From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796036278; b=n0apFBMi8vXO90LCKp+9mozW2mRxmBoEw9JZxO6poWna7xY2S6fFogK+hscLaffjQ5SV pA64lOP2svIeQjgXu/Q+uTI2gr6GJ04zB9nxMFXH45K69KsOP2D8OBA863KHnJEbf9eAx 636bmpFSpPhyeKSRWrRZs/DOGPvNJAhfamwebTa4ft1FGrKxe9eC3oti5FMdq+lzVZPLM xNMmCJqFOlCFDad9UokbmhLJZnRhNOjQx1XRRO2Nqgxkug/yyQM/zp3+f/8UaBm6MOU88 V7ESmlsdkNX1ZSMCBmOloUREy7xFJs5J9vqKurFcqaGe6+Fg1VzfozuGr/sn3L6GMkQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036278; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=00TwEx3qVVwU7sDqwyO5SGyla5VzQRvr2GX8TFJMIrM=; b=LHLCv71oVs/M0J+rpGjfWqmS9mKJx4bgTt1tijq0e7CWAzAyjZ8Pd1BkeXa5WXFvu5mb pclWPmbUI6smMw53sDU0w9qbZxec5RRTVVmcE67/CPd0txZpbssd/TC9BzqOfv1UJcUvt cEHPIagfYyQq1Y8Nnsm7KPhSVZJvA+DGHe2qczwMQ7+R0a7q4vKeoz6/oVPgneqd2vQVA NcjITSmc6+6Eeq+ucnmHBNELXocZ5BKKW/sGuSOlbdYoow6t8fUdN85p+XDS0Ui0NYPby B9pB8S8DPaaYxAld9Ek2cjhI8Mglq/hkeZ5OUpvn/UovnaAEvMfsooJTjCSdH1x0SKg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="eyad/c+u"; arc=none smtp.remote-ip=209.85.128.41 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83C11606A32A for ; Mon, 30 Nov 2026 10:57:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83C11606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=eyad/c+u Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4bb70074ab2so108697445e9.0 for ; Mon, 30 Nov 2026 02:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796036276; x=1796641076; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=00TwEx3qVVwU7sDqwyO5SGyla5VzQRvr2GX8TFJMIrM=; b=eyad/c+ueYLPYqrXhx/uSz17q7UAdy6eXQ1NTU0/VUNVeu7nQJ4TF/qpGFUG3HYBJ4 FTFOatMuoQI/q5AvfPVC8I+JLPc6HPB7L8YmomqKcq4eb94GbuHPL0OE2laxM81z5mjx k9VuIvBPLGincTqPgu2VPhygGRNvSPkXYE2MMZjhGNzrg0dA8u+2xyWeiKblZrJGsVGr jv4kC8nkNuiDPJO+ii25g0agZrE/Y/a6WaN77ukABsrykqnBPFhM9dAkL0dSH3daFurg HkZsjlB89uV3bs1Uw6MsLulEIzeCCM3YaIjF1UqqDPfKf258W2mtBQoLWwwY6Smqb8TE nv6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796036276; x=1796641076; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=00TwEx3qVVwU7sDqwyO5SGyla5VzQRvr2GX8TFJMIrM=; b=p+lu11HwAg2NYkujjz56B53CgkrNsDovJEez4x093U7HmBEn+VKVO7bpIqTU8dYcIU VasAE3ODaEl/SqiBegEJ8H0L47YYnUbiI7AAbFqm2iHY68iYbdo6m4S/ddNRwfUEX6GK dU3tWCLtj1jtKCpkE/eXnwfu0Hs0U6Pvm19yhPHfVFPZzRuNXO1BZOt39AloN3J0oR96 OIBUujx5z+V/NEkQp9caz9+xtmn33M0hbQ6WKEO4GLW8nX3c3WkcrlsSROUgdcdZYXL4 ZwSpCwEmHlVfeAL5PgOf0jPxgnIR245lgPWNL97o1OygaKbE0vhMvr2JS8m7SCpPDmbq NWKg== X-Forwarded-Encrypted: i=1; AL+hErFEO8/CCCt7FGtpqJQEyuVnBUKeLabJnDyAMT+If5FMV9PRtRXpuRO5QuVjUa6Qb3OXXkpL6E7nlb3FUz8=@vger.kernel.org X-Gm-Message-State: APuU4Z8/NKsJYgV9zXbIG0iaKlJy4rvSGuEbVUwHEUWV/U88ctDiucIC Tmorxe8z31XMtWEVNu7Dt3KdRop8PJsBm9fc29KrrgLExDw0ZUiufnHP X-Gm-Gg: AZFdTZemDbv6aObc3UsZRTr3bphMGO0PtrVyLKRii1OIdMYGoBKgTOIncKeGUkYuz5k 6bu7jl92WPWQZyhoWe/u0IznxxPP2d3qJ4Y743ex7vSog73LjxKX+uatE6S8YEEv2EdXjWcHY89 BMGzpC9BOr6C8yyZEww06p9FbXKFhDzZUn1S12SPTW37vIV418qREF2J/buo1jvEGZ95gp2N2Dp FpBCbj1HRYBB1KisHE2rErzK/PQwy/RRvl5VfdnlerPfUxZBwKgx6VQ6Y5A+dwbuVtrHUCEe1YD /Ac2Bn+wQdtOAekN48uAi+Nn/vYpIsd44Iv6Yav2h1V2Ll8nzyr3xTqlGX4py0TYzvaCgScfGXo +ShJ3cugoQ+xLoTJmqgdx/jMENVUSU1AIfyDLMMYpA3J721TzY2tYS8jBORdUh6kbgiYaPpPNSY T2j9DcKuMSoz/jr/+rWQATBzQsJBVi2Ox7BjwawlT3q2VIE2qIZUHlCt7EB92C8WTrAq/sY7Tgp RFijQd1id1PEYXCdoJ39j6DkbLAB6o7HzixTzTEv+SiI8lRO1YkOFuZYfu6j0Rbrw+Ua0WVAoFx yRdPkomRsH6o5PviJP0kbh5cMAUJw009I/WzlgI= X-Received: by 2002:a05:600c:37c6:b0:4bb:7033:c938 with SMTP id 5b1f17b1804b1-4bb888147b7mr662722265e9.14.1796036275686; Mon, 30 Nov 2026 02:57:55 -0800 (PST) Received: from foxbook (bfj60.neoplus.adsl.tpnet.pl. [83.28.47.60]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8960068fsm372314855e9.4.2026.11.30.02.57.54 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 30 Nov 2026 02:57:55 -0800 (PST) Date: Mon, 30 Nov 2026 11:57:53 +0100 From: Michal Pecio To: Mario Limonciello Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Mika Westerberg , linux-acpi@vger.kernel.org, "Chia-Lin Kao (AceLan)" , Alan Stern Subject: Re: [PATCH v3] USB: hub: call ACPI _PRR reset during port power-cycle on enumeration failure Message-ID: <20261130115753.5cb59dd2.michal.pecio@gmail.com> In-Reply-To: <20260706080117.3754550-1-v3-1-0e3069228fe9@kernel.org> References: <20260706080117.3754550-1-v3-1-0e3069228fe9@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 03 Nov 2026 00:08:43 -0600, Mario Limonciello wrote: > Some USB-connected devices (e.g. MT7925 Bluetooth on Dell laptops) expose > their hardware reset line via an ACPI Power Resource for Reset (_PRR) > rather than relying solely on VBUS cycling for recovery. When the reset > GPIO gets stuck low the device stops responding on USB; a VBUS power-cycle > alone cannot recover it because the chip remains in reset regardless of > VBUS state. Could this be the widely-known "onboard Bluetooth fails to enumerate causing boot delays" issue affecting many different machines? > Add usb_acpi_port_prr_reset() in usb-acpi.c that, given a hub device and > one-based port number, looks up the port's ACPI companion handle, evaluat= es > _PRR to obtain the power-resource reference, and then calls _RST on that > reference to toggle the reset line. The function is a no-op if the port > has no ACPI handle or no _PRR method, so it is safe to call unconditional= ly > for every port. >=20 > Wire it into hub_port_connect() during the mid-retry VBUS power-cycle > (at (PORT_INIT_TRIES-1)/2 iterations), calling usb_acpi_port_prr_reset() > *after* VBUS goes off and *before* VBUS comes back on. The ordering is > critical: on the tested hardware the ACPI _RST method (MBTR._RST) drives > BT_RST low for 200 ms then high again. If _RST is called after VBUS is > already restored the GPIO pulse races with device enumeration starting on > the live bus; the device begins asserting USB signals while still held in > reset and enumeration fails. Performing the reset while the port is > de-powered ensures the GPIO pulse completes fully before the device is > given power and time to initialise. >=20 > After VBUS is restored, add an msleep(100) conditional on _PRR._RST having > succeeded. USB 2.0 spec =C2=A77.1.7.3 (Fig. 7-29) mandates a minimum of = 100 ms > between VBUS power-on and the first reset signalling for power settling. > On root hubs, hub_power_on_good_delay() returns bPwrOn2PwrGood * 2 with > no minimum floor; on the tested xHCI root hub bPwrOn2PwrGood =3D 10, yiel= ding > only 20 ms =E2=80=94 well below the spec minimum. (External hubs already= enforce > a 100 ms minimum via hub_power_on_good_delay().) When _PRR._RST has been > exercised the device must also complete its full power-on sequence (GPIO > de-assertion, internal oscillator start, firmware load) before USB > enumeration begins. The 100 ms sleep enforces the spec minimum and gives > the device adequate settling time. >=20 > Tested on a Dell laptop with MT7925 Bluetooth (idVendor=3D0489, > idProduct=3De139) whose BT_RST GPIO was stuck low. With this fix the > device recovers autonomously at boot without requiring a G3 > (mechanical power-off) cycle. The relevant dmesg sequence: >=20 > [ 1.448491] usb 3-10: new high-speed USB device number 4 using xhci_= hcd > [ 6.813942] usb 3-10: device descriptor read/64, error -110 > [ 22.685978] usb 3-10: device descriptor read/64, error -110 > [ 22.901715] usb 3-10: new high-speed USB device number 5 using xhci_= hcd > [ 28.317963] usb 3-10: device descriptor read/64, error -110 > [ 44.189949] usb 3-10: device descriptor read/64, error -110 > [ 44.294065] usb usb3-port10: attempt power cycle > [ 44.872709] usb 3-10: new high-speed USB device number 6 using xhci_= hcd > [ 44.888293] usb 3-10: New USB device found, idVendor=3D0489, idProdu= ct=3De139, bcdDevice=3D 1.00 > [ 44.888318] usb 3-10: Manufacturer: MediaTek Inc. >=20 > Signed-off-by: Chia-Lin Kao (AceLan) > Reviewed-by: Mario Limonciello (AMD) > Link: https://patch.msgid.link/20260706080117.3754550-1-acelan.kao@canoni= cal.com > Signed-off-by: Mario Limonciello (AMD) > --- > This was sent last cycle but got no feedback except for my review comment. > I think we should bring it forward this cycle. >=20 > Changes from v2: > * Rebase on 7.4-rc1 > * Link to v2: https://lore.kernel.org/linux-usb/20260706080117.3754550-1-= acelan.kao@canonical.com/ > --- > drivers/usb/core/hub.c | 14 ++++++++++ > drivers/usb/core/usb-acpi.c | 68 +++++++++++++++++++++++++++++++++++++++= ++++++ > drivers/usb/core/usb.h | 3 ++ > 3 files changed, 85 insertions(+) >=20 > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 199d3f535a891..72da7aea94cc4 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -5621,11 +5621,25 @@ static void hub_port_connect(struct usb_hub *hub,= int port1, u16 portstatus, > =20 > /* When halfway through our retry count, power-cycle the port */ > if (i =3D=3D (PORT_INIT_TRIES - 1) / 2) { > + int prr_reset; > + > dev_info(&port_dev->dev, "attempt power cycle\n"); > usb_hub_set_port_power(hdev, hub, port1, false); > msleep(2 * hub_power_on_good_delay(hub)); > + prr_reset =3D usb_acpi_port_prr_reset(hdev, port1); > usb_hub_set_port_power(hdev, hub, port1, true); > msleep(hub_power_on_good_delay(hub)); > + /* > + * USB 2.0 spec =C2=A77.1.7.3 requires at least 100 ms > + * between VBUS power-on and the first reset for power > + * settling. hub_power_on_good_delay() on an xHCI root > + * hub returns bPwrOn2PwrGood * 2 with no minimum floor, > + * which can be as little as 20 ms. When _PRR _RST was > + * also exercised the device must complete its power-on > + * sequence before enumeration; enforce the spec minimum. > + */ Nothing xHCI-specific about it. It seems hub_power_on_good_delay() used to enforce this, but that has been disabled on root hubs for some reason by 90d28fb53d4a5 without updating this caller. If next iteration resets the port before 100ms passes then it's a USB spec violation in all cases, not only for this device, isn't it? And I suspect that nobody who reaches this point would mind an extra 80ms of delay by default - this is not a "fast path". Was the delay seen to make a difference for this device? Regards, Michal > + if (prr_reset =3D=3D 0) > + msleep(100); > } > } > if (hub->hdev->parent || > diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c > index 489dbdc96f94a..bb1b5e8cdc15e 100644 > --- a/drivers/usb/core/usb-acpi.c > +++ b/drivers/usb/core/usb-acpi.c > @@ -142,6 +142,74 @@ int usb_acpi_set_power_state(struct usb_device *hdev= , int index, bool enable) > } > EXPORT_SYMBOL_GPL(usb_acpi_set_power_state); > =20 > +/** > + * usb_acpi_port_prr_reset - issue an ACPI _PRR reset on a hub port > + * @hdev: USB device belonging to the usb hub > + * @port1: port number (one-based) > + * > + * Some devices expose their hardware reset line via an ACPI Power Resou= rce for > + * Reset (_PRR). When such a device fails to enumerate (e.g. because th= e reset > + * GPIO is stuck low), the USB power-cycle alone is not enough; the firm= ware > + * reset path must also be exercised. > + * > + * This function evaluates _PRR on the port's ACPI companion to obtain t= he > + * power-resource reference and then calls _RST on that resource to togg= le the > + * reset line. It is intended to be called alongside the mid-retry VBUS > + * power-cycle already performed by hub_port_connect(). > + * > + * Returns 0 on success, -ENODEV if the port has no ACPI handle or no _P= RR > + * method, or a negative error code on failure. > + */ > +int usb_acpi_port_prr_reset(struct usb_device *hdev, int port1) > +{ > + acpi_handle port_handle; > + struct acpi_buffer buffer =3D { ACPI_ALLOCATE_BUFFER, NULL }; > + union acpi_object *pkg, *ref; > + acpi_status status; > + int ret =3D 0; > + > + port_handle =3D usb_get_hub_port_acpi_handle(hdev, port1); > + if (!port_handle) > + return -ENODEV; > + > + if (!acpi_has_method(port_handle, "_PRR")) > + return -ENODEV; > + > + status =3D acpi_evaluate_object(port_handle, "_PRR", NULL, &buffer); > + if (ACPI_FAILURE(status)) { > + dev_dbg(&hdev->dev, "port%d: _PRR evaluation failed: %s\n", > + port1, acpi_format_exception(status)); > + return -ENODEV; > + } > + > + pkg =3D buffer.pointer; > + if (!pkg || pkg->type !=3D ACPI_TYPE_PACKAGE || pkg->package.count !=3D= 1) { > + dev_dbg(&hdev->dev, "port%d: _PRR returned unexpected object\n", > + port1); > + ret =3D -EINVAL; > + goto out; > + } > + > + ref =3D &pkg->package.elements[0]; > + if (ref->type !=3D ACPI_TYPE_LOCAL_REFERENCE || !ref->reference.handle)= { > + dev_dbg(&hdev->dev, "port%d: _PRR element is not a reference\n", > + port1); > + ret =3D -EINVAL; > + goto out; > + } > + > + status =3D acpi_evaluate_object(ref->reference.handle, "_RST", NULL, NU= LL); > + if (ACPI_FAILURE(status)) { > + dev_dbg(&hdev->dev, "port%d: _RST evaluation failed: %s\n", > + port1, acpi_format_exception(status)); > + ret =3D -EIO; > + } > + > +out: > + kfree(buffer.pointer); > + return ret; > +} > + > /** > * usb_acpi_add_usb4_devlink - add device link to USB4 Host Interface fo= r tunneled USB3 devices > * > diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h > index a9b37aeb515be..4d3dc3bd881b2 100644 > --- a/drivers/usb/core/usb.h > +++ b/drivers/usb/core/usb.h > @@ -211,7 +211,10 @@ extern int usb_acpi_register(void); > extern void usb_acpi_unregister(void); > extern acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, > int port1); > +extern int usb_acpi_port_prr_reset(struct usb_device *hdev, int port1); > #else > static inline int usb_acpi_register(void) { return 0; }; > static inline void usb_acpi_unregister(void) { }; > +static inline int usb_acpi_port_prr_reset(struct usb_device *hdev, > + int port1) { return -ENODEV; } > #endif >=20 > --- > base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 > change-id: 20260706080117.3754550-1-acelan.kao@canonical.com >=20 > Best regards, > -- =20 > Mario Limonciello >=20