All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wl@xen.org>
To: Xen Development List <xen-devel@lists.xenproject.org>
Cc: "Wei Liu" <liuwe@microsoft.com>, "Wei Liu" <wl@xen.org>,
	"Paul Durrant" <paul@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Paul Durrant" <pdurrant@amazon.com>,
	"Michael Kelley" <mikelley@microsoft.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH 2/3] x86/viridian: drop virdian_sint_msr
Date: Sun, 22 Dec 2019 23:20:34 +0000	[thread overview]
Message-ID: <20191222232035.31613-3-liuwe@microsoft.com> (raw)
In-Reply-To: <20191222232035.31613-1-liuwe@microsoft.com>

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@microsoft.com>
---
 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-12-22 23:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22 23:20 [Xen-devel] [PATCH 0/3] More viridian code cleanup Wei Liu
2019-12-22 23:20 ` [Xen-devel] [PATCH 1/3] x86/viridian: drop a wrong invalid value from reference TSC implementation Wei Liu
2019-12-23  8:36   ` Durrant, Paul
2019-12-22 23:20 ` Wei Liu [this message]
2019-12-23  8:38   ` [Xen-devel] [PATCH 2/3] x86/viridian: drop virdian_sint_msr Durrant, Paul
2019-12-22 23:20 ` [Xen-devel] [PATCH 3/3] x86/viridian: drop viridian_stimer_config_msr Wei Liu
2019-12-23  8:39   ` Durrant, Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191222232035.31613-3-liuwe@microsoft.com \
    --to=wl@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=liuwe@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=paul@xen.org \
    --cc=pdurrant@amazon.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.