Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370525 > unrolled thread

Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications

Started byOctavian Purdila <octavian.purdila@intel.com>
First post2016-04-04 12:30 +0200
Last post2016-04-05 20:30 +0200
Articles 9 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications Octavian Purdila <octavian.purdila@intel.com> - 2016-04-04 12:30 +0200
    Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure  notifications Mark Brown <broonie@kernel.org> - 2016-04-04 18:10 +0200
      Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications Octavian Purdila <octavian.purdila@intel.com> - 2016-04-04 21:40 +0200
        Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications "Rafael J. Wysocki" <rafael@kernel.org> - 2016-04-04 23:20 +0200
          Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications Octavian Purdila <octavian.purdila@intel.com> - 2016-04-05 13:50 +0200
            Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure  notifications Mark Brown <broonie@kernel.org> - 2016-04-05 20:40 +0200
              Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications Octavian Purdila <octavian.purdila@intel.com> - 2016-04-05 21:20 +0200
                Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure  notifications Mark Brown <broonie@kernel.org> - 2016-04-05 23:30 +0200
        Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure  notifications Mark Brown <broonie@kernel.org> - 2016-04-05 20:30 +0200

#1370525 — Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications

FromOctavian Purdila <octavian.purdila@intel.com>
Date2016-04-04 12:30 +0200
SubjectRe: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rk9VF-1Ap-25@gated-at.bofh.it>
On Sat, Apr 2, 2016 at 7:24 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Apr 01, 2016 at 09:26:38PM +0200, Rafael J. Wysocki wrote:
>> On Fri, Apr 1, 2016 at 4:08 PM, Mark Brown <broonie@kernel.org> wrote:
>
>> > That's not the point.  The point is that since the handling is identical
>> > why are we handling it through exactly the same code?
>
>> I think that during the initial enumeration the controller driver's
>> probe walks the children and creates device objects for them.  When a
>> table is loaded later, the controller driver has been probed already
>> and there needs to be a way to trigger a walk over the (new) children
>> from it.
>
>> Or a hook somewhere around acpi_platform_notify() is needed.
>
> What I don't understand is why the flow on inital probe isn't simply to
> register the controller which then triggers the walk of the children.
> That way any bus that supports initial probe also supports hotplug
> without needing to go and manually add a second code path.

Do you mean register the notifier per controller instead of per
subsystem? Either way we need changes at the subsystem level and I
choose to follow the device tree implementation for consistency.

The other reason is that (pending other ACPICA changes) we can add
other notification events in the future such as node added or removed
(just like device tree), and in that case the probe and hotplug
handling would be different (and a bit more efficient).

[toc] | [next] | [standalone]


#1370729 — Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications

FromMark Brown <broonie@kernel.org>
Date2016-04-04 18:10 +0200
SubjectRe: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rkfeG-5Fz-27@gated-at.bofh.it>
In reply to#1370525

[Multipart message — attachments visible in raw view] — view raw

On Mon, Apr 04, 2016 at 01:25:56PM +0300, Octavian Purdila wrote:
> On Sat, Apr 2, 2016 at 7:24 PM, Mark Brown <broonie@kernel.org> wrote:

> > What I don't understand is why the flow on inital probe isn't simply to
> > register the controller which then triggers the walk of the children.
> > That way any bus that supports initial probe also supports hotplug
> > without needing to go and manually add a second code path.

> Do you mean register the notifier per controller instead of per
> subsystem? Either way we need changes at the subsystem level and I
> choose to follow the device tree implementation for consistency.

No!  I mean use the exact same callback you've got now for everything.

> The other reason is that (pending other ACPICA changes) we can add
> other notification events in the future such as node added or removed
> (just like device tree), and in that case the probe and hotplug
> handling would be different (and a bit more efficient).

Why is probe different to hotplug?  We don't need to do that in the
normal driver model.

[toc] | [prev] | [next] | [standalone]


#1370833

