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 3/3] x86/viridian: drop viridian_stimer_config_msr
Date: Sun, 22 Dec 2019 23:20:35 +0000	[thread overview]
Message-ID: <20191222232035.31613-4-liuwe@microsoft.com> (raw)
In-Reply-To: <20191222232035.31613-1-liuwe@microsoft.com>

Use hv_stimer_config instead. No functional change.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
---
 xen/arch/x86/hvm/viridian/time.c   | 28 ++++++++++++++--------------
 xen/include/asm-x86/hvm/viridian.h | 19 +------------------
 2 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 0f1cd9e208..3de5665c02 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -220,7 +220,7 @@ static void poll_stimer(struct vcpu *v, unsigned int stimerx)
      * is disabled make sure the pending bit is cleared to avoid re-
      * polling.
      */
-    if ( !vs->config.enabled )
+    if ( !vs->config.enable )
     {
         clear_bit(stimerx, &vv->stimer_pending);
         return;
@@ -239,7 +239,7 @@ static void poll_stimer(struct vcpu *v, unsigned int stimerx)
     if ( vs->config.periodic )
         start_stimer(vs);
     else
-        vs->config.enabled = 0;
+        vs->config.enable = 0;
 }
 
 void viridian_time_poll_timers(struct vcpu *v)
@@ -285,7 +285,7 @@ static void time_vcpu_thaw(struct vcpu *v)
     {
         struct viridian_stimer *vs = &vv->stimer[i];
 
-        if ( vs->config.enabled )
+        if ( vs->config.enable )
             start_stimer(vs);
     }
 }
@@ -355,12 +355,12 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
 
         stop_stimer(vs);
 
-        vs->config.raw = val;
+        vs->config.as_uint64 = val;
 
         if ( !vs->config.sintx )
-            vs->config.enabled = 0;
+            vs->config.enable = 0;
 
-        if ( vs->config.enabled )
+        if ( vs->config.enable )
             start_stimer(vs);
 
         break;
@@ -383,11 +383,11 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
         vs->count = val;
 
         if ( !vs->count  )
-            vs->config.enabled = 0;
+            vs->config.enable = 0;
         else if ( vs->config.auto_enable )
-            vs->config.enabled = 1;
+            vs->config.enable = 1;
 
-        if ( vs->config.enabled )
+        if ( vs->config.enable )
             start_stimer(vs);
 
         break;
@@ -454,7 +454,7 @@ int viridian_time_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val)
         unsigned int stimerx = (idx - HV_X64_MSR_STIMER0_CONFIG) / 2;
         const struct viridian_stimer *vs =
             &array_access_nospec(vv->stimer, stimerx);
-        union viridian_stimer_config_msr config = vs->config;
+        union hv_stimer_config config = vs->config;
 
         if ( !(viridian_feature_mask(d) & HVMPV_stimer) )
             return X86EMUL_EXCEPTION;
@@ -464,9 +464,9 @@ int viridian_time_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val)
          * the enabled flag is clear.
          */
         if ( !config.periodic && test_bit(stimerx, &vv->stimer_pending) )
-            config.enabled = 0;
+            config.enable = 0;
 
-        *val = config.raw;
+        *val = config.as_uint64;
         break;
     }
 
@@ -549,7 +549,7 @@ void viridian_time_save_vcpu_ctxt(
     {
         const struct viridian_stimer *vs = &vv->stimer[i];
 
-        ctxt->stimer_config_msr[i] = vs->config.raw;
+        ctxt->stimer_config_msr[i] = vs->config.as_uint64;
         ctxt->stimer_count_msr[i] = vs->count;
     }
 }
@@ -564,7 +564,7 @@ void viridian_time_load_vcpu_ctxt(
     {
         struct viridian_stimer *vs = &vv->stimer[i];
 
-        vs->config.raw = ctxt->stimer_config_msr[i];
+        vs->config.as_uint64 = ctxt->stimer_config_msr[i];
         vs->count = ctxt->stimer_count_msr[i];
     }
 }
diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/viridian.h
index d694d83521..d9138562e6 100644
--- a/xen/include/asm-x86/hvm/viridian.h
+++ b/xen/include/asm-x86/hvm/viridian.h
@@ -28,27 +28,10 @@ struct viridian_page
     void *ptr;
 };
 
-union viridian_stimer_config_msr
-{
-    uint64_t raw;
-    struct
-    {
-        uint64_t enabled:1;
-        uint64_t periodic:1;
-        uint64_t lazy:1;
-        uint64_t auto_enable:1;
-        uint64_t vector:8;
-        uint64_t direct_mode:1;
-        uint64_t reserved_zero1:3;
-        uint64_t sintx:4;
-        uint64_t reserved_zero2:44;
-    };
-};
-
 struct viridian_stimer {
     struct vcpu *v;
     struct timer timer;
-    union viridian_stimer_config_msr config;
+    union hv_stimer_config config;
     uint64_t count;
     uint64_t expiration;
     bool started;
-- 
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 ` [Xen-devel] [PATCH 2/3] x86/viridian: drop virdian_sint_msr Wei Liu
2019-12-23  8:38   ` Durrant, Paul
2019-12-22 23:20 ` Wei Liu [this message]
2019-12-23  8:39   ` [Xen-devel] [PATCH 3/3] x86/viridian: drop viridian_stimer_config_msr 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-4-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.