All of lore.kernel.org
 help / color / mirror / Atom feed
From: Schrempf Frieder <frieder.schrempf@kontron.de>
To: Lucas Stach <l.stach@pengutronix.de>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	Jacky Bai <ping.bai@nxp.com>, Adam Ford <aford173@gmail.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Cc: "Aisheng Dong" <aisheng.dong@nxp.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	"Souvik Chakravarty" <Souvik.Chakravarty@arm.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Clément Faure" <clement.faure@nxp.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Silvano Di Ninno" <silvano.dininno@nxp.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 0/3] Add power domain driver support for i.mx8m family
Date: Thu, 13 Feb 2020 16:16:59 +0000	[thread overview]
Message-ID: <9679a5be-6e14-1a37-6163-b95fd55ebb36@kontron.de> (raw)
In-Reply-To: <13d6492b91c38e6b1ff5ff2874197fff224fff5c.camel@pengutronix.de>

On 13.02.20 16:58, Lucas Stach wrote:
> On Do, 2020-02-13 at 15:19 +0000, Leonard Crestez wrote:
>> On 13.02.2020 16:47, Lucas Stach wrote:
>>> On Do, 2020-02-13 at 14:30 +0000, Leonard Crestez wrote:
>>>> On 13.02.2020 13:32, Lucas Stach wrote:
>>>>> On Do, 2020-02-13 at 09:21 +0000, Jacky Bai wrote:
>>>>>>> -----Original Message-----
>>>>>>> From: Schrempf Frieder <frieder.schrempf@kontron.de>
>>>>>>> Sent: Thursday, February 13, 2020 5:16 PM
>>>>>>> To: Adam Ford <aford173@gmail.com>; Sudeep Holla
>>>>>>> <sudeep.holla@arm.com>
>>>>>>> Cc: Aisheng Dong <aisheng.dong@nxp.com>; mark.rutland@arm.com; Peng
>>>>>>> Fan <peng.fan@nxp.com>; Souvik Chakravarty
>>>>>>> <Souvik.Chakravarty@arm.com>; Jacky Bai <ping.bai@nxp.com>;
>>>>>>> devicetree@vger.kernel.org; Clément Faure <clement.faure@nxp.com>;
>>>>>>> s.hauer@pengutronix.de; shawnguo@kernel.org; robh+dt@kernel.org;
>>>>>>> dl-linux-imx <linux-imx@nxp.com>; kernel@pengutronix.de; Andre Przywara
>>>>>>> <andre.przywara@arm.com>; Silvano Di Ninno <silvano.dininno@nxp.com>;
>>>>>>> Leonard Crestez <leonard.crestez@nxp.com>; festevam@gmail.com;
>>>>>>> linux-arm-kernel@lists.infradead.org; Lucas Stach <l.stach@pengutronix.de>
>>>>>>> Subject: Re: [PATCH 0/3] Add power domain driver support for i.mx8m family
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> On 07.11.19 22:28, Adam Ford wrote:
>>>>>>>> On Thu, Apr 18, 2019 at 9:43 AM Sudeep Holla <sudeep.holla@arm.com>
>>>>>>> wrote:
>>>>>>>>> On Wed, Apr 17, 2019 at 04:21:55PM +0000, Leonard Crestez wrote:
>>>>>>>>>> On 4/17/2019 4:33 PM, Sudeep Holla wrote:
>>>>>>>>>>>>> I don't yet buy the security argument. There are many more shared
>>>>>>>>>>>>> parts on the SoC, like the clock controller, that would need to
>>>>>>>>>>>>> be taken away from the non-secure world if one would want to run
>>>>>>>>>>>>> an untrusted OS kernel on a i.MX8M system.
>>>>>>>>>>>>>
>>>>>>>>>>>>> To properly implement security on any i.MX8M based system the
>>>>>>>>>>>>> firmware would need to grow something like a full ARM SCPI
>>>>>>>>>>>>> implementation, so all shared critical peripherals are solely under
>>>>>>> firmware control.
>>>>>>>>>>>> It might be possible to rework this to use some form of
>>>>>>>>>>>> SCMI-over-SMC instead of vendor-specific SMCCC SIP calls
>>>>>>>>
>>>>>>>> I was just curious to know if there is any progress being made on
>>>>>>>> this.  The i.mx8mm-evk is missing functionality upstream and I think
>>>>>>>> the power domain support would help enable some of these features.
>>>>>>>>
>>>>>>>
>>>>>>> Has there been any decision or action taken in this topic?
>>>>>>> Will the power domain driver as proposed in this patch be upstreamed at
>>>>>>> some time, or rather not?
>>>>>>>
>>>>>>> I try to build a mainline BSP for i.MX8MM (ML U-Boot, ML TF-A, ML Linux)
>>>>>>> and I integrated display and graphics support from the downstream NXP
>>>>>>> kernel.
>>>>>>>
>>>>>>> While most things already work fine, there's the issue of how to handle the
>>>>>>> power domains. Currently I need to ungate some clocks in the TF-A
>>>>>>> BL31 to get for example the GPU running. If I understand this correctly the
>>>>>>> proposed power domain driver could handle this in Linux otherwise.
>>>>>>>
>>>>>>
>>>>>> the SCMI over SMC is still under review
>>>>>
>>>>> Even if the SCMI over SMC is ready at some point, it's still unclear to
>>>>> me how you intend to abstract the GPC behind the SCMI interface in the
>>>>> TF-A. The power domains have dependencies both into the regulator and
>>>>> the clock framework. Both are currently under exclusive control of the
>>>>> rich OS. How do you intend to allow the TF-A to control the power
>>>>> supplies and necessary reset clocks without messing up any state in the
>>>>> rich OS?
>>>>
>>>> This is indeed difficult, SCMI assumes that the responder has sufficient
>>>> control over clocks to fully implement power domain handling, including
>>>> over clocks and regulators.
>>>>
>>>> Perhaps it might be possible to modify current gpcv2 driver to send SCMI
>>>> messages for power only and keep handling regulators itself? It could
>>>> switch based on whether it has a reference to a scmi channel as a DT
>>>> property.
>>>
>>> With such a split implementation I feel like we are getting worst of
>>> both worlds: more complexity as the implementation is split across
>>> multiple components (TF-A and kernel) and still the rich OS is able to
>>> mess up the power supply of a domain that it might not even own. This
>>> doesn't sound really enticing.
>>>
>>> IMHO it only makes sense to push this functionality down into TF-A if
>>> it allows to abstract all the implementation details behind a standard
>>> interface like SCMI. But then the needed changes are much more invasive
>>> than just pushing down the GPC implementation.
>>>
>>>> A full scmi-based implementation might use entirely very different
>>>> bindings and take a long time. If people want to support their chips by
>>>> implementing power domain support in the rich OS we shouldn't block them.
>>>>
>>>> So it would be good to accept gpcv2 enhancement for 8mm and similar.
>>>
>>> I fully agree.
>>>
>>> For a full SCMI based implementation I expect that much more than just
>>> the GPC functionality needs to be pushed down into the TF-A. Right now
>>> I see clocks, i2c and regulator handling, maybe there is more that
>>> escapes my mind.
>>
>> I2C regulator handling inside TF-A sounds very difficult. Not only would
>> upstream TF-A likely object but on imx8m EVK boards the i2c bus for
>> regulators is shared with other devices (like camera).
> 
> And that's exactly the point where trying to push things into lower
> layers starts to crumble. It only really makes sense if you manage to
> establish a nice abstraction of what is happening in those lower
> layers. If you need to punch through those abstractions due to system
> design limitations, the benefit of those abstractions is wiped away.
> The only thing you gain is more complexity due to more components being
> involved in a specific task.
> 
> If you want to be able to partition the system (and as far as I
> understand it that's the main motivation for pushing GPC functionality
> into TF-A) you need to design the system (starting on the HW level) to
> make this possible. Trying to force such a model on a system that
> hasn't really been designed for this is IMHO doomed to fail.
> 
>> So if we do this maybe SCMI dt bindings could be expanded to at least
>> allow regulators on a per-domain basis?
> 
> Maybe that is what needs to be done to allow at least a partial
> implementation of SCMI on the existing i.MX8M designs. However it
> doesn't really provide much of the benefits of SCMI.
> 
> So I'm all for having a pure Linux based implementation of the
> functionality, instead of waiting for the SCMI based implementation
> that may provide only questionable benefit.