FromOctavian Purdila <octavian.purdila@intel.com>
Date2016-04-04 21:40 +0200
Message-ID<rkivU-86a-7@gated-at.bofh.it>
In reply to#1370729
On Mon, Apr 4, 2016 at 7:03 PM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Apr 04, 2016 at 01:25:56PM +0300, Octavian Purdila wrote:
>> On Sat, Apr 2, 2016 at 7:24 PM, Mark Brown <broonie@kernel.org> wrote:
>
>> > What I don't understand is why the flow on inital probe isn't simply to
>> > register the controller which then triggers the walk of the children.
>> > That way any bus that supports initial probe also supports hotplug
>> > without needing to go and manually add a second code path.
>
>> Do you mean register the notifier per controller instead of per
>> subsystem? Either way we need changes at the subsystem level and I
>> choose to follow the device tree implementation for consistency.
>
> No!  I mean use the exact same callback you've got now for everything.
>
>> The other reason is that (pending other ACPICA changes) we can add
>> other notification events in the future such as node added or removed
>> (just like device tree), and in that case the probe and hotplug
>> handling would be different (and a bit more efficient).
>
> Why is probe different to hotplug?  We don't need to do that in the
> normal driver model.

There might be some confusion with the term, I am referring to slave
hotplug, not controller hotplug.

The way I see it, there are two logical operations: probe of a
controller and the associated enumeration of the SPI slaves for that
bus and "hotplug" of new SPI slaves and the enumeration of those
particular slaves.

When we probe the controller we search DT/ACPI and enumerate all the
slaves for *that* controller.

When a slave hotplug happens for device tree we get a device node
notification and we can instantiate the SPI slave based on that info.
In case of ACPI, (at this point) we get a global callback and in that
callback we need to iterate through *all* controllers.

[toc] | [prev] | [next] | [standalone]


#1370902

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2016-04-04 23:20 +0200
Message-ID<rkk4F-N4-3@gated-at.bofh.it>
In reply to#1370833
On Mon, Apr 4, 2016 at 9:34 PM, Octavian Purdila
<octavian.purdila@intel.com> wrote:
> On Mon, Apr 4, 2016 at 7:03 PM, Mark Brown <broonie@kernel.org> wrote:
>> On Mon, Apr 04, 2016 at 01:25:56PM +0300, Octavian Purdila wrote:
>>> On Sat, Apr 2, 2016 at 7:24 PM, Mark Brown <broonie@kernel.org> wrote:
>>
>>> > What I don't understand is why the flow on inital probe isn't simply to
>>> > register the controller which then triggers the walk of the children.
>>> > That way any bus that supports initial probe also supports hotplug
>>> > without needing to go and manually add a second code path.
>>
>>> Do you mean register the notifier per controller instead of per
>>> subsystem? Either way we need changes at the subsystem level and I
>>> choose to follow the device tree implementation for consistency.
>>
>> No!  I mean use the exact same callback you've got now for everything.
>>
>>> The other reason is that (pending other ACPICA changes) we can add
>>> other notification events in the future such as node added or removed
>>> (just like device tree), and in that case the probe and hotplug
>>> handling would be different (and a bit more efficient).
>>
>> Why is probe different to hotplug?  We don't need to do that in the
>> normal driver model.
>
> There might be some confusion with the term, I am referring to slave
> hotplug, not controller hotplug.
>
> The way I see it, there are two logical operations: probe of a
> controller and the associated enumeration of the SPI slaves for that
> bus and "hotplug" of new SPI slaves and the enumeration of those
> particular slaves.
>
> When we probe the controller we search DT/ACPI and enumerate all the
> slaves for *that* controller.
>
> When a slave hotplug happens for device tree we get a device node
> notification and we can instantiate the SPI slave based on that info.
> In case of ACPI, (at this point) we get a global callback and in that
> callback we need to iterate through *all* controllers.

Is that really necessary?

The namespace rescan could notify the parent of a new node in
acpi_default_enumeration(), couldn't it?

[toc] | [prev] | [next] | [standalone]


#1371428

