From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.62]) by mx.groups.io with SMTP id smtpd.web10.6840.1684194552127316385 for ; Mon, 15 May 2023 16:49:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=JgU+aaFX; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.244.62, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F/qub1AYpbDU/Wvc2qI/3PttY5c7C/Qe4mQy4t9GyoYM26c6bdbXWE+yjG1UYM+5dk2MjSifSvEON5W0DSRZ836G6CbOUu//7L+EJipODv2zriU4buRv/stgfEt5KynUfc+5QAr4bWNBbVtWdCcjzGgh3AvmSnRu72TsTy1mukpIZ8DtYie5dwOZsJNQkxVZxscQ0Nv5/QpujrljdeqJzY4PWixuEKlIFclmSP3C1opjE4WXRnLyY4epjRNb/9LeYCRoaSg75SqV8BEJuONDUOgVrTXF+9uco4OZ/+k3VzzEWTLSXhCOX5gGN7dLaIwcBZnfs3VKNJm7UoZ3xBqkYA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=axPAV489hvqeiBJMnf3z6oatRhNnz+bgyr+EafKF4Es=; b=PDi9lY9ec4jmxyFK9PLOENz4pyRO6fVcGEBjzxScXxv+aiLxim16las1sVOyhdRAGMMmOsFH+K0qzIyiNaVErF//4Ojc+YL8Nzll4Rlf2tWYEeVfu9smb6ndYACt2zhwMeicxoO6uh23PPjSeeLXVPTmKDLS0uIh8xEfx0Kqp3GQ8pBZr8gwuFYWTC1xp3DWq3qxWKz9yaSaX8En8UeAowfi0kav7sg9L23KVwQ8ZsweNwm+AC84KzYKhgIjZSguX3L1tPrX/bWhsXDd8TqUIFRV+9oaGKP+0HIDzAn/aItCRWjzh3fLf5t+OBX2oq4n9/5GYSQ6XiYFmdF+YZdVDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=axPAV489hvqeiBJMnf3z6oatRhNnz+bgyr+EafKF4Es=; b=JgU+aaFXE/kP7zX0oOEme53KqOBkdOV3R9qBG8JGH1j4u1BC/cW3JFDnq6Q4GPSGw61eFXjJ+kliX0NzBb1CeAUfG6vJhYQ2Bx5V1LAzzwscEncFAInrToDH28ySTNb0ZPlN/cUEe3J1VYAIHmxYisVtQ6PjLHAGRYq4TwNk5uUfgF5FwldnuMW4E/TCx7+b2TF8kBl5sPt/f9Cc1mLqexRF+bzoX3063f5qJw+AMnDkWGjkj755JBUJ/qOXWFu0p5eGC0HkwWMqsdVV7ZnttKeWPkQHkL1jcBo1lGtc5cwEY2Qh2rxmn5NCtx2QYgmVx9XSOHzTei4Py/9rMF8Cvg== Received: from BN9PR03CA0206.namprd03.prod.outlook.com (2603:10b6:408:f9::31) by DM4PR12MB6349.namprd12.prod.outlook.com (2603:10b6:8:a4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 23:49:08 +0000 Received: from BN8NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9:cafe::c1) by BN9PR03CA0206.outlook.office365.com (2603:10b6:408:f9::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30 via Frontend Transport; Mon, 15 May 2023 23:49:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by BN8NAM11FT058.mail.protection.outlook.com (10.13.177.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.15 via Frontend Transport; Mon, 15 May 2023 23:49:08 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 15 May 2023 16:49:03 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 15 May 2023 16:49:03 -0700 Received: from 6cd8174ac25c.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 15 May 2023 16:49:02 -0700 From: "Jeff Brasen" To: CC: , , , Jeff Brasen , Ashish Singhal Subject: [PATCH] MdeModulePkg/DxeCore: Allow relocation of images with large address Date: Mon, 15 May 2023 23:48:56 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT058:EE_|DM4PR12MB6349:EE_ X-MS-Office365-Filtering-Correlation-Id: da45b809-2e4e-4498-b49b-08db559ef9d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I9NcZGSxkYq4mNnOpi6vbMEz35pv6DCm9dUu6I/yxhNvtpRwtrrqojprG8s1DAQiSEZiwAKYuYgwcOB59zCPMedUj94KDTAnPPjYzXPWsCjS2h/kTXUrXQQtgXSH6bY7BUJFBWs4YHkoDtzkORRvsf8n4NOJdL0PZ93ujq4tL0CCsJrlPeWvZnEJ10kZjYzHZoQxOAVWs/oFkXDlDpx69DD+nAoCCM29VOLP+8Wb2cDKDChnbFGB0E2kGVqtcBDi+xqeN4j4ZYs2EuME6cblHI9wSVKS6tRZZKPQF53gjbA0R/TD02ngv3UgwL59HWflVE0uMWoCfNLQnAIH9vVcHcnkAhGgTM0ANcCsiDbKIaQ2IwqbRP+AYFCwRvwtBaT8VXB7nKQW3yvDPc3OwxTvjZAYPQtoddV4IPBhbFcGT+omFEq/+30qU2PI/hGy7vP+OmCnbxczUQX550lbqWb77jCT58s89gEsmRAfUy6vfMmv3gkFj2ZAWfc2UWrFdw6dFhp1DI4XD/yf5TAH1Q64SYMWmSBXitW7zALFFHreudYvCy6EM9DwVqlg+RA8Jr9HUmjbLeBr6cX1K/qh7gbgNml/OWJYzko3PpwpW5oPhSpxJylRPC2zea4yVRxjbZU8WfUN0r19JxJFkduoNa9jrVoTUZ2iqv6zjmI7TV9zroIDYc6LQCCsFM8BYAe7JsxZc6n9QYM1zmvkgGRPZxot9mWZn2FbHMmFTfSlYPqHZacoPVzh9qzP8zpgXauOBIs4 X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199021)(36840700001)(40470700004)(46966006)(70206006)(54906003)(6916009)(478600001)(4326008)(70586007)(6666004)(316002)(7696005)(8936002)(82310400005)(40480700001)(2906002)(8676002)(41300700001)(5660300002)(26005)(82740400003)(107886003)(7636003)(356005)(86362001)(40460700003)(336012)(426003)(2616005)(83380400001)(186003)(36860700001)(47076005)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 23:49:08.5646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da45b809-2e4e-4498-b49b-08db559ef9d1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6349 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add PCD to control if modules with start addresses in PE/COFF > 0x100000 attempt to load at specified address. If a module has an address in this range and there is untested memory DxeCore will attempt to promote all memory to tested which bypasses any memory testing that would occur later in boot. There are several existing AARCH64 option roms that have base addresses of 0x180000000. Signed-off-by: Jeff Brasen Reviewed-by: Ashish Singhal --- MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + MdeModulePkg/Core/Dxe/Image/Image.c | 4 +++- MdeModulePkg/MdeModulePkg.dec | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeM= ain.inf index 35d5bf0dee..16871f2021 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -187,6 +187,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask = ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard = ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth = ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad = ## CONSUMES =20 # [Hob] # RESOURCE_DESCRIPTOR ## CONSUMES diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Im= age/Image.c index 9dbfb2a1fa..6bc3a549ae 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -680,7 +680,9 @@ CoreLoadPeImage ( ); } } else { - if ((Image->ImageContext.ImageAddress >=3D 0x100000) || Image->Image= Context.RelocationsStripped) { + if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image->ImageContext.= ImageAddress) >=3D 0x100000)) || + Image->ImageContext.RelocationsStripped) + { Status =3D CoreAllocatePages ( AllocateAddress, (EFI_MEMORY_TYPE)(Image->ImageContext.ImageCodeMemoryTy= pe), diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..6fd1bd7b8f 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1116,6 +1116,13 @@ # @Prompt Output MMIO address of Trace Hub message. gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugMmioAddress|0|UINT64|0x30= 001058 =20 + ## Indicates if images with large load address (>0x100000) should attemp= ted to load at specified location. + # If enabled, attempt to allocate at specfied location will be attempte= d with a fall back to any address. + # TRUE - UEFI will attempt to load at specified location.
+ # FALSE - UEFI will load at any address
+ # @Prompt Enable large address image loading. + gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad|TRUE|BOOLEAN|0x3= 0001059 + [PcdsFixedAtBuild, PcdsPatchableInModule] ## Dynamic type PCD can be registered callback function for Pcd setting = action. # PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of= callback function --=20 2.25.1