All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin GAIGNARD <benjamin.gaignard@st.com>
To: Robin Murphy <robin.murphy@arm.com>, Sudeep Holla <sudeep.holla@arm.com>
Cc: "broonie@kernel.org" <broonie@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"fabio.estevam@nxp.com" <fabio.estevam@nxp.com>,
	"lkml@metux.net" <lkml@metux.net>,
	Loic PALLARDY <loic.pallardy@st.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-imx@nxp.com" <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"system-dt@lists.openampproject.org" 
	<system-dt@lists.openampproject.org>,
	"stefano.stabellini@xilinx.com" <stefano.stabellini@xilinx.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH v2 0/7] Introduce bus firewall controller framework
Date: Mon, 3 Feb 2020 13:16:02 +0000	[thread overview]
Message-ID: <df6fcb24-2357-af1d-8060-1a9ca0064758@st.com> (raw)
In-Reply-To: <3624ec3e-b06a-907d-ebfa-8516b14cb306@arm.com>


On 1/31/20 7:25 PM, Robin Murphy wrote:
> On 29/01/2020 1:40 pm, Benjamin GAIGNARD wrote:
>>
>> On 1/28/20 11:06 PM, Robin Murphy wrote:
>>> On 2020-01-28 8:06 pm, Benjamin GAIGNARD wrote:
>>>>
>>>> On 1/28/20 6:17 PM, Sudeep Holla wrote:
>>>>> On Tue, Jan 28, 2020 at 04:46:41PM +0000, Benjamin GAIGNARD wrote:
>>>>>> On 1/28/20 5:36 PM, Sudeep Holla wrote:
>>>>>>> On Tue, Jan 28, 2020 at 04:37:59PM +0100, Benjamin Gaignard wrote:
>>>>>>>> Bus firewall framework aims to provide a kernel API to set the
>>>>>>>> configuration
>>>>>>>> of the harware blocks in charge of busses access control.
>>>>>>>>
>>>>>>>> Framework architecture is inspirated by pinctrl framework:
>>>>>>>> - a default configuration could be applied before bind the driver.
>>>>>>>>       If a configuration could not be applied the driver is not 
>>>>>>>> bind
>>>>>>>>       to avoid doing accesses on prohibited regions.
>>>>>>>> - configurations could be apllied dynamically by drivers.
>>>>>>>> - device node provides the bus firewall configurations.
>>>>>>>>
>>>>>>>> An example of bus firewall controller is STM32 ETZPC hardware 
>>>>>>>> block
>>>>>>>> which got 3 possible configurations:
>>>>>>>> - trust: hardware blocks are only accessible by software running
>>>>>>>> on trust
>>>>>>>>       zone (i.e op-tee firmware).
>>>>>>>> - non-secure: hardware blocks are accessible by non-secure
>>>>>>>> software (i.e.
>>>>>>>>       linux kernel).
>>>>>>>> - coprocessor: hardware blocks are only accessible by the
>>>>>>>> coprocessor.
>>>>>>>> Up to 94 hardware blocks of the soc could be managed by ETZPC.
>>>>>>>>
>>>>>>> /me confused. Is ETZPC accessible from the non-secure kernel 
>>>>>>> space to
>>>>>>> begin with ? If so, is it allowed to configure hardware blocks as
>>>>>>> secure
>>>>>>> or trusted ? I am failing to understand the overall design of a
>>>>>>> system
>>>>>>> with ETZPC controller.
>>>>>> Non-secure kernel could read the values set in ETZPC, if it doesn't
>>>>>> match
>>>>>> with what is required by the device node the driver won't be probed.
>>>>>>
>>>>> OK, but I was under the impression that it was made clear that 
>>>>> Linux is
>>>>> not firmware validation suite. The firmware need to ensure all the
>>>>> devices
>>>>> that are not accessible in the Linux kernel are marked as disabled 
>>>>> and
>>>>> this needs to happen before entering the kernel. So if this is what
>>>>> this
>>>>> patch series achieves, then there is no need for it. Please stop
>>>>> pursuing
>>>>> this any further or provide any other reasons(if any) to have it. 
>>>>> Until
>>>>> you have other reasons, NACK for this series.
>>>>
>>>> No it doesn't disable the nodes.
>>>>
>>>> When the firmware disable a node before the kernel that means it 
>>>> change
>>>>
>>>> the DTB and that is a problem when you want to sign it. With my 
>>>> proposal
>>>>
>>>> the DTB remains the same.
>>>
>>> ???
>>>
>>> :/
>>>
>>> The DTB is used to pass the kernel command line, memory reservations,
>>> random seeds, and all manner of other things dynamically generated by
>>> firmware at boot-time. Apologies for being blunt but if "changing the
>>> DTB" is considered a problem then I can't help but think you're doing
>>> it wrong.
>>
>> Yes but I would like to limit the number of cases where a firmware has
>> to change the DTB.
>
> Sure, but unless you can limit that number to strictly zero, then 
> presumably the firmware must have the general capability to verify, 
> modify, and re-sign a DTB. At that point having it also tweak the 
> status of nodes that it wants for itself doesn't seem like a 
> particularly big ask.
>
>> With this proposal nodes remain the same and embedded the firewall
>> configuration(s).
>>
>> Until now firewall configuration is "static", the firmware disable (or
>> remove) the nodes not accessible from Linux.
>>
>> If Linux can rely on node's firewall information it could allow switch
>> dynamically an hardware block from Linux to a coprocessor.
>>
>> For example Linux could manage the display pipe configuration and when
>> going to suspend handover the display hardware block to a coprocessor in
>> charge a refreshing only some pixels.
>
> And like I'm sure I said before, the interface between Linux and the 
> Secure environment to ultimately achieve that will almost certainly 
> make inspecting a passive status bit in a register redundant anyway.

