From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by mx.groups.io with SMTP id smtpd.web12.182.1571077034312036783 for ; Mon, 14 Oct 2019 11:17:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=pMjd5s5K; spf=pass (domain: nvidia.com, ip: 203.18.50.4, mailfrom: ashishsingha@nvidia.com) Received: from hkpgpgate101.nvidia.com (Not Verified[10.18.92.100]) by nat-hk.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 15 Oct 2019 02:17:12 +0800 Received: from HKMAIL102.nvidia.com ([10.18.16.11]) by hkpgpgate101.nvidia.com (PGP Universal service); Mon, 14 Oct 2019 11:17:11 -0700 X-PGP-Universal: processed; by hkpgpgate101.nvidia.com on Mon, 14 Oct 2019 11:17:11 -0700 Received: from HKMAIL104.nvidia.com (10.18.16.13) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 14 Oct 2019 18:17:11 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (104.47.34.52) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 14 Oct 2019 18:17:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f2GV3YxedNI8eo62wLKqriSIamz3gH84qE+2zrvKg6WIZe0iTP0yosdlkXOgcjhdwRnCzQLE1ylsJgZlIa0BtQp0m1FuXvUtZa/CTrskLOSPZ4e3c8LaabTHS4RhC7N8KgguDzbsPBRbo4JugG6+aLqHJ2ax2ULPKTzBi06IcdNE9Xk6A9X8GvQ0nd0//eJy0/le7kDOM/OkGRAOEhZA8ldbvFAFHraeMGHYFKNO4feZ/Ns+1+8cdVPn98DMV00qh5h4yp9SFoZKAkpoZRCKrrd6Evbf4lbloLosuUwxUHJslWB2UnqTIcr1xA0s/FVLrpqd8NWril9DZdn6poIzBw== 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=FKkhCJqrGtMzYXtFF0Nv/POlMLdTAO5M6VjBoTtGv6g=; b=b7NnDNTALjI8LNHOpDAFfPWDufBtGxoGx9+9JjHj63arWErGxxTnR3CXT3RJv4Kt2lkEgfvRHYr1ZD/HOvq0Bzi9FxDFJs9blrVCifqWgQjdhH+IIwht/WpKowVG7vglDoR4hC48ANOyocm0dx0vMlIhDmi/K2Mbqq/Mu3v0WJe7/5jdvvrf0AAbrKkUySDCX1IXu6bnYW820k3YBVu11BJGpYWpUHzsdEbGwM8hhb1i90FD0coxeDBUlb0eSk+BHnut30l6qxy3O30vmml9VHELH+WnYrmsa3WrM7DjVYgAlSIdyWawQEM5SKnd0EBNrl0G42VgCG8MGDKZaQkKEw== 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 DM6PR12MB3420.namprd12.prod.outlook.com (20.178.198.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.17; Mon, 14 Oct 2019 18:17:08 +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.2347.023; Mon, 14 Oct 2019 18:17:08 +0000 From: "Ashish Singhal" To: "Wu, Hao A" , "devel@edk2.groups.io" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation Thread-Index: AQHVfsNV/8sSJTw/YUqQWeYilI1PdqdTF8OAgAAGroCAAAOUAIABBmEGgACZ/oCAAAcD4IAAKYKAgADM+i2ABLml0A== Date: Mon, 14 Oct 2019 18:17:08 +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: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ashishsingha@nvidia.com; x-originating-ip: [216.228.112.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 62d535f4-33fe-46e1-bf45-08d750d2b9c9 x-ms-traffictypediagnostic: DM6PR12MB3420: x-ms-exchange-purlcount: 5 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 01901B3451 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(346002)(366004)(136003)(396003)(376002)(189003)(199004)(13464003)(51874003)(6246003)(25786009)(14454004)(6506007)(53546011)(478600001)(66066001)(561944003)(33656002)(99286004)(76176011)(7696005)(606006)(81156014)(8676002)(14444005)(19627235002)(256004)(81166006)(52536014)(71190400001)(71200400001)(66946007)(76116006)(66446008)(66476007)(66556008)(64756008)(8936002)(2501003)(105004)(7736002)(74316002)(186003)(486006)(26005)(76236002)(476003)(5660300002)(11346002)(446003)(19627405001)(86362001)(6436002)(102836004)(229853002)(3846002)(6116002)(316002)(110136005)(236005)(6306002)(54896002)(55016002)(9686003)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3420;H:DM6PR12MB3324.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: SI7J/JPQok3C6DHdQww7Yppam/WUUOjlNTAtg+exkN6f3y4pimO6qeWYtHLjg8BWSPgSxCMTnMs0M68dUemDWGfQOxGg31hZLxCSAcjHDovSNFS2+r7sqOoPY/B/3bBy9S/YcQrAueUoYuPrAsxnkD0CgFNE2iVKjyCCs5C3KDzUQcBQm/oItiR0w7mv/uJYvHdewiegjSKdEWwIxWIGWFi7/nL7mSqLGRkn5DOhc4m7IusajddY2fcKztuoyYlk3uprCqbjt0uaxZF34Bm0jwijBo0Gy+sLP5oYN9ApkHijpmQpS53u3a1XX8acKZQzdrn5tNatFEJg6vf2If9Dfecxpj2/IFdaAfiPzYEcAILGEoRvAvYScOFgp5woHd7CtFcOXLPr02h47Ksz2vDeSNuJQAjDO7VJ/3RBD+q4PXT58uyFvoGrWEoh0BOw7O4qRnHY/0AOS2MJ6wfpqHXBEQ== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 62d535f4-33fe-46e1-bf45-08d750d2b9c9 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2019 18:17:08.4756 (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: /6UrlNVFShA0SK9mbwyAumFnZ+hqwfzgU6cPmb+XlfLD2ACxcsDn25+bnfRGxtIdC+0Mp1H6Y4TG6rMKXRum7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3420 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=1571077032; bh=FKkhCJqrGtMzYXtFF0Nv/POlMLdTAO5M6VjBoTtGv6g=; 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: authentication-results:x-originating-ip:x-ms-publictraffictype: x-ms-office365-filtering-correlation-id:x-ms-traffictypediagnostic: x-ms-exchange-purlcount: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; b=pMjd5s5K9m5SF5L9EKNCHRaem0MAtr/OOBJigHpeWv+m69K1pbv4sU2HZQihq4nj5 V5RbSmHzIWoGmdwn5cJ3pi6oYGhNX4DHLyL0CcSK+c1YpImd2zBCtC2Vt3/pXajeLA nQs+xQABB84fIcsjKfvaWapB2P40gjWjA8bJK3iOMEP+3XhtTm3DAT8SW2SUoOVr6X Ff4rnQCpWPsD4WIsQRt0//DjUXtpdspso6nV5Yo3p7Q5vdLvyeWXN7eZ2VUjfR9oY4 GnOiOpYPn/pl+hzEh4A+oQ3V2D1uj3PjB/nEtNIfqqUOZllUHeNUURIavYVw/e+dwT Qt0QxvuU4hzRQ== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DM6PR12MB33244923889835B91A633B87BA900DM6PR12MB3324namp_" --_000_DM6PR12MB33244923889835B91A633B87BA900DM6PR12MB3324namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Hao, Were you able to validate the PEI change I sent last week? Thanks Ashish ________________________________ From: Ashish Singhal Sent: Friday, October 11, 2019 12:07 PM To: Wu, Hao A ; devel@edk2.groups.io ; Ni, Ray Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page A= llocation Patch set 2 has been submitted for review. Thanks Ashish ________________________________ From: Wu, Hao A Sent: Thursday, October 10, 2019 11:53 PM To: devel@edk2.groups.io ; Ashish Singhal ; Ni, Ray Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page A= llocation Hello Ashish, I think the IOMMU feature is added for the protection of FW integrity agai= nst HW devices, which is the motivation to use IOMMU PPI for memory allocation= . The fix is easy for the DXE part since the IOMMU part has been integrated = to the implementation of the PciIo protocol. As for the XhciPei case, my thought is that a new helper function (maybe c= alled 'IoMmuAllocateAlignedBuffer') can be added in DmaMem.c file. The main diff= erece between IoMmuAllocateAlignedBuffer() and existing IoMmuAllocateBuffer() wi= ll be: 1. If IOMMU PPI exists, mIoMmu->AllocateBuffer() should be called with big= ger number of pages for alignment and mIoMmu->FreeBuffer() can be called right= after to free the unused pages. 2. If IOMMU PPI does not exist, this case will fall back to a similar fix = for the DXE case. Ideally, IoMmuFreeBuffer() can be reused to free the aligned buffer. Please help to raise if you observe any open for the above proposal, thank= s. Best Regards, Hao Wu From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ashi= sh Singhal Sent: Friday, October 11, 2019 11:30 AM To: Wu, Hao A; devel@edk2.groups.io; Ni, Ray Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page A= llocation Hello Hao, What is your motivation towards using IoMMUPei for memory allocation now i= nstead of Pei Services? The fix would be simple if we just change the numbe= r of pages needed to accommodate for the alignment. The call to free the pa= ges would not do anything. If we use IoMMUPei, we may need to change function definition for allocate= to return how many pages were allocated for each call so that freeing can = be done correctly as well. This may need more refactoring of the code that = initially thought of. Thanks Ashish From: Wu, Hao A Sent: Thursday, October 10, 2019 9:00 PM To: devel@edk2.groups.io; Ashish Singhal ; Ni, Ra= y Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page A= llocation Thanks Ashish, Please help to send out the fix for XhciPei in a separate patch as well. I can help to see if verification can be done on my side. Best Regards, Hao Wu From: devel@edk2.groups.io [mailto:devel@edk2= .groups.io] On Behalf Of Ashish Singhal Sent: Friday, October 11, 2019 1:51 AM To: Wu, Hao A; devel@edk2.groups.io; Ni, Ray Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page A= llocation Hello Hao, I agree that for completeness we should fix the issue in both DXE as well = as PEI but on my target, we do not have any PEI phase for me to be able to = verify any change that I will be making. If you still want, I can still mak= e the change so that someone else can verify or we can have someone else fi= x PEI and push my change meanwhile to fix the issue in DXE. Thanks Ashish ________________________________ From: Wu, Hao A > Sent: Wednesday, October 9, 2019 8:09 PM To: Ashish Singhal >; devel@edk2.groups.io >; Ni, Ray > Subject: RE: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation > -----Original Message----- > From: Ashish Singhal [mailto:ashishsingha@nvidia.com] > Sent: Thursday, October 10, 2019 9:58 AM > To: Wu, Hao A; devel@edk2.groups.io; Ni, Ra= y > Subject: RE: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation > > Hello Hao, > > I can see that the PEI also has the same issue and take a look at that a= s well > 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 64K. Is it possible for you to verify the PEI case with a test PEI module that performs read operation to a USB storage device? I think this will trigger the affecting codes. In my opinion, it would be better for the fix to be complete. Best Regards, Hao Wu > > Thanks > Ashish > > -----Original Message----- > From: Wu, Hao A > > Sent: Wednesday, October 9, 2019 7:33 PM > To: Ashish Singhal >; devel@edk2.groups.io; Ni, > Ray > > 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 > > > > While allocating pages aligned at an alignment higher than 4K, > > allocate memory taking into consideration the padding required for > > that alignment. The calls to free pages takes care of this already. > > > > Signed-off-by: Ashish Singhal > > > --- > > MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > 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 h= elp 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 not be suitable now. Instead, I think services in the IoMmu PPI ca= n be > used. > > 2. Could you help to provide the information on what test has been done = for > 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 = may > contain > confidential information. Any unauthorized review, use, disclosure or > distribution > is prohibited. If you are not the intended recipient, please contact th= e > sender by > reply email and destroy all copies of the original message. > ------------------------------------------------------------------------= ----------- --_000_DM6PR12MB33244923889835B91A633B87BA900DM6PR12MB3324namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hello Hao,

Were you able to validate the PEI change I sent last week?

Thanks
Ashish

From: Ashish Singhal <a= shishsingha@nvidia.com>
Sent: Friday, October 11, 2019 12:07 PM
To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io <= devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned= Page Allocation
 
Patch set 2 has been submitted for review.

Thanks
Ashish

From: Wu, Hao A <hao.= a.wu@intel.com>
Sent: Thursday, October 10, 2019 11:53 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; Ashish Singh= al <ashishsingha@nvidia.com>; Ni, Ray <ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned= Page Allocation
 

Hello Ashish,

 

I think the IOMMU = feature is added for the protection of FW integrity against

HW devices, which = is the motivation to use IOMMU PPI for memory allocation.

 

The fix is easy fo= r the DXE part since the IOMMU part has been integrated to the

implementation of = the PciIo protocol.

 

As for the XhciPei case, my thought is that a new h= elper function (maybe called

'IoMmuAllocateAlignedBuffer') can be added in DmaMem.c file. The main differece

between IoMmuAllocateAlignedBuffer() and existin= g IoMmuAllocateBuffer() will be:

 

1. If IOMMU PPI ex= ists, mIoMmu->Al= locateBuffer() should be called with bigger

number of pages fo= r alignment and mIoMmu->Fr= eeBuffer() can be called right after

