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

Re: [Xen-devel] [PATCH v6 11/29] xen/x86: add bitmap of enabled emulated devices



On Fri, Sep 04, 2015 at 02:08:50PM +0200, Roger Pau Monne wrote:
> Introduce a bitmap in x86 xen_arch_domainconfig that allows enabling or
> disabling specific devices emulated inside of Xen for HVM guests.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> Changes since v4:
>  - Add a check to make sure the emulation bitmap is sane (undefined bits are
>    all 0s).
>  - Add Andrew Cooper Reviewed-by.
> 
> Changes since v3:
>  - Return EOPNOTSUPP instead of ENOPERM if an invalid emulation mask is
>    used.
>  - Fix error messages (prefix them with d%d and use %#x instead of 0x%x).
>  - Clearly state in the public header that emulation_flags should only be
>    used with HVM guests.
>  - Add a XEN_X86 prefix to the emulation flags defines.
>  - Properly parenthese the has_* marcos.
> ---
>  tools/libxl/libxl_x86.c           |  8 ++++++--
>  xen/arch/x86/domain.c             | 23 +++++++++++++++++++++++
>  xen/include/asm-x86/domain.h      | 13 +++++++++++++
>  xen/include/public/arch-x86/xen.h | 21 ++++++++++++++++++++-
>  4 files changed, 62 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
> index 9276126..9ecd85d 100644
> --- a/tools/libxl/libxl_x86.c
> +++ b/tools/libxl/libxl_x86.c
> @@ -7,8 +7,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>                                        libxl_domain_config *d_config,
>                                        xc_domain_configuration_t *xc_config)
>  {
> -    /* No specific configuration right now */
> -
> +    if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM)
> +        xc_config->emulation_flags = (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET |
> +                                      XEN_X86_EMU_PMTIMER | XEN_X86_EMU_RTC |
> +                                      XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC |
> +                                      XEN_X86_EMU_PMU | XEN_X86_EMU_VGA |
> +                                      XEN_X86_EMU_IOMMU);
>      return 0;
>  }
>  
> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> index 045f6ff..fe9504f 100644
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -555,6 +555,29 @@ int arch_domain_create(struct domain *d, unsigned int 
> domcr_flags,
>                 d->domain_id);
>      }
>  
> +    if ( is_hvm_domain(d) )
> +    {
> +        uint32_t emulation_mask = (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET |
> +                                   XEN_X86_EMU_PMTIMER | XEN_X86_EMU_RTC |
> +                                   XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC |
> +                                   XEN_X86_EMU_PMU | XEN_X86_EMU_VGA |
> +                                   XEN_X86_EMU_IOMMU);

This is repetitive. Could you consolidate all these to

  #define XEN_X86_EMU_ALL ...

?

Or am I talking non-sense?

Wei.

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


 


Rackspace

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