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.856.1570729870892225262 for ; Thu, 10 Oct 2019 10:51:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=K55dHKKx; 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 ; Thu, 10 Oct 2019 10:51:14 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 10 Oct 2019 10:51:10 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 10 Oct 2019 10:51:10 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 10 Oct 2019 17:51:09 +0000 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.55) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 10 Oct 2019 17:51:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JMsvK4s3u5kNjRsZfTb9tton+DHAfzVJTalBldFEI+oeIWguE4253OokhFclnai/SHUAifesfTkw1mZDbnzK+CgLEdWCdbFVR4ZQimLXaPWWgT/d0ol4lj49DJkedMvRQqupKIR3yisQhWuJg+Hk1qfGxjzlOKpmfLbTlRkbnYuSxY80BSXxACiZbGTt0Yrp4zwiNewDe55hmk65++HFHEvh/L12GASc5BP/MvHNQ0sevA89nwwnYsseGE/IAWL7O/CB/vbDnJvCVl8IPazVgMVRXAeI2Zzl60KkU8FKjzioO6xHCXo9EXcoETn7GGNIHDZ2Yb6HcTZy9lT1BQyX+Q== 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=cVgvhOTaMgm5E+XeVDRdyC4Ss2yZeX+8C4iU7Eav5/s=; b=X+bL1gCcSSRppB8bWfDLVmzIARbInbCr2tRqQ4iwm8EP/iyRJVhVypjgl2CMVF2Wkwu0UU5fnKXzxORGpUaSsJ1VwY9v7/ogETQ6llQt/QWaTIMBucoiZjVnu1H1y3kPgovN6a3TNfi8y7d1gmRL/In7k2luzwtCAEaZniFmHO3BBA3khCpltPqJTGdqaKYugyI4bnt85lDflUadKMfG5KIAOaTwqj2cZBM1wAbO3Qj5NsPoTjeku2Af0hSw+lviWzNJrmiYp7zcrTNbyxTGwnFJPkLs/4+/1kA/oUx7g96zGqlWdFkN02/O+viE861rt5QIiddonL6vyu0wJo+g1g== 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 DM6PR12MB4300.namprd12.prod.outlook.com (10.141.186.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.19; Thu, 10 Oct 2019 17:51:09 +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 17:51:09 +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/YUqQWeYilI1PdqdTF8OAgAAGroCAAAOUAIABBmEG Date: Thu, 10 Oct 2019 17:51: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: 74d1d554-8b6f-469b-99d0-08d74daa6e8d x-ms-traffictypediagnostic: DM6PR12MB4300: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 018632C080 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(51874003)(199004)(13464003)(189003)(99286004)(71200400001)(52536014)(71190400001)(53546011)(6506007)(14444005)(7696005)(256004)(105004)(76176011)(316002)(2906002)(74316002)(7736002)(186003)(25786009)(478600001)(102836004)(26005)(14454004)(66066001)(446003)(11346002)(19627405001)(86362001)(9686003)(6436002)(5660300002)(76116006)(8936002)(54896002)(2501003)(236005)(55016002)(81166006)(81156014)(486006)(110136005)(3846002)(6116002)(229853002)(476003)(66946007)(33656002)(66556008)(6246003)(66476007)(66446008)(64756008)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB4300;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: 9BbFrg49l1fKfnRUij5eI7Nuh6B6l31Cj0/+7qZfdjq46qTM+oc2SMKr+PYsQSifhix8WpCgrhXvRT4gvmrLpxx1pjy8pEr6tEsqMSf06tdn3/wC2tpJ8hNdAEsHKnWrlJT2jD0uxTdAWvfwB27hNzit8HDkXA02bvY5p8TxirBbkXkq1ytW9XlA+FT01h4VOShMPsvdgZstF7tIA3KvsOyna2ZmtFQhNgVuf0rA50i4K+w9kDiIt5o/3QAoog6e50x9c3vGZUKo15Vsb6af8IBGsjFXxwjmbMXIPZx9PPdCxGtccFicFLSSfGY5whqbraeA12xhHuzxhTDduFai42Pok1RIvOfGDy+BA7z8yHztWhlA5IQoRq68NmxJm/4SkW2qHaLHt1wC0v8QVQ81b0OMWxuj8pJzRpuy2K/AAuY= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 74d1d554-8b6f-469b-99d0-08d74daa6e8d X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2019 17:51:09.0067 (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: kkXW+55csS3ItAm08G05QpZPIU1C8O+/iikXsLV32JCt35561uDaUqVUsiHL0UkVx0qBxnE2uX4tBAX+GmHIkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4300 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=1570729874; bh=cVgvhOTaMgm5E+XeVDRdyC4Ss2yZeX+8C4iU7Eav5/s=; 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-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=K55dHKKxhaKx9L9hhRK1A1iwyd8gOcOoHRpM3qcq+1JnM2hlbu6Rg/EkPH0ZmZnPH I/yNThf78L7xxZxG2KMOVy7USJV5U416Hylx37Keri1NY58N73JSHvLrqv2ZfZ8Rx3 CqaVa7q1COW2Wl/gWPXBPjfUrc2CRTsywDc4jJbCJ+quGfBm9onn3dPSavpZObH3+L TE2+7e4ZTxUVOOeI6rYVHwxbbhBUNrcH7OHqLxGtMV/s6NyXarY39cAc1khrWgYSqT q3Llo8x7RamgYQ+TCzj/+LrVOFOjsBqhUvbui6ZNhyAEimmKgCYw+vUTtHNBRRuDKN 6txfh4fz1/ZdA== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DM6PR12MB3324A32EF40EB6A102C4F6DBBA940DM6PR12MB3324namp_" --_000_DM6PR12MB3324A32EF40EB6A102C4F6DBBA940DM6PR12MB3324namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Hao, I agree that for completeness we should fix the issue in both DXE as well a= s PEI but on my target, we do not have any PEI phase for me to be able to v= erify 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 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, Ray > 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 as= 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 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 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 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 > distribution > is prohibited. If you are not the intended recipient, please contact the > sender by > reply email and destroy all copies of the original message. > -------------------------------------------------------------------------= ---------- --_000_DM6PR12MB3324A32EF40EB6A102C4F6DBBA940DM6PR12MB3324namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hello Hao,

I agree that for completeness we should fix the issue in both DXE as well a= s PEI but on my target, we do not have any PEI phase for me to be able to v= erify 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 change meanwhil= e to fix the issue in DXE.

Thanks
Ashish

From: Wu, Hao A <hao.a.w= u@intel.com>
Sent: Wednesday, October 9, 2019 8:09 PM
To: Ashish Singhal <ashishsingha@nvidia.com>; devel@edk2.group= s.io <devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com>
Subject: RE: [PATCH] MdeModulePkg/XhciDxe: Fix Aligned Page Allocati= on
 
> -----Original Message-----
> From: Ashish Singhal [mailt= o:ashishsingha@nvidia.com]
> Sent: Thursday, October 10, 2019 9:58 AM
> To: Wu, Hao A; devel@edk2.groups.io; Ni, Ray
> 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= as well
> but I have no way to verify that as we are not using it. For the chang= e 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<= br> 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@intel.com>
> Sent: Wednesday, October 9, 2019 7:33 PM
> To: Ashish Singhal <ashishsingha@nvidia.com>; devel@edk2.groups.= io; Ni,
> Ray <ray.ni@intel.com>
> 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 Allocatio= n
> >
> > While allocating pages aligned at an alignment higher than 4K, > > allocate memory taking into consideration the padding required fo= r
> > that alignment. The calls to free pages takes care of this alread= y.
> >
> > 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/Pci/XhciDxe/UsbHcMem.c
> > @@ -656,7 +656,7 @@ UsbHcAllocateAlignedPages (
> >           =              Pc= iIo,
> >           =              Al= locateAnyPages,
> >           =              Ef= iBootServicesData,
> > -          &nbs= p;           Pages,
> > +          =             RealPage= s,
> >           =              &a= mp;Memory,
> >           =              0<= br> > >           =              );=
>
>
> 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 IoMmuAllocateBuffer() 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 don= e 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) an= d may
> contain
> confidential information.  Any unauthorized review, use, disclosu= re or
> distribution
> is prohibited.  If you are not the intended recipient, please con= tact the
> sender by
> reply email and destroy all copies of the original message.
> ----------------------------------------------------------------------= -------------
--_000_DM6PR12MB3324A32EF40EB6A102C4F6DBBA940DM6PR12MB3324namp_--