Re: [PATCH v4 2/3] x86/tdx: Add TDX Guest event notify interrupt support

Sathyanarayanan Kuppuswamy
2022-04-28T17:57:36Z

On 4/28/22 10:50 AM, Wander Lairson Costa wrote:
> On Fri, Apr 22, 2022 at 04:34:17PM -0700, Kuppuswamy Sathyanarayanan wrote:
>
> [snip]
>
>>
>> +/*
>> + * tdx_hcall_set_notify_intr() - Setup Event Notify Interrupt Vector.
>> + *
>> + * @vector : Vector address to be used for notification.
>> + *
>> + * return 0 on success or failure error number.
>> + */
>> +static long tdx_hcall_set_notify_intr(u8 vector)
>> +{
>> + u64 ret;
>> +
>> + /* Minimum vector value allowed is 32 */
>> + if (vector < 32)
>> + return -EINVAL;
>> +
>> + /*
>> + * Register callback vector address with VMM. More details
>> + * about the ABI can be found in TDX Guest-Host-Communication
>> + * Interface (GHCI), sec titled
>> + * "TDG.VP.VMCALL<SetupEventNotifyInterrupt>".
>> + */
>> + ret = _tdx_hypercall(TDVMCALL_SETUP_NOTIFY_INTR, vector, 0, 0, 0);
>> +
>> + if (ret)
>> + return ret;
>> +
>> + return 0;
>
> Just "return _tdx_hypercall(TDVMCALL_SETUP_NOTIFY_INTR, vector, 0, 0, 0);" does the job, doesn't it?
> And we can remove the declaration of ret.

Makes sense. I will remove it.

>
> [snip]
>
>>
>> +#ifdef CONFIG_INTEL_TDX_GUEST
>
> Just for consistency, can we change to "#if IS_ENABLED(CONFIG_INTEL_TDX_GUEST)"?

Ok. I will change it in next version.

>
>> +DECLARE_IDTENTRY_SYSVEC(TDX_GUEST_EVENT_NOTIFY_VECTOR, sysvec_tdx_event_notify);
>> +#endif
>> +
>
> [snip]
>

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer