From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.57929.1682357043047977409 for ; Mon, 24 Apr 2023 10:24:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PLWGmxxJ; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F31761C12 for ; Mon, 24 Apr 2023 17:24:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4A6EC4339B for ; Mon, 24 Apr 2023 17:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682357041; bh=baZAUxOQawaJ3b/vYtQHo8XCvdT1bV1Q+czSLH/GPwE=; h=References:In-Reply-To:From:Date:Subject:To:From; b=PLWGmxxJS+5cANGNhshz4bEMM3K/8mZWTvRyNlZqklcfeVa5wUILHgubNlEnzX9FA ITeQfwrfKUI11kWHQ1uwnxdZyv8xfGYqngngTrwLBit7ft6XcXtrvaSpbrAHEKpqOU bLIxFKz9Lu5F6O0eR60kuaYxPmZ1f07NP8aVIV5WPvvI1UGRcNAZbPbcUsrHip7wC9 AqoUGsnobf/byKu4Em5grfJZWevaFv7p8nCFECo9McEmvx24FFcaSpioZpQvj7MSvb egICq25OHcQ/Yz22qSrD1LZNjUq8pe9R7/8RNWpEXjcs264jICjigFS4FpFgp+hrMY VECy19OEaQ7MA== Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4eed6ddcae1so20379508e87.0 for ; Mon, 24 Apr 2023 10:24:01 -0700 (PDT) X-Gm-Message-State: AAQBX9ec+5khmjUww+R6GhsaAkQZ0lCGd6yBCSNQfzKVN2nw5qH/sUr5 rz3x03otXyZPhSizQO7Jfa/0aONhOXv/N3Rm4yc= X-Google-Smtp-Source: AKy350YTaOdkM0jnI/e1RZeF0D80bBkNs95TxQ+bpEPY6/MTOKIQt92QoM0FKc9uQGjb3I2ykL83GsBf9zHodymmqGo= X-Received: by 2002:a05:6512:1319:b0:4dd:9eb6:5b4c with SMTP id x25-20020a056512131900b004dd9eb65b4cmr4411976lfu.0.1682357039845; Mon, 24 Apr 2023 10:23:59 -0700 (PDT) MIME-Version: 1.0 References: <20230424100552.2718-1-dun.tan@intel.com> In-Reply-To: <20230424100552.2718-1-dun.tan@intel.com> From: "Ard Biesheuvel" Date: Mon, 24 Apr 2023 19:23:48 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [Patch V3 0/8] Create page table by CpuPageTableLib in DxeIpl To: devel@edk2.groups.io, dun.tan@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 24 Apr 2023 at 12:06, duntan wrote: > > In V3 patch set: > 1. Add a new patch 'MdePkg: Move CpuPageTableLib defination to MdePkg' to= Move CpuPageTableLib defination from UefiCpuPkg to MdePkg. > So that MdeModulePkg doesn't need to depend on UefiCpuPkg. As I replied to the other patch, I think adding CpuPageTableLib to MdePkg in its current form (even only the interface) is not the right approach here. The function protoypes and enums exposed by this library are highly specific to a particular implementation. There is a clear use case here, which is the DXE IPL code, and as has been suggested in the other thread, it would be more appropriate to define an abstraction regarding this use case, and define it as a library class (with a NULL implementation) in MdeModulePkg. That way, UefiCpuPkg can provide the x86 implementation based on CpuPageTableLilb, and other architectures can do likewise. Please refer to the patch below, which illustrates why there are other requirements in this area: https://edk2.groups.io/g/devel/message/101122 --=20 Ard. > 2. Modify the patch 'MdeModulePkg/DxeIpl: Create page table by CpuPageTab= leLib' to set GHCB page to be mapped as unencrypted for each CPU for AMD SE= V feature. > > Dun Tan (8): > MdePkg: Move CpuPageTableLib defination to MdePkg > EmulatorPkg: Add CpuPageTableLib required by DxeIpl in DSC > IntelFsp2Pkg: Add CpuPageTableLib required by DxeIpl in DSC > MdeModulePkg: Add CpuPageTableLib required by DxeIpl in DSC > OvmfPkg: Add CpuPageTableLib required by DxeIpl in DSC file > MdeModulePkg/DxeIpl: Create page table by CpuPageTableLib > MdeModulePkg/DxeIpl: Remove duplicated code to enable NX > MdeModulePkg/DxeIpl: Refinement to the code to set PageTable as RO > > EmulatorPkg/EmulatorPkg.dsc | 3 ++- > IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc | 3 ++- > MdeModulePkg/Core/DxeIplPeim/DxeIpl.h | 3 ++- > MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 5 ++++- > MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 112 ++++-----= ---------------------------------------------------------------------------= ---------------------------- > MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c | 5 +++-- > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 720 +++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------------------------ > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.h | 182 +++++++++= +--------------------------------------------------------------------------= ---------------------------------------------------------------------------= ----------------------- > MdeModulePkg/MdeModulePkg.dsc | 3 ++- > {UefiCpuPkg =3D> MdePkg}/Include/Library/CpuPageTableLib.h | 0 > MdePkg/MdePkg.dec | 5 ++++- > OvmfPkg/AmdSev/AmdSevX64.dsc | 2 +- > OvmfPkg/Bhyve/BhyveX64.dsc | 3 ++- > OvmfPkg/CloudHv/CloudHvX64.dsc | 2 +- > OvmfPkg/Microvm/MicrovmX64.dsc | 2 +- > OvmfPkg/OvmfPkgIa32.dsc | 3 ++- > OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- > OvmfPkg/OvmfPkgX64.dsc | 2 +- > OvmfPkg/OvmfXen.dsc | 2 +- > UefiCpuPkg/UefiCpuPkg.dec | 3 --- > 20 files changed, 211 insertions(+), 851 deletions(-) > rename {UefiCpuPkg =3D> MdePkg}/Include/Library/CpuPageTableLib.h (100%) > > -- > 2.31.1.windows.1 > > > >=20 > >