linux-next: manual merge of the kvm-arm tree with the kvm tree

From: Stephen Rothwell
Date: Thu May 05 2022 - 00:48:08 EST


Hi all,

Today's linux-next merge of the kvm-arm tree got conflicts in:

include/uapi/linux/kvm.h
Documentation/virt/kvm/api.rst

between commits:

c24a950ec7d6 ("KVM, SEV: Add KVM_EXIT_SHUTDOWN metadata for SEV-ES")
71d7c575a673 ("Merge branch 'kvm-fixes-for-5.18-rc5' into HEAD")

from the kvm tree and commits:

7b33a09d036f ("KVM: arm64: Add support for userspace to suspend a vCPU")
bfbab4456877 ("KVM: arm64: Implement PSCI SYSTEM_SUSPEND")

from the kvm-arm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc Documentation/virt/kvm/api.rst
index 2325b703a1ea,cbea3983f47b..000000000000
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@@ -6090,7 -6032,8 +6137,9 @@@ should put the acknowledged interrupt v
#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
#define KVM_SYSTEM_EVENT_CRASH 3
- #define KVM_SYSTEM_EVENT_WAKEUP 4
- #define KVM_SYSTEM_EVENT_SUSPEND 5
+ #define KVM_SYSTEM_EVENT_SEV_TERM 4
++ #define KVM_SYSTEM_EVENT_WAKEUP 5
++ #define KVM_SYSTEM_EVENT_SUSPEND 6
__u32 type;
__u32 ndata;
__u64 data[16];
@@@ -6115,8 -6058,37 +6164,39 @@@ Valid values for 'type' are
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]`.
+ - KVM_SYSTEM_EVENT_WAKEUP -- the exiting vCPU is in a suspended state and
+ KVM has recognized a wakeup event. Userspace may honor this event by
+ marking the exiting vCPU as runnable, or deny it and call KVM_RUN again.
+ - KVM_SYSTEM_EVENT_SUSPEND -- the guest has requested a suspension of
+ the VM.
+
+ For arm/arm64:
+ ^^^^^^^^^^^^^^
+
+ KVM_SYSTEM_EVENT_SUSPEND exits are enabled with the
+ KVM_CAP_ARM_SYSTEM_SUSPEND VM capability. If a guest invokes the PSCI
+ SYSTEM_SUSPEND function, KVM will exit to userspace with this event
+ type.
+
+ It is the sole responsibility of userspace to implement the PSCI
+ SYSTEM_SUSPEND call according to ARM DEN0022D.b 5.19 "SYSTEM_SUSPEND".
+ KVM does not change the vCPU's state before exiting to userspace, so
+ the call parameters are left in-place in the vCPU registers.
+
+ Userspace is _required_ to take action for such an exit. It must
+ either:
+
+ - Honor the guest request to suspend the VM. Userspace can request
+ in-kernel emulation of suspension by setting the calling vCPU's
+ state to KVM_MP_STATE_SUSPENDED. Userspace must configure the vCPU's
+ state according to the parameters passed to the PSCI function when
+ the calling vCPU is resumed. See ARM DEN0022D.b 5.19.1 "Intended use"
+ for details on the function parameters.
+
+ - Deny the guest request to suspend the VM. See ARM DEN0022D.b 5.19.2
+ "Caller responsibilities" for possible return values.

If KVM_CAP_SYSTEM_EVENT_DATA is present, the 'data' field can contain
architecture specific information for the system-level event. Only
diff --cc include/uapi/linux/kvm.h
index e10d131edd80,32c56384fd08..000000000000
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@@ -444,7 -444,8 +444,9 @@@ struct kvm_run
#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
#define KVM_SYSTEM_EVENT_CRASH 3
-#define KVM_SYSTEM_EVENT_WAKEUP 4
-#define KVM_SYSTEM_EVENT_SUSPEND 5
+#define KVM_SYSTEM_EVENT_SEV_TERM 4
++#define KVM_SYSTEM_EVENT_WAKEUP 5
++#define KVM_SYSTEM_EVENT_SUSPEND 6
__u32 type;
__u32 ndata;
union {
@@@ -1151,8 -1153,9 +1154,9 @@@ struct kvm_ppc_resize_hpt
#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
+ #define KVM_CAP_ARM_SYSTEM_SUSPEND 216

#ifdef KVM_CAP_IRQ_ROUTING

Attachment: pgpFcotRK7WL8.pgp
Description: OpenPGP digital signature