]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 3 Nov 2025 15:10:17 +0000 (12:10 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 3 Nov 2025 16:29:53 +0000 (13:29 -0300)
To pick the changes in:

  fddd07626baa419c ("KVM: x86: Define AMD's #HV, #VC, and #SX exception vectors")
  f2f5519aa4e3ec4e ("KVM: x86: Define Control Protection Exception (#CP) vector")
  9d6812d415358372 ("KVM: x86: Enable guest SSP read/write interface with new uAPIs")
  06f2969c6a1237f0 ("KVM: x86: Introduce KVM_{G,S}ET_ONE_REG uAPIs support")

That just rebuilds kvm-stat.c on x86, no change in functionality.

This silences these perf build warning:

  Warning: Kernel ABI header differences:
    diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h

Please see tools/include/uapi/README for further details.

Cc: Sean Christopherson <seanjc@google.com>
Cc: Yang Weijiang <weijiang.yang@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/arch/x86/include/uapi/asm/kvm.h

index 0f15d683817d6a77b0c7cdfe3fda2b6bef2e4172..d420c9c066d48c9836854a12436e13b4d6aa9d35 100644 (file)
 #define MC_VECTOR 18
 #define XM_VECTOR 19
 #define VE_VECTOR 20
+#define CP_VECTOR 21
+
+#define HV_VECTOR 28
+#define VC_VECTOR 29
+#define SX_VECTOR 30
 
 /* Select x86 specific features in <linux/kvm.h> */
 #define __KVM_HAVE_PIT
@@ -411,6 +416,35 @@ struct kvm_xcrs {
        __u64 padding[16];
 };
 
+#define KVM_X86_REG_TYPE_MSR           2
+#define KVM_X86_REG_TYPE_KVM           3
+
+#define KVM_X86_KVM_REG_SIZE(reg)                                              \
+({                                                                             \
+       reg == KVM_REG_GUEST_SSP ? KVM_REG_SIZE_U64 : 0;                        \
+})
+
+#define KVM_X86_REG_TYPE_SIZE(type, reg)                                       \
+({                                                                             \
+       __u64 type_size = (__u64)type << 32;                                    \
+                                                                               \
+       type_size |= type == KVM_X86_REG_TYPE_MSR ? KVM_REG_SIZE_U64 :          \
+                    type == KVM_X86_REG_TYPE_KVM ? KVM_X86_KVM_REG_SIZE(reg) : \
+                    0;                                                         \
+       type_size;                                                              \
+})
+
+#define KVM_X86_REG_ID(type, index)                            \
+       (KVM_REG_X86 | KVM_X86_REG_TYPE_SIZE(type, index) | index)
+
+#define KVM_X86_REG_MSR(index)                                 \
+       KVM_X86_REG_ID(KVM_X86_REG_TYPE_MSR, index)
+#define KVM_X86_REG_KVM(index)                                 \
+       KVM_X86_REG_ID(KVM_X86_REG_TYPE_KVM, index)
+
+/* KVM-defined registers starting from 0 */
+#define KVM_REG_GUEST_SSP      0
+
 #define KVM_SYNC_X86_REGS      (1UL << 0)
 #define KVM_SYNC_X86_SREGS     (1UL << 1)
 #define KVM_SYNC_X86_EVENTS    (1UL << 2)