After reading through the thread and other resources - with still very 
limited knowledge - I tend to support Lucas' argument.

We want to provide a mainline BSP for our i.MX8MM hardware and it seems 
like pushing more and more functionality from Linux into firmware will 
increase complexity even further and also delay or block the upstreaming 
of missing components, that would otherwise be rather easy to get running.

WARNING: multiple messages have this Message-ID (diff)
From: Schrempf Frieder <frieder.schrempf@kontron.de>
To: Lucas Stach <l.stach@pengutronix.de>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	Jacky Bai <ping.bai@nxp.com>, Adam Ford <aford173@gmail.com>,
	Sudeep Holla <sudeep.holla@arm.com>
Cc: "Aisheng Dong" <aisheng.dong@nxp.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"Souvik Chakravarty" <Souvik.Chakravarty@arm.com>,
	"Clément Faure" <clement.faure@nxp.com>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"Silvano Di Ninno" <silvano.dininno@nxp.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 0/3] Add power domain driver support for i.mx8m family
Date: Thu, 13 Feb 2020 16:16:59 +0000	[thread overview]
Message-ID: <9679a5be-6e14-1a37-6163-b95fd55ebb36@kontron.de> (raw)
In-Reply-To: <13d6492b91c38e6b1ff5ff2874197fff224fff5c.camel@pengutronix.de>

