Linux USB
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Michal Pecio <michal.pecio@gmail.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: xhci: Simplify xhci_quiesce()
Date: Mon, 1 Jun 2026 14:03:58 +0300	[thread overview]
Message-ID: <e99ae325-5ebd-4121-9223-57862487dc0e@linux.intel.com> (raw)
In-Reply-To: <20260529110510.64115fce.michal.pecio@gmail.com>

On 5/29/26 12:05, Michal Pecio wrote:
> The function reads USBCMD, clears some bits and writes it back.
> Its treatment of the Run bit is weird: the bit is usually written
> as 0, as we would expect, but it may also be written as 1 if both
> its current value and USBSTS.HCHalted are observed as 1.
> 
> Per xHCI 5.4.2, HCHalted is 0 whenever Run is 1, so the above can
> only happen due to buggy HW or SW, e.g. concurrent xhci_quiesce()
> and xhci_start() execution.
> 
> It's unclear why we should treat such cases specially and write
> the bit as 1. The logic comes from original PoC implementation
> and has never been explained. Just write 0 every time, which
> looks like the safer choice when the intent is to stop the xHC.
> 
> We could get in trouble if clearing Run causes some very broken
> xHC to start running after it was halted, but no such case has
> been documented. It seems the logic was just poorly thought out.
> 
> Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
> ---
> 
> Hi Mathias,
> 
> I'm not aware of this causing any problem. But I wasted a few minutes
> trying to understand the point of this code, until I was forced to
> conclude that it doesn't seem to have any point whatsoever.
> 
> Maybe getting rid of it will save somebody else another few minutes.
> The removal seems harmless.

Thanks, adding this patch

-Mathias



      reply	other threads:[~2026-06-01 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  9:05 [PATCH] usb: xhci: Simplify xhci_quiesce() Michal Pecio
2026-06-01 11:03 ` 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=e99ae325-5ebd-4121-9223-57862487dc0e@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=michal.pecio@gmail.com \
    /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