It is not only about secure and non secure hardware blocks split but 
also about the split with the coprocessor.

The goal is to describe, in the device tree, these possible 
configurations to be able to use them dynamically rather than

having a static configuration. It could also help to detect 
misconfiguration between the firewall and the DT nodes.

>
> In the interest of being productive, though, there is another way of 
> looking at this. If we drop the pretence that it's in any way generic 
> or ever going to be relevant beyond certain configurations of certain 
> STMicro SoCs, then in plain terms it's just some block of MMIO 
> registers that have *something* to do with various other devices. At 
> that point, the answer is just to treat it as a syscon and make the 
> relevant drivers for those SoCs aware of it. I'm most familiar with 
> the "General Register File" on Rockchip SoCs as a prime example of 
> "bunch of registers that relate to the integration of various IP 
> blocks", which manages to be supported just fine without invasive 
> hooks in the driver core.

I had thought to use syscon but there is some problems with that way: if 
the firewall hardware change the way it encode the information you have 
change all it customers. That would mean add in each driver a test to 
detect the firewall version and act accordingly. That doesn't sound 
reasonable to me so I decide to create an interface to abstract the 
firewall to avoid this problem.

I could reuse this interface in the ~40 impacted drivers (not all 
dedicated to STMicro SoCs) but adding it in the driver core as a generic 
service was making more sens for me. Note that I have take care of using 
a compilation flag to not impact the others architectures.

Benjamin

>
> Robin.

WARNING: multiple messages have this Message-ID (diff)
From: Benjamin GAIGNARD <benjamin.gaignard@st.com>
To: Robin Murphy <robin.murphy@arm.com>, Sudeep Holla <sudeep.holla@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	"robh@kernel.org" <robh@kernel.org>,
	Loic PALLARDY <loic.pallardy@st.com>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"system-dt@lists.openampproject.org"
	<system-dt@lists.openampproject.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"lkml@metux.net" <lkml@metux.net>,
	"linux-imx@nxp.com" <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"fabio.estevam@nxp.com" <fabio.estevam@nxp.com>,
	"stefano.stabellini@xilinx.com" <stefano.stabellini@xilinx.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 0/7] Introduce bus firewall controller framework
Date: Mon, 3 Feb 2020 13:16:02 +0000	[thread overview]
Message-ID: <df6fcb24-2357-af1d-8060-1a9ca0064758@st.com> (raw)
In-Reply-To: <3624ec3e-b06a-907d-ebfa-8516b14cb306@arm.com>


