From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min Xu <min.m.xu@intel.com>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Abner Chang <abner.chang@hpe.com>,
Daniel Schaefer <daniel.schaefer@hpe.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH V4 0/8] Enable secure-boot when lauch OVMF with -bios parameter
Date: Fri, 1 Jul 2022 07:29:09 +0800 [thread overview]
Message-ID: <cover.1656630360.git.min.m.xu@intel.com> (raw)
Secure-Boot related variables include the PK/KEK/DB/DBX and they are
stored in NvVarStore (OVMF_VARS.fd). When lauching with -pflash,
QEMU/OVMF will use emulated flash, and fully support UEFI variables.
But when launching with -bios parameter, UEFI variables will be partially
emulated, and non-volatile variables may lose their contents after a
reboot. See OvmfPkg/README.
Tdx guest is an example that -pflash is not supported. So this patch-set
is designed to initialize the NvVarStore with the content of in
OVMF_VARS.fd.
patch 1:
Add a new function (AllocateRuntimePages) in PrePiMemoryAllocationLib.
This function will be used in PeilessStartupLib which will run
in SEC phase.
patch 2:
Delete the TdxValidateCfv in PeilessStartupLib. Because it is going to
be renamed to PlatformValidateNvVarStore and be moved to PlatformInitLib.
patch 3 - 7:
Then we add functions for EmuVariableNvStore in PlatformInitLib. This
lib will then be called in OvmfPkg/PlatformPei and PeilessStartupLib.
We also shortcut ConnectNvVarsToFileSystem in secure-boot.
patch 8:
At last a build-flag (SECURE_BOOT_FEATURE_ENABLED) is introduced in
the dsc in OvmfPkg. Because the copy over of OVMR_VARS.fd to
EmuVariableNvStore is only required when secure-boot is enabled.
Code: https://github.com/mxu9/edk2/tree/secure-boot.v4
v4 chagnes:
- "EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib" is
missed in v3. It is added in this version.
- No other changes.
v3 changes:
- Renamed TdxValidateCfv to PlatformValidateNvVarStore and implemented
in PlatformInitlLib/Platform.c.
- Shortcut ConnectNvVarsToFileSystem in secure-boot.
- Other minor changes, such as adding log in
PlatformInitEmuVariableNvStore.
v2 changes:
- The v1 title is "Enable Secure-Boot in Tdx guest". Because the
patch-setwe was first designed to fix the gap when secure-boot feature
was enabled in Tdx guest. After discussing with the community (see
the disuccsions under https://edk2.groups.io/g/devel/message/90589)
this patch-set can fix the secure-boot issue when OVMF is lauched
with -bios parameter. So the title is updated.
- Add a new function (AllocateRuntimePages) in PrePiMemoryAllocationLib.
- Add build-flag SECURE_BOOT_FEATURE_ENABLED to control the copy over
of OVMF_VARS.fd to EmuVariableNvStore.
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com> [jejb]
Cc: Jiewen Yao <jiewen.yao@intel.com> [jyao1]
Cc: Tom Lendacky <thomas.lendacky@amd.com> [tlendacky]
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Min M Xu (8):
EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib
OvmfPkg/PeilessStartupLib: Delete TdxValidateCfv
OvmfPkg/PlatformInitLib: Add functions for EmuVariableNvStore
OvmfPkg/PlatformPei: Update ReserveEmuVariableNvStore
OvmfPkg: Reserve and init EmuVariableNvStore in Pei-less Startup
OvmfPkg/NvVarsFileLib: Shortcut ConnectNvVarsToFileSystem in
secure-boot
OvmfPkg/TdxDxe: Set PcdEmuVariableNvStoreReserved
OvmfPkg: Add build-flag SECURE_BOOT_FEATURE_ENABLED
EmbeddedPkg/Include/Library/PrePiLib.h | 19 ++
.../MemoryAllocationLib.c | 64 +++--
OvmfPkg/CloudHv/CloudHvX64.dsc | 9 +
OvmfPkg/Include/Library/PlatformInitLib.h | 51 ++++
OvmfPkg/IntelTdx/IntelTdxX64.dsc | 9 +
OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.c | 7 +
OvmfPkg/Library/PeilessStartupLib/IntelTdx.c | 153 -----------
.../PeilessStartupLib/PeilessStartup.c | 15 +-
.../PeilessStartupInternal.h | 17 --
OvmfPkg/Library/PlatformInitLib/Platform.c | 238 ++++++++++++++++++
.../PlatformInitLib/PlatformInitLib.inf | 3 +
OvmfPkg/OvmfPkgIa32.dsc | 9 +
OvmfPkg/OvmfPkgIa32X64.dsc | 9 +
OvmfPkg/OvmfPkgX64.dsc | 9 +
OvmfPkg/PlatformPei/Platform.c | 25 +-
OvmfPkg/TdxDxe/TdxDxe.c | 2 +
OvmfPkg/TdxDxe/TdxDxe.inf | 1 +
17 files changed, 428 insertions(+), 212 deletions(-)
--
2.29.2.windows.2
next reply other threads:[~2022-06-30 23:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 23:29 Min Xu [this message]
2022-06-30 23:29 ` [PATCH V4 1/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib Min Xu
2022-09-05 11:54 ` [edk2-devel] " Ard Biesheuvel
2022-06-30 23:29 ` [PATCH V4 2/8] OvmfPkg/PeilessStartupLib: Delete TdxValidateCfv Min Xu
2022-06-30 23:29 ` [PATCH V4 3/8] OvmfPkg/PlatformInitLib: Add functions for EmuVariableNvStore Min Xu
2022-06-30 23:29 ` [PATCH V4 4/8] OvmfPkg/PlatformPei: Update ReserveEmuVariableNvStore Min Xu
2022-06-30 23:29 ` [PATCH V4 5/8] OvmfPkg: Reserve and init EmuVariableNvStore in Pei-less Startup Min Xu
2022-06-30 23:29 ` [PATCH V4 6/8] OvmfPkg/NvVarsFileLib: Shortcut ConnectNvVarsToFileSystem in secure-boot Min Xu
2022-06-30 23:29 ` [PATCH V4 7/8] OvmfPkg/TdxDxe: Set PcdEmuVariableNvStoreReserved Min Xu
2022-06-30 23:29 ` [PATCH V4 8/8] OvmfPkg: Add build-flag SECURE_BOOT_FEATURE_ENABLED Min Xu
2022-07-20 6:38 ` [PATCH V4 0/8] Enable secure-boot when lauch OVMF with -bios parameter Min Xu
2022-07-20 8:24 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1656630360.git.min.m.xu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox