[PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors

Won Chung posted 2 patches 4 years ago
.../ABI/testing/sysfs-bus-thunderbolt         | 10 +++++
drivers/misc/mei/hdcp/mei_hdcp.c              |  2 +-
drivers/misc/mei/pxp/mei_pxp.c                |  2 +-
drivers/thunderbolt/usb4_port.c               | 38 +++++++++++++++++++
4 files changed, 50 insertions(+), 2 deletions(-)
[PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Won Chung 4 years ago
Currently, USB port is linked to Type C connector, using the component
framework, if they share the same _PLD fields from ACPI table. Type C
port-mapper searches for devices with the same _PLD values, and
aggregate them as components.

When there is another device that share the same _PLD but does not
registers a component, Type C connector (component master) would never
be bound due to a component match entry device without a component
registered. There exists some cases where USB4 port also shares the same
_PLD with USB port and Type C connector, so we need to register a
component for USB4 ports too, linking USB4 port with Type C connector.
Otherwise, link between USB port and Type C connector would not
work either.

Due to the nature of the component framework, all registered components
are shared by all component match despite the relevance. MEI subsystems
also use the component framework to bind to i915 driver, which try to
match components registered by USB ports and USB4 ports. This can be
problematic since MEI assumes that there is a driver bound to the
component device, while USB4 port does not bind to any drivers. MEI's
component match callback functions should handle such case to avoid NULL
pointer dereference when USB4 port registers a component.

In summary this patch series
1. Fixes MEI subsystem's component match callbacks to handle a component
device without any driver bound
2. Registers a component for USB4 ports to link them to Type C
connectors, similar to USB ports.

Heikki Krogerus (1):
  thunderbolt: Link USB4 ports to their USB Type-C connectors

Won Chung (1):
  misc/mei: Add NULL check to component match callback functions

 .../ABI/testing/sysfs-bus-thunderbolt         | 10 +++++
 drivers/misc/mei/hdcp/mei_hdcp.c              |  2 +-
 drivers/misc/mei/pxp/mei_pxp.c                |  2 +-
 drivers/thunderbolt/usb4_port.c               | 38 +++++++++++++++++++
 4 files changed, 50 insertions(+), 2 deletions(-)

-- 
2.36.0.rc0.470.gd361397f0d-goog
Re: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Mika Westerberg 4 years ago
Hi,

On Mon, Apr 18, 2022 at 05:59:30PM +0000, Won Chung wrote:
> Currently, USB port is linked to Type C connector, using the component
> framework, if they share the same _PLD fields from ACPI table. Type C
> port-mapper searches for devices with the same _PLD values, and
> aggregate them as components.
> 
> When there is another device that share the same _PLD but does not
> registers a component, Type C connector (component master) would never
> be bound due to a component match entry device without a component
> registered. There exists some cases where USB4 port also shares the same
> _PLD with USB port and Type C connector, so we need to register a
> component for USB4 ports too, linking USB4 port with Type C connector.
> Otherwise, link between USB port and Type C connector would not
> work either.
> 
> Due to the nature of the component framework, all registered components
> are shared by all component match despite the relevance. MEI subsystems
> also use the component framework to bind to i915 driver, which try to
> match components registered by USB ports and USB4 ports. This can be
> problematic since MEI assumes that there is a driver bound to the
> component device, while USB4 port does not bind to any drivers. MEI's
> component match callback functions should handle such case to avoid NULL
> pointer dereference when USB4 port registers a component.
> 
> In summary this patch series
> 1. Fixes MEI subsystem's component match callbacks to handle a component
> device without any driver bound
> 2. Registers a component for USB4 ports to link them to Type C
> connectors, similar to USB ports.
> 
> Heikki Krogerus (1):
>   thunderbolt: Link USB4 ports to their USB Type-C connectors
> 
> Won Chung (1):
>   misc/mei: Add NULL check to component match callback functions

The Thunderbolt patch looks good to me. Do you want me to take the both
patches through the Thunderbolt tree or they can go separately? I need
an ack from the mei maintainer it goes through my tree.
Re: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Won Chung 4 years ago
On Wed, Apr 20, 2022 at 3:54 AM Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
>
> Hi,
>
> On Mon, Apr 18, 2022 at 05:59:30PM +0000, Won Chung wrote:
> > Currently, USB port is linked to Type C connector, using the component
> > framework, if they share the same _PLD fields from ACPI table. Type C
> > port-mapper searches for devices with the same _PLD values, and
> > aggregate them as components.
> >
> > When there is another device that share the same _PLD but does not
> > registers a component, Type C connector (component master) would never
> > be bound due to a component match entry device without a component
> > registered. There exists some cases where USB4 port also shares the same
> > _PLD with USB port and Type C connector, so we need to register a
> > component for USB4 ports too, linking USB4 port with Type C connector.
> > Otherwise, link between USB port and Type C connector would not
> > work either.
> >
> > Due to the nature of the component framework, all registered components
> > are shared by all component match despite the relevance. MEI subsystems
> > also use the component framework to bind to i915 driver, which try to
> > match components registered by USB ports and USB4 ports. This can be
> > problematic since MEI assumes that there is a driver bound to the
> > component device, while USB4 port does not bind to any drivers. MEI's
> > component match callback functions should handle such case to avoid NULL
> > pointer dereference when USB4 port registers a component.
> >
> > In summary this patch series
> > 1. Fixes MEI subsystem's component match callbacks to handle a component
> > device without any driver bound
> > 2. Registers a component for USB4 ports to link them to Type C
> > connectors, similar to USB ports.
> >
> > Heikki Krogerus (1):
> >   thunderbolt: Link USB4 ports to their USB Type-C connectors
> >
> > Won Chung (1):
> >   misc/mei: Add NULL check to component match callback functions
>
> The Thunderbolt patch looks good to me. Do you want me to take the both
> patches through the Thunderbolt tree or they can go separately? I need
> an ack from the mei maintainer it goes through my tree.

Hi Mika,

I would prefer the two patches to go to the same tree since it can
cause a crash with only the second patch (tbt). Would that sound okay?

Hey Alexander, would you be the right person to ask for an ack on this?

Thanks,
Won
Re: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Mika Westerberg 4 years ago
Hi,

On Wed, Apr 20, 2022 at 09:39:25AM -0700, Won Chung wrote:
> On Wed, Apr 20, 2022 at 3:54 AM Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> >
> > Hi,
> >
> > On Mon, Apr 18, 2022 at 05:59:30PM +0000, Won Chung wrote:
> > > Currently, USB port is linked to Type C connector, using the component
> > > framework, if they share the same _PLD fields from ACPI table. Type C
> > > port-mapper searches for devices with the same _PLD values, and
> > > aggregate them as components.
> > >
> > > When there is another device that share the same _PLD but does not
> > > registers a component, Type C connector (component master) would never
> > > be bound due to a component match entry device without a component
> > > registered. There exists some cases where USB4 port also shares the same
> > > _PLD with USB port and Type C connector, so we need to register a
> > > component for USB4 ports too, linking USB4 port with Type C connector.
> > > Otherwise, link between USB port and Type C connector would not
> > > work either.
> > >
> > > Due to the nature of the component framework, all registered components
> > > are shared by all component match despite the relevance. MEI subsystems
> > > also use the component framework to bind to i915 driver, which try to
> > > match components registered by USB ports and USB4 ports. This can be
> > > problematic since MEI assumes that there is a driver bound to the
> > > component device, while USB4 port does not bind to any drivers. MEI's
> > > component match callback functions should handle such case to avoid NULL
> > > pointer dereference when USB4 port registers a component.
> > >
> > > In summary this patch series
> > > 1. Fixes MEI subsystem's component match callbacks to handle a component
> > > device without any driver bound
> > > 2. Registers a component for USB4 ports to link them to Type C
> > > connectors, similar to USB ports.
> > >
> > > Heikki Krogerus (1):
> > >   thunderbolt: Link USB4 ports to their USB Type-C connectors
> > >
> > > Won Chung (1):
> > >   misc/mei: Add NULL check to component match callback functions
> >
> > The Thunderbolt patch looks good to me. Do you want me to take the both
> > patches through the Thunderbolt tree or they can go separately? I need
> > an ack from the mei maintainer it goes through my tree.
> 
> Hi Mika,
> 
> I would prefer the two patches to go to the same tree since it can
> cause a crash with only the second patch (tbt). Would that sound okay?

Sounds good to me.
RE: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Usyskin, Alexander 4 years ago
> > > > Currently, USB port is linked to Type C connector, using the component
> > > > framework, if they share the same _PLD fields from ACPI table. Type C
> > > > port-mapper searches for devices with the same _PLD values, and
> > > > aggregate them as components.
> > > >
> > > > When there is another device that share the same _PLD but does not
> > > > registers a component, Type C connector (component master) would never
> > > > be bound due to a component match entry device without a component
> > > > registered. There exists some cases where USB4 port also shares the same
> > > > _PLD with USB port and Type C connector, so we need to register a
> > > > component for USB4 ports too, linking USB4 port with Type C connector.
> > > > Otherwise, link between USB port and Type C connector would not
> > > > work either.
> > > >
> > > > Due to the nature of the component framework, all registered components
> > > > are shared by all component match despite the relevance. MEI subsystems
> > > > also use the component framework to bind to i915 driver, which try to
> > > > match components registered by USB ports and USB4 ports. This can be
> > > > problematic since MEI assumes that there is a driver bound to the
> > > > component device, while USB4 port does not bind to any drivers. MEI's
> > > > component match callback functions should handle such case to avoid
> NULL
> > > > pointer dereference when USB4 port registers a component.
> > > >
> > > > In summary this patch series
> > > > 1. Fixes MEI subsystem's component match callbacks to handle a
> component
> > > > device without any driver bound
> > > > 2. Registers a component for USB4 ports to link them to Type C
> > > > connectors, similar to USB ports.
> > > >
> > > > Heikki Krogerus (1):
> > > >   thunderbolt: Link USB4 ports to their USB Type-C connectors
> > > >
> > > > Won Chung (1):
> > > >   misc/mei: Add NULL check to component match callback functions
> > >
> > > The Thunderbolt patch looks good to me. Do you want me to take the both
> > > patches through the Thunderbolt tree or they can go separately? I need
> > > an ack from the mei maintainer it goes through my tree.
> >
> > Hi Mika,
> >
> > I would prefer the two patches to go to the same tree since it can
> > cause a crash with only the second patch (tbt). Would that sound okay?
> 
> Sounds good to me.

Tomas is MEI maintainer and should ack MEI patch

-- 
Thanks,
Sasha
Re: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Won Chung 4 years ago
On Sun, Apr 24, 2022 at 2:12 PM Usyskin, Alexander
<alexander.usyskin@intel.com> wrote:
>
> > > > > Currently, USB port is linked to Type C connector, using the component
> > > > > framework, if they share the same _PLD fields from ACPI table. Type C
> > > > > port-mapper searches for devices with the same _PLD values, and
> > > > > aggregate them as components.
> > > > >
> > > > > When there is another device that share the same _PLD but does not
> > > > > registers a component, Type C connector (component master) would never
> > > > > be bound due to a component match entry device without a component
> > > > > registered. There exists some cases where USB4 port also shares the same
> > > > > _PLD with USB port and Type C connector, so we need to register a
> > > > > component for USB4 ports too, linking USB4 port with Type C connector.
> > > > > Otherwise, link between USB port and Type C connector would not
> > > > > work either.
> > > > >
> > > > > Due to the nature of the component framework, all registered components
> > > > > are shared by all component match despite the relevance. MEI subsystems
> > > > > also use the component framework to bind to i915 driver, which try to
> > > > > match components registered by USB ports and USB4 ports. This can be
> > > > > problematic since MEI assumes that there is a driver bound to the
> > > > > component device, while USB4 port does not bind to any drivers. MEI's
> > > > > component match callback functions should handle such case to avoid
> > NULL
> > > > > pointer dereference when USB4 port registers a component.
> > > > >
> > > > > In summary this patch series
> > > > > 1. Fixes MEI subsystem's component match callbacks to handle a
> > component
> > > > > device without any driver bound
> > > > > 2. Registers a component for USB4 ports to link them to Type C
> > > > > connectors, similar to USB ports.
> > > > >
> > > > > Heikki Krogerus (1):
> > > > >   thunderbolt: Link USB4 ports to their USB Type-C connectors
> > > > >
> > > > > Won Chung (1):
> > > > >   misc/mei: Add NULL check to component match callback functions
> > > >
> > > > The Thunderbolt patch looks good to me. Do you want me to take the both
> > > > patches through the Thunderbolt tree or they can go separately? I need
> > > > an ack from the mei maintainer it goes through my tree.
> > >
> > > Hi Mika,
> > >
> > > I would prefer the two patches to go to the same tree since it can
> > > cause a crash with only the second patch (tbt). Would that sound okay?
> >
> > Sounds good to me.
>
> Tomas is MEI maintainer and should ack MEI patch
>
> --
> Thanks,
> Sasha
>
>

Hi Tomas,

Can you take a look at this patch series and give an ack if it looks
okay to be merged into Mika's tree?
One of the patches adds NULL checks in MEI:
https://lore.kernel.org/all/20220418175932.1809770-2-wonchung@google.com/

Thank you,
Won
Re: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Won Chung 4 years ago
On Tue, Apr 26, 2022 at 1:51 AM Won Chung <wonchung@google.com> wrote:
>
> On Sun, Apr 24, 2022 at 2:12 PM Usyskin, Alexander
> <alexander.usyskin@intel.com> wrote:
> >
> > > > > > Currently, USB port is linked to Type C connector, using the component
> > > > > > framework, if they share the same _PLD fields from ACPI table. Type C
> > > > > > port-mapper searches for devices with the same _PLD values, and
> > > > > > aggregate them as components.
> > > > > >
> > > > > > When there is another device that share the same _PLD but does not
> > > > > > registers a component, Type C connector (component master) would never
> > > > > > be bound due to a component match entry device without a component
> > > > > > registered. There exists some cases where USB4 port also shares the same
> > > > > > _PLD with USB port and Type C connector, so we need to register a
> > > > > > component for USB4 ports too, linking USB4 port with Type C connector.
> > > > > > Otherwise, link between USB port and Type C connector would not
> > > > > > work either.
> > > > > >
> > > > > > Due to the nature of the component framework, all registered components
> > > > > > are shared by all component match despite the relevance. MEI subsystems
> > > > > > also use the component framework to bind to i915 driver, which try to
> > > > > > match components registered by USB ports and USB4 ports. This can be
> > > > > > problematic since MEI assumes that there is a driver bound to the
> > > > > > component device, while USB4 port does not bind to any drivers. MEI's
> > > > > > component match callback functions should handle such case to avoid
> > > NULL
> > > > > > pointer dereference when USB4 port registers a component.
> > > > > >
> > > > > > In summary this patch series
> > > > > > 1. Fixes MEI subsystem's component match callbacks to handle a
> > > component
> > > > > > device without any driver bound
> > > > > > 2. Registers a component for USB4 ports to link them to Type C
> > > > > > connectors, similar to USB ports.
> > > > > >
> > > > > > Heikki Krogerus (1):
> > > > > >   thunderbolt: Link USB4 ports to their USB Type-C connectors
> > > > > >
> > > > > > Won Chung (1):
> > > > > >   misc/mei: Add NULL check to component match callback functions
> > > > >
> > > > > The Thunderbolt patch looks good to me. Do you want me to take the both
> > > > > patches through the Thunderbolt tree or they can go separately? I need
> > > > > an ack from the mei maintainer it goes through my tree.
> > > >
> > > > Hi Mika,
> > > >
> > > > I would prefer the two patches to go to the same tree since it can
> > > > cause a crash with only the second patch (tbt). Would that sound okay?
> > >
> > > Sounds good to me.
> >
> > Tomas is MEI maintainer and should ack MEI patch
> >
> > --
> > Thanks,
> > Sasha
> >
> >
>
> Hi Tomas,
>
> Can you take a look at this patch series and give an ack if it looks
> okay to be merged into Mika's tree?
> One of the patches adds NULL checks in MEI:
> https://lore.kernel.org/all/20220418175932.1809770-2-wonchung@google.com/
>
> Thank you,
> Won

Hi Mika,

Tomas has given an ack on the first patch on MEI:
https://lore.kernel.org/all/0136fcb26ca8433899593208af4351c9@intel.com/

Should I resend the patch with an additional "Acked-by" tag?
Or could that be added as the patch is merged into the thunderbolt tree?

Thank you,
Won
Re: [PATCH 0/2] thunderbolt: Link USB4 ports to their USB Type-C connectors
Posted by Mika Westerberg 4 years ago
Hi,

On Fri, Apr 29, 2022 at 03:34:56AM +0900, Won Chung wrote:
> Hi Mika,
> 
> Tomas has given an ack on the first patch on MEI:
> https://lore.kernel.org/all/0136fcb26ca8433899593208af4351c9@intel.com/
> 
> Should I resend the patch with an additional "Acked-by" tag?
> Or could that be added as the patch is merged into the thunderbolt tree?

Both applied to thunderbolt.git/next, thanks!