to free the unused= pages.

 

2. If IOMMU PPI do= es not exist, this case will fall back to a similar fix for

the DXE case.

 

Ideally, IoMmuFreeBuffer() can be reused to free = the aligned buffer.

Please help to rai= se if you observe any open for the above proposal, thanks.

 

Best Regards,

Hao Wu

 

From: d= evel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ashish Singhal
Sent: Friday, October 11, 2019 11:30 AM
To: Wu, Hao A; devel@edk2.groups.io; Ni, Ray
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation

 

Hello Hao,

 

What is your motivation towards u= sing IoMMUPei for memory allocation now inste= ad of Pei Services? The fix would be simple if we just change the number of= pages needed to accommodate for the alignment. The call to free the pages = would not do anything.

 

If we use IoMMUPei, we may need to change function= definition for allocate to return how many pages were allocated for each c= all so that freeing can be done correctly as well. This may need more refac= toring of the code that initially thought of.

 

Thanks

Ashish

 

From:= Wu, Hao A <hao.a.wu@intel.com>
Sent: Thursday, October 10, 2019 9:00 PM
To: devel@edk2.groups.io; Ashish Singhal <ashishsingha@nvidia.co= m>; Ni, Ray <ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation

 

Thanks Ashish,

 

Please help to sen= d out the fix for XhciPei in a separate patch as well.

