From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqemgate14.nvidia.com (hqemgate14.nvidia.com [216.228.121.143]) by mx.groups.io with SMTP id smtpd.web11.1283.1570672703375836001 for ; Wed, 09 Oct 2019 18:58:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=o40l+YYg; spf=pass (domain: nvidia.com, ip: 216.228.121.143, mailfrom: ashishsingha@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 09 Oct 2019 18:58:26 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 09 Oct 2019 18:58:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 09 Oct 2019 18:58:22 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 10 Oct 2019 01:58:22 +0000 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.50) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 10 Oct 2019 01:58:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Iq1Im6E+aoLEYm+T3ss3APPMJyoSojcpxjihuq4pY/47cXHRQyJnoEqtsemN5KG2/iN+iPSQQV6noZ71UCLPzIPJhyEYjdTWQNtM+WBRKeO1vrh4L0+oKEFqiotuUANVLBaNGwvuDT54znmHcWwztdxxPsOQLGxQ6K9mimTqvdcOUGWrlFYDP5tGcTTWrpNB6jeeu0VWBK9V82mBZzHE7TlTH1aoypvjgoYfjg3e7W+Q2IQ5cUt4I4ONSlWHdj+Ab/71M8Hj5kCIvPxF8EJEUETZY0DPZYwlDXb8AV4k5ifL+iLMY0nTr1urWojhl852MnZ3/FUzz+61Yll8evh38w== 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=RVo0bYiZLNe91TWBw0lCCUJ4mtQyNzoRmaEGld605S8=; b=FKO/KR1OG1Frct7YKkBLGgwxFDm5OZlluVpvtZN8kf/xMUKhsK4NZpGwlXhYbsOAWX5ir+XMC9+R1iRtSBoT8taGzRzW5Fv8fC5UIOuEDg/qpd1Ro6uXIcAaZvC5lWjMPn2jY6itWI4x24T2LcQjOFBPbqAOBoYtO63YhhTnnN6dheEH0lhuXpe0UYVzTcmdoOLswrcqPkJKifz3nb8DqDS56AYdclZTi0VLK9smVGcfMrte6aOpOjLEv9n2hYJf/tuFpEdtjXo19ZjEFn4+X1YAF5EEJlvao2IvuCOV+5GtVVmjMO94S3B2s1RyEimcFYr8u2CBTZAWoowNPo+Csw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from DM6PR12MB3324.namprd12.prod.outlook.com (20.178.31.154) by DM6PR12MB3323.namprd12.prod.outlook.com (20.178.31.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.17; Thu, 10 Oct 2019 01:58:20 +0000 Received: from DM6PR12MB3324.namprd12.prod.outlook.com ([fe80::1807:a182:87ae:55de]) by DM6PR12MB3324.namprd12.prod.outlook.com ([fe80::1807:a182:87ae:55de%5]) with mapi id 15.20.2327.023; Thu, 10 Oct 2019 01:58:20 +0000 From: "Ashish Singhal" To: "Wu, Hao A" , "devel@edk2.groups.io" , "Ni, Ray" Subject: Re: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation Thread-Topic: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation Thread-Index: AQHVfsNV/8sSJTw/YUqQWeYilI1PdqdTF8OAgAAGroA= Date: Thu, 10 Oct 2019 01:58:20 +0000 Message-ID: References: <9ce268553db91fbe7fb13e2205d0e1611e1d0212.1570640221.git.ashishsingha@nvidia.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Enabled=True; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SiteId=43083d15-7273-40c1-b7db-39efd9ccc17a; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Owner=ashishsingha@nvidia.com; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SetDate=2019-10-10T01:58:19.1060971Z; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Name=Unrestricted; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Application=Microsoft Azure Information Protection; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_ActionId=1f93b16a-d980-4e50-a243-191bdb8a7bb4; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Extended_MSFT_Method=Automatic authentication-results: spf=none (sender IP is ) smtp.mailfrom=ashishsingha@nvidia.com; x-originating-ip: [8.46.90.104] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c51b1b12-6033-4612-c1e5-08d74d255383 x-ms-traffictypediagnostic: DM6PR12MB3323: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 018632C080 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(136003)(376002)(366004)(396003)(39860400002)(13464003)(51874003)(199004)(189003)(446003)(102836004)(11346002)(2906002)(2501003)(74316002)(3846002)(186003)(6116002)(26005)(52536014)(476003)(486006)(7736002)(110136005)(9686003)(55016002)(6436002)(316002)(305945005)(229853002)(86362001)(5660300002)(66066001)(33656002)(53546011)(6506007)(76176011)(99286004)(6246003)(25786009)(14454004)(7696005)(8936002)(76116006)(14444005)(71200400001)(478600001)(66556008)(66476007)(64756008)(66946007)(8676002)(256004)(71190400001)(81156014)(81166006)(66446008);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3323;H:DM6PR12MB3324.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Zqc4oJciBmXI9gRIK3fy4LoYEiSjJmmQRlh0R1/HVHq4GxJSgIIV0aVpmTIJkvF/PP5h4BHCux7VnO31nRZGSbeFYDonQgASp78wU58WhhFvO5ClXM1q78yN7tiFDCLQovpQe2gHF9ZwhvlBzSLMx6Ag1Vno3IkBYTjtubOOmlOudSPRbpG+I4xrCxVMCGHTDbq1UJ6rX81b1tCReIlC3SNYIqovUp0tL2CyQl+7djfoMhchV/Mk0uzj+WIErZ78hp/3uLEZVAiYeC5PnsNb3T19WsS+uDcr2ug8l5THaj+4nkmAETEZJ3p+C+LMgkRmDpV4OE7McB9WXZ3dkr8IvZgdsp1d1YDT7skMzwYyz15sEEAmEU0Er01xC4Zuxc4/xQDi8yLmQ74wuQDZ7y6e0WddztEnLUBEEC7lpzNo1aQ= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c51b1b12-6033-4612-c1e5-08d74d255383 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2019 01:58:20.4448 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3CFpVaIdz62pmqNmUCuWDBQK1644Am6h0g05P3BHeqDFi8mNCZFiZn1rEjePrEvtNL7nv/I906TPEuXu6wR6yA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3323 Return-Path: ashishsingha@nvidia.com X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1570672706; bh=69XEeAfEcPhTSE0G8JBFZu7oOWYvWYWF/bEZFG4CW0A=; h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature: ARC-Authentication-Results:From:To:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To: Accept-Language:X-MS-Has-Attach:X-MS-TNEF-Correlator:msip_labels: authentication-results:x-originating-ip:x-ms-publictraffictype: x-ms-office365-filtering-correlation-id:x-ms-traffictypediagnostic: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-forefront-prvs:x-forefront-antispam-report:received-spf: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:x-ms-exchange-transport-forked: MIME-Version:X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg: Content-Language:Content-Type:Content-Transfer-Encoding; b=o40l+YYgzMbR4Dnef/175cV1RqLlhGlneo6QexbuEl4I6MzZU9HRnm7N5iaAX6Tf4 1TAHomhU3J8pqEL3K5veTYqIUTYljiT3OO319DBgeaSoJcjWT9PGkCxYDYdlYGsimp cQslUOiILhcrcDWe8uXGkExngjfmWdtVbu1es1agsfJSOkvAlScm9i2+2i0Ifvregz Yo4dM01r4S6jafiRECUr9kopqwS+BpXBRT2TxXnOj90SvG1wEDtreTao6nYi1LWBi1 BwEOj80VM6rK0berHUt9zyBX6dc1L9TDnx3MdqLk1SUwmhmKUo2Zp1xroA+1qyIzjk J3/o8Pplb+jKw== Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Hao, I can see that the PEI also has the same issue and take a look at that as= =20well but I have no way to verify that as we are not using it. For the = change I have made in DXE, I have verified it with an alignment of 4K and= =2064K. Thanks Ashish -----Original Message----- From: Wu, Hao A =20 Sent: Wednesday, October 9, 2019 7:33 PM To: Ashish Singhal ; devel@edk2.groups.io; Ni, R= ay Subject: RE: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation > -----Original Message----- > From: Ashish Singhal [mailto:ashishsingha@nvidia.com] > Sent: Thursday, October 10, 2019 1:02 AM > To: devel@edk2.groups.io; Wu, Hao A; Ni, Ray > Cc: Ashish Singhal > Subject: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation >=20 > While allocating pages aligned at an alignment higher than 4K,=20 > allocate memory taking into consideration the padding required for=20 > that alignment. The calls to free pages takes care of this already. >=20 > Signed-off-by: Ashish Singhal > --- > MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c > b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c > index fd79988..aa69c47 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c > @@ -656,7 +656,7 @@ UsbHcAllocateAlignedPages ( > PciIo, > AllocateAnyPages, > EfiBootServicesData, > - Pages, > + RealPages, > &Memory, > 0 > ); Hello, The change looks good to me. Just a couple of things to confirm: 1. I think there is a similar case within the XhciPei driver Could you he= lp to resolve it as well? I think for the PEI counterpart you may need to update both UsbHcAllocateAlignedPages() and UsbHcFreeAlignedPages(), since the IOMMU = helper functions like IoMmuAllocateBuffer() and IoMmuFreeBuffer() might n= ot be suitable now. Instead, I think services in the IoMmu PPI can be use= d. 2. Could you help to provide the information on what test has been done f= or the proposed patch? Thanks in advance. Best Regards, Hao Wu > -- > 2.7.4 -------------------------------------------------------------------------= ---------- This email message is for the sole use of the intended recipient(s) and m= ay contain confidential information. Any unauthorized review, use, disclosure or di= stribution is prohibited. If you are not the intended recipient, please contact the= =20sender by reply email and destroy all copies of the original message. -------------------------------------------------------------------------= ----------