97168e
From 10fc28b61a6fba1e6dc44fd544cf31c7f313c622 Mon Sep 17 00:00:00 2001
97168e
From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
97168e
Date: Fri, 28 Oct 2022 17:48:00 +0100
97168e
Subject: [PATCH 05/42] Update linux headers to v6.0-rc4
97168e
MIME-Version: 1.0
97168e
Content-Type: text/plain; charset=UTF-8
97168e
Content-Transfer-Encoding: 8bit
97168e
97168e
RH-Author: Cédric Le Goater <clg@redhat.com>
97168e
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
97168e
RH-Bugzilla: 1664378 2043909
97168e
RH-Acked-by: Thomas Huth <thuth@redhat.com>
97168e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
97168e
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
97168e
RH-Commit: [5/41] ca55f497d1bf1e72179330f8f613781bf999d898
97168e
97168e
Based on upstream commit d525f73f9186a5bc641b8caf0b2c9bb94e5aa963
97168e
("Update linux headers to v6.0-rc4"), but this is focusing only on the
97168e
ZPCI and protected dump changes.
97168e
97168e
Signed-off-by: Cédric Le Goater <clg@redhat.com>
97168e
---
97168e
 linux-headers/linux/kvm.h       | 87 +++++++++++++++++++++++++++++++++
97168e
 linux-headers/linux/vfio_zdev.h |  7 +++
97168e
 2 files changed, 94 insertions(+)
97168e
97168e
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
97168e
index 0d05d02ee4..c65930288c 100644
97168e
--- a/linux-headers/linux/kvm.h
97168e
+++ b/linux-headers/linux/kvm.h
97168e
@@ -1150,6 +1150,9 @@ struct kvm_ppc_resize_hpt {
97168e
 #define KVM_CAP_DISABLE_QUIRKS2 213
97168e
 /* #define KVM_CAP_VM_TSC_CONTROL 214 */
97168e
 #define KVM_CAP_SYSTEM_EVENT_DATA 215
97168e
+#define KVM_CAP_S390_PROTECTED_DUMP 217
97168e
+#define KVM_CAP_S390_ZPCI_OP 221
97168e
+#define KVM_CAP_S390_CPU_TOPOLOGY 222
97168e
 
97168e
 #ifdef KVM_CAP_IRQ_ROUTING
97168e
 
97168e
@@ -1651,6 +1654,55 @@ struct kvm_s390_pv_unp {
97168e
 	__u64 tweak;
97168e
 };
97168e
 
97168e
+enum pv_cmd_dmp_id {
97168e
+	KVM_PV_DUMP_INIT,
97168e
+	KVM_PV_DUMP_CONFIG_STOR_STATE,
97168e
+	KVM_PV_DUMP_COMPLETE,
97168e
+	KVM_PV_DUMP_CPU,
97168e
+};
97168e
+
97168e
+struct kvm_s390_pv_dmp {
97168e
+	__u64 subcmd;
97168e
+	__u64 buff_addr;
97168e
+	__u64 buff_len;
97168e
+	__u64 gaddr;		/* For dump storage state */
97168e
+	__u64 reserved[4];
97168e
+};
97168e
+
97168e
+enum pv_cmd_info_id {
97168e
+	KVM_PV_INFO_VM,
97168e
+	KVM_PV_INFO_DUMP,
97168e
+};
97168e
+
97168e
+struct kvm_s390_pv_info_dump {
97168e
+	__u64 dump_cpu_buffer_len;
97168e
+	__u64 dump_config_mem_buffer_per_1m;
97168e
+	__u64 dump_config_finalize_len;
97168e
+};
97168e
+
97168e
+struct kvm_s390_pv_info_vm {
97168e
+	__u64 inst_calls_list[4];
97168e
+	__u64 max_cpus;
97168e
+	__u64 max_guests;
97168e
+	__u64 max_guest_addr;
97168e
+	__u64 feature_indication;
97168e
+};
97168e
+
97168e
+struct kvm_s390_pv_info_header {
97168e
+	__u32 id;
97168e
+	__u32 len_max;
97168e
+	__u32 len_written;
97168e
+	__u32 reserved;
97168e
+};
97168e
+
97168e
+struct kvm_s390_pv_info {
97168e
+	struct kvm_s390_pv_info_header header;
97168e
+	union {
97168e
+		struct kvm_s390_pv_info_dump dump;
97168e
+		struct kvm_s390_pv_info_vm vm;
97168e
+	};
97168e
+};
97168e
+
97168e
 enum pv_cmd_id {
97168e
 	KVM_PV_ENABLE,
97168e
 	KVM_PV_DISABLE,
97168e
@@ -1659,6 +1711,8 @@ enum pv_cmd_id {
97168e
 	KVM_PV_VERIFY,
97168e
 	KVM_PV_PREP_RESET,
97168e
 	KVM_PV_UNSHARE_ALL,
97168e
+	KVM_PV_INFO,
97168e
+	KVM_PV_DUMP,
97168e
 };
97168e
 
97168e
 struct kvm_pv_cmd {
97168e
@@ -2066,4 +2120,37 @@ struct kvm_stats_desc {
97168e
 /* Available with KVM_CAP_XSAVE2 */
97168e
 #define KVM_GET_XSAVE2		  _IOR(KVMIO,  0xcf, struct kvm_xsave)
97168e
 
97168e
+/* Available with KVM_CAP_S390_PROTECTED_DUMP */
97168e
+#define KVM_S390_PV_CPU_COMMAND	_IOWR(KVMIO, 0xd0, struct kvm_pv_cmd)
97168e
+
97168e
+/* Available with KVM_CAP_S390_ZPCI_OP */
97168e
+#define KVM_S390_ZPCI_OP         _IOW(KVMIO,  0xd1, struct kvm_s390_zpci_op)
97168e
+
97168e
+struct kvm_s390_zpci_op {
97168e
+	/* in */
97168e
+	__u32 fh;               /* target device */
97168e
+	__u8  op;               /* operation to perform */
97168e
+	__u8  pad[3];
97168e
+	union {
97168e
+		/* for KVM_S390_ZPCIOP_REG_AEN */
97168e
+		struct {
97168e
+			__u64 ibv;      /* Guest addr of interrupt bit vector */
97168e
+			__u64 sb;       /* Guest addr of summary bit */
97168e
+			__u32 flags;
97168e
+			__u32 noi;      /* Number of interrupts */
97168e
+			__u8 isc;       /* Guest interrupt subclass */
97168e
+			__u8 sbo;       /* Offset of guest summary bit vector */
97168e
+			__u16 pad;
97168e
+		} reg_aen;
97168e
+		__u64 reserved[8];
97168e
+	} u;
97168e
+};
97168e
+
97168e
+/* types for kvm_s390_zpci_op->op */
97168e
+#define KVM_S390_ZPCIOP_REG_AEN                0
97168e
+#define KVM_S390_ZPCIOP_DEREG_AEN      1
97168e
+
97168e
+/* flags for kvm_s390_zpci_op->u.reg_aen.flags */
97168e
+#define KVM_S390_ZPCIOP_REGAEN_HOST    (1 << 0)
97168e
+
97168e
 #endif /* __LINUX_KVM_H */
97168e
diff --git a/linux-headers/linux/vfio_zdev.h b/linux-headers/linux/vfio_zdev.h
97168e
index b4309397b6..77f2aff1f2 100644
97168e
--- a/linux-headers/linux/vfio_zdev.h
97168e
+++ b/linux-headers/linux/vfio_zdev.h
97168e
@@ -29,6 +29,9 @@ struct vfio_device_info_cap_zpci_base {
97168e
 	__u16 fmb_length;	/* Measurement Block Length (in bytes) */
97168e
 	__u8 pft;		/* PCI Function Type */
97168e
 	__u8 gid;		/* PCI function group ID */
97168e
+	/* End of version 1 */
97168e
+	__u32 fh;		/* PCI function handle */
97168e
+	/* End of version 2 */
97168e
 };
97168e
 
97168e
 /**
97168e
@@ -47,6 +50,10 @@ struct vfio_device_info_cap_zpci_group {
97168e
 	__u16 noi;		/* Maximum number of MSIs */
97168e
 	__u16 maxstbl;		/* Maximum Store Block Length */
97168e
 	__u8 version;		/* Supported PCI Version */
97168e
+	/* End of version 1 */
97168e
+	__u8 reserved;
97168e
+	__u16 imaxstbl;		/* Maximum Interpreted Store Block Length */
97168e
+	/* End of version 2 */
97168e
 };
97168e
 
97168e
 /**
97168e
-- 
97168e
2.37.3
97168e