* [PATCH] crypto: caam: map job ring registers without claiming region
@ 2026-09-01 20:37 Rosen Penev
2026-09-02 6:10 ` Francesco Dolcini
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Rosen Penev @ 2026-09-01 20:37 UTC (permalink / raw)
To: linux-crypto
Cc: Horia Geantă,
Pankaj Gupta, Gaurav Jain, Herbert Xu, David S. Miller,
Rosen Penev, open list
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@gmail.com>
---
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam: map job ring registers without claiming region
2026-09-01 20:37 [PATCH] crypto: caam: map job ring registers without claiming region Rosen Penev
@ 2026-09-02 6:10 ` Francesco Dolcini
2026-09-02 7:55 ` Emanuele Ghidoli
2026-09-07 15:35 ` Richard Leitner
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Francesco Dolcini @ 2026-09-02 6:10 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-crypto, Horia Geantă,
Pankaj Gupta, Gaurav Jain, Herbert Xu, David S. Miller,
open list, Emanuele Ghidoli
+ Emanuele
On Tue, Sep 01, 2026 at 01:37:36PM -0700, Rosen Penev wrote:
> 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@gmail.com>
Reported-by: Emanuele Ghidoli <ghidoliemanuele@gmail.com>
Closes: https://lore.kernel.org/lkml/20260901194524.908240-1-ghidoliemanuele@gmail.com/
Thanks,
Francesco
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam: map job ring registers without claiming region
2026-09-02 6:10 ` Francesco Dolcini
@ 2026-09-02 7:55 ` Emanuele Ghidoli
0 siblings, 0 replies; 7+ messages in thread
From: Emanuele Ghidoli @ 2026-09-02 7:55 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-crypto, Horia Geantă,
Pankaj Gupta, Gaurav Jain, Herbert Xu, David S. Miller,
open list, Francesco Dolcini, Emanuele Ghidoli
On 9/2/26 08:10, Francesco Dolcini wrote:
> + Emanuele
>
> On Tue, Sep 01, 2026 at 01:37:36PM -0700, Rosen Penev wrote:
>> 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@gmail.com>
>
> Reported-by: Emanuele Ghidoli <ghidoliemanuele@gmail.com>
> Closes: https://lore.kernel.org/lkml/20260901194524.908240-1-ghidoliemanuele@gmail.com/
>
> Thanks,
> Francesco
Tested on colibri-imx7.
Tested-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Thanks,
Emanuele
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam: map job ring registers without claiming region
2026-09-01 20:37 [PATCH] crypto: caam: map job ring registers without claiming region Rosen Penev
2026-09-02 6:10 ` Francesco Dolcini
@ 2026-09-07 15:35 ` Richard Leitner
2026-09-15 12:15 ` Richard Leitner
2026-09-14 16:21 ` [EXT] " Sahil Malhotra
2026-09-16 9:58 ` Herbert Xu
3 siblings, 1 reply; 7+ messages in thread
From: Richard Leitner @ 2026-09-07 15:35 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-crypto, Horia Geantă,
Pankaj Gupta, Gaurav Jain, Herbert Xu, David S. Miller,
open list
Hi Rosen,
On Tue, Sep 01, 2026 at 01:37:36PM -0700, Rosen Penev wrote:
> 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@gmail.com>
thanks for that fix!
Tested-by: Richard Leitner <richard.leitner@linux.dev> # i.MX8MP
regards;rl
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [EXT] [PATCH] crypto: caam: map job ring registers without claiming region
2026-09-01 20:37 [PATCH] crypto: caam: map job ring registers without claiming region Rosen Penev
2026-09-02 6:10 ` Francesco Dolcini
2026-09-07 15:35 ` Richard Leitner
@ 2026-09-14 16:21 ` Sahil Malhotra
2026-09-16 9:58 ` Herbert Xu
3 siblings, 0 replies; 7+ messages in thread
From: Sahil Malhotra @ 2026-09-14 16:21 UTC (permalink / raw)
To: Rosen Penev, linux-crypto
Cc: Horia Geanta, Pankaj Gupta, Gaurav Jain, Herbert Xu,
David S. Miller, open list
[-- Attachment #1: Type: text/plain, Size: 3208 bytes --]
Hi Rosen,
Thanks for the fix.
Tested-by: Sahil Malhotra <sahil.malhotra@nxp.com> # i.MX8MM-EVK
> -----Original Message-----
> From: Rosen Penev <rosenp@gmail.com>
> Sent: 02 September 2026 02:08
> To: linux-crypto@vger.kernel.org
> Cc: Horia Geanta <horia.geanta@nxp.com>; Pankaj Gupta
> <pankaj.gupta@nxp.com>; Gaurav Jain <gaurav.jain@nxp.com>; Herbert Xu
> <herbert@gondor.apana.org.au>; David S. Miller <davem@davemloft.net>;
Rosen
> Penev <rosenp@gmail.com>; open list <linux-kernel@vger.kernel.org>
> 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@gmail.com>
> ---
> 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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 11208 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam: map job ring registers without claiming region
2026-09-07 15:35 ` Richard Leitner
@ 2026-09-15 12:15 ` Richard Leitner
0 siblings, 0 replies; 7+ messages in thread
From: Richard Leitner @ 2026-09-15 12:15 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-crypto, Horia Geantă,
Pankaj Gupta, Gaurav Jain, Herbert Xu, David S. Miller,
open list
Hi everybody,
just a friendly reminder that this patch is now on the mailing list for
14 days and was not included in the 2 rc's which were released since then.
As this essentially breaks CAAM on multiple i.MX SoC variants, is there
any possibility to get this included in v7.3-rc4?
Would be great :-)
Thanks!
regards;rl
On Mon, Sep 07, 2026 at 05:35:51PM +0200, Richard Leitner wrote:
> Hi Rosen,
>
> On Tue, Sep 01, 2026 at 01:37:36PM -0700, Rosen Penev wrote:
> > 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@gmail.com>
>
> thanks for that fix!
>
> Tested-by: Richard Leitner <richard.leitner@linux.dev> # i.MX8MP
>
> regards;rl
>
> > ---
> > 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
> >
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: caam: map job ring registers without claiming region
2026-09-01 20:37 [PATCH] crypto: caam: map job ring registers without claiming region Rosen Penev
` (2 preceding siblings ...)
2026-09-14 16:21 ` [EXT] " Sahil Malhotra
@ 2026-09-16 9:58 ` Herbert Xu
3 siblings, 0 replies; 7+ messages in thread
From: Herbert Xu @ 2026-09-16 9:58 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-crypto, Horia Geantă,
Pankaj Gupta, Gaurav Jain, David S. Miller, open list
On Tue, Sep 01, 2026 at 01:37:36PM -0700, Rosen Penev wrote:
> 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@gmail.com>
> ---
> drivers/crypto/caam/jr.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-09-16 9:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 20:37 [PATCH] crypto: caam: map job ring registers without claiming region Rosen Penev
2026-09-02 6:10 ` Francesco Dolcini
2026-09-02 7:55 ` Emanuele Ghidoli
2026-09-07 15:35 ` Richard Leitner
2026-09-15 12:15 ` Richard Leitner
2026-09-14 16:21 ` [EXT] " Sahil Malhotra
2026-09-16 9:58 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®