File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -7184,6 +7184,10 @@ The valid value for 'flags' is:
71847184 u64 leaf;
71857185 u64 r11, r12, r13, r14;
71867186 } get_tdvmcall_info;
7187+ struct {
7188+ u64 ret;
7189+ u64 vector;
7190+ } setup_event_notify;
71877191 };
71887192 } tdx;
71897193
@@ -7214,6 +7218,9 @@ status of TDVMCALLs. The output values for the given leaf should be
72147218placed in fields from ``r11 `` to ``r14 `` of the ``get_tdvmcall_info ``
72157219field of the union.
72167220
7221+ * ``TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT ``: the guest has requested to
7222+ set up a notification interrupt for vector ``vector ``.
7223+
72177224KVM may add support for more values in the future that may cause a userspace
72187225exit, even without calls to ``KVM_ENABLE_CAP `` or similar. In this case,
72197226it will enter with output fields already valid; in the common case, the
Original file line number Diff line number Diff line change 3737#define TDVMCALL_MAP_GPA 0x10001
3838#define TDVMCALL_GET_QUOTE 0x10002
3939#define TDVMCALL_REPORT_FATAL_ERROR 0x10003
40+ #define TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT 0x10004ULL
4041
4142/*
4243 * TDG.VP.VMCALL Status Codes (returned in R10)
Original file line number Diff line number Diff line change @@ -1530,6 +1530,27 @@ static int tdx_get_quote(struct kvm_vcpu *vcpu)
15301530 return 0 ;
15311531}
15321532
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+
15331554static int handle_tdvmcall (struct kvm_vcpu * vcpu )
15341555{
15351556 switch (tdvmcall_leaf (vcpu )) {
@@ -1541,6 +1562,8 @@ static int handle_tdvmcall(struct kvm_vcpu *vcpu)
15411562 return tdx_get_td_vm_call_info (vcpu );
15421563 case TDVMCALL_GET_QUOTE :
15431564 return tdx_get_quote (vcpu );
1565+ case TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT :
1566+ return tdx_setup_event_notify_interrupt (vcpu );
15441567 default :
15451568 break ;
15461569 }
Original file line number Diff line number Diff line change @@ -467,6 +467,10 @@ struct kvm_run {
467467 __u64 leaf ;
468468 __u64 r11 , r12 , r13 , r14 ;
469469 } get_tdvmcall_info ;
470+ struct {
471+ __u64 ret ;
472+ __u64 vector ;
473+ } setup_event_notify ;
470474 };
471475 } tdx ;
472476 /* Fix the size of the union. */
You can’t perform that action at this time.
0 commit comments