diff mbox series

[RFC,v4,1/2] Capability/IOCTL/Documentation

Message ID 20211119213707.2363945-2-farman@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Improvements to SIGP handling [KVM] | expand

Commit Message

Eric Farman Nov. 19, 2021, 9:37 p.m. UTC
(This should be squashed with the next patch; it's just broken
out for ease-of-future rebase.)

Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 Documentation/virt/kvm/api.rst | 22 ++++++++++++++++++++++
 include/uapi/linux/kvm.h       | 16 ++++++++++++++++
 2 files changed, 38 insertions(+)
diff mbox series

Patch

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index a6729c8cf063..012167775419 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -5317,6 +5317,18 @@  the trailing ``'\0'``, is indicated by ``name_size`` in the header.
 The Stats Data block contains an array of 64-bit values in the same order
 as the descriptors in Descriptors block.
 
+4.134 KVM_S390_USER_BUSY
+---------------------------------
+
+:Capability: KVM_CAP_S390_USER_BUSY
+:Architectures: s390
+:Type: vcpu ioctl
+:Parameters: struct kvm_s390_busy_info
+:Returns: 0, or -EBUSY if VCPU is already busy
+
+This ioctl sets the VCPU's indicator that it is busy processing an item
+of work, and is thus unavailable for additional work of that type.
+
 5. The kvm_run structure
 ========================
 
@@ -6706,6 +6718,16 @@  MAP_SHARED mmap will result in an -EINVAL return.
 When enabled the VMM may make use of the ``KVM_ARM_MTE_COPY_TAGS`` ioctl to
 perform a bulk copy of tags to/from the guest.
 
+7.29 KVM_CAP_S390_USER_BUSY
+--------------------------------
+
+:Architectures: s390
+:Parameters: none
+
+This capability indicates that KVM should indicate when a vcpu is busy
+performing some work, and conflicting work directed at the same vcpu should
+return CC2 (BUSY) until it has completed.
+
 8. Other capabilities.
 ======================
 
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index a067410ebea5..7f16f9fb4ae8 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1112,6 +1112,7 @@  struct kvm_ppc_resize_hpt {
 #define KVM_CAP_BINARY_STATS_FD 203
 #define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204
 #define KVM_CAP_ARM_MTE 205
+#define KVM_CAP_S390_USER_BUSY 206
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -2007,4 +2008,19 @@  struct kvm_stats_desc {
 
 #define KVM_GET_STATS_FD  _IO(KVMIO,  0xce)
 
+/* Available with KVM_CAP_S390_USER_BUSY */
+#define KVM_S390_USER_BUSY	_IOW(KVMIO, 0xcf, struct kvm_s390_user_busy_info)
+
+#define KVM_S390_USER_BUSY_REASON_SIGP		1
+
+#define KVM_S390_USER_BUSY_FUNCTION_RESET	0
+#define KVM_S390_USER_BUSY_FUNCTION_SET		1
+
+/* FIXME struct description */
+struct kvm_s390_user_busy_info {
+	__u32 reason;
+	__u32 function;
+	__u32 payload;
+};
+
 #endif /* __LINUX_KVM_H */