On Fri, Apr 01, 2022 at 11:47:12AM +0100, Jane Malalane wrote:
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 709a4191ef..e5dde9f8ce 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -117,6 +117,9 @@ static const char __initconst warning_hvm_fep[] =
>  static bool_t __initdata opt_altp2m_enabled = 0;
>  boolean_param("altp2m", opt_altp2m_enabled);
>  
> +bool __ro_after_init assisted_xapic_available;
> +bool __ro_after_init assisted_x2apic_available;
> +
>  static int cf_check cpu_callback(
>      struct notifier_block *nfb, unsigned long action, void *hcpu)
>  {
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index 56fed2db03..53d97eaf13 100644
> --- 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.

The rest LGTM, so with this taken care of:

Reviewed-by: Roger Pau Monné <roger....@citrix.com>

Thanks, Roger.

Reply via email to