On 13.02.20 16:58, Lucas Stach wrote:
> On Do, 2020-02-13 at 15:19 +0000, Leonard Crestez wrote:
>> On 13.02.2020 16:47, Lucas Stach wrote:
>>> On Do, 2020-02-13 at 14:30 +0000, Leonard Crestez wrote:
>>>> On 13.02.2020 13:32, Lucas Stach wrote:
>>>>> On Do, 2020-02-13 at 09:21 +0000, Jacky Bai wrote:
>>>>>>> -----Original Message-----
>>>>>>> From: Schrempf Frieder <frieder.schrempf@kontron.de>
>>>>>>> Sent: Thursday, February 13, 2020 5:16 PM
>>>>>>> To: Adam Ford <aford173@gmail.com>; Sudeep Holla
>>>>>>> <sudeep.holla@arm.com>
>>>>>>> Cc: Aisheng Dong <aisheng.dong@nxp.com>; mark.rutland@arm.com; Peng
>>>>>>> Fan <peng.fan@nxp.com>; Souvik Chakravarty
>>>>>>> <Souvik.Chakravarty@arm.com>; Jacky Bai <ping.bai@nxp.com>;
>>>>>>> devicetree@vger.kernel.org; Clément Faure <clement.faure@nxp.com>;
>>>>>>> s.hauer@pengutronix.de; shawnguo@kernel.org; robh+dt@kernel.org;
>>>>>>> dl-linux-imx <linux-imx@nxp.com>; kernel@pengutronix.de; Andre Przywara
>>>>>>> <andre.przywara@arm.com>; Silvano Di Ninno <silvano.dininno@nxp.com>;
>>>>>>> Leonard Crestez <leonard.crestez@nxp.com>; festevam@gmail.com;
>>>>>>> linux-arm-kernel@lists.infradead.org; Lucas Stach <l.stach@pengutronix.de>
>>>>>>> Subject: Re: [PATCH 0/3] Add power domain driver support for i.mx8m family
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> On 07.11.19 22:28, Adam Ford wrote:
>>>>>>>> On Thu, Apr 18, 2019 at 9:43 AM Sudeep Holla <sudeep.holla@arm.com>
>>>>>>> wrote:
>>>>>>>>> On Wed, Apr 17, 2019 at 04:21:55PM +0000, Leonard Crestez wrote:
>>>>>>>>>> On 4/17/2019 4:33 PM, Sudeep Holla wrote:
>>>>>>>>>>>>> I don't yet buy the security argument. There are many more shared
>>>>>>>>>>>>> parts on the SoC, like the clock controller, that would need to
>>>>>>>>>>>>> be taken away from the non-secure world if one would want to run
>>>>>>>>>>>>> an untrusted OS kernel on a i.MX8M system.
>>>>>>>>>>>>>
>>>>>>>>>>>>> To properly implement security on any i.MX8M based system the
>>>>>>>>>>>>> firmware would need to grow something like a full ARM SCPI
>>>>>>>>>>>>> implementation, so all shared critical peripherals are solely under
>>>>>>> firmware control.
>>>>>>>>>>>> It might be possible to rework this to use some form of
>>>>>>>>>>>> SCMI-over-SMC instead of vendor-specific SMCCC SIP calls
>>>>>>>>
>>>>>>>> I was just curious to know if there is any progress being made on
>>>>>>>> this.  The i.mx8mm-evk is missing functionality upstream and I think
>>>>>>>> the power domain support would help enable some of these features.
>>>>>>>>
>>>>>>>
>>>>>>> Has there been any decision or action taken in this topic?
>>>>>>> Will the power domain driver as proposed in this patch be upstreamed at
>>>>>>> some time, or rather not?
>>>>>>>
>>>>>>> I try to build a mainline BSP for i.MX8MM (ML U-Boot, ML TF-A, ML Linux)
>>>>>>> and I integrated display and graphics support from the downstream NXP
>>>>>>> kernel.
>>>>>>>
>>>>>>> While most things already work fine, there's the issue of how to handle the
>>>>>>> power domains. Currently I need to ungate some clocks in the TF-A
>>>>>>> BL31 to get for example the GPU running. If I understand this correctly the
>>>>>>> proposed power domain driver could handle this in Linux otherwise.
>>>>>>>
>>>>>>
>>>>>> the SCMI over SMC is still under review
>>>>>
>>>>> Even if the SCMI over SMC is ready at some point, it's still unclear to
>>>>> me how you intend to abstract the GPC behind the SCMI interface in the
>>>>> TF-A. The power domains have dependencies both into the regulator and
>>>>> the clock framework. Both are currently under exclusive control of the
>>>>> rich OS. How do you intend to allow the TF-A to control the power
>>>>> supplies and necessary reset clocks without messing up any state in the
>>>>> rich OS?
>>>>
>>>> This is indeed difficult, SCMI assumes that the responder has sufficient
>>>> control over clocks to fully implement power domain handling, including
>>>> over clocks and regulators.
>>>>
>>>> Perhaps it might be possible to modify current gpcv2 driver to send SCMI
>>>> messages for power only and keep handling regulators itself? It could
>>>> switch based on whether it has a reference to a scmi channel as a DT
>>>> property.
>>>
>>> With such a split implementation I feel like we are getting worst of
>>> both worlds: more complexity as the implementation is split across
>>> multiple components (TF-A and kernel) and still the rich OS is able to
>>> mess up the power supply of a domain that it might not even own. This
>>> doesn't sound really enticing.
>>>
>>> IMHO it only makes sense to push this functionality down into TF-A if
>>> it allows to abstract all the implementation details behind a standard
>>> interface like SCMI. But then the needed changes are much more invasive
>>> than just pushing down the GPC implementation.
>>>
>>>> A full scmi-based implementation might use entirely very different
>>>> bindings and take a long time. If people want to support their chips by
>>>> implementing power domain support in the rich OS we shouldn't block them.
>>>>
>>>> So it would be good to accept gpcv2 enhancement for 8mm and similar.
>>>
>>> I fully agree.
>>>
>>> For a full SCMI based implementation I expect that much more than just
>>> the GPC functionality needs to be pushed down into the TF-A. Right now
>>> I see clocks, i2c and regulator handling, maybe there is more that
>>> escapes my mind.
>>
>> I2C regulator handling inside TF-A sounds very difficult. Not only would
>> upstream TF-A likely object but on imx8m EVK boards the i2c bus for
>> regulators is shared with other devices (like camera).
> 
> And that's exactly the point where trying to push things into lower
> layers starts to crumble. It only really makes sense if you manage to
> establish a nice abstraction of what is happening in those lower
> layers. If you need to punch through those abstractions due to system
> design limitations, the benefit of those abstractions is wiped away.
> The only thing you gain is more complexity due to more components being
> involved in a specific task.
> 
> If you want to be able to partition the system (and as far as I
> understand it that's the main motivation for pushing GPC functionality
> into TF-A) you need to design the system (starting on the HW level) to
> make this possible. Trying to force such a model on a system that
> hasn't really been designed for this is IMHO doomed to fail.
> 
>> So if we do this maybe SCMI dt bindings could be expanded to at least
>> allow regulators on a per-domain basis?
> 
> Maybe that is what needs to be done to allow at least a partial
> implementation of SCMI on the existing i.MX8M designs. However it
> doesn't really provide much of the benefits of SCMI.
> 
> So I'm all for having a pure Linux based implementation of the
> functionality, instead of waiting for the SCMI based implementation
> that may provide only questionable benefit.

