On 08.02.2022 17:17, Roger Pau Monné wrote:
> On Mon, Feb 07, 2022 at 06:21:01PM +0000, Jane Malalane wrote:
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -1115,7 +1115,8 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, 
>> uint32_t leaf,
>>          if ( !is_hvm_domain(d) || subleaf != 0 )
>>              break;
>>  
>> -        if ( cpu_has_vmx_apic_reg_virt )
>> +        if ( cpu_has_vmx_apic_reg_virt &&
> 
> You can drop the cpu_has_vmx_apic_reg_virt check here, if
> cpu_has_vmx_apic_reg_virt is false assisted_xapic won't be set to true.

Along these lines ...

>> +             v->domain->arch.hvm.assisted_xapic )
>>              res->a |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
>>  
>>          /*
>> @@ -1124,9 +1125,8 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, 
>> uint32_t leaf,
>>           * and wrmsr in the guest will run without VMEXITs (see
>>           * vmx_vlapic_msr_changed()).
>>           */
>> -        if ( cpu_has_vmx_virtualize_x2apic_mode &&
>> -             cpu_has_vmx_apic_reg_virt &&
>> -             cpu_has_vmx_virtual_intr_delivery )
>> +        if ( (cpu_has_vmx_apic_reg_virt && 
>> cpu_has_vmx_virtual_intr_delivery) &&
>                 ^ unneeded parentheses

... this also wants simplifying to just v->domain->arch.hvm.assisted_x2apic:
The apparently stray parentheses were, I think, added in reply to me pointing
out that the check here isn't in line with that put in place by patch 1 in
vmx_init_vmcs_config(). I.e. the inner && really was meant to be || as it
looks. Yet once the two are in line, the same simplification as above is
possible.

Jan


Reply via email to