Re: [PATCH v18 6/7] crypto: caam: cleanup CONFIG_64BIT ifdefs when using io{read|write}64
From: Fabio Estevam
Date: Tue Jul 03 2018 - 19:52:46 EST
On Tue, Jul 3, 2018 at 8:20 PM, Logan Gunthorpe <logang@xxxxxxxxxxxx> wrote:
> Oh. So some IO in some other place must have changed to trigger the BUG...
Yes, there are two 64-bit write operations inside caam_jr_init().
If I use the old 64-bit write function then things works fine:
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -384,6 +384,17 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
}
EXPORT_SYMBOL(caam_jr_enqueue);
+static inline void wr_reg64old(void __iomem *reg, u64 data)
+{
+ if (!caam_imx && caam_little_end) {
+ wr_reg32((u32 __iomem *)(reg) + 1, data >> 32);
+ wr_reg32((u32 __iomem *)(reg), data);
+ } else {
+ wr_reg32((u32 __iomem *)(reg), data >> 32);
+ wr_reg32((u32 __iomem *)(reg) + 1, data);
+ }
+}
+
/*
* Init JobR independent of platform property detection
*/
@@ -434,8 +445,8 @@ static int caam_jr_init(struct device *dev)
jrp->head = 0;
jrp->tail = 0;
- wr_reg64(&jrp->rregs->inpring_base, inpbusaddr);
- wr_reg64(&jrp->rregs->outring_base, outbusaddr);
+ wr_reg64old(&jrp->rregs->inpring_base, inpbusaddr);
+ wr_reg64old(&jrp->rregs->outring_base, outbusaddr);
wr_reg32(&jrp->rregs->inpring_size, JOBR_DEPTH);
wr_reg32(&jrp->rregs->outring_size, JOBR_DEPTH);