RE: [EXT] [PATCH] crypto: caam: map job ring registers without claiming region

From: Sahil Malhotra

Date: Mon Sep 14 2026 - 12:21:31 EST


Hi Rosen,

Thanks for the fix.

Tested-by: Sahil Malhotra <sahil.malhotra@xxxxxxx> # i.MX8MM-EVK

> -----Original Message-----
> From: Rosen Penev <rosenp@xxxxxxxxx>
> Sent: 02 September 2026 02:08
> To: linux-crypto@xxxxxxxxxxxxxxx
> Cc: Horia Geanta <horia.geanta@xxxxxxx>; Pankaj Gupta
> <pankaj.gupta@xxxxxxx>; Gaurav Jain <gaurav.jain@xxxxxxx>; Herbert Xu
> <herbert@xxxxxxxxxxxxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>;
Rosen
> Penev <rosenp@xxxxxxxxx>; open list <linux-kernel@xxxxxxxxxxxxxxx>
> Subject: [EXT] [PATCH] crypto: caam: map job ring registers without
claiming
> region
>
> Caution: This is an external email. Please take care when clicking links
or opening
> attachments. When in doubt, report the message using the 'Report this
email'
> button
>
>
> devm_platform_ioremap_resource() ends up calling request_mem_region(),
> which fails with -EBUSY on i.MX SoCs:
>
> There the job rings are modelled as sub-regions of their parent
> fsl,sec-v4.0 register window, and caam_probe() already reserves the whole
> window exclusively via devm_of_iomap() before the children are populated.
> Every job ring therefore collides with its own parent and fails to probe,
taking the
> hardware RNG offline (seen on i.MX6, i.MX7 and i.MX8 boards such as
colibri-
> imx7 and verdin-imx8mp).
>
> Map the job ring registers with devm_ioremap() instead, which does not
claim the
> (already owned) region.
>
> Fixes: 9a955c0a7d11 ("crypto: caam - simplify probe resource and IRQ
handling")
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
> drivers/crypto/caam/jr.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index
> f9e029945b51..2ed8229d4733 100644
> --- a/drivers/crypto/caam/jr.c
> +++ b/drivers/crypto/caam/jr.c
> @@ -583,12 +583,29 @@ static int caam_jr_probe(struct platform_device
> *pdev)
> struct caam_drv_private_jr *jrpriv;
> static int total_jobrs;
> void __iomem *ctrl;
> + struct resource *r;
> int error;
> int irq;
>
> - ctrl = devm_platform_ioremap_resource(pdev, 0);
> - if (IS_ERR(ctrl))
> - return PTR_ERR(ctrl);
> + /*
> + * The job rings live inside the register window of their parent
> + * fsl,sec-v4.0 node, which caam_probe() already reserves (and
maps)
> + * via devm_of_iomap(). A requested region that overlaps that
> + * reservation, e.g. from devm_platform_ioremap_resource(), would
> + * therefore fail with -EBUSY, so map the registers without
claiming
> + * the region here.
> + */
> + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!r) {
> + dev_err(&pdev->dev, "platform_get_resource() failed\n");
> + return -EINVAL;
> + }
> +
> + ctrl = devm_ioremap(&pdev->dev, r->start, resource_size(r));
> + if (!ctrl) {
> + dev_err(&pdev->dev, "devm_ioremap() failed\n");
> + return -ENOMEM;
> + }
>
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> --
> 2.55.0
>

Attachment: smime.p7s
Description: S/MIME cryptographic signature