Skip to content

Commit 8fc50be

Browse files
committed
tools headers UAPI: Sync kvm header with the kernel sources
To pick the changes in: c9c1e20 ("KVM: x86: Introduce Intel specific quirk KVM_X86_QUIRK_IGNORE_GUEST_PAT") 012426d ("KVM: TDX: Finalize VM initialization") c846b45 ("KVM: TDX: Add an ioctl to create initial guest memory") 488808e ("KVM: x86: Introduce KVM_TDX_GET_CPUID") a50f673 ("KVM: TDX: Do TDX specific vcpu initialization") 0186dd2 ("KVM: TDX: add ioctl to initialize VM with TDX specific parameters") 61bb282 ("KVM: TDX: Get system-wide info about TDX module on initialization") b2aaf38 ("KVM: TDX: Add place holder for TDX VM specific mem_enc_op ioctl") This addresses these perf build warnings: 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: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Isaku Yamahata <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Xiaoyao Li <[email protected]> Cc: Yan Zhao <[email protected]> Link: https://lore.kernel.org/r/aErqLPktXIzGyS-m@x1 Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent da845e4 commit 8fc50be

File tree

1 file changed

+71
-0
lines changed
  • tools/arch/x86/include/uapi/asm

1 file changed

+71
-0
lines changed

tools/arch/x86/include/uapi/asm/kvm.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ struct kvm_sync_regs {
441441
#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS (1 << 6)
442442
#define KVM_X86_QUIRK_SLOT_ZAP_ALL (1 << 7)
443443
#define KVM_X86_QUIRK_STUFF_FEATURE_MSRS (1 << 8)
444+
#define KVM_X86_QUIRK_IGNORE_GUEST_PAT (1 << 9)
444445

445446
#define KVM_STATE_NESTED_FORMAT_VMX 0
446447
#define KVM_STATE_NESTED_FORMAT_SVM 1
@@ -931,4 +932,74 @@ struct kvm_hyperv_eventfd {
931932
#define KVM_X86_SNP_VM 4
932933
#define KVM_X86_TDX_VM 5
933934

935+
/* Trust Domain eXtension sub-ioctl() commands. */
936+
enum kvm_tdx_cmd_id {
937+
KVM_TDX_CAPABILITIES = 0,
938+
KVM_TDX_INIT_VM,
939+
KVM_TDX_INIT_VCPU,
940+
KVM_TDX_INIT_MEM_REGION,
941+
KVM_TDX_FINALIZE_VM,
942+
KVM_TDX_GET_CPUID,
943+
944+
KVM_TDX_CMD_NR_MAX,
945+
};
946+
947+
struct kvm_tdx_cmd {
948+
/* enum kvm_tdx_cmd_id */
949+
__u32 id;
950+
/* flags for sub-commend. If sub-command doesn't use this, set zero. */
951+
__u32 flags;
952+
/*
953+
* data for each sub-command. An immediate or a pointer to the actual
954+
* data in process virtual address. If sub-command doesn't use it,
955+
* set zero.
956+
*/
957+
__u64 data;
958+
/*
959+
* Auxiliary error code. The sub-command may return TDX SEAMCALL
960+
* status code in addition to -Exxx.
961+
*/
962+
__u64 hw_error;
963+
};
964+
965+
struct kvm_tdx_capabilities {
966+
__u64 supported_attrs;
967+
__u64 supported_xfam;
968+
__u64 reserved[254];
969+
970+
/* Configurable CPUID bits for userspace */
971+
struct kvm_cpuid2 cpuid;
972+
};
973+
974+
struct kvm_tdx_init_vm {
975+
__u64 attributes;
976+
__u64 xfam;
977+
__u64 mrconfigid[6]; /* sha384 digest */
978+
__u64 mrowner[6]; /* sha384 digest */
979+
__u64 mrownerconfig[6]; /* sha384 digest */
980+
981+
/* The total space for TD_PARAMS before the CPUIDs is 256 bytes */
982+
__u64 reserved[12];
983+
984+
/*
985+
* Call KVM_TDX_INIT_VM before vcpu creation, thus before
986+
* KVM_SET_CPUID2.
987+
* This configuration supersedes KVM_SET_CPUID2s for VCPUs because the
988+
* TDX module directly virtualizes those CPUIDs without VMM. The user
989+
* space VMM, e.g. qemu, should make KVM_SET_CPUID2 consistent with
990+
* those values. If it doesn't, KVM may have wrong idea of vCPUIDs of
991+
* the guest, and KVM may wrongly emulate CPUIDs or MSRs that the TDX
992+
* module doesn't virtualize.
993+
*/
994+
struct kvm_cpuid2 cpuid;
995+
};
996+
997+
#define KVM_TDX_MEASURE_MEMORY_REGION _BITULL(0)
998+
999+
struct kvm_tdx_init_mem_region {
1000+
__u64 source_addr;
1001+
__u64 gpa;
1002+
__u64 nr_pages;
1003+
};
1004+
9341005
#endif /* _ASM_X86_KVM_H */

0 commit comments

Comments
 (0)