[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v1 16/20] x86: Allow LAPIC-only emulation_flags for HVM guests



>>> On 05.07.16 at 21:05, <boris.ostrovsky@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -545,25 +545,31 @@ int arch_domain_create(struct domain *d, unsigned int 
> domcr_flags,
>      }
>      else
>      {
> -        if ( (config->emulation_flags & ~XEN_X86_EMU_ALL) != 0 )
> +        uint32_t emflags;
> +
> +        if ( is_hardware_domain(d) )
> +            config->emulation_flags |= XEN_X86_EMU_PIT;
> +
> +        emflags = config->emulation_flags;
> +        if ( (emflags & ~XEN_X86_EMU_ALL) != 0 )

In cases like this please consider dropping the pointless != 0.

>          {
>              printk(XENLOG_G_ERR "d%d: Invalid emulation bitmap: %#x\n",
> -                   d->domain_id, config->emulation_flags);
> +                   d->domain_id, emflags);
>              return -EINVAL;
>          }
> -        if ( is_hardware_domain(d) )
> -            config->emulation_flags |= XEN_X86_EMU_PIT;
> -        if ( config->emulation_flags != 0 &&
> -             (config->emulation_flags !=
> -              (is_hvm_domain(d) ? XEN_X86_EMU_ALL : XEN_X86_EMU_PIT)) )
> +
> +        /* PVHv2 guests can request emulated APIC */

Comment style. With at least this one fixed
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> +        if ( emflags &&
> +            (is_hvm_domain(d) ? ((emflags != XEN_X86_EMU_ALL) &&
> +                                 (emflags != XEN_X86_EMU_LAPIC)) :
> +                                (emflags != XEN_X86_EMU_PIT)) )

I guess sooner or later this will need re-arranging so that it's easier
to maintain when more variations are permitted for HVM, but for
now I think it's fine.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.