#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
#define KVM_SYSTEM_EVENT_CRASH 3
- #define KVM_SYSTEM_EVENT_NDATA_VALID (1u << 31)
+ #define KVM_SYSTEM_EVENT_SEV_TERM 4
__u32 type;
__u32 ndata;
- __u64 flags;
__u64 data[16];
} system_event;
has requested a crash condition maintenance. Userspace can choose
to ignore the request, or to gather VM memory core dump and/or
reset/shutdown of the VM.
+ - KVM_SYSTEM_EVENT_SEV_TERM -- an AMD SEV guest requested termination.
+ The guest physical address of the guest's GHCB is stored in `data[0]`.
- Valid flags are:
+ If KVM_CAP_SYSTEM_EVENT_DATA is present, the 'data' field can contain
+ architecture specific information for the system-level event. Only
+ the first `ndata` items (possibly zero) of the data array are valid.
- - KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 (arm64 only) -- the guest issued
- a SYSTEM_RESET2 call according to v1.1 of the PSCI specification.
+ - for arm64, data[0] is set to KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 if
+ the guest issued a SYSTEM_RESET2 call according to v1.1 of the PSCI
+ specification.
- Extra data for this event is stored in the `data[]` array, up to index
- `ndata-1` included, if bit 31 is set in `type`. The data depends on the
- `type` field. There is no extra data if bit 31 is clear or `ndata` is zero.
+ - for RISC-V, data[0] is set to the value of the second argument of the
+ ``sbi_system_reset`` call.
+
+ Previous versions of Linux defined a `flags` member in this struct. The
+ field is now aliased to `data[0]`. Userspace can assume that it is only
+ written if ndata is greater than 0.
::
pr_info("SEV-ES guest requested termination: %#llx:%#llx\n",
reason_set, reason_code);
- ret = -EINVAL;
- break;
+ vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
- vcpu->run->system_event.type = KVM_SYSTEM_EVENT_SEV_TERM |
- KVM_SYSTEM_EVENT_NDATA_VALID;
++ vcpu->run->system_event.type = KVM_SYSTEM_EVENT_SEV_TERM;
+ vcpu->run->system_event.ndata = 1;
- vcpu->run->system_event.data[1] = control->ghcb_gpa;
++ vcpu->run->system_event.data[0] = control->ghcb_gpa;
+
+ return 0;
}
default:
/* Error, keep GHCB MSR value as-is */
#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
#define KVM_SYSTEM_EVENT_CRASH 3
- #define KVM_SYSTEM_EVENT_NDATA_VALID (1u << 31)
+#define KVM_SYSTEM_EVENT_SEV_TERM 4
__u32 type;
__u32 ndata;
- __u64 data[16];
+ union {
+ #ifndef __KERNEL__
+ __u64 flags;
+ #endif
+ __u64 data[16];
+ };
} system_event;
/* KVM_EXIT_S390_STSI */
struct {
#define KVM_CAP_S390_MEM_OP_EXTENSION 211
#define KVM_CAP_PMU_CAPABILITY 212
#define KVM_CAP_DISABLE_QUIRKS2 213
-/* #define KVM_CAP_VM_TSC_CONTROL 214 */
+#define KVM_CAP_VM_TSC_CONTROL 214
+ #define KVM_CAP_SYSTEM_EVENT_DATA 215
#ifdef KVM_CAP_IRQ_ROUTING