FromOctavian Purdila <octavian.purdila@intel.com>
Date2016-04-05 13:50 +0200
Message-ID<rkxEB-2EV-3@gated-at.bofh.it>
In reply to#1370902
On Tue, Apr 5, 2016 at 12:18 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Mon, Apr 4, 2016 at 9:34 PM, Octavian Purdila
> <octavian.purdila@intel.com> wrote:
>> On Mon, Apr 4, 2016 at 7:03 PM, Mark Brown <broonie@kernel.org> wrote:
>>> On Mon, Apr 04, 2016 at 01:25:56PM +0300, Octavian Purdila wrote:
>>>> On Sat, Apr 2, 2016 at 7:24 PM, Mark Brown <broonie@kernel.org> wrote:
>>>
>>>> > What I don't understand is why the flow on inital probe isn't simply to
>>>> > register the controller which then triggers the walk of the children.
>>>> > That way any bus that supports initial probe also supports hotplug
>>>> > without needing to go and manually add a second code path.
>>>
>>>> Do you mean register the notifier per controller instead of per
>>>> subsystem? Either way we need changes at the subsystem level and I
>>>> choose to follow the device tree implementation for consistency.
>>>
>>> No!  I mean use the exact same callback you've got now for everything.
>>>
>>>> The other reason is that (pending other ACPICA changes) we can add
>>>> other notification events in the future such as node added or removed
>>>> (just like device tree), and in that case the probe and hotplug
>>>> handling would be different (and a bit more efficient).
>>>
>>> Why is probe different to hotplug?  We don't need to do that in the
>>> normal driver model.
>>
>> There might be some confusion with the term, I am referring to slave
>> hotplug, not controller hotplug.
>>
>> The way I see it, there are two logical operations: probe of a
>> controller and the associated enumeration of the SPI slaves for that
>> bus and "hotplug" of new SPI slaves and the enumeration of those
>> particular slaves.
>>
>> When we probe the controller we search DT/ACPI and enumerate all the
>> slaves for *that* controller.
>>
>> When a slave hotplug happens for device tree we get a device node
>> notification and we can instantiate the SPI slave based on that info.
>> In case of ACPI, (at this point) we get a global callback and in that
>> callback we need to iterate through *all* controllers.
>
> Is that really necessary?
>
> The namespace rescan could notify the parent of a new node in
> acpi_default_enumeration(), couldn't it?

We could do that, with some complexity, but I am not sure if it is
worth it - see below. And in either case I still don't see how we can
avoid two enumeration paths: one from the probe of the controller ->
spi_register_master() -> acpi_register_spi_devices()  and one from the
notification handler -> acpi_register_spi_devices(). Both will end up
are calling the same enumeration function but there are still two
paths.

Even right now, in the case of dynamic DT, we have the two enumeration paths.

If we really want to have a single path for ACPI enumeration we could
do that by using an ACPI SPI bridge driver or scan handlers after
extending the matching mechanisms. But we would still need to modify
the SPI subsystem and I don't think its worth it just to save a call
to acpi_register_spi_devices() from spi_register_master().

Now for parent notification complexity: in the case of SPI we can
easily to this because current ACPI SPI enumeration supports only
direct children as slaves. However, on I2C we can have an unrelated
node as a slave - that is why the I2C scanning searches the whole
namespaces for references to a particular i2c_adapter. So, we would
need to retrieve the parent node from the namespace node information
which means that we will do SPI specific stuff in ACPI generic code. I
don't think it is a big issue, because we already treat SPI / I2C
special, right?

Once we have the parent handle we would still have to iterate through
all controllers to get the spi_master matching the ACPI handle. It is
a bit more efficient then global notification, but probably won't
matter in practice.

[toc] | [prev] | [next] | [standalone]


#1371880 — Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications

FromMark Brown <broonie@kernel.org>
Date2016-04-05 20:40 +0200
SubjectRe: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rkE3n-8gJ-11@gated-at.bofh.it>
In reply to#1371428

[Multipart message — attachments visible in raw view] — view raw

On Tue, Apr 05, 2016 at 02:49:13PM +0300, Octavian Purdila wrote:

> If we really want to have a single path for ACPI enumeration we could
> do that by using an ACPI SPI bridge driver or scan handlers after
> extending the matching mechanisms. But we would still need to modify
> the SPI subsystem and I don't think its worth it just to save a call
> to acpi_register_spi_devices() from spi_register_master().

It's not specifically for SPI, it's the fact that you're asking every
single bus type which might be described in ACPI to handle both hotplug
and coldplug paths separately.  Given that the code that's being added
just seems like trivial boilerplate it seems like we're doing this
wrong, we should be factoring this out so there's nothing bus types can
get wrong.

> Now for parent notification complexity: in the case of SPI we can
> easily to this because current ACPI SPI enumeration supports only
> direct children as slaves. However, on I2C we can have an unrelated
> node as a slave - that is why the I2C scanning searches the whole
> namespaces for references to a particular i2c_adapter. So, we would
> need to retrieve the parent node from the namespace node information
> which means that we will do SPI specific stuff in ACPI generic code. I
> don't think it is a big issue, because we already treat SPI / I2C
> special, right?

