Skip to content

Commit 0726fd0

Browse files
author
Maxim Levitsky
committed
tools headers UAPI: Sync kvm header with the kernel sources
JIRA: https://issues.redhat.com/browse/RHEL-47242 commit 8fc50be Author: Arnaldo Carvalho de Melo <acme@redhat.com> Date: Thu Jun 12 11:31:41 2025 -0300 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 <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Isaku Yamahata <isaku.yamahata@intel.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Xiaoyao Li <xiaoyao.li@intel.com> Cc: Yan Zhao <yan.y.zhao@intel.com> Link: https://lore.kernel.org/r/aErqLPktXIzGyS-m@x1 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
1 parent e94caf0 commit 0726fd0

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
@@ -930,4 +931,74 @@ struct kvm_hyperv_eventfd {
930931
#define KVM_X86_SNP_VM 4
931932
#define KVM_X86_TDX_VM 5
932933

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

0 commit comments

Comments
 (0)