thebeanogamer / rpms / qemu-kvm

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