From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.4836.1603335669469568752 for ; Wed, 21 Oct 2020 20:01:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=YF6/Vy8d; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: heng.luo@intel.com) IronPort-SDR: NzsOm6iZfh18oPK/tLq8oUFdZubR6HxV3WrN4Sa75VI7GQ8bI93Mo1WwyxeuQ3TvqJQBNnvyPe PM1OyNSA3Htg== X-IronPort-AV: E=McAfee;i="6000,8403,9781"; a="229087033" X-IronPort-AV: E=Sophos;i="5.77,403,1596524400"; d="scan'208";a="229087033" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2020 20:01:06 -0700 IronPort-SDR: xxdqueBGcmLjVQJ2j6FAqVpxrmHMIz4+GVOTx86GKzrItLxu8GM5MptVUWFgvpFMI1nV15g6Dv wCMat437K16Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,403,1596524400"; d="scan'208";a="524121003" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 21 Oct 2020 20:01:06 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 21 Oct 2020 20:01:06 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 21 Oct 2020 20:01:06 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.42) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 21 Oct 2020 20:01:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RhpuS4L4qOvsBYLoMbfRHnzo6JYFC5R5vJHWJE4zYTeENouFvtI5NQpGKaiz3mZE/9iGw/K56cjdGN7+Mp5+JW6aO6ymxCZFP8lQjJ70GMa0H3P7cLVRKZjOTU0BYEvXs/06PMRnhPWgboGjXWD4/FTgEV3cS5sqIalT4vW9bcdwibd7q7yYnGkW01MS/KP0kJw96sSps0mKEpKBvFw6jrvdibN83YjPLytNqMYoAC46VooH78YOKMBvvZAxJaPOcw/fvzAVzA5mJzzjqXMiOv9z4klfLb1KJ3yumZ3YZCFOTK3SRakwfI9i1q4M8omkW9zIPlr7dpu12U0PnXMD+g== 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=w/gWOfxQctKo61BKT6ZRG1rvWrFaqw0ryvWGGTlXpOg=; b=RGGQfZjSwDTFtpB3x+UgxVsjMuODrTxTDyx8BJQ/zlmCt9fzl9/b2TXprDlCVasLb2svxFmNCDoCSXzfQShn2PQGJUe44A2ZfDPH90jpyIf+5R9saMeumB4hstfEKglr+g+XTHWJrRwsB5l4DIDFCd6IQoSK3Hbrz0gIfPSycgfLmgn3MD0xCrsFzmG0sDaKYkGIP9VeZ51EhSZGQq/KqZsHwZH27b56XZ8T2a2QU2XCNKzlvtsnXJI8JZ9pvb2lSFznCtuSJVd3BrbJW5CbMx5HsBQJo8cVQohKFLg0OEztfoZv8qrzrFeP/OL6cVqfe4nj+n3E93vyw9ZhU2MmsQ== 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=w/gWOfxQctKo61BKT6ZRG1rvWrFaqw0ryvWGGTlXpOg=; b=YF6/Vy8dRVK5A8/Oc4CyWX4cVV7Q8bNNhxpJg4L1tdniKxEAO1/46C4blzKKN5H9SQSt2S3lVN5pQ1Ba0ssRmtJSKz7qDf+6f6NakrDCqiLJERMF1OQF3k+eJr4F3Q2HaH3g207ppefYIXaBGWycpApclcDJRAEXYok7nNQQiT0= Received: from MWHPR11MB1805.namprd11.prod.outlook.com (2603:10b6:300:114::14) by MWHPR11MB1728.namprd11.prod.outlook.com (2603:10b6:300:2b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 22 Oct 2020 03:01:05 +0000 Received: from MWHPR11MB1805.namprd11.prod.outlook.com ([fe80::bd78:5a79:d875:65e4]) by MWHPR11MB1805.namprd11.prod.outlook.com ([fe80::bd78:5a79:d875:65e4%12]) with mapi id 15.20.3477.028; Thu, 22 Oct 2020 03:01:05 +0000 From: "Heng Luo" To: "Wu, Hao A" , "devel@edk2.groups.io" , "jbrasen@nvidia.com" CC: "Ni, Ray" , Jon Hunter Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Retry device slot init on failure Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Retry device slot init on failure Thread-Index: AQHWp8EpkR/mfPS+y0246NywgHCuvqmizDqAgAAh+1A= Date: Thu, 22 Oct 2020 03:01:04 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.198] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 74da9b25-5d12-452d-08f6-08d87636b76f x-ms-traffictypediagnostic: MWHPR11MB1728: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wJE6I0pq78AIQHUScPxGMsngGNu6inO54TRrQt6vlKqJ/OCGDUdXphmHmzn7ryl8PFUM7VxeTBk8kFjy3tkOzK0ka2t9foCSeyGbLhHpDNCxy0XXePB+aVLjGGQFIls4fQCLm1rNj+06M7R48rPYdGI3ilhDpw0sa49eMyw70e497SzztINXx1mmCNRroQ9Ubjlrz28siVhZqeAFeaanGUMekllZnUp+hS0dMzUvxpw5yx1UoO39JIMpVSp0/RLg/92yD3Ln0VTKot+g6soCnGzhtQztSbsk3vTASLxFy815uWESkSfhmEcmCVL4Sp6ywLwM7i8tjKJPLTclw32FpUKhqpVF9C8hU1mhJdnI1Tv/wbEYLNcXGu5VzYMMABYWSH/bqDdR9143gOVSk2i7mw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1805.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(366004)(136003)(376002)(39860400002)(64756008)(66446008)(66556008)(186003)(66476007)(966005)(66946007)(76116006)(83380400001)(52536014)(8676002)(7696005)(4326008)(71200400001)(9686003)(110136005)(5660300002)(478600001)(53546011)(55016002)(86362001)(26005)(54906003)(33656002)(316002)(2906002)(6506007)(19627235002)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Lyen9BHAodPvKrt1AUTxVWJT650OSzD3BwS2v02B1JiK1hXwAysMJQ0mT+7PDk+Bg3bWnikK30G6hGKJ9AGjAfmw05Ed7Pv8+sKMRlPpEYJ1oIw0Hd+fauMJJTbHrgMxI2lFOkF40qi/SchmY1YJOA5rWwOz1VABfKyCMNtz3Urrca72alQAN4ICfk1dm25LiNuIeQBwFVQuOuuStmvtthDVFWugnQNDE16z1+yFICrR4/rmdM5zm0RVpTmrZtvcv0PziKpPT+iejC/WYkcZRl4E32ePhU1GEZzpA5CxfQvdO2yTioaN4LFuBYwyR+JwBayJBCWE6VyMZ8AyCDv92v8l8b+ovHYEjDvt0Q5r8iJYgHvoiSnD6bNSn9A/tsR9WuAqkGw429lImccEbwKvagBAVItswxgSoD/r5NM0x7RTQB+nJomzi6UD8aQc7Yz2gg2DVAjHLKfeFlkKmn5hZPR+gPzWH7LK9MXXAyBTjoJQb/iCDqwYnuBLCSpq9zop+WfThazyIl0VFaOlq9nduVR71RiBWHsPOLet2OSidmF1GBMuwsOUpOjJYd+48wX1IVbmWW20VGrC3RyzUBUyn8UOhjhyzIK24GEUMKCFSn3y4EJ97ohC8cNeLslwMTMpCiJl+nbsc5e/cBfOyiG7xQ== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1805.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74da9b25-5d12-452d-08f6-08d87636b76f X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2020 03:01:05.0214 (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: yNamyFeeiliKVOGlIlqtYa2iPtUBEq8sF+tQiaL0CHFpgy04hLy3jWIGneLaM/dtkBJnXB2wD7PNO0oG/Ilekg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1728 Return-Path: heng.luo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Hao, I applying this patch, it cannot fix BZ https://bugzilla.tianocore.org/sho= w_bug.cgi?id=3D3007. Thanks, Heng > -----Original Message----- > From: Wu, Hao A > Sent: Thursday, October 22, 2020 8:54 AM > To: devel@edk2.groups.io; jbrasen@nvidia.com; Luo, Heng > > Cc: Ni, Ray ; Jon Hunter > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Retry device slo= t > init on failure >=20 > Hello Heng, >=20 > It looks to me that the patch is addressing a similar issue you met on t= he > UpXtreme board mentioned in: > https://bugzilla.tianocore.org/show_bug.cgi?id=3D3007 >=20 > Could you help to check if such retry during the slot initialization hel= ps for > the USB device on your board? > Thanks in advance. >=20 > Best Regards, > Hao Wu >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Jeff > > Brasen > > Sent: Wednesday, October 21, 2020 11:45 PM > > To: devel@edk2.groups.io > > Cc: Wu, Hao A ; Ni, Ray ; Jon > > Hunter ; Jeff Brasen > > Subject: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Retry device slot > > init on failure > > > > From: Jon Hunter > > > > With some super-speed USB mass storage devices it has been observed > > that a USB transaction error may occur when attempting the set the > > device address during enumeration. > > > > According the the xHCI specification (section 4.6.5) ... > > > > "A USB Transaction ErrorCompletion Code for an Address Device Command > > may be due to a Stall response from a device. Software should issue a > > Disable Slot Commandfor the Device Slot then an Enable Slot Command > > to recover from this error." > > > > To fix this, retry the device slot initialization if it fails due to a= device error. > > > > Signed-off-by: Jeff Brasen > > --- > > MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 71 ++++++++++++++-------- > > -- > > 1 file changed, 42 insertions(+), 29 deletions(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > > index 9cb115363c..1a16864205 100644 > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > > @@ -1717,9 +1717,11 @@ XhcPollPortStatusChange ( > > EFI_STATUS Status; > > UINT8 Speed; > > UINT8 SlotId; > > + UINT8 Retries; > > USB_DEV_ROUTE RouteChart; > > > > Status =3D EFI_SUCCESS; > > + Retries =3D 1; > > > > if ((PortState->PortChangeStatus & (USB_PORT_STAT_C_CONNECTION | > > USB_PORT_STAT_C_ENABLE | USB_PORT_STAT_C_OVERCURRENT | > > USB_PORT_STAT_C_RESET)) =3D=3D 0) { > > return EFI_SUCCESS; > > @@ -1739,40 +1741,51 @@ XhcPollPortStatusChange ( > > RouteChart.Route.TierNum =3D ParentRouteChart.Route.TierNum= + 1; > > } > > > > - SlotId =3D XhcRouteStringToSlotId (Xhc, RouteChart); > > - if (SlotId !=3D 0) { > > - if (Xhc->HcCParams.Data.Csz =3D=3D 0) { > > - Status =3D XhcDisableSlotCmd (Xhc, SlotId); > > - } else { > > - Status =3D XhcDisableSlotCmd64 (Xhc, SlotId); > > - } > > - } > > - > > - if (((PortState->PortStatus & USB_PORT_STAT_ENABLE) !=3D 0) && > > - ((PortState->PortStatus & USB_PORT_STAT_CONNECTION) !=3D 0)) { > > - // > > - // Has a device attached, Identify device speed after port is ena= bled. > > - // > > - Speed =3D EFI_USB_SPEED_FULL; > > - if ((PortState->PortStatus & USB_PORT_STAT_LOW_SPEED) !=3D 0) { > > - Speed =3D EFI_USB_SPEED_LOW; > > - } else if ((PortState->PortStatus & USB_PORT_STAT_HIGH_SPEED) != =3D 0) { > > - Speed =3D EFI_USB_SPEED_HIGH; > > - } else if ((PortState->PortStatus & USB_PORT_STAT_SUPER_SPEED) != =3D 0) { > > - Speed =3D EFI_USB_SPEED_SUPER; > > - } > > - // > > - // Execute Enable_Slot cmd for attached device, initialize device= context > > and assign device address. > > - // > > + do { > > SlotId =3D XhcRouteStringToSlotId (Xhc, RouteChart); > > - if ((SlotId =3D=3D 0) && ((PortState->PortChangeStatus & > > USB_PORT_STAT_C_RESET) !=3D 0)) { > > + if (SlotId !=3D 0) { > > if (Xhc->HcCParams.Data.Csz =3D=3D 0) { > > - Status =3D XhcInitializeDeviceSlot (Xhc, ParentRouteChart, Po= rt, > > RouteChart, Speed); > > + Status =3D XhcDisableSlotCmd (Xhc, SlotId); > > } else { > > - Status =3D XhcInitializeDeviceSlot64 (Xhc, ParentRouteChart, = Port, > > RouteChart, Speed); > > + Status =3D XhcDisableSlotCmd64 (Xhc, SlotId); > > } > > } > > - } > > + > > + if (((PortState->PortStatus & USB_PORT_STAT_ENABLE) !=3D 0) && > > + ((PortState->PortStatus & USB_PORT_STAT_CONNECTION) !=3D 0)) = { > > + // > > + // Has a device attached, Identify device speed after port is e= nabled. > > + // > > + Speed =3D EFI_USB_SPEED_FULL; > > + if ((PortState->PortStatus & USB_PORT_STAT_LOW_SPEED) !=3D 0) { > > + Speed =3D EFI_USB_SPEED_LOW; > > + } else if ((PortState->PortStatus & USB_PORT_STAT_HIGH_SPEED) != = =3D 0) > { > > + Speed =3D EFI_USB_SPEED_HIGH; > > + } else if ((PortState->PortStatus & USB_PORT_STAT_SUPER_SPEED) > > + !=3D 0) > > { > > + Speed =3D EFI_USB_SPEED_SUPER; > > + } > > + // > > + // Execute Enable_Slot cmd for attached device, initialize > > + device context > > and assign device address. > > + // > > + SlotId =3D XhcRouteStringToSlotId (Xhc, RouteChart); > > + if ((SlotId =3D=3D 0) && ((PortState->PortChangeStatus & > > USB_PORT_STAT_C_RESET) !=3D 0)) { > > + if (Xhc->HcCParams.Data.Csz =3D=3D 0) { > > + Status =3D XhcInitializeDeviceSlot (Xhc, ParentRouteChart, > > + Port, > > RouteChart, Speed); > > + } else { > > + Status =3D XhcInitializeDeviceSlot64 (Xhc, ParentRouteChart= , > > + Port, > > RouteChart, Speed); > > + } > > + } > > + } > > + > > + // > > + // According to the xHCI specification (section 4.6.5), "a USB > Transaction > > + // Error Completion Code for an Address Device Command may be due > > + to > > a Stall > > + // response from a device. Software should issue a Disable Slot > > + Command > > for > > + // the Device Slot then an Enable Slot Command to recover from > > + this > > error." > > + // Therefore, retry the device slot initialization if it fails du= e to a > > + // device error. > > + // > > + } while ((Status =3D=3D EFI_DEVICE_ERROR) && (Retries--)); > > > > return Status; > > } > > -- > > 2.25.1 > > > > > > > >=20 > >