mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Horia Geantă" <horia.geanta@nxp.com>
To: ZHIZHIKIN Andrey <andrey.zhizhikin@leica-geosystems.com>,
	Michael Walle <michael@walle.cc>
Cc: Pankaj Gupta <pankaj.gupta@nxp.com>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Iuliana Prodan <iuliana.prodan@nxp.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-imx <linux-imx@nxp.com>
Subject: Re: [PATCH v2 2/2] crypto: caam - check jr permissions before probing
Date: Thu, 18 Nov 2021 02:47:47 +0200	[thread overview]
Message-ID: <59c04d9d-7acf-5468-1382-ce22bff8292d@nxp.com> (raw)
In-Reply-To: <AM6PR06MB46914ECA12815ABFCE8C1A59A6989@AM6PR06MB4691.eurprd06.prod.outlook.com>

On 11/15/2021 12:07 PM, ZHIZHIKIN Andrey wrote:
> Hello Michael,
> 
>> -----Original Message-----
>> From: Michael Walle <michael@walle.cc>
>> Sent: Friday, November 12, 2021 10:18 PM
>> To: ZHIZHIKIN Andrey <andrey.zhizhikin@leica-geosystems.com>
>> Cc: horia.geanta@nxp.com; pankaj.gupta@nxp.com;
>> herbert@gondor.apana.org.au; davem@davemloft.net;
>> iuliana.prodan@nxp.com; linux-crypto@vger.kernel.org; linux-
>> kernel@vger.kernel.org
>> Subject: Re: [PATCH v2 2/2] crypto: caam - check jr permissions before probing
>>
>>
>> Am 2021-11-11 17:46, schrieb Andrey Zhizhikin:
>>> Job Rings can be set to be exclusively used by TrustZone which makes
>>> the access to those rings only possible from Secure World. This access
>>> separation is defined by setting bits in CAAM JRxDID_MS register. Once
>>> reserved to be owned by TrustZone, this Job Ring becomes unavailable
>>> for the Kernel. This reservation is performed early in the boot
>>> process, even before the Kernel starts, which leads to unavailability
>>> of the HW at the probing stage. Moreover, the reservation can be done
>>> for any Job Ring and is not under control of the Kernel.
>>>
>>> Current implementation lists Job Rings as child nodes of CAAM driver,
>>> and tries to perform probing on those regardless of whether JR HW is
>>> accessible or not.
>>>
>>> This leads to the following error while probing:
>>> [    1.509894] caam 30900000.crypto: job rings = 3, qi = 0
>>> [    1.525201] caam_jr 30901000.jr: failed to flush job ring 0
>>> [    1.525214] caam_jr: probe of 30901000.jr failed with error -5
>>>
>>> Implement a dynamic mechanism to identify which Job Ring is actually
>>> marked as owned by TrustZone, and fail the probing of those child
>>> nodes with -ENODEV.
>>
>> For other reviewers/maintainers: I'm still not sure this is the way to go. Instead
>> one can let u-boot fix up the device tree and remove or disable the JR node if its
>> not available.
> 
> Just as further clarification: this patch is intended to accommodate for cases where
> JR is claimed in S world at the boot and not available for Kernel. It does not account
> for fully dynamic cases, where JRs can be reclaimed between S <-> NS Worlds
> during runtime. It rather accounts for situation when any arbitrary JR can be reserved
> by any software entity before Kernel starts without a need to disable nodes at
> compile time.
> 
I prefer f/w to fix the DT before passing it to the kernel,
either by adding the "secure-status" property (set explicitly to "disabled")
or by removing the job ring node(s) that are reserved.
OP-TEE already uses the first option. We should probably pick this up.

The reason I am supporting relying on DT and consequently avoiding registers
is that accessing page 0 in the caam register space from Non-secure world
should be avoided when caam is managed by Secure world (e.g. OP-TEE)
or a Secure Enclave (e.g. SECO).

Unfortunately support for HW-enforced access control for caam register space
is not that great / fine-grained, with the exception of more recent parts
like i.MX8MP and i.MX8ULP.

Horia

  parent reply	other threads:[~2021-11-18  0:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 16:21 [PATCH] " Andrey Zhizhikin
2021-11-05  1:20 ` Michael Walle
2021-11-05 10:34   ` ZHIZHIKIN Andrey
2021-11-05 23:16     ` Michael Walle
2021-11-08 10:24       ` ZHIZHIKIN Andrey
2021-11-08 16:13         ` Michael Walle
2021-11-10  9:33           ` ZHIZHIKIN Andrey
2021-11-12 18:55             ` Michael Walle
2021-11-15  9:38               ` ZHIZHIKIN Andrey
2021-11-15 11:40                 ` Michael Walle
2021-11-11 16:45 ` [PATCH v2 0/2] CAAM Driver: re-factor and dynamic JR availability check Andrey Zhizhikin
2021-11-11 16:46   ` [PATCH v2 1/2] crypto: caam - convert to use capabilities Andrey Zhizhikin
2021-11-12 19:22     ` Michael Walle
2021-11-15  9:45       ` ZHIZHIKIN Andrey
2021-11-11 16:46   ` [PATCH v2 2/2] crypto: caam - check jr permissions before probing Andrey Zhizhikin
2021-11-12 21:17     ` Michael Walle
2021-11-15 10:07       ` ZHIZHIKIN Andrey
2021-11-15 11:17         ` Michael Walle
2021-11-18  0:47         ` Horia Geantă [this message]
2021-11-18  8:28           ` Michael Walle
2021-11-18 10:08             ` ZHIZHIKIN Andrey
2021-11-18 10:11               ` Michael Walle
2021-12-07 23:02   ` [PATCH v3 0/2] CAAM Driver: re-factor and set proper JR status Andrey Zhizhikin
2021-12-07 23:02     ` [PATCH v3 1/2] crypto: caam - convert to use capabilities Andrey Zhizhikin
2021-12-07 23:02     ` [PATCH v3 2/2] arm64: dts: imx8m: define proper status for caam jr Andrey Zhizhikin
2022-01-06 11:26       ` Rouven Czerwinski
2022-01-06 14:08         ` ZHIZHIKIN Andrey
2022-01-07  9:46           ` Rouven Czerwinski
2022-01-07 10:40             ` ZHIZHIKIN Andrey
2022-01-07 11:55               ` Rouven Czerwinski
2022-01-08 20:48                 ` ZHIZHIKIN Andrey
2022-01-07 11:47             ` Michael Walle
2022-01-07 11:58               ` Lucas Stach
2022-01-07 12:05                 ` Michael Walle
2022-01-06 10:56     ` [PATCH v3 0/2] CAAM Driver: re-factor and set proper JR status ZHIZHIKIN Andrey
2022-01-07  2:36       ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59c04d9d-7acf-5468-1382-ce22bff8292d@nxp.com \
    --to=horia.geanta@nxp.com \
    --cc=andrey.zhizhikin@leica-geosystems.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=iuliana.prodan@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=pankaj.gupta@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®