[v1,0/6] ACPI: scan: MIPI DiSco for Imaging support

Message ID 13276375.uLZWGnKmhe@kreacher
Headers
Series ACPI: scan: MIPI DiSco for Imaging support |

Message

Rafael J. Wysocki May 24, 2023, 11:38 a.m. UTC
  Hi Folks,

This basically is a re-write of a recent patch series from Sakari:

https://lore.kernel.org/linux-acpi/20230329100951.1522322-1-sakari.ailus@linux.intel.com

The general idea is the same - CSI-2 resource descriptors, introduced in
ACPI 6.4 and defined by

https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#camera-serial-interface-csi-2-connection-resource-descriptor

are found and used for creating a set of software nodes that represent the CSI-2
connection graph.

These software nodes need to be available before any scan handlers or ACPI drivers
are bound to any struct acpi_device objects, so all of that is done at the early
stage of ACPI device enumeration, but unnecessary ACPI namespace walks are avoided.

The CSI-2 software nodes are populated with data extracted from the CSI-2 resource
descriptors themselves and from device properties defined by the MIPI DiSco for
Imaging specification (see https://www.mipi.org/specifications/mipi-disco-imaging).

Patches [4,6/6] come from the original series directly, but the other patches have
been changes substantially, so I've decided to re-start patch series versioning from
scratch.

This series is based on the patch at

https://patchwork.kernel.org/project/linux-acpi/patch/12223415.O9o76ZdvQC@kreacher/

applied on top of 6.4-rc3.

Later on, I'll put all of this material into a special git branch for easier
access.

Thanks!
  

Comments

Rafael J. Wysocki May 24, 2023, 11:56 a.m. UTC | #1
On Wed, May 24, 2023 at 1:48 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> Hi Folks,
>
> This basically is a re-write of a recent patch series from Sakari:
>
> https://lore.kernel.org/linux-acpi/20230329100951.1522322-1-sakari.ailus@linux.intel.com
>
> The general idea is the same - CSI-2 resource descriptors, introduced in
> ACPI 6.4 and defined by
>
> https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#camera-serial-interface-csi-2-connection-resource-descriptor
>
> are found and used for creating a set of software nodes that represent the CSI-2
> connection graph.
>
> These software nodes need to be available before any scan handlers or ACPI drivers
> are bound to any struct acpi_device objects, so all of that is done at the early
> stage of ACPI device enumeration, but unnecessary ACPI namespace walks are avoided.
>
> The CSI-2 software nodes are populated with data extracted from the CSI-2 resource
> descriptors themselves and from device properties defined by the MIPI DiSco for
> Imaging specification (see https://www.mipi.org/specifications/mipi-disco-imaging).
>
> Patches [4,6/6] come from the original series directly, but the other patches have
> been changes substantially, so I've decided to re-start patch series versioning from
> scratch.

I should have mentioned that the following two patches are not included:

https://patchwork.kernel.org/project/linux-acpi/patch/20230329100951.1522322-9-sakari.ailus@linux.intel.com/
https://patchwork.kernel.org/project/linux-acpi/patch/20230329100951.1522322-10-sakari.ailus@linux.intel.com/

because I don't agree with the idea of renaming device properties in place.

Also not included is the documentation patch, because comments are
added by the individual patches making changes in the code.

Thanks!
  
Rafael J. Wysocki May 24, 2023, 6:06 p.m. UTC | #2
On Wed, May 24, 2023 at 1:48 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> Hi Folks,
>
> This basically is a re-write of a recent patch series from Sakari:
>
> https://lore.kernel.org/linux-acpi/20230329100951.1522322-1-sakari.ailus@linux.intel.com
>
> The general idea is the same - CSI-2 resource descriptors, introduced in
> ACPI 6.4 and defined by
>
> https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#camera-serial-interface-csi-2-connection-resource-descriptor
>
> are found and used for creating a set of software nodes that represent the CSI-2
> connection graph.
>
> These software nodes need to be available before any scan handlers or ACPI drivers
> are bound to any struct acpi_device objects, so all of that is done at the early
> stage of ACPI device enumeration, but unnecessary ACPI namespace walks are avoided.
>
> The CSI-2 software nodes are populated with data extracted from the CSI-2 resource
> descriptors themselves and from device properties defined by the MIPI DiSco for
> Imaging specification (see https://www.mipi.org/specifications/mipi-disco-imaging).
>
> Patches [4,6/6] come from the original series directly, but the other patches have
> been changes substantially, so I've decided to re-start patch series versioning from
> scratch.
>
> This series is based on the patch at
>
> https://patchwork.kernel.org/project/linux-acpi/patch/12223415.O9o76ZdvQC@kreacher/
>
> applied on top of 6.4-rc3.
>
> Later on, I'll put all of this material into a special git branch for easier
> access.

The patches are now available from the acpi-mipi-disco-imaging branch
in the linux-pm.git tree at kernel.org.

Thanks!
  
Sakari Ailus June 9, 2023, 9:51 a.m. UTC | #3
Hi Rafael,

On Wed, May 24, 2023 at 08:06:09PM +0200, Rafael J. Wysocki wrote:
> On Wed, May 24, 2023 at 1:48 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> >
> > Hi Folks,
> >
> > This basically is a re-write of a recent patch series from Sakari:
> >
> > https://lore.kernel.org/linux-acpi/20230329100951.1522322-1-sakari.ailus@linux.intel.com
> >
> > The general idea is the same - CSI-2 resource descriptors, introduced in
> > ACPI 6.4 and defined by
> >
> > https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#camera-serial-interface-csi-2-connection-resource-descriptor
> >
> > are found and used for creating a set of software nodes that represent the CSI-2
> > connection graph.
> >
> > These software nodes need to be available before any scan handlers or ACPI drivers
> > are bound to any struct acpi_device objects, so all of that is done at the early
> > stage of ACPI device enumeration, but unnecessary ACPI namespace walks are avoided.
> >
> > The CSI-2 software nodes are populated with data extracted from the CSI-2 resource
> > descriptors themselves and from device properties defined by the MIPI DiSco for
> > Imaging specification (see https://www.mipi.org/specifications/mipi-disco-imaging).
> >
> > Patches [4,6/6] come from the original series directly, but the other patches have
> > been changes substantially, so I've decided to re-start patch series versioning from
> > scratch.
> >
> > This series is based on the patch at
> >
> > https://patchwork.kernel.org/project/linux-acpi/patch/12223415.O9o76ZdvQC@kreacher/
> >
> > applied on top of 6.4-rc3.
> >
> > Later on, I'll put all of this material into a special git branch for easier
> > access.
> 
> The patches are now available from the acpi-mipi-disco-imaging branch
> in the linux-pm.git tree at kernel.org.

I've been doing some testing on this version.

It oopses and that's relatively easy to fix by removing the kfree() that
releases memory of the software nodes and properties.

It doesn't work with that change either, it would seem like that the _CRS
CSI2 data is (most of the time) released before it gets used for creating
the software nodes, leading node registration to fail. This appears to be
taking place in different processes --- there's a work queue.

Moving the release of the _CRS CSI-2 resources to where they are no longer
needed makes the system crash early at boot. I've yet to debug this
further.
  
Rafael J. Wysocki June 9, 2023, 5:31 p.m. UTC | #4
Hi Sakari,

On Fri, Jun 9, 2023 at 11:51 AM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Rafael,
>
> On Wed, May 24, 2023 at 08:06:09PM +0200, Rafael J. Wysocki wrote:
> > On Wed, May 24, 2023 at 1:48 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > >
> > > Hi Folks,
> > >
> > > This basically is a re-write of a recent patch series from Sakari:
> > >
> > > https://lore.kernel.org/linux-acpi/20230329100951.1522322-1-sakari.ailus@linux.intel.com
> > >
> > > The general idea is the same - CSI-2 resource descriptors, introduced in
> > > ACPI 6.4 and defined by
> > >
> > > https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#camera-serial-interface-csi-2-connection-resource-descriptor
> > >
> > > are found and used for creating a set of software nodes that represent the CSI-2
> > > connection graph.
> > >
> > > These software nodes need to be available before any scan handlers or ACPI drivers
> > > are bound to any struct acpi_device objects, so all of that is done at the early
> > > stage of ACPI device enumeration, but unnecessary ACPI namespace walks are avoided.
> > >
> > > The CSI-2 software nodes are populated with data extracted from the CSI-2 resource
> > > descriptors themselves and from device properties defined by the MIPI DiSco for
> > > Imaging specification (see https://www.mipi.org/specifications/mipi-disco-imaging).
> > >
> > > Patches [4,6/6] come from the original series directly, but the other patches have
> > > been changes substantially, so I've decided to re-start patch series versioning from
> > > scratch.
> > >
> > > This series is based on the patch at
> > >
> > > https://patchwork.kernel.org/project/linux-acpi/patch/12223415.O9o76ZdvQC@kreacher/
> > >
> > > applied on top of 6.4-rc3.
> > >
> > > Later on, I'll put all of this material into a special git branch for easier
> > > access.
> >
> > The patches are now available from the acpi-mipi-disco-imaging branch
> > in the linux-pm.git tree at kernel.org.
>
> I've been doing some testing on this version.

Thanks for testing!

> It oopses and that's relatively easy to fix by removing the kfree() that
> releases memory of the software nodes and properties.

It would be good to check which of the patches introduces the crash.

> It doesn't work with that change either, it would seem like that the _CRS
> CSI2 data is (most of the time) released before it gets used for creating
> the software nodes, leading node registration to fail. This appears to be
> taking place in different processes --- there's a work queue.
>
> Moving the release of the _CRS CSI-2 resources to where they are no longer
> needed makes the system crash early at boot. I've yet to debug this
> further.

OK, thanks!

I think that the way to go would be to check if the results of the
first patch are as expected and if so, move to the next one etc.