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

[Xen-devel] [PATCH v9 04/11] viridian: make 'fields' struct anonymous...



...inside viridian_page_msr and viridian_guest_os_id_msr unions.

There's no need to name it and the code is shortened by not doing so.
No functional change.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>

v4:
 - New in v4
---
 xen/arch/x86/hvm/viridian/synic.c    |  4 ++--
 xen/arch/x86/hvm/viridian/time.c     | 10 +++++-----
 xen/arch/x86/hvm/viridian/viridian.c | 20 +++++++++-----------
 xen/include/asm-x86/hvm/viridian.h   |  4 ++--
 4 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c 
b/xen/arch/x86/hvm/viridian/synic.c
index f3d9f7ae74..05d971b365 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -102,7 +102,7 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, 
uint64_t val)
         viridian_unmap_guest_page(&vv->vp_assist);
         vv->vp_assist.msr.raw = val;
         viridian_dump_guest_page(v, "VP_ASSIST", &vv->vp_assist);
-        if ( vv->vp_assist.msr.fields.enabled )
+        if ( vv->vp_assist.msr.enabled )
             viridian_map_guest_page(v, &vv->vp_assist);
         break;
 
@@ -161,7 +161,7 @@ void viridian_synic_load_vcpu_ctxt(
     struct viridian_vcpu *vv = v->arch.hvm.viridian;
 
     vv->vp_assist.msr.raw = ctxt->vp_assist_msr;
-    if ( vv->vp_assist.msr.fields.enabled )
+    if ( vv->vp_assist.msr.enabled )
         viridian_map_guest_page(v, &vv->vp_assist);
 
     vv->apic_assist_pending = ctxt->apic_assist_pending;
diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index 76f9612001..909a3fb9e3 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -29,16 +29,16 @@ static void dump_reference_tsc(const struct domain *d)
 {
     const union viridian_page_msr *rt = &d->arch.hvm.viridian->reference_tsc;
 
-    if ( !rt->fields.enabled )
+    if ( !rt->enabled )
         return;
 
     printk(XENLOG_G_INFO "d%d: VIRIDIAN REFERENCE_TSC: pfn: %lx\n",
-           d->domain_id, (unsigned long)rt->fields.pfn);
+           d->domain_id, (unsigned long)rt->pfn);
 }
 
 static void update_reference_tsc(struct domain *d, bool initialize)
 {
-    unsigned long gmfn = d->arch.hvm.viridian->reference_tsc.fields.pfn;
+    unsigned long gmfn = d->arch.hvm.viridian->reference_tsc.pfn;
     struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC);
     HV_REFERENCE_TSC_PAGE *p;
 
@@ -151,7 +151,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, 
uint64_t val)
 
         vd->reference_tsc.raw = val;
         dump_reference_tsc(d);
-        if ( vd->reference_tsc.fields.enabled )
+        if ( vd->reference_tsc.enabled )
             update_reference_tsc(d, true);
         break;
 
@@ -232,7 +232,7 @@ void viridian_time_load_domain_ctxt(
     vd->time_ref_count.val = ctxt->time_ref_count;
     vd->reference_tsc.raw = ctxt->reference_tsc;
 
-    if ( vd->reference_tsc.fields.enabled )
+    if ( vd->reference_tsc.enabled )
         update_reference_tsc(d, false);
 }
 
diff --git a/xen/arch/x86/hvm/viridian/viridian.c 
b/xen/arch/x86/hvm/viridian/viridian.c
index 710470fed7..1a20d68aaf 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -192,7 +192,7 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t 
leaf,
 
     case 4:
         /* Recommended hypercall usage. */
-        if ( vd->guest_os_id.raw == 0 || vd->guest_os_id.fields.os < 4 )
+        if ( vd->guest_os_id.raw == 0 || vd->guest_os_id.os < 4 )
             break;
         res->a = CPUID4A_RELAX_TIMER_INT;
         if ( viridian_feature_mask(d) & HVMPV_hcall_remote_tlb_flush )
@@ -228,10 +228,8 @@ static void dump_guest_os_id(const struct domain *d)
 
     printk(XENLOG_G_INFO
            "d%d: VIRIDIAN GUEST_OS_ID: vendor: %x os: %x major: %x minor: %x 
sp: %x build: %x\n",
-           d->domain_id,
-           goi->fields.vendor, goi->fields.os,
-           goi->fields.major, goi->fields.minor,
-           goi->fields.service_pack, goi->fields.build_number);
+           d->domain_id, goi->vendor, goi->os, goi->major, goi->minor,
+           goi->service_pack, goi->build_number);
 }
 
 static void dump_hypercall(const struct domain *d)
@@ -242,12 +240,12 @@ static void dump_hypercall(const struct domain *d)
 
     printk(XENLOG_G_INFO "d%d: VIRIDIAN HYPERCALL: enabled: %x pfn: %lx\n",
            d->domain_id,
-           hg->fields.enabled, (unsigned long)hg->fields.pfn);
+           hg->enabled, (unsigned long)hg->pfn);
 }
 
 static void enable_hypercall_page(struct domain *d)
 {
-    unsigned long gmfn = d->arch.hvm.viridian->hypercall_gpa.fields.pfn;
+    unsigned long gmfn = d->arch.hvm.viridian->hypercall_gpa.pfn;
     struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC);
     uint8_t *p;
 
@@ -297,7 +295,7 @@ int guest_wrmsr_viridian(struct vcpu *v, uint32_t idx, 
uint64_t val)
     case HV_X64_MSR_HYPERCALL:
         vd->hypercall_gpa.raw = val;
         dump_hypercall(d);
-        if ( vd->hypercall_gpa.fields.enabled )
+        if ( vd->hypercall_gpa.enabled )
             enable_hypercall_page(d);
         break;
 
@@ -606,17 +604,17 @@ out:
 void viridian_dump_guest_page(const struct vcpu *v, const char *name,
                               const struct viridian_page *vp)
 {
-    if ( !vp->msr.fields.enabled )
+    if ( !vp->msr.enabled )
         return;
 
     printk(XENLOG_G_INFO "%pv: VIRIDIAN %s: pfn: %lx\n",
-           v, name, (unsigned long)vp->msr.fields.pfn);
+           v, name, (unsigned long)vp->msr.pfn);
 }
 
 void viridian_map_guest_page(const struct vcpu *v, struct viridian_page *vp)
 {
     struct domain *d = v->domain;
-    unsigned long gmfn = vp->msr.fields.pfn;
+    unsigned long gmfn = vp->msr.pfn;
     struct page_info *page;
 
     if ( vp->ptr )
diff --git a/xen/include/asm-x86/hvm/viridian.h 
b/xen/include/asm-x86/hvm/viridian.h
index c562424332..abbbb36092 100644
--- a/xen/include/asm-x86/hvm/viridian.h
+++ b/xen/include/asm-x86/hvm/viridian.h
@@ -17,7 +17,7 @@ union viridian_page_msr
         uint64_t enabled:1;
         uint64_t reserved_preserved:11;
         uint64_t pfn:48;
-    } fields;
+    };
 };
 
 struct viridian_page
@@ -44,7 +44,7 @@ union viridian_guest_os_id_msr
         uint64_t major:8;
         uint64_t os:8;
         uint64_t vendor:16;
-    } fields;
+    };
 };
 
 struct viridian_time_ref_count
-- 
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®.