From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87AB7199920; Wed, 18 Feb 2026 20:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771444986; cv=none; b=TwLGjGPjE4QEJ/ptoONONNzLT5kdFEjVvLnIxALE1HaGpH6jEwENG81SQLNoNE0Zti7xAJTELDEBJrmWMr8GQbgYZFGhvqhOVIyoLTHWU2TXzt/eE4QVSN5ljDeACrwHnwtcC5amk/dIESAUOVSxu9eNCW1UAG0+/OO77HKNvPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771444986; c=relaxed/simple; bh=x74pCM8g+AY+IDvVyRtaHl/FTxvqT89D/tM1i9imlbg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Efn6fQushwOh8Tk/ZSqkt7ulmqpOM3p2KX0Qs/vIFJunjhV6OHThI2teBYvp75cMrJZGJKi1TtQHRRcHR5H2LH20FodSg2i0uSrrZifK33MfA6ltdDHwT/HESRDFOWSEA0dBdPohrrKBdZF0I/bKnZSv1a9+Hr8iFQsclAlt9n0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AOfw8yPk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AOfw8yPk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 106CDC116D0; Wed, 18 Feb 2026 20:03:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771444986; bh=x74pCM8g+AY+IDvVyRtaHl/FTxvqT89D/tM1i9imlbg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=AOfw8yPkYUVfE0XzMMnTFWb8x0XKa2txAwWs2tZFiN24w2OoQevCM7rmbFLGAw8bu 6rqHJ1sxhHf16gOspxOAWXfVj+Oz+SVlfifIm2NpWmixM1abunvsdBkKm9TGSMrUMx /ZDder/ip+O5T8lBZuG1ui29GSyEoYJSRd+6/ifO5FIpfMBcbT+8uQQ2zPHIKm67fM BQRPHOTT5pJxfk+MvYlomFLd/CYl8FWAj2eC7dcHCv42FDXwyv3QTkn9WyMsEBEyIy druZOh8uev8KLqSO71szxxaPrVqpcwvesoNu4v9/29M6T+/Mom9euEbm/r9VZcQufH B2/OlQJNysewQ== Message-ID: Date: Wed, 18 Feb 2026 21:03:02 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/7] dt-bindings: soc: st: document the RISAB firewall peripheral To: Gatien CHEVALLIER , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue Cc: devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260209-stm32_risab-v1-0-ef0b2b6a7e0a@foss.st.com> <20260209-stm32_risab-v1-1-ef0b2b6a7e0a@foss.st.com> <516036b6-b825-4a29-a48a-5d3af3234968@foss.st.com> <66ecf6a5-cc1f-4872-971d-6bc32894dbac@foss.st.com> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzk@kernel.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAOb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Wmu 4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB YpsFAmgXUF8FCRaWWyoACgkQG5NDfTtBYptO0w//dlXJs5/42hAXKsk+PDg3wyEFb4NpyA1v qmx7SfAzk9Hf6lWwU1O6AbqNMbh6PjEwadKUk1m04S7EjdQLsj/MBSgoQtCT3MDmWUUtHZd5 RYIPnPq3WVB47GtuO6/u375tsxhtf7vt95QSYJwCB+ZUgo4T+FV4hquZ4AsRkbgavtIzQisg Dgv76tnEv3YHV8Jn9mi/Bu0FURF+5kpdMfgo1sq6RXNQ//TVf8yFgRtTUdXxW/qHjlYURrm2 H4kutobVEIxiyu6m05q3e9eZB/TaMMNVORx+1kM3j7f0rwtEYUFzY1ygQfpcMDPl7pRYoJjB dSsm0ZuzDaCwaxg2t8hqQJBzJCezTOIkjHUsWAK+tEbU4Z4SnNpCyM3fBqsgYdJxjyC/tWVT AQ18NRLtPw7tK1rdcwCl0GFQHwSwk5pDpz1NH40e6lU+NcXSeiqkDDRkHlftKPV/dV+lQXiu jWt87ecuHlpL3uuQ0ZZNWqHgZoQLXoqC2ZV5KrtKWb/jyiFX/sxSrodALf0zf+tfHv0FZWT2 zHjUqd0t4njD/UOsuIMOQn4Ig0SdivYPfZukb5cdasKJukG1NOpbW7yRNivaCnfZz6dTawXw XRIV/KDsHQiyVxKvN73bThKhONkcX2LWuD928tAR6XMM2G5ovxLe09vuOzzfTWQDsm++9UKF a/A= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 18/02/2026 11:38, Gatien CHEVALLIER wrote: > > > On 2/17/26 21:06, Krzysztof Kozlowski wrote: >> On 17/02/2026 14:12, Gatien CHEVALLIER wrote: >>> >>> >>> On 2/13/26 16:06, Krzysztof Kozlowski wrote: >>>> On 10/02/2026 10:55, Gatien CHEVALLIER wrote: >>>>>>> + memory-region: >>>>>>> + minItems: 1 >>>>>>> + maxItems: 32 >>>>>>> + description: >>>>>>> + Phandle to nodes describing memory regions to be configured in the RISAB >>>>>>> + by the trusted domain of at least a RISAB page size. >>>>>>> + These regions cannot overlap. A zone must be within st,mem-map range and >>>>>>> + can be represented by one or more pages. >>>>>>> + >>>>>>> + st,mem-map: >>>>>>> + $ref: /schemas/types.yaml#/definitions/uint32-array >>>>>>> + description: Memory address range covered by the RISAB. >>>>>>> + items: >>>>>>> + - description: Memory range base address >>>>>>> + - description: Memory range size >>>>>> >>>>>> Why do you need this property if you have memory-region already? This >>>>>> also should be part of , although this mixing with memory-region is >>>>>> anyway confusing. >>>>>> >>>>> >>>>> The RISAB is a memory firewall peripheral covering internal RAMs. It is >>>>> possible to configure multiple memory regions within these RAMs (done by >>>>> the Trusted Domain) with security, privilege and compartment isolation. >>>>> This peripheral allow 4kBytes page granularity. Each page can hold >>>>> different access rights, with 32 pages at most (hence the maxItems: 32). >>>>> That is some information that can be added to the documentation. >>>>> >>>>> Moreover, when a region is delegated to a non-secure privileged >>>>> component, this component can configure the privilege level necessary to >>>>> access the region. >>>>> >>>>> This property gives me the opportunity to get the memory range covered >>>>> by the RISAB. "reg" here is used to access the actual RISAB registers >>>>> holding the configuration. >>>> >>>> Looks awfully like memory regions still :/ >>>> >>> >>> IIUC the memory-region property references memory regions within >>> a reserved memory. Which is not really what I want to describe >>> here as I want to get the boundaries of the whole range. The >>> memory-region property would be used by the Trusted Domain / kernel >>> to get each regions (or only one that represents the whole range) of the >>> internal RAM to apply desired access rights to them / use them. >>> >>> Describing the memory range using a reserved memory would make the >>> kernel exclude this memory range from the normal usage, no? >> >> In general yes, but also depends on the use case/drivers/purpose. I do >> not understand why would you mark some memory for generic use by kernel >> (so not reserved for specific purpose) and still configure it somehow >> for trusted firmware to allow secure read/write access. >> >> If you mark some part of memory as a meaning for TF for secure access, >> you already claim it is not a generic memory. Otherwise TF just writes >> all over malloced() pages? >> > > While the Trusted Domain applies the configuration, it is entirely > possible for the Trusted domain to give himself access to, let's say, > the first RISAB page to store whatever data, and give the rest to the > kernel. Actually, this is what we do to store OTP data mirrors And what happens with the rest of that memory? Why the first page cannot be the reserved region? > or DDR context and give the rest to the kernel or the co-processor. > > Now, using internal RAM for generic use by the kernel is unlikely but > I have in mind the last firewall controller of the stm32mp2x platforms, > which is the RISAF. It has the same purpose as the RISAB but for > external memories. One protects the DDR so I do want DDR regions as > accessible for general use (memory node). > > This property allows me to describe the boundaries of what is protected > without having to imply anything from frameworks about the regions as I > have no way of knowing what is accessible and what is not. Frameworks do not matter here - we don't even talk about them yet. You want to describe boundaries of some dedicated memory region and you should not have a custom property for that. > >>> >>> I think declaring a "boundaries" memory region with no usage for the >>> kernel wouldn't make sense. The kernel may not be able to access the >>> whole memory range. >> >> I don't understand that. reserved-memory is for cases with "no usage for >> the kernel", so it would perfectly make sense. > >> >> Look what your description said: >> >> "used to protect internal RAMs by applying access" > > Yes, access rights are applied by the Trusted Domain. These firewalls > are very flexible because access rights on secure and privilege levels > along with Compartment ID (SoC is divided into multiple compartments > holding a compartment ID) can be configured. Some bits of the > firewall configuration can also be delegated. e.g: When a memory > region is configured for privileged, non-secure access for the > cortex running Linux; then the kernel could reconfigure the > privilege level (unlikely but feasible). > > It would be quite complex to explain the whole mechanism without > pointing to some documentation [1]. > > Anyway, access rights are applied, but access may very well be given to > the privileged non-secure compartment running the kernel. Meaning that > only the kernel can access such memory. Not the Trusted Domain, not the > user-space, not the co-processor. This implies that if you do not reserve such memory that way, then Trusted Domain or user-space could just poke and use it... If kernel explicitly has to tell TD to do something with specific region of memory, this is somehow a reserved memory. It is distinctive, special, selected, chosen. > > So you could give some bits of internal RAM to the kernel for whatever > purpose you'd like (Storing particular data you want to keep in some > low-power mode, etc...). All RAM is for that purpose... > > > [1]: https://wiki.st.com/stm32mpu/wiki/Resource_Isolation_Framework_overview > >> >> and >> >> " a trusted domain, or the domain to whom the page configuration has >> been delegated," >> >> so how it is not a dedicated, special memory delegated to specific >> devices and/or TF? >> > > The memory is delegated to some contexts. These can be the processor > running Linux, a co-processor, some initiator ports of peripherals > having DMAs, etc... > So pretty close to what the purpose of reserved-memory is... Well, we keep discussing and I am really not convinced. You can try to catch @Rob tomorrow on IRC and maybe get his approval, but for me this is clearly some sort of reserved memory thus you cannot go with own bindings. Another way would be to prove me wrong by using the reserved memory binding and showing how it could not possible work, ever (such counter examples sometimes help to look at the problem from a new angle). Best regards, Krzysztof