From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jin Liu <jinl@redhat.com>, Michael Roth <michael.roth@amd.com>
Subject: [PULL 01/41] target/i386: convert SEV-ES termination requests to guest panic events
Date: Thu, 12 Feb 2026 15:42:03 +0100 [thread overview]
Message-ID: <20260212144244.22579-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20260212144244.22579-1-pbonzini@redhat.com>
This produces a good error message instead of:
KVM: unknown exit reason 24
EAX=00000000 EBX=00000000 ECX=00000000 EDX=00a00f11
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
EIP=0000b004 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=1
ES =0000 00000000 0000ffff 00009300
CS =f000 00800000 0000ffff 00009b00
SS =0000 00000000 0000ffff 00009300
DS =0000 00000000 0000ffff 00009300
FS =0000 00000000 0000ffff 00009300
GS =0000 00000000 0000ffff 00009300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT= 00000000 0000ffff
IDT= 00000000 0000ffff
CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <00> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Reported-by: Jin Liu <jinl@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qapi/run-state.json | 23 +++++++++++++++++++++--
accel/kvm/kvm-all.c | 1 +
system/runstate.c | 4 ++++
target/i386/cpu-system.c | 22 ++++++++++++++++++++++
4 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/qapi/run-state.json b/qapi/run-state.json
index a6bc94a44bb..a5771ad4681 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -504,10 +504,12 @@
#
# @tdx: tdx guest panic information type (Since: 10.1)
#
+# @sev: AMD SEV-ES guest termination information type (Since: 11.0)
+#
# Since: 2.9
##
{ 'enum': 'GuestPanicInformationType',
- 'data': [ 'hyper-v', 's390', 'tdx' ] }
+ 'data': [ 'hyper-v', 's390', 'tdx', 'sev' ] }
##
# @GuestPanicInformation:
@@ -523,7 +525,8 @@
'discriminator': 'type',
'data': {'hyper-v': 'GuestPanicInformationHyperV',
's390': 'GuestPanicInformationS390',
- 'tdx' : 'GuestPanicInformationTdx'}}
+ 'tdx': 'GuestPanicInformationTdx',
+ 'sev': 'GuestPanicInformationSev' }}
##
# @GuestPanicInformationHyperV:
@@ -625,6 +628,22 @@
'message': 'str',
'*gpa': 'uint64'}}
+##
+# @GuestPanicInformationSev:
+#
+# Information for AMD SEV-specific termination request (GHCB MSR
+# contents)
+#
+# @set: The reason code set provided by the guest
+#
+# @code: The reason code provided by the guest
+#
+# Since: 11.0
+##
+{'struct': 'GuestPanicInformationSev',
+ 'data': {'set': 'uint32',
+ 'code': 'uint32'}}
+
##
# @MEMORY_FAILURE:
#
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 8301a512e7f..0d8b0c43470 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3300,6 +3300,7 @@ int kvm_cpu_exec(CPUState *cpu)
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
ret = EXCP_INTERRUPT;
break;
+ case KVM_SYSTEM_EVENT_SEV_TERM:
case KVM_SYSTEM_EVENT_CRASH:
kvm_cpu_synchronize_state(cpu);
bql_lock();
diff --git a/system/runstate.c b/system/runstate.c
index ed2db564806..d091a2bdddb 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -669,6 +669,10 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
"can be found at gpa page: 0x%" PRIx64 "\n",
info->u.tdx.gpa);
}
+ } else if (info->type == GUEST_PANIC_INFORMATION_TYPE_SEV) {
+ qemu_log_mask(LOG_GUEST_ERROR, "SEV termination (reason set: %d code: %d)",
+ info->u.sev.set,
+ info->u.sev.code);
}
qapi_free_GuestPanicInformation(info);
diff --git a/target/i386/cpu-system.c b/target/i386/cpu-system.c
index b1494aa6740..c8bbf0cbafd 100644
--- a/target/i386/cpu-system.c
+++ b/target/i386/cpu-system.c
@@ -18,6 +18,8 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "system/kvm.h"
#include "cpu.h"
#include "qapi/error.h"
#include "qapi/qapi-visit-run-state.h"
@@ -272,6 +274,26 @@ GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs)
CPUX86State *env = &cpu->env;
GuestPanicInformation *panic_info = NULL;
+#ifdef CONFIG_KVM
+ if (kvm_enabled()) {
+ struct kvm_run *run = cs->kvm_run;
+
+ if (run->exit_reason == KVM_EXIT_SYSTEM_EVENT &&
+ run->system_event.type == KVM_SYSTEM_EVENT_SEV_TERM) {
+ panic_info = g_new0(GuestPanicInformation, 1);
+
+ panic_info->type = GUEST_PANIC_INFORMATION_TYPE_SEV;
+ /* There should always be one data item, otherwise use zeroes. */
+ if (run->system_event.ndata > 0) {
+ panic_info->u.sev.set = (run->system_event.data[0] >> 12) & 0xf;
+ panic_info->u.sev.code = (run->system_event.data[0] >> 16) & 0xff;
+ } else {
+ warn_report("Hypervisor did not provide any data for SEV-ES termination");
+ }
+ }
+ } else
+#endif
+
if (hyperv_feat_enabled(cpu, HYPERV_FEAT_CRASH)) {
panic_info = g_new0(GuestPanicInformation, 1);
--
2.52.0
next prev parent reply other threads:[~2026-02-12 14:45 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 14:42 [PULL 00/41] QOM, target/i386 patches for 2026-02-12 Paolo Bonzini
2026-02-12 14:42 ` Paolo Bonzini [this message]
2026-02-12 14:42 ` [PULL 02/41] hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 03/41] tests/acpi: Allow DSDT table change for x86 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 04/41] pc: Start with modern CPU hotplug interface by default Paolo Bonzini
2026-03-16 16:01 ` Peter Maydell
2026-03-17 4:23 ` Zhao Liu
2026-03-17 14:21 ` Peter Maydell
2026-02-12 14:42 ` [PULL 05/41] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field Paolo Bonzini
2026-02-12 14:42 ` [PULL 06/41] acpi: Remove legacy cpu hotplug utilities Paolo Bonzini
2026-02-12 14:42 ` [PULL 07/41] docs/specs/acpi_cpu_hotplug: Remove legacy cpu hotplug descriptions Paolo Bonzini
2026-02-12 14:42 ` [PULL 08/41] tests/acpi: Update DSDT tables for pc & q35 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 09/41] hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix Paolo Bonzini
2026-02-12 14:42 ` [PULL 10/41] hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma() Paolo Bonzini
2026-02-12 14:42 ` [PULL 11/41] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out Paolo Bonzini
2026-02-12 14:42 ` [PULL 12/41] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma() Paolo Bonzini
2026-02-12 14:42 ` [PULL 13/41] hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field Paolo Bonzini
2026-02-12 14:42 ` [PULL 14/41] hw/i386/pc: Remove multiboot.bin Paolo Bonzini
2026-02-12 14:42 ` [PULL 15/41] hw/i386: Assume fw_cfg DMA is always enabled Paolo Bonzini
2026-02-12 14:42 ` [PULL 16/41] hw/i386: Remove linuxboot.bin Paolo Bonzini
2026-03-24 12:12 ` Daniel P. Berrangé
2026-03-24 12:14 ` Paolo Bonzini
2026-02-12 14:42 ` [PULL 17/41] hw/i386/pc: Remove pc_compat_2_6[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 18/41] hw/intc/apic: Remove APICCommonState::legacy_instance_id field Paolo Bonzini
2026-02-12 14:42 ` [PULL 19/41] hw/core/machine: Remove hw_compat_2_6[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 20/41] hw/virtio/virtio-mmio: Remove VirtIOMMIOProxy::format_transport_address field Paolo Bonzini
2026-02-12 14:42 ` [PULL 21/41] hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 22/41] hw/i386/pc: Remove pc_compat_2_7[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 23/41] target/i386/cpu: Remove CPUX86State::full_cpuid_auto_level field Paolo Bonzini
2026-02-12 14:42 ` [PULL 24/41] hw/audio/pcspk: Remove PCSpkState::migrate field Paolo Bonzini
2026-02-12 14:42 ` [PULL 25/41] hw/core/machine: Remove hw_compat_2_7[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 26/41] hw/i386/intel_iommu: Remove IntelIOMMUState::buggy_eim field Paolo Bonzini
2026-02-12 14:42 ` [PULL 27/41] hw/virtio/virtio-pci: Remove VirtIOPCIProxy::ignore_backend_features field Paolo Bonzini
2026-02-12 14:42 ` [PULL 28/41] hw/char/virtio-serial: Do not expose the 'emergency-write' property Paolo Bonzini
2026-02-16 17:21 ` Alexander Bulekov
2026-02-12 14:42 ` [PULL 29/41] i386/cpu: Fix incorrect initializer in Diamond Rapids definition Paolo Bonzini
2026-02-12 14:42 ` [PULL 30/41] target/i386/kvm: set KVM_PMU_CAP_DISABLE if "-pmu" is configured Paolo Bonzini
2026-02-12 14:42 ` [PULL 31/41] target/i386/kvm: extract unrelated code out of kvm_x86_build_cpuid() Paolo Bonzini
2026-02-12 14:42 ` [PULL 32/41] target/i386/kvm: rename architectural PMU variables Paolo Bonzini
2026-02-12 14:42 ` [PULL 33/41] target/i386/kvm: reset AMD PMU registers during VM reset Paolo Bonzini
2026-02-12 14:42 ` [PULL 34/41] target/i386/kvm: support perfmon-v2 for reset Paolo Bonzini
2026-02-12 14:42 ` [PULL 35/41] qdev: Free property array on release Paolo Bonzini
2026-02-12 14:42 ` [PULL 36/41] qdev: make release_string() idempotent Paolo Bonzini
2026-02-12 14:42 ` [PULL 37/41] qdev: make release_drive() idempotent Paolo Bonzini
2026-02-12 14:42 ` [PULL 38/41] qdev: make release_tpm() idempotent Paolo Bonzini
2026-02-12 14:42 ` [PULL 39/41] tests: add /qdev/free-properties test Paolo Bonzini
2026-02-12 14:42 ` [PULL 40/41] accel/mshv: Remove remap overlapping mappings code Paolo Bonzini
2026-02-12 14:42 ` [PULL 41/41] target/i386/mshv: remove unused optimization of gva=>gpa translation Paolo Bonzini
2026-02-12 16:26 ` [PULL 00/41] QOM, target/i386 patches for 2026-02-12 Peter Maydell
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-all 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=20260212144244.22579-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=jinl@redhat.com \
--cc=michael.roth@amd.com \
--cc=qemu-devel@nongnu.org \
/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