On 1/31/20 7:25 PM, Robin Murphy wrote:
> On 29/01/2020 1:40 pm, Benjamin GAIGNARD wrote:
>>
>> On 1/28/20 11:06 PM, Robin Murphy wrote:
>>> On 2020-01-28 8:06 pm, Benjamin GAIGNARD wrote:
>>>>
>>>> On 1/28/20 6:17 PM, Sudeep Holla wrote:
>>>>> On Tue, Jan 28, 2020 at 04:46:41PM +0000, Benjamin GAIGNARD wrote:
>>>>>> On 1/28/20 5:36 PM, Sudeep Holla wrote:
>>>>>>> On Tue, Jan 28, 2020 at 04:37:59PM +0100, Benjamin Gaignard wrote:
>>>>>>>> Bus firewall framework aims to provide a kernel API to set the
>>>>>>>> configuration
>>>>>>>> of the harware blocks in charge of busses access control.
>>>>>>>>
>>>>>>>> Framework architecture is inspirated by pinctrl framework:
>>>>>>>> - a default configuration could be applied before bind the driver.
>>>>>>>>       If a configuration could not be applied the driver is not 
>>>>>>>> bind
>>>>>>>>       to avoid doing accesses on prohibited regions.
>>>>>>>> - configurations could be apllied dynamically by drivers.
>>>>>>>> - device node provides the bus firewall configurations.
>>>>>>>>
>>>>>>>> An example of bus firewall controller is STM32 ETZPC hardware 
>>>>>>>> block
>>>>>>>> which got 3 possible configurations:
>>>>>>>> - trust: hardware blocks are only accessible by software running
>>>>>>>> on trust
>>>>>>>>       zone (i.e op-tee firmware).
>>>>>>>> - non-secure: hardware blocks are accessible by non-secure
>>>>>>>> software (i.e.
>>>>>>>>       linux kernel).
>>>>>>>> - coprocessor: hardware blocks are only accessible by the
>>>>>>>> coprocessor.
>>>>>>>> Up to 94 hardware blocks of the soc could be managed by ETZPC.
>>>>>>>>
>>>>>>> /me confused. Is ETZPC accessible from the non-secure kernel 
>>>>>>> space to
>>>>>>> begin with ? If so, is it allowed to configure hardware blocks as
>>>>>>> secure
>>>>>>> or trusted ? I am failing to understand the overall design of a
>>>>>>> system
>>>>>>> with ETZPC controller.
>>>>>> Non-secure kernel could read the values set in ETZPC, if it doesn't
>>>>>> match
>>>>>> with what is required by the device node the driver won't be probed.
>>>>>>
>>>>> OK, but I was under the impression that it was made clear that 
>>>>> Linux is
>>>>> not firmware validation suite. The firmware need to ensure all the
>>>>> devices
>>>>> that are not accessible in the Linux kernel are marked as disabled 
>>>>> and
>>>>> this needs to happen before entering the kernel. So if this is what
>>>>> this
>>>>> patch series achieves, then there is no need for it. Please stop
>>>>> pursuing
>>>>> this any further or provide any other reasons(if any) to have it. 
>>>>> Until
>>>>> you have other reasons, NACK for this series.
>>>>
>>>> No it doesn't disable the nodes.
>>>>
>>>> When the firmware disable a node before the kernel that means it 
>>>> change
>>>>
>>>> the DTB and that is a problem when you want to sign it. With my 
>>>> proposal
>>>>
>>>> the DTB remains the same.
>>>
>>> ???
>>>
>>> :/
>>>
>>> The DTB is used to pass the kernel command line, memory reservations,
>>> random seeds, and all manner of other things dynamically generated by
>>> firmware at boot-time. Apologies for being blunt but if "changing the
>>> DTB" is considered a problem then I can't help but think you're doing
>>> it wrong.
>>
>> Yes but I would like to limit the number of cases where a firmware has
>> to change the DTB.
>
> Sure, but unless you can limit that number to strictly zero, then 
> presumably the firmware must have the general capability to verify, 
> modify, and re-sign a DTB. At that point having it also tweak the 
> status of nodes that it wants for itself doesn't seem like a 
> particularly big ask.
>
>> With this proposal nodes remain the same and embedded the firewall
>> configuration(s).
>>
>> Until now firewall configuration is "static", the firmware disable (or
>> remove) the nodes not accessible from Linux.
>>
>> If Linux can rely on node's firewall information it could allow switch
>> dynamically an hardware block from Linux to a coprocessor.
>>
>> For example Linux could manage the display pipe configuration and when
>> going to suspend handover the display hardware block to a coprocessor in
>> charge a refreshing only some pixels.
>
> And like I'm sure I said before, the interface between Linux and the 
> Secure environment to ultimately achieve that will almost certainly 
> make inspecting a passive status bit in a register redundant anyway.

It is not only about secure and non secure hardware blocks split but 
also about the split with the coprocessor.

The goal is to describe, in the device tree, these possible 
configurations to be able to use them dynamically rather than

having a static configuration. It could also help to detect 
misconfiguration between the firewall and the DT nodes.

>
> In the interest of being productive, though, there is another way of 
> looking at this. If we drop the pretence that it's in any way generic 
> or ever going to be relevant beyond certain configurations of certain 
> STMicro SoCs, then in plain terms it's just some block of MMIO 
> registers that have *something* to do with various other devices. At 
> that point, the answer is just to treat it as a syscon and make the 
> relevant drivers for those SoCs aware of it. I'm most familiar with 
> the "General Register File" on Rockchip SoCs as a prime example of 
> "bunch of registers that relate to the integration of various IP 
> blocks", which manages to be supported just fine without invasive 
> hooks in the driver core.

