Commit 8fc50bec authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

tools headers UAPI: Sync kvm header with the kernel sources

To pick the changes in:

  c9c1e20b ("KVM: x86: Introduce Intel specific quirk KVM_X86_QUIRK_IGNORE_GUEST_PAT")
  012426d6 ("KVM: TDX: Finalize VM initialization")
  c846b451 ("KVM: TDX: Add an ioctl to create initial guest memory")
  488808e6 ("KVM: x86: Introduce KVM_TDX_GET_CPUID")
  a50f673f ("KVM: TDX: Do TDX specific vcpu initialization")
  0186dd29 ("KVM: TDX: add ioctl to initialize VM with TDX specific parameters")
  61bb2827 ("KVM: TDX: Get system-wide info about TDX module on initialization")
  b2aaf38c ("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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent da845e4b
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
@@ -441,6 +441,7 @@ struct kvm_sync_regs {
#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS	(1 << 6)
#define KVM_X86_QUIRK_SLOT_ZAP_ALL		(1 << 7)
#define KVM_X86_QUIRK_STUFF_FEATURE_MSRS	(1 << 8)
#define KVM_X86_QUIRK_IGNORE_GUEST_PAT		(1 << 9)

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

/* Trust Domain eXtension sub-ioctl() commands. */
enum kvm_tdx_cmd_id {
	KVM_TDX_CAPABILITIES = 0,
	KVM_TDX_INIT_VM,
	KVM_TDX_INIT_VCPU,
	KVM_TDX_INIT_MEM_REGION,
	KVM_TDX_FINALIZE_VM,
	KVM_TDX_GET_CPUID,

	KVM_TDX_CMD_NR_MAX,
};

struct kvm_tdx_cmd {
	/* enum kvm_tdx_cmd_id */
	__u32 id;
	/* flags for sub-commend. If sub-command doesn't use this, set zero. */
	__u32 flags;
	/*
	 * data for each sub-command. An immediate or a pointer to the actual
	 * data in process virtual address.  If sub-command doesn't use it,
	 * set zero.
	 */
	__u64 data;
	/*
	 * Auxiliary error code.  The sub-command may return TDX SEAMCALL
	 * status code in addition to -Exxx.
	 */
	__u64 hw_error;
};

struct kvm_tdx_capabilities {
	__u64 supported_attrs;
	__u64 supported_xfam;
	__u64 reserved[254];

	/* Configurable CPUID bits for userspace */
	struct kvm_cpuid2 cpuid;
};

struct kvm_tdx_init_vm {
	__u64 attributes;
	__u64 xfam;
	__u64 mrconfigid[6];	/* sha384 digest */
	__u64 mrowner[6];	/* sha384 digest */
	__u64 mrownerconfig[6];	/* sha384 digest */

	/* The total space for TD_PARAMS before the CPUIDs is 256 bytes */
	__u64 reserved[12];

	/*
	 * Call KVM_TDX_INIT_VM before vcpu creation, thus before
	 * KVM_SET_CPUID2.
	 * This configuration supersedes KVM_SET_CPUID2s for VCPUs because the
	 * TDX module directly virtualizes those CPUIDs without VMM.  The user
	 * space VMM, e.g. qemu, should make KVM_SET_CPUID2 consistent with
	 * those values.  If it doesn't, KVM may have wrong idea of vCPUIDs of
	 * the guest, and KVM may wrongly emulate CPUIDs or MSRs that the TDX
	 * module doesn't virtualize.
	 */
	struct kvm_cpuid2 cpuid;
};

#define KVM_TDX_MEASURE_MEMORY_REGION   _BITULL(0)

struct kvm_tdx_init_mem_region {
	__u64 source_addr;
	__u64 gpa;
	__u64 nr_pages;
};

#endif /* _ASM_X86_KVM_H */