thebeanogamer / rpms / qemu-kvm

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