From nobody Thu May 2 11:21:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58193+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58193+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1588025789; cv=none; d=zohomail.com; s=zohoarc; b=NBAdY1p7dc+MqPiqnBONXAPn9QxUNYoY39XFg80WeBM6YDyele8O3M+gs5+i/biQwaAsFmK2ju+YiwaDfjlr1Ulxis4y0vbgFhEHm736kg/3t/8hhReEvtd7Z5RNWzOSOaoqg8biAcSzj+/C2xXmNNZ4MdwQWRQhYiEEvEMbHBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588025789; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=2AqSJTkbp6mXm2qMYNyQ8JA2g+f+LuNHumqfTkdn1zY=; b=WLwqzt4ZmhXtetqDA4gCip/uxTmHDu+yzclNnpEga048TrEg0Q3CRVwislbQrW8ZDuAXC3E5LA3+11bfXKq7YHfkUJbVs+qPEkZB19pNU69zbrjYqj2ZGCq145CkektW7nnBEA1y5ouqEKmXtARz/Nh74rhviZ8qo4hlI8BteW4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58193+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1588025789831265.402995331891; Mon, 27 Apr 2020 15:16:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id TwWIYY1788612xO7GO7nSWRD; Mon, 27 Apr 2020 15:16:29 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.164.1588025788267877016 for ; Mon, 27 Apr 2020 15:16:28 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D54BD31B; Mon, 27 Apr 2020 15:16:26 -0700 (PDT) X-Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CBC023F68F; Mon, 27 Apr 2020 15:16:26 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: hao.a.wu@intel.com, ray.ni@intel.com, michael.d.kinney@intel.com, feng.tian@intel.com, jian.j.wang@intel.com, ard.biesheuvel@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: On reset rebuild descriptor table Date: Mon, 27 Apr 2020 17:16:25 -0500 Message-Id: <20200427221625.599302-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: <27952.devel.edk2.groups.io> Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: 81WTIL2MZ1xZ2Asf62vDj0lnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1588025789; bh=5Sj/jhRMoOXP68gfc1MQ6jBvV7T+KFgy+fYaljyTIKA=; h=Cc:Date:From:Reply-To:Subject:To; b=dYsIhXP7Yk1475US0ZrXT27Vvs5eXb4lgNoDbV7HWQpLOVHPgkkapiDju2S8WAMl583 ke81ytN9vJMu28JocckUIYPI/d4WDdRj6jshy+a4XR/MLsXIL/ptAfbitn/WHAA7Jl9so AWnRaRHQ6aylcJqXXWuEfNapIPJroLJ6PbI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" During port reset, the device descriptors should be checked before attempting to set an endpoint configuration. In particular this fixes a crash due to ASSERT(TrsRing !=3D NULL) in XhcSyncTrsRing(). That crash happens during error recovery on devices attached to XHCI hosts. This is because the port disable clears and deallocats all the EP data structures. When the port is reconfigured without first requesting the EP descriptors, XhcSetConfigCmd[64]() is not being called because the NumConfigurations remains 0. We could attempt to rebuild the EP descriptions directly from the XHCI driver. OTOH, its probably good practice to assure the device description is what we expect from within the core USB subsystem during reset. Signed-off-by: Jeremy Linton --- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c b/MdeModulePkg/Bus/Usb= /UsbBusDxe/UsbBus.c index 4b4915c019..17bb691bf8 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c @@ -874,6 +874,14 @@ UsbIoPortReset ( // is in CONFIGURED state. // if (Dev->ActiveConfig !=3D NULL) { + Status =3D UsbBuildDescTable (Dev); + + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "UsbIoPortReset: failed to build descriptor tab= le for %d - %r\n", + Dev->Address, Status)); + goto ON_EXIT; + } + Status =3D UsbSetConfig (Dev, Dev->ActiveConfig->Desc.ConfigurationVal= ue); =20 if (EFI_ERROR (Status)) { --=20 2.24.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58193): https://edk2.groups.io/g/devel/message/58193 Mute This Topic: https://groups.io/mt/73315690/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-