Or perhaps the issue is that we can't make our mind up if the bus
specific code should go in the bus or in the ACPI core?

[toc] | [prev] | [next] | [standalone]


#1371899

FromOctavian Purdila <octavian.purdila@intel.com>
Date2016-04-05 21:20 +0200
Message-ID<rkEG5-lM-11@gated-at.bofh.it>
In reply to#1371880
On Tue, Apr 5, 2016 at 9:32 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Apr 05, 2016 at 02:49:13PM +0300, Octavian Purdila wrote:
>
>> If we really want to have a single path for ACPI enumeration we could
>> do that by using an ACPI SPI bridge driver or scan handlers after
>> extending the matching mechanisms. But we would still need to modify
>> the SPI subsystem and I don't think its worth it just to save a call
>> to acpi_register_spi_devices() from spi_register_master().
>
> It's not specifically for SPI, it's the fact that you're asking every
> single bus type which might be described in ACPI to handle both hotplug
> and coldplug paths separately.  Given that the code that's being added
> just seems like trivial boilerplate it seems like we're doing this
> wrong, we should be factoring this out so there's nothing bus types can
> get wrong.
>

AFAICS this is exactly the same case for DT: one code path for
coldplug and one for hotplug.

Which makes me think that it is not possible to have a single path for
both, or maybe its not worth it. Do I miss something obvious?

[toc] | [prev] | [next] | [standalone]


#1371956 — Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications

FromMark Brown <broonie@kernel.org>
Date2016-04-05 23:30 +0200
SubjectRe: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rkGHU-1Ji-13@gated-at.bofh.it>
In reply to#1371899

[Multipart message — attachments visible in raw view] — view raw

On Tue, Apr 05, 2016 at 10:16:16PM +0300, Octavian Purdila wrote:
> On Tue, Apr 5, 2016 at 9:32 PM, Mark Brown <broonie@kernel.org> wrote:

> > It's not specifically for SPI, it's the fact that you're asking every
> > single bus type which might be described in ACPI to handle both hotplug
> > and coldplug paths separately.  Given that the code that's being added
> > just seems like trivial boilerplate it seems like we're doing this
> > wrong, we should be factoring this out so there's nothing bus types can
> > get wrong.

> AFAICS this is exactly the same case for DT: one code path for
> coldplug and one for hotplug.

In the DT case the DT code understands a bit more of what's going on
with the firmware parsing which makes things better (the code in the two
paths is not identical, unlike ACPI) but yes, that's another aspect of
why I'm not thrilled with this - if it's not the hotplug and coldplug
that should be sharing code then perhaps it's along the firmware
interface axis that we need to be sharing things.

> Which makes me think that it is not possible to have a single path for
> both, or maybe its not worth it. Do I miss something obvious?

I think at a very high level what I'm looking at here is that we're
having to write too much boilerplate per firmware interface.  Perhaps
the hotplug vs coldplug path isn't it, it looked like it from your
patch, but there must be something here we're spending too much time on.

[toc] | [prev] | [next] | [standalone]


#1371870 — Re: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications

FromMark Brown <broonie@kernel.org>
Date2016-04-05 20:30 +0200
SubjectRe: [RFC PATCH 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rkDTI-8d1-23@gated-at.bofh.it>
In reply to#1370833

[Multipart message — attachments visible in raw view] — view raw

On Mon, Apr 04, 2016 at 10:34:56PM +0300, Octavian Purdila wrote:
> On Mon, Apr 4, 2016 at 7:03 PM, Mark Brown <broonie@kernel.org> wrote:

> > Why is probe different to hotplug?  We don't need to do that in the
> > normal driver model.

> There might be some confusion with the term, I am referring to slave
> hotplug, not controller hotplug.

That's what I was talking about too.

> The way I see it, there are two logical operations: probe of a
> controller and the associated enumeration of the SPI slaves for that
> bus and "hotplug" of new SPI slaves and the enumeration of those
> particular slaves.

I don't see a distinction here.  The firmware finds some new slaves to
tell the framework about.  Quite why it decided to go looking shouldn't
matter.

> When a slave hotplug happens for device tree we get a device node
> notification and we can instantiate the SPI slave based on that info.
> In case of ACPI, (at this point) we get a global callback and in that
> callback we need to iterate through *all* controllers.

That's not really helping me understand why you need every bus to open
code enumeration twice?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web