This is a temporary patch intended for review and testing purposes only.
It syncs the QEMU linux-headers with the kernel changes that introduce
the KVM_PPC_GET_COMPAT_CAPS ioctl for querying host CPU compatibility
capabilities. This includes the kvm_ppc_compat_caps structure with a
size field for ABI versioning, the KVM_CAP_PPC_COMPAT_CAPS capability
definition, the KVM_PPC_GET_COMPAT_CAPS ioctl definition, and capability
bit definitions for POWER9, POWER10, and POWER11 compatibility modes.

The actual header sync will be done via scripts/update-linux-headers.sh
once the kernel changes [1] are merged upstream.

[1] https://lore.kernel.org/all/[email protected]/

Signed-off-by: Amit Machhiwal <[email protected]>
---
 linux-headers/asm-powerpc/kvm.h | 18 ++++++++++++++++++
 linux-headers/linux/kvm.h       |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
index 077c5437f521..22ee61bdc812 100644
--- a/linux-headers/asm-powerpc/kvm.h
+++ b/linux-headers/asm-powerpc/kvm.h
@@ -437,6 +437,24 @@ struct kvm_ppc_cpu_char {
        __u64   behaviour_mask;         /* valid bits in behaviour */
 };
 
+/* For KVM_PPC_GET_COMPAT_CAPS */
+struct kvm_ppc_compat_caps {
+       __u64   flags;                  /* Reserved for future use */
+       __u64   size;                   /* Size of this structure */
+       __u64   compat_capabilities;    /* Capabilities supported by the host */
+};
+/*
+ * Capability bits for compat_capabilities field in kvm_ppc_compat_caps.
+ * These bits indicate which processor compatibility modes are supported.
+ */
+#define KVM_PPC_COMPAT_CAP_POWER9      (1ULL << 62)
+#define KVM_PPC_COMPAT_CAP_POWER10     (1ULL << 61)
+#define KVM_PPC_COMPAT_CAP_POWER11     (1ULL << 60)
+#define KVM_PPC_COMPAT_BITMASK         (KVM_PPC_COMPAT_CAP_POWER9 | \
+                                        KVM_PPC_COMPAT_CAP_POWER10 | \
+                                        KVM_PPC_COMPAT_CAP_POWER11)
+
+
 /*
  * Values for character and character_mask.
  * These are identical to the values used by H_GET_CPU_CHARACTERISTICS.
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 50e87ed72c20..a3dbf7c317b9 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -985,6 +985,7 @@ struct kvm_enable_cap {
 #define KVM_CAP_S390_USER_OPEREXEC 246
 #define KVM_CAP_S390_KEYOP 247
 #define KVM_CAP_S390_VSIE_ESAMODE 248
+#define KVM_CAP_PPC_COMPAT_CAPS 249
 
 struct kvm_irq_routing_irqchip {
        __u32 irqchip;
@@ -1329,6 +1330,8 @@ struct kvm_s390_keyop {
 /* Available with KVM_CAP_COUNTER_OFFSET */
 #define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO,  0xb5, struct 
kvm_arm_counter_offset)
 #define KVM_ARM_GET_REG_WRITABLE_MASKS _IOR(KVMIO,  0xb6, struct 
reg_mask_range)
+/* Available with KVM_CAP_PPC_COMPAT_CAPS */
+#define KVM_PPC_GET_COMPAT_CAPS          _IOR(KVMIO,  0xe4, struct 
kvm_ppc_compat_caps)
 
 /* ioctl for vm fd */
 #define KVM_CREATE_DEVICE        _IOWR(KVMIO,  0xe0, struct kvm_create_device)
-- 
2.50.1 (Apple Git-155)


Reply via email to