mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/sev/vc: fix efi runtime instruction emulation
@ 2025-05-27 14:45 Gerd Hoffmann
  2025-05-27 14:45 ` [PATCH 2/2] x86/sev: let sev_es_efi_map_ghcbs map the caa pages too Gerd Hoffmann
  2025-05-27 16:21 ` [PATCH 1/2] x86/sev/vc: fix efi runtime instruction emulation Borislav Petkov
  0 siblings, 2 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2025-05-27 14:45 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
  Cc: kvm, linux-coco, Gerd Hoffmann, linux-kernel

In case efi_mm is active go use the userspace instruction decoder which
supports fetching instructions from active_mm.  This is needed to make
instruction emulation work for EFI runtime code, so it can use cpuid
and rdmsr.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 arch/x86/coco/sev/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 36beaac713c1..145f594d7e6b 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -346,7 +346,7 @@ static enum es_result __vc_decode_kern_insn(struct es_em_ctxt *ctxt)
 
 static enum es_result vc_decode_insn(struct es_em_ctxt *ctxt)
 {
-	if (user_mode(ctxt->regs))
+	if (user_mode(ctxt->regs) || current->active_mm == &efi_mm)
 		return __vc_decode_user_insn(ctxt);
 	else
 		return __vc_decode_kern_insn(ctxt);
-- 
2.49.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-06-02 10:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-27 14:45 [PATCH 1/2] x86/sev/vc: fix efi runtime instruction emulation Gerd Hoffmann
2025-05-27 14:45 ` [PATCH 2/2] x86/sev: let sev_es_efi_map_ghcbs map the caa pages too Gerd Hoffmann
2025-05-27 16:44   ` Dionna Amalie Glaze
2025-05-28  7:16     ` Gerd Hoffmann
2025-05-27 16:21 ` [PATCH 1/2] x86/sev/vc: fix efi runtime instruction emulation Borislav Petkov
2025-05-28  7:38   ` Gerd Hoffmann
2025-05-29 23:02     ` Borislav Petkov
2025-06-02 10:04       ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®