Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joseph Telaak" <joseph@telaak.dev>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: ehci-pci: Set has_hostpc for TDI EHCI on Intel CE5300/CE2600
Date: Fri, 16 Oct 2026 01:22:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-173543@kernel.org> (raw)
In-Reply-To: <20261015-ehci-ce5300-hostpc-v1-1-3cae67c11946@telaak.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: ehci: tdi_in_host_mode() fails to check USBMODE_EX
--

commit 493a630291d0b5961a888e40fa36840fea16fbf5
Author: Joseph Telaak <joseph@telaak.dev>
    usb: ehci-pci: Set has_hostpc for TDI EHCI on Intel CE5300/CE2600

The TransDimension EHCI core in the Intel CE5300 and CE2600 SoCs
(192e:0101, revision >= 6) has the Moorestown-style register extensions:
host mode is selected in USBMODE_EX rather than USBMODE. This commit sets
has_hostpc so that USBMODE_EX reads back 0x23 and devices enumerate.

> diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
> index bd3a635555942..8c71c3de3082e 100644
> --- a/drivers/usb/host/ehci-pci.c
> +++ b/drivers/usb/host/ehci-pci.c
> @@ -145,8 +145,16 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
>  			hcd->has_tt = 1;
>  		break;
>  	case PCI_VENDOR_ID_TDI:
> -		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI)
> +		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
>  			hcd->has_tt = 1;
> +			/*
> +			 * The TDI core in the Intel CE5300/CE2600 (rev >= 6)
> +			 * selects host mode in USBMODE_EX and reports port
> +			 * speed in HOSTPC, as on Moorestown.
> +			 */
> +			if (pdev->revision >= 0x6)
> +				ehci->has_hostpc = 1;
> +		}

[Severity: High]
Since this hardware selects host mode via USBMODE_EX (offset 0xc8), the
standard USBMODE register (offset 0x68) may read as 0. If it does, will
tdi_in_host_mode() falsely return 0?

drivers/usb/host/ehci-hcd.c:tdi_in_host_mode() {
    ...
    tmp = ehci_readl(ehci, &ehci->regs->usbmode);
    return (tmp & 3) == USBMODE_CM_HC;
}

During driver unbind or system suspend, ehci_halt() relies on
tdi_in_host_mode(). A false 0 return causes ehci_halt() to exit
immediately and completely bypass the teardown sequence (clearing
CMD_RUN and waiting for STS_HALT):

drivers/usb/host/ehci-hcd.c:ehci_halt() {
    ...
    if (ehci_is_TDI(ehci) && !ehci->no_tdi_mode &&
        !tdi_in_host_mode(ehci)) {
        spin_unlock_irq(&ehci->lock);
        return 0;
    }
    ...
}

Can this bypassed teardown sequence leave DMA and IRQs active on the
newly enabled core, potentially leading to memory corruption or a system
panic? Does tdi_in_host_mode() need to check USBMODE_EX if has_hostpc
is set?

>  		break;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015-ehci-ce5300-hostpc-v1-1-3cae67c11946@telaak.dev?part=1

  reply	other threads:[~2026-10-16  1:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  1:09 [PATCH] usb: ehci-pci: Set has_hostpc for TDI EHCI on Intel CE5300/CE2600 Joseph Telaak via B4 Relay
2026-10-16  1:22 ` sashiko-bot [this message]
2026-10-16  3:08   ` Joseph Telaak

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-173543@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=joseph@telaak.dev \
    --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