From nobody Sun Feb 8 22:58:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39409+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39409+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1556006799; cv=none; d=zoho.com; s=zohoarc; b=M1iwiSBaO8lBkT74BiUg0PdhU7UvLmUbh1TVNs/zizBXTBRlVnt+MBvlkvd1cXpg9bBU5Z1uePubVCYHnSpF8yqzxx+KbxWkC4rrAVILjGImYmgoP/khTgQS/jlCwYshkziLG6dvQ/yUMq0RX3QoK45+UEQfrEsokb+cAGVy9jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556006799; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Lqn3wvzQgWsJS67DDFEenULsG4ZICCEjAWl/YGWFlmU=; b=SPRCDDULwxtQ/Xhm4P1iNLFB9O3vH2Z5kjQoEcKxXU+tgIx/2sNG1d6zqVcMlOtDWTIXphLsABgVR/OSPu0EVrH6io0fH7y3HzfURIEt2U/iOkjCT7obTWzP+uGBU8mL4loUlaw3AZlmyQ4BefVwASoFp78TWF3DdrTj4fidnkQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39409+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556006799929437.9015744160332; Tue, 23 Apr 2019 01:06:39 -0700 (PDT) Return-Path: X-Received: from mga05.intel.com (mga05.intel.com []) by groups.io with SMTP; Tue, 23 Apr 2019 01:06:38 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 01:06:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,385,1549958400"; d="scan'208";a="339945777" X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by fmsmga006.fm.intel.com with ESMTP; 23 Apr 2019 01:06:33 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: Hao Wu , Ray Ni , Eric Dong , Jian J Wang Subject: [edk2-devel] [PATCH v3 1/2] MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address Date: Tue, 23 Apr 2019 16:06:29 +0800 Message-Id: <20190423080630.14992-2-hao.a.wu@intel.com> In-Reply-To: <20190423080630.14992-1-hao.a.wu@intel.com> References: <20190423080630.14992-1-hao.a.wu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,hao.a.wu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556006799; bh=YgolYO7PJ6RC2TFZzKEmgcJmeoF2hZuoDdEyxp1FnxE=; h=Cc:Date:From:Reply-To:Subject:To; b=IqqJkixlqhKrS3fZhUohkDYYJFnRqpH2XXpqcHm3fpQtYIogHjmqYsyBsNdb+pRmdAl yvQ0oeXlRWXUM3Yf1+2moe2sCRs/dbhFNwC4sZ1LVJNuEBbK0k7oTtWZbc1i8Vwc6ozQe H4hjSN3KdupY2q661uX2ms7g7HOqnG5LLCg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1483 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 addressing. According to PCDs: gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSize|0x00400000 gIntelSiliconPkgTokenSpaceGuid.PcdVTdPeiDmaBufferSizeS3|0x00200000 The default buffer size allocated for IOMMU mapping is: * 4M bytes for non-S3 cases; * 2M bytes for S3 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 to 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. Cc: Ray Ni Cc: Eric Dong Cc: Jian J Wang Signed-off-by: Hao Wu Reviewed-by: Ray Ni --- MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 addressing. +// 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, --=20 2.12.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39409): https://edk2.groups.io/g/devel/message/39409 Mute This Topic: https://groups.io/mt/31306791/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-