From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
Michael Roth <michael.roth@amd.com>,
Oliver Steffen <osteffen@redhat.com>,
Erdem Aktas <erdemaktas@google.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Laszlo Ersek <lersek@redhat.com>, Min Xu <min.m.xu@intel.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Jiewen Yao <jiewen.yao@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [edk2-devel] [PATCH v3 4/6] OvmfPkg/ResetVector: SEV: keep #vc handler installed longer
Date: Tue, 20 Feb 2024 10:06:37 +0100 [thread overview]
Message-ID: <20240220090639.472222-5-kraxel@redhat.com> (raw)
In-Reply-To: <20240220090639.472222-1-kraxel@redhat.com>
When running in SEV mode do not uninstall the #vc handler in
CheckSevFeatures. Keep it active and uninstall it later in
SevClearPageEncMaskForGhcbPage.
This allows using the cpuid instruction in SetCr3ForPageTables64,
which is needed to check for la57 & 1G page support.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
OvmfPkg/ResetVector/Ia32/AmdSev.asm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
index 043c88a7abbe..02f287f1d934 100644
--- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm
+++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
@@ -158,6 +158,11 @@ SevClearPageEncMaskForGhcbPage:
cmp byte[WORK_AREA_GUEST_TYPE], 1
jnz SevClearPageEncMaskForGhcbPageExit
+ ; Clear exception handlers and stack
+ mov eax, ADDR_OF(IdtrClear)
+ lidt [cs:eax]
+ mov esp, 0
+
; Check if SEV-ES is enabled
mov ecx, 1
bt [SEV_ES_WORK_AREA_STATUS_MSR], ecx
@@ -332,7 +337,6 @@ NoSevEsVcHlt:
NoSevPass:
xor eax, eax
-SevExit:
;
; Clear exception handlers and stack
;
@@ -342,6 +346,7 @@ SevExit:
pop eax
mov esp, 0
+SevExit:
OneTimeCallRet CheckSevFeatures
; Start of #VC exception handling routines
--
2.43.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115648): https://edk2.groups.io/g/devel/message/115648
Mute This Topic: https://groups.io/mt/104464311/7686176
Mute #vc:https://edk2.groups.io/g/devel/mutehashtag/vc
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-20 9:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 9:06 [edk2-devel] [PATCH v3 0/6] OvmfPkg: Add support for 5-level paging Gerd Hoffmann
2024-02-20 9:06 ` [edk2-devel] [PATCH v3 1/6] MdeModulePkg/DxeIplPeim: fix PcdUse5LevelPageTable assert Gerd Hoffmann
2024-02-20 9:06 ` [edk2-devel] [PATCH v3 2/6] MdeModulePkg/DxeIplPeim: rename variable Gerd Hoffmann
2024-02-20 9:06 ` [edk2-devel] [PATCH v3 3/6] OvmfPkg/ResetVector: improve page table flag names Gerd Hoffmann
2024-02-20 9:06 ` Gerd Hoffmann [this message]
2024-02-20 16:48 ` [edk2-devel] [PATCH v3 4/6] OvmfPkg/ResetVector: SEV: keep #vc handler installed longer Laszlo Ersek
2024-02-20 19:56 ` Lendacky, Thomas via groups.io
2024-02-20 9:06 ` [edk2-devel] [PATCH v3 5/6] OvmfPkg/ResetVector: add 5-level paging support Gerd Hoffmann
2024-02-20 17:45 ` Laszlo Ersek
2024-02-20 18:32 ` Laszlo Ersek
2024-02-20 22:18 ` Lendacky, Thomas via groups.io
2024-02-20 9:06 ` [edk2-devel] [PATCH v3 6/6] OvmfPkg/PlatformInitLib: " Gerd Hoffmann
2024-02-21 6:42 ` [edk2-devel] [PATCH v3 0/6] OvmfPkg: Add support for 5-level paging Min Xu
2024-02-21 13:31 ` Ard Biesheuvel
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=20240220090639.472222-5-kraxel@redhat.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