> -----Original Message-----
> From: Igor Druzhinin <igor.druzhi...@citrix.com>
> Sent: 08 January 2021 00:47
> To: xen-devel@lists.xenproject.org
> Cc: p...@xen.org; w...@xen.org; i...@xenproject.org; 
> anthony.per...@citrix.com;
> andrew.coop...@citrix.com; george.dun...@citrix.com; jbeul...@suse.com; 
> jul...@xen.org;
> sstabell...@kernel.org; roger....@citrix.com; Igor Druzhinin 
> <igor.druzhi...@citrix.com>
> Subject: [PATCH 2/2] viridian: allow vCPU hotplug for Windows VMs
> 
> If Viridian extensions are enabled, Windows wouldn't currently allow
> a hotplugged vCPU to be brought up dynamically. We need to expose a special
> bit to let the guest know we allow it. It appears we can just start exposing
> it without worrying too much about compatibility - see relevant QEMU
> discussion here:
> 
> https://patchwork.kernel.org/project/qemu-devel/patch/1455364815-19586-1-git-send-email-
> d...@openvz.org/

I don't think that discussion really confirmed it was safe... just that 
empirically it appeared to be so. I think we should err on
the side of caution and have this behind a feature flag (but I'm happy for it 
to default to on).

  Paul

> 
> Signed-off-by: Igor Druzhinin <igor.druzhi...@citrix.com>
> ---
>  xen/arch/x86/hvm/viridian/viridian.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/hvm/viridian/viridian.c 
> b/xen/arch/x86/hvm/viridian/viridian.c
> index ae1ea86..76e8291 100644
> --- a/xen/arch/x86/hvm/viridian/viridian.c
> +++ b/xen/arch/x86/hvm/viridian/viridian.c
> @@ -76,6 +76,7 @@ typedef union _HV_CRASH_CTL_REG_CONTENTS
>  } HV_CRASH_CTL_REG_CONTENTS;
> 
>  /* Viridian CPUID leaf 3, Hypervisor Feature Indication */
> +#define CPUID3D_CPU_DYNAMIC_PARTITIONING (1 << 3)
>  #define CPUID3D_CRASH_MSRS (1 << 10)
>  #define CPUID3D_SINT_POLLING (1 << 17)
> 
> @@ -179,8 +180,11 @@ void cpuid_viridian_leaves(const struct vcpu *v, 
> uint32_t leaf,
>          res->a = u.lo;
>          res->b = u.hi;
> 
> +        /* Expose ability to bring up VPs dynamically - allows vCPU hotplug 
> */
> +        res->d = CPUID3D_CPU_DYNAMIC_PARTITIONING;
> +
>          if ( viridian_feature_mask(d) & HVMPV_crash_ctl )
> -            res->d = CPUID3D_CRASH_MSRS;
> +            res->d |= CPUID3D_CRASH_MSRS;
>          if ( viridian_feature_mask(d) & HVMPV_synic )
>              res->d |= CPUID3D_SINT_POLLING;
> 
> --
> 2.7.4



Reply via email to