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

Re: [Xen-devel] [PATCH 2/3] x86/viridian: drop virdian_sint_msr



> -----Original Message-----
> From: Wei Liu <wei.liu.xen@xxxxxxxxx> On Behalf Of Wei Liu
> Sent: 22 December 2019 23:21
> To: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> Cc: Michael Kelley <mikelley@xxxxxxxxxxxxx>; Durrant, Paul
> <pdurrant@xxxxxxxxxx>; Wei Liu <liuwe@xxxxxxxxxxxxx>; Paul Durrant
> <paul@xxxxxxx>; Jan Beulich <jbeulich@xxxxxxxx>; Andrew Cooper
> <andrew.cooper3@xxxxxxxxxx>; Wei Liu <wl@xxxxxxx>; Roger Pau Monné
> <roger.pau@xxxxxxxxxx>
> Subject: [PATCH 2/3] x86/viridian: drop virdian_sint_msr
> 
> Use hv_synic_sint in hyperv-tlfs.h instead.
> 
> This requires adding the missing "polling" member to hv_synic_sint.
> 
> No functional change.
> 
> Signed-off-by: Wei Liu <liuwe@xxxxxxxxxxxxx>

Reviewed-by: Paul Durrant <paul@xxxxxxx>

> ---
>  xen/arch/x86/hvm/viridian/synic.c       | 20 ++++++++++----------
>  xen/include/asm-x86/guest/hyperv-tlfs.h |  3 ++-
>  xen/include/asm-x86/hvm/viridian.h      | 16 +---------------
>  3 files changed, 13 insertions(+), 26 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/viridian/synic.c
> b/xen/arch/x86/hvm/viridian/synic.c
> index 54c62f843f..94a2b88733 100644
> --- a/xen/arch/x86/hvm/viridian/synic.c
> +++ b/xen/arch/x86/hvm/viridian/synic.c
> @@ -143,7 +143,7 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx,
> uint64_t val)
>      case HV_X64_MSR_SINT0 ... HV_X64_MSR_SINT15:
>      {
>          unsigned int sintx = idx - HV_X64_MSR_SINT0;
> -        union viridian_sint_msr new, *vs =
> +        union hv_synic_sint new, *vs =
>              &array_access_nospec(vv->sint, sintx);
>          uint8_t vector;
> 
> @@ -151,7 +151,7 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx,
> uint64_t val)
>              return X86EMUL_EXCEPTION;
> 
>          /* Vectors must be in the range 0x10-0xff inclusive */
> -        new.raw = val;
> +        new.as_uint64 = val;
>          if ( new.vector < 0x10 )
>              return X86EMUL_EXCEPTION;
> 
> @@ -256,13 +256,13 @@ int viridian_synic_rdmsr(const struct vcpu *v,
> uint32_t idx, uint64_t *val)
>      case HV_X64_MSR_SINT0 ... HV_X64_MSR_SINT15:
>      {
>          unsigned int sintx = idx - HV_X64_MSR_SINT0;
> -        const union viridian_sint_msr *vs =
> +        const union hv_synic_sint *vs =
>              &array_access_nospec(vv->sint, sintx);
> 
>          if ( !(viridian_feature_mask(d) & HVMPV_synic) )
>              return X86EMUL_EXCEPTION;
> 
> -        *val = vs->raw;
> +        *val = vs->as_uint64;
>          break;
>      }
> 
> @@ -284,7 +284,7 @@ int viridian_synic_vcpu_init(const struct vcpu *v)
>       * initally masked.
>       */
>      for ( i = 0; i < ARRAY_SIZE(vv->sint); i++ )
> -        vv->sint[i].mask = 1;
> +        vv->sint[i].masked = 1;
> 
>      /* Initialize the mapping array with invalid values */
>      for ( i = 0; i < ARRAY_SIZE(vv->vector_to_sintx); i++ )
> @@ -321,7 +321,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v,
> unsigned int sintx,
>                                        uint64_t delivery)
>  {
>      struct viridian_vcpu *vv = v->arch.hvm.viridian;
> -    const union viridian_sint_msr *vs = &vv->sint[sintx];
> +    const union hv_synic_sint *vs = &vv->sint[sintx];
>      struct hv_message *msg = vv->simp.ptr;
>      struct {
>          uint32_t TimerIndex;
> @@ -360,7 +360,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v,
> unsigned int sintx,
>      BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload));
>      memcpy(msg->u.payload, &payload, sizeof(payload));
> 
> -    if ( !vs->mask )
> +    if ( !vs->masked )
>          vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0);
> 
>      return true;
> @@ -371,7 +371,7 @@ bool viridian_synic_is_auto_eoi_sint(const struct vcpu
> *v,
>  {
>      const struct viridian_vcpu *vv = v->arch.hvm.viridian;
>      unsigned int sintx = vv->vector_to_sintx[vector];
> -    const union viridian_sint_msr *vs =
> +    const union hv_synic_sint *vs =
>          &array_access_nospec(vv->sint, sintx);
> 
>      if ( sintx >= ARRAY_SIZE(vv->sint) )
> @@ -401,7 +401,7 @@ void viridian_synic_save_vcpu_ctxt(const struct vcpu
> *v,
>      BUILD_BUG_ON(ARRAY_SIZE(vv->sint) != ARRAY_SIZE(ctxt->sint_msr));
> 
>      for ( i = 0; i < ARRAY_SIZE(vv->sint); i++ )
> -        ctxt->sint_msr[i] = vv->sint[i].raw;
> +        ctxt->sint_msr[i] = vv->sint[i].as_uint64;
> 
>      ctxt->simp_msr = vv->simp.msr.raw;
> 
> @@ -430,7 +430,7 @@ void viridian_synic_load_vcpu_ctxt(
>      {
>          uint8_t vector;
> 
> -        vv->sint[i].raw = ctxt->sint_msr[i];
> +        vv->sint[i].as_uint64 = ctxt->sint_msr[i];
> 
>          vector = vv->sint[i].vector;
>          if ( vector < 0x10 )
> diff --git a/xen/include/asm-x86/guest/hyperv-tlfs.h b/xen/include/asm-
> x86/guest/hyperv-tlfs.h
> index 4402854c80..fe9fb232d0 100644
> --- a/xen/include/asm-x86/guest/hyperv-tlfs.h
> +++ b/xen/include/asm-x86/guest/hyperv-tlfs.h
> @@ -819,7 +819,8 @@ union hv_synic_sint {
>               u64 reserved1:8;
>               u64 masked:1;
>               u64 auto_eoi:1;
> -             u64 reserved2:46;
> +             u64 polling:1;
> +             u64 reserved2:45;
>       } __packed;
>  };
> 
> diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-
> x86/hvm/viridian.h
> index cfbaede158..d694d83521 100644
> --- a/xen/include/asm-x86/hvm/viridian.h
> +++ b/xen/include/asm-x86/hvm/viridian.h
> @@ -28,20 +28,6 @@ struct viridian_page
>      void *ptr;
>  };
> 
> -union viridian_sint_msr
> -{
> -    uint64_t raw;
> -    struct
> -    {
> -        uint64_t vector:8;
> -        uint64_t reserved_preserved1:8;
> -        uint64_t mask:1;
> -        uint64_t auto_eoi:1;
> -        uint64_t polling:1;
> -        uint64_t reserved_preserved2:45;
> -    };
> -};
> -
>  union viridian_stimer_config_msr
>  {
>      uint64_t raw;
> @@ -77,7 +63,7 @@ struct viridian_vcpu
>      uint64_t scontrol;
>      uint64_t siefp;
>      struct viridian_page simp;
> -    union viridian_sint_msr sint[16];
> +    union hv_synic_sint sint[16];
>      uint8_t vector_to_sintx[256];
>      struct viridian_stimer stimer[4];
>      unsigned int stimer_enabled;
> --
> 2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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