[PATCH v6 36/60] i386/tdx: Force exposing CPUID 0x1f

Xiaoyao Li posted 60 patches 1 year, 3 months ago
There is a newer version of this series
[PATCH v6 36/60] i386/tdx: Force exposing CPUID 0x1f
Posted by Xiaoyao Li 1 year, 3 months ago
TDX uses CPUID 0x1f to configure TD guest's CPU topology. So set
enable_cpuid_0x1f for TDs.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 target/i386/kvm/tdx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 289722a129ce..19ce90df4143 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -388,7 +388,11 @@ static int tdx_kvm_type(X86ConfidentialGuest *cg)
 
 static void tdx_cpu_instance_init(X86ConfidentialGuest *cg, CPUState *cpu)
 {
+    X86CPU *x86cpu = X86_CPU(cpu);
+
     object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort);
+
+    x86cpu->enable_cpuid_0x1f = true;
 }
 
 static void tdx_cpu_realizefn(X86ConfidentialGuest *cg, CPUState *cs,
-- 
2.34.1
Re: [PATCH v6 36/60] i386/tdx: Force exposing CPUID 0x1f
Posted by Ira Weiny 1 year, 1 month ago
On Tue, Nov 05, 2024 at 01:23:44AM -0500, Xiaoyao Li wrote:
> TDX uses CPUID 0x1f to configure TD guest's CPU topology. So set
> enable_cpuid_0x1f for TDs.

If you squashed this into patch 35 I think it might make more sense overall
after some commit message clean ups.

Ira

> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  target/i386/kvm/tdx.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
> index 289722a129ce..19ce90df4143 100644
> --- a/target/i386/kvm/tdx.c
> +++ b/target/i386/kvm/tdx.c
> @@ -388,7 +388,11 @@ static int tdx_kvm_type(X86ConfidentialGuest *cg)
>  
>  static void tdx_cpu_instance_init(X86ConfidentialGuest *cg, CPUState *cpu)
>  {
> +    X86CPU *x86cpu = X86_CPU(cpu);
> +
>      object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort);
> +
> +    x86cpu->enable_cpuid_0x1f = true;
>  }
>  
>  static void tdx_cpu_realizefn(X86ConfidentialGuest *cg, CPUState *cs,
> -- 
> 2.34.1
>
Re: [PATCH v6 36/60] i386/tdx: Force exposing CPUID 0x1f
Posted by Xiaoyao Li 1 year ago
On 12/13/2024 6:17 AM, Ira Weiny wrote:
> On Tue, Nov 05, 2024 at 01:23:44AM -0500, Xiaoyao Li wrote:
>> TDX uses CPUID 0x1f to configure TD guest's CPU topology. So set
>> enable_cpuid_0x1f for TDs.
> 
> If you squashed this into patch 35 I think it might make more sense overall
> after some commit message clean ups.

I see it as patch 35 introduces the interface, and this patch uses it. 
I'm neutral. Squash is simple, I would leave it to Paolo to make the 
final decision.

> Ira
> 
>>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
>>   target/i386/kvm/tdx.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
>> index 289722a129ce..19ce90df4143 100644
>> --- a/target/i386/kvm/tdx.c
>> +++ b/target/i386/kvm/tdx.c
>> @@ -388,7 +388,11 @@ static int tdx_kvm_type(X86ConfidentialGuest *cg)
>>   
>>   static void tdx_cpu_instance_init(X86ConfidentialGuest *cg, CPUState *cpu)
>>   {
>> +    X86CPU *x86cpu = X86_CPU(cpu);
>> +
>>       object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort);
>> +
>> +    x86cpu->enable_cpuid_0x1f = true;
>>   }
>>   
>>   static void tdx_cpu_realizefn(X86ConfidentialGuest *cg, CPUState *cs,
>> -- 
>> 2.34.1
>>