Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/include: Sync uapi/linux/kvm.h with the kernel sources

And other arch-specific UAPI headers to pick up changes from:

4b23e0c199b2 KVM: Ensure new code that references immediate_exit gets extra scrutiny
85542adb65ec KVM: x86: Add KVM_RUN_X86_GUEST_MODE kvm_run flag
6fef518594bc KVM: x86: Add a capability to configure bus frequency for APIC timer
34ff65901735 x86/sev: Use kernel provided SVSM Calling Areas
5dcc1e76144f Merge tag 'kvm-x86-misc-6.11' of https://github.com/kvm-x86/linux into HEAD
9a0d2f4995dd KVM: PPC: Book3S HV: Add one-reg interface for HASHPKEYR register
e9eb790b2557 KVM: PPC: Book3S HV: Add one-reg interface for HASHKEYR register
1a1e6865f516 KVM: PPC: Book3S HV: Add one-reg interface for DEXCR register

This should be used to beautify KVM syscall arguments and it addresses
these tools/perf build warnings:

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

Please see tools/include/uapi/README for details (it's in the first patch
of this series).

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

+69 -1
+3
tools/arch/powerpc/include/uapi/asm/kvm.h
··· 645 645 #define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3) 646 646 #define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4) 647 647 #define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5) 648 + #define KVM_REG_PPC_DEXCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc6) 649 + #define KVM_REG_PPC_HASHKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc7) 650 + #define KVM_REG_PPC_HASHPKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc8) 648 651 649 652 /* Transactional Memory checkpointed state: 650 653 * This is all GPRs, all VSX regs and a subset of SPRs
+49
tools/arch/x86/include/uapi/asm/kvm.h
··· 106 106 107 107 #define KVM_RUN_X86_SMM (1 << 0) 108 108 #define KVM_RUN_X86_BUS_LOCK (1 << 1) 109 + #define KVM_RUN_X86_GUEST_MODE (1 << 2) 109 110 110 111 /* for KVM_GET_REGS and KVM_SET_REGS */ 111 112 struct kvm_regs { ··· 698 697 /* Second time is the charm; improved versions of the above ioctls. */ 699 698 KVM_SEV_INIT2, 700 699 700 + /* SNP-specific commands */ 701 + KVM_SEV_SNP_LAUNCH_START = 100, 702 + KVM_SEV_SNP_LAUNCH_UPDATE, 703 + KVM_SEV_SNP_LAUNCH_FINISH, 704 + 701 705 KVM_SEV_NR_MAX, 702 706 }; 703 707 ··· 830 824 __u32 pad2; 831 825 }; 832 826 827 + struct kvm_sev_snp_launch_start { 828 + __u64 policy; 829 + __u8 gosvw[16]; 830 + __u16 flags; 831 + __u8 pad0[6]; 832 + __u64 pad1[4]; 833 + }; 834 + 835 + /* Kept in sync with firmware values for simplicity. */ 836 + #define KVM_SEV_SNP_PAGE_TYPE_NORMAL 0x1 837 + #define KVM_SEV_SNP_PAGE_TYPE_ZERO 0x3 838 + #define KVM_SEV_SNP_PAGE_TYPE_UNMEASURED 0x4 839 + #define KVM_SEV_SNP_PAGE_TYPE_SECRETS 0x5 840 + #define KVM_SEV_SNP_PAGE_TYPE_CPUID 0x6 841 + 842 + struct kvm_sev_snp_launch_update { 843 + __u64 gfn_start; 844 + __u64 uaddr; 845 + __u64 len; 846 + __u8 type; 847 + __u8 pad0; 848 + __u16 flags; 849 + __u32 pad1; 850 + __u64 pad2[4]; 851 + }; 852 + 853 + #define KVM_SEV_SNP_ID_BLOCK_SIZE 96 854 + #define KVM_SEV_SNP_ID_AUTH_SIZE 4096 855 + #define KVM_SEV_SNP_FINISH_DATA_SIZE 32 856 + 857 + struct kvm_sev_snp_launch_finish { 858 + __u64 id_block_uaddr; 859 + __u64 id_auth_uaddr; 860 + __u8 id_block_en; 861 + __u8 auth_key_en; 862 + __u8 vcek_disabled; 863 + __u8 host_data[KVM_SEV_SNP_FINISH_DATA_SIZE]; 864 + __u8 pad0[3]; 865 + __u16 flags; 866 + __u64 pad1[4]; 867 + }; 868 + 833 869 #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) 834 870 #define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1) 835 871 ··· 922 874 #define KVM_X86_SW_PROTECTED_VM 1 923 875 #define KVM_X86_SEV_VM 2 924 876 #define KVM_X86_SEV_ES_VM 3 877 + #define KVM_X86_SNP_VM 4 925 878 926 879 #endif /* _ASM_X86_KVM_H */
+1
tools/arch/x86/include/uapi/asm/svm.h
··· 115 115 #define SVM_VMGEXIT_AP_CREATE_ON_INIT 0 116 116 #define SVM_VMGEXIT_AP_CREATE 1 117 117 #define SVM_VMGEXIT_AP_DESTROY 2 118 + #define SVM_VMGEXIT_SNP_RUN_VMPL 0x80000018 118 119 #define SVM_VMGEXIT_HV_FEATURES 0x8000fffd 119 120 #define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe 120 121 #define SVM_VMGEXIT_TERM_REASON(reason_set, reason_code) \
+16 -1
tools/include/uapi/linux/kvm.h
··· 192 192 /* Flags that describe what fields in emulation_failure hold valid data. */ 193 193 #define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES (1ULL << 0) 194 194 195 + /* 196 + * struct kvm_run can be modified by userspace at any time, so KVM must be 197 + * careful to avoid TOCTOU bugs. In order to protect KVM, HINT_UNSAFE_IN_KVM() 198 + * renames fields in struct kvm_run from <symbol> to <symbol>__unsafe when 199 + * compiled into the kernel, ensuring that any use within KVM is obvious and 200 + * gets extra scrutiny. 201 + */ 202 + #ifdef __KERNEL__ 203 + #define HINT_UNSAFE_IN_KVM(_symbol) _symbol##__unsafe 204 + #else 205 + #define HINT_UNSAFE_IN_KVM(_symbol) _symbol 206 + #endif 207 + 195 208 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 196 209 struct kvm_run { 197 210 /* in */ 198 211 __u8 request_interrupt_window; 199 - __u8 immediate_exit; 212 + __u8 HINT_UNSAFE_IN_KVM(immediate_exit); 200 213 __u8 padding1[6]; 201 214 202 215 /* out */ ··· 931 918 #define KVM_CAP_GUEST_MEMFD 234 932 919 #define KVM_CAP_VM_TYPES 235 933 920 #define KVM_CAP_PRE_FAULT_MEMORY 236 921 + #define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237 922 + #define KVM_CAP_X86_GUEST_MODE 238 934 923 935 924 struct kvm_irq_routing_irqchip { 936 925 __u32 irqchip;