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

Configure Feed

Select the types of activity you want to include in your feed.

KVM: TDX: Exit to userspace for SetupEventNotifyInterrupt

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+35
+7
Documentation/virt/kvm/api.rst
··· 7196 7196 u64 leaf; 7197 7197 u64 r11, r12, r13, r14; 7198 7198 } get_tdvmcall_info; 7199 + struct { 7200 + u64 ret; 7201 + u64 vector; 7202 + } setup_event_notify; 7199 7203 }; 7200 7204 } tdx; 7201 7205 ··· 7229 7225 status of TDVMCALLs. The output values for the given leaf should be 7230 7226 placed in fields from ``r11`` to ``r14`` of the ``get_tdvmcall_info`` 7231 7227 field of the union. 7228 + 7229 + * ``TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT``: the guest has requested to 7230 + set up a notification interrupt for vector ``vector``. 7232 7231 7233 7232 KVM may add support for more values in the future that may cause a userspace 7234 7233 exit, even without calls to ``KVM_ENABLE_CAP`` or similar. In this case,
+1
arch/x86/include/asm/shared/tdx.h
··· 72 72 #define TDVMCALL_MAP_GPA 0x10001 73 73 #define TDVMCALL_GET_QUOTE 0x10002 74 74 #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 75 + #define TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT 0x10004ULL 75 76 76 77 /* 77 78 * TDG.VP.VMCALL Status Codes (returned in R10)
+23
arch/x86/kvm/vmx/tdx.c
··· 1530 1530 return 0; 1531 1531 } 1532 1532 1533 + static int tdx_setup_event_notify_interrupt(struct kvm_vcpu *vcpu) 1534 + { 1535 + struct vcpu_tdx *tdx = to_tdx(vcpu); 1536 + u64 vector = tdx->vp_enter_args.r12; 1537 + 1538 + if (vector < 32 || vector > 255) { 1539 + tdvmcall_set_return_code(vcpu, TDVMCALL_STATUS_INVALID_OPERAND); 1540 + return 1; 1541 + } 1542 + 1543 + vcpu->run->exit_reason = KVM_EXIT_TDX; 1544 + vcpu->run->tdx.flags = 0; 1545 + vcpu->run->tdx.nr = TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT; 1546 + vcpu->run->tdx.setup_event_notify.ret = TDVMCALL_STATUS_SUBFUNC_UNSUPPORTED; 1547 + vcpu->run->tdx.setup_event_notify.vector = vector; 1548 + 1549 + vcpu->arch.complete_userspace_io = tdx_complete_simple; 1550 + 1551 + return 0; 1552 + } 1553 + 1533 1554 static int handle_tdvmcall(struct kvm_vcpu *vcpu) 1534 1555 { 1535 1556 switch (tdvmcall_leaf(vcpu)) { ··· 1562 1541 return tdx_get_td_vm_call_info(vcpu); 1563 1542 case TDVMCALL_GET_QUOTE: 1564 1543 return tdx_get_quote(vcpu); 1544 + case TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT: 1545 + return tdx_setup_event_notify_interrupt(vcpu); 1565 1546 default: 1566 1547 break; 1567 1548 }
+4
include/uapi/linux/kvm.h
··· 467 467 __u64 leaf; 468 468 __u64 r11, r12, r13, r14; 469 469 } get_tdvmcall_info; 470 + struct { 471 + __u64 ret; 472 + __u64 vector; 473 + } setup_event_notify; 470 474 }; 471 475 } tdx; 472 476 /* Fix the size of the union. */