Linux USB
 help / color / mirror / Atom feed
From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: heikki.krogerus@linux.intel.com, bleung@chromium.org,
	 jthies@google.com, myrrhperiwinkle@qtmlabs.xyz,
	pooja.katiyar@intel.com,  abelvesa@kernel.org,
	yuanhsinte@chromium.org, johan@kernel.org,
	 dmitry.baryshkov@oss.qualcomm.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/3] usb: typec: ucsi: Detect and skip duplicate altmodes from buggy firmware
Date: Mon, 13 Jul 2026 16:46:35 +0800	[thread overview]
Message-ID: <alSlvJKufAMp4zde@acelan-Precision-5480> (raw)
In-Reply-To: <2026070844-hermit-postwar-9b7c@gregkh>

On Wed, Jul 08, 2026 at 01:45:32PM +0200, Greg KH wrote:
> On Fri, Jun 12, 2026 at 01:21:10PM +0800, Chia-Lin Kao (AceLan) wrote:
> > Some firmware implementations incorrectly return the same altmode
> > multiple times at different offsets when queried via
> > UCSI_GET_ALTERNATE_MODES.  This causes sysfs duplicate filename errors
> > and kernel call traces when the driver attempts to register the same
> > altmode twice:
> >
> >   sysfs: cannot create duplicate filename '/devices/.../typec/port0/port0.0/partner'
> >   typec-thunderbolt port0-partner.1: failed to create symlinks
> >   typec-thunderbolt port0-partner.1: probe with driver typec-thunderbolt failed with error -17
> >
> > The matching rules differ by recipient:
> >
> >   - UCSI_RECIPIENT_CON (port) and UCSI_RECIPIENT_SOP_P (plug):
> >     Two altmodes with identical SVID and VDO are byte-for-byte
> >     duplicates and the second has no observable function, so drop it.
> >
> >   - UCSI_RECIPIENT_SOP (partner):
> >     The typec class binds each partner altmode to a port altmode of
> >     the same SVID via altmode_match()/device_find_child(), which
> >     returns the first port altmode with a matching SVID.  If the
> >     partner advertises more altmodes for SVID X than the port
> >     advertises, the surplus partner altmode(s) collapse onto an
> >     already-paired port altmode and trigger the
> >     "duplicate filename .../partner" sysfs error during
> >     typec_altmode_create_links().  Use the port-side altmode count for
> >     SVID X as the authoritative cap and reject any partner altmode
> >     that would exceed it.  This preserves legitimate multi-Mode
> >     partner altmodes (vendor SVIDs that the port really does
> >     advertise more than once) while filtering the firmware-generated
> >     duplicates that have no port counterpart, and is therefore
> >     stricter than a plain SVID+VDO comparison (which still admits the
> >     Thunderbolt case where firmware reports the same SVID twice with
> >     different VDOs) without being over-broad like a plain SVID match
> >     (which would falsely drop legitimate vendor multi-Mode entries).
> >
> > If a duplicate is detected, skip it and emit a clean warning instead
> > of generating a kernel call trace:
> >
> >   ucsi_acpi USBC000:00: con2: Firmware bug: duplicate partner altmode SVID 0x8087 at offset 1, ignoring.
> >   ucsi_acpi USBC000:00: con2: VDO mismatch: 0x8087a043 vs 0x00000001
>
> Can you change the ", ignoring." to ", ignoring but please contact the
> BIOS vendor to fix this issue." as they need to get told this, otherwise
> this looks like it is a kernel issue.
Here is the v7 that just rephrased the warning message.

https://lore.kernel.org/lkml/20260713084323.287516-1-acelan.kao@canonical.com/

>
> thanks,
>
> greg k-h

  reply	other threads:[~2026-07-13  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  5:21 [PATCH v6 0/3] usb: typec: ucsi: Filter duplicate altmodes from buggy firmware Chia-Lin Kao (AceLan)
2026-06-12  5:21 ` [PATCH v6 1/3] usb: typec: ucsi: Detect and skip " Chia-Lin Kao (AceLan)
2026-07-08 11:45   ` Greg KH
2026-07-13  8:46     ` Chia-Lin Kao (AceLan) [this message]
2026-06-12  5:21 ` [PATCH v6 2/3] usb: typec: ucsi: Add duplicate detection to nvidia registration path Chia-Lin Kao (AceLan)
2026-06-12  5:21 ` [PATCH v6 3/3] usb: typec: ucsi: yoga_c630: Remove redundant duplicate altmode handling Chia-Lin Kao (AceLan)
2026-06-12  5:32 ` [PATCH v6 0/3] usb: typec: ucsi: Filter duplicate altmodes from buggy firmware AceLan Kao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alSlvJKufAMp4zde@acelan-Precision-5480 \
    --to=acelan.kao@canonical.com \
    --cc=abelvesa@kernel.org \
    --cc=bleung@chromium.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johan@kernel.org \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=myrrhperiwinkle@qtmlabs.xyz \
    --cc=pooja.katiyar@intel.com \
    --cc=yuanhsinte@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox