mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-16 01:19:32 -07:00
i386/tdx: handle TDG.VP.VMCALL<GetTdVmCallInfo>
Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
688b0756ad
commit
427b8cf47a
4 changed files with 37 additions and 0 deletions
|
|
@ -6170,6 +6170,18 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case KVM_EXIT_TDX:
|
||||
/*
|
||||
* run->tdx is already set up for the case where userspace
|
||||
* does not handle the TDVMCALL.
|
||||
*/
|
||||
switch (run->tdx.nr) {
|
||||
case TDVMCALL_GET_TD_VM_CALL_INFO:
|
||||
tdx_handle_get_tdvmcall_info(cpu, run);
|
||||
break;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
|
||||
ret = -1;
|
||||
|
|
|
|||
|
|
@ -18,3 +18,7 @@ int tdx_handle_report_fatal_error(X86CPU *cpu, struct kvm_run *run)
|
|||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void tdx_handle_get_tdvmcall_info(X86CPU *cpu, struct kvm_run *run)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1120,6 +1120,18 @@ int tdx_parse_tdvf(void *flash_ptr, int size)
|
|||
return tdvf_parse_metadata(&tdx_guest->tdvf, flash_ptr, size);
|
||||
}
|
||||
|
||||
void tdx_handle_get_tdvmcall_info(X86CPU *cpu, struct kvm_run *run)
|
||||
{
|
||||
if (run->tdx.get_tdvmcall_info.leaf != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
run->tdx.get_tdvmcall_info.r11 = 0;
|
||||
run->tdx.get_tdvmcall_info.r12 = 0;
|
||||
run->tdx.get_tdvmcall_info.r13 = 0;
|
||||
run->tdx.get_tdvmcall_info.r14 = 0;
|
||||
}
|
||||
|
||||
static void tdx_panicked_on_fatal_error(X86CPU *cpu, uint64_t error_code,
|
||||
char *message, uint64_t gpa)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ typedef struct TdxGuestClass {
|
|||
/* TDX requires bus frequency 25MHz */
|
||||
#define TDX_APIC_BUS_CYCLES_NS 40
|
||||
|
||||
#define TDVMCALL_GET_TD_VM_CALL_INFO 0x10000
|
||||
|
||||
#define TDG_VP_VMCALL_SUCCESS 0x0000000000000000ULL
|
||||
#define TDG_VP_VMCALL_RETRY 0x0000000000000001ULL
|
||||
#define TDG_VP_VMCALL_INVALID_OPERAND 0x8000000000000000ULL
|
||||
#define TDG_VP_VMCALL_GPA_INUSE 0x8000000000000001ULL
|
||||
#define TDG_VP_VMCALL_ALIGN_ERROR 0x8000000000000002ULL
|
||||
|
||||
enum TdxRamType {
|
||||
TDX_RAM_UNACCEPTED,
|
||||
TDX_RAM_ADDED,
|
||||
|
|
@ -61,5 +69,6 @@ int tdx_pre_create_vcpu(CPUState *cpu, Error **errp);
|
|||
void tdx_set_tdvf_region(MemoryRegion *tdvf_mr);
|
||||
int tdx_parse_tdvf(void *flash_ptr, int size);
|
||||
int tdx_handle_report_fatal_error(X86CPU *cpu, struct kvm_run *run);
|
||||
void tdx_handle_get_tdvmcall_info(X86CPU *cpu, struct kvm_run *run);
|
||||
|
||||
#endif /* QEMU_I386_TDX_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue