From: Cristian Marussi <cristian.marussi@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, vincent.guittot@linaro.org,
f.fainelli@gmail.com
Subject: Re: [PATCH 2/5] firmware: arm_scmi: Support only one single SystemPower device
Date: Fri, 1 Jul 2022 15:31:18 +0100 [thread overview]
Message-ID: <Yr8FG9/f60AVg7qJ@e120937-lin> (raw)
In-Reply-To: <20220701134509.e6wk3vwhimqre6h5@bogus>
On Fri, Jul 01, 2022 at 02:45:09PM +0100, Sudeep Holla wrote:
> On Thu, Jun 23, 2022 at 01:47:39PM +0100, Cristian Marussi wrote:
> > In order to minimize SCMI platform fw-side complexity, only one single SCMI
> > platform should be in charge of SCMI SystemPower protocol communications
> > with the OSPM: enforce the existence of one single unique device associated
> > with SystemPower protocol across any possible number of SCMI platforms, and
> > warn if a system tries to register different SystemPower devices from
> > multiple platforms.
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> > drivers/firmware/arm_scmi/bus.c | 31 ++++++++++++++++++++++++++++++-
> > 1 file changed, 30 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> > index a7cbf4d09081..476855d3dccb 100644
> > --- a/drivers/firmware/arm_scmi/bus.c
> > +++ b/drivers/firmware/arm_scmi/bus.c
> > @@ -19,6 +19,11 @@ static DEFINE_IDA(scmi_bus_id);
> > static DEFINE_IDR(scmi_protocols);
> > static DEFINE_SPINLOCK(protocol_lock);
> >
> > +/* Track globally the creation of SCMI SystemPower related devices */
> > +static bool scmi_syspower_registered;
> > +/* Protect access to scmi_syspower_registered */
> > +static DEFINE_MUTEX(scmi_syspower_mtx);
> > +
>
Hi Sudeep,
thanks for the review first of all.
> Since we create device from the driver, can't we do this from there
> and keep the bus code free from handling all these special conditions
> which are checked for each device creation.
>
> Yes scmi_device_create can be called outside the exiting code but since it
> is not exported(yet), we can assume all users are in kernel and we can
> catch that if anyone attempts to add. And probably we don't need the lock
> as well if it is taken care in the single loop creating the device.
>
Do you mean to move the check inside driver.c common routines like in
scmi_get_protocol_device() right before calling scmi_device_create() ?
If this is what you meant, yes I can do that to avoid polluting the
bus code...indeed it would be easier than dealing with all the internals
in scmi_device_create() like it is now, BUT regarding the mutex I'm not so
sure I can avoid it since the device creation is triggered at the end of
main platform probe (driver:scmi_probe()) BUT potentially also whenever a
new SCMI driver is (lately) loaded and asks for the device creation after
(or worst concurrently to) the main probe loop.
Beside that, there is the case of definitions of multiple SCMI platforms,
which is not officially supported I know but that is, in my understanding,
one of the most possible cause of having multiple instances of an SCMI
SystemPower driver trying to register. (i.e. multiple scmi DT nodes ALL
defining a SystemPower protocol with potentially multiple underlying FWs
advertising SystemPower support which was the thing we wanted to avoid
promoting ... AFAIU...but I could be missing something..)
Thanks,
Cristian
next prev parent reply other threads:[~2022-07-01 14:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 12:47 [PATCH 0/5] Introduce SCMI System Power Control driver Cristian Marussi
2022-06-23 12:47 ` [PATCH 1/5] firmware: arm_scmi: Remove deprecated ida_simple_ calls Cristian Marussi
2022-07-01 13:46 ` Sudeep Holla
2022-06-23 12:47 ` [PATCH 2/5] firmware: arm_scmi: Support only one single SystemPower device Cristian Marussi
2022-07-01 13:45 ` Sudeep Holla
2022-07-01 14:31 ` Cristian Marussi [this message]
2022-07-01 15:00 ` Sudeep Holla
2022-06-23 12:47 ` [PATCH 3/5] firmware: arm_scmi: Add SCMIv3.1 SystemPower extensions Cristian Marussi
2022-06-23 12:47 ` [PATCH 4/5] firmware: arm_scmi: Add devm_protocol_acquire helper Cristian Marussi
2022-06-23 12:47 ` [PATCH 5/5] firmware: arm_scmi: Add SCMI System Power Control driver Cristian Marussi
2022-06-27 13:54 ` Greg Kroah-Hartman
2022-07-01 13:49 ` [PATCH 0/5] Introduce " Sudeep Holla
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=Yr8FG9/f60AVg7qJ@e120937-lin \
--to=cristian.marussi@arm.com \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=vincent.guittot@linaro.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 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®