From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.19083.1611800073471490732 for ; Wed, 27 Jan 2021 18:14:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=pRuTX+fr; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: hao.a.wu@intel.com) IronPort-SDR: mQTXv87Pnky+T+r5NuhuQV4GUURNf/FDrT2bFYB48D6M+GDy49qwukl9yzjLbTYrjn86eXa4aH bbdiMm96hlog== X-IronPort-AV: E=McAfee;i="6000,8403,9877"; a="180244889" X-IronPort-AV: E=Sophos;i="5.79,381,1602572400"; d="scan'208";a="180244889" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2021 18:14:32 -0800 IronPort-SDR: HwFHHQQ6jYajiKpdJXRNqw69ny5Tl+XjkrEiOFCKa9U6/nE5OZyVpTaHTmLglPUbE/gSXqfyhR Lvi2FFovh1CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,381,1602572400"; d="scan'208";a="473378316" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga001.fm.intel.com with ESMTP; 27 Jan 2021 18:14:31 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 27 Jan 2021 18:14:31 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 27 Jan 2021 18:14:30 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) 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, 27 Jan 2021 18:14:30 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 27 Jan 2021 18:14:29 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mlaF8/Xk7OpNc1b1FNqFnqtS0tgIieKV48Rb9UluaDhTxWr7jv24I1fzeqZ/boVlwFPyS2yswKPc66JC3qp3KJTcr5/xQmo7LmdF9gu58al2j7W4T4S3UIXdFT6KID7avTRQGAQrMlyT8uivzbw3XJSgkuFpBV01aEyxPQi9xKqQC2AYCOfKczlpWUichUmQdYLrTX7SaRpIXmD65Ey+QxZDDCPB3SRihf/eynr1Ib2rLttNZhKmiXYNsnGJ1blqsIuQHPtCnpP18DBwII7PB/Yozc3SM1rNJuqVYVg2aJr20AElh1XqQWtPOIFTRkp4+HtcTs89TyCACdcSHh9Cpg== 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=TLF760nkdL5U4yOf0ndnihQvXVGGGObM1IYEcSS0Soc=; b=jdu7nF1lsznhiwtJy1v6gYOH6v4akUtnRxeEAHwG+Hg9zsu3CyTwh5Kf0MEuNETNr4WC5cIuQ+amQ78gQM18kAanC7fs7XCjBU4e7v7io8gIsquKtK67+Qp9nFeEYSgJd++WSZa54EESk5x2tCOHttSCQRDaBV6OTl6ucgNY4cpwLDYRP8yx9Gz/q0nMxWKrRNfTJ8d+9JCWMpkc2ABngAx2skQB2AmhQ37q2XMrFdrMJZ66nX5aOr2lsQCQoscHg43ZMgf/1JvsBkaNQw53iDn0X00G7VYl6oM9Bum1DLz2oHP4wqp6+9GzTCEw76nhDeMlVo0tcNWqS4VasHMp1Q== 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=TLF760nkdL5U4yOf0ndnihQvXVGGGObM1IYEcSS0Soc=; b=pRuTX+frmpyAmSOg+H92UqIxe6YqY73bJyJ1V3jdIyuLKUwhmS+guXjfklIG2jhI0DxsLbpSGVsDlXHWR1f2zwlAh1lZJ3RSHW4MoBsyrgB/9DhuTHCghV8kuA02m8aHcX4kOs4VGN7tAe/ZD1CAE7TJsYY3bp5hwQti7YGgU9Y= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN7PR11MB2625.namprd11.prod.outlook.com (2603:10b6:406:b9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.15; Thu, 28 Jan 2021 02:14:28 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::d11e:3b2:e34f:7f0f]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::d11e:3b2:e34f:7f0f%5]) with mapi id 15.20.3784.017; Thu, 28 Jan 2021 02:14:28 +0000 From: "Wu, Hao A" To: Patrick Rudolph , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Ni, Ray" Subject: Re: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting Thread-Topic: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting Thread-Index: AQHW70U7/IDIozZcIE+pMsPw7H8Gj6o8VmOw Date: Thu, 28 Jan 2021 02:14:27 +0000 Message-ID: References: <20210120155900.3343123-1-patrick.rudolph@9elements.com> <20210120155900.3343123-2-patrick.rudolph@9elements.com> In-Reply-To: <20210120155900.3343123-2-patrick.rudolph@9elements.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: 9elements.com; dkim=none (message not signed) header.d=none;9elements.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f814280b-5ac0-4b18-9151-08d8c33270c1 x-ms-traffictypediagnostic: BN7PR11MB2625: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PjBud+IhdwJAWzc6jFBWVp2BwINo68QgNwP6Ss0L3aLDaCF9NfUxJFC7M6MUFBr2Zp4iCPknEdavXjMkxQebjBNyqE8ez8bPqgqEHQ619r+ZYumc6CxAMej3sXNJfHWtR0s1cw4IYerEQceHIj0vZrdTLMga/14/8aRsyUv595+Jq7jl7JGZzrI54SeEwAAkWJ2pSyg14S95YiJWE2RKn21jB5Bt0SH5gE0M+jhG22Rvrbv90spQyQerHM1a2F07mLG6GJkBkNyux/SY/xy2FX4RKyows0/rEZsJQGpA/Gts/Le0e3R2KhHTlG/9k5vw76RV1luBbqFmSTkTkAETcfGWGcgKzXgKhxOxtx8OUtj8t7XFBtvrJbGXYtpVzuKl1qrf9Qx8/j0aoBo3Sl9gV22noIrcYDiH1PgN6/Ot1GO4a2mv6q7gc9RfX38t4BjTJgQVTYSF7K1fVTN9tkj7Y0LOf49DF2nTxddLBNZcB+ycG55znSXObVtDn+IeKLmQhffa7T+LajCKNrOR0Vn5TA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(39860400002)(136003)(376002)(396003)(346002)(316002)(7696005)(52536014)(2906002)(107886003)(33656002)(26005)(66476007)(83380400001)(64756008)(86362001)(4326008)(8936002)(76116006)(66556008)(110136005)(478600001)(8676002)(9686003)(55016002)(54906003)(186003)(71200400001)(53546011)(66946007)(5660300002)(6506007)(66446008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?FDBd+6cMNU+mq2+kVsCWTdPDZNeguVL31nk3tmcEplfCKzPDlu48koiIDPpk?= =?us-ascii?Q?UorD0bRb1M2s2ElO38OojfsuX4AZj3DDqtT7N8PW2qxvfavwHRLuzKzqm0VE?= =?us-ascii?Q?9+p72sWudbGRK4Q6baHjzkGN+ODW6KhAmGjuUpNO/MYm4iMIhJlFz0oeFdOX?= =?us-ascii?Q?3XYBeAZU7ZKcNzlgk+psZ6fgtl+rceN7wauGge+YbpmQ4eFSZgJak9TnKuD6?= =?us-ascii?Q?qLdFjz95g64J0vRrZQstbkIWD4VFvK50mJPmEl2fRH3Gcja2Ku68AQy+HeTD?= =?us-ascii?Q?+rlceztzIsvedK7foPobcg5hDCBX+LVMhdHGHlrnjDJdLClBcv1dzP71CEP8?= =?us-ascii?Q?ddKaM4jh6QZY60iRWYZ86MsJcwlLc/TzrL9KOcmMHFh8da8t7j639NzF2b1R?= =?us-ascii?Q?XCRJu7uhe0z2/MgSl7FEm1NSz0osdAaQNFCQ0abX+4NZJ8oqidtgHnjDWBq2?= =?us-ascii?Q?x9OyljOMClyhk9q/m0B2IEeAkVSdgv+VlHolRIVZU6S8WLCmgzgyXFMwc2KR?= =?us-ascii?Q?ZBzXwrXhEoJJH9jvlj5oP789Uy2WYVoarhLf9Os7leDx1uS7Mprf689lLqy1?= =?us-ascii?Q?oJYLqAu4H9Ka/pEr+DurDPFX/EsrKZJdT9nBedwqHccDWPNvtHl4bVt+HJJ6?= =?us-ascii?Q?sfCclPKzzDbSOO059Qf5X39d3GeBKzAtiUK9usIBhK2bDpGxs5Xic1hBPpKH?= =?us-ascii?Q?jTmCG7vbNfENcMBji9RyflIlfMFbm9zWPfEVGHpfRBveCh84Bz5XOTOK4qq5?= =?us-ascii?Q?BIBgv0LVcjeMwbWUbR5z/djQXmbGECN7SjwTiJeGKyne8jOFFpFVeyE/Ls5q?= =?us-ascii?Q?MdHBXZ3+T9YUE3pvvZ/FaNDvUKVOigSapZ3GXHj6rlCyA01uYHZtnN1XUGCd?= =?us-ascii?Q?fZZGIa321NFVCX4C5B15O6On3d5NUhuTJKHbYU0HnI6tW9idR+QxU3cdlEHc?= =?us-ascii?Q?isqx29nmiNutrSS/EqiBSshk0Wwr9x7sBMnCCT1z71US3AF6RO0fpk/EOnsk?= =?us-ascii?Q?b0eycsA9x3keGVlaGkcmVg0nPfmAQncC/Vm4OxbGiRF1gOy27r0CKi+5+yu6?= =?us-ascii?Q?80Cx8SFy?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f814280b-5ac0-4b18-9151-08d8c33270c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2021 02:14:27.9600 (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: wbkUSeZKd0CbeHV3/SrIgein4JMdRVoVeVH0ZYOp3/Rp8++Aweb/NKc6hX2QHD3T9ULp17ok7kJ90Q72szbtAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2625 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Patrick Rudolph > Sent: Wednesday, January 20, 2021 11:59 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A ; > Ni, Ray > Subject: [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request > protocol before setting >=20 > From: Matt DeVillier >=20 > No need to check the interface protocol then conditionally setting, just = set it > to BOOT_PROTOCOL and check for error. >=20 > This is what Linux does for HID devices as some don't follow the USB spec= . > One example is the Aspeed BMC HID keyboard device, which adds a massive > boot delay without this patch as it doesn't respond to 'GetProtocolReques= t'. I am okay with the code change. But since the current logic is here for a long time, I am not sure whether other USB keyboard device will have functional/performance impact for this change. Besides the above mentioned Aspeed BMC HID keyboard device (which has a performance issue for the Get_Protocol request that the patch is going to drop), could you at least try one USB keyboard device that works fine with the origin code logic to see if there is any side effect for this patch? Thanks in advance. Best Regards, Hao Wu >=20 > Signed-off-by: Matt DeVillier > Signed-off-by: Patrick Rudolph > --- > MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 28 ++++++++++++------- > - > 1 file changed, 17 insertions(+), 11 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c > b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c > index 77e20b203f..5914174b4d 100644 > --- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c > +++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c > @@ -801,7 +801,6 @@ InitUSBKeyboard ( > IN OUT USB_KB_DEV *UsbKeyboardDevice ) {- UINT8 Pro= tocol; > EFI_STATUS Status; REPORT_STATUS_CODE_WITH_DEVICE_PATH (@@ > -814,21 +813,28 @@ InitUSBKeyboard ( > InitQueue (&UsbKeyboardDevice->EfiKeyQueue, sizeof (EFI_KEY_DATA)); > InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof > (EFI_KEY_DATA)); - UsbGetProtocolRequest (- UsbKeyboardDevice- > >UsbIo,- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,- > &Protocol- ); // // Set boot protocol for the USB Keyboard. // T= his driver > only supports boot protocol. //- if (Protocol !=3D BOOT_PROTOCOL) {- > UsbSetProtocolRequest (- UsbKeyboardDevice->UsbIo,- > UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,- > BOOT_PROTOCOL+ Status =3D UsbSetProtocolRequest (+ > UsbKeyboardDevice->UsbIo,+ UsbKeyboardDevice- > >InterfaceDescriptor.InterfaceNumber,+ BOOT_PROTOCOL+ = );+ > if (EFI_ERROR (Status)) {+ //+ // If protocol could not be set here= , it > means+ // the keyboard interface has some errors and could+ // not = be > initialized+ //+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (+ > EFI_ERROR_CODE | EFI_ERROR_MINOR,+ (EFI_PERIPHERAL_KEYBOARD | > EFI_P_EC_INTERFACE_ERROR),+ UsbKeyboardDevice->DevicePath );++ > return EFI_DEVICE_ERROR; } UsbKeyboardDevice->CtrlOn =3D FALSE;-= - > 2.26.2