After reading through the thread and other resources - with still very 
limited knowledge - I tend to support Lucas' argument.

We want to provide a mainline BSP for our i.MX8MM hardware and it seems 
like pushing more and more functionality from Linux into firmware will 
increase complexity even further and also delay or block the upstreaming 
of missing components, that would otherwise be rather easy to get running.
_______________________________________________
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-13 16:17 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  5:27 [PATCH 0/3] Add power domain driver support for i.mx8m family Jacky Bai
2019-04-17  5:27 ` Jacky Bai
2019-04-17  5:27 ` [PATCH 1/3] dt-bindings: power: Add power domain binding " Jacky Bai
2019-04-17  5:27   ` Jacky Bai
2019-04-17  5:27 ` [PATCH 2/3] soc: imx: Add power domain driver support " Jacky Bai
2019-04-17  5:27   ` Jacky Bai
2019-04-17  5:27 ` [PATCH 3/3] arm64: dts: freescale: Add power domain nodes for i.mx8mm Jacky Bai
2019-04-17  5:27   ` Jacky Bai
2019-04-17 11:16 ` [PATCH 0/3] Add power domain driver support for i.mx8m family Aisheng Dong
2019-04-17 11:16   ` Aisheng Dong
2019-04-17 12:13   ` Lucas Stach
2019-04-17 12:13     ` Lucas Stach
2019-04-17 12:40     ` Leonard Crestez
2019-04-17 12:40       ` Leonard Crestez
2019-04-17 12:54       ` Lucas Stach
2019-04-17 13:25         ` Sudeep Holla
2019-04-17 12:54       ` Peng Fan
2019-04-17 12:54         ` Peng Fan
2019-04-17 13:33       ` Sudeep Holla
2019-04-17 13:33         ` Sudeep Holla
2019-04-17 16:21         ` Leonard Crestez
2019-04-17 16:21           ` Leonard Crestez
2019-04-18 14:43           ` Sudeep Holla
2019-04-18 14:43             ` Sudeep Holla
2019-11-07 21:28             ` Adam Ford
2019-11-07 21:28               ` Adam Ford
2020-02-13  9:16               ` Schrempf Frieder
2020-02-13  9:16                 ` Schrempf Frieder
2020-02-13  9:21                 ` Jacky Bai
2020-02-13  9:21                   ` Jacky Bai
2020-02-13 10:52                   ` Schrempf Frieder
2020-02-13 10:52                     ` Schrempf Frieder
2020-02-13 11:32                   ` Lucas Stach
2020-02-13 11:32                     ` Lucas Stach
2020-02-13 14:30                     ` Leonard Crestez
2020-02-13 14:30                       ` Leonard Crestez
2020-02-13 14:47                       ` Lucas Stach
2020-02-13 14:47                         ` Lucas Stach
2020-02-13 15:19                         ` Leonard Crestez
2020-02-13 15:19                           ` Leonard Crestez
2020-02-13 15:58                           ` Lucas Stach
2020-02-13 15:58                             ` Lucas Stach
2020-02-13 16:16                             ` Schrempf Frieder [this message]
2020-02-13 16:16                               ` Schrempf Frieder
2019-04-17 13:23     ` Sudeep Holla
2019-04-17 13:23       ` Sudeep Holla
2019-04-17 13:36       ` Sudeep Holla
2019-04-17 13:36         ` Sudeep Holla
2019-04-17 12:39 Jacky Bai
2019-04-17 14:30 Jacky Bai
2019-04-17 14:43 ` Sudeep Holla
2019-04-17 14:43   ` Sudeep Holla
2019-04-18  1:54 Jacky Bai
2019-04-20 13:38 Peng Fan
2019-04-23 11:07 ` Sudeep Holla
2019-04-23 11:07   ` Sudeep Holla
2019-04-23 14:02   ` Peng Fan
2019-04-23 14:02     ` Peng Fan

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=9679a5be-6e14-1a37-6163-b95fd55ebb36@kontron.de \
    --to=frieder.schrempf@kontron.de \
    --cc=Souvik.Chakravarty@arm.com \
    --cc=aford173@gmail.com \
    --cc=aisheng.dong@nxp.com \
    --cc=andre.przywara@arm.com \
    --cc=clement.faure@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=mark.rutland@arm.com \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=silvano.dininno@nxp.com \
    --cc=sudeep.holla@arm.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 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.