linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: TDX: Don't report base TDVMCALLs
@ 2025-07-17  2:20 Xiaoyao Li
  2025-07-17  2:45 ` Binbin Wu
  2025-07-17 12:25 ` Vishal Annapurve
  0 siblings, 2 replies; 6+ messages in thread
From: Xiaoyao Li @ 2025-07-17  2:20 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Rick Edgecombe
  Cc: kvm, linux-kernel, xiaoyao.li

Remove TDVMCALLINFO_GET_QUOTE from user_tdvmcallinfo_1_r11 reported to
userspace to align with the direction of the GHCI spec.

Recently, concern was raised about a gap in the GHCI spec that left
ambiguity in how to expose to the guest that only a subset of GHCI
TDVMCalls were supported. During the back and forth on the spec details[0],
<GetQuote> was moved from an individually enumerable TDVMCall, to one that
is part of the 'base spec', meaning it doesn't have a specific bit in the
<GetTDVMCallInfo> return values. Although the spec[1] is still in draft
form, the GetQoute part has been agreed by the major TDX VMMs.

Unfortunately the commits that were upstreamed still treat <GetQuote> as
individually enumerable. They set bit 0 in the user_tdvmcallinfo_1_r11
which is reported to userspace to tell supported optional TDVMCalls,
intending to say that <GetQuote> is supported.

So stop reporting <GetQute> in user_tdvmcallinfo_1_r11 to align with
the direction of the spec, and allow some future TDVMCall to use that bit.

[0] https://lore.kernel.org/all/aEmuKII8FGU4eQZz@google.com/
[1] https://cdrdv2.intel.com/v1/dl/getContent/858626

Fixes: 28224ef02b56 ("KVM: TDX: Report supported optional TDVMCALLs in TDX capabilities")
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 arch/x86/kvm/vmx/tdx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index f31ccdeb905b..ea1261ca805f 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -173,7 +173,6 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
 	tdx_clear_unsupported_cpuid(entry);
 }
 
-#define TDVMCALLINFO_GET_QUOTE				BIT(0)
 #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT	BIT(1)
 
 static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
@@ -192,7 +191,6 @@ static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
 	caps->cpuid.nent = td_conf->num_cpuid_config;
 
 	caps->user_tdvmcallinfo_1_r11 =
-		TDVMCALLINFO_GET_QUOTE |
 		TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT;
 
 	for (i = 0; i < td_conf->num_cpuid_config; i++)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: TDX: Don't report base TDVMCALLs
  2025-07-17  2:20 [PATCH] KVM: TDX: Don't report base TDVMCALLs Xiaoyao Li
@ 2025-07-17  2:45 ` Binbin Wu
  2025-07-17  3:14   ` Xiaoyao Li
  2025-07-17 12:25 ` Vishal Annapurve
  1 sibling, 1 reply; 6+ messages in thread
From: Binbin Wu @ 2025-07-17  2:45 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: Paolo Bonzini, Sean Christopherson, Rick Edgecombe, kvm,
	linux-kernel



On 7/17/2025 10:20 AM, Xiaoyao Li wrote:
> Remove TDVMCALLINFO_GET_QUOTE from user_tdvmcallinfo_1_r11 reported to
> userspace to align with the direction of the GHCI spec.
>
> Recently, concern was raised about a gap in the GHCI spec that left
> ambiguity in how to expose to the guest that only a subset of GHCI
> TDVMCalls were supported. During the back and forth on the spec details[0],
> <GetQuote> was moved from an individually enumerable TDVMCall, to one that
> is part of the 'base spec', meaning it doesn't have a specific bit in the

'GHCI base API' is more appropriate instead of 'base spec'

> <GetTDVMCallInfo> return values. Although the spec[1] is still in draft
> form, the GetQoute part has been agreed by the major TDX VMMs.
GetQoute  ->  <GetQuote>

typo and use <> to align with others.

>
> Unfortunately the commits that were upstreamed still treat <GetQuote> as
> individually enumerable. They set bit 0 in the user_tdvmcallinfo_1_r11
> which is reported to userspace to tell supported optional TDVMCalls,
> intending to say that <GetQuote> is supported.
>
> So stop reporting <GetQute> in user_tdvmcallinfo_1_r11 to align with

GetQute -> GetQuote

> the direction of the spec, and allow some future TDVMCall to use that bit.
>
> [0] https://lore.kernel.org/all/aEmuKII8FGU4eQZz@google.com/
> [1] https://cdrdv2.intel.com/v1/dl/getContent/858626
>
> Fixes: 28224ef02b56 ("KVM: TDX: Report supported optional TDVMCALLs in TDX capabilities")
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>

Nits: typos and wording suggested above.

Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>

> ---
>   arch/x86/kvm/vmx/tdx.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index f31ccdeb905b..ea1261ca805f 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -173,7 +173,6 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
>   	tdx_clear_unsupported_cpuid(entry);
>   }
>   
> -#define TDVMCALLINFO_GET_QUOTE				BIT(0)
>   #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT	BIT(1)
>   
>   static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
> @@ -192,7 +191,6 @@ static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
>   	caps->cpuid.nent = td_conf->num_cpuid_config;
>   
>   	caps->user_tdvmcallinfo_1_r11 =
> -		TDVMCALLINFO_GET_QUOTE |
>   		TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT;
>   
>   	for (i = 0; i < td_conf->num_cpuid_config; i++)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: TDX: Don't report base TDVMCALLs
  2025-07-17  2:45 ` Binbin Wu
@ 2025-07-17  3:14   ` Xiaoyao Li
  0 siblings, 0 replies; 6+ messages in thread
From: Xiaoyao Li @ 2025-07-17  3:14 UTC (permalink / raw)
  To: Binbin Wu
  Cc: Paolo Bonzini, Sean Christopherson, Rick Edgecombe, kvm,
	linux-kernel

On 7/17/2025 10:45 AM, Binbin Wu wrote:
> 
> 
> On 7/17/2025 10:20 AM, Xiaoyao Li wrote:
>> Remove TDVMCALLINFO_GET_QUOTE from user_tdvmcallinfo_1_r11 reported to
>> userspace to align with the direction of the GHCI spec.
>>
>> Recently, concern was raised about a gap in the GHCI spec that left
>> ambiguity in how to expose to the guest that only a subset of GHCI
>> TDVMCalls were supported. During the back and forth on the spec 
>> details[0],
>> <GetQuote> was moved from an individually enumerable TDVMCall, to one 
>> that
>> is part of the 'base spec', meaning it doesn't have a specific bit in the
> 
> 'GHCI base API' is more appropriate instead of 'base spec'
> 
>> <GetTDVMCallInfo> return values. Although the spec[1] is still in draft
>> form, the GetQoute part has been agreed by the major TDX VMMs.
> GetQoute  ->  <GetQuote>
> 
> typo and use <> to align with others.
> 
>>
>> Unfortunately the commits that were upstreamed still treat <GetQuote> as
>> individually enumerable. They set bit 0 in the user_tdvmcallinfo_1_r11
>> which is reported to userspace to tell supported optional TDVMCalls,
>> intending to say that <GetQuote> is supported.
>>
>> So stop reporting <GetQute> in user_tdvmcallinfo_1_r11 to align with
> 
> GetQute -> GetQuote
> 
>> the direction of the spec, and allow some future TDVMCall to use that 
>> bit.
>>
>> [0] https://lore.kernel.org/all/aEmuKII8FGU4eQZz@google.com/
>> [1] https://cdrdv2.intel.com/v1/dl/getContent/858626
>>
>> Fixes: 28224ef02b56 ("KVM: TDX: Report supported optional TDVMCALLs in 
>> TDX capabilities")
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> 
> Nits: typos and wording suggested above.

thanks for catching them!

I would like to leave them to Paolo to fix when he applies the patch 
instead of spinning a v2.

> Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
> 
>> ---
>>   arch/x86/kvm/vmx/tdx.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>> index f31ccdeb905b..ea1261ca805f 100644
>> --- a/arch/x86/kvm/vmx/tdx.c
>> +++ b/arch/x86/kvm/vmx/tdx.c
>> @@ -173,7 +173,6 @@ static void td_init_cpuid_entry2(struct 
>> kvm_cpuid_entry2 *entry, unsigned char i
>>       tdx_clear_unsupported_cpuid(entry);
>>   }
>> -#define TDVMCALLINFO_GET_QUOTE                BIT(0)
>>   #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT    BIT(1)
>>   static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf 
>> *td_conf,
>> @@ -192,7 +191,6 @@ static int init_kvm_tdx_caps(const struct 
>> tdx_sys_info_td_conf *td_conf,
>>       caps->cpuid.nent = td_conf->num_cpuid_config;
>>       caps->user_tdvmcallinfo_1_r11 =
>> -        TDVMCALLINFO_GET_QUOTE |
>>           TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT;
>>       for (i = 0; i < td_conf->num_cpuid_config; i++)
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: TDX: Don't report base TDVMCALLs
  2025-07-17  2:20 [PATCH] KVM: TDX: Don't report base TDVMCALLs Xiaoyao Li
  2025-07-17  2:45 ` Binbin Wu
@ 2025-07-17 12:25 ` Vishal Annapurve
  2025-07-17 15:24   ` Edgecombe, Rick P
  1 sibling, 1 reply; 6+ messages in thread
From: Vishal Annapurve @ 2025-07-17 12:25 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: Paolo Bonzini, Sean Christopherson, Rick Edgecombe, kvm,
	linux-kernel

On Wed, Jul 16, 2025 at 7:28 PM Xiaoyao Li <xiaoyao.li@intel.com> wrote:
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index f31ccdeb905b..ea1261ca805f 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -173,7 +173,6 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
>         tdx_clear_unsupported_cpuid(entry);
>  }
>
> -#define TDVMCALLINFO_GET_QUOTE                         BIT(0)
>  #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT      BIT(1)

I am struggling to find the patch that adds support for
TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT. Can you help point out the
series that adds this support?

Thanks,
Vishal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: TDX: Don't report base TDVMCALLs
  2025-07-17 12:25 ` Vishal Annapurve
@ 2025-07-17 15:24   ` Edgecombe, Rick P
  2025-07-17 15:33     ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Edgecombe, Rick P @ 2025-07-17 15:24 UTC (permalink / raw)
  To: Li, Xiaoyao, Annapurve, Vishal
  Cc: kvm@vger.kernel.org, pbonzini@redhat.com, seanjc@google.com,
	linux-kernel@vger.kernel.org

On Thu, 2025-07-17 at 05:25 -0700, Vishal Annapurve wrote:
> On Wed, Jul 16, 2025 at 7:28 PM Xiaoyao Li <xiaoyao.li@intel.com> wrote:
> > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > index f31ccdeb905b..ea1261ca805f 100644
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> > @@ -173,7 +173,6 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
> >          tdx_clear_unsupported_cpuid(entry);
> >   }
> > 
> > -#define TDVMCALLINFO_GET_QUOTE                         BIT(0)
> >   #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT      BIT(1)
> 
> I am struggling to find the patch that adds support for
> TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT. Can you help point out the
> series that adds this support?

This was the last version of the series posted:
https://lore.kernel.org/kvm/20250619180159.187358-1-pbonzini@redhat.com/#t

But it didn't have those changes. They got added before it was sent upstream.
Possibly in response to this discussion, but I'm not sure:
https://lore.kernel.org/kvm/e6fedf41180a98068c0b410b628f14cb85cad93f.camel@intel.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] KVM: TDX: Don't report base TDVMCALLs
  2025-07-17 15:24   ` Edgecombe, Rick P
@ 2025-07-17 15:33     ` Paolo Bonzini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2025-07-17 15:33 UTC (permalink / raw)
  To: Edgecombe, Rick P, Li, Xiaoyao, Annapurve, Vishal
  Cc: kvm@vger.kernel.org, seanjc@google.com,
	linux-kernel@vger.kernel.org

On 7/17/25 17:24, Edgecombe, Rick P wrote:
> On Thu, 2025-07-17 at 05:25 -0700, Vishal Annapurve wrote:
>> On Wed, Jul 16, 2025 at 7:28 PM Xiaoyao Li <xiaoyao.li@intel.com> wrote:
>>> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>>> index f31ccdeb905b..ea1261ca805f 100644
>>> --- a/arch/x86/kvm/vmx/tdx.c
>>> +++ b/arch/x86/kvm/vmx/tdx.c
>>> @@ -173,7 +173,6 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
>>>           tdx_clear_unsupported_cpuid(entry);
>>>    }
>>>
>>> -#define TDVMCALLINFO_GET_QUOTE                         BIT(0)
>>>    #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT      BIT(1)
>>
>> I am struggling to find the patch that adds support for
>> TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT. Can you help point out the
>> series that adds this support?
> 
> This was the last version of the series posted:
> https://lore.kernel.org/kvm/20250619180159.187358-1-pbonzini@redhat.com/#t

Yep, I didn't send the patches for SetupEventNotifyInterrupt to the KVM 
mailing list.

I hadn't even noticed until now that I hadn't sent them because, when I 
came back from vacation, I found the matching QEMU patches in my inbox. 
So when git reported them to be in the next pull request I didn't think 
of double checking.  Of course the blame is mine---thanks Xiaoyao for 
writing the QEMU side.

They are:
- commit 28224ef02b56fceee2c161fe2a49a0bb197e44f5
   KVM: TDX: Report supported optional TDVMCALLs in TDX capabilities

- commit 4580dbef5ce0f95a4bd8ac2d007bc4fbf1539332
   KVM: TDX: Exit to userspace for SetupEventNotifyInterrupt

Sorry about that.

Paolo


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-17 15:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17  2:20 [PATCH] KVM: TDX: Don't report base TDVMCALLs Xiaoyao Li
2025-07-17  2:45 ` Binbin Wu
2025-07-17  3:14   ` Xiaoyao Li
2025-07-17 12:25 ` Vishal Annapurve
2025-07-17 15:24   ` Edgecombe, Rick P
2025-07-17 15:33     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).