Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto/NX: Set receive window credits to max number of CRBs in RxFIFO

System gets checkstop if RxFIFO overruns with more requests than the
maximum possible number of CRBs in FIFO at the same time. The max number
of requests per window is controlled by window credits. So find max
CRBs from FIFO size and set it to receive window credits.

Fixes: b0d6c9bab5e4 ("crypto/nx: Add P9 NX support for 842 compression engine")
CC: stable@vger.kernel.org # v4.14+
Signed-off-by:Haren Myneni <haren@us.ibm.com>

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Haren Myneni and committed by
Herbert Xu
e52d484d 90acc065

+5 -3
+5 -3
drivers/crypto/nx/nx-842-powernv.c
··· 36 36 #define WORKMEM_ALIGN (CRB_ALIGN) 37 37 #define CSB_WAIT_MAX (5000) /* ms */ 38 38 #define VAS_RETRIES (10) 39 - /* # of requests allowed per RxFIFO at a time. 0 for unlimited */ 40 - #define MAX_CREDITS_PER_RXFIFO (1024) 41 39 42 40 struct nx842_workmem { 43 41 /* Below fields must be properly aligned */ ··· 819 821 rxattr.lnotify_lpid = lpid; 820 822 rxattr.lnotify_pid = pid; 821 823 rxattr.lnotify_tid = tid; 822 - rxattr.wcreds_max = MAX_CREDITS_PER_RXFIFO; 824 + /* 825 + * Maximum RX window credits can not be more than #CRBs in 826 + * RxFIFO. Otherwise, can get checkstop if RxFIFO overruns. 827 + */ 828 + rxattr.wcreds_max = fifo_size / CRB_SIZE; 823 829 824 830 /* 825 831 * Open a VAS receice window which is used to configure RxFIFO