From nobody Fri May 10 16:11:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114373+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114373+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1706170865; cv=none; d=zohomail.com; s=zohoarc; b=cRKne78f4vO/AfP7tfdLhT+iLRXZGp/oG2N1p06vJsEMxqdptzMm6HCaFRHapu/7DwqkuxG7zuuAgulppsICjWniyDU3OR6qWdcMIMRZzSRAmodp7rwor8R5tsV//pXyQN88X56R9yTE8MNaKGGTBnEC0ie+fCAgHYOd17DAutI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706170865; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=WYpicGr6tc96wP/wJLL5+bZExTe0lGaXGLqg8gOpKHg=; b=lRawxeP8MK6mqLmqA+OQWzozBlhhscpVLES7rh/HltZLi3oguPcrkhiGPJQlUvIk3ebr3RXI+evwWIlx/XQI28G5e+jaLRjgmXNpRdQKHkUlCP4RNvx24ga8722c6cErrN4tqm+vhwf54zI9SOVh8CwnEE3s1gTcZoAnIrRS934= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114373+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706170865060864.1466224402085; Thu, 25 Jan 2024 00:21:05 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=MNKeVZqXGrhu6ZRzDmupbAHleeN9jNQCR2Kdh2UxCpg=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706170864; v=1; b=mva62+smDrvnVhAIjNeyltWJi6VjhoK59gVnXoLTCp0afod88G0K0r5m3O74VFMp0AEN8Zgc pK30mA96b71egX6JH9Q1Le5qu4OVHYewokUJ968ktXd8IiLQjCTqB7BWwxUlrVos3ypKqGByBXr EOPcOBRUMcTheJGlQhMD+LxQ= X-Received: by 127.0.0.2 with SMTP id 6Nj6YY1788612xPFDq1DLjV6; Thu, 25 Jan 2024 00:21:04 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.12521.1706170863918679372 for ; Thu, 25 Jan 2024 00:21:04 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-KbLafkTONGe7wueTv-qv0Q-1; Thu, 25 Jan 2024 03:20:59 -0500 X-MC-Unique: KbLafkTONGe7wueTv-qv0Q-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C4B1106D062; Thu, 25 Jan 2024 08:20:59 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 409E3492BC9; Thu, 25 Jan 2024 08:20:58 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E176B1801A8B; Thu, 25 Jan 2024 09:20:57 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Liming Gao , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Oliver Steffen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 1/2] MdeModulePkg: rename PcdUse5LevelPageTable to PcdEnable5LevelPageTable Date: Thu, 25 Jan 2024 09:20:56 +0100 Message-ID: <20240125082057.309133-2-kraxel@redhat.com> In-Reply-To: <20240125082057.309133-1-kraxel@redhat.com> References: <20240125082057.309133-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: 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,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: FaYNppLGljQJGuto95lczd9Kx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706170865371100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The PCD will allow but not require 5-level paging. Whenever 5-level paging is used or not will be decided by the ResetVector, by looking at CPU capabilities. Rename the PCD to make that clear. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- MdeModulePkg/MdeModulePkg.dec | 2 +- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 2 +- MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 4 ++-- MdeModulePkg/MdeModulePkg.uni | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index a2cd83345f5b..80047f029d36 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2105,7 +2105,7 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic= , PcdsDynamicEx] # TRUE - 5-Level Paging will be enabled.
# FALSE - 5-Level Paging will not be enabled.
# @Prompt Enable 5-Level Paging support in long mode. - gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable|FALSE|BOOLEAN|0x000= 1105F + gEfiMdeModulePkgTokenSpaceGuid.PcdEnable5LevelPageTable|FALSE|BOOLEAN|0x= 0001105F =20 ## Capsule In Ram is to use memory to deliver the capsules that will be = processed after system # reset.

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/Dx= eIplPeim/DxeIpl.inf index f1990eac7760..d73add2d814d 100644 --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf @@ -104,7 +104,7 @@ [Pcd.IA32,Pcd.X64] gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ##= CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ##= CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ##= CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable ##= SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdEnable5LevelPageTable ##= SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ##= CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize ##= CONSUMES =20 diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePk= g/Core/DxeIplPeim/X64/VirtualMemory.c index 980c2002d4f5..46528e4f719d 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -745,13 +745,13 @@ CreateIdentityMappingPageTables ( // Cr4.UintN =3D AsmReadCr4 (); Page5LevelSupport =3D (Cr4.Bits.LA57 !=3D 0); - ASSERT (PcdGetBool (PcdUse5LevelPageTable) =3D=3D Page5LevelSupport); + ASSERT (PcdGetBool (PcdEnable5LevelPageTable) =3D=3D Page5LevelSupport= ); } else { // // If cpu runs in 32bit protected mode PEI, Page table Level in DXE is= decided by PCD and feature capability. // Page5LevelSupport =3D FALSE; - if (PcdGetBool (PcdUse5LevelPageTable)) { + if (PcdGetBool (PcdEnable5LevelPageTable)) { AsmCpuidEx ( CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO, diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni index a17d34d60b21..7a98dc64832b 100644 --- a/MdeModulePkg/MdeModulePkg.uni +++ b/MdeModulePkg/MdeModulePkg.uni @@ -1332,9 +1332,9 @@ = "required to be accessed in PcdDxe driver entry point. So, its val= ue must be set in PEI phase." = "It can't depend on EFI variable service, and can't be DynamicExHi= i PCD." =20 -#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdUse5LevelPageTable_PROMPT #= language en-US "Enable 5-Level Paging support in long mode" +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdEnable5LevelPageTable_PROMPT= #language en-US "Enable 5-Level Paging support in long mode" =20 -#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdUse5LevelPageTable_HELP #la= nguage en-US "Indicates if 5-Level Paging will be enabled in long mode. 5-L= evel Paging will not be enabled" +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdEnable5LevelPageTable_HELP = #language en-US "Indicates if 5-Level Paging will be enabled in long mode. = 5-Level Paging will not be enabled" = "when the PCD is TRUE but CPU doesn't support 5-Level Paging." = " TRUE - 5-Level Paging will be enabled." = " FALSE - 5-Level Paging will not be enabled." --=20 2.43.0 -=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 (#114373): https://edk2.groups.io/g/devel/message/114373 Mute This Topic: https://groups.io/mt/103950404/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- From nobody Fri May 10 16:11:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114375+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114375+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1706170866; cv=none; d=zohomail.com; s=zohoarc; b=e4unxWTpmPPokMU52ey3sO9hwEFuSXi/c6s6k54w2HK8hRmobsgghuEn67OvYD1patsHRHkUH2emK3lDL/iEwbdoyG31LH+VAw6zPl5/kX3a7hxGB49uNG6X7CSFgLDsKAQl1eagAGCUtNYrxhMofHte196UWCysq5rNC9E567M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706170866; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=rVRaBFPv2JIarnA0CG6kLrLwtcNr8ZWM9zPwM4dfYsE=; b=mz0gwTIt1cBoX2z9adliOk5K/RY4yTEFDt8O8u+9Ba/sPzLbGIu4PNctt5b5cSrVDrUjfmi1z1ze66gYwvxdb8BCfM95ciViJ42XPuBSu/0T2041EaBINDB11/nswTnFmnVLM6OO3LlwLsCR6jAgGgUvqr3Q6yD019wryYdjAZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114375+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706170866129109.65010608285627; Thu, 25 Jan 2024 00:21:06 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=mhquKtooTOGUgmAv1Id0hdj25D2On1acKJc+CwnhUXA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706170865; v=1; b=jeIevXVXGxABkCTh1Zld91ssOQ0VQ3BWNOJ1/Nwm+99VoBMH71nOVC7688jLWpl5l2LPg8CL mzjDGzJcgtAuUDfK3oW7QgOVPZXK8kt1TLmHb1/clNu4SHTmYUUtH3bHKA5gXqoqr20JpbxvqWW cklxZHve2ogtCKrPk3Z6nrVM= X-Received: by 127.0.0.2 with SMTP id GsPpYY1788612xmnBWUkA3VZ; Thu, 25 Jan 2024 00:21:05 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.12514.1706170864970255999 for ; Thu, 25 Jan 2024 00:21:05 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-581-EY4_v0aIMDSyADMHWxlV8A-1; Thu, 25 Jan 2024 03:21:00 -0500 X-MC-Unique: EY4_v0aIMDSyADMHWxlV8A-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8DD80106D064; Thu, 25 Jan 2024 08:21:00 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EE6BC15E61; Thu, 25 Jan 2024 08:21:00 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EBDB31801A90; Thu, 25 Jan 2024 09:20:57 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Liming Gao , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Oliver Steffen , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 2/2] MdeModulePkg/VirtualMemory: fix 5-level paging assert Date: Thu, 25 Jan 2024 09:20:57 +0100 Message-ID: <20240125082057.309133-3-kraxel@redhat.com> In-Reply-To: <20240125082057.309133-1-kraxel@redhat.com> References: <20240125082057.309133-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: 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,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: X6tTS9F41StJeiseKVeMt4wnx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706170867368100010 Content-Type: text/plain; charset="utf-8"; x-default="true" The ResetVector decides at runtime (depending on CPU capabilities) whenever it uses 5-level paging or not. Firmware builds with 5-level paging enabled (PcdEnable5LevelPageTable=3DTRUE) may run run in 4-level paging mode. The code handles that just fine, by looking at the la57 bit in cr4 instead of checking PcdEnable5LevelPageTable. So the ASSERT is too strict. Change it to ensure the build was configured with PcdEnable5LevelPageTable=3DTRUE when running in 5-level paging mode. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePk= g/Core/DxeIplPeim/X64/VirtualMemory.c index 46528e4f719d..9e194ef8cc55 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -745,7 +745,9 @@ CreateIdentityMappingPageTables ( // Cr4.UintN =3D AsmReadCr4 (); Page5LevelSupport =3D (Cr4.Bits.LA57 !=3D 0); - ASSERT (PcdGetBool (PcdEnable5LevelPageTable) =3D=3D Page5LevelSupport= ); + if (Page5LevelSupport) { + ASSERT (PcdGetBool (PcdEnable5LevelPageTable)); + } } else { // // If cpu runs in 32bit protected mode PEI, Page table Level in DXE is= decided by PCD and feature capability. --=20 2.43.0 -=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 (#114375): https://edk2.groups.io/g/devel/message/114375 Mute This Topic: https://groups.io/mt/103950406/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-