On 07.04.2022 10:28, Roger Pau Monné wrote:
> On Fri, Apr 01, 2022 at 11:47:12AM +0100, Jane Malalane wrote:
>> --- a/xen/arch/x86/hvm/vmx/vmcs.c
>> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
>> @@ -2145,6 +2145,12 @@ int __init vmx_vmcs_init(void)
>>  
>>      ret = _vmx_cpu_up(true);
>>  
>> +    /* Check whether hardware supports accelerated xapic and x2apic. */
>> +    assisted_xapic_available = cpu_has_vmx_virtualize_apic_accesses;
>> +    assisted_x2apic_available = cpu_has_vmx_virtualize_x2apic_mode &&
>> +                                (cpu_has_vmx_apic_reg_virt ||
>> +                                 cpu_has_vmx_virtual_intr_delivery);
> 
> Setting assisted_x{2}apic_available should only be done !ret, or else
> we might be reporting those capabilities when VMX is not usable, which
> would be misleading IMO.

Hmm, while I agree with the observation, wouldn't it be better if all
the feature masks were cleared in case of failure, such that other
code using the predicates wouldn't be mislead either? (That would
likely want to be a separate, prereq change.)

Jan


Reply via email to