From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by groups.io with SMTP; Tue, 23 Apr 2019 11:13:01 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 11:13:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="340115317" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 23 Apr 2019 11:12:59 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Apr 2019 11:12:59 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Apr 2019 11:12:59 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.92]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.164]) with mapi id 14.03.0415.000; Wed, 24 Apr 2019 02:12:57 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Wu, Hao A" CC: "Dong, Eric" , "Wang, Jian J" Subject: Re: [edk2-devel] [PATCH v3 1/2] MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address Thread-Topic: [edk2-devel] [PATCH v3 1/2] MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address Thread-Index: AQHU+auHdmoO6fUcQkq9eWu8yTzef6ZKDHvA Date: Tue, 23 Apr 2019 18:12:55 +0000 Deferred-Delivery: Tue, 23 Apr 2019 18:12:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C0FEAF5@SHSMSX104.ccr.corp.intel.com> References: <20190423080630.14992-1-hao.a.wu@intel.com> <20190423080630.14992-2-hao.a.wu@intel.com> In-Reply-To: <20190423080630.14992-2-hao.a.wu@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDZkNDlhNzAtOGY5YS00N2NjLTgwYTEtMWY1ZTU3ZTczZWNkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSFhjZ05nSmd2NTJ6eVRwZ0RZZXZ3Tmc3Tzl3U1QwV0x1dkMrc0lMYnpqQ3BORnFlWklcLzFyd0p1MVd3NDhkcE4ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Wu, Hao A > Sent: Tuesday, April 23, 2019 1:06 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A ; Ni, Ray ; Dong, > Eric ; Wang, Jian J > Subject: [edk2-devel] [PATCH v3 1/2] MdeModulePkg/AhciPei: Limit max > transfer blocknum for 48-bit address >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1483 >=20 > Due to the limited resource on the VTd DMA buffer size in the PEI phase,= the > driver will limit the maximum transfer block number for 48-bit addressin= g. >=20 > According to PCDs: > gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize|0x00400000 > gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3|0x00200000 >=20 > The default buffer size allocated for IOMMU mapping is: > * 4M bytes for non-S3 cases; > * 2M bytes for S3 >=20 > For ATA devices in 48-bit address mode, the maximum block number is > currently set to 0xFFFF. For a device with block size equal to 512 bytes= , the > maximum buffer allowed for mapping within AhciPei driver will be close t= o > 32M bytes. Thus, this commit will limit the 48-bit mode maximum block > number to 0x800, which means 1M-byte maximum buffer for mapping when > the block size of a device is 512 bytes. By doing so, potential failure = on calls > to the IOMMU 'Map' service can be avoided. >=20 > Cc: Ray Ni > Cc: Eric Dong > Cc: Jian J Wang > Signed-off-by: Hao Wu > --- > MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c > b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c > index a83c213a47..11754b3057 100644 > --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c > +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c > @@ -48,7 +48,13 @@ UINT8 mAtaTrustCommands[2] =3D { // Look up table > (Lba48Bit) for maximum transfer block number // > #define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100 > -#define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF > +// > +// Due to limited resource for VTd PEI DMA buffer on platforms, the > +driver // limits the maximum transfer block number for 48-bit addressin= g. > +// Here, setting to 0x800 means that for device with 512-byte block > +size, the // maximum buffer for DMA mapping will be 1M bytes in size. > +// > +#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x800 >=20 > UINT32 mMaxTransferBlockNumber[2] =3D { > MAX_28BIT_TRANSFER_BLOCK_NUM, > -- > 2.12.0.windows.1 >=20 >=20 >=20