On Tue, 2023-04-25 at 23:07 -0700, Sathyanarayanan Kuppuswamy wrote: > > > +/** > > > + * tdx_event_irq_init() - Register IRQ for event notification from the > > > VMM to > > > + * the TDX Guest. > > > + * > > > + * Use SetupEventNotifyInterrupt TDVMCALL to register the event > > > notification > > > + * IRQ with the VMM, which is used by the VMM to notify the TDX guest > > > when > > > + * needed, for instance, when VMM finishes the GetQuote request from the > > > TDX > > > + * guest. The VMM always notifies the TDX guest via the same CPU on which > > > the > > > + * SetupEventNotifyInterrupt TDVMCALL is called. For simplicity, just > > > allocate > > > + * an IRQ (and a vector) directly from x86_vector_domain for such > > > notification > > > + * and pin the IRQ to the same CPU on which TDVMCALL is called. > > > > I think "for simplicity" applies to allocate IRQ/vector "from BSP using > > early_initcall()" (so TDVMCALL is easily guaranteed to be called on the same > > cpu > > where vector is allocated), but doesn't apply to allocate IRQ/vector from > > x86_vector_domain and "pin the IRQ to the same CPU on which TDVMCALAL is > > called". The latter is something you must do (otherwise you need to > > allocate > > the same vector on all cpus), but not something that you do "for > > simplicity". > > > > > + * > > > + * Since tdx_event_irq_init() is triggered via early_initcall(), it will > > > be > > > + * called before secondary CPUs bring up, so no special logic is required > > > to > > > + * ensure that the same CPU is used for SetupEventNotifyInterrupt > > > TDVMCALL and > > > + * IRQ allocation. > > > > IMHO the second paragraph is obvious and no need to mention. > > > > As explained above, I guess you just need to at somewhere simply mention > > something like: "for simplicity use early_initcall() to allocate and pin the > > IRQ/vector on BSP and also call the TDVMCALL on BSP". Or probably "also > > call > > the TDVMCALL on BSP" can also be omitted as it's kinda already explained in > > the > > nature of the TDVMCALL. > > How about the following? > > Use SetupEventNotifyInterrupt TDVMCALL to register the event notification > IRQ with the VMM, which is used by the VMM to notify the TDX guest when > needed, for instance, when VMM finishes the GetQuote request from the TDX > guest. The VMM always notifies the TDX guest via the same CPU that calls the > SetupEventNotifyInterrupt TDVMCALL. Allocate an IRQ/vector from the > x86_vector_domain and pin it on the same CPU on which TDVMCALL is called. > For simplicity, use early_initcall() to allow both IRQ allocation and > TDVMCALL to use BSP. Sorry I missed your reply. OK to me.