From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.1828.1588032981162650719 for ; Mon, 27 Apr 2020 17:16:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=uta7u2kV; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: guomin.jiang@intel.com) IronPort-SDR: HMf+NPDJGlRrzxCcse5iMuZg9bFfy6h0YiYla81psJFwXXs1LxglcfhA279Ha+fNaEnry4gNSJ 396G9SMmzngQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2020 17:16:20 -0700 IronPort-SDR: ygMtNbcE7OoPwvGqs5Rv5BZrL0t8Sig0LprT6797TwPIAcAAGRnXb9gaFjQfaI+jYf5fBMHX7V yOAE6805PoQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,325,1583222400"; d="scan'208";a="292680071" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 27 Apr 2020 17:16:20 -0700 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 27 Apr 2020 17:16:20 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 27 Apr 2020 17:16:20 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 27 Apr 2020 17:16:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DK5xev0A60pPjUg5VUakzSA7x/5Cao46OOEIa+As57RqSyNWLDofOI2ATuZBul0IiVXd42kx7v0tiEcVNvSa65ZlVHkCIMJE9mkvNlt34w9Tsvc2vnHWO4EhYy8lk3o2NijUoTTah4hU89TI6j1/f8XucoSfjEUsJEiM4ha75yuBuTP+IwOgJC2r5+8UTkk2X41ySN5lUh4obrbS7p2sXBoXgdwZ/4fizAFieoQxFE4gKOyrB8GKecWCnXio+ASX6IC+vrBPd7ou3uiZuiixEAKwOeoDaj32qCh1oQC/JFjSjA7tETvAPG6koxxYfXI2hc7Ka4TbCQQ0J4MlCgeuxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QRohQjytV+dEKAGQDs++EPcQxVU7ec0bhDVkoyzGYhI=; b=jX+OkeAwOZsze+FN83p5O1otKZjnd6GnAF4CenZBlzuiKWB0U99rKdc+trexLcrzL/g1GsxKdPB2A3VFLLItxjflcOqERaAIfF7TZjbEcfajyLN3dolaQL4Wjc5lECL0BWR7SZT4RybxaHGhYTB+pRMG/NgE6XA0e0jHxbH1A+0K+jJR6XfgobDry8ZpdCmHZpu3DPlDEyqQE603WLpBdMiT3lpWUhL4eG6ckKSOKM5GNiJJaliEH6syIQd4gPQ3XVAmSGVZ6EukkkNgLIrGvDKUoHXGLX4s9gNI6Zsy2cdPWUt8OombUSxqUWFPvnk6IAThQDV41hCIoZFuWZYQXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QRohQjytV+dEKAGQDs++EPcQxVU7ec0bhDVkoyzGYhI=; b=uta7u2kV5+nqHGL5ZpNo4r8xEcyM//XGcpxgWS77k6geYRojvFjY/bJW6nOsopuRgzC4z3bNHU/cioDkzIiUQmc/OuCASlv5TlTxy5/+yE9tlTns51Uv6S9flOG4wUoOBcUH+2jTcKZRswCODPczBsAzgZKwW00C8unbYwFTAMI= Received: from DM6PR11MB2955.namprd11.prod.outlook.com (2603:10b6:5:65::31) by DM6PR11MB3642.namprd11.prod.outlook.com (2603:10b6:5:138::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Tue, 28 Apr 2020 00:15:38 +0000 Received: from DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::ccd4:4b0d:535a:58be]) by DM6PR11MB2955.namprd11.prod.outlook.com ([fe80::ccd4:4b0d:535a:58be%7]) with mapi id 15.20.2937.023; Tue, 28 Apr 2020 00:15:38 +0000 From: "Guomin Jiang" To: "devel@edk2.groups.io" , "jeremy.linton@arm.com" CC: "Wu, Hao A" , "Ni, Ray" , "Kinney, Michael D" , "Tian, Feng" , "Wang, Jian J" , "ard.biesheuvel@arm.com" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: On reset rebuild descriptor table Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: On reset rebuild descriptor table Thread-Index: AQHWHOGb4AckBcN8X02LfCwtfbQxwKiNqRYA Date: Tue, 28 Apr 2020 00:15:38 +0000 Message-ID: References: <20200427221625.599302-1-jeremy.linton@arm.com> In-Reply-To: <20200427221625.599302-1-jeremy.linton@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: spf=none (sender IP is ) smtp.mailfrom=guomin.jiang@intel.com; x-originating-ip: [134.191.221.109] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d9cc0984-a7f1-4db4-7453-08d7eb094797 x-ms-traffictypediagnostic: DM6PR11MB3642: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0387D64A71 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB2955.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(39860400002)(366004)(396003)(376002)(346002)(136003)(478600001)(86362001)(52536014)(66556008)(66476007)(64756008)(66446008)(33656002)(76116006)(66946007)(186003)(8936002)(53546011)(6506007)(2906002)(81156014)(7696005)(5660300002)(8676002)(9686003)(55016002)(71200400001)(4326008)(54906003)(966005)(26005)(316002)(110136005);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Q2RXbQKp8y63kd+uiepPhVS+luYfI86eHZUHDrx42BfCDWKURO8467imtK43mmWJHmOiS10hc0kqop7EJsclekGt5GaxQTbdPjhMQt/UXLb23rvj1u+SVmZF1jcD8+i7CPTMhC+V0pi4nB72Zps4Cso8B9FvnsswiLIUZMIYKU8JN+dYfK0Rot0J/5zQUiWSHAZFjIkRuRBOfBf70Vqx0JEDX/J8gD6ybWee9t69BJeSM4yBw3kDSK7Jr7hs6UXBgSzMqhsrQUfnqderiocXQB307UQkdDHe0um6FVLQjaF2J2dr8Vx4Njq2kMkEGOG/a45HIDX1J4xLB/obYb4U2GFyEhPx7xpzAn/8BDJqC4kBiI8lBPSoL1/C543O1enGNgqSgcIhcOXW1+UYsagdEYU/C/2GzVrBVwiiQaU8GFBxXO0bp1QYvwUDMKB8p47tD6uQXPlpgXoCmOFVn9Sat0edyTp3FEeYu4GHu4b3YsTupqf4uZXfkutWqQ9C+UTccjl7h5kesb8L3a4i79G4Wg== x-ms-exchange-antispam-messagedata: rWnbuYMIQADzSGQ0AEeCz2+FL5jvggBuuqxncsHsVcIIu6UapAWbVEIp0wTxuGbEPh/GRm0LLTUOB3ffzHcqsvpdkW1Ywh/Yz+gJdZ+bseKcuJ4/Z0kxc5OdDpGylKSH4IaAVxQ99vjGw2SLnnJ5Q/xViAsk3kZx2NHuMZW2iRSP+ASLCLetn5eh846Fq7atIsG0WRM4uJdg4qepVJw9E+2OXhOqwBovlbPzOFREK469ZHXJT5thwMpAmbQW3VZ1uCc8ZRdl2WFrVOuZHpx3K7n3pNX/ZhH4F0wEmXqLYCGO5H65cB5UnGtnNVAf159FcdD4WB9/zG6lmPDzGaKyrPSHzmdsLEQ2T6Hv5BdBZeWUm7hB+Wgu00e04+/Uj/crYVCgI3/INGcu1csRnRjPFNAmI2y+GKU1nX8FJRVsPVIjXixbpt0frbbpzlGiZY5WbPyrsd3dogY5ZLfrR1ur8RkNuIo7ACWHDzeB82O5HbyTQTbVogAwEU7scRwRxwtivdORCGKGh8TfGgoFEOBBvw393UTGNlpaXwXMctK+ZaUCjqS9jgaHZv73Wxph6bzhM8xZkLks82ZX1ctThOgBI4/ZHE5Dx0gSqoD76ri1ETYHzyXJVsKSVe5W55FDhQxyOvCFGLJIQ5z+F6zD8ImC4EbVwGxXx+U6UWNLQ8UhBxLe5A9x28SPofe7Je0/8w/8VWkeTBQiE/kRn/zHQHNjPBdYkRtq6zXqFwGRJerO0GRpzv5ZZiMuPlswuyegnRpTRGIBlrlBP36blUw+LcivXXRDHv4i6NbToMFLcTdOcaX+mFoKvwyHxYiv/aqdgIeC MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d9cc0984-a7f1-4db4-7453-08d7eb094797 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Apr 2020 00:15:38.2536 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: m7Zze+2fUA54FtQbbwGPbWGkq9VEN4smeWaeEDxKfA7m3TLYz3m3AVV9kD7xdXj/HsIoapDto7FtzhoCWt4DxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3642 Return-Path: guomin.jiang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Jeremy, You can refer https://edk2.groups.io/g/devel/message/58125 for discussion a= bout this solution. Two issue I found: 1. Memory leakage may occur if doing so and I am investigating it. 2. It test pass with OVMF but fail in real platform, and I am figuring out = the flow. Best Regards Guomin > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Jeremy > Linton > Sent: Tuesday, April 28, 2020 6:16 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A ; Ni, Ray ; Kinney, > Michael D ; Tian, Feng ; > Wang, Jian J ; ard.biesheuvel@arm.com; Jeremy > Linton > Subject: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: On reset rebuild > descriptor table >=20 > During port reset, the device descriptors should be checked > before attempting to set an endpoint configuration. >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Jeremy Linton > --- > MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > 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. >=20 > // >=20 > if (Dev->ActiveConfig !=3D NULL) { >=20 > + Status =3D UsbBuildDescTable (Dev); >=20 > + >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((EFI_D_ERROR, "UsbIoPortReset: failed to build descriptor t= able > for %d - %r\n", >=20 > + Dev->Address, Status)); >=20 > + goto ON_EXIT; >=20 > + } >=20 > + >=20 > Status =3D UsbSetConfig (Dev, Dev->ActiveConfig->Desc.ConfigurationV= alue); >=20 >=20 >=20 > if (EFI_ERROR (Status)) { >=20 > -- > 2.24.1 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. >=20 > View/Reply Online (#58193): https://edk2.groups.io/g/devel/message/58193 > Mute This Topic: https://groups.io/mt/73315690/4399222 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [guomin.jiang@intel.co= m] > -=3D-=3D-=3D-=3D-=3D-=3D