Linux USB
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Breno Leitao <leitao@debian.org>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] usb: xhci: bail out of setup if the controller is inaccessible
Date: Tue, 28 Jul 2026 13:27:57 +0300	[thread overview]
Message-ID: <407654ae-c3b3-4be9-9bbb-fd9526ed5b70@linux.intel.com> (raw)
In-Reply-To: <20260724-xhci_dead_hc-v2-1-1f8dee685ef1@debian.org>

On 7/24/26 12:38, Breno Leitao wrote:
> xhci_gen_setup() locates the operational registers using the capability
> length read from the very first register:
> 
> 	xhci->op_regs = hcd->regs +
> 		HC_LENGTH(readl(&xhci->cap_regs->hc_capbase));
> 
> If the controller is dead or has dropped off the bus, that read returns
> ~0, HC_LENGTH() truncates it to 0xff, and op_regs ends up 0xff bytes
> past the page-aligned MMIO base, i.e. unaligned. The first access
> through it, xhci_halt() -> xhci_handshake() reading op_regs->status, is
> then an unaligned readl() on device memory. arm64 faults on unaligned
> device accesses, so instead of xhci_handshake() catching the all-ones
> value and returning -ENODEV, setup oopses:
> 
>    xhci-pci-renesas 0005:08:00.0: Unable to change power state from D3cold to D0, device inaccessible
>    xhci-pci-renesas 0005:08:00.0: xHCI Host Controller
>    xhci-pci-renesas 0005:08:00.0: new USB bus registered, assigned bus number 1
>    Unable to handle kernel paging request at virtual address ffff80030a770103
>      ESR = 0x0000000096000021
>      FSC = 0x21: alignment fault
>    Internal error: Oops: 0000000096000021 [#1]  SMP
>    pc : xhci_halt [xhci_hcd]
>    Call trace:
>     xhci_halt
>     xhci_gen_setup
>     xhci_pci_setup
>     usb_add_hcd
>     usb_hcd_pci_probe
>     xhci_pci_common_probe
>     xhci_pci_renesas_probe
> 
> This was hit with a Renesas uPD720201 that failed to power up ("Unable
> to change power state from D3cold to D0, device inaccessible") yet still
> reached the HCD probe path.
> 
> Read the capability register once, and if it reads back the all-ones
> value (as xhci_handshake() and xhci_reset() already test for), abort
> setup with -ENODEV before op_regs is derived from it. Reading it once
> also avoids re-reading a register that may change under a concurrent
> hot-removal.
> 
> Fixes: 66d4eadd8d06 ("USB: xhci: BIOS handoff and HW initialization.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---

Thanks, added to queue

-Mathias



      reply	other threads:[~2026-07-28 10:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  9:38 [PATCH v2] usb: xhci: bail out of setup if the controller is inaccessible Breno Leitao
2026-07-28 10:27 ` Mathias Nyman [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=407654ae-c3b3-4be9-9bbb-fd9526ed5b70@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=stable@vger.kernel.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