drivers/usb/typec/ucsi/ucsi.c | 6 ++++++ 1 file changed, 6 insertions(+)
The UCSI spec states that the num_connectors field is 7 bits, and the
8th bit is reserved and should be set to zero.
Some buggy FW has been known to set this bit, and it can lead to a
system not booting.
Flag that the FW is not behaving correctly, and auto-fix the value
so that the system boots correctly.
Found on Lenovo P1 G8 during Linux enablement program. The FW will
be fixed, but seemed worth addressing in case it hit platforms that
aren't officially Linux supported.
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
drivers/usb/typec/ucsi/ucsi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 5739ea2abdd1..181351afe887 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1790,6 +1790,12 @@ static int ucsi_init(struct ucsi *ucsi)
ret = -ENODEV;
goto err_reset;
}
+ /* Check if reserved bit set. This is out of spec but happens in buggy FW */
+ if (ucsi->cap.num_connectors & 0x80) {
+ dev_warn(ucsi->dev, "UCSI: Invalid num_connectors %d. Likely buggy FW\n",
+ ucsi->cap.num_connectors);
+ ucsi->cap.num_connectors &= 0x7f; // clear bit and carry on
+ }
/* Allocate the connectors. Released in ucsi_unregister() */
connector = kcalloc(ucsi->cap.num_connectors + 1, sizeof(*connector), GFP_KERNEL);
--
2.43.0
On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: > The UCSI spec states that the num_connectors field is 7 bits, and the > 8th bit is reserved and should be set to zero. > Some buggy FW has been known to set this bit, and it can lead to a > system not booting. > Flag that the FW is not behaving correctly, and auto-fix the value > so that the system boots correctly. > > Found on Lenovo P1 G8 during Linux enablement program. The FW will > be fixed, but seemed worth addressing in case it hit platforms that > aren't officially Linux supported. > > Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Any hints as to what commit id this fixes? thanks, greg k-h
Hi Greg, On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: > On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: >> The UCSI spec states that the num_connectors field is 7 bits, and the >> 8th bit is reserved and should be set to zero. >> Some buggy FW has been known to set this bit, and it can lead to a >> system not booting. >> Flag that the FW is not behaving correctly, and auto-fix the value >> so that the system boots correctly. >> >> Found on Lenovo P1 G8 during Linux enablement program. The FW will >> be fixed, but seemed worth addressing in case it hit platforms that >> aren't officially Linux supported. >> >> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> > > Any hints as to what commit id this fixes? > > thanks, > > greg k-h Maybe 3cf657f ('Remove all bit-fields')? The commit there states that 'We can't use bit fields with data that is received or send to/from the device.' Not sure why that is, but I assumed this means we shouldn't change the structure to use 7 bits for num_connectors, which was my original plan. After that, we go all the way back to the file creation (c1b0bc2) where it was defined as 8 bit. Mark
Hi all, On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: > Hi Greg, > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: >>> The UCSI spec states that the num_connectors field is 7 bits, and the >>> 8th bit is reserved and should be set to zero. >>> Some buggy FW has been known to set this bit, and it can lead to a >>> system not booting. >>> Flag that the FW is not behaving correctly, and auto-fix the value >>> so that the system boots correctly. >>> >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will >>> be fixed, but seemed worth addressing in case it hit platforms that >>> aren't officially Linux supported. >>> >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> >> >> Any hints as to what commit id this fixes? >> >> thanks, >> >> greg k-h > > Maybe 3cf657f ('Remove all bit-fields')? > > The commit there states that 'We can't use bit fields with data that is > received or send > to/from the device.' > Not sure why that is, but I assumed this means we shouldn't change the > structure to use 7 bits for num_connectors, which was my original plan. > > After that, we go all the way back to the file creation (c1b0bc2) where > it was defined as 8 bit. > Just a gentle nudge to see if there are any concerns or questions with the patch. Thanks Mark
On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: > Hi all, > > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: > > Hi Greg, > > > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: > >>> The UCSI spec states that the num_connectors field is 7 bits, and the > >>> 8th bit is reserved and should be set to zero. > >>> Some buggy FW has been known to set this bit, and it can lead to a > >>> system not booting. > >>> Flag that the FW is not behaving correctly, and auto-fix the value > >>> so that the system boots correctly. > >>> > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will > >>> be fixed, but seemed worth addressing in case it hit platforms that > >>> aren't officially Linux supported. > >>> > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> > >> > >> Any hints as to what commit id this fixes? > >> > >> thanks, > >> > >> greg k-h > > > > Maybe 3cf657f ('Remove all bit-fields')? > > > > The commit there states that 'We can't use bit fields with data that is > > received or send > > to/from the device.' > > Not sure why that is, but I assumed this means we shouldn't change the > > structure to use 7 bits for num_connectors, which was my original plan. > > > > After that, we go all the way back to the file creation (c1b0bc2) where > > it was defined as 8 bit. > > > > Just a gentle nudge to see if there are any concerns or questions with the patch. I was waiting for the maintainer of this code to review it :)
On Thu, Sep 18, 2025 at 09:50:30AM +0200, Greg KH wrote: > On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: > > Hi all, > > > > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: > > > Hi Greg, > > > > > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: > > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: > > >>> The UCSI spec states that the num_connectors field is 7 bits, and the > > >>> 8th bit is reserved and should be set to zero. > > >>> Some buggy FW has been known to set this bit, and it can lead to a > > >>> system not booting. > > >>> Flag that the FW is not behaving correctly, and auto-fix the value > > >>> so that the system boots correctly. > > >>> > > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will > > >>> be fixed, but seemed worth addressing in case it hit platforms that > > >>> aren't officially Linux supported. > > >>> > > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> > > >> > > >> Any hints as to what commit id this fixes? > > >> > > >> thanks, > > >> > > >> greg k-h > > > > > > Maybe 3cf657f ('Remove all bit-fields')? > > > > > > The commit there states that 'We can't use bit fields with data that is > > > received or send > > > to/from the device.' > > > Not sure why that is, but I assumed this means we shouldn't change the > > > structure to use 7 bits for num_connectors, which was my original plan. > > > > > > After that, we go all the way back to the file creation (c1b0bc2) where > > > it was defined as 8 bit. > > > > > > > Just a gentle nudge to see if there are any concerns or questions with the patch. > > I was waiting for the maintainer of this code to review it :) So not Fixes tag? Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> -- heikki
Hi Heikki, On Fri, Sep 19, 2025, at 3:44 AM, Heikki Krogerus wrote: > On Thu, Sep 18, 2025 at 09:50:30AM +0200, Greg KH wrote: >> On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: >> > Hi all, >> > >> > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: >> > > Hi Greg, >> > > >> > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: >> > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: >> > >>> The UCSI spec states that the num_connectors field is 7 bits, and the >> > >>> 8th bit is reserved and should be set to zero. >> > >>> Some buggy FW has been known to set this bit, and it can lead to a >> > >>> system not booting. >> > >>> Flag that the FW is not behaving correctly, and auto-fix the value >> > >>> so that the system boots correctly. >> > >>> >> > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will >> > >>> be fixed, but seemed worth addressing in case it hit platforms that >> > >>> aren't officially Linux supported. >> > >>> >> > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> >> > >> >> > >> Any hints as to what commit id this fixes? >> > >> >> > >> thanks, >> > >> >> > >> greg k-h >> > > >> > > Maybe 3cf657f ('Remove all bit-fields')? >> > > >> > > The commit there states that 'We can't use bit fields with data that is >> > > received or send >> > > to/from the device.' >> > > Not sure why that is, but I assumed this means we shouldn't change the >> > > structure to use 7 bits for num_connectors, which was my original plan. >> > > >> > > After that, we go all the way back to the file creation (c1b0bc2) where >> > > it was defined as 8 bit. >> > > >> > >> > Just a gentle nudge to see if there are any concerns or questions with the patch. >> >> I was waiting for the maintainer of this code to review it :) > > So not Fixes tag? > I can add a Fixes tag for the very original commit of this file (c1b0bc2) if that's wanted. > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > Thanks for the review Mark
On Fri, Sep 19, 2025 at 11:45:48AM -0400, Mark Pearson wrote: > Hi Heikki, > > On Fri, Sep 19, 2025, at 3:44 AM, Heikki Krogerus wrote: > > On Thu, Sep 18, 2025 at 09:50:30AM +0200, Greg KH wrote: > >> On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: > >> > Hi all, > >> > > >> > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: > >> > > Hi Greg, > >> > > > >> > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: > >> > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: > >> > >>> The UCSI spec states that the num_connectors field is 7 bits, and the > >> > >>> 8th bit is reserved and should be set to zero. > >> > >>> Some buggy FW has been known to set this bit, and it can lead to a > >> > >>> system not booting. > >> > >>> Flag that the FW is not behaving correctly, and auto-fix the value > >> > >>> so that the system boots correctly. > >> > >>> > >> > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will > >> > >>> be fixed, but seemed worth addressing in case it hit platforms that > >> > >>> aren't officially Linux supported. > >> > >>> > >> > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> > >> > >> > >> > >> Any hints as to what commit id this fixes? > >> > >> > >> > >> thanks, > >> > >> > >> > >> greg k-h > >> > > > >> > > Maybe 3cf657f ('Remove all bit-fields')? > >> > > > >> > > The commit there states that 'We can't use bit fields with data that is > >> > > received or send > >> > > to/from the device.' > >> > > Not sure why that is, but I assumed this means we shouldn't change the > >> > > structure to use 7 bits for num_connectors, which was my original plan. > >> > > > >> > > After that, we go all the way back to the file creation (c1b0bc2) where > >> > > it was defined as 8 bit. > >> > > > >> > > >> > Just a gentle nudge to see if there are any concerns or questions with the patch. > >> > >> I was waiting for the maintainer of this code to review it :) > > > > So not Fixes tag? > > > > I can add a Fixes tag for the very original commit of this file (c1b0bc2) if that's wanted. I don't think it's necessary in this case if the fw is really fixed. But what says Greg? thanks, > > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > > > Thanks for the review > > Mark -- heikki
Hi Heikki, On Mon, Sep 22, 2025, at 8:48 AM, Heikki Krogerus wrote: > On Fri, Sep 19, 2025 at 11:45:48AM -0400, Mark Pearson wrote: >> Hi Heikki, >> >> On Fri, Sep 19, 2025, at 3:44 AM, Heikki Krogerus wrote: >> > On Thu, Sep 18, 2025 at 09:50:30AM +0200, Greg KH wrote: >> >> On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: >> >> > Hi all, >> >> > >> >> > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: >> >> > > Hi Greg, >> >> > > >> >> > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: >> >> > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: >> >> > >>> The UCSI spec states that the num_connectors field is 7 bits, and the >> >> > >>> 8th bit is reserved and should be set to zero. >> >> > >>> Some buggy FW has been known to set this bit, and it can lead to a >> >> > >>> system not booting. >> >> > >>> Flag that the FW is not behaving correctly, and auto-fix the value >> >> > >>> so that the system boots correctly. >> >> > >>> >> >> > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will >> >> > >>> be fixed, but seemed worth addressing in case it hit platforms that >> >> > >>> aren't officially Linux supported. >> >> > >>> >> >> > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> >> >> > >> >> >> > >> Any hints as to what commit id this fixes? >> >> > >> >> >> > >> thanks, >> >> > >> >> >> > >> greg k-h >> >> > > >> >> > > Maybe 3cf657f ('Remove all bit-fields')? >> >> > > >> >> > > The commit there states that 'We can't use bit fields with data that is >> >> > > received or send >> >> > > to/from the device.' >> >> > > Not sure why that is, but I assumed this means we shouldn't change the >> >> > > structure to use 7 bits for num_connectors, which was my original plan. >> >> > > >> >> > > After that, we go all the way back to the file creation (c1b0bc2) where >> >> > > it was defined as 8 bit. >> >> > > >> >> > >> >> > Just a gentle nudge to see if there are any concerns or questions with the patch. >> >> >> >> I was waiting for the maintainer of this code to review it :) >> > >> > So not Fixes tag? >> > >> >> I can add a Fixes tag for the very original commit of this file (c1b0bc2) if that's wanted. > > I don't think it's necessary in this case if the fw is really fixed. > But what says Greg? > I don't think the Fixes tag makes sense either; and to confirm - this will be fixed in FW. Greg - can we go ahead with this please? Mark
On Mon, Sep 29, 2025 at 03:25:06PM -0400, Mark Pearson wrote: > Hi Heikki, > > On Mon, Sep 22, 2025, at 8:48 AM, Heikki Krogerus wrote: > > On Fri, Sep 19, 2025 at 11:45:48AM -0400, Mark Pearson wrote: > >> Hi Heikki, > >> > >> On Fri, Sep 19, 2025, at 3:44 AM, Heikki Krogerus wrote: > >> > On Thu, Sep 18, 2025 at 09:50:30AM +0200, Greg KH wrote: > >> >> On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: > >> >> > Hi all, > >> >> > > >> >> > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: > >> >> > > Hi Greg, > >> >> > > > >> >> > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: > >> >> > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: > >> >> > >>> The UCSI spec states that the num_connectors field is 7 bits, and the > >> >> > >>> 8th bit is reserved and should be set to zero. > >> >> > >>> Some buggy FW has been known to set this bit, and it can lead to a > >> >> > >>> system not booting. > >> >> > >>> Flag that the FW is not behaving correctly, and auto-fix the value > >> >> > >>> so that the system boots correctly. > >> >> > >>> > >> >> > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will > >> >> > >>> be fixed, but seemed worth addressing in case it hit platforms that > >> >> > >>> aren't officially Linux supported. > >> >> > >>> > >> >> > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> > >> >> > >> > >> >> > >> Any hints as to what commit id this fixes? > >> >> > >> > >> >> > >> thanks, > >> >> > >> > >> >> > >> greg k-h > >> >> > > > >> >> > > Maybe 3cf657f ('Remove all bit-fields')? > >> >> > > > >> >> > > The commit there states that 'We can't use bit fields with data that is > >> >> > > received or send > >> >> > > to/from the device.' > >> >> > > Not sure why that is, but I assumed this means we shouldn't change the > >> >> > > structure to use 7 bits for num_connectors, which was my original plan. > >> >> > > > >> >> > > After that, we go all the way back to the file creation (c1b0bc2) where > >> >> > > it was defined as 8 bit. > >> >> > > > >> >> > > >> >> > Just a gentle nudge to see if there are any concerns or questions with the patch. > >> >> > >> >> I was waiting for the maintainer of this code to review it :) > >> > > >> > So not Fixes tag? > >> > > >> > >> I can add a Fixes tag for the very original commit of this file (c1b0bc2) if that's wanted. > > > > I don't think it's necessary in this case if the fw is really fixed. > > But what says Greg? > > > I don't think the Fixes tag makes sense either; and to confirm - this will be fixed in FW. > > Greg - can we go ahead with this please? It's the merge window right now, I'll pick it up after -rc1 is out. thanks, greg k-h
On Mon, Sep 29, 2025, at 3:35 PM, Greg KH wrote: > On Mon, Sep 29, 2025 at 03:25:06PM -0400, Mark Pearson wrote: >> Hi Heikki, >> >> On Mon, Sep 22, 2025, at 8:48 AM, Heikki Krogerus wrote: >> > On Fri, Sep 19, 2025 at 11:45:48AM -0400, Mark Pearson wrote: >> >> Hi Heikki, >> >> >> >> On Fri, Sep 19, 2025, at 3:44 AM, Heikki Krogerus wrote: >> >> > On Thu, Sep 18, 2025 at 09:50:30AM +0200, Greg KH wrote: >> >> >> On Wed, Sep 17, 2025 at 02:14:28PM -0400, Mark Pearson wrote: >> >> >> > Hi all, >> >> >> > >> >> >> > On Fri, Aug 22, 2025, at 8:54 AM, Mark Pearson wrote: >> >> >> > > Hi Greg, >> >> >> > > >> >> >> > > On Fri, Aug 22, 2025, at 12:51 AM, Greg KH wrote: >> >> >> > >> On Thu, Aug 21, 2025 at 02:53:07PM -0400, Mark Pearson wrote: >> >> >> > >>> The UCSI spec states that the num_connectors field is 7 bits, and the >> >> >> > >>> 8th bit is reserved and should be set to zero. >> >> >> > >>> Some buggy FW has been known to set this bit, and it can lead to a >> >> >> > >>> system not booting. >> >> >> > >>> Flag that the FW is not behaving correctly, and auto-fix the value >> >> >> > >>> so that the system boots correctly. >> >> >> > >>> >> >> >> > >>> Found on Lenovo P1 G8 during Linux enablement program. The FW will >> >> >> > >>> be fixed, but seemed worth addressing in case it hit platforms that >> >> >> > >>> aren't officially Linux supported. >> >> >> > >>> >> >> >> > >>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> >> >> >> > >> >> >> >> > >> Any hints as to what commit id this fixes? >> >> >> > >> >> >> >> > >> thanks, >> >> >> > >> >> >> >> > >> greg k-h >> >> >> > > >> >> >> > > Maybe 3cf657f ('Remove all bit-fields')? >> >> >> > > >> >> >> > > The commit there states that 'We can't use bit fields with data that is >> >> >> > > received or send >> >> >> > > to/from the device.' >> >> >> > > Not sure why that is, but I assumed this means we shouldn't change the >> >> >> > > structure to use 7 bits for num_connectors, which was my original plan. >> >> >> > > >> >> >> > > After that, we go all the way back to the file creation (c1b0bc2) where >> >> >> > > it was defined as 8 bit. >> >> >> > > >> >> >> > >> >> >> > Just a gentle nudge to see if there are any concerns or questions with the patch. >> >> >> >> >> >> I was waiting for the maintainer of this code to review it :) >> >> > >> >> > So not Fixes tag? >> >> > >> >> >> >> I can add a Fixes tag for the very original commit of this file (c1b0bc2) if that's wanted. >> > >> > I don't think it's necessary in this case if the fw is really fixed. >> > But what says Greg? >> > >> I don't think the Fixes tag makes sense either; and to confirm - this will be fixed in FW. >> >> Greg - can we go ahead with this please? > > It's the merge window right now, I'll pick it up after -rc1 is out. > Sounds good - thanks! Mark
© 2016 - 2025 Red Hat, Inc.