I had thought to use syscon but there is some problems with that way: if 
the firewall hardware change the way it encode the information you have 
change all it customers. That would mean add in each driver a test to 
detect the firewall version and act accordingly. That doesn't sound 
reasonable to me so I decide to create an interface to abstract the 
firewall to avoid this problem.

I could reuse this interface in the ~40 impacted drivers (not all 
dedicated to STMicro SoCs) but adding it in the driver core as a generic 
service was making more sens for me. Note that I have take care of using 
a compilation flag to not impact the others architectures.

Benjamin

>
> Robin.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-02-03 13:16 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 15:37 [PATCH v2 0/7] Introduce bus firewall controller framework Benjamin Gaignard
2020-01-28 15:37 ` Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 1/7] dt-bindings: bus: Add firewall bindings Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 2/7] bus: Introduce firewall controller framework Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 15:52   ` Greg KH
2020-01-28 15:52     ` Greg KH
2020-01-28 16:41     ` Benjamin GAIGNARD
2020-01-28 16:41       ` Benjamin GAIGNARD
2020-01-28 16:57       ` Greg KH
2020-01-28 16:57         ` Greg KH
2020-01-28 20:29         ` Benjamin GAIGNARD
2020-01-28 20:29           ` Benjamin GAIGNARD
2020-01-29  5:49           ` Greg KH
2020-01-29  5:49             ` Greg KH
2020-01-29  9:42           ` Linus Walleij
2020-01-29  9:42             ` Linus Walleij
2020-01-29  9:52             ` Greg KH
2020-01-29  9:52               ` Greg KH
2020-01-29 11:17               ` Mark Brown
2020-01-29 11:17                 ` Mark Brown
2020-01-31  8:37                 ` Benjamin GAIGNARD
2020-01-31  8:37                   ` Benjamin GAIGNARD
2020-01-31  9:06                   ` Greg KH
2020-01-31  9:06                     ` Greg KH
2020-02-14 16:05                     ` Linus Walleij
2020-02-14 16:05                       ` Linus Walleij
2020-02-14 21:40                       ` Greg KH
2020-02-14 21:40                         ` Greg KH
2020-02-15 12:41                         ` Benjamin GAIGNARD
2020-02-15 12:41                           ` Benjamin GAIGNARD
2020-02-16  7:21                           ` Greg KH
2020-02-16  7:21                             ` Greg KH
2020-01-28 15:38 ` [PATCH v2 3/7] base: Add calls to firewall controller Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 4/7] dt-bindings: bus: Add STM32 ETZPC " Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 5/7] bus: firewall: Add driver for STM32 ETZPC controller Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 6/7] ARM: dts: stm32: Add firewall node for stm32mp157 SoC Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 7/7] ARM: dts: stm32: enable firewall controller node on stm32mp157c-ed1 Benjamin Gaignard
2020-01-28 15:38   ` Benjamin Gaignard
2020-01-28 16:36 ` [PATCH v2 0/7] Introduce bus firewall controller framework Sudeep Holla
2020-01-28 16:36   ` Sudeep Holla
2020-01-28 16:46   ` Benjamin GAIGNARD
2020-01-28 16:46     ` Benjamin GAIGNARD
2020-01-28 17:17     ` Sudeep Holla
2020-01-28 17:17       ` Sudeep Holla
2020-01-28 20:06       ` Benjamin GAIGNARD
2020-01-28 20:06         ` Benjamin GAIGNARD
2020-01-28 22:06         ` Robin Murphy
2020-01-28 22:06           ` Robin Murphy
2020-01-29 13:40           ` Benjamin GAIGNARD
2020-01-29 13:40             ` Benjamin GAIGNARD
2020-01-31 18:25             ` Robin Murphy
2020-01-31 18:25               ` Robin Murphy
2020-02-03 13:16               ` Benjamin GAIGNARD [this message]
2020-02-03 13:16                 ` Benjamin GAIGNARD
2020-01-31 20:51             ` Florian Fainelli
2020-01-31 20:51               ` Florian Fainelli
2020-02-03 13:41               ` Benjamin GAIGNARD
2020-02-03 13:41                 ` Benjamin GAIGNARD
2020-01-31 20:48         ` Florian Fainelli
2020-01-31 20:48           ` Florian Fainelli
2020-02-02 12:23           ` Mark Brown
2020-02-02 12:23             ` Mark Brown

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=df6fcb24-2357-af1d-8060-1a9ca0064758@st.com \
    --to=benjamin.gaignard@st.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@metux.net \
    --cc=loic.pallardy@st.com \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=sudeep.holla@arm.com \
    --cc=system-dt@lists.openampproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.