From: sashiko-bot@kernel.org
To: "Atharva Tiwari" <atharvatiwarilinuxdev@gmail.com>
Cc: "open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] usb: acpi: Get correct location data for Apple macs
Date: Mon, 23 Nov 2026 05:53:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-228742@kernel.org> (raw)
In-Reply-To: <20261123053911.9856-1-atharvatiwarilinuxdev@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] usb: acpi: stale _PLD location left on XHC1 USB2 ports in
usb_acpi_apple_get_location()
- [Low] usb: acpi: commit message refers to ACPI method SSD instead of
SSP
--
commit 092f7ae240ffb60b57f520dfbc02f53417ace8ae
Author: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
usb: acpi: Get correct location data for Apple macs
This commit overrides the _PLD-derived USB port location on x86 Apple Macs
by reading Apple's SSP ACPI object for USB 2.0 ports and _ADR for USB 3.x
ports on the internal XHC1 controller.
> To fix this we use Apple's own location methods called SSD
> for USB2.0, and they use _ADR for USB3.0.
[ ... ]
> NOTE: All USB controller has bad _PLD values but SSD is only available
> on internal USB controller, and even only new intel macs has SSD
> method, so we check for SSD and XHC1 before using apple's methods.
[Severity: Low]
The commit message refers to the ACPI method as "SSD", whereas the code
checks for and evaluates "SSP".
> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
> index 489dbdc96f94a..b5c61a2eae2bc 100644
> --- a/drivers/usb/core/usb-acpi.c
> +++ b/drivers/usb/core/usb-acpi.c
[ ... ]
> @@ -199,6 +200,66 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev)
[ ... ]
> +static void
> +usb_acpi_apple_get_location(struct usb_port *port_dev, struct acpi_device *adev)
> +{
> + struct usb_device *hdev = to_usb_device(port_dev->dev.parent->parent);
> + struct acpi_device *hc = ACPI_COMPANION(hdev->bus->sysdev);
> + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
> + union acpi_object *ssp;
> + acpi_status status;
> +
> + /* Only applies to the CPU's internal XHCI controller. */
> + if (!hc || strncmp(acpi_device_bid(hc), "XHC1", ACPI_NAMESEG_SIZE))
> + return;
> +
> + /* USB 3.x ports use _ADR as the location. */
> + if (hdev->speed >= USB_SPEED_SUPER) {
> + port_dev->location = USB_ACPI_LOCATION_VALID |
> + adev->pnp.bus_address;
> + return;
> + }
> +
> + /* USB 2.0 ports: SSP = { "XHCn", <companion SuperSpeed port> } */
> + status = acpi_evaluate_object_typed(adev->handle, "SSP", NULL, &buffer,
> + ACPI_TYPE_PACKAGE);
> + if (ACPI_FAILURE(status))
> + return;
> +
> + ssp = buffer.pointer;
> + if (ssp->package.count >= 2 &&
> + ssp->package.elements[1].type == ACPI_TYPE_INTEGER)
> + port_dev->location = USB_ACPI_LOCATION_VALID |
> + ssp->package.elements[1].integer.value;
> + kfree(buffer.pointer);
> +}
[Severity: Medium]
Does returning here without clearing port_dev->location leave the garbage
_PLD location on XHC1 USB 2.0 ports that do not have an SSP method?
usb_acpi_get_connect_type() runs before usb_acpi_apple_get_location() and
sets port_dev->location from _PLD:
drivers/usb/core/usb-acpi.c:usb_acpi_get_connect_type() {
if (acpi_get_physical_device_location(handle, &pld) && pld)
port_dev->location = USB_ACPI_LOCATION_VALID |
pld->group_token << 8 | pld->group_position;
On USB 2.0-only ports on XHC1 that lack a SuperSpeed companion (and thus
have no SSP object), acpi_evaluate_object_typed() fails and leaves that
_PLD value in port_dev->location, mixing raw _PLD values into the same
location namespace as USB 3.x _ADR values where they can falsely match in
find_and_link_peer(). Resetting port_dev->location = 0 right after
confirming the controller is XHC1 would clear the stale _PLD data even when
SSP is absent.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123053911.9856-1-atharvatiwarilinuxdev@gmail.com?part=1
prev parent reply other threads:[~2026-11-23 5:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 5:39 [PATCH] usb: acpi: Get correct location data for Apple macs Atharva Tiwari
2026-11-23 5:44 ` Greg Kroah-Hartman
2026-11-23 5:57 ` Atharva Tiwari
2026-11-23 6:01 ` Greg KH
2026-11-23 5:53 ` sashiko-bot [this message]
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=sashiko-outbox-228742@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=atharvatiwarilinuxdev@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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