Public bug reported:

[Impact]
Dell systems (CID: 202604-38600) log a firmware bug warning on every boot and
lose one USB-C partner alternate mode:

  ucsi_acpi USBC000:00: con2: Firmware bug: duplicate partner altmode SVID 
0x413c
    (VDO 0x00000001 vs 0x00000002) at offset 1, ignoring. Please update your
    system firmware.

The two altmodes are not the same. They share the Dell vendor SVID 0x413c but
have different VDOs (0x00000001 and 0x00000002). The second one is valid and
gets thrown away.

The cause is in our own SAUCE patch set for LP: #2127960. That set added
ucsi_altmode_is_duplicate(). For port (SOP') and plug altmodes it compares
SVID + VDO, but for partner (SOP) altmodes it compares SVID only, so any
second partner altmode under the same SVID is dropped.

The same machines also hit this on warm reboot, about 6 out of 60 times:

  ucsi_acpi USBC000:00: con2: failed to register alt modes

[Fix]
Revert the three SAUCE patches and apply the three upstream commits that
replaced them. The upstream versions went through review and changed the
partner matching rule.

Reverts (SAUCE patches from LP: #2127960):
  7fdb513192401 Revert "usb: typec: ucsi: Detect and skip duplicate altmodes
                from buggy firmware"
  7d150034c77fc Revert "usb: typec: ucsi: Add duplicate detection to nvidia
                registration path"
  fbb8fb2a11769 Revert "usb: typec: ucsi: yoga_c630: Remove redundant duplicate
                altmode handling"

Cherry-picks, all upstream in v7.2-rc5:
  67c92c6419ea6 usb: typec: ucsi: Detect and skip duplicate altmodes from buggy
                firmware
  f1aa17f72f9b9 usb: typec: ucsi: Add duplicate detection to nvidia registration
                path
  8706409bd45fb usb: typec: ucsi: yoga_c630: Remove redundant duplicate altmode
                handling

What changed against the SAUCE version:

  - Partner (SOP) altmodes are no longer matched by SVID alone. The typec class
    binds each partner altmode to the first port altmode with the same SVID, so
    the real limit is how many altmodes the port side advertises for that SVID.
    The new code counts the port altmodes for the SVID and only rejects partner
    altmodes past that count. Dell's second 0x413c altmode has a port
    counterpart, so it now registers. The Thunderbolt firmware duplicate has
    none, so it is still dropped and the sysfs error from LP: #2127960 stays
    fixed.
  - Port (CON) and plug (SOP_P) altmodes keep the SVID + VDO rule.
  - The nvidia registration path (used by drivers with an update_altmodes()
    callback) also runs the check now.
  - yoga_c630 drops its own duplicate handling, since the core does it. This
    also puts that driver back on the standard registration path.

The three cherry-picks are byte for byte the same code as v7.2-rc5.

Patches:
https://lore.kernel.org/lkml/[email protected]/

[Test Plan]
On a Dell system that shows the warning (CID: 202604-38600):

1. Check the Dell altmodes are both there:

   $ dmesg | grep -i "duplicate partner altmode"
   $ grep -H . /sys/class/typec/port2-partner/port2-partner.*/svid

   Without patch: dmesg warns about duplicate partner altmode SVID 0x413c and
   only one 0x413c entry shows up in sysfs.
   With patch: no warning for SVID 0x413c, and both 0x413c altmodes are listed.

2. Warm reboot 60 times and check fwts after each boot:

   $ sudo reboot
   $ sudo fwts klog oops

   Without patch: "con2: failed to register alt modes" on about 6 boots out
   of 60.
   With patch: no "failed to register alt modes".

3. Check the original call trace has not come back. Plug in a Thunderbolt
   device:

   $ dmesg | grep -E "cannot create duplicate filename|failed to create
symlinks"

   Expected: no output, on both the old and the new patches.

[Where problems could occur]
Could break USB-C alternate mode registration in the ucsi driver, on any
machine with a Type-C port.

The partner rule now depends on the port altmode list being read before the
partner list. If the port list is empty or short when the partner altmodes are
registered, valid partner altmodes get dropped. That would show up as a missing
mode in /sys/class/typec/portX-partner/, and DisplayPort or Thunderbolt over
USB-C would not come up on that port.

If the rule is too loose in the other direction, the old sysfs error comes
back:

  sysfs: cannot create duplicate filename '/devices/.../port0/port0.0/partner'
  typec-thunderbolt port0-partner.1: probe with driver typec-thunderbolt failed
  with error -17

The nvidia path change also reorders the code that fills in the altmode
descriptor. A mistake there would register altmodes with the wrong SVID or VDO
on nvidia UCSI hardware.

yoga_c630 moves back to the standard registration path. If the core check does
not catch what its local code caught, that laptop gets duplicate altmodes
again.

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: Invalid

** Affects: linux-oem-6.17 (Ubuntu)
     Importance: Undecided
         Status: Invalid

** Affects: linux-oem-7.0 (Ubuntu)
     Importance: Undecided
         Status: Invalid

** Affects: linux (Ubuntu Noble)
     Importance: Undecided
         Status: Invalid

** Affects: linux-oem-6.17 (Ubuntu Noble)
     Importance: Undecided
     Assignee: AceLan Kao (acelankao)
         Status: In Progress

** Affects: linux-oem-7.0 (Ubuntu Noble)
     Importance: Undecided
     Assignee: AceLan Kao (acelankao)
         Status: In Progress

** Affects: linux (Ubuntu Resolute)
     Importance: Undecided
     Assignee: AceLan Kao (acelankao)
         Status: In Progress

** Affects: linux-oem-6.17 (Ubuntu Resolute)
     Importance: Undecided
         Status: Invalid

** Affects: linux-oem-7.0 (Ubuntu Resolute)
     Importance: Undecided
         Status: Invalid

** Also affects: linux (Ubuntu Resolute)
   Importance: Undecided
       Status: New

** Also affects: linux-oem-6.17 (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: linux-oem-7.0 (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: linux (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: linux-oem-6.17 (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: linux-oem-7.0 (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Changed in: linux (Ubuntu Noble)
       Status: New => Invalid

** Changed in: linux (Ubuntu Resolute)
       Status: New => In Progress

** Changed in: linux (Ubuntu Resolute)
     Assignee: (unassigned) => AceLan Kao (acelankao)

** Changed in: linux-oem-6.17 (Ubuntu Noble)
       Status: New => In Progress

** Changed in: linux-oem-6.17 (Ubuntu Noble)
     Assignee: (unassigned) => AceLan Kao (acelankao)

** Changed in: linux (Ubuntu)
       Status: New => Invalid

** Changed in: linux-oem-6.17 (Ubuntu)
       Status: New => Invalid

** Changed in: linux-oem-7.0 (Ubuntu)
       Status: New => Invalid

** Changed in: linux-oem-7.0 (Ubuntu Noble)
       Status: New => In Progress

** Changed in: linux-oem-6.17 (Ubuntu Resolute)
       Status: New => Invalid

** Changed in: linux-oem-7.0 (Ubuntu Noble)
     Assignee: (unassigned) => AceLan Kao (acelankao)

** Changed in: linux-oem-7.0 (Ubuntu Resolute)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2162695

Title:
  USB-C alt mode dropped with false firmware bug warning on Dell systems

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2162695/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to