I can help to see = if verification can be done on my side.

 

Best Regards,

Hao Wu

 

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ashish Singhal
Sent: Friday, October 11, 2019 1:51 AM
To: Wu, Hao A; devel@edk2.g= roups.io; Ni, Ray
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocation

 

Hello Hao,

 

I agree that for completeness we shoul= d fix the issue in both DXE as well as PEI but on my target, we do not have= any PEI phase for me to be able to verify any change that I will be making. If you still want, I can still make the change so that = someone else can verify or we can have someone else fix PEI and push my cha= nge meanwhile to fix the issue in DXE.

 

Thanks

Ashish

=

From:<= span style=3D"font-size:11.0pt; font-family:"Calibri","sans-= serif"; color:black"> Wu, Hao A <hao.a.wu@intel.com>
Sent: Wednesday, October 9, 2019 8:09 PM
To: Ashish Singhal <a= shishsingha@nvidia.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Ni, Ray &l= t;ray.ni@intel.com>
Subject: RE: [PATCH] MdeModulePkg/XhciDx= e: Fix Aligned Page Allocation

 

> -----Orig= inal Message-----
> From: Ashish Singhal [mail= to:ashishsingha@nvidia.com]
> Sent: Thursday, October 10, 2019 9:58 AM
> To: Wu, Hao A; devel@edk2.gro= ups.io; Ni, Ray
> Subject: RE: [PATCH] MdeModulePkg/XhciDxe<= /span>: Fix Aligned Page Allocation
>
> Hello Hao,
>
> I can see that the PEI also has the same issue and take a look at tha= t as well
> but I have no way to verify that as we are not using it. For the chan= ge I have
> made in DXE, I have verified it with an alignment of 4K and 64K.


Is it possible for you to verify the PEI case with a test PEI module that<= br> performs read operation to a USB storage device? I think this will trigger=
the affecting codes.

In my opinion, it would be better for the fix to be complete.

Best Regards,
Hao Wu


>
> Thanks
> Ashish
>
> -----Original Message-----
> From: Wu, Hao A <hao.a.wu@in= tel.com>
> Sent: Wednesday, October 9, 2019 7:33 PM
> To: Ashish Singhal <ash= ishsingha@nvidia.com>; devel@edk2.groups.io; Ni,
> Ray <ray.ni@intel.com><= br> > Subject: RE: [PATCH] MdeModulePkg/XhciDxe<= /span>: 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
> >
> > While allocating pages aligned at an alignment higher than 4K, > > allocate memory taking into consideration the padding required f= or
> > that alignment. The calls to free pages takes care of this alrea= dy.
> >
> > Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
> > ---
> >  MdeModulePkg/Bus/Pci/XhciDxe
/UsbHcMem.= c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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/Pc= i/XhciDxe/UsbHcMem.c
> > @@ -656,7 +656,7 @@ UsbHcAllocate= AlignedPages (
> >           = ;             <= span class=3D"x_x_SpellE">PciIo
,
> >           = ;             <= span class=3D"x_x_SpellE">AllocateAnyPages
,
> >           = ;             <= span class=3D"x_x_SpellE">EfiBootServicesData
,
> > -          &nb= sp;           Pages,
> > +          = ;            RealPages,
> >           = ;             &= amp;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 help 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 IoMmuAllocateB= uffer() and IoMmuFreeBuffer()
> might not be suitable now. Instead, I think services in the IoMmu PPI can be
> used.
>
> 2. Could you help to provide the information on what test has been do= ne for
> 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) a= nd may
> contain
> confidential information.  Any unauthorized review, use, disclos= ure or
> distribution
> is prohibited.  If you are not the intended recipient, please co= ntact the
> sender by
> reply email and destroy all copies of the original message.
> ---------------------------------------------------------------------= --------------

--_000_DM6PR12MB33244923889835B91A633B87BA900DM6PR12MB3324namp_--