Skip to contentSkip to conversation

x86: Structure naming and consistency improvements

PATCH In review Andrew Cooper 8 participants 39 messages Aug 28, 2018 – Sep 3, 2018

lore
Share & tools
lore
#0 lore raw

cover x86: Structure naming and consistency improvements

This series started by trying to address the bug in patch 7, and ballooned somewhat.

It is semi RFC because I expect there might be some objection in principle to a series this invasive, but I can't find any less invasive way of making the changes. In particular, we can't use #define's to stage the changes over time, because it interferes with local variables with the same name.

Overall, I think the series is enough of an improvement for it to be considered.

Andrew Cooper (7):
x86/pv: Rename d->arch.pv_domain to d->arch.pv x86/pv: Rename v->arch.pv_vcpu to v->arch.pv xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm x86/vtx: Rename arch_vmx_struct to vmx_vcpu x86/svm: Rename arch_svm_struct to svm_vcpu x86/hvm: Drop hvm_{vmx,svm} shorthands

 xen/arch/arm/domain_build.c             |   2 +-
 xen/arch/arm/hvm.c                      |   4 +-
 xen/arch/x86/cpu/amd.c                  |   6 +-
 xen/arch/x86/cpu/intel.c                |   6 +-
 xen/arch/x86/cpu/vpmu.c                 |   2 +-
 xen/arch/x86/cpuid.c                    |  12 +-
 xen/arch/x86/domain.c                   |  96 +++----
 xen/arch/x86/domain_page.c              |  14 +-
 xen/arch/x86/domctl.c                   | 104 ++++----
 xen/arch/x86/hvm/asid.c                 |   2 +-
 xen/arch/x86/hvm/dm.c                   |  12 +-
 xen/arch/x86/hvm/dom0_build.c           |   4 +-
 xen/arch/x86/hvm/domain.c               |  40 +--
 xen/arch/x86/hvm/emulate.c              |  28 +-
 xen/arch/x86/hvm/hpet.c                 |  10 +-
 xen/arch/x86/hvm/hvm.c                  | 307 +++++++++++-----------
 xen/arch/x86/hvm/hypercall.c            |   6 +-
 xen/arch/x86/hvm/intercept.c            |  14 +-
 xen/arch/x86/hvm/io.c                   |  60 ++---
 xen/arch/x86/hvm/ioreq.c                |  84 +++---
 xen/arch/x86/hvm/irq.c                  |  56 ++--
 xen/arch/x86/hvm/mtrr.c                 |  36 +--
 xen/arch/x86/hvm/pmtimer.c              |  42 +--
 xen/arch/x86/hvm/rtc.c                  |   4 +-
 xen/arch/x86/hvm/save.c                 |   6 +-
 xen/arch/x86/hvm/stdvga.c               |  18 +-
 xen/arch/x86/hvm/svm/asid.c             |   4 +-
 xen/arch/x86/hvm/svm/emulate.c          |   4 +-
 xen/arch/x86/hvm/svm/intr.c             |   8 +-
 xen/arch/x86/hvm/svm/nestedsvm.c        |  72 +++--
 xen/arch/x86/hvm/svm/svm.c              | 248 +++++++++---------
 xen/arch/x86/hvm/svm/vmcb.c             |  16 +-
 xen/arch/x86/hvm/vioapic.c              |  44 ++--
 xen/arch/x86/hvm/viridian.c             | 120 ++++-----
 xen/arch/x86/hvm/vlapic.c               |   8 +-
 xen/arch/x86/hvm/vmsi.c                 |  44 ++--
 xen/arch/x86/hvm/vmx/intr.c             |  20 +-
 xen/arch/x86/hvm/vmx/realmode.c         |  28 +-
 xen/arch/x86/hvm/vmx/vmcs.c             | 174 ++++++-------
 xen/arch/x86/hvm/vmx/vmx.c              | 448 ++++++++++++++++----------------
 xen/arch/x86/hvm/vmx/vvmx.c             |  96 +++----
 xen/arch/x86/hvm/vpic.c                 |  20 +-
 xen/arch/x86/hvm/vpt.c                  |  94 +++----
 xen/arch/x86/i387.c                     |   2 +-
 xen/arch/x86/irq.c                      |  10 +-
 xen/arch/x86/mm.c                       |  24 +-
 xen/arch/x86/mm/hap/guest_walk.c        |   2 +-
 xen/arch/x86/mm/hap/hap.c               |  15 +-
 xen/arch/x86/mm/mem_sharing.c           |   6 +-
 xen/arch/x86/mm/p2m-ept.c               |   6 +-
 xen/arch/x86/mm/shadow/common.c         |  18 +-
 xen/arch/x86/mm/shadow/multi.c          |  20 +-
 xen/arch/x86/physdev.c                  |  11 +-
 xen/arch/x86/pv/callback.c              |  42 +--
 xen/arch/x86/pv/descriptor-tables.c     |  18 +-
 xen/arch/x86/pv/dom0_build.c            |   8 +-
 xen/arch/x86/pv/domain.c                |  65 +++--
 xen/arch/x86/pv/emul-gate-op.c          |   4 +-
 xen/arch/x86/pv/emul-priv-op.c          |  42 +--
 xen/arch/x86/pv/iret.c                  |  10 +-
 xen/arch/x86/pv/misc-hypercalls.c       |   4 +-
 xen/arch/x86/pv/mm.c                    |  10 +-
 xen/arch/x86/pv/traps.c                 |  10 +-
 xen/arch/x86/setup.c                    |  10 +-
 xen/arch/x86/time.c                     |  16 +-
 xen/arch/x86/traps.c                    |  24 +-
 xen/arch/x86/x86_64/asm-offsets.c       |  48 ++--
 xen/arch/x86/x86_64/entry.S             |   2 +-
 xen/arch/x86/x86_64/mm.c                |  10 +-
 xen/arch/x86/x86_64/traps.c             |  18 +-
 xen/arch/x86/x86_emulate.c              |   2 +-
 xen/common/vm_event.c                   |   2 +-
 xen/drivers/passthrough/io.c            |   2 +-
 xen/drivers/passthrough/pci.c           |   2 +-
 xen/drivers/vpci/msix.c                 |   6 +-
 xen/include/asm-arm/domain.h            |   2 +-
 xen/include/asm-x86/domain.h            |  16 +-
 xen/include/asm-x86/flushtlb.h          |   2 +-
 xen/include/asm-x86/guest_pt.h          |   2 +-
 xen/include/asm-x86/hvm/domain.h        |   2 +-
 xen/include/asm-x86/hvm/hvm.h           |  31 ++-
 xen/include/asm-x86/hvm/irq.h           |   2 +-
 xen/include/asm-x86/hvm/nestedhvm.h     |   6 +-
 xen/include/asm-x86/hvm/svm/asid.h      |   2 +-
 xen/include/asm-x86/hvm/svm/nestedsvm.h |   2 +-
 xen/include/asm-x86/hvm/svm/vmcb.h      |   2 +-
 xen/include/asm-x86/hvm/vcpu.h          |  10 +-
 xen/include/asm-x86/hvm/vioapic.h       |   2 +-
 xen/include/asm-x86/hvm/vlapic.h        |   6 +-
 xen/include/asm-x86/hvm/vmx/vmcs.h      |   4 +-
 xen/include/asm-x86/hvm/vmx/vmx.h       |   2 +-
 xen/include/asm-x86/hvm/vpt.h           |   4 +-
 xen/include/asm-x86/irq.h               |   3 +-
 xen/include/asm-x86/ldt.h               |   2 +-
 xen/include/asm-x86/pv/traps.h          |   2 +-
 xen/include/asm-x86/shadow.h            |   4 +-
 96 files changed, 1485 insertions(+), 1515 deletions(-)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/7 x86/pv: Rename d->arch.pv_domain to d->arch.pv

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>

---
 xen/arch/x86/cpu/amd.c         |  4 ++--
 xen/arch/x86/cpu/intel.c       |  4 ++--
 xen/arch/x86/domain.c          |  2 +-
 xen/arch/x86/domain_page.c     |  8 ++++----
 xen/arch/x86/domctl.c          | 10 +++++-----
 xen/arch/x86/mm.c              | 14 +++++++-------
 xen/arch/x86/pv/dom0_build.c   |  4 ++--
 xen/arch/x86/pv/domain.c       | 35 ++++++++++++++++-------------------
 xen/include/asm-x86/domain.h   |  4 ++--
 xen/include/asm-x86/flushtlb.h |  2 +-
 xen/include/asm-x86/shadow.h   |  4 ++--
 11 files changed, 44 insertions(+), 47 deletions(-)
xen/arch/x86/cpu/amd.c +2 -2
index a7afa2f..e0ee114 100644
@@ -208,8 +208,8 @@ static void amd_ctxt_switch_masking(const struct vcpu *next)
 	struct cpuidmasks *these_masks = &this_cpu(cpuidmasks);
 	const struct domain *nextd = next ? next->domain : NULL;
 	const struct cpuidmasks *masks =
-		(nextd && is_pv_domain(nextd) && nextd->arch.pv_domain.cpuidmasks)
-		? nextd->arch.pv_domain.cpuidmasks : &cpuidmask_defaults;
+		(nextd && is_pv_domain(nextd) && nextd->arch.pv.cpuidmasks)
+		? nextd->arch.pv.cpuidmasks : &cpuidmask_defaults;
 
 	if ((levelling_caps & LCAP_1cd) == LCAP_1cd) {
 		uint64_t val = masks->_1cd;
xen/arch/x86/cpu/intel.c +2 -2
index 377beef..8c375c8 100644
@@ -119,8 +119,8 @@ static void intel_ctxt_switch_masking(const struct vcpu *next)
 	struct cpuidmasks *these_masks = &this_cpu(cpuidmasks);
 	const struct domain *nextd = next ? next->domain : NULL;
 	const struct cpuidmasks *masks =
-		(nextd && is_pv_domain(nextd) && nextd->arch.pv_domain.cpuidmasks)
-		? nextd->arch.pv_domain.cpuidmasks : &cpuidmask_defaults;
+		(nextd && is_pv_domain(nextd) && nextd->arch.pv.cpuidmasks)
+		? nextd->arch.pv.cpuidmasks : &cpuidmask_defaults;
 
         if (msr_basic) {
 		uint64_t val = masks->_1cd;
xen/arch/x86/domain.c +1 -1
index eb1e93f..8c7ddf5 100644
@@ -970,7 +970,7 @@ int arch_set_info_guest(
         if ( d != current->domain && !VM_ASSIST(d, m2p_strict) &&
              is_pv_domain(d) && !is_pv_32bit_domain(d) &&
              test_bit(VMASST_TYPE_m2p_strict, &c.nat->vm_assist) &&
-             atomic_read(&d->arch.pv_domain.nr_l4_pages) )
+             atomic_read(&d->arch.pv.nr_l4_pages) )
         {
             bool done = false;
 
xen/arch/x86/domain_page.c +4 -4
index 0c24530..15ba6f5 100644
@@ -85,7 +85,7 @@ void *map_domain_page(mfn_t mfn)
     if ( !v || !is_pv_vcpu(v) )
         return mfn_to_virt(mfn_x(mfn));
 
-    dcache = &v->domain->arch.pv_domain.mapcache;
+    dcache = &v->domain->arch.pv.mapcache;
     vcache = &v->arch.pv_vcpu.mapcache;
     if ( !dcache->inuse )
         return mfn_to_virt(mfn_x(mfn));
@@ -189,7 +189,7 @@ void unmap_domain_page(const void *ptr)
     v = mapcache_current_vcpu();
     ASSERT(v && is_pv_vcpu(v));
 
-    dcache = &v->domain->arch.pv_domain.mapcache;
+    dcache = &v->domain->arch.pv.mapcache;
     ASSERT(dcache->inuse);
 
     idx = PFN_DOWN(va - MAPCACHE_VIRT_START);
@@ -233,7 +233,7 @@ void unmap_domain_page(const void *ptr)
 
 int mapcache_domain_init(struct domain *d)
 {
-    struct mapcache_domain *dcache = &d->arch.pv_domain.mapcache;
+    struct mapcache_domain *dcache = &d->arch.pv.mapcache;
     unsigned int bitmap_pages;
 
     ASSERT(is_pv_domain(d));
@@ -261,7 +261,7 @@ int mapcache_domain_init(struct domain *d)
 int mapcache_vcpu_init(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    struct mapcache_domain *dcache = &d->arch.pv_domain.mapcache;
+    struct mapcache_domain *dcache = &d->arch.pv.mapcache;
     unsigned long i;
     unsigned int ents = d->max_vcpus * MAPCACHE_VCPU_ENTRIES;
     unsigned int nr = PFN_UP(BITS_TO_LONGS(ents) * sizeof(long));
xen/arch/x86/domctl.c +5 -5
index 6f1c43e..e27e971 100644
@@ -194,7 +194,7 @@ static int update_domain_cpuid_info(struct domain *d,
                 break;
             }
 
-            d->arch.pv_domain.cpuidmasks->_1cd = mask;
+            d->arch.pv.cpuidmasks->_1cd = mask;
         }
         break;
 
@@ -206,7 +206,7 @@ static int update_domain_cpuid_info(struct domain *d,
             if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
                 mask &= (~0ULL << 32) | ctl->ecx;
 
-            d->arch.pv_domain.cpuidmasks->_6c = mask;
+            d->arch.pv.cpuidmasks->_6c = mask;
         }
         break;
 
@@ -223,7 +223,7 @@ static int update_domain_cpuid_info(struct domain *d,
             if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
                 mask &= ((uint64_t)eax << 32) | ebx;
 
-            d->arch.pv_domain.cpuidmasks->_7ab0 = mask;
+            d->arch.pv.cpuidmasks->_7ab0 = mask;
         }
 
         /*
@@ -262,7 +262,7 @@ static int update_domain_cpuid_info(struct domain *d,
             if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
                 mask &= (~0ULL << 32) | eax;
 
-            d->arch.pv_domain.cpuidmasks->Da1 = mask;
+            d->arch.pv.cpuidmasks->Da1 = mask;
         }
         break;
 
@@ -305,7 +305,7 @@ static int update_domain_cpuid_info(struct domain *d,
                 break;
             }
 
-            d->arch.pv_domain.cpuidmasks->e1cd = mask;
+            d->arch.pv.cpuidmasks->e1cd = mask;
         }
         break;
 
xen/arch/x86/mm.c +7 -7
index 8ac4412..26c4551 100644
@@ -501,7 +501,7 @@ void make_cr3(struct vcpu *v, mfn_t mfn)
     struct domain *d = v->domain;
 
     v->arch.cr3 = mfn_x(mfn) << PAGE_SHIFT;
-    if ( is_pv_domain(d) && d->arch.pv_domain.pcid )
+    if ( is_pv_domain(d) && d->arch.pv.pcid )
         v->arch.cr3 |= get_pcid_bits(v, false);
 }
 
@@ -514,9 +514,9 @@ unsigned long pv_guest_cr4_to_real_cr4(const struct vcpu *v)
     cr4 |= mmu_cr4_features & (X86_CR4_PSE | X86_CR4_SMEP | X86_CR4_SMAP |
                                X86_CR4_OSXSAVE | X86_CR4_FSGSBASE);
 
-    if ( d->arch.pv_domain.pcid )
+    if ( d->arch.pv.pcid )
         cr4 |= X86_CR4_PCIDE;
-    else if ( !d->arch.pv_domain.xpti )
+    else if ( !d->arch.pv.xpti )
         cr4 |= X86_CR4_PGE;
 
     cr4 |= d->arch.vtsc ? X86_CR4_TSD : 0;
@@ -533,7 +533,7 @@ void write_ptbase(struct vcpu *v)
               ? pv_guest_cr4_to_real_cr4(v)
               : ((read_cr4() & ~(X86_CR4_PCIDE | X86_CR4_TSD)) | X86_CR4_PGE);
 
-    if ( is_pv_vcpu(v) && v->domain->arch.pv_domain.xpti )
+    if ( is_pv_vcpu(v) && v->domain->arch.pv.xpti )
     {
         cpu_info->root_pgt_changed = true;
         cpu_info->pv_cr3 = __pa(this_cpu(root_pgt));
@@ -1753,7 +1753,7 @@ static int alloc_l4_table(struct page_info *page)
     {
         init_xen_l4_slots(pl4e, _mfn(pfn),
                           d, INVALID_MFN, VM_ASSIST(d, m2p_strict));
-        atomic_inc(&d->arch.pv_domain.nr_l4_pages);
+        atomic_inc(&d->arch.pv.nr_l4_pages);
         rc = 0;
     }
     unmap_domain_page(pl4e);
@@ -1873,7 +1873,7 @@ static int free_l4_table(struct page_info *page)
 
     if ( rc >= 0 )
     {
-        atomic_dec(&d->arch.pv_domain.nr_l4_pages);
+        atomic_dec(&d->arch.pv.nr_l4_pages);
         rc = 0;
     }
 
@@ -3784,7 +3784,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc && pt_owner->arch.pv_domain.xpti )
+                    if ( !rc && pt_owner->arch.pv.xpti )
                     {
                         bool local_in_use = false;
 
xen/arch/x86/pv/dom0_build.c +2 -2
index 34c77bc..078288b 100644
@@ -387,8 +387,8 @@ int __init dom0_construct_pv(struct domain *d,
     if ( compat32 )
     {
         d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 1;
-        d->arch.pv_domain.xpti = false;
-        d->arch.pv_domain.pcid = false;
+        d->arch.pv.xpti = false;
+        d->arch.pv.pcid = false;
         v->vcpu_info = (void *)&d->shared_info->compat.vcpu_info[0];
         if ( setup_compat_arg_xlat(v) != 0 )
             BUG();
xen/arch/x86/pv/domain.c +16 -19
index 52108d4..454d580 100644
@@ -122,8 +122,8 @@ int switch_compat(struct domain *d)
 
     d->arch.x87_fip_width = 4;
 
-    d->arch.pv_domain.xpti = false;
-    d->arch.pv_domain.pcid = false;
+    d->arch.pv.xpti = false;
+    d->arch.pv.pcid = false;
 
     return 0;
 
@@ -142,7 +142,7 @@ static int pv_create_gdt_ldt_l1tab(struct vcpu *v)
 {
     return create_perdomain_mapping(v->domain, GDT_VIRT_START(v),
                                     1U << GDT_LDT_VCPU_SHIFT,
-                                    v->domain->arch.pv_domain.gdt_ldt_l1tab,
+                                    v->domain->arch.pv.gdt_ldt_l1tab,
                                     NULL);
 }
 
@@ -215,11 +215,9 @@ void pv_domain_destroy(struct domain *d)
     destroy_perdomain_mapping(d, GDT_LDT_VIRT_START,
                               GDT_LDT_MBYTES << (20 - PAGE_SHIFT));
 
-    xfree(d->arch.pv_domain.cpuidmasks);
-    d->arch.pv_domain.cpuidmasks = NULL;
+    XFREE(d->arch.pv.cpuidmasks);
 
-    free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab);
-    d->arch.pv_domain.gdt_ldt_l1tab = NULL;
+    FREE_XENHEAP_PAGE(d->arch.pv.gdt_ldt_l1tab);
 }
 
 
@@ -234,14 +232,14 @@ int pv_domain_initialise(struct domain *d)
 
     pv_l1tf_domain_init(d);
 
-    d->arch.pv_domain.gdt_ldt_l1tab =
+    d->arch.pv.gdt_ldt_l1tab =
         alloc_xenheap_pages(0, MEMF_node(domain_to_node(d)));
-    if ( !d->arch.pv_domain.gdt_ldt_l1tab )
+    if ( !d->arch.pv.gdt_ldt_l1tab )
         goto fail;
-    clear_page(d->arch.pv_domain.gdt_ldt_l1tab);
+    clear_page(d->arch.pv.gdt_ldt_l1tab);
 
     if ( levelling_caps & ~LCAP_faulting &&
-         (d->arch.pv_domain.cpuidmasks = xmemdup(&cpuidmask_defaults)) == NULL )
+         (d->arch.pv.cpuidmasks = xmemdup(&cpuidmask_defaults)) == NULL )
         goto fail;
 
     rc = create_perdomain_mapping(d, GDT_LDT_VIRT_START,
@@ -255,8 +253,8 @@ int pv_domain_initialise(struct domain *d)
     /* 64-bit PV guest by default. */
     d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0;
 
-    d->arch.pv_domain.xpti = opt_xpti & (is_hardware_domain(d)
-                                         ? OPT_XPTI_DOM0 : OPT_XPTI_DOMU);
+    d->arch.pv.xpti = opt_xpti & (is_hardware_domain(d)
+                                  ? OPT_XPTI_DOM0 : OPT_XPTI_DOMU);
 
     if ( !is_pv_32bit_domain(d) && use_invpcid && cpu_has_pcid )
         switch ( opt_pcid )
@@ -265,15 +263,15 @@ int pv_domain_initialise(struct domain *d)
             break;
 
         case PCID_ALL:
-            d->arch.pv_domain.pcid = true;
+            d->arch.pv.pcid = true;
             break;
 
         case PCID_XPTI:
-            d->arch.pv_domain.pcid = d->arch.pv_domain.xpti;
+            d->arch.pv.pcid = d->arch.pv.xpti;
             break;
 
         case PCID_NOXPTI:
-            d->arch.pv_domain.pcid = !d->arch.pv_domain.xpti;
+            d->arch.pv.pcid = !d->arch.pv.xpti;
             break;
 
         default:
@@ -295,14 +293,13 @@ static void _toggle_guest_pt(struct vcpu *v)
 
     v->arch.flags ^= TF_kernel_mode;
     update_cr3(v);
-    if ( d->arch.pv_domain.xpti )
+    if ( d->arch.pv.xpti )
     {
         struct cpu_info *cpu_info = get_cpu_info();
 
         cpu_info->root_pgt_changed = true;
         cpu_info->pv_cr3 = __pa(this_cpu(root_pgt)) |
-                           (d->arch.pv_domain.pcid
-                            ? get_pcid_bits(v, true) : 0);
+                           (d->arch.pv.pcid ? get_pcid_bits(v, true) : 0);
     }
 
     /* Don't flush user global mappings from the TLB. Don't tick TLB clock. */
xen/include/asm-x86/domain.h +2 -2
index 09f6b3d..0c75c02 100644
@@ -305,7 +305,7 @@ struct arch_domain
     struct list_head pdev_list;
 
     union {
-        struct pv_domain pv_domain;
+        struct pv_domain pv;
         struct hvm_domain hvm_domain;
     };
 
@@ -458,7 +458,7 @@ struct arch_domain
 #define gdt_ldt_pt_idx(v) \
       ((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT))
 #define pv_gdt_ptes(v) \
-    ((v)->domain->arch.pv_domain.gdt_ldt_l1tab[gdt_ldt_pt_idx(v)] + \
+    ((v)->domain->arch.pv.gdt_ldt_l1tab[gdt_ldt_pt_idx(v)] + \
      (((v)->vcpu_id << GDT_LDT_VCPU_SHIFT) & (L1_PAGETABLE_ENTRIES - 1)))
 #define pv_ldt_ptes(v) (pv_gdt_ptes(v) + 16)
 
xen/include/asm-x86/flushtlb.h +1 -1
index ed5f45e..434821a 100644
@@ -138,7 +138,7 @@ void flush_area_mask(const cpumask_t *, const void *va, unsigned int flags);
 
 #define flush_root_pgtbl_domain(d)                                       \
 {                                                                        \
-    if ( is_pv_domain(d) && (d)->arch.pv_domain.xpti )                   \
+    if ( is_pv_domain(d) && (d)->arch.pv.xpti )                          \
         flush_mask((d)->dirty_cpumask, FLUSH_ROOT_PGTBL);                \
 }
 
xen/include/asm-x86/shadow.h +2 -2
index f40f411..b3ebe56 100644
@@ -169,7 +169,7 @@ static inline bool pv_l1tf_check_pte(struct domain *d, unsigned int level,
     ASSERT(is_pv_domain(d));
     ASSERT(!(pte & _PAGE_PRESENT));
 
-    if ( d->arch.pv_domain.check_l1tf && !paging_mode_sh_forced(d) &&
+    if ( d->arch.pv.check_l1tf && !paging_mode_sh_forced(d) &&
          (((level > 1) && (pte & _PAGE_PSE)) || !is_l1tf_safe_maddr(pte)) )
     {
 #ifdef CONFIG_SHADOW_PAGING
@@ -224,7 +224,7 @@ void pv_l1tf_tasklet(unsigned long data);
 
 static inline void pv_l1tf_domain_init(struct domain *d)
 {
-    d->arch.pv_domain.check_l1tf =
+    d->arch.pv.check_l1tf =
         opt_pv_l1tf & (is_hardware_domain(d)
                        ? OPT_PV_L1TF_DOM0 : OPT_PV_L1TF_DOMU);
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] x86/pv: Rename d->arch.pv_domain to d->arch.pv

Quoted 8 lines · Andrew Cooper

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/7
#3 lore raw

Re: [PATCH 1/7] x86/pv: Rename d->arch.pv_domain to d->arch.pv

In reply to Andrew Cooper
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

I've long wanted to do this, but didn't dare to with the discussions we had during PVHv1 development, where some suggestions of mine to shorten names like this weren't really liked. So - thanks!

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

PATCH 2/7 x86/pv: Rename v->arch.pv_vcpu to v->arch.pv

In reply to Andrew Cooper

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/cpu/amd.c              |  2 +-
 xen/arch/x86/cpu/intel.c            |  2 +-
 xen/arch/x86/cpuid.c                |  6 +--
 xen/arch/x86/domain.c               | 88 ++++++++++++++++++-------------------
 xen/arch/x86/domain_page.c          |  6 +--
 xen/arch/x86/domctl.c               | 76 ++++++++++++++++----------------
 xen/arch/x86/i387.c                 |  2 +-
 xen/arch/x86/mm.c                   | 10 ++---
 xen/arch/x86/physdev.c              |  9 ++--
 xen/arch/x86/pv/callback.c          | 42 +++++++++---------
 xen/arch/x86/pv/descriptor-tables.c | 18 ++++----
 xen/arch/x86/pv/dom0_build.c        |  4 +-
 xen/arch/x86/pv/domain.c            | 30 ++++++-------
 xen/arch/x86/pv/emul-gate-op.c      |  4 +-
 xen/arch/x86/pv/emul-priv-op.c      | 42 +++++++++---------
 xen/arch/x86/pv/iret.c              | 10 ++---
 xen/arch/x86/pv/misc-hypercalls.c   |  4 +-
 xen/arch/x86/pv/mm.c                | 10 ++---
 xen/arch/x86/pv/traps.c             | 10 ++---
 xen/arch/x86/time.c                 |  2 +-
 xen/arch/x86/traps.c                | 24 +++++-----
 xen/arch/x86/x86_64/asm-offsets.c   | 28 ++++++------
 xen/arch/x86/x86_64/entry.S         |  2 +-
 xen/arch/x86/x86_64/mm.c            | 10 ++---
 xen/arch/x86/x86_64/traps.c         | 10 ++---
 xen/arch/x86/x86_emulate.c          |  2 +-
 xen/include/asm-x86/domain.h        |  2 +-
 xen/include/asm-x86/ldt.h           |  2 +-
 xen/include/asm-x86/pv/traps.h      |  2 +-
 29 files changed, 227 insertions(+), 232 deletions(-)
xen/arch/x86/cpu/amd.c +1 -1
index e0ee114..c394c1c 100644
@@ -220,7 +220,7 @@ static void amd_ctxt_switch_masking(const struct vcpu *next)
 		 * kernel.
 		 */
 		if (next && is_pv_vcpu(next) && !is_idle_vcpu(next) &&
-		    !(next->arch.pv_vcpu.ctrlreg[4] & X86_CR4_OSXSAVE))
+		    !(next->arch.pv.ctrlreg[4] & X86_CR4_OSXSAVE))
 			val &= ~((uint64_t)cpufeat_mask(X86_FEATURE_OSXSAVE) << 32);
 
 		if (unlikely(these_masks->_1cd != val)) {
xen/arch/x86/cpu/intel.c +1 -1
index 8c375c8..65fa3d6 100644
@@ -131,7 +131,7 @@ static void intel_ctxt_switch_masking(const struct vcpu *next)
 		 * kernel.
 		 */
 		if (next && is_pv_vcpu(next) && !is_idle_vcpu(next) &&
-		    !(next->arch.pv_vcpu.ctrlreg[4] & X86_CR4_OSXSAVE))
+		    !(next->arch.pv.ctrlreg[4] & X86_CR4_OSXSAVE))
 			val &= ~(uint64_t)cpufeat_mask(X86_FEATURE_OSXSAVE);
 
 		if (unlikely(these_masks->_1cd != val)) {
xen/arch/x86/cpuid.c +3 -3
index 88694ed..24366ea 100644
@@ -841,7 +841,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
              *
              * Architecturally, the correct code here is simply:
              *
-             *   if ( v->arch.pv_vcpu.ctrlreg[4] & X86_CR4_OSXSAVE )
+             *   if ( v->arch.pv.ctrlreg[4] & X86_CR4_OSXSAVE )
              *       c |= cpufeat_mask(X86_FEATURE_OSXSAVE);
              *
              * However because of bugs in Xen (before c/s bd19080b, Nov 2010,
@@ -887,7 +887,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
              *    #UD or #GP is currently being serviced.
              */
             /* OSXSAVE clear in policy.  Fast-forward CR4 back in. */
-            if ( (v->arch.pv_vcpu.ctrlreg[4] & X86_CR4_OSXSAVE) ||
+            if ( (v->arch.pv.ctrlreg[4] & X86_CR4_OSXSAVE) ||
                  (regs->entry_vector == TRAP_invalid_op &&
                   guest_kernel_mode(v, regs) &&
                   (read_cr4() & X86_CR4_OSXSAVE)) )
@@ -959,7 +959,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         case 0:
             /* OSPKE clear in policy.  Fast-forward CR4 back in. */
             if ( (is_pv_domain(d)
-                  ? v->arch.pv_vcpu.ctrlreg[4]
+                  ? v->arch.pv.ctrlreg[4]
                   : v->arch.hvm_vcpu.guest_cr[4]) & X86_CR4_PKE )
                 res->c |= cpufeat_mask(X86_FEATURE_OSPKE);
             break;
xen/arch/x86/domain.c +44 -44

201 lines not on this page · raw message

xen/arch/x86/domain_page.c +3 -3
index 15ba6f5..5c30c62 100644
@@ -86,7 +86,7 @@ void *map_domain_page(mfn_t mfn)
         return mfn_to_virt(mfn_x(mfn));
 
     dcache = &v->domain->arch.pv.mapcache;
-    vcache = &v->arch.pv_vcpu.mapcache;
+    vcache = &v->arch.pv.mapcache;
     if ( !dcache->inuse )
         return mfn_to_virt(mfn_x(mfn));
 
@@ -194,7 +194,7 @@ void unmap_domain_page(const void *ptr)
 
     idx = PFN_DOWN(va - MAPCACHE_VIRT_START);
     mfn = l1e_get_pfn(MAPCACHE_L1ENT(idx));
-    hashent = &v->arch.pv_vcpu.mapcache.hash[MAPHASH_HASHFN(mfn)];
+    hashent = &v->arch.pv.mapcache.hash[MAPHASH_HASHFN(mfn)];
 
     local_irq_save(flags);
 
@@ -293,7 +293,7 @@ int mapcache_vcpu_init(struct vcpu *v)
     BUILD_BUG_ON(MAPHASHENT_NOTINUSE < MAPCACHE_ENTRIES);
     for ( i = 0; i < MAPHASH_ENTRIES; i++ )
     {
-        struct vcpu_maphash_entry *hashent = &v->arch.pv_vcpu.mapcache.hash[i];
+        struct vcpu_maphash_entry *hashent = &v->arch.pv.mapcache.hash[i];
 
         hashent->mfn = ~0UL; /* never valid to map */
         hashent->idx = MAPHASHENT_NOTINUSE;
xen/arch/x86/domctl.c +38 -38

162 lines not on this page · raw message

xen/arch/x86/i387.c +1 -1
index 00cf6bd..8817848 100644
@@ -233,7 +233,7 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
         v->fpu_dirtied = 1;
 
         /* Xen doesn't need TS set, but the guest might. */
-        need_stts = is_pv_vcpu(v) && (v->arch.pv_vcpu.ctrlreg[0] & X86_CR0_TS);
+        need_stts = is_pv_vcpu(v) && (v->arch.pv.ctrlreg[0] & X86_CR0_TS);
     }
     else
     {
xen/arch/x86/mm.c +5 -5
index 26c4551..6a882e7 100644
@@ -510,7 +510,7 @@ unsigned long pv_guest_cr4_to_real_cr4(const struct vcpu *v)
     const struct domain *d = v->domain;
     unsigned long cr4;
 
-    cr4 = v->arch.pv_vcpu.ctrlreg[4] & ~X86_CR4_DE;
+    cr4 = v->arch.pv.ctrlreg[4] & ~X86_CR4_DE;
     cr4 |= mmu_cr4_features & (X86_CR4_PSE | X86_CR4_SMEP | X86_CR4_SMAP |
                                X86_CR4_OSXSAVE | X86_CR4_FSGSBASE);
 
@@ -3468,14 +3468,14 @@ long do_mmuext_op(
                          "Bad args to SET_LDT: ptr=%lx, ents=%x\n", ptr, ents);
                 rc = -EINVAL;
             }
-            else if ( (curr->arch.pv_vcpu.ldt_ents != ents) ||
-                      (curr->arch.pv_vcpu.ldt_base != ptr) )
+            else if ( (curr->arch.pv.ldt_ents != ents) ||
+                      (curr->arch.pv.ldt_base != ptr) )
             {
                 if ( pv_destroy_ldt(curr) )
                     flush_tlb_local();
 
-                curr->arch.pv_vcpu.ldt_base = ptr;
-                curr->arch.pv_vcpu.ldt_ents = ents;
+                curr->arch.pv.ldt_base = ptr;
+                curr->arch.pv.ldt_ents = ents;
                 load_LDT(curr);
             }
             break;
xen/arch/x86/physdev.c +4 -5
index b87ec90..4524823 100644
@@ -412,7 +412,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( set_iopl.iopl > 3 )
             break;
         ret = 0;
-        curr->arch.pv_vcpu.iopl = MASK_INSR(set_iopl.iopl, X86_EFLAGS_IOPL);
+        curr->arch.pv.iopl = MASK_INSR(set_iopl.iopl, X86_EFLAGS_IOPL);
         break;
     }
 
@@ -429,12 +429,11 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
         ret = 0;
 #ifndef COMPAT
-        curr->arch.pv_vcpu.iobmp = set_iobitmap.bitmap;
+        curr->arch.pv.iobmp = set_iobitmap.bitmap;
 #else
-        guest_from_compat_handle(curr->arch.pv_vcpu.iobmp,
-                                 set_iobitmap.bitmap);
+        guest_from_compat_handle(curr->arch.pv.iobmp, set_iobitmap.bitmap);
 #endif
-        curr->arch.pv_vcpu.iobmp_limit = set_iobitmap.nr_ports;
+        curr->arch.pv.iobmp_limit = set_iobitmap.nr_ports;
         break;
     }
 
xen/arch/x86/pv/callback.c +21 -21

110 lines not on this page · raw message

xen/arch/x86/pv/descriptor-tables.c +9 -9
index 71bf927..9b84cbe 100644
@@ -37,9 +37,9 @@ bool pv_destroy_ldt(struct vcpu *v)
 
     ASSERT(!in_irq());
 
-    spin_lock(&v->arch.pv_vcpu.shadow_ldt_lock);
+    spin_lock(&v->arch.pv.shadow_ldt_lock);
 
-    if ( v->arch.pv_vcpu.shadow_ldt_mapcnt == 0 )
+    if ( v->arch.pv.shadow_ldt_mapcnt == 0 )
         goto out;
 
     pl1e = pv_ldt_ptes(v);
@@ -58,11 +58,11 @@ bool pv_destroy_ldt(struct vcpu *v)
         put_page_and_type(page);
     }
 
-    ASSERT(v->arch.pv_vcpu.shadow_ldt_mapcnt == mappings_dropped);
-    v->arch.pv_vcpu.shadow_ldt_mapcnt = 0;
+    ASSERT(v->arch.pv.shadow_ldt_mapcnt == mappings_dropped);
+    v->arch.pv.shadow_ldt_mapcnt = 0;
 
  out:
-    spin_unlock(&v->arch.pv_vcpu.shadow_ldt_lock);
+    spin_unlock(&v->arch.pv.shadow_ldt_lock);
 
     return mappings_dropped;
 }
@@ -74,7 +74,7 @@ void pv_destroy_gdt(struct vcpu *v)
     l1_pgentry_t zero_l1e = l1e_from_mfn(zero_mfn, __PAGE_HYPERVISOR_RO);
     unsigned int i;
 
-    v->arch.pv_vcpu.gdt_ents = 0;
+    v->arch.pv.gdt_ents = 0;
     for ( i = 0; i < FIRST_RESERVED_GDT_PAGE; i++ )
     {
         mfn_t mfn = l1e_get_mfn(pl1e[i]);
@@ -84,7 +84,7 @@ void pv_destroy_gdt(struct vcpu *v)
             put_page_and_type(mfn_to_page(mfn));
 
         l1e_write(&pl1e[i], zero_l1e);
-        v->arch.pv_vcpu.gdt_frames[i] = 0;
+        v->arch.pv.gdt_frames[i] = 0;
     }
 }
 
@@ -117,11 +117,11 @@ long pv_set_gdt(struct vcpu *v, unsigned long *frames, unsigned int entries)
     pv_destroy_gdt(v);
 
     /* Install the new GDT. */
-    v->arch.pv_vcpu.gdt_ents = entries;
+    v->arch.pv.gdt_ents = entries;
     pl1e = pv_gdt_ptes(v);
     for ( i = 0; i < nr_frames; i++ )
     {
-        v->arch.pv_vcpu.gdt_frames[i] = frames[i];
+        v->arch.pv.gdt_frames[i] = frames[i];
         l1e_write(&pl1e[i], l1e_from_pfn(frames[i], __PAGE_HYPERVISOR_RW));
     }
 
xen/arch/x86/pv/dom0_build.c +2 -2
index 078288b..96ff0ee 100644
@@ -589,8 +589,8 @@ int __init dom0_construct_pv(struct domain *d,
 
     if ( is_pv_32bit_domain(d) )
     {
-        v->arch.pv_vcpu.failsafe_callback_cs = FLAT_COMPAT_KERNEL_CS;
-        v->arch.pv_vcpu.event_callback_cs    = FLAT_COMPAT_KERNEL_CS;
+        v->arch.pv.failsafe_callback_cs = FLAT_COMPAT_KERNEL_CS;
+        v->arch.pv.event_callback_cs    = FLAT_COMPAT_KERNEL_CS;
     }
 
     /* WARNING: The new domain must have its 'processor' field filled in! */
xen/arch/x86/pv/domain.c +13 -17
index 454d580..d52e640 100644
@@ -161,8 +161,7 @@ void pv_vcpu_destroy(struct vcpu *v)
     }
 
     pv_destroy_gdt_ldt_l1tab(v);
-    xfree(v->arch.pv_vcpu.trap_ctxt);
-    v->arch.pv_vcpu.trap_ctxt = NULL;
+    XFREE(v->arch.pv.trap_ctxt);
 }
 
 int pv_vcpu_initialise(struct vcpu *v)
@@ -172,17 +171,16 @@ int pv_vcpu_initialise(struct vcpu *v)
 
     ASSERT(!is_idle_domain(d));
 
-    spin_lock_init(&v->arch.pv_vcpu.shadow_ldt_lock);
+    spin_lock_init(&v->arch.pv.shadow_ldt_lock);
 
     rc = pv_create_gdt_ldt_l1tab(v);
     if ( rc )
         return rc;
 
-    BUILD_BUG_ON(NR_VECTORS * sizeof(*v->arch.pv_vcpu.trap_ctxt) >
+    BUILD_BUG_ON(NR_VECTORS * sizeof(*v->arch.pv.trap_ctxt) >
                  PAGE_SIZE);
-    v->arch.pv_vcpu.trap_ctxt = xzalloc_array(struct trap_info,
-                                              NR_VECTORS);
-    if ( !v->arch.pv_vcpu.trap_ctxt )
+    v->arch.pv.trap_ctxt = xzalloc_array(struct trap_info, NR_VECTORS);
+    if ( !v->arch.pv.trap_ctxt )
     {
         rc = -ENOMEM;
         goto done;
@@ -191,7 +189,7 @@ int pv_vcpu_initialise(struct vcpu *v)
     /* PV guests by default have a 100Hz ticker. */
     v->periodic_period = MILLISECS(10);
 
-    v->arch.pv_vcpu.ctrlreg[4] = real_cr4_to_pv_guest_cr4(mmu_cr4_features);
+    v->arch.pv.ctrlreg[4] = real_cr4_to_pv_guest_cr4(mmu_cr4_features);
 
     if ( is_pv_32bit_domain(d) )
     {
@@ -308,14 +306,12 @@ static void _toggle_guest_pt(struct vcpu *v)
     if ( !(v->arch.flags & TF_kernel_mode) )
         return;
 
-    if ( v->arch.pv_vcpu.need_update_runstate_area &&
-         update_runstate_area(v) )
-        v->arch.pv_vcpu.need_update_runstate_area = 0;
+    if ( v->arch.pv.need_update_runstate_area && update_runstate_area(v) )
+        v->arch.pv.need_update_runstate_area = 0;
 
-    if ( v->arch.pv_vcpu.pending_system_time.version &&
-         update_secondary_system_time(v,
-                                      &v->arch.pv_vcpu.pending_system_time) )
-        v->arch.pv_vcpu.pending_system_time.version = 0;
+    if ( v->arch.pv.pending_system_time.version &&
+         update_secondary_system_time(v, &v->arch.pv.pending_system_time) )
+        v->arch.pv.pending_system_time.version = 0;
 }
 
 void toggle_guest_mode(struct vcpu *v)
@@ -325,9 +321,9 @@ void toggle_guest_mode(struct vcpu *v)
     if ( cpu_has_fsgsbase )
     {
         if ( v->arch.flags & TF_kernel_mode )
-            v->arch.pv_vcpu.gs_base_kernel = __rdgsbase();
+            v->arch.pv.gs_base_kernel = __rdgsbase();
         else
-            v->arch.pv_vcpu.gs_base_user = __rdgsbase();
+            v->arch.pv.gs_base_user = __rdgsbase();
     }
     asm volatile ( "swapgs" );
 
xen/arch/x86/pv/emul-gate-op.c +2 -2
index 810c4f7..d1c8aa6 100644
@@ -324,8 +324,8 @@ void pv_emulate_gate_op(struct cpu_user_regs *regs)
                 pv_inject_hw_exception(TRAP_gp_fault, regs->error_code);
                 return;
             }
-            esp = v->arch.pv_vcpu.kernel_sp;
-            ss = v->arch.pv_vcpu.kernel_ss;
+            esp = v->arch.pv.kernel_sp;
+            ss = v->arch.pv.kernel_ss;
             if ( (ss & 3) != (sel & 3) ||
                  !pv_emul_read_descriptor(ss, v, &base, &limit, &ar, 0) ||
                  ((ar >> 13) & 3) != (sel & 3) ||
xen/arch/x86/pv/emul-priv-op.c +21 -21

159 lines not on this page · raw message

xen/arch/x86/pv/iret.c +5 -5
index ca433a6..c359a1d 100644
@@ -51,7 +51,7 @@ unsigned long do_iret(void)
     }
 
     if ( VM_ASSIST(v->domain, architectural_iopl) )
-        v->arch.pv_vcpu.iopl = iret_saved.rflags & X86_EFLAGS_IOPL;
+        v->arch.pv.iopl = iret_saved.rflags & X86_EFLAGS_IOPL;
 
     regs->rip    = iret_saved.rip;
     regs->cs     = iret_saved.cs | 3; /* force guest privilege */
@@ -115,7 +115,7 @@ unsigned int compat_iret(void)
     }
 
     if ( VM_ASSIST(v->domain, architectural_iopl) )
-        v->arch.pv_vcpu.iopl = eflags & X86_EFLAGS_IOPL;
+        v->arch.pv.iopl = eflags & X86_EFLAGS_IOPL;
 
     regs->eflags = (eflags & ~X86_EFLAGS_IOPL) | X86_EFLAGS_IF;
 
@@ -130,7 +130,7 @@ unsigned int compat_iret(void)
          * mode frames).
          */
         const struct trap_info *ti;
-        u32 x, ksp = v->arch.pv_vcpu.kernel_sp - 40;
+        u32 x, ksp = v->arch.pv.kernel_sp - 40;
         unsigned int i;
         int rc = 0;
 
@@ -158,9 +158,9 @@ unsigned int compat_iret(void)
             return 0;
         }
         regs->esp = ksp;
-        regs->ss = v->arch.pv_vcpu.kernel_ss;
+        regs->ss = v->arch.pv.kernel_ss;
 
-        ti = &v->arch.pv_vcpu.trap_ctxt[TRAP_gp_fault];
+        ti = &v->arch.pv.trap_ctxt[TRAP_gp_fault];
         if ( TI_GET_IF(ti) )
             eflags &= ~X86_EFLAGS_IF;
         regs->eflags &= ~(X86_EFLAGS_VM|X86_EFLAGS_RF|
xen/arch/x86/pv/misc-hypercalls.c +2 -2
index 1619be7..9f61f3d 100644
@@ -42,12 +42,12 @@ long do_fpu_taskswitch(int set)
 
     if ( set )
     {
-        v->arch.pv_vcpu.ctrlreg[0] |= X86_CR0_TS;
+        v->arch.pv.ctrlreg[0] |= X86_CR0_TS;
         stts();
     }
     else
     {
-        v->arch.pv_vcpu.ctrlreg[0] &= ~X86_CR0_TS;
+        v->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
         if ( v->fpu_dirtied )
             clts();
     }
xen/arch/x86/pv/mm.c +5 -5
index b46fd94..e9156ea 100644
@@ -87,7 +87,7 @@ bool pv_map_ldt_shadow_page(unsigned int offset)
     struct domain *currd = curr->domain;
     struct page_info *page;
     l1_pgentry_t gl1e, *pl1e;
-    unsigned long linear = curr->arch.pv_vcpu.ldt_base + offset;
+    unsigned long linear = curr->arch.pv.ldt_base + offset;
 
     BUG_ON(unlikely(in_irq()));
 
@@ -97,7 +97,7 @@ bool pv_map_ldt_shadow_page(unsigned int offset)
      * current vcpu, and vcpu_reset() will block until this vcpu has been
      * descheduled before continuing.
      */
-    ASSERT((offset >> 3) <= curr->arch.pv_vcpu.ldt_ents);
+    ASSERT((offset >> 3) <= curr->arch.pv.ldt_ents);
 
     if ( is_pv_32bit_domain(currd) )
         linear = (uint32_t)linear;
@@ -119,10 +119,10 @@ bool pv_map_ldt_shadow_page(unsigned int offset)
     pl1e = &pv_ldt_ptes(curr)[offset >> PAGE_SHIFT];
     l1e_add_flags(gl1e, _PAGE_RW);
 
-    spin_lock(&curr->arch.pv_vcpu.shadow_ldt_lock);
+    spin_lock(&curr->arch.pv.shadow_ldt_lock);
     l1e_write(pl1e, gl1e);
-    curr->arch.pv_vcpu.shadow_ldt_mapcnt++;
-    spin_unlock(&curr->arch.pv_vcpu.shadow_ldt_lock);
+    curr->arch.pv.shadow_ldt_mapcnt++;
+    spin_unlock(&curr->arch.pv.shadow_ldt_lock);
 
     return true;
 }
xen/arch/x86/pv/traps.c +5 -5
index f48db92..1740784 100644
@@ -63,8 +63,8 @@ void pv_inject_event(const struct x86_event *event)
     else
         ASSERT(error_code == X86_EVENT_NO_EC);
 
-    tb = &curr->arch.pv_vcpu.trap_bounce;
-    ti = &curr->arch.pv_vcpu.trap_ctxt[vector];
+    tb = &curr->arch.pv.trap_bounce;
+    ti = &curr->arch.pv.trap_ctxt[vector];
 
     tb->flags = TBF_EXCEPTION;
     tb->cs    = ti->cs;
@@ -73,7 +73,7 @@ void pv_inject_event(const struct x86_event *event)
     if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
          vector == TRAP_page_fault )
     {
-        curr->arch.pv_vcpu.ctrlreg[2] = event->cr2;
+        curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
         /* Re-set error_code.user flag appropriately for the guest. */
@@ -113,7 +113,7 @@ void pv_inject_event(const struct x86_event *event)
 bool set_guest_machinecheck_trapbounce(void)
 {
     struct vcpu *curr = current;
-    struct trap_bounce *tb = &curr->arch.pv_vcpu.trap_bounce;
+    struct trap_bounce *tb = &curr->arch.pv.trap_bounce;
 
     pv_inject_hw_exception(TRAP_machine_check, X86_EVENT_NO_EC);
     tb->flags &= ~TBF_EXCEPTION; /* not needed for MCE delivery path */
@@ -128,7 +128,7 @@ bool set_guest_machinecheck_trapbounce(void)
 bool set_guest_nmi_trapbounce(void)
 {
     struct vcpu *curr = current;
-    struct trap_bounce *tb = &curr->arch.pv_vcpu.trap_bounce;
+    struct trap_bounce *tb = &curr->arch.pv.trap_bounce;
 
     pv_inject_hw_exception(TRAP_nmi, X86_EVENT_NO_EC);
     tb->flags &= ~TBF_EXCEPTION; /* not needed for NMI delivery path */
xen/arch/x86/time.c +1 -1
index 536449b..69e9aaf 100644
@@ -1099,7 +1099,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
 
     if ( !update_secondary_system_time(v, &_u) && is_pv_domain(d) &&
          !is_pv_32bit_domain(d) && !(v->arch.flags & TF_kernel_mode) )
-        v->arch.pv_vcpu.pending_system_time = _u;
+        v->arch.pv.pending_system_time = _u;
 }
 
 bool update_secondary_system_time(struct vcpu *v,
xen/arch/x86/traps.c +12 -12
index ddff346..7ca695c 100644
@@ -1145,7 +1145,7 @@ static int handle_ldt_mapping_fault(unsigned int offset,
 
         /* Access would have become non-canonical? Pass #GP[sel] back. */
         if ( unlikely(!is_canonical_address(
-                          curr->arch.pv_vcpu.ldt_base + offset)) )
+                          curr->arch.pv.ldt_base + offset)) )
         {
             uint16_t ec = (offset & ~(X86_XEC_EXT | X86_XEC_IDT)) | X86_XEC_TI;
 
@@ -1154,7 +1154,7 @@ static int handle_ldt_mapping_fault(unsigned int offset,
         else
             /* else pass the #PF back, with adjusted %cr2. */
             pv_inject_page_fault(regs->error_code,
-                                 curr->arch.pv_vcpu.ldt_base + offset);
+                                 curr->arch.pv.ldt_base + offset);
     }
 
     return EXCRET_fault_fixed;
@@ -1536,7 +1536,7 @@ void do_general_protection(struct cpu_user_regs *regs)
         /* This fault must be due to <INT n> instruction. */
         const struct trap_info *ti;
         unsigned char vector = regs->error_code >> 3;
-        ti = &v->arch.pv_vcpu.trap_ctxt[vector];
+        ti = &v->arch.pv.trap_ctxt[vector];
         if ( permit_softint(TI_GET_DPL(ti), v, regs) )
         {
             regs->rip += 2;
@@ -1768,10 +1768,10 @@ void do_device_not_available(struct cpu_user_regs *regs)
 
     vcpu_restore_fpu_lazy(curr);
 
-    if ( curr->arch.pv_vcpu.ctrlreg[0] & X86_CR0_TS )
+    if ( curr->arch.pv.ctrlreg[0] & X86_CR0_TS )
     {
         pv_inject_hw_exception(TRAP_no_device, X86_EVENT_NO_EC);
-        curr->arch.pv_vcpu.ctrlreg[0] &= ~X86_CR0_TS;
+        curr->arch.pv.ctrlreg[0] &= ~X86_CR0_TS;
     }
     else
         TRACE_0D(TRC_PV_MATH_STATE_RESTORE);
@@ -2073,10 +2073,10 @@ void activate_debugregs(const struct vcpu *curr)
 
     if ( boot_cpu_has(X86_FEATURE_DBEXT) )
     {
-        wrmsrl(MSR_AMD64_DR0_ADDRESS_MASK, curr->arch.pv_vcpu.dr_mask[0]);
-        wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, curr->arch.pv_vcpu.dr_mask[1]);
-        wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, curr->arch.pv_vcpu.dr_mask[2]);
-        wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, curr->arch.pv_vcpu.dr_mask[3]);
+        wrmsrl(MSR_AMD64_DR0_ADDRESS_MASK, curr->arch.pv.dr_mask[0]);
+        wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, curr->arch.pv.dr_mask[1]);
+        wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, curr->arch.pv.dr_mask[2]);
+        wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, curr->arch.pv.dr_mask[3]);
     }
 }
 
@@ -2109,7 +2109,7 @@ long set_debugreg(struct vcpu *v, unsigned int reg, unsigned long value)
         break;
 
     case 4:
-        if ( v->arch.pv_vcpu.ctrlreg[4] & X86_CR4_DE )
+        if ( v->arch.pv.ctrlreg[4] & X86_CR4_DE )
             return -ENODEV;
 
         /* Fallthrough */
@@ -2129,7 +2129,7 @@ long set_debugreg(struct vcpu *v, unsigned int reg, unsigned long value)
         break;
 
     case 5:
-        if ( v->arch.pv_vcpu.ctrlreg[4] & X86_CR4_DE )
+        if ( v->arch.pv.ctrlreg[4] & X86_CR4_DE )
             return -ENODEV;
 
         /* Fallthrough */
@@ -2160,7 +2160,7 @@ long set_debugreg(struct vcpu *v, unsigned int reg, unsigned long value)
             {
                 if ( ((value >> i) & 3) == DR_IO )
                 {
-                    if ( !(v->arch.pv_vcpu.ctrlreg[4] & X86_CR4_DE) )
+                    if ( !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
                         return -EPERM;
                     io_enable |= value & (3 << ((i - 16) >> 1));
                 }
xen/arch/x86/x86_64/asm-offsets.c +14 -14
index 18077af..26524c4 100644
@@ -52,28 +52,28 @@ void __dummy__(void)
     OFFSET(VCPU_processor, struct vcpu, processor);
     OFFSET(VCPU_domain, struct vcpu, domain);
     OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info);
-    OFFSET(VCPU_trap_bounce, struct vcpu, arch.pv_vcpu.trap_bounce);
+    OFFSET(VCPU_trap_bounce, struct vcpu, arch.pv.trap_bounce);
     OFFSET(VCPU_thread_flags, struct vcpu, arch.flags);
-    OFFSET(VCPU_event_addr, struct vcpu, arch.pv_vcpu.event_callback_eip);
-    OFFSET(VCPU_event_sel, struct vcpu, arch.pv_vcpu.event_callback_cs);
+    OFFSET(VCPU_event_addr, struct vcpu, arch.pv.event_callback_eip);
+    OFFSET(VCPU_event_sel, struct vcpu, arch.pv.event_callback_cs);
     OFFSET(VCPU_syscall_addr, struct vcpu,
-           arch.pv_vcpu.syscall_callback_eip);
+           arch.pv.syscall_callback_eip);
     OFFSET(VCPU_syscall32_addr, struct vcpu,
-           arch.pv_vcpu.syscall32_callback_eip);
+           arch.pv.syscall32_callback_eip);
     OFFSET(VCPU_syscall32_sel, struct vcpu,
-           arch.pv_vcpu.syscall32_callback_cs);
+           arch.pv.syscall32_callback_cs);
     OFFSET(VCPU_syscall32_disables_events, struct vcpu,
-           arch.pv_vcpu.syscall32_disables_events);
+           arch.pv.syscall32_disables_events);
     OFFSET(VCPU_sysenter_addr, struct vcpu,
-           arch.pv_vcpu.sysenter_callback_eip);
+           arch.pv.sysenter_callback_eip);
     OFFSET(VCPU_sysenter_sel, struct vcpu,
-           arch.pv_vcpu.sysenter_callback_cs);
+           arch.pv.sysenter_callback_cs);
     OFFSET(VCPU_sysenter_disables_events, struct vcpu,
-           arch.pv_vcpu.sysenter_disables_events);
-    OFFSET(VCPU_trap_ctxt, struct vcpu, arch.pv_vcpu.trap_ctxt);
-    OFFSET(VCPU_kernel_sp, struct vcpu, arch.pv_vcpu.kernel_sp);
-    OFFSET(VCPU_kernel_ss, struct vcpu, arch.pv_vcpu.kernel_ss);
-    OFFSET(VCPU_iopl, struct vcpu, arch.pv_vcpu.iopl);
+           arch.pv.sysenter_disables_events);
+    OFFSET(VCPU_trap_ctxt, struct vcpu, arch.pv.trap_ctxt);
+    OFFSET(VCPU_kernel_sp, struct vcpu, arch.pv.kernel_sp);
+    OFFSET(VCPU_kernel_ss, struct vcpu, arch.pv.kernel_ss);
+    OFFSET(VCPU_iopl, struct vcpu, arch.pv.iopl);
     OFFSET(VCPU_guest_context_flags, struct vcpu, arch.vgc_flags);
     OFFSET(VCPU_cr3, struct vcpu, arch.cr3);
     OFFSET(VCPU_arch_msrs, struct vcpu, arch.msrs);
xen/arch/x86/x86_64/entry.S +1 -1
index dab8c4f..48cb96c 100644
@@ -371,7 +371,7 @@ UNLIKELY_END(msi_check)
         mov   VCPU_domain(%rbx), %rax
 
         /*
-         * if ( null_trap_info(v, &v->arch.pv_vcpu.trap_ctxt[0x80]) )
+         * if ( null_trap_info(v, &v->arch.pv.trap_ctxt[0x80]) )
          *    goto int80_slow_path;
          */
         mov    0x80 * TRAPINFO_sizeof + TRAPINFO_eip(%rsi), %rdi
xen/arch/x86/x86_64/mm.c +5 -5
index cca4ae9..989a534 100644
@@ -1007,8 +1007,8 @@ long subarch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 long do_stack_switch(unsigned long ss, unsigned long esp)
 {
     fixup_guest_stack_selector(current->domain, ss);
-    current->arch.pv_vcpu.kernel_ss = ss;
-    current->arch.pv_vcpu.kernel_sp = esp;
+    current->arch.pv.kernel_ss = ss;
+    current->arch.pv.kernel_sp = esp;
     return 0;
 }
 
@@ -1026,7 +1026,7 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         if ( is_canonical_address(base) )
         {
             wrfsbase(base);
-            v->arch.pv_vcpu.fs_base = base;
+            v->arch.pv.fs_base = base;
         }
         else
             ret = -EINVAL;
@@ -1036,7 +1036,7 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         if ( is_canonical_address(base) )
         {
             wrgsshadow(base);
-            v->arch.pv_vcpu.gs_base_user = base;
+            v->arch.pv.gs_base_user = base;
         }
         else
             ret = -EINVAL;
@@ -1046,7 +1046,7 @@ long do_set_segment_base(unsigned int which, unsigned long base)
         if ( is_canonical_address(base) )
         {
             wrgsbase(base);
-            v->arch.pv_vcpu.gs_base_kernel = base;
+            v->arch.pv.gs_base_kernel = base;
         }
         else
             ret = -EINVAL;
xen/arch/x86/x86_64/traps.c +5 -5
index ed02b78..606b1b0 100644
@@ -169,15 +169,15 @@ void vcpu_show_registers(const struct vcpu *v)
     if ( !is_pv_vcpu(v) )
         return;
 
-    crs[0] = v->arch.pv_vcpu.ctrlreg[0];
+    crs[0] = v->arch.pv.ctrlreg[0];
     crs[2] = arch_get_cr2(v);
     crs[3] = pagetable_get_paddr(kernel ?
                                  v->arch.guest_table :
                                  v->arch.guest_table_user);
-    crs[4] = v->arch.pv_vcpu.ctrlreg[4];
-    crs[5] = v->arch.pv_vcpu.fs_base;
-    crs[6 + !kernel] = v->arch.pv_vcpu.gs_base_kernel;
-    crs[7 - !kernel] = v->arch.pv_vcpu.gs_base_user;
+    crs[4] = v->arch.pv.ctrlreg[4];
+    crs[5] = v->arch.pv.fs_base;
+    crs[6 + !kernel] = v->arch.pv.gs_base_kernel;
+    crs[7 - !kernel] = v->arch.pv.gs_base_user;
 
     _show_registers(regs, crs, CTXT_pv_guest, v);
 }
xen/arch/x86/x86_emulate.c +1 -1
index 30f89ad..532b7e0 100644
@@ -111,7 +111,7 @@ int x86emul_read_dr(unsigned int reg, unsigned long *val,
         break;
 
     case 4 ... 5:
-        if ( !(curr->arch.pv_vcpu.ctrlreg[4] & X86_CR4_DE) )
+        if ( !(curr->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         {
             *val = curr->arch.debugreg[reg + 2];
             break;
xen/include/asm-x86/domain.h +1 -1
index 0c75c02..fdd6856 100644
@@ -540,7 +540,7 @@ struct arch_vcpu
 
     /* Virtual Machine Extensions */
     union {
-        struct pv_vcpu pv_vcpu;
+        struct pv_vcpu pv;
         struct hvm_vcpu hvm_vcpu;
     };
 
xen/include/asm-x86/ldt.h +1 -1
index 589daf8..a6236b2 100644
@@ -9,7 +9,7 @@ static inline void load_LDT(struct vcpu *v)
     struct desc_struct *desc;
     unsigned long ents;
 
-    if ( (ents = v->arch.pv_vcpu.ldt_ents) == 0 )
+    if ( (ents = v->arch.pv.ldt_ents) == 0 )
         lldt(0);
     else
     {
xen/include/asm-x86/pv/traps.h +1 -1
index 89985d1..fcc75f5 100644
@@ -37,7 +37,7 @@ bool pv_emulate_invalid_op(struct cpu_user_regs *regs);
 static inline bool pv_trap_callback_registered(const struct vcpu *v,
                                                uint8_t vector)
 {
-    return v->arch.pv_vcpu.trap_ctxt[vector].address;
+    return v->arch.pv.trap_ctxt[vector].address;
 }
 
 #else  /* !CONFIG_PV */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 2/7
#5 lore raw

Re: [PATCH 2/7] x86/pv: Rename v->arch.pv_vcpu to v->arch.pv

Quoted 8 lines · Andrew Cooper

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 2/7
#6 lore raw

Re: [PATCH 2/7] x86/pv: Rename v->arch.pv_vcpu to v->arch.pv

In reply to Andrew Cooper

xen/arch/x86/pv/callback.c static long register_guest_callback(struct callback_register *reg) · line 79

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:
xen/arch/x86/pv/callback.c +1 -1
@@ -76,11 +76,11 @@ static long register_guest_callback(struct callback_register *reg)
     switch ( reg->type )
     {
     case CALLBACKTYPE_event:
-        curr->arch.pv_vcpu.event_callback_eip    = reg->address;
+        curr->arch.pv.event_callback_eip    = reg->address;

Would you mind dropping the stray extra blanks? Also further down in this same file.

In any event

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

PATCH 3/7 xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

In reply to Andrew Cooper

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Razvan Cojocaru <[email protected]>
CC: Tamas K Lengyel <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>

---
 xen/arch/arm/domain_build.c         |   2 +-
 xen/arch/arm/hvm.c                  |   4 +-
 xen/arch/x86/domain.c               |   2 +-
 xen/arch/x86/domctl.c               |  10 +--
 xen/arch/x86/hvm/dom0_build.c       |   4 +-
 xen/arch/x86/hvm/domain.c           |   2 +-
 xen/arch/x86/hvm/hpet.c             |   8 +-
 xen/arch/x86/hvm/hvm.c              | 145 +++++++++++++++++-------------------
 xen/arch/x86/hvm/hypercall.c        |   6 +-
 xen/arch/x86/hvm/intercept.c        |  14 ++--
 xen/arch/x86/hvm/io.c               |  48 ++++++------
 xen/arch/x86/hvm/ioreq.c            |  80 ++++++++++----------
 xen/arch/x86/hvm/irq.c              |  50 ++++++-------
 xen/arch/x86/hvm/mtrr.c             |  14 ++--
 xen/arch/x86/hvm/pmtimer.c          |  40 +++++-----
 xen/arch/x86/hvm/rtc.c              |   4 +-
 xen/arch/x86/hvm/save.c             |   6 +-
 xen/arch/x86/hvm/stdvga.c           |  18 ++---
 xen/arch/x86/hvm/svm/svm.c          |   5 +-
 xen/arch/x86/hvm/svm/vmcb.c         |   2 +-
 xen/arch/x86/hvm/vioapic.c          |  44 +++++------
 xen/arch/x86/hvm/viridian.c         |  56 +++++++-------
 xen/arch/x86/hvm/vlapic.c           |   8 +-
 xen/arch/x86/hvm/vmsi.c             |  14 ++--
 xen/arch/x86/hvm/vmx/vmcs.c         |  12 +--
 xen/arch/x86/hvm/vmx/vmx.c          |  46 ++++++------
 xen/arch/x86/hvm/vpic.c             |  20 ++---
 xen/arch/x86/hvm/vpt.c              |  20 ++---
 xen/arch/x86/irq.c                  |  10 +--
 xen/arch/x86/mm/hap/hap.c           |  11 ++-
 xen/arch/x86/mm/mem_sharing.c       |   6 +-
 xen/arch/x86/mm/shadow/common.c     |  18 ++---
 xen/arch/x86/mm/shadow/multi.c      |   8 +-
 xen/arch/x86/physdev.c              |   2 +-
 xen/arch/x86/setup.c                |  10 +--
 xen/arch/x86/time.c                 |   8 +-
 xen/common/vm_event.c               |   2 +-
 xen/drivers/passthrough/pci.c       |   2 +-
 xen/drivers/vpci/msix.c             |   6 +-
 xen/include/asm-arm/domain.h        |   2 +-
 xen/include/asm-x86/domain.h        |   4 +-
 xen/include/asm-x86/hvm/domain.h    |   2 +-
 xen/include/asm-x86/hvm/hvm.h       |  11 ++-
 xen/include/asm-x86/hvm/irq.h       |   2 +-
 xen/include/asm-x86/hvm/nestedhvm.h |   4 +-
 xen/include/asm-x86/hvm/vioapic.h   |   2 +-
 xen/include/asm-x86/hvm/vpt.h       |   4 +-
 xen/include/asm-x86/irq.h           |   3 +-
 48 files changed, 395 insertions(+), 406 deletions(-)
xen/arch/arm/domain_build.c +1 -1
index e1c79b2..72fd2ae 100644
@@ -2075,7 +2075,7 @@ static void __init evtchn_allocate(struct domain *d)
     val |= MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL,
                      HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK);
     val |= d->arch.evtchn_irq;
-    d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val;
+    d->arch.hvm.params[HVM_PARAM_CALLBACK_IRQ] = val;
 }
 
 static void __init find_gnttab_region(struct domain *d,
xen/arch/arm/hvm.c +2 -2
index a56b3fe..76b27c9 100644
@@ -59,11 +59,11 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         if ( op == HVMOP_set_param )
         {
-            d->arch.hvm_domain.params[a.index] = a.value;
+            d->arch.hvm.params[a.index] = a.value;
         }
         else
         {
-            a.value = d->arch.hvm_domain.params[a.index];
+            a.value = d->arch.hvm.params[a.index];
             rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
         }
 
xen/arch/x86/domain.c +1 -1
index 4cdcd5d..3dcd7f9 100644
@@ -505,7 +505,7 @@ int arch_domain_create(struct domain *d,
 
     /* Need to determine if HAP is enabled before initialising paging */
     if ( is_hvm_domain(d) )
-        d->arch.hvm_domain.hap_enabled =
+        d->arch.hvm.hap_enabled =
             hvm_hap_supported() && (config->flags & XEN_DOMCTL_CDF_hap);
 
     if ( (rc = paging_domain_init(d, config->flags)) != 0 )
xen/arch/x86/domctl.c +5 -5
index fdbcce0..f306614 100644
@@ -745,7 +745,7 @@ long arch_do_domctl(
         unsigned int fmp = domctl->u.ioport_mapping.first_mport;
         unsigned int np = domctl->u.ioport_mapping.nr_ports;
         unsigned int add = domctl->u.ioport_mapping.add_mapping;
-        struct hvm_domain *hvm_domain;
+        struct hvm_domain *hvm;
         struct g2m_ioport *g2m_ioport;
         int found = 0;
 
@@ -774,14 +774,14 @@ long arch_do_domctl(
         if ( ret )
             break;
 
-        hvm_domain = &d->arch.hvm_domain;
+        hvm = &d->arch.hvm;
         if ( add )
         {
             printk(XENLOG_G_INFO
                    "ioport_map:add: dom%d gport=%x mport=%x nr=%x\n",
                    d->domain_id, fgp, fmp, np);
 
-            list_for_each_entry(g2m_ioport, &hvm_domain->g2m_ioport_list, list)
+            list_for_each_entry(g2m_ioport, &hvm->g2m_ioport_list, list)
                 if (g2m_ioport->mport == fmp )
                 {
                     g2m_ioport->gport = fgp;
@@ -800,7 +800,7 @@ long arch_do_domctl(
                 g2m_ioport->gport = fgp;
                 g2m_ioport->mport = fmp;
                 g2m_ioport->np = np;
-                list_add_tail(&g2m_ioport->list, &hvm_domain->g2m_ioport_list);
+                list_add_tail(&g2m_ioport->list, &hvm->g2m_ioport_list);
             }
             if ( !ret )
                 ret = ioports_permit_access(d, fmp, fmp + np - 1);
@@ -815,7 +815,7 @@ long arch_do_domctl(
             printk(XENLOG_G_INFO
                    "ioport_map:remove: dom%d gport=%x mport=%x nr=%x\n",
                    d->domain_id, fgp, fmp, np);
-            list_for_each_entry(g2m_ioport, &hvm_domain->g2m_ioport_list, list)
+            list_for_each_entry(g2m_ioport, &hvm->g2m_ioport_list, list)
                 if ( g2m_ioport->mport == fmp )
                 {
                     list_del(&g2m_ioport->list);
xen/arch/x86/hvm/dom0_build.c +2 -2
index 5065729..22e335f 100644
@@ -240,7 +240,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d)
         if ( hvm_copy_to_guest_phys(gaddr, NULL, HVM_VM86_TSS_SIZE, v) !=
              HVMTRANS_okay )
             printk("Unable to zero VM86 TSS area\n");
-        d->arch.hvm_domain.params[HVM_PARAM_VM86_TSS_SIZED] =
+        d->arch.hvm.params[HVM_PARAM_VM86_TSS_SIZED] =
             VM86_TSS_UPDATED | ((uint64_t)HVM_VM86_TSS_SIZE << 32) | gaddr;
         if ( pvh_add_mem_range(d, gaddr, gaddr + HVM_VM86_TSS_SIZE,
                                E820_RESERVED) )
@@ -271,7 +271,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d)
     write_32bit_pse_identmap(ident_pt);
     unmap_domain_page(ident_pt);
     put_page(mfn_to_page(mfn));
-    d->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] = gaddr;
+    d->arch.hvm.params[HVM_PARAM_IDENT_PT] = gaddr;
     if ( pvh_add_mem_range(d, gaddr, gaddr + PAGE_SIZE, E820_RESERVED) )
             printk("Unable to set identity page tables as reserved in the memory map\n");
 
xen/arch/x86/hvm/domain.c +1 -1
index ae70aaf..8a2c83e 100644
@@ -319,7 +319,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
     v->arch.hvm_vcpu.cache_tsc_offset =
         d->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset;
     hvm_set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset,
-                       d->arch.hvm_domain.sync_tsc);
+                       d->arch.hvm.sync_tsc);
 
     paging_update_paging_modes(v);
 
xen/arch/x86/hvm/hpet.c +4 -4
index a594254..8090699 100644
@@ -26,7 +26,7 @@
 #include <xen/event.h>
 #include <xen/trace.h>
 
-#define domain_vhpet(x) (&(x)->arch.hvm_domain.pl_time->vhpet)
+#define domain_vhpet(x) (&(x)->arch.hvm.pl_time->vhpet)
 #define vcpu_vhpet(x)   (domain_vhpet((x)->domain))
 #define vhpet_domain(x) (container_of(x, struct pl_time, vhpet)->domain)
 #define vhpet_vcpu(x)   (pt_global_vcpu_target(vhpet_domain(x)))
@@ -164,7 +164,7 @@ static int hpet_read(
     unsigned long result;
     uint64_t val;
 
-    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] )
+    if ( !v->domain->arch.hvm.params[HVM_PARAM_HPET_ENABLED] )
     {
         result = ~0ul;
         goto out;
@@ -354,7 +354,7 @@ static int hpet_write(
 #define set_start_timer(n)   (__set_bit((n), &start_timers))
 #define set_restart_timer(n) (set_stop_timer(n),set_start_timer(n))
 
-    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] )
+    if ( !v->domain->arch.hvm.params[HVM_PARAM_HPET_ENABLED] )
         goto out;
 
     addr &= HPET_MMAP_SIZE-1;
@@ -735,7 +735,7 @@ void hpet_init(struct domain *d)
 
     hpet_set(domain_vhpet(d));
     register_mmio_handler(d, &hpet_mmio_ops);
-    d->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] = 1;
+    d->arch.hvm.params[HVM_PARAM_HPET_ENABLED] = 1;
 }
 
 void hpet_deinit(struct domain *d)
xen/arch/x86/hvm/hvm.c +69 -76

383 lines not on this page · raw message

xen/arch/x86/hvm/hypercall.c +3 -3
index 85eacd7..3d7ac49 100644
@@ -41,7 +41,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = compat_memory_op(cmd, arg);
 
     if ( (cmd & MEMOP_CMD_MASK) == XENMEM_decrease_reservation )
-        curr->domain->arch.hvm_domain.qemu_mapcache_invalidate = true;
+        curr->domain->arch.hvm.qemu_mapcache_invalidate = true;
 
     return rc;
 }
@@ -286,8 +286,8 @@ int hvm_hypercall(struct cpu_user_regs *regs)
     if ( curr->hcall_preempted )
         return HVM_HCALL_preempted;
 
-    if ( unlikely(currd->arch.hvm_domain.qemu_mapcache_invalidate) &&
-         test_and_clear_bool(currd->arch.hvm_domain.qemu_mapcache_invalidate) )
+    if ( unlikely(currd->arch.hvm.qemu_mapcache_invalidate) &&
+         test_and_clear_bool(currd->arch.hvm.qemu_mapcache_invalidate) )
         send_invalidate_req();
 
     return HVM_HCALL_completed;
xen/arch/x86/hvm/intercept.c +7 -7
index 2bc156d..aac22c5 100644
@@ -219,10 +219,10 @@ static const struct hvm_io_handler *hvm_find_io_handler(const ioreq_t *p)
     BUG_ON((p->type != IOREQ_TYPE_PIO) &&
            (p->type != IOREQ_TYPE_COPY));
 
-    for ( i = 0; i < curr_d->arch.hvm_domain.io_handler_count; i++ )
+    for ( i = 0; i < curr_d->arch.hvm.io_handler_count; i++ )
     {
         const struct hvm_io_handler *handler =
-            &curr_d->arch.hvm_domain.io_handler[i];
+            &curr_d->arch.hvm.io_handler[i];
         const struct hvm_io_ops *ops = handler->ops;
 
         if ( handler->type != p->type )
@@ -257,9 +257,9 @@ int hvm_io_intercept(ioreq_t *p)
 
 struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
 {
-    unsigned int i = d->arch.hvm_domain.io_handler_count++;
+    unsigned int i = d->arch.hvm.io_handler_count++;
 
-    ASSERT(d->arch.hvm_domain.io_handler);
+    ASSERT(d->arch.hvm.io_handler);
 
     if ( i == NR_IO_HANDLERS )
     {
@@ -267,7 +267,7 @@ struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
         return NULL;
     }
 
-    return &d->arch.hvm_domain.io_handler[i];
+    return &d->arch.hvm.io_handler[i];
 }
 
 void register_mmio_handler(struct domain *d,
@@ -303,10 +303,10 @@ void relocate_portio_handler(struct domain *d, unsigned int old_port,
 {
     unsigned int i;
 
-    for ( i = 0; i < d->arch.hvm_domain.io_handler_count; i++ )
+    for ( i = 0; i < d->arch.hvm.io_handler_count; i++ )
     {
         struct hvm_io_handler *handler =
-            &d->arch.hvm_domain.io_handler[i];
+            &d->arch.hvm.io_handler[i];
 
         if ( handler->type != IOREQ_TYPE_PIO )
             continue;
xen/arch/x86/hvm/io.c +24 -24

148 lines not on this page · raw message

xen/arch/x86/hvm/ioreq.c +40 -40

290 lines not on this page · raw message

xen/arch/x86/hvm/irq.c +25 -25

175 lines not on this page · raw message

xen/arch/x86/hvm/mtrr.c +7 -7
index edfe5cd..8a772bc 100644
@@ -539,12 +539,12 @@ static DEFINE_RCU_READ_LOCK(pinned_cacheattr_rcu_lock);
 
 void hvm_init_cacheattr_region_list(struct domain *d)
 {
-    INIT_LIST_HEAD(&d->arch.hvm_domain.pinned_cacheattr_ranges);
+    INIT_LIST_HEAD(&d->arch.hvm.pinned_cacheattr_ranges);
 }
 
 void hvm_destroy_cacheattr_region_list(struct domain *d)
 {
-    struct list_head *head = &d->arch.hvm_domain.pinned_cacheattr_ranges;
+    struct list_head *head = &d->arch.hvm.pinned_cacheattr_ranges;
     struct hvm_mem_pinned_cacheattr_range *range;
 
     while ( !list_empty(head) )
@@ -568,7 +568,7 @@ int hvm_get_mem_pinned_cacheattr(struct domain *d, gfn_t gfn,
 
     rcu_read_lock(&pinned_cacheattr_rcu_lock);
     list_for_each_entry_rcu ( range,
-                              &d->arch.hvm_domain.pinned_cacheattr_ranges,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
     {
         if ( ((gfn_x(gfn) & mask) >= range->start) &&
@@ -612,7 +612,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         /* Remove the requested range. */
         rcu_read_lock(&pinned_cacheattr_rcu_lock);
         list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm_domain.pinned_cacheattr_ranges,
+                                  &d->arch.hvm.pinned_cacheattr_ranges,
                                   list )
             if ( range->start == gfn_start && range->end == gfn_end )
             {
@@ -655,7 +655,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
 
     rcu_read_lock(&pinned_cacheattr_rcu_lock);
     list_for_each_entry_rcu ( range,
-                              &d->arch.hvm_domain.pinned_cacheattr_ranges,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
     {
         if ( range->start == gfn_start && range->end == gfn_end )
@@ -682,7 +682,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
     range->end = gfn_end;
     range->type = type;
 
-    list_add_rcu(&range->list, &d->arch.hvm_domain.pinned_cacheattr_ranges);
+    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
     if ( type != PAT_TYPE_WRBACK )
         flush_all(FLUSH_CACHE);
@@ -827,7 +827,7 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
 
     if ( direct_mmio )
     {
-        if ( (mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >> order )
+        if ( (mfn_x(mfn) ^ d->arch.hvm.vmx.apic_access_mfn) >> order )
             return MTRR_TYPE_UNCACHABLE;
         if ( order )
             return -1;
xen/arch/x86/hvm/pmtimer.c +20 -20
index 435647f..75b9408 100644
@@ -56,7 +56,7 @@
 /* Dispatch SCIs based on the PM1a_STS and PM1a_EN registers */
 static void pmt_update_sci(PMTState *s)
 {
-    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm_domain.acpi;
+    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm.acpi;
 
     ASSERT(spin_is_locked(&s->lock));
 
@@ -68,26 +68,26 @@ static void pmt_update_sci(PMTState *s)
 
 void hvm_acpi_power_button(struct domain *d)
 {
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
     if ( !has_vpm(d) )
         return;
 
     spin_lock(&s->lock);
-    d->arch.hvm_domain.acpi.pm1a_sts |= PWRBTN_STS;
+    d->arch.hvm.acpi.pm1a_sts |= PWRBTN_STS;
     pmt_update_sci(s);
     spin_unlock(&s->lock);
 }
 
 void hvm_acpi_sleep_button(struct domain *d)
 {
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
     if ( !has_vpm(d) )
         return;
 
     spin_lock(&s->lock);
-    d->arch.hvm_domain.acpi.pm1a_sts |= PWRBTN_STS;
+    d->arch.hvm.acpi.pm1a_sts |= PWRBTN_STS;
     pmt_update_sci(s);
     spin_unlock(&s->lock);
 }
@@ -97,7 +97,7 @@ void hvm_acpi_sleep_button(struct domain *d)
 static void pmt_update_time(PMTState *s)
 {
     uint64_t curr_gtime, tmp;
-    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm_domain.acpi;
+    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm.acpi;
     uint32_t tmr_val = acpi->tmr_val, msb = tmr_val & TMR_VAL_MSB;
     
     ASSERT(spin_is_locked(&s->lock));
@@ -137,7 +137,7 @@ static void pmt_timer_callback(void *opaque)
 
     /* How close are we to the next MSB flip? */
     pmt_cycles_until_flip = TMR_VAL_MSB -
-        (s->vcpu->domain->arch.hvm_domain.acpi.tmr_val & (TMR_VAL_MSB - 1));
+        (s->vcpu->domain->arch.hvm.acpi.tmr_val & (TMR_VAL_MSB - 1));
 
     /* Overall time between MSB flips */
     time_until_flip = (1000000000ULL << 23) / FREQUENCE_PMTIMER;
@@ -156,13 +156,13 @@ static int handle_evt_io(
     int dir, unsigned int port, unsigned int bytes, uint32_t *val)
 {
     struct vcpu *v = current;
-    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm_domain.acpi;
-    PMTState *s = &v->domain->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm.acpi;
+    PMTState *s = &v->domain->arch.hvm.pl_time->vpmt;
     uint32_t addr, data, byte;
     int i;
 
     addr = port -
-        ((v->domain->arch.hvm_domain.params[
+        ((v->domain->arch.hvm.params[
             HVM_PARAM_ACPI_IOPORTS_LOCATION] == 0) ?
          PM1a_STS_ADDR_V0 : PM1a_STS_ADDR_V1);
 
@@ -220,8 +220,8 @@ static int handle_pmt_io(
     int dir, unsigned int port, unsigned int bytes, uint32_t *val)
 {
     struct vcpu *v = current;
-    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm_domain.acpi;
-    PMTState *s = &v->domain->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm.acpi;
+    PMTState *s = &v->domain->arch.hvm.pl_time->vpmt;
 
     if ( bytes != 4 || dir != IOREQ_READ )
     {
@@ -251,8 +251,8 @@ static int handle_pmt_io(
 
 static int acpi_save(struct domain *d, hvm_domain_context_t *h)
 {
-    struct hvm_hw_acpi *acpi = &d->arch.hvm_domain.acpi;
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &d->arch.hvm.acpi;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
     uint32_t x, msb = acpi->tmr_val & TMR_VAL_MSB;
     int rc;
 
@@ -282,8 +282,8 @@ static int acpi_save(struct domain *d, hvm_domain_context_t *h)
 
 static int acpi_load(struct domain *d, hvm_domain_context_t *h)
 {
-    struct hvm_hw_acpi *acpi = &d->arch.hvm_domain.acpi;
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &d->arch.hvm.acpi;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
     if ( !has_vpm(d) )
         return -ENODEV;
@@ -320,7 +320,7 @@ int pmtimer_change_ioport(struct domain *d, unsigned int version)
         return -ENODEV;
 
     /* Check that version is changing. */
-    old_version = d->arch.hvm_domain.params[HVM_PARAM_ACPI_IOPORTS_LOCATION];
+    old_version = d->arch.hvm.params[HVM_PARAM_ACPI_IOPORTS_LOCATION];
     if ( version == old_version )
         return 0;
 
@@ -346,7 +346,7 @@ int pmtimer_change_ioport(struct domain *d, unsigned int version)
 
 void pmtimer_init(struct vcpu *v)
 {
-    PMTState *s = &v->domain->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &v->domain->arch.hvm.pl_time->vpmt;
 
     if ( !has_vpm(v->domain) )
         return;
@@ -370,7 +370,7 @@ void pmtimer_init(struct vcpu *v)
 
 void pmtimer_deinit(struct domain *d)
 {
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
     if ( !has_vpm(d) )
         return;
@@ -384,7 +384,7 @@ void pmtimer_reset(struct domain *d)
         return;
 
     /* Reset the counter. */
-    d->arch.hvm_domain.acpi.tmr_val = 0;
+    d->arch.hvm.acpi.tmr_val = 0;
 }
 
 /*
xen/arch/x86/hvm/rtc.c +2 -2
index 96921bb..1828587 100644
@@ -38,7 +38,7 @@
 #define MIN_PER_HOUR    60
 #define HOUR_PER_DAY    24
 
-#define domain_vrtc(x) (&(x)->arch.hvm_domain.pl_time->vrtc)
+#define domain_vrtc(x) (&(x)->arch.hvm.pl_time->vrtc)
 #define vcpu_vrtc(x)   (domain_vrtc((x)->domain))
 #define vrtc_domain(x) (container_of(x, struct pl_time, vrtc)->domain)
 #define vrtc_vcpu(x)   (pt_global_vcpu_target(vrtc_domain(x)))
@@ -148,7 +148,7 @@ static void rtc_timer_update(RTCState *s)
                 s_time_t now = NOW();
 
                 s->period = period;
-                if ( v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] )
+                if ( v->domain->arch.hvm.params[HVM_PARAM_VPT_ALIGN] )
                     delta = 0;
                 else
                     delta = period - ((now - s->start_time) % period);
xen/arch/x86/hvm/save.c +3 -3
index d2dc430..0ace160 100644
@@ -39,7 +39,7 @@ void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
     hdr->gtsc_khz = d->arch.tsc_khz;
 
     /* Time when saving started */
-    d->arch.hvm_domain.sync_tsc = rdtsc();
+    d->arch.hvm.sync_tsc = rdtsc();
 }
 
 int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
@@ -74,10 +74,10 @@ int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
         hvm_set_rdtsc_exiting(d, 1);
 
     /* Time when restore started  */
-    d->arch.hvm_domain.sync_tsc = rdtsc();
+    d->arch.hvm.sync_tsc = rdtsc();
 
     /* VGA state is not saved/restored, so we nobble the cache. */
-    d->arch.hvm_domain.stdvga.cache = STDVGA_CACHE_DISABLED;
+    d->arch.hvm.stdvga.cache = STDVGA_CACHE_DISABLED;
 
     return 0;
 }
xen/arch/x86/hvm/stdvga.c +9 -9
index 925bab2..bd398db 100644
@@ -134,7 +134,7 @@ static bool_t stdvga_cache_is_enabled(const struct hvm_hw_stdvga *s)
 
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
     int rc = 1, prev_stdvga = s->stdvga;
 
     switch ( addr )
@@ -202,7 +202,7 @@ static void stdvga_out(uint32_t port, uint32_t bytes, uint32_t val)
 static int stdvga_intercept_pio(
     int dir, unsigned int port, unsigned int bytes, uint32_t *val)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
 
     if ( dir == IOREQ_WRITE )
     {
@@ -252,7 +252,7 @@ static unsigned int stdvga_mem_offset(
 
 static uint8_t stdvga_mem_readb(uint64_t addr)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
     int plane;
     uint32_t ret, *vram_l;
     uint8_t *vram_b;
@@ -347,7 +347,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler,
 
 static void stdvga_mem_writeb(uint64_t addr, uint32_t val)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
     int plane, write_mode, b, func_select, mask;
     uint32_t write_mask, bit_mask, set_mask, *vram_l;
     uint8_t *vram_b;
@@ -457,7 +457,7 @@ static int stdvga_mem_write(const struct hvm_io_handler *handler,
                             uint64_t addr, uint32_t size,
                             uint64_t data)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
     ioreq_t p = {
         .type = IOREQ_TYPE_COPY,
         .addr = addr,
@@ -517,7 +517,7 @@ static int stdvga_mem_write(const struct hvm_io_handler *handler,
 static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
                                 const ioreq_t *p)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
 
     /*
      * The range check must be done without taking the lock, to avoid
@@ -560,7 +560,7 @@ static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
 
 static void stdvga_mem_complete(const struct hvm_io_handler *handler)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
 
     spin_unlock(&s->lock);
 }
@@ -574,7 +574,7 @@ static const struct hvm_io_ops stdvga_mem_ops = {
 
 void stdvga_init(struct domain *d)
 {
-    struct hvm_hw_stdvga *s = &d->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
     struct page_info *pg;
     unsigned int i;
 
@@ -615,7 +615,7 @@ void stdvga_init(struct domain *d)
 
 void stdvga_deinit(struct domain *d)
 {
-    struct hvm_hw_stdvga *s = &d->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
     int i;
 
     if ( !has_vvga(d) )
xen/arch/x86/hvm/svm/svm.c +2 -3
index a16f372..2d52247 100644
@@ -1197,7 +1197,7 @@ void svm_vmenter_helper(const struct cpu_user_regs *regs)
 
 static void svm_guest_osvw_init(struct domain *d)
 {
-    struct svm_domain *svm = &d->arch.hvm_domain.svm;
+    struct svm_domain *svm = &d->arch.hvm.svm;
 
     spin_lock(&osvw_lock);
 
@@ -2006,8 +2006,7 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     case MSR_AMD_OSVW_STATUS:
         if ( !d->arch.cpuid->extd.osvw )
             goto gpf;
-        *msr_content =
-            d->arch.hvm_domain.svm.osvw.raw[msr - MSR_AMD_OSVW_ID_LENGTH];
+        *msr_content = d->arch.hvm.svm.osvw.raw[msr - MSR_AMD_OSVW_ID_LENGTH];
         break;
 
     default:
xen/arch/x86/hvm/svm/vmcb.c +1 -1
index 04518fd..d31fcfa 100644
@@ -106,7 +106,7 @@ static int construct_vmcb(struct vcpu *v)
         svm_disable_intercept_for_msr(v, MSR_AMD64_LWP_CBADDR);
 
     vmcb->_msrpm_base_pa = (u64)virt_to_maddr(arch_svm->msrpm);
-    vmcb->_iopm_base_pa = __pa(v->domain->arch.hvm_domain.io_bitmap);
+    vmcb->_iopm_base_pa = __pa(v->domain->arch.hvm.io_bitmap);
 
     /* Virtualise EFLAGS.IF and LAPIC TPR (CR8). */
     vmcb->_vintr.fields.intr_masking = 1;
xen/arch/x86/hvm/vioapic.c +22 -22

151 lines not on this page · raw message

xen/arch/x86/hvm/viridian.c +28 -28

164 lines not on this page · raw message

xen/arch/x86/hvm/vlapic.c +4 -4
index ec089cc..04702e9 100644
@@ -1203,10 +1203,10 @@ int vlapic_accept_pic_intr(struct vcpu *v)
         return 0;
 
     TRACE_2D(TRC_HVM_EMUL_LAPIC_PIC_INTR,
-             (v == v->domain->arch.hvm_domain.i8259_target),
+             (v == v->domain->arch.hvm.i8259_target),
              v ? __vlapic_accept_pic_intr(v) : -1);
 
-    return ((v == v->domain->arch.hvm_domain.i8259_target) &&
+    return ((v == v->domain->arch.hvm.i8259_target) &&
             __vlapic_accept_pic_intr(v));
 }
 
@@ -1224,9 +1224,9 @@ void vlapic_adjust_i8259_target(struct domain *d)
     v = d->vcpu ? d->vcpu[0] : NULL;
 
  found:
-    if ( d->arch.hvm_domain.i8259_target == v )
+    if ( d->arch.hvm.i8259_target == v )
         return;
-    d->arch.hvm_domain.i8259_target = v;
+    d->arch.hvm.i8259_target = v;
     pt_adjust_global_vcpu_target(v);
 }
 
xen/arch/x86/hvm/vmsi.c +7 -7
index 3001d5c..ccbf181 100644
@@ -173,7 +173,7 @@ static DEFINE_RCU_READ_LOCK(msixtbl_rcu_lock);
  */
 static bool msixtbl_initialised(const struct domain *d)
 {
-    return !!d->arch.hvm_domain.msixtbl_list.next;
+    return !!d->arch.hvm.msixtbl_list.next;
 }
 
 static struct msixtbl_entry *msixtbl_find_entry(
@@ -182,7 +182,7 @@ static struct msixtbl_entry *msixtbl_find_entry(
     struct msixtbl_entry *entry;
     struct domain *d = v->domain;
 
-    list_for_each_entry( entry, &d->arch.hvm_domain.msixtbl_list, list )
+    list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
         if ( addr >= entry->gtable &&
              addr < entry->gtable + entry->table_len )
             return entry;
@@ -430,7 +430,7 @@ static void add_msixtbl_entry(struct domain *d,
     entry->pdev = pdev;
     entry->gtable = (unsigned long) gtable;
 
-    list_add_rcu(&entry->list, &d->arch.hvm_domain.msixtbl_list);
+    list_add_rcu(&entry->list, &d->arch.hvm.msixtbl_list);
 }
 
 static void free_msixtbl_entry(struct rcu_head *rcu)
@@ -483,7 +483,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
 
     pdev = msi_desc->dev;
 
-    list_for_each_entry( entry, &d->arch.hvm_domain.msixtbl_list, list )
+    list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
         if ( pdev == entry->pdev )
             goto found;
 
@@ -542,7 +542,7 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq *pirq)
 
     pdev = msi_desc->dev;
 
-    list_for_each_entry( entry, &d->arch.hvm_domain.msixtbl_list, list )
+    list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
         if ( pdev == entry->pdev )
             goto found;
 
@@ -564,7 +564,7 @@ void msixtbl_init(struct domain *d)
     if ( !is_hvm_domain(d) || !has_vlapic(d) || msixtbl_initialised(d) )
         return;
 
-    INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list);
+    INIT_LIST_HEAD(&d->arch.hvm.msixtbl_list);
 
     handler = hvm_next_io_handler(d);
     if ( handler )
@@ -584,7 +584,7 @@ void msixtbl_pt_cleanup(struct domain *d)
     spin_lock(&d->event_lock);
 
     list_for_each_entry_safe( entry, temp,
-                              &d->arch.hvm_domain.msixtbl_list, list )
+                              &d->arch.hvm.msixtbl_list, list )
         del_msixtbl_entry(entry);
 
     spin_unlock(&d->event_lock);
xen/arch/x86/hvm/vmx/vmcs.c +6 -6
index 6681032..f30850c 100644
@@ -1108,8 +1108,8 @@ static int construct_vmcs(struct vcpu *v)
     }
 
     /* I/O access bitmap. */
-    __vmwrite(IO_BITMAP_A, __pa(d->arch.hvm_domain.io_bitmap));
-    __vmwrite(IO_BITMAP_B, __pa(d->arch.hvm_domain.io_bitmap) + PAGE_SIZE);
+    __vmwrite(IO_BITMAP_A, __pa(d->arch.hvm.io_bitmap));
+    __vmwrite(IO_BITMAP_B, __pa(d->arch.hvm.io_bitmap) + PAGE_SIZE);
 
     if ( cpu_has_vmx_virtual_intr_delivery )
     {
@@ -1263,7 +1263,7 @@ static int construct_vmcs(struct vcpu *v)
         __vmwrite(XSS_EXIT_BITMAP, 0);
 
     if ( cpu_has_vmx_tsc_scaling )
-        __vmwrite(TSC_MULTIPLIER, d->arch.hvm_domain.tsc_scaling_ratio);
+        __vmwrite(TSC_MULTIPLIER, d->arch.hvm.tsc_scaling_ratio);
 
     /* will update HOST & GUEST_CR3 as reqd */
     paging_update_paging_modes(v);
@@ -1643,7 +1643,7 @@ void vmx_vcpu_flush_pml_buffer(struct vcpu *v)
 
 bool_t vmx_domain_pml_enabled(const struct domain *d)
 {
-    return !!(d->arch.hvm_domain.vmx.status & VMX_DOMAIN_PML_ENABLED);
+    return !!(d->arch.hvm.vmx.status & VMX_DOMAIN_PML_ENABLED);
 }
 
 /*
@@ -1668,7 +1668,7 @@ int vmx_domain_enable_pml(struct domain *d)
         if ( (rc = vmx_vcpu_enable_pml(v)) != 0 )
             goto error;
 
-    d->arch.hvm_domain.vmx.status |= VMX_DOMAIN_PML_ENABLED;
+    d->arch.hvm.vmx.status |= VMX_DOMAIN_PML_ENABLED;
 
     return 0;
 
@@ -1697,7 +1697,7 @@ void vmx_domain_disable_pml(struct domain *d)
     for_each_vcpu ( d, v )
         vmx_vcpu_disable_pml(v);
 
-    d->arch.hvm_domain.vmx.status &= ~VMX_DOMAIN_PML_ENABLED;
+    d->arch.hvm.vmx.status &= ~VMX_DOMAIN_PML_ENABLED;
 }
 
 /*
xen/arch/x86/hvm/vmx/vmx.c +23 -23

141 lines not on this page · raw message

xen/arch/x86/hvm/vpic.c +10 -10
index cfc9544..e0500c5 100644
@@ -35,7 +35,7 @@
 #include <asm/hvm/support.h>
 
 #define vpic_domain(v) (container_of((v), struct domain, \
-                        arch.hvm_domain.vpic[!vpic->is_master]))
+                        arch.hvm.vpic[!vpic->is_master]))
 #define __vpic_lock(v) &container_of((v), struct hvm_domain, \
                                         vpic[!(v)->is_master])->irq_lock
 #define vpic_lock(v)   spin_lock(__vpic_lock(v))
@@ -112,7 +112,7 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic)
         if ( vpic->is_master )
         {
             /* Master INT line is connected in Virtual Wire Mode. */
-            struct vcpu *v = vpic_domain(vpic)->arch.hvm_domain.i8259_target;
+            struct vcpu *v = vpic_domain(vpic)->arch.hvm.i8259_target;
             if ( v != NULL )
             {
                 TRACE_1D(TRC_HVM_EMUL_PIC_KICK, irq);
@@ -334,7 +334,7 @@ static int vpic_intercept_pic_io(
         return X86EMUL_OKAY;
     }
 
-    vpic = &current->domain->arch.hvm_domain.vpic[port >> 7];
+    vpic = &current->domain->arch.hvm.vpic[port >> 7];
 
     if ( dir == IOREQ_WRITE )
         vpic_ioport_write(vpic, port, (uint8_t)*val);
@@ -352,7 +352,7 @@ static int vpic_intercept_elcr_io(
 
     BUG_ON(bytes != 1);
 
-    vpic = &current->domain->arch.hvm_domain.vpic[port & 1];
+    vpic = &current->domain->arch.hvm.vpic[port & 1];
 
     if ( dir == IOREQ_WRITE )
     {
@@ -382,7 +382,7 @@ static int vpic_save(struct domain *d, hvm_domain_context_t *h)
     /* Save the state of both PICs */
     for ( i = 0; i < 2 ; i++ )
     {
-        s = &d->arch.hvm_domain.vpic[i];
+        s = &d->arch.hvm.vpic[i];
         if ( hvm_save_entry(PIC, i, h, s) )
             return 1;
     }
@@ -401,7 +401,7 @@ static int vpic_load(struct domain *d, hvm_domain_context_t *h)
     /* Which PIC is this? */
     if ( inst > 1 )
         return -EINVAL;
-    s = &d->arch.hvm_domain.vpic[inst];
+    s = &d->arch.hvm.vpic[inst];
 
     /* Load the state */
     if ( hvm_load_entry(PIC, h, s) != 0 )
@@ -420,7 +420,7 @@ void vpic_reset(struct domain *d)
         return;
 
     /* Master PIC. */
-    vpic = &d->arch.hvm_domain.vpic[0];
+    vpic = &d->arch.hvm.vpic[0];
     memset(vpic, 0, sizeof(*vpic));
     vpic->is_master = 1;
     vpic->elcr      = 1 << 2;
@@ -446,7 +446,7 @@ void vpic_init(struct domain *d)
 
 void vpic_irq_positive_edge(struct domain *d, int irq)
 {
-    struct hvm_hw_vpic *vpic = &d->arch.hvm_domain.vpic[irq >> 3];
+    struct hvm_hw_vpic *vpic = &d->arch.hvm.vpic[irq >> 3];
     uint8_t mask = 1 << (irq & 7);
 
     ASSERT(has_vpic(d));
@@ -464,7 +464,7 @@ void vpic_irq_positive_edge(struct domain *d, int irq)
 
 void vpic_irq_negative_edge(struct domain *d, int irq)
 {
-    struct hvm_hw_vpic *vpic = &d->arch.hvm_domain.vpic[irq >> 3];
+    struct hvm_hw_vpic *vpic = &d->arch.hvm.vpic[irq >> 3];
     uint8_t mask = 1 << (irq & 7);
 
     ASSERT(has_vpic(d));
@@ -483,7 +483,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq)
 int vpic_ack_pending_irq(struct vcpu *v)
 {
     int irq, vector;
-    struct hvm_hw_vpic *vpic = &v->domain->arch.hvm_domain.vpic[0];
+    struct hvm_hw_vpic *vpic = &v->domain->arch.hvm.vpic[0];
 
     ASSERT(has_vpic(v->domain));
 
xen/arch/x86/hvm/vpt.c +10 -10
index 6ac4c91..7b57017 100644
@@ -24,11 +24,11 @@
 #include <asm/mc146818rtc.h>
 
 #define mode_is(d, name) \
-    ((d)->arch.hvm_domain.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
+    ((d)->arch.hvm.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
 
 void hvm_init_guest_time(struct domain *d)
 {
-    struct pl_time *pl = d->arch.hvm_domain.pl_time;
+    struct pl_time *pl = d->arch.hvm.pl_time;
 
     spin_lock_init(&pl->pl_time_lock);
     pl->stime_offset = -(u64)get_s_time();
@@ -37,7 +37,7 @@ void hvm_init_guest_time(struct domain *d)
 
 uint64_t hvm_get_guest_time_fixed(const struct vcpu *v, uint64_t at_tsc)
 {
-    struct pl_time *pl = v->domain->arch.hvm_domain.pl_time;
+    struct pl_time *pl = v->domain->arch.hvm.pl_time;
     u64 now;
 
     /* Called from device models shared with PV guests. Be careful. */
@@ -88,7 +88,7 @@ static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
     gsi = hvm_isa_irq_to_gsi(isa_irq);
 
     if ( src == hvm_intsrc_pic )
-        return (v->domain->arch.hvm_domain.vpic[isa_irq >> 3].irq_base
+        return (v->domain->arch.hvm.vpic[isa_irq >> 3].irq_base
                 + (isa_irq & 7));
 
     ASSERT(src == hvm_intsrc_lapic);
@@ -121,7 +121,7 @@ static int pt_irq_masked(struct periodic_time *pt)
 
     case PTSRC_isa:
     {
-        uint8_t pic_imr = v->domain->arch.hvm_domain.vpic[pt->irq >> 3].imr;
+        uint8_t pic_imr = v->domain->arch.hvm.vpic[pt->irq >> 3].imr;
 
         /* Check if the interrupt is unmasked in the PIC. */
         if ( !(pic_imr & (1 << (pt->irq & 7))) && vlapic_accept_pic_intr(v) )
@@ -363,7 +363,7 @@ int pt_update_irq(struct vcpu *v)
     case PTSRC_isa:
         hvm_isa_irq_deassert(v->domain, irq);
         if ( platform_legacy_irq(irq) && vlapic_accept_pic_intr(v) &&
-             v->domain->arch.hvm_domain.vpic[irq >> 3].int_output )
+             v->domain->arch.hvm.vpic[irq >> 3].int_output )
             hvm_isa_irq_assert(v->domain, irq, NULL);
         else
         {
@@ -514,7 +514,7 @@ void create_periodic_time(
 
     if ( !pt->one_shot )
     {
-        if ( v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] )
+        if ( v->domain->arch.hvm.params[HVM_PARAM_VPT_ALIGN] )
         {
             pt->scheduled = align_timer(pt->scheduled, pt->period);
         }
@@ -605,7 +605,7 @@ void pt_adjust_global_vcpu_target(struct vcpu *v)
     pt_adjust_vcpu(&vpit->pt0, v);
     spin_unlock(&vpit->lock);
 
-    pl_time = v->domain->arch.hvm_domain.pl_time;
+    pl_time = v->domain->arch.hvm.pl_time;
 
     spin_lock(&pl_time->vrtc.lock);
     pt_adjust_vcpu(&pl_time->vrtc.pt, v);
@@ -640,9 +640,9 @@ void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt)
     if ( d )
     {
         pt_resume(&d->arch.vpit.pt0);
-        pt_resume(&d->arch.hvm_domain.pl_time->vrtc.pt);
+        pt_resume(&d->arch.hvm.pl_time->vrtc.pt);
         for ( i = 0; i < HPET_TIMER_NUM; i++ )
-            pt_resume(&d->arch.hvm_domain.pl_time->vhpet.pt[i]);
+            pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]);
     }
 
     if ( vlapic_pt )
xen/arch/x86/irq.c +5 -5
index 6865c79..ec93ab6 100644
@@ -1293,7 +1293,7 @@ int init_domain_irq_mapping(struct domain *d)
 
     radix_tree_init(&d->arch.irq_pirq);
     if ( is_hvm_domain(d) )
-        radix_tree_init(&d->arch.hvm_domain.emuirq_pirq);
+        radix_tree_init(&d->arch.hvm.emuirq_pirq);
 
     for ( i = 1; platform_legacy_irq(i); ++i )
     {
@@ -1319,7 +1319,7 @@ void cleanup_domain_irq_mapping(struct domain *d)
 {
     radix_tree_destroy(&d->arch.irq_pirq, NULL);
     if ( is_hvm_domain(d) )
-        radix_tree_destroy(&d->arch.hvm_domain.emuirq_pirq, NULL);
+        radix_tree_destroy(&d->arch.hvm.emuirq_pirq, NULL);
 }
 
 struct pirq *alloc_pirq_struct(struct domain *d)
@@ -2490,7 +2490,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
     /* do not store emuirq mappings for pt devices */
     if ( emuirq != IRQ_PT )
     {
-        int err = radix_tree_insert(&d->arch.hvm_domain.emuirq_pirq, emuirq,
+        int err = radix_tree_insert(&d->arch.hvm.emuirq_pirq, emuirq,
                                     radix_tree_int_to_ptr(pirq));
 
         switch ( err )
@@ -2500,7 +2500,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
         case -EEXIST:
             radix_tree_replace_slot(
                 radix_tree_lookup_slot(
-                    &d->arch.hvm_domain.emuirq_pirq, emuirq),
+                    &d->arch.hvm.emuirq_pirq, emuirq),
                 radix_tree_int_to_ptr(pirq));
             break;
         default:
@@ -2542,7 +2542,7 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
         pirq_cleanup_check(info, d);
     }
     if ( emuirq != IRQ_PT )
-        radix_tree_delete(&d->arch.hvm_domain.emuirq_pirq, emuirq);
+        radix_tree_delete(&d->arch.hvm.emuirq_pirq, emuirq);
 
  done:
     return ret;
xen/arch/x86/mm/hap/hap.c +5 -6
index 812a840..fe10e9d 100644
@@ -83,7 +83,7 @@ int hap_track_dirty_vram(struct domain *d,
 
         paging_lock(d);
 
-        dirty_vram = d->arch.hvm_domain.dirty_vram;
+        dirty_vram = d->arch.hvm.dirty_vram;
         if ( !dirty_vram )
         {
             rc = -ENOMEM;
@@ -93,7 +93,7 @@ int hap_track_dirty_vram(struct domain *d,
                 goto out;
             }
 
-            d->arch.hvm_domain.dirty_vram = dirty_vram;
+            d->arch.hvm.dirty_vram = dirty_vram;
         }
 
         if ( begin_pfn != dirty_vram->begin_pfn ||
@@ -145,7 +145,7 @@ int hap_track_dirty_vram(struct domain *d,
     {
         paging_lock(d);
 
-        dirty_vram = d->arch.hvm_domain.dirty_vram;
+        dirty_vram = d->arch.hvm.dirty_vram;
         if ( dirty_vram )
         {
             /*
@@ -155,7 +155,7 @@ int hap_track_dirty_vram(struct domain *d,
             begin_pfn = dirty_vram->begin_pfn;
             nr = dirty_vram->end_pfn - dirty_vram->begin_pfn;
             xfree(dirty_vram);
-            d->arch.hvm_domain.dirty_vram = NULL;
+            d->arch.hvm.dirty_vram = NULL;
         }
 
         paging_unlock(d);
@@ -579,8 +579,7 @@ void hap_teardown(struct domain *d, bool *preempted)
 
     d->arch.paging.mode &= ~PG_log_dirty;
 
-    xfree(d->arch.hvm_domain.dirty_vram);
-    d->arch.hvm_domain.dirty_vram = NULL;
+    XFREE(d->arch.hvm.dirty_vram);
 
 out:
     paging_unlock(d);
xen/arch/x86/mm/mem_sharing.c +3 -3
index fad8a9d..fe1df83 100644
@@ -150,7 +150,7 @@ static inline shr_handle_t get_next_handle(void)
 }
 
 #define mem_sharing_enabled(d) \
-    (is_hvm_domain(d) && (d)->arch.hvm_domain.mem_sharing_enabled)
+    (is_hvm_domain(d) && (d)->arch.hvm.mem_sharing_enabled)
 
 static atomic_t nr_saved_mfns   = ATOMIC_INIT(0); 
 static atomic_t nr_shared_mfns  = ATOMIC_INIT(0);
@@ -1333,7 +1333,7 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
 
     /* Only HAP is supported */
     rc = -ENODEV;
-    if ( !hap_enabled(d) || !d->arch.hvm_domain.mem_sharing_enabled )
+    if ( !hap_enabled(d) || !d->arch.hvm.mem_sharing_enabled )
         goto out;
 
     switch ( mso.op )
@@ -1613,7 +1613,7 @@ int mem_sharing_domctl(struct domain *d, struct xen_domctl_mem_sharing_op *mec)
             if ( unlikely(need_iommu(d) && mec->u.enable) )
                 rc = -EXDEV;
             else
-                d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
+                d->arch.hvm.mem_sharing_enabled = mec->u.enable;
         }
         break;
 
xen/arch/x86/mm/shadow/common.c +9 -9
index 1930a1d..afdc27d 100644
@@ -2881,11 +2881,11 @@ void shadow_teardown(struct domain *d, bool *preempted)
      * calls now that we've torn down the bitmap */
     d->arch.paging.mode &= ~PG_log_dirty;
 
-    if (d->arch.hvm_domain.dirty_vram) {
-        xfree(d->arch.hvm_domain.dirty_vram->sl1ma);
-        xfree(d->arch.hvm_domain.dirty_vram->dirty_bitmap);
-        xfree(d->arch.hvm_domain.dirty_vram);
-        d->arch.hvm_domain.dirty_vram = NULL;
+    if ( d->arch.hvm.dirty_vram )
+    {
+        xfree(d->arch.hvm.dirty_vram->sl1ma);
+        xfree(d->arch.hvm.dirty_vram->dirty_bitmap);
+        XFREE(d->arch.hvm.dirty_vram);
     }
 
 out:
@@ -3261,7 +3261,7 @@ int shadow_track_dirty_vram(struct domain *d,
     p2m_lock(p2m_get_hostp2m(d));
     paging_lock(d);
 
-    dirty_vram = d->arch.hvm_domain.dirty_vram;
+    dirty_vram = d->arch.hvm.dirty_vram;
 
     if ( dirty_vram && (!nr ||
              ( begin_pfn != dirty_vram->begin_pfn
@@ -3272,7 +3272,7 @@ int shadow_track_dirty_vram(struct domain *d,
         xfree(dirty_vram->sl1ma);
         xfree(dirty_vram->dirty_bitmap);
         xfree(dirty_vram);
-        dirty_vram = d->arch.hvm_domain.dirty_vram = NULL;
+        dirty_vram = d->arch.hvm.dirty_vram = NULL;
     }
 
     if ( !nr )
@@ -3299,7 +3299,7 @@ int shadow_track_dirty_vram(struct domain *d,
             goto out;
         dirty_vram->begin_pfn = begin_pfn;
         dirty_vram->end_pfn = end_pfn;
-        d->arch.hvm_domain.dirty_vram = dirty_vram;
+        d->arch.hvm.dirty_vram = dirty_vram;
 
         if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
             goto out_dirty_vram;
@@ -3418,7 +3418,7 @@ int shadow_track_dirty_vram(struct domain *d,
     xfree(dirty_vram->sl1ma);
 out_dirty_vram:
     xfree(dirty_vram);
-    dirty_vram = d->arch.hvm_domain.dirty_vram = NULL;
+    dirty_vram = d->arch.hvm.dirty_vram = NULL;
 
 out:
     paging_unlock(d);
xen/arch/x86/mm/shadow/multi.c +4 -4
index 9e43533..62819eb 100644
@@ -527,7 +527,7 @@ _sh_propagate(struct vcpu *v,
     guest_l1e_t guest_entry = { guest_intpte };
     shadow_l1e_t *sp = shadow_entry_ptr;
     struct domain *d = v->domain;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
     gfn_t target_gfn = guest_l1e_get_gfn(guest_entry);
     u32 pass_thru_flags;
     u32 gflags, sflags;
@@ -619,7 +619,7 @@ _sh_propagate(struct vcpu *v,
         if ( !mmio_mfn &&
              (type = hvm_get_mem_pinned_cacheattr(d, target_gfn, 0)) >= 0 )
             sflags |= pat_type_2_pte_flags(type);
-        else if ( d->arch.hvm_domain.is_in_uc_mode )
+        else if ( d->arch.hvm.is_in_uc_mode )
             sflags |= pat_type_2_pte_flags(PAT_TYPE_UNCACHABLE);
         else
             if ( iomem_access_permitted(d, mfn_x(target_mfn), mfn_x(target_mfn)) )
@@ -1110,7 +1110,7 @@ static inline void shadow_vram_get_l1e(shadow_l1e_t new_sl1e,
     mfn_t mfn = shadow_l1e_get_mfn(new_sl1e);
     int flags = shadow_l1e_get_flags(new_sl1e);
     unsigned long gfn;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
     if ( !dirty_vram         /* tracking disabled? */
          || !(flags & _PAGE_RW) /* read-only mapping? */
@@ -1141,7 +1141,7 @@ static inline void shadow_vram_put_l1e(shadow_l1e_t old_sl1e,
     mfn_t mfn = shadow_l1e_get_mfn(old_sl1e);
     int flags = shadow_l1e_get_flags(old_sl1e);
     unsigned long gfn;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
     if ( !dirty_vram         /* tracking disabled? */
          || !(flags & _PAGE_RW) /* read-only mapping? */
xen/arch/x86/physdev.c +1 -1
index 4524823..3a3c158 100644
@@ -98,7 +98,7 @@ int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
     {
         /*
          * Only makes sense for vector-based callback, else HVM-IRQ logic
-         * calls back into itself and deadlocks on hvm_domain.irq_lock.
+         * calls back into itself and deadlocks on hvm.irq_lock.
          */
         if ( !is_hvm_pv_evtchn_domain(d) )
             return -EINVAL;
xen/arch/x86/setup.c +5 -5
index dd11815..ed133fc 100644
@@ -1870,7 +1870,7 @@ static int __hwdom_init io_bitmap_cb(unsigned long s, unsigned long e,
 
     ASSERT(e <= INT_MAX);
     for ( i = s; i <= e; i++ )
-        __clear_bit(i, d->arch.hvm_domain.io_bitmap);
+        __clear_bit(i, d->arch.hvm.io_bitmap);
 
     return 0;
 }
@@ -1881,7 +1881,7 @@ void __hwdom_init setup_io_bitmap(struct domain *d)
 
     if ( is_hvm_domain(d) )
     {
-        bitmap_fill(d->arch.hvm_domain.io_bitmap, 0x10000);
+        bitmap_fill(d->arch.hvm.io_bitmap, 0x10000);
         rc = rangeset_report_ranges(d->arch.ioport_caps, 0, 0x10000,
                                     io_bitmap_cb, d);
         BUG_ON(rc);
@@ -1892,9 +1892,9 @@ void __hwdom_init setup_io_bitmap(struct domain *d)
          * Access to 1 byte RTC ports also needs to be trapped in order
          * to keep consistency with PV.
          */
-        __set_bit(0xcf8, d->arch.hvm_domain.io_bitmap);
-        __set_bit(RTC_PORT(0), d->arch.hvm_domain.io_bitmap);
-        __set_bit(RTC_PORT(1), d->arch.hvm_domain.io_bitmap);
+        __set_bit(0xcf8, d->arch.hvm.io_bitmap);
+        __set_bit(RTC_PORT(0), d->arch.hvm.io_bitmap);
+        __set_bit(RTC_PORT(1), d->arch.hvm.io_bitmap);
     }
 }
 
xen/arch/x86/time.c +4 -4
index 69e9aaf..5922fbf 100644
@@ -1039,7 +1039,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
 
         if ( is_hvm_domain(d) )
         {
-            struct pl_time *pl = v->domain->arch.hvm_domain.pl_time;
+            struct pl_time *pl = v->domain->arch.hvm.pl_time;
 
             stime += pl->stime_offset + v->arch.hvm_vcpu.stime_offset;
             if ( stime >= 0 )
@@ -2183,7 +2183,7 @@ void tsc_set_info(struct domain *d,
     if ( is_hvm_domain(d) )
     {
         if ( hvm_tsc_scaling_supported && !d->arch.vtsc )
-            d->arch.hvm_domain.tsc_scaling_ratio =
+            d->arch.hvm.tsc_scaling_ratio =
                 hvm_get_tsc_scaling_ratio(d->arch.tsc_khz);
 
         hvm_set_rdtsc_exiting(d, d->arch.vtsc);
@@ -2197,10 +2197,10 @@ void tsc_set_info(struct domain *d,
              * call set_tsc_offset() later from hvm_vcpu_reset_state() and they
              * will sync their TSC to BSP's sync_tsc.
              */
-            d->arch.hvm_domain.sync_tsc = rdtsc();
+            d->arch.hvm.sync_tsc = rdtsc();
             hvm_set_tsc_offset(d->vcpu[0],
                                d->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset,
-                               d->arch.hvm_domain.sync_tsc);
+                               d->arch.hvm.sync_tsc);
         }
     }
 
xen/common/vm_event.c +1 -1
index 144ab81..4793aac 100644
@@ -48,7 +48,7 @@ static int vm_event_enable(
     xen_event_channel_notification_t notification_fn)
 {
     int rc;
-    unsigned long ring_gfn = d->arch.hvm_domain.params[param];
+    unsigned long ring_gfn = d->arch.hvm.params[param];
 
     if ( !*ved )
         *ved = xzalloc(struct vm_event_domain);
xen/drivers/passthrough/pci.c +1 -1
index d1adffa..2644048 100644
@@ -1417,7 +1417,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
     /* Prevent device assign if mem paging or mem sharing have been 
      * enabled for this domain */
     if ( unlikely(!need_iommu(d) &&
-            (d->arch.hvm_domain.mem_sharing_enabled ||
+            (d->arch.hvm.mem_sharing_enabled ||
              vm_event_check_ring(d->vm_event_paging) ||
              p2m_get_hostp2m(d)->global_logdirty)) )
         return -EXDEV;
xen/drivers/vpci/msix.c +3 -3
index bcf6325..1960dae 100644
@@ -152,7 +152,7 @@ static struct vpci_msix *msix_find(const struct domain *d, unsigned long addr)
 {
     struct vpci_msix *msix;
 
-    list_for_each_entry ( msix, &d->arch.hvm_domain.msix_tables, next )
+    list_for_each_entry ( msix, &d->arch.hvm.msix_tables, next )
     {
         const struct vpci_bar *bars = msix->pdev->vpci->header.bars;
         unsigned int i;
@@ -438,10 +438,10 @@ static int init_msix(struct pci_dev *pdev)
     if ( rc )
         return rc;
 
-    if ( list_empty(&d->arch.hvm_domain.msix_tables) )
+    if ( list_empty(&d->arch.hvm.msix_tables) )
         register_mmio_handler(d, &vpci_msix_table_ops);
 
-    list_add(&pdev->vpci->msix->next, &d->arch.hvm_domain.msix_tables);
+    list_add(&pdev->vpci->msix->next, &d->arch.hvm.msix_tables);
 
     return 0;
 }
xen/include/asm-arm/domain.h +1 -1
index 280c395..d682307 100644
@@ -51,7 +51,7 @@ struct arch_domain
     /* Virtual MMU */
     struct p2m_domain p2m;
 
-    struct hvm_domain hvm_domain;
+    struct hvm_domain hvm;
 
     struct vmmio vmmio;
 
xen/include/asm-x86/domain.h +2 -2
index fdd6856..4722c2d 100644
@@ -17,7 +17,7 @@
 #define is_pv_32bit_vcpu(v)    (is_pv_32bit_domain((v)->domain))
 
 #define is_hvm_pv_evtchn_domain(d) (is_hvm_domain(d) && \
-        (d)->arch.hvm_domain.irq->callback_via_type == HVMIRQ_callback_vector)
+        (d)->arch.hvm.irq->callback_via_type == HVMIRQ_callback_vector)
 #define is_hvm_pv_evtchn_vcpu(v) (is_hvm_pv_evtchn_domain(v->domain))
 #define is_domain_direct_mapped(d) ((void)(d), 0)
 
@@ -306,7 +306,7 @@ struct arch_domain
 
     union {
         struct pv_domain pv;
-        struct hvm_domain hvm_domain;
+        struct hvm_domain hvm;
     };
 
     struct paging_domain paging;
xen/include/asm-x86/hvm/domain.h +1 -1
index 5885950..acf8e03 100644
@@ -202,7 +202,7 @@ struct hvm_domain {
     };
 };
 
-#define hap_enabled(d)  ((d)->arch.hvm_domain.hap_enabled)
+#define hap_enabled(d)  ((d)->arch.hvm.hap_enabled)
 
 #endif /* __ASM_X86_HVM_DOMAIN_H__ */
 
xen/include/asm-x86/hvm/hvm.h +5 -6
index 5ea507b..ac0f035 100644
@@ -266,7 +266,7 @@ u64 hvm_get_guest_tsc_fixed(struct vcpu *v, u64 at_tsc);
     (1ULL << hvm_funcs.tsc_scaling.ratio_frac_bits)
 
 #define hvm_tsc_scaling_ratio(d) \
-    ((d)->arch.hvm_domain.tsc_scaling_ratio)
+    ((d)->arch.hvm.tsc_scaling_ratio)
 
 u64 hvm_scale_tsc(const struct domain *d, u64 tsc);
 u64 hvm_get_tsc_scaling_ratio(u32 gtsc_khz);
@@ -391,10 +391,10 @@ static inline bool hvm_get_guest_bndcfgs(struct vcpu *v, u64 *val)
 bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
 
 #define has_hvm_params(d) \
-    ((d)->arch.hvm_domain.params != NULL)
+    ((d)->arch.hvm.params != NULL)
 
 #define viridian_feature_mask(d) \
-    (has_hvm_params(d) ? (d)->arch.hvm_domain.params[HVM_PARAM_VIRIDIAN] : 0)
+    (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
 
 #define is_viridian_domain(d) \
     (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
@@ -670,9 +670,8 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d, bool restore);
 #define arch_vcpu_block(v) ({                                   \
     struct vcpu *v_ = (v);                                      \
     struct domain *d_ = v_->domain;                             \
-    if ( is_hvm_domain(d_) &&                               \
-         (d_->arch.hvm_domain.pi_ops.vcpu_block) )          \
-        d_->arch.hvm_domain.pi_ops.vcpu_block(v_);          \
+    if ( is_hvm_domain(d_) && d_->arch.hvm.pi_ops.vcpu_block )  \
+        d_->arch.hvm.pi_ops.vcpu_block(v_);                     \
 })
 
 #endif /* __ASM_X86_HVM_HVM_H__ */
xen/include/asm-x86/hvm/irq.h +1 -1
index 8a43cb9..2e6fa70 100644
@@ -97,7 +97,7 @@ struct hvm_irq {
     (((((dev)<<2) + ((dev)>>3) + (intx)) & 31) + 16)
 #define hvm_pci_intx_link(dev, intx) \
     (((dev) + (intx)) & 3)
-#define hvm_domain_irq(d) ((d)->arch.hvm_domain.irq)
+#define hvm_domain_irq(d) ((d)->arch.hvm.irq)
 #define hvm_irq_size(cnt) offsetof(struct hvm_irq, gsi_assert_count[cnt])
 
 #define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2)
xen/include/asm-x86/hvm/nestedhvm.h +2 -2
index 3c810b7..4a041e2 100644
@@ -35,8 +35,8 @@ enum nestedhvm_vmexits {
 /* Nested HVM on/off per domain */
 static inline bool nestedhvm_enabled(const struct domain *d)
 {
-    return is_hvm_domain(d) && d->arch.hvm_domain.params &&
-        d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM];
+    return is_hvm_domain(d) && d->arch.hvm.params &&
+        d->arch.hvm.params[HVM_PARAM_NESTEDHVM];
 }
 
 /* Nested VCPU */
xen/include/asm-x86/hvm/vioapic.h +1 -1
index 138d2c0..a72cd17 100644
@@ -58,7 +58,7 @@ struct hvm_vioapic {
 };
 
 #define hvm_vioapic_size(cnt) offsetof(struct hvm_vioapic, redirtbl[cnt])
-#define domain_vioapic(d, i) ((d)->arch.hvm_domain.vioapic[i])
+#define domain_vioapic(d, i) ((d)->arch.hvm.vioapic[i])
 #define vioapic_domain(v) ((v)->domain)
 
 int vioapic_init(struct domain *d);
xen/include/asm-x86/hvm/vpt.h +2 -2
index 61c26ed..99169dd 100644
@@ -150,8 +150,8 @@ void pt_migrate(struct vcpu *v);
 
 void pt_adjust_global_vcpu_target(struct vcpu *v);
 #define pt_global_vcpu_target(d) \
-    (is_hvm_domain(d) && (d)->arch.hvm_domain.i8259_target ? \
-     (d)->arch.hvm_domain.i8259_target : \
+    (is_hvm_domain(d) && (d)->arch.hvm.i8259_target ? \
+     (d)->arch.hvm.i8259_target : \
      (d)->vcpu ? (d)->vcpu[0] : NULL)
 
 void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt);
xen/include/asm-x86/irq.h +1 -2
index d9dad39..054c3ab 100644
@@ -188,8 +188,7 @@ void cleanup_domain_irq_mapping(struct domain *);
 #define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq,              \
     arch.hvm.emuirq, IRQ_UNBOUND)
 #define domain_emuirq_to_pirq(d, emuirq) ({                             \
-    void *__ret = radix_tree_lookup(&(d)->arch.hvm_domain.emuirq_pirq,  \
-                                    emuirq);                            \
+    void *__ret = radix_tree_lookup(&(d)->arch.hvm.emuirq_pirq, emuirq);\
     __ret ? radix_tree_ptr_to_int(__ret) : IRQ_UNBOUND;                 \
 })
 #define IRQ_UNBOUND -1
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 3/7
#8 lore raw

Re: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

Quoted 8 lines · Andrew Cooper

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 3/7
#9 lore raw

Re: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

In reply to Andrew Cooper
Quoted 8 lines · Andrew Cooper

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

Quoted 18 lines
xen/arch/x86/domain.c +1 -1
index 4cdcd5d..3dcd7f9 100644
@@ -505,7 +505,7 @@ int arch_domain_create(struct domain *d,
 
     /* Need to determine if HAP is enabled before initialising paging */
     if ( is_hvm_domain(d) )
-        d->arch.hvm_domain.hap_enabled =
+        d->arch.hvm.hap_enabled =
             hvm_hap_supported() && (config->flags & XEN_DOMCTL_CDF_hap);
 
     if ( (rc = paging_domain_init(d, config->flags)) != 0 )
xen/arch/x86/domctl.c +0 -0
index fdbcce0..f306614 100644

xen/arch/x86/domctl.c long arch_do_domctl( · line 748

Quoted 5 lines
xen/arch/x86/domctl.c +1 -1
@@ -745,7 +745,7 @@ long arch_do_domctl(
         unsigned int fmp = domctl->u.ioport_mapping.first_mport;
         unsigned int np = domctl->u.ioport_mapping.nr_ports;
         unsigned int add = domctl->u.ioport_mapping.add_mapping;
-        struct hvm_domain *hvm_domain;
+        struct hvm_domain *hvm;

Yet I think this hvm is clearer if it stays hvm_domain. I don't feel too strong for this though.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 3/7
#10 lore raw

Re: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

In reply to Andrew Cooper
Quoted 5 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Wednesday, August 29, 2018 1:39 AM

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Quoted 7 lines

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers
where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 3/7
#11 lore raw

Re: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

In reply to Andrew Cooper

xen/arch/x86/hvm/vmsi.c static DEFINE_RCU_READ_LOCK(msixtbl_rcu_lock); · line 176

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:
xen/arch/x86/hvm/vmsi.c +1 -1
@@ -173,7 +173,7 @@ static DEFINE_RCU_READ_LOCK(msixtbl_rcu_lock);
  */
 static bool msixtbl_initialised(const struct domain *d)
 {
-    return !!d->arch.hvm_domain.msixtbl_list.next;
+    return !!d->arch.hvm.msixtbl_list.next;

How about dropping the !! here at the same time?

xen/arch/x86/hvm/vmsi.c void vmx_vcpu_flush_pml_buffer(struct vcpu *v) · line 1647

Quoted 7 lines
xen/arch/x86/hvm/vmsi.c +1 -1
@@ -1643,7 +1643,7 @@ void vmx_vcpu_flush_pml_buffer(struct vcpu *v)
 
 bool_t vmx_domain_pml_enabled(const struct domain *d)
 {
-    return !!(d->arch.hvm_domain.vmx.status & VMX_DOMAIN_PML_ENABLED);
+    return !!(d->arch.hvm.vmx.status & VMX_DOMAIN_PML_ENABLED);
 }

And here.

xen/arch/x86/hvm/vmsi.c static void vpic_update_int_output(struct hvm_hw_vpic *vpic) · line 116

Quoted 7 lines
xen/arch/x86/hvm/vmsi.c +1 -1
@@ -112,7 +112,7 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic)
         if ( vpic->is_master )
         {
             /* Master INT line is connected in Virtual Wire Mode. */
-            struct vcpu *v = vpic_domain(vpic)->arch.hvm_domain.i8259_target;
+            struct vcpu *v = vpic_domain(vpic)->arch.hvm.i8259_target;
             if ( v != NULL )

And adding a blank line here?

In any event

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 3/7
#12 lore raw

Re: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

In reply to Andrew Cooper

Hi Andrew,

Quoted 8 lines · Andrew Cooper

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

Cheers,

Quoted 3,152 lines

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Razvan Cojocaru <[email protected]>
CC: Tamas K Lengyel <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>

---
  xen/arch/arm/domain_build.c         |   2 +-
  xen/arch/arm/hvm.c                  |   4 +-
  xen/arch/x86/domain.c               |   2 +-
  xen/arch/x86/domctl.c               |  10 +--
  xen/arch/x86/hvm/dom0_build.c       |   4 +-
  xen/arch/x86/hvm/domain.c           |   2 +-
  xen/arch/x86/hvm/hpet.c             |   8 +-
  xen/arch/x86/hvm/hvm.c              | 145 +++++++++++++++++-------------------
  xen/arch/x86/hvm/hypercall.c        |   6 +-
  xen/arch/x86/hvm/intercept.c        |  14 ++--
  xen/arch/x86/hvm/io.c               |  48 ++++++------
  xen/arch/x86/hvm/ioreq.c            |  80 ++++++++++----------
  xen/arch/x86/hvm/irq.c              |  50 ++++++-------
  xen/arch/x86/hvm/mtrr.c             |  14 ++--
  xen/arch/x86/hvm/pmtimer.c          |  40 +++++-----
  xen/arch/x86/hvm/rtc.c              |   4 +-
  xen/arch/x86/hvm/save.c             |   6 +-
  xen/arch/x86/hvm/stdvga.c           |  18 ++---
  xen/arch/x86/hvm/svm/svm.c          |   5 +-
  xen/arch/x86/hvm/svm/vmcb.c         |   2 +-
  xen/arch/x86/hvm/vioapic.c          |  44 +++++------
  xen/arch/x86/hvm/viridian.c         |  56 +++++++-------
  xen/arch/x86/hvm/vlapic.c           |   8 +-
  xen/arch/x86/hvm/vmsi.c             |  14 ++--
  xen/arch/x86/hvm/vmx/vmcs.c         |  12 +--
  xen/arch/x86/hvm/vmx/vmx.c          |  46 ++++++------
  xen/arch/x86/hvm/vpic.c             |  20 ++---
  xen/arch/x86/hvm/vpt.c              |  20 ++---
  xen/arch/x86/irq.c                  |  10 +--
  xen/arch/x86/mm/hap/hap.c           |  11 ++-
  xen/arch/x86/mm/mem_sharing.c       |   6 +-
  xen/arch/x86/mm/shadow/common.c     |  18 ++---
  xen/arch/x86/mm/shadow/multi.c      |   8 +-
  xen/arch/x86/physdev.c              |   2 +-
  xen/arch/x86/setup.c                |  10 +--
  xen/arch/x86/time.c                 |   8 +-
  xen/common/vm_event.c               |   2 +-
  xen/drivers/passthrough/pci.c       |   2 +-
  xen/drivers/vpci/msix.c             |   6 +-
  xen/include/asm-arm/domain.h        |   2 +-
  xen/include/asm-x86/domain.h        |   4 +-
  xen/include/asm-x86/hvm/domain.h    |   2 +-
  xen/include/asm-x86/hvm/hvm.h       |  11 ++-
  xen/include/asm-x86/hvm/irq.h       |   2 +-
  xen/include/asm-x86/hvm/nestedhvm.h |   4 +-
  xen/include/asm-x86/hvm/vioapic.h   |   2 +-
  xen/include/asm-x86/hvm/vpt.h       |   4 +-
  xen/include/asm-x86/irq.h           |   3 +-
  48 files changed, 395 insertions(+), 406 deletions(-)
xen/arch/arm/domain_build.c +1 -1
index e1c79b2..72fd2ae 100644
@@ -2075,7 +2075,7 @@ static void __init evtchn_allocate(struct domain *d)
      val |= MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL,
                       HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK);
      val |= d->arch.evtchn_irq;
-    d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val;
+    d->arch.hvm.params[HVM_PARAM_CALLBACK_IRQ] = val;
  }
 
  static void __init find_gnttab_region(struct domain *d,
xen/arch/arm/hvm.c +2 -2
index a56b3fe..76b27c9 100644
@@ -59,11 +59,11 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
 
          if ( op == HVMOP_set_param )
          {
-            d->arch.hvm_domain.params[a.index] = a.value;
+            d->arch.hvm.params[a.index] = a.value;
          }
          else
          {
-            a.value = d->arch.hvm_domain.params[a.index];
+            a.value = d->arch.hvm.params[a.index];
              rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
          }
 
xen/arch/x86/domain.c +1 -1
index 4cdcd5d..3dcd7f9 100644
@@ -505,7 +505,7 @@ int arch_domain_create(struct domain *d,
 
      /* Need to determine if HAP is enabled before initialising paging */
      if ( is_hvm_domain(d) )
-        d->arch.hvm_domain.hap_enabled =
+        d->arch.hvm.hap_enabled =
              hvm_hap_supported() && (config->flags & XEN_DOMCTL_CDF_hap);
 
      if ( (rc = paging_domain_init(d, config->flags)) != 0 )
xen/arch/x86/domctl.c +5 -5
index fdbcce0..f306614 100644
@@ -745,7 +745,7 @@ long arch_do_domctl(
          unsigned int fmp = domctl->u.ioport_mapping.first_mport;
          unsigned int np = domctl->u.ioport_mapping.nr_ports;
          unsigned int add = domctl->u.ioport_mapping.add_mapping;
-        struct hvm_domain *hvm_domain;
+        struct hvm_domain *hvm;
          struct g2m_ioport *g2m_ioport;
          int found = 0;
 
@@ -774,14 +774,14 @@ long arch_do_domctl(
          if ( ret )
              break;
 
-        hvm_domain = &d->arch.hvm_domain;
+        hvm = &d->arch.hvm;
          if ( add )
          {
              printk(XENLOG_G_INFO
                     "ioport_map:add: dom%d gport=%x mport=%x nr=%x\n",
                     d->domain_id, fgp, fmp, np);
 
-            list_for_each_entry(g2m_ioport, &hvm_domain->g2m_ioport_list, list)
+            list_for_each_entry(g2m_ioport, &hvm->g2m_ioport_list, list)
                  if (g2m_ioport->mport == fmp )
                  {
                      g2m_ioport->gport = fgp;
@@ -800,7 +800,7 @@ long arch_do_domctl(
                  g2m_ioport->gport = fgp;
                  g2m_ioport->mport = fmp;
                  g2m_ioport->np = np;
-                list_add_tail(&g2m_ioport->list, &hvm_domain->g2m_ioport_list);
+                list_add_tail(&g2m_ioport->list, &hvm->g2m_ioport_list);
              }
              if ( !ret )
                  ret = ioports_permit_access(d, fmp, fmp + np - 1);
@@ -815,7 +815,7 @@ long arch_do_domctl(
              printk(XENLOG_G_INFO
                     "ioport_map:remove: dom%d gport=%x mport=%x nr=%x\n",
                     d->domain_id, fgp, fmp, np);
-            list_for_each_entry(g2m_ioport, &hvm_domain->g2m_ioport_list, list)
+            list_for_each_entry(g2m_ioport, &hvm->g2m_ioport_list, list)
                  if ( g2m_ioport->mport == fmp )
                  {
                      list_del(&g2m_ioport->list);
xen/arch/x86/hvm/dom0_build.c +2 -2
index 5065729..22e335f 100644
@@ -240,7 +240,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d)
          if ( hvm_copy_to_guest_phys(gaddr, NULL, HVM_VM86_TSS_SIZE, v) !=
               HVMTRANS_okay )
              printk("Unable to zero VM86 TSS area\n");
-        d->arch.hvm_domain.params[HVM_PARAM_VM86_TSS_SIZED] =
+        d->arch.hvm.params[HVM_PARAM_VM86_TSS_SIZED] =
              VM86_TSS_UPDATED | ((uint64_t)HVM_VM86_TSS_SIZE << 32) | gaddr;
          if ( pvh_add_mem_range(d, gaddr, gaddr + HVM_VM86_TSS_SIZE,
                                 E820_RESERVED) )
@@ -271,7 +271,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d)
      write_32bit_pse_identmap(ident_pt);
      unmap_domain_page(ident_pt);
      put_page(mfn_to_page(mfn));
-    d->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] = gaddr;
+    d->arch.hvm.params[HVM_PARAM_IDENT_PT] = gaddr;
      if ( pvh_add_mem_range(d, gaddr, gaddr + PAGE_SIZE, E820_RESERVED) )
              printk("Unable to set identity page tables as reserved in the memory map\n");
 
xen/arch/x86/hvm/domain.c +1 -1
index ae70aaf..8a2c83e 100644
@@ -319,7 +319,7 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
      v->arch.hvm_vcpu.cache_tsc_offset =
          d->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset;
      hvm_set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset,
-                       d->arch.hvm_domain.sync_tsc);
+                       d->arch.hvm.sync_tsc);
 
      paging_update_paging_modes(v);
 
xen/arch/x86/hvm/hpet.c +4 -4
index a594254..8090699 100644
@@ -26,7 +26,7 @@
  #include <xen/event.h>
  #include <xen/trace.h>
 
-#define domain_vhpet(x) (&(x)->arch.hvm_domain.pl_time->vhpet)
+#define domain_vhpet(x) (&(x)->arch.hvm.pl_time->vhpet)
  #define vcpu_vhpet(x)   (domain_vhpet((x)->domain))
  #define vhpet_domain(x) (container_of(x, struct pl_time, vhpet)->domain)
  #define vhpet_vcpu(x)   (pt_global_vcpu_target(vhpet_domain(x)))
@@ -164,7 +164,7 @@ static int hpet_read(
      unsigned long result;
      uint64_t val;
 
-    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] )
+    if ( !v->domain->arch.hvm.params[HVM_PARAM_HPET_ENABLED] )
      {
          result = ~0ul;
          goto out;
@@ -354,7 +354,7 @@ static int hpet_write(
  #define set_start_timer(n)   (__set_bit((n), &start_timers))
  #define set_restart_timer(n) (set_stop_timer(n),set_start_timer(n))
 
-    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] )
+    if ( !v->domain->arch.hvm.params[HVM_PARAM_HPET_ENABLED] )
          goto out;
 
      addr &= HPET_MMAP_SIZE-1;
@@ -735,7 +735,7 @@ void hpet_init(struct domain *d)
 
      hpet_set(domain_vhpet(d));
      register_mmio_handler(d, &hpet_mmio_ops);
-    d->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] = 1;
+    d->arch.hvm.params[HVM_PARAM_HPET_ENABLED] = 1;
  }
 
  void hpet_deinit(struct domain *d)
xen/arch/x86/hvm/hvm.c +69 -76
index 72c51fa..f895339 100644
@@ -382,7 +382,7 @@ u64 hvm_get_tsc_scaling_ratio(u32 gtsc_khz)
 
  u64 hvm_scale_tsc(const struct domain *d, u64 tsc)
  {
-    u64 ratio = d->arch.hvm_domain.tsc_scaling_ratio;
+    u64 ratio = d->arch.hvm.tsc_scaling_ratio;
      u64 dummy;
 
      if ( ratio == hvm_default_tsc_scaling_ratio )
@@ -583,14 +583,14 @@ int hvm_domain_initialise(struct domain *d)
          return -EINVAL;
      }
 
-    spin_lock_init(&d->arch.hvm_domain.irq_lock);
-    spin_lock_init(&d->arch.hvm_domain.uc_lock);
-    spin_lock_init(&d->arch.hvm_domain.write_map.lock);
-    rwlock_init(&d->arch.hvm_domain.mmcfg_lock);
-    INIT_LIST_HEAD(&d->arch.hvm_domain.write_map.list);
-    INIT_LIST_HEAD(&d->arch.hvm_domain.g2m_ioport_list);
-    INIT_LIST_HEAD(&d->arch.hvm_domain.mmcfg_regions);
-    INIT_LIST_HEAD(&d->arch.hvm_domain.msix_tables);
+    spin_lock_init(&d->arch.hvm.irq_lock);
+    spin_lock_init(&d->arch.hvm.uc_lock);
+    spin_lock_init(&d->arch.hvm.write_map.lock);
+    rwlock_init(&d->arch.hvm.mmcfg_lock);
+    INIT_LIST_HEAD(&d->arch.hvm.write_map.list);
+    INIT_LIST_HEAD(&d->arch.hvm.g2m_ioport_list);
+    INIT_LIST_HEAD(&d->arch.hvm.mmcfg_regions);
+    INIT_LIST_HEAD(&d->arch.hvm.msix_tables);
 
      rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
      if ( rc )
@@ -603,15 +603,15 @@ int hvm_domain_initialise(struct domain *d)
          goto fail0;
 
      nr_gsis = is_hardware_domain(d) ? nr_irqs_gsi : NR_HVM_DOMU_IRQS;
-    d->arch.hvm_domain.pl_time = xzalloc(struct pl_time);
-    d->arch.hvm_domain.params = xzalloc_array(uint64_t, HVM_NR_PARAMS);
-    d->arch.hvm_domain.io_handler = xzalloc_array(struct hvm_io_handler,
-                                                  NR_IO_HANDLERS);
-    d->arch.hvm_domain.irq = xzalloc_bytes(hvm_irq_size(nr_gsis));
+    d->arch.hvm.pl_time = xzalloc(struct pl_time);
+    d->arch.hvm.params = xzalloc_array(uint64_t, HVM_NR_PARAMS);
+    d->arch.hvm.io_handler = xzalloc_array(struct hvm_io_handler,
+                                           NR_IO_HANDLERS);
+    d->arch.hvm.irq = xzalloc_bytes(hvm_irq_size(nr_gsis));
 
      rc = -ENOMEM;
-    if ( !d->arch.hvm_domain.pl_time || !d->arch.hvm_domain.irq ||
-         !d->arch.hvm_domain.params  || !d->arch.hvm_domain.io_handler )
+    if ( !d->arch.hvm.pl_time || !d->arch.hvm.irq ||
+         !d->arch.hvm.params  || !d->arch.hvm.io_handler )
          goto fail1;
 
      /* Set the number of GSIs */
@@ -621,21 +621,21 @@ int hvm_domain_initialise(struct domain *d)
      ASSERT(hvm_domain_irq(d)->nr_gsis >= NR_ISAIRQS);
 
      /* need link to containing domain */
-    d->arch.hvm_domain.pl_time->domain = d;
+    d->arch.hvm.pl_time->domain = d;
 
      /* Set the default IO Bitmap. */
      if ( is_hardware_domain(d) )
      {
-        d->arch.hvm_domain.io_bitmap = _xmalloc(HVM_IOBITMAP_SIZE, PAGE_SIZE);
-        if ( d->arch.hvm_domain.io_bitmap == NULL )
+        d->arch.hvm.io_bitmap = _xmalloc(HVM_IOBITMAP_SIZE, PAGE_SIZE);
+        if ( d->arch.hvm.io_bitmap == NULL )
          {
              rc = -ENOMEM;
              goto fail1;
          }
-        memset(d->arch.hvm_domain.io_bitmap, ~0, HVM_IOBITMAP_SIZE);
+        memset(d->arch.hvm.io_bitmap, ~0, HVM_IOBITMAP_SIZE);
      }
      else
-        d->arch.hvm_domain.io_bitmap = hvm_io_bitmap;
+        d->arch.hvm.io_bitmap = hvm_io_bitmap;
 
      register_g2m_portio_handler(d);
      register_vpci_portio_handler(d);
@@ -644,7 +644,7 @@ int hvm_domain_initialise(struct domain *d)
 
      hvm_init_guest_time(d);
 
-    d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_REASON] = SHUTDOWN_reboot;
+    d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON] = SHUTDOWN_reboot;
 
      vpic_init(d);
 
@@ -659,7 +659,7 @@ int hvm_domain_initialise(struct domain *d)
      register_portio_handler(d, 0xe9, 1, hvm_print_line);
 
      if ( hvm_tsc_scaling_supported )
-        d->arch.hvm_domain.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
+        d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
 
      rc = hvm_funcs.domain_initialise(d);
      if ( rc != 0 )
@@ -673,11 +673,11 @@ int hvm_domain_initialise(struct domain *d)
      vioapic_deinit(d);
   fail1:
      if ( is_hardware_domain(d) )
-        xfree(d->arch.hvm_domain.io_bitmap);
-    xfree(d->arch.hvm_domain.io_handler);
-    xfree(d->arch.hvm_domain.params);
-    xfree(d->arch.hvm_domain.pl_time);
-    xfree(d->arch.hvm_domain.irq);
+        xfree(d->arch.hvm.io_bitmap);
+    xfree(d->arch.hvm.io_handler);
+    xfree(d->arch.hvm.params);
+    xfree(d->arch.hvm.pl_time);
+    xfree(d->arch.hvm.irq);
   fail0:
      hvm_destroy_cacheattr_region_list(d);
      destroy_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0);
@@ -710,11 +710,8 @@ void hvm_domain_destroy(struct domain *d)
      struct list_head *ioport_list, *tmp;
      struct g2m_ioport *ioport;
 
-    xfree(d->arch.hvm_domain.io_handler);
-    d->arch.hvm_domain.io_handler = NULL;
-
-    xfree(d->arch.hvm_domain.params);
-    d->arch.hvm_domain.params = NULL;
+    XFREE(d->arch.hvm.io_handler);
+    XFREE(d->arch.hvm.params);
 
      hvm_destroy_cacheattr_region_list(d);
 
@@ -723,14 +720,10 @@ void hvm_domain_destroy(struct domain *d)
      stdvga_deinit(d);
      vioapic_deinit(d);
 
-    xfree(d->arch.hvm_domain.pl_time);
-    d->arch.hvm_domain.pl_time = NULL;
-
-    xfree(d->arch.hvm_domain.irq);
-    d->arch.hvm_domain.irq = NULL;
+    XFREE(d->arch.hvm.pl_time);
+    XFREE(d->arch.hvm.irq);
 
-    list_for_each_safe ( ioport_list, tmp,
-                         &d->arch.hvm_domain.g2m_ioport_list )
+    list_for_each_safe ( ioport_list, tmp, &d->arch.hvm.g2m_ioport_list )
      {
          ioport = list_entry(ioport_list, struct g2m_ioport, list);
          list_del(&ioport->list);
@@ -798,7 +791,7 @@ static int hvm_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
          /* Architecture-specific vmcs/vmcb bits */
          hvm_funcs.save_cpu_ctxt(v, &ctxt);
 
-        ctxt.tsc = hvm_get_guest_tsc_fixed(v, d->arch.hvm_domain.sync_tsc);
+        ctxt.tsc = hvm_get_guest_tsc_fixed(v, d->arch.hvm.sync_tsc);
 
          ctxt.msr_tsc_aux = hvm_msr_tsc_aux(v);
 
@@ -1053,7 +1046,7 @@ static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
 
      v->arch.hvm_vcpu.msr_tsc_aux = ctxt.msr_tsc_aux;
 
-    hvm_set_guest_tsc_fixed(v, ctxt.tsc, d->arch.hvm_domain.sync_tsc);
+    hvm_set_guest_tsc_fixed(v, ctxt.tsc, d->arch.hvm.sync_tsc);
 
      seg.limit = ctxt.idtr_limit;
      seg.base = ctxt.idtr_base;
@@ -1637,7 +1630,7 @@ void hvm_triple_fault(void)
  {
      struct vcpu *v = current;
      struct domain *d = v->domain;
-    u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_REASON];
+    u8 reason = d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON];
 
      gprintk(XENLOG_INFO,
              "Triple fault - invoking HVM shutdown action %d\n",
@@ -2046,7 +2039,7 @@ static bool_t domain_exit_uc_mode(struct vcpu *v)
 
  static void hvm_set_uc_mode(struct vcpu *v, bool_t is_in_uc_mode)
  {
-    v->domain->arch.hvm_domain.is_in_uc_mode = is_in_uc_mode;
+    v->domain->arch.hvm.is_in_uc_mode = is_in_uc_mode;
      shadow_blow_tables_per_domain(v->domain);
  }
 
@@ -2130,10 +2123,10 @@ void hvm_shadow_handle_cd(struct vcpu *v, unsigned long value)
      if ( value & X86_CR0_CD )
      {
          /* Entering no fill cache mode. */
-        spin_lock(&v->domain->arch.hvm_domain.uc_lock);
+        spin_lock(&v->domain->arch.hvm.uc_lock);
          v->arch.hvm_vcpu.cache_mode = NO_FILL_CACHE_MODE;
 
-        if ( !v->domain->arch.hvm_domain.is_in_uc_mode )
+        if ( !v->domain->arch.hvm.is_in_uc_mode )
          {
              domain_pause_nosync(v->domain);
 
@@ -2143,19 +2136,19 @@ void hvm_shadow_handle_cd(struct vcpu *v, unsigned long value)
 
              domain_unpause(v->domain);
          }
-        spin_unlock(&v->domain->arch.hvm_domain.uc_lock);
+        spin_unlock(&v->domain->arch.hvm.uc_lock);
      }
      else if ( !(value & X86_CR0_CD) &&
                (v->arch.hvm_vcpu.cache_mode == NO_FILL_CACHE_MODE) )
      {
          /* Exit from no fill cache mode. */
-        spin_lock(&v->domain->arch.hvm_domain.uc_lock);
+        spin_lock(&v->domain->arch.hvm.uc_lock);
          v->arch.hvm_vcpu.cache_mode = NORMAL_CACHE_MODE;
 
          if ( domain_exit_uc_mode(v) )
              hvm_set_uc_mode(v, 0);
 
-        spin_unlock(&v->domain->arch.hvm_domain.uc_lock);
+        spin_unlock(&v->domain->arch.hvm.uc_lock);
      }
  }
 
@@ -2597,9 +2590,9 @@ static void *_hvm_map_guest_frame(unsigned long gfn, bool_t permanent,
              return NULL;
          }
          track->page = page;
-        spin_lock(&d->arch.hvm_domain.write_map.lock);
-        list_add_tail(&track->list, &d->arch.hvm_domain.write_map.list);
-        spin_unlock(&d->arch.hvm_domain.write_map.lock);
+        spin_lock(&d->arch.hvm.write_map.lock);
+        list_add_tail(&track->list, &d->arch.hvm.write_map.list);
+        spin_unlock(&d->arch.hvm.write_map.lock);
      }
 
      map = __map_domain_page_global(page);
@@ -2640,8 +2633,8 @@ void hvm_unmap_guest_frame(void *p, bool_t permanent)
          struct hvm_write_map *track;
 
          unmap_domain_page_global(p);
-        spin_lock(&d->arch.hvm_domain.write_map.lock);
-        list_for_each_entry(track, &d->arch.hvm_domain.write_map.list, list)
+        spin_lock(&d->arch.hvm.write_map.lock);
+        list_for_each_entry(track, &d->arch.hvm.write_map.list, list)
              if ( track->page == page )
              {
                  paging_mark_dirty(d, mfn);
@@ -2649,7 +2642,7 @@ void hvm_unmap_guest_frame(void *p, bool_t permanent)
                  xfree(track);
                  break;
              }
-        spin_unlock(&d->arch.hvm_domain.write_map.lock);
+        spin_unlock(&d->arch.hvm.write_map.lock);
      }
 
      put_page(page);
@@ -2659,10 +2652,10 @@ void hvm_mapped_guest_frames_mark_dirty(struct domain *d)
  {
      struct hvm_write_map *track;
 
-    spin_lock(&d->arch.hvm_domain.write_map.lock);
-    list_for_each_entry(track, &d->arch.hvm_domain.write_map.list, list)
+    spin_lock(&d->arch.hvm.write_map.lock);
+    list_for_each_entry(track, &d->arch.hvm.write_map.list, list)
          paging_mark_dirty(d, page_to_mfn(track->page));
-    spin_unlock(&d->arch.hvm_domain.write_map.lock);
+    spin_unlock(&d->arch.hvm.write_map.lock);
  }
 
  static void *hvm_map_entry(unsigned long va, bool_t *writable)
@@ -3942,7 +3935,7 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
      v->arch.hvm_vcpu.cache_tsc_offset =
          v->domain->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset;
      hvm_set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset,
-                       d->arch.hvm_domain.sync_tsc);
+                       d->arch.hvm.sync_tsc);
 
      v->arch.hvm_vcpu.msr_tsc_adjust = 0;
 
@@ -3964,7 +3957,7 @@ static void hvm_s3_suspend(struct domain *d)
      domain_lock(d);
 
      if ( d->is_dying || (d->vcpu == NULL) || (d->vcpu[0] == NULL) ||
-         test_and_set_bool(d->arch.hvm_domain.is_s3_suspended) )
+         test_and_set_bool(d->arch.hvm.is_s3_suspended) )
      {
          domain_unlock(d);
          domain_unpause(d);
@@ -3994,7 +3987,7 @@ static void hvm_s3_suspend(struct domain *d)
 
  static void hvm_s3_resume(struct domain *d)
  {
-    if ( test_and_clear_bool(d->arch.hvm_domain.is_s3_suspended) )
+    if ( test_and_clear_bool(d->arch.hvm.is_s3_suspended) )
      {
          struct vcpu *v;
 
@@ -4074,7 +4067,7 @@ static int hvmop_set_evtchn_upcall_vector(
  static int hvm_allow_set_param(struct domain *d,
                                 const struct xen_hvm_param *a)
  {
-    uint64_t value = d->arch.hvm_domain.params[a->index];
+    uint64_t value = d->arch.hvm.params[a->index];
      int rc;
 
      rc = xsm_hvm_param(XSM_TARGET, d, HVMOP_set_param);
@@ -4177,7 +4170,7 @@ static int hvmop_set_param(
           */
          if ( !paging_mode_hap(d) || !cpu_has_vmx )
          {
-            d->arch.hvm_domain.params[a.index] = a.value;
+            d->arch.hvm.params[a.index] = a.value;
              break;
          }
 
@@ -4192,7 +4185,7 @@ static int hvmop_set_param(
 
          rc = 0;
          domain_pause(d);
-        d->arch.hvm_domain.params[a.index] = a.value;
+        d->arch.hvm.params[a.index] = a.value;
          for_each_vcpu ( d, v )
              paging_update_cr3(v, false);
          domain_unpause(d);
@@ -4241,11 +4234,11 @@ static int hvmop_set_param(
          if ( !paging_mode_hap(d) && a.value )
              rc = -EINVAL;
          if ( a.value &&
-             d->arch.hvm_domain.params[HVM_PARAM_ALTP2M] )
+             d->arch.hvm.params[HVM_PARAM_ALTP2M] )
              rc = -EINVAL;
          /* Set up NHVM state for any vcpus that are already up. */
          if ( a.value &&
-             !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )
+             !d->arch.hvm.params[HVM_PARAM_NESTEDHVM] )
              for_each_vcpu(d, v)
                  if ( rc == 0 )
                      rc = nestedhvm_vcpu_initialise(v);
@@ -4260,7 +4253,7 @@ static int hvmop_set_param(
          if ( a.value > XEN_ALTP2M_limited )
              rc = -EINVAL;
          if ( a.value &&
-             d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )
+             d->arch.hvm.params[HVM_PARAM_NESTEDHVM] )
              rc = -EINVAL;
          break;
      case HVM_PARAM_BUFIOREQ_EVTCHN:
@@ -4271,20 +4264,20 @@ static int hvmop_set_param(
              rc = -EINVAL;
          break;
      case HVM_PARAM_IOREQ_SERVER_PFN:
-        d->arch.hvm_domain.ioreq_gfn.base = a.value;
+        d->arch.hvm.ioreq_gfn.base = a.value;
          break;
      case HVM_PARAM_NR_IOREQ_SERVER_PAGES:
      {
          unsigned int i;
 
          if ( a.value == 0 ||
-             a.value > sizeof(d->arch.hvm_domain.ioreq_gfn.mask) * 8 )
+             a.value > sizeof(d->arch.hvm.ioreq_gfn.mask) * 8 )
          {
              rc = -EINVAL;
              break;
          }
          for ( i = 0; i < a.value; i++ )
-            set_bit(i, &d->arch.hvm_domain.ioreq_gfn.mask);
+            set_bit(i, &d->arch.hvm.ioreq_gfn.mask);
 
          break;
      }
@@ -4339,7 +4332,7 @@ static int hvmop_set_param(
      if ( rc != 0 )
          goto out;
 
-    d->arch.hvm_domain.params[a.index] = a.value;
+    d->arch.hvm.params[a.index] = a.value;
 
      HVM_DBG_LOG(DBG_LEVEL_HCALL, "set param %u = %"PRIx64,
                  a.index, a.value);
@@ -4418,15 +4411,15 @@ static int hvmop_get_param(
      switch ( a.index )
      {
      case HVM_PARAM_ACPI_S_STATE:
-        a.value = d->arch.hvm_domain.is_s3_suspended ? 3 : 0;
+        a.value = d->arch.hvm.is_s3_suspended ? 3 : 0;
          break;
 
      case HVM_PARAM_VM86_TSS:
-        a.value = (uint32_t)d->arch.hvm_domain.params[HVM_PARAM_VM86_TSS_SIZED];
+        a.value = (uint32_t)d->arch.hvm.params[HVM_PARAM_VM86_TSS_SIZED];
          break;
 
      case HVM_PARAM_VM86_TSS_SIZED:
-        a.value = d->arch.hvm_domain.params[HVM_PARAM_VM86_TSS_SIZED] &
+        a.value = d->arch.hvm.params[HVM_PARAM_VM86_TSS_SIZED] &
                    ~VM86_TSS_UPDATED;
          break;
 
@@ -4453,7 +4446,7 @@ static int hvmop_get_param(
 
      /*FALLTHRU*/
      default:
-        a.value = d->arch.hvm_domain.params[a.index];
+        a.value = d->arch.hvm.params[a.index];
          break;
      }
 
@@ -4553,7 +4546,7 @@ static int do_altp2m_op(
          goto out;
      }
 
-    mode = d->arch.hvm_domain.params[HVM_PARAM_ALTP2M];
+    mode = d->arch.hvm.params[HVM_PARAM_ALTP2M];
 
      if ( XEN_ALTP2M_disabled == mode )
      {
xen/arch/x86/hvm/hypercall.c +3 -3
index 85eacd7..3d7ac49 100644
@@ -41,7 +41,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
          rc = compat_memory_op(cmd, arg);
 
      if ( (cmd & MEMOP_CMD_MASK) == XENMEM_decrease_reservation )
-        curr->domain->arch.hvm_domain.qemu_mapcache_invalidate = true;
+        curr->domain->arch.hvm.qemu_mapcache_invalidate = true;
 
      return rc;
  }
@@ -286,8 +286,8 @@ int hvm_hypercall(struct cpu_user_regs *regs)
      if ( curr->hcall_preempted )
          return HVM_HCALL_preempted;
 
-    if ( unlikely(currd->arch.hvm_domain.qemu_mapcache_invalidate) &&
-         test_and_clear_bool(currd->arch.hvm_domain.qemu_mapcache_invalidate) )
+    if ( unlikely(currd->arch.hvm.qemu_mapcache_invalidate) &&
+         test_and_clear_bool(currd->arch.hvm.qemu_mapcache_invalidate) )
          send_invalidate_req();
 
      return HVM_HCALL_completed;
xen/arch/x86/hvm/intercept.c +7 -7
index 2bc156d..aac22c5 100644
@@ -219,10 +219,10 @@ static const struct hvm_io_handler *hvm_find_io_handler(const ioreq_t *p)
      BUG_ON((p->type != IOREQ_TYPE_PIO) &&
             (p->type != IOREQ_TYPE_COPY));
 
-    for ( i = 0; i < curr_d->arch.hvm_domain.io_handler_count; i++ )
+    for ( i = 0; i < curr_d->arch.hvm.io_handler_count; i++ )
      {
          const struct hvm_io_handler *handler =
-            &curr_d->arch.hvm_domain.io_handler[i];
+            &curr_d->arch.hvm.io_handler[i];
          const struct hvm_io_ops *ops = handler->ops;
 
          if ( handler->type != p->type )
@@ -257,9 +257,9 @@ int hvm_io_intercept(ioreq_t *p)
 
  struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
  {
-    unsigned int i = d->arch.hvm_domain.io_handler_count++;
+    unsigned int i = d->arch.hvm.io_handler_count++;
 
-    ASSERT(d->arch.hvm_domain.io_handler);
+    ASSERT(d->arch.hvm.io_handler);
 
      if ( i == NR_IO_HANDLERS )
      {
@@ -267,7 +267,7 @@ struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
          return NULL;
      }
 
-    return &d->arch.hvm_domain.io_handler[i];
+    return &d->arch.hvm.io_handler[i];
  }
 
  void register_mmio_handler(struct domain *d,
@@ -303,10 +303,10 @@ void relocate_portio_handler(struct domain *d, unsigned int old_port,
  {
      unsigned int i;
 
-    for ( i = 0; i < d->arch.hvm_domain.io_handler_count; i++ )
+    for ( i = 0; i < d->arch.hvm.io_handler_count; i++ )
      {
          struct hvm_io_handler *handler =
-            &d->arch.hvm_domain.io_handler[i];
+            &d->arch.hvm.io_handler[i];
 
          if ( handler->type != IOREQ_TYPE_PIO )
              continue;
xen/arch/x86/hvm/io.c +24 -24
index bf4d874..f1ea7d7 100644
@@ -179,12 +179,12 @@ static bool_t g2m_portio_accept(const struct hvm_io_handler *handler,
                                  const ioreq_t *p)
  {
      struct vcpu *curr = current;
-    const struct hvm_domain *hvm_domain = &curr->domain->arch.hvm_domain;
+    const struct hvm_domain *hvm = &curr->domain->arch.hvm;
      struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
      struct g2m_ioport *g2m_ioport;
      unsigned int start, end;
 
-    list_for_each_entry( g2m_ioport, &hvm_domain->g2m_ioport_list, list )
+    list_for_each_entry( g2m_ioport, &hvm->g2m_ioport_list, list )
      {
          start = g2m_ioport->gport;
          end = start + g2m_ioport->np;
@@ -313,12 +313,12 @@ static int vpci_portio_read(const struct hvm_io_handler *handler,
      if ( addr == 0xcf8 )
      {
          ASSERT(size == 4);
-        *data = d->arch.hvm_domain.pci_cf8;
+        *data = d->arch.hvm.pci_cf8;
          return X86EMUL_OKAY;
      }
 
      ASSERT((addr & ~3) == 0xcfc);
-    cf8 = ACCESS_ONCE(d->arch.hvm_domain.pci_cf8);
+    cf8 = ACCESS_ONCE(d->arch.hvm.pci_cf8);
      if ( !CF8_ENABLED(cf8) )
          return X86EMUL_UNHANDLEABLE;
 
@@ -343,12 +343,12 @@ static int vpci_portio_write(const struct hvm_io_handler *handler,
      if ( addr == 0xcf8 )
      {
          ASSERT(size == 4);
-        d->arch.hvm_domain.pci_cf8 = data;
+        d->arch.hvm.pci_cf8 = data;
          return X86EMUL_OKAY;
      }
 
      ASSERT((addr & ~3) == 0xcfc);
-    cf8 = ACCESS_ONCE(d->arch.hvm_domain.pci_cf8);
+    cf8 = ACCESS_ONCE(d->arch.hvm.pci_cf8);
      if ( !CF8_ENABLED(cf8) )
          return X86EMUL_UNHANDLEABLE;
 
@@ -397,7 +397,7 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
  {
      const struct hvm_mmcfg *mmcfg;
 
-    list_for_each_entry ( mmcfg, &d->arch.hvm_domain.mmcfg_regions, next )
+    list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
          if ( addr >= mmcfg->addr && addr < mmcfg->addr + mmcfg->size )
              return mmcfg;
 
@@ -420,9 +420,9 @@ static int vpci_mmcfg_accept(struct vcpu *v, unsigned long addr)
      struct domain *d = v->domain;
      bool found;
 
-    read_lock(&d->arch.hvm_domain.mmcfg_lock);
+    read_lock(&d->arch.hvm.mmcfg_lock);
      found = vpci_mmcfg_find(d, addr);
-    read_unlock(&d->arch.hvm_domain.mmcfg_lock);
+    read_unlock(&d->arch.hvm.mmcfg_lock);
 
      return found;
  }
@@ -437,16 +437,16 @@ static int vpci_mmcfg_read(struct vcpu *v, unsigned long addr,
 
      *data = ~0ul;
 
-    read_lock(&d->arch.hvm_domain.mmcfg_lock);
+    read_lock(&d->arch.hvm.mmcfg_lock);
      mmcfg = vpci_mmcfg_find(d, addr);
      if ( !mmcfg )
      {
-        read_unlock(&d->arch.hvm_domain.mmcfg_lock);
+        read_unlock(&d->arch.hvm.mmcfg_lock);
          return X86EMUL_RETRY;
      }
 
      reg = vpci_mmcfg_decode_addr(mmcfg, addr, &sbdf);
-    read_unlock(&d->arch.hvm_domain.mmcfg_lock);
+    read_unlock(&d->arch.hvm.mmcfg_lock);
 
      if ( !vpci_access_allowed(reg, len) ||
           (reg + len) > PCI_CFG_SPACE_EXP_SIZE )
@@ -479,16 +479,16 @@ static int vpci_mmcfg_write(struct vcpu *v, unsigned long addr,
      unsigned int reg;
      pci_sbdf_t sbdf;
 
-    read_lock(&d->arch.hvm_domain.mmcfg_lock);
+    read_lock(&d->arch.hvm.mmcfg_lock);
      mmcfg = vpci_mmcfg_find(d, addr);
      if ( !mmcfg )
      {
-        read_unlock(&d->arch.hvm_domain.mmcfg_lock);
+        read_unlock(&d->arch.hvm.mmcfg_lock);
          return X86EMUL_RETRY;
      }
 
      reg = vpci_mmcfg_decode_addr(mmcfg, addr, &sbdf);
-    read_unlock(&d->arch.hvm_domain.mmcfg_lock);
+    read_unlock(&d->arch.hvm.mmcfg_lock);
 
      if ( !vpci_access_allowed(reg, len) ||
           (reg + len) > PCI_CFG_SPACE_EXP_SIZE )
@@ -527,8 +527,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
      new->segment = seg;
      new->size = (end_bus - start_bus + 1) << 20;
 
-    write_lock(&d->arch.hvm_domain.mmcfg_lock);
-    list_for_each_entry ( mmcfg, &d->arch.hvm_domain.mmcfg_regions, next )
+    write_lock(&d->arch.hvm.mmcfg_lock);
+    list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
          if ( new->addr < mmcfg->addr + mmcfg->size &&
               mmcfg->addr < new->addr + new->size )
          {
@@ -539,25 +539,25 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
                   new->segment == mmcfg->segment &&
                   new->size == mmcfg->size )
                  ret = 0;
-            write_unlock(&d->arch.hvm_domain.mmcfg_lock);
+            write_unlock(&d->arch.hvm.mmcfg_lock);
              xfree(new);
              return ret;
          }
 
-    if ( list_empty(&d->arch.hvm_domain.mmcfg_regions) )
+    if ( list_empty(&d->arch.hvm.mmcfg_regions) )
          register_mmio_handler(d, &vpci_mmcfg_ops);
 
-    list_add(&new->next, &d->arch.hvm_domain.mmcfg_regions);
-    write_unlock(&d->arch.hvm_domain.mmcfg_lock);
+    list_add(&new->next, &d->arch.hvm.mmcfg_regions);
+    write_unlock(&d->arch.hvm.mmcfg_lock);
 
      return 0;
  }
 
  void destroy_vpci_mmcfg(struct domain *d)
  {
-    struct list_head *mmcfg_regions = &d->arch.hvm_domain.mmcfg_regions;
+    struct list_head *mmcfg_regions = &d->arch.hvm.mmcfg_regions;
 
-    write_lock(&d->arch.hvm_domain.mmcfg_lock);
+    write_lock(&d->arch.hvm.mmcfg_lock);
      while ( !list_empty(mmcfg_regions) )
      {
          struct hvm_mmcfg *mmcfg = list_first_entry(mmcfg_regions,
@@ -566,7 +566,7 @@ void destroy_vpci_mmcfg(struct domain *d)
          list_del(&mmcfg->next);
          xfree(mmcfg);
      }
-    write_unlock(&d->arch.hvm_domain.mmcfg_lock);
+    write_unlock(&d->arch.hvm.mmcfg_lock);
  }
 
  /*
xen/arch/x86/hvm/ioreq.c +40 -40
index 940a2c9..8d60b02 100644
@@ -38,13 +38,13 @@ static void set_ioreq_server(struct domain *d, unsigned int id,
                               struct hvm_ioreq_server *s)
  {
      ASSERT(id < MAX_NR_IOREQ_SERVERS);
-    ASSERT(!s || !d->arch.hvm_domain.ioreq_server.server[id]);
+    ASSERT(!s || !d->arch.hvm.ioreq_server.server[id]);
 
-    d->arch.hvm_domain.ioreq_server.server[id] = s;
+    d->arch.hvm.ioreq_server.server[id] = s;
  }
 
  #define GET_IOREQ_SERVER(d, id) \
-    (d)->arch.hvm_domain.ioreq_server.server[id]
+    (d)->arch.hvm.ioreq_server.server[id]
 
  static struct hvm_ioreq_server *get_ioreq_server(const struct domain *d,
                                                   unsigned int id)
@@ -247,10 +247,10 @@ static gfn_t hvm_alloc_ioreq_gfn(struct hvm_ioreq_server *s)
 
      ASSERT(!IS_DEFAULT(s));
 
-    for ( i = 0; i < sizeof(d->arch.hvm_domain.ioreq_gfn.mask) * 8; i++ )
+    for ( i = 0; i < sizeof(d->arch.hvm.ioreq_gfn.mask) * 8; i++ )
      {
-        if ( test_and_clear_bit(i, &d->arch.hvm_domain.ioreq_gfn.mask) )
-            return _gfn(d->arch.hvm_domain.ioreq_gfn.base + i);
+        if ( test_and_clear_bit(i, &d->arch.hvm.ioreq_gfn.mask) )
+            return _gfn(d->arch.hvm.ioreq_gfn.base + i);
      }
 
      return INVALID_GFN;
@@ -259,12 +259,12 @@ static gfn_t hvm_alloc_ioreq_gfn(struct hvm_ioreq_server *s)
  static void hvm_free_ioreq_gfn(struct hvm_ioreq_server *s, gfn_t gfn)
  {
      struct domain *d = s->target;
-    unsigned int i = gfn_x(gfn) - d->arch.hvm_domain.ioreq_gfn.base;
+    unsigned int i = gfn_x(gfn) - d->arch.hvm.ioreq_gfn.base;
 
      ASSERT(!IS_DEFAULT(s));
      ASSERT(!gfn_eq(gfn, INVALID_GFN));
 
-    set_bit(i, &d->arch.hvm_domain.ioreq_gfn.mask);
+    set_bit(i, &d->arch.hvm.ioreq_gfn.mask);
  }
 
  static void hvm_unmap_ioreq_gfn(struct hvm_ioreq_server *s, bool buf)
@@ -307,8 +307,8 @@ static int hvm_map_ioreq_gfn(struct hvm_ioreq_server *s, bool buf)
 
      if ( IS_DEFAULT(s) )
          iorp->gfn = _gfn(buf ?
-                         d->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_PFN] :
-                         d->arch.hvm_domain.params[HVM_PARAM_IOREQ_PFN]);
+                         d->arch.hvm.params[HVM_PARAM_BUFIOREQ_PFN] :
+                         d->arch.hvm.params[HVM_PARAM_IOREQ_PFN]);
      else
          iorp->gfn = hvm_alloc_ioreq_gfn(s);
 
@@ -394,7 +394,7 @@ bool is_ioreq_server_page(struct domain *d, const struct page_info *page)
      unsigned int id;
      bool found = false;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      FOR_EACH_IOREQ_SERVER(d, id, s)
      {
@@ -405,7 +405,7 @@ bool is_ioreq_server_page(struct domain *d, const struct page_info *page)
          }
      }
 
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return found;
  }
@@ -492,7 +492,7 @@ static int hvm_ioreq_server_add_vcpu(struct hvm_ioreq_server *s,
 
          s->bufioreq_evtchn = rc;
          if ( IS_DEFAULT(s) )
-            d->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_EVTCHN] =
+            d->arch.hvm.params[HVM_PARAM_BUFIOREQ_EVTCHN] =
                  s->bufioreq_evtchn;
      }
 
@@ -797,7 +797,7 @@ int hvm_create_ioreq_server(struct domain *d, bool is_default,
          return -ENOMEM;
 
      domain_pause(d);
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      if ( is_default )
      {
@@ -841,13 +841,13 @@ int hvm_create_ioreq_server(struct domain *d, bool is_default,
      if ( id )
          *id = i;
 
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
      domain_unpause(d);
 
      return 0;
 
   fail:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
      domain_unpause(d);
 
      xfree(s);
@@ -862,7 +862,7 @@ int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id)
      if ( id == DEFAULT_IOSERVID )
          return -EPERM;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -898,7 +898,7 @@ int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id)
      rc = 0;
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return rc;
  }
@@ -914,7 +914,7 @@ int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id,
      if ( id == DEFAULT_IOSERVID )
          return -EOPNOTSUPP;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -950,7 +950,7 @@ int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id,
      rc = 0;
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return rc;
  }
@@ -967,7 +967,7 @@ int hvm_get_ioreq_server_frame(struct domain *d, ioservid_t id,
      if ( !is_hvm_domain(d) )
          return -EINVAL;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -1007,7 +1007,7 @@ int hvm_get_ioreq_server_frame(struct domain *d, ioservid_t id,
      }
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return rc;
  }
@@ -1026,7 +1026,7 @@ int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id,
      if ( id == DEFAULT_IOSERVID )
          return -EOPNOTSUPP;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -1064,7 +1064,7 @@ int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id,
      rc = rangeset_add_range(r, start, end);
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return rc;
  }
@@ -1083,7 +1083,7 @@ int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id,
      if ( id == DEFAULT_IOSERVID )
          return -EOPNOTSUPP;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -1121,7 +1121,7 @@ int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id,
      rc = rangeset_remove_range(r, start, end);
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return rc;
  }
@@ -1149,7 +1149,7 @@ int hvm_map_mem_type_to_ioreq_server(struct domain *d, ioservid_t id,
      if ( flags & ~XEN_DMOP_IOREQ_MEM_ACCESS_WRITE )
          return -EINVAL;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -1166,7 +1166,7 @@ int hvm_map_mem_type_to_ioreq_server(struct domain *d, ioservid_t id,
      rc = p2m_set_ioreq_server(d, flags, s);
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      if ( rc == 0 && flags == 0 )
      {
@@ -1188,7 +1188,7 @@ int hvm_set_ioreq_server_state(struct domain *d, ioservid_t id,
      if ( id == DEFAULT_IOSERVID )
          return -EOPNOTSUPP;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      s = get_ioreq_server(d, id);
 
@@ -1214,7 +1214,7 @@ int hvm_set_ioreq_server_state(struct domain *d, ioservid_t id,
      rc = 0;
 
   out:
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
      return rc;
  }
 
@@ -1224,7 +1224,7 @@ int hvm_all_ioreq_servers_add_vcpu(struct domain *d, struct vcpu *v)
      unsigned int id;
      int rc;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      FOR_EACH_IOREQ_SERVER(d, id, s)
      {
@@ -1233,7 +1233,7 @@ int hvm_all_ioreq_servers_add_vcpu(struct domain *d, struct vcpu *v)
              goto fail;
      }
 
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return 0;
 
@@ -1248,7 +1248,7 @@ int hvm_all_ioreq_servers_add_vcpu(struct domain *d, struct vcpu *v)
          hvm_ioreq_server_remove_vcpu(s, v);
      }
 
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      return rc;
  }
@@ -1258,12 +1258,12 @@ void hvm_all_ioreq_servers_remove_vcpu(struct domain *d, struct vcpu *v)
      struct hvm_ioreq_server *s;
      unsigned int id;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      FOR_EACH_IOREQ_SERVER(d, id, s)
          hvm_ioreq_server_remove_vcpu(s, v);
 
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
  }
 
  void hvm_destroy_all_ioreq_servers(struct domain *d)
@@ -1271,7 +1271,7 @@ void hvm_destroy_all_ioreq_servers(struct domain *d)
      struct hvm_ioreq_server *s;
      unsigned int id;
 
-    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
 
      /* No need to domain_pause() as the domain is being torn down */
 
@@ -1291,7 +1291,7 @@ void hvm_destroy_all_ioreq_servers(struct domain *d)
          xfree(s);
      }
 
-    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
  }
 
  struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
@@ -1306,7 +1306,7 @@ struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
      if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
          return GET_IOREQ_SERVER(d, DEFAULT_IOSERVID);
 
-    cf8 = d->arch.hvm_domain.pci_cf8;
+    cf8 = d->arch.hvm.pci_cf8;
 
      if ( p->type == IOREQ_TYPE_PIO &&
           (p->addr & ~3) == 0xcfc &&
@@ -1564,7 +1564,7 @@ static int hvm_access_cf8(
      struct domain *d = current->domain;
 
      if ( dir == IOREQ_WRITE && bytes == 4 )
-        d->arch.hvm_domain.pci_cf8 = *val;
+        d->arch.hvm.pci_cf8 = *val;
 
      /* We always need to fall through to the catch all emulator */
      return X86EMUL_UNHANDLEABLE;
@@ -1572,7 +1572,7 @@ static int hvm_access_cf8(
 
  void hvm_ioreq_init(struct domain *d)
  {
-    spin_lock_init(&d->arch.hvm_domain.ioreq_server.lock);
+    spin_lock_init(&d->arch.hvm.ioreq_server.lock);
 
      register_portio_handler(d, 0xcf8, 4, hvm_access_cf8);
  }
xen/arch/x86/hvm/irq.c +25 -25
index dfe8ed6..1ded2c2 100644
@@ -52,11 +52,11 @@ int hvm_ioapic_assert(struct domain *d, unsigned int gsi, bool level)
          return -1;
      }
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
      if ( !level || hvm_irq->gsi_assert_count[gsi]++ == 0 )
          assert_gsi(d, gsi);
      vector = vioapic_get_vector(d, gsi);
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
 
      return vector;
  }
@@ -71,9 +71,9 @@ void hvm_ioapic_deassert(struct domain *d, unsigned int gsi)
          return;
      }
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
      hvm_irq->gsi_assert_count[gsi]--;
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  static void assert_irq(struct domain *d, unsigned ioapic_gsi, unsigned pic_irq)
@@ -122,9 +122,9 @@ static void __hvm_pci_intx_assert(
  void hvm_pci_intx_assert(
      struct domain *d, unsigned int device, unsigned int intx)
  {
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
      __hvm_pci_intx_assert(d, device, intx);
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  static void __hvm_pci_intx_deassert(
@@ -156,9 +156,9 @@ static void __hvm_pci_intx_deassert(
  void hvm_pci_intx_deassert(
      struct domain *d, unsigned int device, unsigned int intx)
  {
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
      __hvm_pci_intx_deassert(d, device, intx);
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  void hvm_gsi_assert(struct domain *d, unsigned int gsi)
@@ -179,13 +179,13 @@ void hvm_gsi_assert(struct domain *d, unsigned int gsi)
       * for the hardware domain, Xen needs to rely on gsi_assert_count in order
       * to know if the GSI is pending or not.
       */
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
      if ( !hvm_irq->gsi_assert_count[gsi] )
      {
          hvm_irq->gsi_assert_count[gsi] = 1;
          assert_gsi(d, gsi);
      }
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
@@ -198,9 +198,9 @@ void hvm_gsi_deassert(struct domain *d, unsigned int gsi)
          return;
      }
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
      hvm_irq->gsi_assert_count[gsi] = 0;
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  int hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq,
@@ -213,7 +213,7 @@ int hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq,
 
      ASSERT(isa_irq <= 15);
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      if ( !__test_and_set_bit(isa_irq, &hvm_irq->isa_irq.i) &&
           (hvm_irq->gsi_assert_count[gsi]++ == 0) )
@@ -222,7 +222,7 @@ int hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq,
      if ( get_vector )
          vector = get_vector(d, gsi);
 
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
 
      return vector;
  }
@@ -235,13 +235,13 @@ void hvm_isa_irq_deassert(
 
      ASSERT(isa_irq <= 15);
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      if ( __test_and_clear_bit(isa_irq, &hvm_irq->isa_irq.i) &&
           (--hvm_irq->gsi_assert_count[gsi] == 0) )
          deassert_irq(d, isa_irq);
 
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  static void hvm_set_callback_irq_level(struct vcpu *v)
@@ -252,7 +252,7 @@ static void hvm_set_callback_irq_level(struct vcpu *v)
 
      ASSERT(v->vcpu_id == 0);
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      /* NB. Do not check the evtchn_upcall_mask. It is not used in HVM mode. */
      asserted = !!vcpu_info(v, evtchn_upcall_pending);
@@ -289,7 +289,7 @@ static void hvm_set_callback_irq_level(struct vcpu *v)
      }
 
   out:
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  void hvm_maybe_deassert_evtchn_irq(void)
@@ -331,7 +331,7 @@ int hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
      if ( (link > 3) || (isa_irq > 15) )
          return -EINVAL;
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      old_isa_irq = hvm_irq->pci_link.route[link];
      if ( old_isa_irq == isa_irq )
@@ -363,7 +363,7 @@ int hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
      }
 
   out:
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
 
      dprintk(XENLOG_G_INFO, "Dom%u PCI link %u changed %u -> %u\n",
              d->domain_id, link, old_isa_irq, isa_irq);
@@ -431,7 +431,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
           (!has_vlapic(d) || !has_vioapic(d) || !has_vpic(d)) )
          return;
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      /* Tear down old callback via. */
      if ( hvm_irq->callback_via_asserted )
@@ -481,7 +481,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
          break;
      }
 
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
 
      for_each_vcpu ( d, v )
          if ( is_vcpu_online(v) )
@@ -509,7 +509,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
 
  struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v)
  {
-    struct hvm_domain *plat = &v->domain->arch.hvm_domain;
+    struct hvm_domain *plat = &v->domain->arch.hvm;
      int vector;
 
      if ( unlikely(v->nmi_pending) )
@@ -645,7 +645,7 @@ static int irq_save_pci(struct domain *d, hvm_domain_context_t *h)
      unsigned int asserted, pdev, pintx;
      int rc;
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      pdev  = hvm_irq->callback_via.pci.dev;
      pintx = hvm_irq->callback_via.pci.intx;
@@ -666,7 +666,7 @@ static int irq_save_pci(struct domain *d, hvm_domain_context_t *h)
      if ( asserted )
          __hvm_pci_intx_assert(d, pdev, pintx);
 
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
 
      return rc;
  }
xen/arch/x86/hvm/mtrr.c +7 -7
index edfe5cd..8a772bc 100644
@@ -539,12 +539,12 @@ static DEFINE_RCU_READ_LOCK(pinned_cacheattr_rcu_lock);
 
  void hvm_init_cacheattr_region_list(struct domain *d)
  {
-    INIT_LIST_HEAD(&d->arch.hvm_domain.pinned_cacheattr_ranges);
+    INIT_LIST_HEAD(&d->arch.hvm.pinned_cacheattr_ranges);
  }
 
  void hvm_destroy_cacheattr_region_list(struct domain *d)
  {
-    struct list_head *head = &d->arch.hvm_domain.pinned_cacheattr_ranges;
+    struct list_head *head = &d->arch.hvm.pinned_cacheattr_ranges;
      struct hvm_mem_pinned_cacheattr_range *range;
 
      while ( !list_empty(head) )
@@ -568,7 +568,7 @@ int hvm_get_mem_pinned_cacheattr(struct domain *d, gfn_t gfn,
 
      rcu_read_lock(&pinned_cacheattr_rcu_lock);
      list_for_each_entry_rcu ( range,
-                              &d->arch.hvm_domain.pinned_cacheattr_ranges,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
                                list )
      {
          if ( ((gfn_x(gfn) & mask) >= range->start) &&
@@ -612,7 +612,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
          /* Remove the requested range. */
          rcu_read_lock(&pinned_cacheattr_rcu_lock);
          list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm_domain.pinned_cacheattr_ranges,
+                                  &d->arch.hvm.pinned_cacheattr_ranges,
                                    list )
              if ( range->start == gfn_start && range->end == gfn_end )
              {
@@ -655,7 +655,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
 
      rcu_read_lock(&pinned_cacheattr_rcu_lock);
      list_for_each_entry_rcu ( range,
-                              &d->arch.hvm_domain.pinned_cacheattr_ranges,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
                                list )
      {
          if ( range->start == gfn_start && range->end == gfn_end )
@@ -682,7 +682,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
      range->end = gfn_end;
      range->type = type;
 
-    list_add_rcu(&range->list, &d->arch.hvm_domain.pinned_cacheattr_ranges);
+    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
      p2m_memory_type_changed(d);
      if ( type != PAT_TYPE_WRBACK )
          flush_all(FLUSH_CACHE);
@@ -827,7 +827,7 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
 
      if ( direct_mmio )
      {
-        if ( (mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >> order )
+        if ( (mfn_x(mfn) ^ d->arch.hvm.vmx.apic_access_mfn) >> order )
              return MTRR_TYPE_UNCACHABLE;
          if ( order )
              return -1;
xen/arch/x86/hvm/pmtimer.c +20 -20
index 435647f..75b9408 100644
@@ -56,7 +56,7 @@
  /* Dispatch SCIs based on the PM1a_STS and PM1a_EN registers */
  static void pmt_update_sci(PMTState *s)
  {
-    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm_domain.acpi;
+    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm.acpi;
 
      ASSERT(spin_is_locked(&s->lock));
 
@@ -68,26 +68,26 @@ static void pmt_update_sci(PMTState *s)
 
  void hvm_acpi_power_button(struct domain *d)
  {
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
      if ( !has_vpm(d) )
          return;
 
      spin_lock(&s->lock);
-    d->arch.hvm_domain.acpi.pm1a_sts |= PWRBTN_STS;
+    d->arch.hvm.acpi.pm1a_sts |= PWRBTN_STS;
      pmt_update_sci(s);
      spin_unlock(&s->lock);
  }
 
  void hvm_acpi_sleep_button(struct domain *d)
  {
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
      if ( !has_vpm(d) )
          return;
 
      spin_lock(&s->lock);
-    d->arch.hvm_domain.acpi.pm1a_sts |= PWRBTN_STS;
+    d->arch.hvm.acpi.pm1a_sts |= PWRBTN_STS;
      pmt_update_sci(s);
      spin_unlock(&s->lock);
  }
@@ -97,7 +97,7 @@ void hvm_acpi_sleep_button(struct domain *d)
  static void pmt_update_time(PMTState *s)
  {
      uint64_t curr_gtime, tmp;
-    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm_domain.acpi;
+    struct hvm_hw_acpi *acpi = &s->vcpu->domain->arch.hvm.acpi;
      uint32_t tmr_val = acpi->tmr_val, msb = tmr_val & TMR_VAL_MSB;
 
      ASSERT(spin_is_locked(&s->lock));
@@ -137,7 +137,7 @@ static void pmt_timer_callback(void *opaque)
 
      /* How close are we to the next MSB flip? */
      pmt_cycles_until_flip = TMR_VAL_MSB -
-        (s->vcpu->domain->arch.hvm_domain.acpi.tmr_val & (TMR_VAL_MSB - 1));
+        (s->vcpu->domain->arch.hvm.acpi.tmr_val & (TMR_VAL_MSB - 1));
 
      /* Overall time between MSB flips */
      time_until_flip = (1000000000ULL << 23) / FREQUENCE_PMTIMER;
@@ -156,13 +156,13 @@ static int handle_evt_io(
      int dir, unsigned int port, unsigned int bytes, uint32_t *val)
  {
      struct vcpu *v = current;
-    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm_domain.acpi;
-    PMTState *s = &v->domain->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm.acpi;
+    PMTState *s = &v->domain->arch.hvm.pl_time->vpmt;
      uint32_t addr, data, byte;
      int i;
 
      addr = port -
-        ((v->domain->arch.hvm_domain.params[
+        ((v->domain->arch.hvm.params[
              HVM_PARAM_ACPI_IOPORTS_LOCATION] == 0) ?
           PM1a_STS_ADDR_V0 : PM1a_STS_ADDR_V1);
 
@@ -220,8 +220,8 @@ static int handle_pmt_io(
      int dir, unsigned int port, unsigned int bytes, uint32_t *val)
  {
      struct vcpu *v = current;
-    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm_domain.acpi;
-    PMTState *s = &v->domain->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &v->domain->arch.hvm.acpi;
+    PMTState *s = &v->domain->arch.hvm.pl_time->vpmt;
 
      if ( bytes != 4 || dir != IOREQ_READ )
      {
@@ -251,8 +251,8 @@ static int handle_pmt_io(
 
  static int acpi_save(struct domain *d, hvm_domain_context_t *h)
  {
-    struct hvm_hw_acpi *acpi = &d->arch.hvm_domain.acpi;
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &d->arch.hvm.acpi;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
      uint32_t x, msb = acpi->tmr_val & TMR_VAL_MSB;
      int rc;
 
@@ -282,8 +282,8 @@ static int acpi_save(struct domain *d, hvm_domain_context_t *h)
 
  static int acpi_load(struct domain *d, hvm_domain_context_t *h)
  {
-    struct hvm_hw_acpi *acpi = &d->arch.hvm_domain.acpi;
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    struct hvm_hw_acpi *acpi = &d->arch.hvm.acpi;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
      if ( !has_vpm(d) )
          return -ENODEV;
@@ -320,7 +320,7 @@ int pmtimer_change_ioport(struct domain *d, unsigned int version)
          return -ENODEV;
 
      /* Check that version is changing. */
-    old_version = d->arch.hvm_domain.params[HVM_PARAM_ACPI_IOPORTS_LOCATION];
+    old_version = d->arch.hvm.params[HVM_PARAM_ACPI_IOPORTS_LOCATION];
      if ( version == old_version )
          return 0;
 
@@ -346,7 +346,7 @@ int pmtimer_change_ioport(struct domain *d, unsigned int version)
 
  void pmtimer_init(struct vcpu *v)
  {
-    PMTState *s = &v->domain->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &v->domain->arch.hvm.pl_time->vpmt;
 
      if ( !has_vpm(v->domain) )
          return;
@@ -370,7 +370,7 @@ void pmtimer_init(struct vcpu *v)
 
  void pmtimer_deinit(struct domain *d)
  {
-    PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
+    PMTState *s = &d->arch.hvm.pl_time->vpmt;
 
      if ( !has_vpm(d) )
          return;
@@ -384,7 +384,7 @@ void pmtimer_reset(struct domain *d)
          return;
 
      /* Reset the counter. */
-    d->arch.hvm_domain.acpi.tmr_val = 0;
+    d->arch.hvm.acpi.tmr_val = 0;
  }
 
  /*
xen/arch/x86/hvm/rtc.c +2 -2
index 96921bb..1828587 100644
@@ -38,7 +38,7 @@
  #define MIN_PER_HOUR    60
  #define HOUR_PER_DAY    24
 
-#define domain_vrtc(x) (&(x)->arch.hvm_domain.pl_time->vrtc)
+#define domain_vrtc(x) (&(x)->arch.hvm.pl_time->vrtc)
  #define vcpu_vrtc(x)   (domain_vrtc((x)->domain))
  #define vrtc_domain(x) (container_of(x, struct pl_time, vrtc)->domain)
  #define vrtc_vcpu(x)   (pt_global_vcpu_target(vrtc_domain(x)))
@@ -148,7 +148,7 @@ static void rtc_timer_update(RTCState *s)
                  s_time_t now = NOW();
 
                  s->period = period;
-                if ( v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] )
+                if ( v->domain->arch.hvm.params[HVM_PARAM_VPT_ALIGN] )
                      delta = 0;
                  else
                      delta = period - ((now - s->start_time) % period);
xen/arch/x86/hvm/save.c +3 -3
index d2dc430..0ace160 100644
@@ -39,7 +39,7 @@ void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
      hdr->gtsc_khz = d->arch.tsc_khz;
 
      /* Time when saving started */
-    d->arch.hvm_domain.sync_tsc = rdtsc();
+    d->arch.hvm.sync_tsc = rdtsc();
  }
 
  int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
@@ -74,10 +74,10 @@ int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
          hvm_set_rdtsc_exiting(d, 1);
 
      /* Time when restore started  */
-    d->arch.hvm_domain.sync_tsc = rdtsc();
+    d->arch.hvm.sync_tsc = rdtsc();
 
      /* VGA state is not saved/restored, so we nobble the cache. */
-    d->arch.hvm_domain.stdvga.cache = STDVGA_CACHE_DISABLED;
+    d->arch.hvm.stdvga.cache = STDVGA_CACHE_DISABLED;
 
      return 0;
  }
xen/arch/x86/hvm/stdvga.c +9 -9
index 925bab2..bd398db 100644
@@ -134,7 +134,7 @@ static bool_t stdvga_cache_is_enabled(const struct hvm_hw_stdvga *s)
 
  static int stdvga_outb(uint64_t addr, uint8_t val)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
      int rc = 1, prev_stdvga = s->stdvga;
 
      switch ( addr )
@@ -202,7 +202,7 @@ static void stdvga_out(uint32_t port, uint32_t bytes, uint32_t val)
  static int stdvga_intercept_pio(
      int dir, unsigned int port, unsigned int bytes, uint32_t *val)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
 
      if ( dir == IOREQ_WRITE )
      {
@@ -252,7 +252,7 @@ static unsigned int stdvga_mem_offset(
 
  static uint8_t stdvga_mem_readb(uint64_t addr)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
      int plane;
      uint32_t ret, *vram_l;
      uint8_t *vram_b;
@@ -347,7 +347,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler,
 
  static void stdvga_mem_writeb(uint64_t addr, uint32_t val)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
      int plane, write_mode, b, func_select, mask;
      uint32_t write_mask, bit_mask, set_mask, *vram_l;
      uint8_t *vram_b;
@@ -457,7 +457,7 @@ static int stdvga_mem_write(const struct hvm_io_handler *handler,
                              uint64_t addr, uint32_t size,
                              uint64_t data)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
      ioreq_t p = {
          .type = IOREQ_TYPE_COPY,
          .addr = addr,
@@ -517,7 +517,7 @@ static int stdvga_mem_write(const struct hvm_io_handler *handler,
  static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
                                  const ioreq_t *p)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
 
      /*
       * The range check must be done without taking the lock, to avoid
@@ -560,7 +560,7 @@ static bool_t stdvga_mem_accept(const struct hvm_io_handler *handler,
 
  static void stdvga_mem_complete(const struct hvm_io_handler *handler)
  {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
 
      spin_unlock(&s->lock);
  }
@@ -574,7 +574,7 @@ static const struct hvm_io_ops stdvga_mem_ops = {
 
  void stdvga_init(struct domain *d)
  {
-    struct hvm_hw_stdvga *s = &d->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
      struct page_info *pg;
      unsigned int i;
 
@@ -615,7 +615,7 @@ void stdvga_init(struct domain *d)
 
  void stdvga_deinit(struct domain *d)
  {
-    struct hvm_hw_stdvga *s = &d->arch.hvm_domain.stdvga;
+    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
      int i;
 
      if ( !has_vvga(d) )
xen/arch/x86/hvm/svm/svm.c +2 -3
index a16f372..2d52247 100644
@@ -1197,7 +1197,7 @@ void svm_vmenter_helper(const struct cpu_user_regs *regs)
 
  static void svm_guest_osvw_init(struct domain *d)
  {
-    struct svm_domain *svm = &d->arch.hvm_domain.svm;
+    struct svm_domain *svm = &d->arch.hvm.svm;
 
      spin_lock(&osvw_lock);
 
@@ -2006,8 +2006,7 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
      case MSR_AMD_OSVW_STATUS:
          if ( !d->arch.cpuid->extd.osvw )
              goto gpf;
-        *msr_content =
-            d->arch.hvm_domain.svm.osvw.raw[msr - MSR_AMD_OSVW_ID_LENGTH];
+        *msr_content = d->arch.hvm.svm.osvw.raw[msr - MSR_AMD_OSVW_ID_LENGTH];
          break;
 
      default:
xen/arch/x86/hvm/svm/vmcb.c +1 -1
index 04518fd..d31fcfa 100644
@@ -106,7 +106,7 @@ static int construct_vmcb(struct vcpu *v)
          svm_disable_intercept_for_msr(v, MSR_AMD64_LWP_CBADDR);
 
      vmcb->_msrpm_base_pa = (u64)virt_to_maddr(arch_svm->msrpm);
-    vmcb->_iopm_base_pa = __pa(v->domain->arch.hvm_domain.io_bitmap);
+    vmcb->_iopm_base_pa = __pa(v->domain->arch.hvm.io_bitmap);
 
      /* Virtualise EFLAGS.IF and LAPIC TPR (CR8). */
      vmcb->_vintr.fields.intr_masking = 1;
xen/arch/x86/hvm/vioapic.c +22 -22
index 97b419f..9675424 100644
@@ -49,7 +49,7 @@ static struct hvm_vioapic *addr_vioapic(const struct domain *d,
  {
      unsigned int i;
 
-    for ( i = 0; i < d->arch.hvm_domain.nr_vioapics; i++ )
+    for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
      {
          struct hvm_vioapic *vioapic = domain_vioapic(d, i);
 
@@ -66,7 +66,7 @@ static struct hvm_vioapic *gsi_vioapic(const struct domain *d,
  {
      unsigned int i;
 
-    for ( i = 0; i < d->arch.hvm_domain.nr_vioapics; i++ )
+    for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
      {
          struct hvm_vioapic *vioapic = domain_vioapic(d, i);
 
@@ -214,7 +214,7 @@ static void vioapic_write_redirent(
      int unmasked = 0;
      unsigned int gsi = vioapic->base_gsi + idx;
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
      pent = &vioapic->redirtbl[idx];
      ent  = *pent;
@@ -264,7 +264,7 @@ static void vioapic_write_redirent(
          vioapic_deliver(vioapic, idx);
      }
 
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
 
      if ( gsi == 0 || unmasked )
          pt_may_unmask_irq(d, NULL);
@@ -388,7 +388,7 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
      struct vcpu *v;
      unsigned int irq = vioapic->base_gsi + pin;
 
-    ASSERT(spin_is_locked(&d->arch.hvm_domain.irq_lock));
+    ASSERT(spin_is_locked(&d->arch.hvm.irq_lock));
 
      HVM_DBG_LOG(DBG_LEVEL_IOAPIC,
                  "dest=%x dest_mode=%x delivery_mode=%x "
@@ -476,7 +476,7 @@ void vioapic_irq_positive_edge(struct domain *d, unsigned int irq)
      HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %x", irq);
 
      ASSERT(pin < vioapic->nr_pins);
-    ASSERT(spin_is_locked(&d->arch.hvm_domain.irq_lock));
+    ASSERT(spin_is_locked(&d->arch.hvm.irq_lock));
 
      ent = &vioapic->redirtbl[pin];
      if ( ent->fields.mask )
@@ -501,9 +501,9 @@ void vioapic_update_EOI(struct domain *d, u8 vector)
 
      ASSERT(has_vioapic(d));
 
-    spin_lock(&d->arch.hvm_domain.irq_lock);
+    spin_lock(&d->arch.hvm.irq_lock);
 
-    for ( i = 0; i < d->arch.hvm_domain.nr_vioapics; i++ )
+    for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
      {
          struct hvm_vioapic *vioapic = domain_vioapic(d, i);
          unsigned int pin;
@@ -518,9 +518,9 @@ void vioapic_update_EOI(struct domain *d, u8 vector)
 
              if ( iommu_enabled )
              {
-                spin_unlock(&d->arch.hvm_domain.irq_lock);
+                spin_unlock(&d->arch.hvm.irq_lock);
                  hvm_dpci_eoi(d, vioapic->base_gsi + pin, ent);
-                spin_lock(&d->arch.hvm_domain.irq_lock);
+                spin_lock(&d->arch.hvm.irq_lock);
              }
 
              if ( (ent->fields.trig_mode == VIOAPIC_LEVEL_TRIG) &&
@@ -533,7 +533,7 @@ void vioapic_update_EOI(struct domain *d, u8 vector)
          }
      }
 
-    spin_unlock(&d->arch.hvm_domain.irq_lock);
+    spin_unlock(&d->arch.hvm.irq_lock);
  }
 
  int vioapic_get_mask(const struct domain *d, unsigned int gsi)
@@ -579,7 +579,7 @@ static int ioapic_save(struct domain *d, hvm_domain_context_t *h)
      s = domain_vioapic(d, 0);
 
      if ( s->nr_pins != ARRAY_SIZE(s->domU.redirtbl) ||
-         d->arch.hvm_domain.nr_vioapics != 1 )
+         d->arch.hvm.nr_vioapics != 1 )
          return -EOPNOTSUPP;
 
      return hvm_save_entry(IOAPIC, 0, h, &s->domU);
@@ -595,7 +595,7 @@ static int ioapic_load(struct domain *d, hvm_domain_context_t *h)
      s = domain_vioapic(d, 0);
 
      if ( s->nr_pins != ARRAY_SIZE(s->domU.redirtbl) ||
-         d->arch.hvm_domain.nr_vioapics != 1 )
+         d->arch.hvm.nr_vioapics != 1 )
          return -EOPNOTSUPP;
 
      return hvm_load_entry(IOAPIC, h, &s->domU);
@@ -609,11 +609,11 @@ void vioapic_reset(struct domain *d)
 
      if ( !has_vioapic(d) )
      {
-        ASSERT(!d->arch.hvm_domain.nr_vioapics);
+        ASSERT(!d->arch.hvm.nr_vioapics);
          return;
      }
 
-    for ( i = 0; i < d->arch.hvm_domain.nr_vioapics; i++ )
+    for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
      {
          struct hvm_vioapic *vioapic = domain_vioapic(d, i);
          unsigned int nr_pins = vioapic->nr_pins, base_gsi = vioapic->base_gsi;
@@ -646,7 +646,7 @@ static void vioapic_free(const struct domain *d, unsigned int nr_vioapics)
 
      for ( i = 0; i < nr_vioapics; i++)
          xfree(domain_vioapic(d, i));
-    xfree(d->arch.hvm_domain.vioapic);
+    xfree(d->arch.hvm.vioapic);
  }
 
  int vioapic_init(struct domain *d)
@@ -655,14 +655,14 @@ int vioapic_init(struct domain *d)
 
      if ( !has_vioapic(d) )
      {
-        ASSERT(!d->arch.hvm_domain.nr_vioapics);
+        ASSERT(!d->arch.hvm.nr_vioapics);
          return 0;
      }
 
      nr_vioapics = is_hardware_domain(d) ? nr_ioapics : 1;
 
-    if ( (d->arch.hvm_domain.vioapic == NULL) &&
-         ((d->arch.hvm_domain.vioapic =
+    if ( (d->arch.hvm.vioapic == NULL) &&
+         ((d->arch.hvm.vioapic =
             xzalloc_array(struct hvm_vioapic *, nr_vioapics)) == NULL) )
          return -ENOMEM;
 
@@ -699,7 +699,7 @@ int vioapic_init(struct domain *d)
       */
      ASSERT(hvm_domain_irq(d)->nr_gsis >= nr_gsis);
 
-    d->arch.hvm_domain.nr_vioapics = nr_vioapics;
+    d->arch.hvm.nr_vioapics = nr_vioapics;
      vioapic_reset(d);
 
      register_mmio_handler(d, &vioapic_mmio_ops);
@@ -711,9 +711,9 @@ void vioapic_deinit(struct domain *d)
  {
      if ( !has_vioapic(d) )
      {
-        ASSERT(!d->arch.hvm_domain.nr_vioapics);
+        ASSERT(!d->arch.hvm.nr_vioapics);
          return;
      }
 
-    vioapic_free(d, d->arch.hvm_domain.nr_vioapics);
+    vioapic_free(d, d->arch.hvm.nr_vioapics);
  }
xen/arch/x86/hvm/viridian.c +28 -28
index 4860651..5ddb41b 100644
@@ -223,7 +223,7 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
      case 2:
          /* Hypervisor information, but only if the guest has set its
             own version number. */
-        if ( d->arch.hvm_domain.viridian.guest_os_id.raw == 0 )
+        if ( d->arch.hvm.viridian.guest_os_id.raw == 0 )
              break;
          res->a = viridian_build;
          res->b = ((uint32_t)viridian_major << 16) | viridian_minor;
@@ -268,8 +268,8 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
 
      case 4:
          /* Recommended hypercall usage. */
-        if ( (d->arch.hvm_domain.viridian.guest_os_id.raw == 0) ||
-             (d->arch.hvm_domain.viridian.guest_os_id.fields.os < 4) )
+        if ( (d->arch.hvm.viridian.guest_os_id.raw == 0) ||
+             (d->arch.hvm.viridian.guest_os_id.fields.os < 4) )
              break;
          res->a = CPUID4A_RELAX_TIMER_INT;
          if ( viridian_feature_mask(d) & HVMPV_hcall_remote_tlb_flush )
@@ -301,7 +301,7 @@ static void dump_guest_os_id(const struct domain *d)
  {
      const union viridian_guest_os_id *goi;
 
-    goi = &d->arch.hvm_domain.viridian.guest_os_id;
+    goi = &d->arch.hvm.viridian.guest_os_id;
 
      printk(XENLOG_G_INFO
             "d%d: VIRIDIAN GUEST_OS_ID: vendor: %x os: %x major: %x minor: %x sp: %x build: %x\n",
@@ -315,7 +315,7 @@ static void dump_hypercall(const struct domain *d)
  {
      const union viridian_hypercall_gpa *hg;
 
-    hg = &d->arch.hvm_domain.viridian.hypercall_gpa;
+    hg = &d->arch.hvm.viridian.hypercall_gpa;
 
      printk(XENLOG_G_INFO "d%d: VIRIDIAN HYPERCALL: enabled: %x pfn: %lx\n",
             d->domain_id,
@@ -336,7 +336,7 @@ static void dump_reference_tsc(const struct domain *d)
  {
      const union viridian_reference_tsc *rt;
 
-    rt = &d->arch.hvm_domain.viridian.reference_tsc;
+    rt = &d->arch.hvm.viridian.reference_tsc;
 
      printk(XENLOG_G_INFO "d%d: VIRIDIAN REFERENCE_TSC: enabled: %x pfn: %lx\n",
             d->domain_id,
@@ -345,7 +345,7 @@ static void dump_reference_tsc(const struct domain *d)
 
  static void enable_hypercall_page(struct domain *d)
  {
-    unsigned long gmfn = d->arch.hvm_domain.viridian.hypercall_gpa.fields.pfn;
+    unsigned long gmfn = d->arch.hvm.viridian.hypercall_gpa.fields.pfn;
      struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC);
      uint8_t *p;
 
@@ -483,7 +483,7 @@ void viridian_apic_assist_clear(struct vcpu *v)
 
  static void update_reference_tsc(struct domain *d, bool_t initialize)
  {
-    unsigned long gmfn = d->arch.hvm_domain.viridian.reference_tsc.fields.pfn;
+    unsigned long gmfn = d->arch.hvm.viridian.reference_tsc.fields.pfn;
      struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC);
      HV_REFERENCE_TSC_PAGE *p;
 
@@ -566,15 +566,15 @@ int wrmsr_viridian_regs(uint32_t idx, uint64_t val)
      {
      case HV_X64_MSR_GUEST_OS_ID:
          perfc_incr(mshv_wrmsr_osid);
-        d->arch.hvm_domain.viridian.guest_os_id.raw = val;
+        d->arch.hvm.viridian.guest_os_id.raw = val;
          dump_guest_os_id(d);
          break;
 
      case HV_X64_MSR_HYPERCALL:
          perfc_incr(mshv_wrmsr_hc_page);
-        d->arch.hvm_domain.viridian.hypercall_gpa.raw = val;
+        d->arch.hvm.viridian.hypercall_gpa.raw = val;
          dump_hypercall(d);
-        if ( d->arch.hvm_domain.viridian.hypercall_gpa.fields.enabled )
+        if ( d->arch.hvm.viridian.hypercall_gpa.fields.enabled )
              enable_hypercall_page(d);
          break;
 
@@ -618,9 +618,9 @@ int wrmsr_viridian_regs(uint32_t idx, uint64_t val)
              return 0;
 
          perfc_incr(mshv_wrmsr_tsc_msr);
-        d->arch.hvm_domain.viridian.reference_tsc.raw = val;
+        d->arch.hvm.viridian.reference_tsc.raw = val;
          dump_reference_tsc(d);
-        if ( d->arch.hvm_domain.viridian.reference_tsc.fields.enabled )
+        if ( d->arch.hvm.viridian.reference_tsc.fields.enabled )
              update_reference_tsc(d, 1);
          break;
 
@@ -681,7 +681,7 @@ void viridian_time_ref_count_freeze(struct domain *d)
  {
      struct viridian_time_ref_count *trc;
 
-    trc = &d->arch.hvm_domain.viridian.time_ref_count;
+    trc = &d->arch.hvm.viridian.time_ref_count;
 
      if ( test_and_clear_bit(_TRC_running, &trc->flags) )
          trc->val = raw_trc_val(d) + trc->off;
@@ -691,7 +691,7 @@ void viridian_time_ref_count_thaw(struct domain *d)
  {
      struct viridian_time_ref_count *trc;
 
-    trc = &d->arch.hvm_domain.viridian.time_ref_count;
+    trc = &d->arch.hvm.viridian.time_ref_count;
 
      if ( !d->is_shutting_down &&
           !test_and_set_bit(_TRC_running, &trc->flags) )
@@ -710,12 +710,12 @@ int rdmsr_viridian_regs(uint32_t idx, uint64_t *val)
      {
      case HV_X64_MSR_GUEST_OS_ID:
          perfc_incr(mshv_rdmsr_osid);
-        *val = d->arch.hvm_domain.viridian.guest_os_id.raw;
+        *val = d->arch.hvm.viridian.guest_os_id.raw;
          break;
 
      case HV_X64_MSR_HYPERCALL:
          perfc_incr(mshv_rdmsr_hc_page);
-        *val = d->arch.hvm_domain.viridian.hypercall_gpa.raw;
+        *val = d->arch.hvm.viridian.hypercall_gpa.raw;
          break;
 
      case HV_X64_MSR_VP_INDEX:
@@ -760,14 +760,14 @@ int rdmsr_viridian_regs(uint32_t idx, uint64_t *val)
              return 0;
 
          perfc_incr(mshv_rdmsr_tsc_msr);
-        *val = d->arch.hvm_domain.viridian.reference_tsc.raw;
+        *val = d->arch.hvm.viridian.reference_tsc.raw;
          break;
 
      case HV_X64_MSR_TIME_REF_COUNT:
      {
          struct viridian_time_ref_count *trc;
 
-        trc = &d->arch.hvm_domain.viridian.time_ref_count;
+        trc = &d->arch.hvm.viridian.time_ref_count;
 
          if ( !(viridian_feature_mask(d) & HVMPV_time_ref_count) )
              return 0;
@@ -993,10 +993,10 @@ int viridian_hypercall(struct cpu_user_regs *regs)
  static int viridian_save_domain_ctxt(struct domain *d, hvm_domain_context_t *h)
  {
      struct hvm_viridian_domain_context ctxt = {
-        .time_ref_count = d->arch.hvm_domain.viridian.time_ref_count.val,
-        .hypercall_gpa  = d->arch.hvm_domain.viridian.hypercall_gpa.raw,
-        .guest_os_id    = d->arch.hvm_domain.viridian.guest_os_id.raw,
-        .reference_tsc  = d->arch.hvm_domain.viridian.reference_tsc.raw,
+        .time_ref_count = d->arch.hvm.viridian.time_ref_count.val,
+        .hypercall_gpa  = d->arch.hvm.viridian.hypercall_gpa.raw,
+        .guest_os_id    = d->arch.hvm.viridian.guest_os_id.raw,
+        .reference_tsc  = d->arch.hvm.viridian.reference_tsc.raw,
      };
 
      if ( !is_viridian_domain(d) )
@@ -1012,12 +1012,12 @@ static int viridian_load_domain_ctxt(struct domain *d, hvm_domain_context_t *h)
      if ( hvm_load_entry_zeroextend(VIRIDIAN_DOMAIN, h, &ctxt) != 0 )
          return -EINVAL;
 
-    d->arch.hvm_domain.viridian.time_ref_count.val = ctxt.time_ref_count;
-    d->arch.hvm_domain.viridian.hypercall_gpa.raw  = ctxt.hypercall_gpa;
-    d->arch.hvm_domain.viridian.guest_os_id.raw    = ctxt.guest_os_id;
-    d->arch.hvm_domain.viridian.reference_tsc.raw  = ctxt.reference_tsc;
+    d->arch.hvm.viridian.time_ref_count.val = ctxt.time_ref_count;
+    d->arch.hvm.viridian.hypercall_gpa.raw  = ctxt.hypercall_gpa;
+    d->arch.hvm.viridian.guest_os_id.raw    = ctxt.guest_os_id;
+    d->arch.hvm.viridian.reference_tsc.raw  = ctxt.reference_tsc;
 
-    if ( d->arch.hvm_domain.viridian.reference_tsc.fields.enabled )
+    if ( d->arch.hvm.viridian.reference_tsc.fields.enabled )
          update_reference_tsc(d, 0);
 
      return 0;
xen/arch/x86/hvm/vlapic.c +4 -4
index ec089cc..04702e9 100644
@@ -1203,10 +1203,10 @@ int vlapic_accept_pic_intr(struct vcpu *v)
          return 0;
 
      TRACE_2D(TRC_HVM_EMUL_LAPIC_PIC_INTR,
-             (v == v->domain->arch.hvm_domain.i8259_target),
+             (v == v->domain->arch.hvm.i8259_target),
               v ? __vlapic_accept_pic_intr(v) : -1);
 
-    return ((v == v->domain->arch.hvm_domain.i8259_target) &&
+    return ((v == v->domain->arch.hvm.i8259_target) &&
              __vlapic_accept_pic_intr(v));
  }
 
@@ -1224,9 +1224,9 @@ void vlapic_adjust_i8259_target(struct domain *d)
      v = d->vcpu ? d->vcpu[0] : NULL;
 
   found:
-    if ( d->arch.hvm_domain.i8259_target == v )
+    if ( d->arch.hvm.i8259_target == v )
          return;
-    d->arch.hvm_domain.i8259_target = v;
+    d->arch.hvm.i8259_target = v;
      pt_adjust_global_vcpu_target(v);
  }
 
xen/arch/x86/hvm/vmsi.c +7 -7
index 3001d5c..ccbf181 100644
@@ -173,7 +173,7 @@ static DEFINE_RCU_READ_LOCK(msixtbl_rcu_lock);
   */
  static bool msixtbl_initialised(const struct domain *d)
  {
-    return !!d->arch.hvm_domain.msixtbl_list.next;
+    return !!d->arch.hvm.msixtbl_list.next;
  }
 
  static struct msixtbl_entry *msixtbl_find_entry(
@@ -182,7 +182,7 @@ static struct msixtbl_entry *msixtbl_find_entry(
      struct msixtbl_entry *entry;
      struct domain *d = v->domain;
 
-    list_for_each_entry( entry, &d->arch.hvm_domain.msixtbl_list, list )
+    list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
          if ( addr >= entry->gtable &&
               addr < entry->gtable + entry->table_len )
              return entry;
@@ -430,7 +430,7 @@ static void add_msixtbl_entry(struct domain *d,
      entry->pdev = pdev;
      entry->gtable = (unsigned long) gtable;
 
-    list_add_rcu(&entry->list, &d->arch.hvm_domain.msixtbl_list);
+    list_add_rcu(&entry->list, &d->arch.hvm.msixtbl_list);
  }
 
  static void free_msixtbl_entry(struct rcu_head *rcu)
@@ -483,7 +483,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
 
      pdev = msi_desc->dev;
 
-    list_for_each_entry( entry, &d->arch.hvm_domain.msixtbl_list, list )
+    list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
          if ( pdev == entry->pdev )
              goto found;
 
@@ -542,7 +542,7 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq *pirq)
 
      pdev = msi_desc->dev;
 
-    list_for_each_entry( entry, &d->arch.hvm_domain.msixtbl_list, list )
+    list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list )
          if ( pdev == entry->pdev )
              goto found;
 
@@ -564,7 +564,7 @@ void msixtbl_init(struct domain *d)
      if ( !is_hvm_domain(d) || !has_vlapic(d) || msixtbl_initialised(d) )
          return;
 
-    INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list);
+    INIT_LIST_HEAD(&d->arch.hvm.msixtbl_list);
 
      handler = hvm_next_io_handler(d);
      if ( handler )
@@ -584,7 +584,7 @@ void msixtbl_pt_cleanup(struct domain *d)
      spin_lock(&d->event_lock);
 
      list_for_each_entry_safe( entry, temp,
-                              &d->arch.hvm_domain.msixtbl_list, list )
+                              &d->arch.hvm.msixtbl_list, list )
          del_msixtbl_entry(entry);
 
      spin_unlock(&d->event_lock);
xen/arch/x86/hvm/vmx/vmcs.c +6 -6
index 6681032..f30850c 100644
@@ -1108,8 +1108,8 @@ static int construct_vmcs(struct vcpu *v)
      }
 
      /* I/O access bitmap. */
-    __vmwrite(IO_BITMAP_A, __pa(d->arch.hvm_domain.io_bitmap));
-    __vmwrite(IO_BITMAP_B, __pa(d->arch.hvm_domain.io_bitmap) + PAGE_SIZE);
+    __vmwrite(IO_BITMAP_A, __pa(d->arch.hvm.io_bitmap));
+    __vmwrite(IO_BITMAP_B, __pa(d->arch.hvm.io_bitmap) + PAGE_SIZE);
 
      if ( cpu_has_vmx_virtual_intr_delivery )
      {
@@ -1263,7 +1263,7 @@ static int construct_vmcs(struct vcpu *v)
          __vmwrite(XSS_EXIT_BITMAP, 0);
 
      if ( cpu_has_vmx_tsc_scaling )
-        __vmwrite(TSC_MULTIPLIER, d->arch.hvm_domain.tsc_scaling_ratio);
+        __vmwrite(TSC_MULTIPLIER, d->arch.hvm.tsc_scaling_ratio);
 
      /* will update HOST & GUEST_CR3 as reqd */
      paging_update_paging_modes(v);
@@ -1643,7 +1643,7 @@ void vmx_vcpu_flush_pml_buffer(struct vcpu *v)
 
  bool_t vmx_domain_pml_enabled(const struct domain *d)
  {
-    return !!(d->arch.hvm_domain.vmx.status & VMX_DOMAIN_PML_ENABLED);
+    return !!(d->arch.hvm.vmx.status & VMX_DOMAIN_PML_ENABLED);
  }
 
  /*
@@ -1668,7 +1668,7 @@ int vmx_domain_enable_pml(struct domain *d)
          if ( (rc = vmx_vcpu_enable_pml(v)) != 0 )
              goto error;
 
-    d->arch.hvm_domain.vmx.status |= VMX_DOMAIN_PML_ENABLED;
+    d->arch.hvm.vmx.status |= VMX_DOMAIN_PML_ENABLED;
 
      return 0;
 
@@ -1697,7 +1697,7 @@ void vmx_domain_disable_pml(struct domain *d)
      for_each_vcpu ( d, v )
          vmx_vcpu_disable_pml(v);
 
-    d->arch.hvm_domain.vmx.status &= ~VMX_DOMAIN_PML_ENABLED;
+    d->arch.hvm.vmx.status &= ~VMX_DOMAIN_PML_ENABLED;
  }
 
  /*
xen/arch/x86/hvm/vmx/vmx.c +23 -23
index 73f0d52..ccfbacb 100644
@@ -318,7 +318,7 @@ void vmx_pi_hooks_assign(struct domain *d)
      if ( !iommu_intpost || !is_hvm_domain(d) )
          return;
 
-    ASSERT(!d->arch.hvm_domain.pi_ops.vcpu_block);
+    ASSERT(!d->arch.hvm.pi_ops.vcpu_block);
 
      /*
       * We carefully handle the timing here:
@@ -329,8 +329,8 @@ void vmx_pi_hooks_assign(struct domain *d)
       * This can make sure the PI (especially the NDST feild) is
       * in proper state when we call vmx_vcpu_block().
       */
-    d->arch.hvm_domain.pi_ops.switch_from = vmx_pi_switch_from;
-    d->arch.hvm_domain.pi_ops.switch_to = vmx_pi_switch_to;
+    d->arch.hvm.pi_ops.switch_from = vmx_pi_switch_from;
+    d->arch.hvm.pi_ops.switch_to = vmx_pi_switch_to;
 
      for_each_vcpu ( d, v )
      {
@@ -345,8 +345,8 @@ void vmx_pi_hooks_assign(struct domain *d)
                  x2apic_enabled ? dest : MASK_INSR(dest, PI_xAPIC_NDST_MASK));
      }
 
-    d->arch.hvm_domain.pi_ops.vcpu_block = vmx_vcpu_block;
-    d->arch.hvm_domain.pi_ops.do_resume = vmx_pi_do_resume;
+    d->arch.hvm.pi_ops.vcpu_block = vmx_vcpu_block;
+    d->arch.hvm.pi_ops.do_resume = vmx_pi_do_resume;
  }
 
  /* This function is called when pcidevs_lock is held */
@@ -357,7 +357,7 @@ void vmx_pi_hooks_deassign(struct domain *d)
      if ( !iommu_intpost || !is_hvm_domain(d) )
          return;
 
-    ASSERT(d->arch.hvm_domain.pi_ops.vcpu_block);
+    ASSERT(d->arch.hvm.pi_ops.vcpu_block);
 
      /*
       * Pausing the domain can make sure the vCPUs are not
@@ -369,7 +369,7 @@ void vmx_pi_hooks_deassign(struct domain *d)
      domain_pause(d);
 
      /*
-     * Note that we don't set 'd->arch.hvm_domain.pi_ops.switch_to' to NULL
+     * Note that we don't set 'd->arch.hvm.pi_ops.switch_to' to NULL
       * here. If we deassign the hooks while the vCPU is runnable in the
       * runqueue with 'SN' set, all the future notification event will be
       * suppressed since vmx_deliver_posted_intr() also use 'SN' bit
@@ -382,9 +382,9 @@ void vmx_pi_hooks_deassign(struct domain *d)
       * system, leave it here until we find a clean solution to deassign the
       * 'switch_to' hook function.
       */
-    d->arch.hvm_domain.pi_ops.vcpu_block = NULL;
-    d->arch.hvm_domain.pi_ops.switch_from = NULL;
-    d->arch.hvm_domain.pi_ops.do_resume = NULL;
+    d->arch.hvm.pi_ops.vcpu_block = NULL;
+    d->arch.hvm.pi_ops.switch_from = NULL;
+    d->arch.hvm.pi_ops.do_resume = NULL;
 
      for_each_vcpu ( d, v )
          vmx_pi_unblock_vcpu(v);
@@ -934,8 +934,8 @@ static void vmx_ctxt_switch_from(struct vcpu *v)
      vmx_restore_host_msrs();
      vmx_save_dr(v);
 
-    if ( v->domain->arch.hvm_domain.pi_ops.switch_from )
-        v->domain->arch.hvm_domain.pi_ops.switch_from(v);
+    if ( v->domain->arch.hvm.pi_ops.switch_from )
+        v->domain->arch.hvm.pi_ops.switch_from(v);
  }
 
  static void vmx_ctxt_switch_to(struct vcpu *v)
@@ -943,8 +943,8 @@ static void vmx_ctxt_switch_to(struct vcpu *v)
      vmx_restore_guest_msrs(v);
      vmx_restore_dr(v);
 
-    if ( v->domain->arch.hvm_domain.pi_ops.switch_to )
-        v->domain->arch.hvm_domain.pi_ops.switch_to(v);
+    if ( v->domain->arch.hvm.pi_ops.switch_to )
+        v->domain->arch.hvm.pi_ops.switch_to(v);
  }
 
 
@@ -1104,7 +1104,7 @@ static void vmx_set_segment_register(struct vcpu *v, enum x86_segment seg,
          if ( seg == x86_seg_tr )
          {
              const struct domain *d = v->domain;
-            uint64_t val = d->arch.hvm_domain.params[HVM_PARAM_VM86_TSS_SIZED];
+            uint64_t val = d->arch.hvm.params[HVM_PARAM_VM86_TSS_SIZED];
 
              if ( val )
              {
@@ -1115,7 +1115,7 @@ static void vmx_set_segment_register(struct vcpu *v, enum x86_segment seg,
                  if ( val & VM86_TSS_UPDATED )
                  {
                      hvm_prepare_vm86_tss(v, base, limit);
-                    cmpxchg(&d->arch.hvm_domain.params[HVM_PARAM_VM86_TSS_SIZED],
+                    cmpxchg(&d->arch.hvm.params[HVM_PARAM_VM86_TSS_SIZED],
                              val, val & ~VM86_TSS_UPDATED);
                  }
                  v->arch.hvm_vmx.vm86_segment_mask &= ~(1u << seg);
@@ -1626,7 +1626,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr,
          {
              if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
                  v->arch.hvm_vcpu.hw_cr[3] =
-                    v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
+                    v->domain->arch.hvm.params[HVM_PARAM_IDENT_PT];
              vmx_load_pdptrs(v);
          }
 
@@ -2997,7 +2997,7 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)
      mfn = page_to_mfn(pg);
      clear_domain_page(mfn);
      share_xen_page_with_guest(pg, d, SHARE_rw);
-    d->arch.hvm_domain.vmx.apic_access_mfn = mfn_x(mfn);
+    d->arch.hvm.vmx.apic_access_mfn = mfn_x(mfn);
      set_mmio_p2m_entry(d, paddr_to_pfn(APIC_DEFAULT_PHYS_BASE), mfn,
                         PAGE_ORDER_4K, p2m_get_hostp2m(d)->default_access);
 
@@ -3006,7 +3006,7 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)
 
  static void vmx_free_vlapic_mapping(struct domain *d)
  {
-    unsigned long mfn = d->arch.hvm_domain.vmx.apic_access_mfn;
+    unsigned long mfn = d->arch.hvm.vmx.apic_access_mfn;
 
      if ( mfn != 0 )
          free_shared_domheap_page(mfn_to_page(_mfn(mfn)));
@@ -3016,13 +3016,13 @@ static void vmx_install_vlapic_mapping(struct vcpu *v)
  {
      paddr_t virt_page_ma, apic_page_ma;
 
-    if ( v->domain->arch.hvm_domain.vmx.apic_access_mfn == 0 )
+    if ( v->domain->arch.hvm.vmx.apic_access_mfn == 0 )
          return;
 
      ASSERT(cpu_has_vmx_virtualize_apic_accesses);
 
      virt_page_ma = page_to_maddr(vcpu_vlapic(v)->regs_page);
-    apic_page_ma = v->domain->arch.hvm_domain.vmx.apic_access_mfn;
+    apic_page_ma = v->domain->arch.hvm.vmx.apic_access_mfn;
      apic_page_ma <<= PAGE_SHIFT;
 
      vmx_vmcs_enter(v);
@@ -4330,8 +4330,8 @@ bool vmx_vmenter_helper(const struct cpu_user_regs *regs)
       if ( nestedhvm_vcpu_in_guestmode(curr) && vcpu_nestedhvm(curr).stale_np2m )
           return false;
 
-    if ( curr->domain->arch.hvm_domain.pi_ops.do_resume )
-        curr->domain->arch.hvm_domain.pi_ops.do_resume(curr);
+    if ( curr->domain->arch.hvm.pi_ops.do_resume )
+        curr->domain->arch.hvm.pi_ops.do_resume(curr);
 
      if ( !cpu_has_vmx_vpid )
          goto out;
xen/arch/x86/hvm/vpic.c +10 -10
index cfc9544..e0500c5 100644
@@ -35,7 +35,7 @@
  #include <asm/hvm/support.h>
 
  #define vpic_domain(v) (container_of((v), struct domain, \
-                        arch.hvm_domain.vpic[!vpic->is_master]))
+                        arch.hvm.vpic[!vpic->is_master]))
  #define __vpic_lock(v) &container_of((v), struct hvm_domain, \
                                          vpic[!(v)->is_master])->irq_lock
  #define vpic_lock(v)   spin_lock(__vpic_lock(v))
@@ -112,7 +112,7 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic)
          if ( vpic->is_master )
          {
              /* Master INT line is connected in Virtual Wire Mode. */
-            struct vcpu *v = vpic_domain(vpic)->arch.hvm_domain.i8259_target;
+            struct vcpu *v = vpic_domain(vpic)->arch.hvm.i8259_target;
              if ( v != NULL )
              {
                  TRACE_1D(TRC_HVM_EMUL_PIC_KICK, irq);
@@ -334,7 +334,7 @@ static int vpic_intercept_pic_io(
          return X86EMUL_OKAY;
      }
 
-    vpic = &current->domain->arch.hvm_domain.vpic[port >> 7];
+    vpic = &current->domain->arch.hvm.vpic[port >> 7];
 
      if ( dir == IOREQ_WRITE )
          vpic_ioport_write(vpic, port, (uint8_t)*val);
@@ -352,7 +352,7 @@ static int vpic_intercept_elcr_io(
 
      BUG_ON(bytes != 1);
 
-    vpic = &current->domain->arch.hvm_domain.vpic[port & 1];
+    vpic = &current->domain->arch.hvm.vpic[port & 1];
 
      if ( dir == IOREQ_WRITE )
      {
@@ -382,7 +382,7 @@ static int vpic_save(struct domain *d, hvm_domain_context_t *h)
      /* Save the state of both PICs */
      for ( i = 0; i < 2 ; i++ )
      {
-        s = &d->arch.hvm_domain.vpic[i];
+        s = &d->arch.hvm.vpic[i];
          if ( hvm_save_entry(PIC, i, h, s) )
              return 1;
      }
@@ -401,7 +401,7 @@ static int vpic_load(struct domain *d, hvm_domain_context_t *h)
      /* Which PIC is this? */
      if ( inst > 1 )
          return -EINVAL;
-    s = &d->arch.hvm_domain.vpic[inst];
+    s = &d->arch.hvm.vpic[inst];
 
      /* Load the state */
      if ( hvm_load_entry(PIC, h, s) != 0 )
@@ -420,7 +420,7 @@ void vpic_reset(struct domain *d)
          return;
 
      /* Master PIC. */
-    vpic = &d->arch.hvm_domain.vpic[0];
+    vpic = &d->arch.hvm.vpic[0];
      memset(vpic, 0, sizeof(*vpic));
      vpic->is_master = 1;
      vpic->elcr      = 1 << 2;
@@ -446,7 +446,7 @@ void vpic_init(struct domain *d)
 
  void vpic_irq_positive_edge(struct domain *d, int irq)
  {
-    struct hvm_hw_vpic *vpic = &d->arch.hvm_domain.vpic[irq >> 3];
+    struct hvm_hw_vpic *vpic = &d->arch.hvm.vpic[irq >> 3];
      uint8_t mask = 1 << (irq & 7);
 
      ASSERT(has_vpic(d));
@@ -464,7 +464,7 @@ void vpic_irq_positive_edge(struct domain *d, int irq)
 
  void vpic_irq_negative_edge(struct domain *d, int irq)
  {
-    struct hvm_hw_vpic *vpic = &d->arch.hvm_domain.vpic[irq >> 3];
+    struct hvm_hw_vpic *vpic = &d->arch.hvm.vpic[irq >> 3];
      uint8_t mask = 1 << (irq & 7);
 
      ASSERT(has_vpic(d));
@@ -483,7 +483,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq)
  int vpic_ack_pending_irq(struct vcpu *v)
  {
      int irq, vector;
-    struct hvm_hw_vpic *vpic = &v->domain->arch.hvm_domain.vpic[0];
+    struct hvm_hw_vpic *vpic = &v->domain->arch.hvm.vpic[0];
 
      ASSERT(has_vpic(v->domain));
 
xen/arch/x86/hvm/vpt.c +10 -10
index 6ac4c91..7b57017 100644
@@ -24,11 +24,11 @@
  #include <asm/mc146818rtc.h>
 
  #define mode_is(d, name) \
-    ((d)->arch.hvm_domain.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
+    ((d)->arch.hvm.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
 
  void hvm_init_guest_time(struct domain *d)
  {
-    struct pl_time *pl = d->arch.hvm_domain.pl_time;
+    struct pl_time *pl = d->arch.hvm.pl_time;
 
      spin_lock_init(&pl->pl_time_lock);
      pl->stime_offset = -(u64)get_s_time();
@@ -37,7 +37,7 @@ void hvm_init_guest_time(struct domain *d)
 
  uint64_t hvm_get_guest_time_fixed(const struct vcpu *v, uint64_t at_tsc)
  {
-    struct pl_time *pl = v->domain->arch.hvm_domain.pl_time;
+    struct pl_time *pl = v->domain->arch.hvm.pl_time;
      u64 now;
 
      /* Called from device models shared with PV guests. Be careful. */
@@ -88,7 +88,7 @@ static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
      gsi = hvm_isa_irq_to_gsi(isa_irq);
 
      if ( src == hvm_intsrc_pic )
-        return (v->domain->arch.hvm_domain.vpic[isa_irq >> 3].irq_base
+        return (v->domain->arch.hvm.vpic[isa_irq >> 3].irq_base
                  + (isa_irq & 7));
 
      ASSERT(src == hvm_intsrc_lapic);
@@ -121,7 +121,7 @@ static int pt_irq_masked(struct periodic_time *pt)
 
      case PTSRC_isa:
      {
-        uint8_t pic_imr = v->domain->arch.hvm_domain.vpic[pt->irq >> 3].imr;
+        uint8_t pic_imr = v->domain->arch.hvm.vpic[pt->irq >> 3].imr;
 
          /* Check if the interrupt is unmasked in the PIC. */
          if ( !(pic_imr & (1 << (pt->irq & 7))) && vlapic_accept_pic_intr(v) )
@@ -363,7 +363,7 @@ int pt_update_irq(struct vcpu *v)
      case PTSRC_isa:
          hvm_isa_irq_deassert(v->domain, irq);
          if ( platform_legacy_irq(irq) && vlapic_accept_pic_intr(v) &&
-             v->domain->arch.hvm_domain.vpic[irq >> 3].int_output )
+             v->domain->arch.hvm.vpic[irq >> 3].int_output )
              hvm_isa_irq_assert(v->domain, irq, NULL);
          else
          {
@@ -514,7 +514,7 @@ void create_periodic_time(
 
      if ( !pt->one_shot )
      {
-        if ( v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] )
+        if ( v->domain->arch.hvm.params[HVM_PARAM_VPT_ALIGN] )
          {
              pt->scheduled = align_timer(pt->scheduled, pt->period);
          }
@@ -605,7 +605,7 @@ void pt_adjust_global_vcpu_target(struct vcpu *v)
      pt_adjust_vcpu(&vpit->pt0, v);
      spin_unlock(&vpit->lock);
 
-    pl_time = v->domain->arch.hvm_domain.pl_time;
+    pl_time = v->domain->arch.hvm.pl_time;
 
      spin_lock(&pl_time->vrtc.lock);
      pt_adjust_vcpu(&pl_time->vrtc.pt, v);
@@ -640,9 +640,9 @@ void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt)
      if ( d )
      {
          pt_resume(&d->arch.vpit.pt0);
-        pt_resume(&d->arch.hvm_domain.pl_time->vrtc.pt);
+        pt_resume(&d->arch.hvm.pl_time->vrtc.pt);
          for ( i = 0; i < HPET_TIMER_NUM; i++ )
-            pt_resume(&d->arch.hvm_domain.pl_time->vhpet.pt[i]);
+            pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]);
      }
 
      if ( vlapic_pt )
xen/arch/x86/irq.c +5 -5
index 6865c79..ec93ab6 100644
@@ -1293,7 +1293,7 @@ int init_domain_irq_mapping(struct domain *d)
 
      radix_tree_init(&d->arch.irq_pirq);
      if ( is_hvm_domain(d) )
-        radix_tree_init(&d->arch.hvm_domain.emuirq_pirq);
+        radix_tree_init(&d->arch.hvm.emuirq_pirq);
 
      for ( i = 1; platform_legacy_irq(i); ++i )
      {
@@ -1319,7 +1319,7 @@ void cleanup_domain_irq_mapping(struct domain *d)
  {
      radix_tree_destroy(&d->arch.irq_pirq, NULL);
      if ( is_hvm_domain(d) )
-        radix_tree_destroy(&d->arch.hvm_domain.emuirq_pirq, NULL);
+        radix_tree_destroy(&d->arch.hvm.emuirq_pirq, NULL);
  }
 
  struct pirq *alloc_pirq_struct(struct domain *d)
@@ -2490,7 +2490,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
      /* do not store emuirq mappings for pt devices */
      if ( emuirq != IRQ_PT )
      {
-        int err = radix_tree_insert(&d->arch.hvm_domain.emuirq_pirq, emuirq,
+        int err = radix_tree_insert(&d->arch.hvm.emuirq_pirq, emuirq,
                                      radix_tree_int_to_ptr(pirq));
 
          switch ( err )
@@ -2500,7 +2500,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
          case -EEXIST:
              radix_tree_replace_slot(
                  radix_tree_lookup_slot(
-                    &d->arch.hvm_domain.emuirq_pirq, emuirq),
+                    &d->arch.hvm.emuirq_pirq, emuirq),
                  radix_tree_int_to_ptr(pirq));
              break;
          default:
@@ -2542,7 +2542,7 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
          pirq_cleanup_check(info, d);
      }
      if ( emuirq != IRQ_PT )
-        radix_tree_delete(&d->arch.hvm_domain.emuirq_pirq, emuirq);
+        radix_tree_delete(&d->arch.hvm.emuirq_pirq, emuirq);
 
   done:
      return ret;
xen/arch/x86/mm/hap/hap.c +5 -6
index 812a840..fe10e9d 100644
@@ -83,7 +83,7 @@ int hap_track_dirty_vram(struct domain *d,
 
          paging_lock(d);
 
-        dirty_vram = d->arch.hvm_domain.dirty_vram;
+        dirty_vram = d->arch.hvm.dirty_vram;
          if ( !dirty_vram )
          {
              rc = -ENOMEM;
@@ -93,7 +93,7 @@ int hap_track_dirty_vram(struct domain *d,
                  goto out;
              }
 
-            d->arch.hvm_domain.dirty_vram = dirty_vram;
+            d->arch.hvm.dirty_vram = dirty_vram;
          }
 
          if ( begin_pfn != dirty_vram->begin_pfn ||
@@ -145,7 +145,7 @@ int hap_track_dirty_vram(struct domain *d,
      {
          paging_lock(d);
 
-        dirty_vram = d->arch.hvm_domain.dirty_vram;
+        dirty_vram = d->arch.hvm.dirty_vram;
          if ( dirty_vram )
          {
              /*
@@ -155,7 +155,7 @@ int hap_track_dirty_vram(struct domain *d,
              begin_pfn = dirty_vram->begin_pfn;
              nr = dirty_vram->end_pfn - dirty_vram->begin_pfn;
              xfree(dirty_vram);
-            d->arch.hvm_domain.dirty_vram = NULL;
+            d->arch.hvm.dirty_vram = NULL;
          }
 
          paging_unlock(d);
@@ -579,8 +579,7 @@ void hap_teardown(struct domain *d, bool *preempted)
 
      d->arch.paging.mode &= ~PG_log_dirty;
 
-    xfree(d->arch.hvm_domain.dirty_vram);
-    d->arch.hvm_domain.dirty_vram = NULL;
+    XFREE(d->arch.hvm.dirty_vram);
 
  out:
      paging_unlock(d);
xen/arch/x86/mm/mem_sharing.c +3 -3
index fad8a9d..fe1df83 100644
@@ -150,7 +150,7 @@ static inline shr_handle_t get_next_handle(void)
  }
 
  #define mem_sharing_enabled(d) \
-    (is_hvm_domain(d) && (d)->arch.hvm_domain.mem_sharing_enabled)
+    (is_hvm_domain(d) && (d)->arch.hvm.mem_sharing_enabled)
 
  static atomic_t nr_saved_mfns   = ATOMIC_INIT(0);
  static atomic_t nr_shared_mfns  = ATOMIC_INIT(0);
@@ -1333,7 +1333,7 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
 
      /* Only HAP is supported */
      rc = -ENODEV;
-    if ( !hap_enabled(d) || !d->arch.hvm_domain.mem_sharing_enabled )
+    if ( !hap_enabled(d) || !d->arch.hvm.mem_sharing_enabled )
          goto out;
 
      switch ( mso.op )
@@ -1613,7 +1613,7 @@ int mem_sharing_domctl(struct domain *d, struct xen_domctl_mem_sharing_op *mec)
              if ( unlikely(need_iommu(d) && mec->u.enable) )
                  rc = -EXDEV;
              else
-                d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
+                d->arch.hvm.mem_sharing_enabled = mec->u.enable;
          }
          break;
 
xen/arch/x86/mm/shadow/common.c +9 -9
index 1930a1d..afdc27d 100644
@@ -2881,11 +2881,11 @@ void shadow_teardown(struct domain *d, bool *preempted)
       * calls now that we've torn down the bitmap */
      d->arch.paging.mode &= ~PG_log_dirty;
 
-    if (d->arch.hvm_domain.dirty_vram) {
-        xfree(d->arch.hvm_domain.dirty_vram->sl1ma);
-        xfree(d->arch.hvm_domain.dirty_vram->dirty_bitmap);
-        xfree(d->arch.hvm_domain.dirty_vram);
-        d->arch.hvm_domain.dirty_vram = NULL;
+    if ( d->arch.hvm.dirty_vram )
+    {
+        xfree(d->arch.hvm.dirty_vram->sl1ma);
+        xfree(d->arch.hvm.dirty_vram->dirty_bitmap);
+        XFREE(d->arch.hvm.dirty_vram);
      }
 
  out:
@@ -3261,7 +3261,7 @@ int shadow_track_dirty_vram(struct domain *d,
      p2m_lock(p2m_get_hostp2m(d));
      paging_lock(d);
 
-    dirty_vram = d->arch.hvm_domain.dirty_vram;
+    dirty_vram = d->arch.hvm.dirty_vram;
 
      if ( dirty_vram && (!nr ||
               ( begin_pfn != dirty_vram->begin_pfn
@@ -3272,7 +3272,7 @@ int shadow_track_dirty_vram(struct domain *d,
          xfree(dirty_vram->sl1ma);
          xfree(dirty_vram->dirty_bitmap);
          xfree(dirty_vram);
-        dirty_vram = d->arch.hvm_domain.dirty_vram = NULL;
+        dirty_vram = d->arch.hvm.dirty_vram = NULL;
      }
 
      if ( !nr )
@@ -3299,7 +3299,7 @@ int shadow_track_dirty_vram(struct domain *d,
              goto out;
          dirty_vram->begin_pfn = begin_pfn;
          dirty_vram->end_pfn = end_pfn;
-        d->arch.hvm_domain.dirty_vram = dirty_vram;
+        d->arch.hvm.dirty_vram = dirty_vram;
 
          if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
              goto out_dirty_vram;
@@ -3418,7 +3418,7 @@ int shadow_track_dirty_vram(struct domain *d,
      xfree(dirty_vram->sl1ma);
  out_dirty_vram:
      xfree(dirty_vram);
-    dirty_vram = d->arch.hvm_domain.dirty_vram = NULL;
+    dirty_vram = d->arch.hvm.dirty_vram = NULL;
 
  out:
      paging_unlock(d);
xen/arch/x86/mm/shadow/multi.c +4 -4
index 9e43533..62819eb 100644
@@ -527,7 +527,7 @@ _sh_propagate(struct vcpu *v,
      guest_l1e_t guest_entry = { guest_intpte };
      shadow_l1e_t *sp = shadow_entry_ptr;
      struct domain *d = v->domain;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
      gfn_t target_gfn = guest_l1e_get_gfn(guest_entry);
      u32 pass_thru_flags;
      u32 gflags, sflags;
@@ -619,7 +619,7 @@ _sh_propagate(struct vcpu *v,
          if ( !mmio_mfn &&
               (type = hvm_get_mem_pinned_cacheattr(d, target_gfn, 0)) >= 0 )
              sflags |= pat_type_2_pte_flags(type);
-        else if ( d->arch.hvm_domain.is_in_uc_mode )
+        else if ( d->arch.hvm.is_in_uc_mode )
              sflags |= pat_type_2_pte_flags(PAT_TYPE_UNCACHABLE);
          else
              if ( iomem_access_permitted(d, mfn_x(target_mfn), mfn_x(target_mfn)) )
@@ -1110,7 +1110,7 @@ static inline void shadow_vram_get_l1e(shadow_l1e_t new_sl1e,
      mfn_t mfn = shadow_l1e_get_mfn(new_sl1e);
      int flags = shadow_l1e_get_flags(new_sl1e);
      unsigned long gfn;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
      if ( !dirty_vram         /* tracking disabled? */
           || !(flags & _PAGE_RW) /* read-only mapping? */
@@ -1141,7 +1141,7 @@ static inline void shadow_vram_put_l1e(shadow_l1e_t old_sl1e,
      mfn_t mfn = shadow_l1e_get_mfn(old_sl1e);
      int flags = shadow_l1e_get_flags(old_sl1e);
      unsigned long gfn;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm_domain.dirty_vram;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
      if ( !dirty_vram         /* tracking disabled? */
           || !(flags & _PAGE_RW) /* read-only mapping? */
xen/arch/x86/physdev.c +1 -1
index 4524823..3a3c158 100644
@@ -98,7 +98,7 @@ int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
      {
          /*
           * Only makes sense for vector-based callback, else HVM-IRQ logic
-         * calls back into itself and deadlocks on hvm_domain.irq_lock.
+         * calls back into itself and deadlocks on hvm.irq_lock.
           */
          if ( !is_hvm_pv_evtchn_domain(d) )
              return -EINVAL;
xen/arch/x86/setup.c +5 -5
index dd11815..ed133fc 100644
@@ -1870,7 +1870,7 @@ static int __hwdom_init io_bitmap_cb(unsigned long s, unsigned long e,
 
      ASSERT(e <= INT_MAX);
      for ( i = s; i <= e; i++ )
-        __clear_bit(i, d->arch.hvm_domain.io_bitmap);
+        __clear_bit(i, d->arch.hvm.io_bitmap);
 
      return 0;
  }
@@ -1881,7 +1881,7 @@ void __hwdom_init setup_io_bitmap(struct domain *d)
 
      if ( is_hvm_domain(d) )
      {
-        bitmap_fill(d->arch.hvm_domain.io_bitmap, 0x10000);
+        bitmap_fill(d->arch.hvm.io_bitmap, 0x10000);
          rc = rangeset_report_ranges(d->arch.ioport_caps, 0, 0x10000,
                                      io_bitmap_cb, d);
          BUG_ON(rc);
@@ -1892,9 +1892,9 @@ void __hwdom_init setup_io_bitmap(struct domain *d)
           * Access to 1 byte RTC ports also needs to be trapped in order
           * to keep consistency with PV.
           */
-        __set_bit(0xcf8, d->arch.hvm_domain.io_bitmap);
-        __set_bit(RTC_PORT(0), d->arch.hvm_domain.io_bitmap);
-        __set_bit(RTC_PORT(1), d->arch.hvm_domain.io_bitmap);
+        __set_bit(0xcf8, d->arch.hvm.io_bitmap);
+        __set_bit(RTC_PORT(0), d->arch.hvm.io_bitmap);
+        __set_bit(RTC_PORT(1), d->arch.hvm.io_bitmap);
      }
  }
 
xen/arch/x86/time.c +4 -4
index 69e9aaf..5922fbf 100644
@@ -1039,7 +1039,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
 
          if ( is_hvm_domain(d) )
          {
-            struct pl_time *pl = v->domain->arch.hvm_domain.pl_time;
+            struct pl_time *pl = v->domain->arch.hvm.pl_time;
 
              stime += pl->stime_offset + v->arch.hvm_vcpu.stime_offset;
              if ( stime >= 0 )
@@ -2183,7 +2183,7 @@ void tsc_set_info(struct domain *d,
      if ( is_hvm_domain(d) )
      {
          if ( hvm_tsc_scaling_supported && !d->arch.vtsc )
-            d->arch.hvm_domain.tsc_scaling_ratio =
+            d->arch.hvm.tsc_scaling_ratio =
                  hvm_get_tsc_scaling_ratio(d->arch.tsc_khz);
 
          hvm_set_rdtsc_exiting(d, d->arch.vtsc);
@@ -2197,10 +2197,10 @@ void tsc_set_info(struct domain *d,
               * call set_tsc_offset() later from hvm_vcpu_reset_state() and they
               * will sync their TSC to BSP's sync_tsc.
               */
-            d->arch.hvm_domain.sync_tsc = rdtsc();
+            d->arch.hvm.sync_tsc = rdtsc();
              hvm_set_tsc_offset(d->vcpu[0],
                                 d->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset,
-                               d->arch.hvm_domain.sync_tsc);
+                               d->arch.hvm.sync_tsc);
          }
      }
 
xen/common/vm_event.c +1 -1
index 144ab81..4793aac 100644
@@ -48,7 +48,7 @@ static int vm_event_enable(
      xen_event_channel_notification_t notification_fn)
  {
      int rc;
-    unsigned long ring_gfn = d->arch.hvm_domain.params[param];
+    unsigned long ring_gfn = d->arch.hvm.params[param];
 
      if ( !*ved )
          *ved = xzalloc(struct vm_event_domain);
xen/drivers/passthrough/pci.c +1 -1
index d1adffa..2644048 100644
@@ -1417,7 +1417,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
      /* Prevent device assign if mem paging or mem sharing have been
       * enabled for this domain */
      if ( unlikely(!need_iommu(d) &&
-            (d->arch.hvm_domain.mem_sharing_enabled ||
+            (d->arch.hvm.mem_sharing_enabled ||
               vm_event_check_ring(d->vm_event_paging) ||
               p2m_get_hostp2m(d)->global_logdirty)) )
          return -EXDEV;
xen/drivers/vpci/msix.c +3 -3
index bcf6325..1960dae 100644
@@ -152,7 +152,7 @@ static struct vpci_msix *msix_find(const struct domain *d, unsigned long addr)
  {
      struct vpci_msix *msix;
 
-    list_for_each_entry ( msix, &d->arch.hvm_domain.msix_tables, next )
+    list_for_each_entry ( msix, &d->arch.hvm.msix_tables, next )
      {
          const struct vpci_bar *bars = msix->pdev->vpci->header.bars;
          unsigned int i;
@@ -438,10 +438,10 @@ static int init_msix(struct pci_dev *pdev)
      if ( rc )
          return rc;
 
-    if ( list_empty(&d->arch.hvm_domain.msix_tables) )
+    if ( list_empty(&d->arch.hvm.msix_tables) )
          register_mmio_handler(d, &vpci_msix_table_ops);
 
-    list_add(&pdev->vpci->msix->next, &d->arch.hvm_domain.msix_tables);
+    list_add(&pdev->vpci->msix->next, &d->arch.hvm.msix_tables);
 
      return 0;
  }
xen/include/asm-arm/domain.h +1 -1
index 280c395..d682307 100644
@@ -51,7 +51,7 @@ struct arch_domain
      /* Virtual MMU */
      struct p2m_domain p2m;
 
-    struct hvm_domain hvm_domain;
+    struct hvm_domain hvm;
 
      struct vmmio vmmio;
 
xen/include/asm-x86/domain.h +2 -2
index fdd6856..4722c2d 100644
@@ -17,7 +17,7 @@
  #define is_pv_32bit_vcpu(v)    (is_pv_32bit_domain((v)->domain))
 
  #define is_hvm_pv_evtchn_domain(d) (is_hvm_domain(d) && \
-        (d)->arch.hvm_domain.irq->callback_via_type == HVMIRQ_callback_vector)
+        (d)->arch.hvm.irq->callback_via_type == HVMIRQ_callback_vector)
  #define is_hvm_pv_evtchn_vcpu(v) (is_hvm_pv_evtchn_domain(v->domain))
  #define is_domain_direct_mapped(d) ((void)(d), 0)
 
@@ -306,7 +306,7 @@ struct arch_domain
 
      union {
          struct pv_domain pv;
-        struct hvm_domain hvm_domain;
+        struct hvm_domain hvm;
      };
 
      struct paging_domain paging;
xen/include/asm-x86/hvm/domain.h +1 -1
index 5885950..acf8e03 100644
@@ -202,7 +202,7 @@ struct hvm_domain {
      };
  };
 
-#define hap_enabled(d)  ((d)->arch.hvm_domain.hap_enabled)
+#define hap_enabled(d)  ((d)->arch.hvm.hap_enabled)
 
  #endif /* __ASM_X86_HVM_DOMAIN_H__ */
 
xen/include/asm-x86/hvm/hvm.h +5 -6
index 5ea507b..ac0f035 100644
@@ -266,7 +266,7 @@ u64 hvm_get_guest_tsc_fixed(struct vcpu *v, u64 at_tsc);
      (1ULL << hvm_funcs.tsc_scaling.ratio_frac_bits)
 
  #define hvm_tsc_scaling_ratio(d) \
-    ((d)->arch.hvm_domain.tsc_scaling_ratio)
+    ((d)->arch.hvm.tsc_scaling_ratio)
 
  u64 hvm_scale_tsc(const struct domain *d, u64 tsc);
  u64 hvm_get_tsc_scaling_ratio(u32 gtsc_khz);
@@ -391,10 +391,10 @@ static inline bool hvm_get_guest_bndcfgs(struct vcpu *v, u64 *val)
  bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
 
  #define has_hvm_params(d) \
-    ((d)->arch.hvm_domain.params != NULL)
+    ((d)->arch.hvm.params != NULL)
 
  #define viridian_feature_mask(d) \
-    (has_hvm_params(d) ? (d)->arch.hvm_domain.params[HVM_PARAM_VIRIDIAN] : 0)
+    (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
 
  #define is_viridian_domain(d) \
      (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
@@ -670,9 +670,8 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d, bool restore);
  #define arch_vcpu_block(v) ({                                   \
      struct vcpu *v_ = (v);                                      \
      struct domain *d_ = v_->domain;                             \
-    if ( is_hvm_domain(d_) &&                               \
-         (d_->arch.hvm_domain.pi_ops.vcpu_block) )          \
-        d_->arch.hvm_domain.pi_ops.vcpu_block(v_);          \
+    if ( is_hvm_domain(d_) && d_->arch.hvm.pi_ops.vcpu_block )  \
+        d_->arch.hvm.pi_ops.vcpu_block(v_);                     \
  })
 
  #endif /* __ASM_X86_HVM_HVM_H__ */
xen/include/asm-x86/hvm/irq.h +1 -1
index 8a43cb9..2e6fa70 100644
@@ -97,7 +97,7 @@ struct hvm_irq {
      (((((dev)<<2) + ((dev)>>3) + (intx)) & 31) + 16)
  #define hvm_pci_intx_link(dev, intx) \
      (((dev) + (intx)) & 3)
-#define hvm_domain_irq(d) ((d)->arch.hvm_domain.irq)
+#define hvm_domain_irq(d) ((d)->arch.hvm.irq)
  #define hvm_irq_size(cnt) offsetof(struct hvm_irq, gsi_assert_count[cnt])
 
  #define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2)
xen/include/asm-x86/hvm/nestedhvm.h +2 -2
index 3c810b7..4a041e2 100644
@@ -35,8 +35,8 @@ enum nestedhvm_vmexits {
  /* Nested HVM on/off per domain */
  static inline bool nestedhvm_enabled(const struct domain *d)
  {
-    return is_hvm_domain(d) && d->arch.hvm_domain.params &&
-        d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM];
+    return is_hvm_domain(d) && d->arch.hvm.params &&
+        d->arch.hvm.params[HVM_PARAM_NESTEDHVM];
  }
 
  /* Nested VCPU */
xen/include/asm-x86/hvm/vioapic.h +1 -1
index 138d2c0..a72cd17 100644
@@ -58,7 +58,7 @@ struct hvm_vioapic {
  };
 
  #define hvm_vioapic_size(cnt) offsetof(struct hvm_vioapic, redirtbl[cnt])
-#define domain_vioapic(d, i) ((d)->arch.hvm_domain.vioapic[i])
+#define domain_vioapic(d, i) ((d)->arch.hvm.vioapic[i])
  #define vioapic_domain(v) ((v)->domain)
 
  int vioapic_init(struct domain *d);
xen/include/asm-x86/hvm/vpt.h +2 -2
index 61c26ed..99169dd 100644
@@ -150,8 +150,8 @@ void pt_migrate(struct vcpu *v);
 
  void pt_adjust_global_vcpu_target(struct vcpu *v);
  #define pt_global_vcpu_target(d) \
-    (is_hvm_domain(d) && (d)->arch.hvm_domain.i8259_target ? \
-     (d)->arch.hvm_domain.i8259_target : \
+    (is_hvm_domain(d) && (d)->arch.hvm.i8259_target ? \
+     (d)->arch.hvm.i8259_target : \
       (d)->vcpu ? (d)->vcpu[0] : NULL)
 
  void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt);
xen/include/asm-x86/irq.h +1 -2
index d9dad39..054c3ab 100644
@@ -188,8 +188,7 @@ void cleanup_domain_irq_mapping(struct domain *);
  #define domain_pirq_to_emuirq(d, pirq) pirq_field(d, pirq,              \
      arch.hvm.emuirq, IRQ_UNBOUND)
  #define domain_emuirq_to_pirq(d, emuirq) ({                             \
-    void *__ret = radix_tree_lookup(&(d)->arch.hvm_domain.emuirq_pirq,  \
-                                    emuirq);                            \
+    void *__ret = radix_tree_lookup(&(d)->arch.hvm.emuirq_pirq, emuirq);\
      __ret ? radix_tree_ptr_to_int(__ret) : IRQ_UNBOUND;                 \
  })
  #define IRQ_UNBOUND -1
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 3/7
#13 lore raw

Re: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d->arch.hvm

In reply to Andrew Cooper
Quoted 17 lines

-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 28 August 2018 18:39
To: Xen-devel <[email protected]>
Cc: Andrew Cooper <[email protected]>; Jan Beulich <[email protected]>; Wei Liu <[email protected]>; Roger Pau Monne <[email protected]>; Tim (Xen.org) <[email protected]>; George Dunlap <[email protected]>; Paul Durrant <[email protected]>; Razvan Cojocaru <[email protected]>; Tamas K Lengyel <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Jun Nakajima <[email protected]>; Kevin Tian <[email protected]>; Boris Ostrovsky <[email protected]>; Suravee Suthikulpanit <[email protected]>; Brian Woods <[email protected]>
Subject: [PATCH 3/7] xen/hvm: Rename d->arch.hvm_domain to d-

Quoted 1 line

arch.hvm

Quoted 8 lines

The trailing _domain suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

PATCH 4/7 x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

In reply to Andrew Cooper

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Razvan Cojocaru <[email protected]>
CC: Tamas K Lengyel <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>

---
 xen/arch/x86/cpu/vpmu.c                 |   2 +-
 xen/arch/x86/cpuid.c                    |   4 +-
 xen/arch/x86/domain.c                   |   4 +-
 xen/arch/x86/domctl.c                   |   8 +-
 xen/arch/x86/hvm/asid.c                 |   2 +-
 xen/arch/x86/hvm/dm.c                   |  12 +--
 xen/arch/x86/hvm/domain.c               |  38 ++++----
 xen/arch/x86/hvm/emulate.c              |  28 +++---
 xen/arch/x86/hvm/hpet.c                 |   2 +-
 xen/arch/x86/hvm/hvm.c                  | 162 ++++++++++++++++----------------
 xen/arch/x86/hvm/io.c                   |  12 +--
 xen/arch/x86/hvm/ioreq.c                |   4 +-
 xen/arch/x86/hvm/irq.c                  |   6 +-
 xen/arch/x86/hvm/mtrr.c                 |  22 ++---
 xen/arch/x86/hvm/pmtimer.c              |   2 +-
 xen/arch/x86/hvm/svm/asid.c             |   2 +-
 xen/arch/x86/hvm/svm/nestedsvm.c        |  44 ++++-----
 xen/arch/x86/hvm/svm/svm.c              |  67 +++++++------
 xen/arch/x86/hvm/svm/vmcb.c             |   6 +-
 xen/arch/x86/hvm/viridian.c             |  64 ++++++-------
 xen/arch/x86/hvm/vmsi.c                 |  30 +++---
 xen/arch/x86/hvm/vmx/intr.c             |   2 +-
 xen/arch/x86/hvm/vmx/realmode.c         |  10 +-
 xen/arch/x86/hvm/vmx/vmcs.c             |   8 +-
 xen/arch/x86/hvm/vmx/vmx.c              | 130 ++++++++++++-------------
 xen/arch/x86/hvm/vmx/vvmx.c             |  32 +++----
 xen/arch/x86/hvm/vpt.c                  |  74 +++++++--------
 xen/arch/x86/mm/hap/guest_walk.c        |   2 +-
 xen/arch/x86/mm/hap/hap.c               |   4 +-
 xen/arch/x86/mm/shadow/multi.c          |  12 +--
 xen/arch/x86/time.c                     |   6 +-
 xen/arch/x86/x86_64/asm-offsets.c       |   8 +-
 xen/arch/x86/x86_64/traps.c             |   8 +-
 xen/include/asm-x86/domain.h            |   6 +-
 xen/include/asm-x86/guest_pt.h          |   2 +-
 xen/include/asm-x86/hvm/hvm.h           |  20 ++--
 xen/include/asm-x86/hvm/nestedhvm.h     |   2 +-
 xen/include/asm-x86/hvm/svm/nestedsvm.h |   2 +-
 xen/include/asm-x86/hvm/vcpu.h          |   4 +-
 xen/include/asm-x86/hvm/vlapic.h        |   6 +-
 xen/include/asm-x86/hvm/vmx/vmx.h       |   2 +-
 41 files changed, 428 insertions(+), 433 deletions(-)
xen/arch/x86/cpu/vpmu.c +1 -1
index fa6762f..8a4f753 100644
@@ -304,7 +304,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs)
                 hvm_get_segment_register(sampled, x86_seg_ss, &seg);
                 r->ss = seg.sel;
                 r->cpl = seg.dpl;
-                if ( !(sampled->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) )
+                if ( !(sampled->arch.hvm.guest_cr[0] & X86_CR0_PE) )
                     *flags |= PMU_SAMPLE_REAL;
             }
         }
xen/arch/x86/cpuid.c +2 -2
index 24366ea..59d3298 100644
@@ -829,7 +829,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         if ( is_hvm_domain(d) )
         {
             /* OSXSAVE clear in policy.  Fast-forward CR4 back in. */
-            if ( v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_OSXSAVE )
+            if ( v->arch.hvm.guest_cr[4] & X86_CR4_OSXSAVE )
                 res->c |= cpufeat_mask(X86_FEATURE_OSXSAVE);
         }
         else /* PV domain */
@@ -960,7 +960,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
             /* OSPKE clear in policy.  Fast-forward CR4 back in. */
             if ( (is_pv_domain(d)
                   ? v->arch.pv.ctrlreg[4]
-                  : v->arch.hvm_vcpu.guest_cr[4]) & X86_CR4_PKE )
+                  : v->arch.hvm.guest_cr[4]) & X86_CR4_PKE )
                 res->c |= cpufeat_mask(X86_FEATURE_OSPKE);
             break;
         }
xen/arch/x86/domain.c +2 -2
index 3dcd7f9..ccdfec2 100644
@@ -1619,7 +1619,7 @@ static void __context_switch(void)
                 BUG();
 
             if ( cpu_has_xsaves && is_hvm_vcpu(n) )
-                set_msr_xss(n->arch.hvm_vcpu.msr_xss);
+                set_msr_xss(n->arch.hvm.msr_xss);
         }
         vcpu_restore_fpu_nonlazy(n, false);
         nd->arch.ctxt_switch->to(n);
@@ -1692,7 +1692,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
         np2m_schedule(NP2M_SCHEDLE_OUT);
     }
 
-    if ( is_hvm_domain(prevd) && !list_empty(&prev->arch.hvm_vcpu.tm_list) )
+    if ( is_hvm_domain(prevd) && !list_empty(&prev->arch.hvm.tm_list) )
         pt_save_timer(prev);
 
     local_irq_disable();
xen/arch/x86/domctl.c +4 -4
index f306614..797841e 100644
@@ -1585,10 +1585,10 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
     {
         struct segment_register sreg;
 
-        c.nat->ctrlreg[0] = v->arch.hvm_vcpu.guest_cr[0];
-        c.nat->ctrlreg[2] = v->arch.hvm_vcpu.guest_cr[2];
-        c.nat->ctrlreg[3] = v->arch.hvm_vcpu.guest_cr[3];
-        c.nat->ctrlreg[4] = v->arch.hvm_vcpu.guest_cr[4];
+        c.nat->ctrlreg[0] = v->arch.hvm.guest_cr[0];
+        c.nat->ctrlreg[2] = v->arch.hvm.guest_cr[2];
+        c.nat->ctrlreg[3] = v->arch.hvm.guest_cr[3];
+        c.nat->ctrlreg[4] = v->arch.hvm.guest_cr[4];
         hvm_get_segment_register(v, x86_seg_cs, &sreg);
         c.nat->user_regs.cs = sreg.sel;
         hvm_get_segment_register(v, x86_seg_ss, &sreg);
xen/arch/x86/hvm/asid.c +1 -1
index beca8ec..9d3c671 100644
@@ -87,7 +87,7 @@ void hvm_asid_flush_vcpu_asid(struct hvm_vcpu_asid *asid)
 
 void hvm_asid_flush_vcpu(struct vcpu *v)
 {
-    hvm_asid_flush_vcpu_asid(&v->arch.hvm_vcpu.n1asid);
+    hvm_asid_flush_vcpu_asid(&v->arch.hvm.n1asid);
     hvm_asid_flush_vcpu_asid(&vcpu_nestedhvm(v).nv_n2asid);
 }
 
xen/arch/x86/hvm/dm.c +6 -6
index 6755f3f..87d97d0 100644
@@ -317,17 +317,17 @@ static int inject_event(struct domain *d,
     if ( data->vcpuid >= d->max_vcpus || !(v = d->vcpu[data->vcpuid]) )
         return -EINVAL;
 
-    if ( cmpxchg(&v->arch.hvm_vcpu.inject_event.vector,
+    if ( cmpxchg(&v->arch.hvm.inject_event.vector,
                  HVM_EVENT_VECTOR_UNSET, HVM_EVENT_VECTOR_UPDATING) !=
          HVM_EVENT_VECTOR_UNSET )
         return -EBUSY;
 
-    v->arch.hvm_vcpu.inject_event.type = data->type;
-    v->arch.hvm_vcpu.inject_event.insn_len = data->insn_len;
-    v->arch.hvm_vcpu.inject_event.error_code = data->error_code;
-    v->arch.hvm_vcpu.inject_event.cr2 = data->cr2;
+    v->arch.hvm.inject_event.type = data->type;
+    v->arch.hvm.inject_event.insn_len = data->insn_len;
+    v->arch.hvm.inject_event.error_code = data->error_code;
+    v->arch.hvm.inject_event.cr2 = data->cr2;
     smp_wmb();
-    v->arch.hvm_vcpu.inject_event.vector = data->vector;
+    v->arch.hvm.inject_event.vector = data->vector;
 
     return 0;
 }
xen/arch/x86/hvm/domain.c +19 -19
index 8a2c83e..5d5a746 100644
@@ -204,10 +204,10 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
         uregs->rip    = regs->eip;
         uregs->rflags = regs->eflags;
 
-        v->arch.hvm_vcpu.guest_cr[0] = regs->cr0;
-        v->arch.hvm_vcpu.guest_cr[3] = regs->cr3;
-        v->arch.hvm_vcpu.guest_cr[4] = regs->cr4;
-        v->arch.hvm_vcpu.guest_efer  = regs->efer;
+        v->arch.hvm.guest_cr[0] = regs->cr0;
+        v->arch.hvm.guest_cr[3] = regs->cr3;
+        v->arch.hvm.guest_cr[4] = regs->cr4;
+        v->arch.hvm.guest_efer  = regs->efer;
     }
     break;
 
@@ -255,10 +255,10 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
         uregs->rip    = regs->rip;
         uregs->rflags = regs->rflags;
 
-        v->arch.hvm_vcpu.guest_cr[0] = regs->cr0;
-        v->arch.hvm_vcpu.guest_cr[3] = regs->cr3;
-        v->arch.hvm_vcpu.guest_cr[4] = regs->cr4;
-        v->arch.hvm_vcpu.guest_efer  = regs->efer;
+        v->arch.hvm.guest_cr[0] = regs->cr0;
+        v->arch.hvm.guest_cr[3] = regs->cr3;
+        v->arch.hvm.guest_cr[4] = regs->cr4;
+        v->arch.hvm.guest_efer  = regs->efer;
 
 #define SEG(l, a) (struct segment_register){ 0, { a }, l, 0 }
         cs = SEG(~0u, 0xa9b); /* 64bit code segment. */
@@ -270,21 +270,21 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
 
     }
 
-    if ( v->arch.hvm_vcpu.guest_efer & EFER_LME )
-        v->arch.hvm_vcpu.guest_efer |= EFER_LMA;
+    if ( v->arch.hvm.guest_efer & EFER_LME )
+        v->arch.hvm.guest_efer |= EFER_LMA;
 
-    if ( v->arch.hvm_vcpu.guest_cr[4] & ~hvm_cr4_guest_valid_bits(d, false) )
+    if ( v->arch.hvm.guest_cr[4] & ~hvm_cr4_guest_valid_bits(d, false) )
     {
         gprintk(XENLOG_ERR, "Bad CR4 value: %#016lx\n",
-                v->arch.hvm_vcpu.guest_cr[4]);
+                v->arch.hvm.guest_cr[4]);
         return -EINVAL;
     }
 
-    errstr = hvm_efer_valid(v, v->arch.hvm_vcpu.guest_efer, -1);
+    errstr = hvm_efer_valid(v, v->arch.hvm.guest_efer, -1);
     if ( errstr )
     {
         gprintk(XENLOG_ERR, "Bad EFER value (%#016lx): %s\n",
-               v->arch.hvm_vcpu.guest_efer, errstr);
+               v->arch.hvm.guest_efer, errstr);
         return -EINVAL;
     }
 
@@ -297,12 +297,12 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
     {
         /* Shadow-mode CR3 change. Check PDBR and update refcounts. */
         struct page_info *page = get_page_from_gfn(v->domain,
-                                 v->arch.hvm_vcpu.guest_cr[3] >> PAGE_SHIFT,
+                                 v->arch.hvm.guest_cr[3] >> PAGE_SHIFT,
                                  NULL, P2M_ALLOC);
         if ( !page )
         {
             gprintk(XENLOG_ERR, "Invalid CR3: %#lx\n",
-                    v->arch.hvm_vcpu.guest_cr[3]);
+                    v->arch.hvm.guest_cr[3]);
             return -EINVAL;
         }
 
@@ -316,9 +316,9 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
     hvm_set_segment_register(v, x86_seg_tr, &tr);
 
     /* Sync AP's TSC with BSP's. */
-    v->arch.hvm_vcpu.cache_tsc_offset =
-        d->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset;
-    hvm_set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset,
+    v->arch.hvm.cache_tsc_offset =
+        d->vcpu[0]->arch.hvm.cache_tsc_offset;
+    hvm_set_tsc_offset(v, v->arch.hvm.cache_tsc_offset,
                        d->arch.hvm.sync_tsc);
 
     paging_update_paging_modes(v);
xen/arch/x86/hvm/emulate.c +14 -14
index 20d1d5b..dbf8b81 100644
@@ -123,7 +123,7 @@ static int hvmemul_do_io(
 {
     struct vcpu *curr = current;
     struct domain *currd = curr->domain;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     ioreq_t p = {
         .type = is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO,
         .addr = addr,
@@ -437,7 +437,7 @@ static int hvmemul_do_io_addr(
     ASSERT(rc != X86EMUL_UNIMPLEMENTED);
 
     if ( rc == X86EMUL_OKAY )
-        v->arch.hvm_vcpu.hvm_io.mmio_retry = (count < *reps);
+        v->arch.hvm.hvm_io.mmio_retry = (count < *reps);
 
     *reps = count;
 
@@ -706,7 +706,7 @@ static int hvmemul_linear_to_phys(
     *reps = min_t(unsigned long, *reps, 4096);
 
     /* With no paging it's easy: linear == physical. */
-    if ( !(curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG) )
+    if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PG) )
     {
         *paddr = addr;
         return X86EMUL_OKAY;
@@ -975,7 +975,7 @@ static int hvmemul_linear_mmio_access(
     unsigned long gla, unsigned int size, uint8_t dir, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt, bool_t known_gpfn)
 {
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
     struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(vio, gla, dir);
     unsigned int chunk, buffer_offset = 0;
@@ -1053,7 +1053,7 @@ static int __hvmemul_read(
     pagefault_info_t pfinfo;
     unsigned long addr, reps = 1;
     uint32_t pfec = PFEC_page_present;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     int rc;
 
     if ( is_x86_system_segment(seg) )
@@ -1174,7 +1174,7 @@ static int hvmemul_write(
     struct vcpu *curr = current;
     unsigned long addr, reps = 1;
     uint32_t pfec = PFEC_page_present | PFEC_write_access;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     int rc;
     void *mapping;
 
@@ -1218,7 +1218,7 @@ static int hvmemul_rmw(
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
     unsigned long addr, reps = 1;
     uint32_t pfec = PFEC_page_present | PFEC_write_access;
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
     int rc;
     void *mapping;
 
@@ -1375,7 +1375,7 @@ static int hvmemul_cmpxchg(
     struct vcpu *curr = current;
     unsigned long addr, reps = 1;
     uint32_t pfec = PFEC_page_present | PFEC_write_access;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     int rc;
     void *mapping = NULL;
 
@@ -1593,7 +1593,7 @@ static int hvmemul_rep_movs(
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
     unsigned long saddr, daddr, bytes;
     paddr_t sgpa, dgpa;
     uint32_t pfec = PFEC_page_present;
@@ -1748,7 +1748,7 @@ static int hvmemul_rep_stos(
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
     unsigned long addr, bytes;
     paddr_t gpa;
     p2m_type_t p2mt;
@@ -1931,7 +1931,7 @@ static int hvmemul_read_cr(
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm_vcpu.guest_cr[reg];
+        *val = current->arch.hvm.guest_cr[reg];
         HVMTRACE_LONG_2D(CR_READ, reg, TRC_PAR_LONG(*val));
         return X86EMUL_OKAY;
     default:
@@ -1956,7 +1956,7 @@ static int hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm_vcpu.guest_cr[2] = val;
+        current->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
@@ -2280,7 +2280,7 @@ static int _hvm_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt,
     const struct cpu_user_regs *regs = hvmemul_ctxt->ctxt.regs;
     struct vcpu *curr = current;
     uint32_t new_intr_shadow;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     int rc;
 
     hvm_emulate_init_per_insn(hvmemul_ctxt, vio->mmio_insn,
@@ -2410,7 +2410,7 @@ void hvm_emulate_one_vm_event(enum emul_kind kind, unsigned int trapnr,
         break;
     case EMUL_KIND_SET_CONTEXT_INSN: {
         struct vcpu *curr = current;
-        struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+        struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
 
         BUILD_BUG_ON(sizeof(vio->mmio_insn) !=
                      sizeof(curr->arch.vm_event->emul.insn.data));
xen/arch/x86/hvm/hpet.c +1 -1
index 8090699..cbd1efb 100644
@@ -581,7 +581,7 @@ static int hpet_save(struct domain *d, hvm_domain_context_t *h)
         return 0;
 
     write_lock(&hp->lock);
-    guest_time = (v->arch.hvm_vcpu.guest_time ?: hvm_get_guest_time(v)) /
+    guest_time = (v->arch.hvm.guest_time ?: hvm_get_guest_time(v)) /
                  STIME_PER_HPET_TICK;
 
     /* Write the proper value into the main counter */
xen/arch/x86/hvm/hvm.c +80 -82

523 lines not on this page · raw message

xen/arch/x86/hvm/io.c +6 -6
index f1ea7d7..47d6c85 100644
@@ -82,7 +82,7 @@ bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr)
 {
     struct hvm_emulate_ctxt ctxt;
     struct vcpu *curr = current;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     int rc;
 
     hvm_emulate_init_once(&ctxt, validate, guest_cpu_user_regs());
@@ -118,7 +118,7 @@ bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr)
 bool handle_mmio_with_translation(unsigned long gla, unsigned long gpfn,
                                   struct npfec access)
 {
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
 
     vio->mmio_access = access.gla_valid &&
                        access.kind == npfec_kind_with_gla
@@ -131,7 +131,7 @@ bool handle_mmio_with_translation(unsigned long gla, unsigned long gpfn,
 bool handle_pio(uint16_t port, unsigned int size, int dir)
 {
     struct vcpu *curr = current;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     unsigned long data;
     int rc;
 
@@ -180,7 +180,7 @@ static bool_t g2m_portio_accept(const struct hvm_io_handler *handler,
 {
     struct vcpu *curr = current;
     const struct hvm_domain *hvm = &curr->domain->arch.hvm;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     struct g2m_ioport *g2m_ioport;
     unsigned int start, end;
 
@@ -201,7 +201,7 @@ static bool_t g2m_portio_accept(const struct hvm_io_handler *handler,
 static int g2m_portio_read(const struct hvm_io_handler *handler,
                            uint64_t addr, uint32_t size, uint64_t *data)
 {
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
     const struct g2m_ioport *g2m_ioport = vio->g2m_ioport;
     unsigned int mport = (addr - g2m_ioport->gport) + g2m_ioport->mport;
 
@@ -226,7 +226,7 @@ static int g2m_portio_read(const struct hvm_io_handler *handler,
 static int g2m_portio_write(const struct hvm_io_handler *handler,
                             uint64_t addr, uint32_t size, uint64_t data)
 {
-    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &current->arch.hvm.hvm_io;
     const struct g2m_ioport *g2m_ioport = vio->g2m_ioport;
     unsigned int mport = (addr - g2m_ioport->gport) + g2m_ioport->mport;
 
xen/arch/x86/hvm/ioreq.c +2 -2
index 8d60b02..138ed69 100644
@@ -110,7 +110,7 @@ bool hvm_io_pending(struct vcpu *v)
 static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
 {
     struct vcpu *v = sv->vcpu;
-    ioreq_t *ioreq = &v->arch.hvm_vcpu.hvm_io.io_req;
+    ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
 
     if ( hvm_ioreq_needs_completion(ioreq) )
     {
@@ -184,7 +184,7 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
 bool handle_hvm_io_completion(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    struct hvm_vcpu_io *vio = &v->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &v->arch.hvm.hvm_io;
     struct hvm_ioreq_server *s;
     enum hvm_io_completion io_completion;
     unsigned int id;
xen/arch/x86/hvm/irq.c +3 -3
index 1ded2c2..fe2c2fa 100644
@@ -306,13 +306,13 @@ void hvm_assert_evtchn_irq(struct vcpu *v)
 {
     if ( unlikely(in_irq() || !local_irq_is_enabled()) )
     {
-        tasklet_schedule(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
+        tasklet_schedule(&v->arch.hvm.assert_evtchn_irq_tasklet);
         return;
     }
 
-    if ( v->arch.hvm_vcpu.evtchn_upcall_vector != 0 )
+    if ( v->arch.hvm.evtchn_upcall_vector != 0 )
     {
-        uint8_t vector = v->arch.hvm_vcpu.evtchn_upcall_vector;
+        uint8_t vector = v->arch.hvm.evtchn_upcall_vector;
 
         vlapic_set_irq(vcpu_vlapic(v), vector, 0);
     }
xen/arch/x86/hvm/mtrr.c +11 -11
index 8a772bc..de1b5c4 100644
@@ -122,7 +122,7 @@ uint8_t pat_type_2_pte_flags(uint8_t pat_type)
 
 int hvm_vcpu_cacheattr_init(struct vcpu *v)
 {
-    struct mtrr_state *m = &v->arch.hvm_vcpu.mtrr;
+    struct mtrr_state *m = &v->arch.hvm.mtrr;
     unsigned int num_var_ranges =
         is_hardware_domain(v->domain) ? MASK_EXTR(mtrr_state.mtrr_cap,
                                                   MTRRcap_VCNT)
@@ -144,7 +144,7 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v)
 
     m->mtrr_cap = (1u << 10) | (1u << 8) | num_var_ranges;
 
-    v->arch.hvm_vcpu.pat_cr =
+    v->arch.hvm.pat_cr =
         ((uint64_t)PAT_TYPE_WRBACK) |               /* PAT0: WB */
         ((uint64_t)PAT_TYPE_WRTHROUGH << 8) |       /* PAT1: WT */
         ((uint64_t)PAT_TYPE_UC_MINUS << 16) |       /* PAT2: UC- */
@@ -185,7 +185,7 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v)
 
 void hvm_vcpu_cacheattr_destroy(struct vcpu *v)
 {
-    xfree(v->arch.hvm_vcpu.mtrr.var_ranges);
+    xfree(v->arch.hvm.mtrr.var_ranges);
 }
 
 /*
@@ -343,8 +343,8 @@ uint32_t get_pat_flags(struct vcpu *v,
     uint8_t guest_eff_mm_type;
     uint8_t shadow_mtrr_type;
     uint8_t pat_entry_value;
-    uint64_t pat = v->arch.hvm_vcpu.pat_cr;
-    struct mtrr_state *g = &v->arch.hvm_vcpu.mtrr;
+    uint64_t pat = v->arch.hvm.pat_cr;
+    struct mtrr_state *g = &v->arch.hvm.mtrr;
 
     /* 1. Get the effective memory type of guest physical address,
      * with the pair of guest MTRR and PAT
@@ -494,8 +494,8 @@ bool_t mtrr_var_range_msr_set(
 
 bool mtrr_pat_not_equal(const struct vcpu *vd, const struct vcpu *vs)
 {
-    const struct mtrr_state *md = &vd->arch.hvm_vcpu.mtrr;
-    const struct mtrr_state *ms = &vs->arch.hvm_vcpu.mtrr;
+    const struct mtrr_state *md = &vd->arch.hvm.mtrr;
+    const struct mtrr_state *ms = &vs->arch.hvm.mtrr;
 
     if ( md->enabled != ms->enabled )
         return true;
@@ -525,7 +525,7 @@ bool mtrr_pat_not_equal(const struct vcpu *vd, const struct vcpu *vs)
     }
 
     /* Test PAT. */
-    return vd->arch.hvm_vcpu.pat_cr != vs->arch.hvm_vcpu.pat_cr;
+    return vd->arch.hvm.pat_cr != vs->arch.hvm.pat_cr;
 }
 
 struct hvm_mem_pinned_cacheattr_range {
@@ -697,7 +697,7 @@ static int hvm_save_mtrr_msr(struct domain *d, hvm_domain_context_t *h)
     /* save mtrr&pat */
     for_each_vcpu(d, v)
     {
-        const struct mtrr_state *mtrr_state = &v->arch.hvm_vcpu.mtrr;
+        const struct mtrr_state *mtrr_state = &v->arch.hvm.mtrr;
         struct hvm_hw_mtrr hw_mtrr = {
             .msr_mtrr_def_type = mtrr_state->def_type |
                                  MASK_INSR(mtrr_state->fixed_enabled,
@@ -764,7 +764,7 @@ static int hvm_load_mtrr_msr(struct domain *d, hvm_domain_context_t *h)
         return -EINVAL;
     }
 
-    mtrr_state = &v->arch.hvm_vcpu.mtrr;
+    mtrr_state = &v->arch.hvm.mtrr;
 
     hvm_set_guest_pat(v, hw_mtrr.msr_pat_cr);
 
@@ -858,7 +858,7 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
         return -1;
 
     gmtrr_mtype = is_hvm_domain(d) && v ?
-                  get_mtrr_type(&v->arch.hvm_vcpu.mtrr,
+                  get_mtrr_type(&v->arch.hvm.mtrr,
                                 gfn << PAGE_SHIFT, order) :
                   MTRR_TYPE_WRBACK;
     hmtrr_mtype = get_mtrr_type(&mtrr_state, mfn_x(mfn) << PAGE_SHIFT, order);
xen/arch/x86/hvm/pmtimer.c +1 -1
index 75b9408..8542a32 100644
@@ -265,7 +265,7 @@ static int acpi_save(struct domain *d, hvm_domain_context_t *h)
      * Update the counter to the guest's current time.  Make sure it only
      * goes forwards.
      */
-    x = (((s->vcpu->arch.hvm_vcpu.guest_time ?: hvm_get_guest_time(s->vcpu)) -
+    x = (((s->vcpu->arch.hvm.guest_time ?: hvm_get_guest_time(s->vcpu)) -
           s->last_gtime) * s->scale) >> 32;
     if ( x < 1UL<<31 )
         acpi->tmr_val += x;
xen/arch/x86/hvm/svm/asid.c +1 -1
index 4861daa..7cc54da 100644
@@ -43,7 +43,7 @@ void svm_asid_handle_vmrun(void)
     struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb;
     struct hvm_vcpu_asid *p_asid =
         nestedhvm_vcpu_in_guestmode(curr)
-        ? &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm_vcpu.n1asid;
+        ? &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm.n1asid;
     bool_t need_flush = hvm_asid_handle_vmenter(p_asid);
 
     /* ASID 0 indicates that ASIDs are disabled. */
xen/arch/x86/hvm/svm/nestedsvm.c +22 -22

139 lines not on this page · raw message

xen/arch/x86/hvm/svm/svm.c +33 -34

211 lines not on this page · raw message

xen/arch/x86/hvm/svm/vmcb.c +3 -3
index d31fcfa..3776c53 100644
@@ -125,7 +125,7 @@ static int construct_vmcb(struct vcpu *v)
     }
 
     /* Guest EFER. */
-    v->arch.hvm_vcpu.guest_efer = 0;
+    v->arch.hvm.guest_efer = 0;
     hvm_update_guest_efer(v);
 
     /* Guest segment limits. */
@@ -171,10 +171,10 @@ static int construct_vmcb(struct vcpu *v)
     vmcb->tr.base = 0;
     vmcb->tr.limit = 0xff;
 
-    v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
+    v->arch.hvm.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
     hvm_update_guest_cr(v, 0);
 
-    v->arch.hvm_vcpu.guest_cr[4] = 0;
+    v->arch.hvm.guest_cr[4] = 0;
     hvm_update_guest_cr(v, 4);
 
     paging_update_paging_modes(v);
xen/arch/x86/hvm/viridian.c +32 -32

182 lines not on this page · raw message

xen/arch/x86/hvm/vmsi.c +15 -15
index ccbf181..0c5d0cb 100644
@@ -311,7 +311,7 @@ static int msixtbl_write(struct vcpu *v, unsigned long address,
     if ( !(val & PCI_MSIX_VECTOR_BITMASK) &&
          test_and_clear_bit(nr_entry, &entry->table_flags) )
     {
-        v->arch.hvm_vcpu.hvm_io.msix_unmask_address = address;
+        v->arch.hvm.hvm_io.msix_unmask_address = address;
         goto out;
     }
 
@@ -383,8 +383,8 @@ static bool_t msixtbl_range(const struct hvm_io_handler *handler,
                   PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET) &&
                  !(data & PCI_MSIX_VECTOR_BITMASK) )
             {
-                curr->arch.hvm_vcpu.hvm_io.msix_snoop_address = addr;
-                curr->arch.hvm_vcpu.hvm_io.msix_snoop_gpa = 0;
+                curr->arch.hvm.hvm_io.msix_snoop_address = addr;
+                curr->arch.hvm.hvm_io.msix_snoop_gpa = 0;
             }
         }
         else if ( (size == 4 || size == 8) &&
@@ -401,9 +401,9 @@ static bool_t msixtbl_range(const struct hvm_io_handler *handler,
             BUILD_BUG_ON((PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET + 4) &
                          (PCI_MSIX_ENTRY_SIZE - 1));
 
-            curr->arch.hvm_vcpu.hvm_io.msix_snoop_address =
+            curr->arch.hvm.hvm_io.msix_snoop_address =
                 addr + size * r->count - 4;
-            curr->arch.hvm_vcpu.hvm_io.msix_snoop_gpa =
+            curr->arch.hvm.hvm_io.msix_snoop_gpa =
                 r->data + size * r->count - 4;
         }
     }
@@ -506,13 +506,13 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
         for_each_vcpu ( d, v )
         {
             if ( (v->pause_flags & VPF_blocked_in_xen) &&
-                 !v->arch.hvm_vcpu.hvm_io.msix_snoop_gpa &&
-                 v->arch.hvm_vcpu.hvm_io.msix_snoop_address ==
+                 !v->arch.hvm.hvm_io.msix_snoop_gpa &&
+                 v->arch.hvm.hvm_io.msix_snoop_address ==
                  (gtable + msi_desc->msi_attrib.entry_nr *
                            PCI_MSIX_ENTRY_SIZE +
                   PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET) )
-                v->arch.hvm_vcpu.hvm_io.msix_unmask_address =
-                    v->arch.hvm_vcpu.hvm_io.msix_snoop_address;
+                v->arch.hvm.hvm_io.msix_unmask_address =
+                    v->arch.hvm.hvm_io.msix_snoop_address;
         }
     }
 
@@ -592,13 +592,13 @@ void msixtbl_pt_cleanup(struct domain *d)
 
 void msix_write_completion(struct vcpu *v)
 {
-    unsigned long ctrl_address = v->arch.hvm_vcpu.hvm_io.msix_unmask_address;
-    unsigned long snoop_addr = v->arch.hvm_vcpu.hvm_io.msix_snoop_address;
+    unsigned long ctrl_address = v->arch.hvm.hvm_io.msix_unmask_address;
+    unsigned long snoop_addr = v->arch.hvm.hvm_io.msix_snoop_address;
 
-    v->arch.hvm_vcpu.hvm_io.msix_snoop_address = 0;
+    v->arch.hvm.hvm_io.msix_snoop_address = 0;
 
     if ( !ctrl_address && snoop_addr &&
-         v->arch.hvm_vcpu.hvm_io.msix_snoop_gpa )
+         v->arch.hvm.hvm_io.msix_snoop_gpa )
     {
         const struct msi_desc *desc;
         uint32_t data;
@@ -610,7 +610,7 @@ void msix_write_completion(struct vcpu *v)
 
         if ( desc &&
              hvm_copy_from_guest_phys(&data,
-                                      v->arch.hvm_vcpu.hvm_io.msix_snoop_gpa,
+                                      v->arch.hvm.hvm_io.msix_snoop_gpa,
                                       sizeof(data)) == HVMTRANS_okay &&
              !(data & PCI_MSIX_VECTOR_BITMASK) )
             ctrl_address = snoop_addr;
@@ -619,7 +619,7 @@ void msix_write_completion(struct vcpu *v)
     if ( !ctrl_address )
         return;
 
-    v->arch.hvm_vcpu.hvm_io.msix_unmask_address = 0;
+    v->arch.hvm.hvm_io.msix_unmask_address = 0;
     if ( msixtbl_write(v, ctrl_address, 4, 0) != X86EMUL_OKAY )
         gdprintk(XENLOG_WARNING, "MSI-X write completion failure\n");
 }
xen/arch/x86/hvm/vmx/intr.c +1 -1
index eb9b288..889067c 100644
@@ -232,7 +232,7 @@ void vmx_intr_assist(void)
     int pt_vector;
 
     /* Block event injection when single step with MTF. */
-    if ( unlikely(v->arch.hvm_vcpu.single_step) )
+    if ( unlikely(v->arch.hvm.single_step) )
     {
         v->arch.hvm_vmx.exec_control |= CPU_BASED_MONITOR_TRAP_FLAG;
         vmx_update_cpu_exec_control(v);
xen/arch/x86/hvm/vmx/realmode.c +5 -5
index b20d8c4..032a681 100644
@@ -96,7 +96,7 @@ static void realmode_deliver_exception(
 void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt)
 {
     struct vcpu *curr = current;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     int rc;
 
     perfc_incr(realmode_emulations);
@@ -115,7 +115,7 @@ void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt)
     if ( rc == X86EMUL_UNRECOGNIZED )
     {
         gdprintk(XENLOG_ERR, "Unrecognized insn.\n");
-        if ( curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE )
+        if ( curr->arch.hvm.guest_cr[0] & X86_CR0_PE )
             goto fail;
 
         realmode_deliver_exception(TRAP_invalid_op, 0, hvmemul_ctxt);
@@ -129,7 +129,7 @@ void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt)
         {
             domain_pause_for_debugger();
         }
-        else if ( curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE )
+        else if ( curr->arch.hvm.guest_cr[0] & X86_CR0_PE )
         {
             gdprintk(XENLOG_ERR, "Exception %02x in protected mode.\n",
                      hvmemul_ctxt->ctxt.event.vector);
@@ -156,7 +156,7 @@ void vmx_realmode(struct cpu_user_regs *regs)
     struct vcpu *curr = current;
     struct hvm_emulate_ctxt hvmemul_ctxt;
     struct segment_register *sreg;
-    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm.hvm_io;
     unsigned long intr_info;
     unsigned int emulations = 0;
 
@@ -168,7 +168,7 @@ void vmx_realmode(struct cpu_user_regs *regs)
     hvm_emulate_init_once(&hvmemul_ctxt, NULL, regs);
 
     /* Only deliver interrupts into emulated real mode. */
-    if ( !(curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) &&
+    if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) &&
          (intr_info & INTR_INFO_VALID_MASK) )
     {
         realmode_deliver_exception((uint8_t)intr_info, 0, &hvmemul_ctxt);
xen/arch/x86/hvm/vmx/vmcs.c +4 -4
index f30850c..5e4a6b1 100644
@@ -1233,10 +1233,10 @@ static int construct_vmcs(struct vcpu *v)
               | (v->arch.fully_eager_fpu ? 0 : (1U << TRAP_no_device));
     vmx_update_exception_bitmap(v);
 
-    v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
+    v->arch.hvm.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
     hvm_update_guest_cr(v, 0);
 
-    v->arch.hvm_vcpu.guest_cr[4] = 0;
+    v->arch.hvm.guest_cr[4] = 0;
     hvm_update_guest_cr(v, 4);
 
     if ( cpu_has_vmx_tpr_shadow )
@@ -1838,9 +1838,9 @@ void vmx_do_resume(struct vcpu *v)
                   || v->domain->arch.monitor.software_breakpoint_enabled
                   || v->domain->arch.monitor.singlestep_enabled;
 
-    if ( unlikely(v->arch.hvm_vcpu.debug_state_latch != debug_state) )
+    if ( unlikely(v->arch.hvm.debug_state_latch != debug_state) )
     {
-        v->arch.hvm_vcpu.debug_state_latch = debug_state;
+        v->arch.hvm.debug_state_latch = debug_state;
         vmx_update_debug_state(v);
     }
 
xen/arch/x86/hvm/vmx/vmx.c +65 -65

373 lines not on this page · raw message

xen/arch/x86/hvm/vmx/vvmx.c +16 -16
index b7d9a1a..5cdea47 100644
@@ -383,8 +383,8 @@ static int vmx_inst_check_privilege(struct cpu_user_regs *regs, int vmxop_check)
 
     if ( vmxop_check )
     {
-        if ( !(v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) ||
-             !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_VMXE) )
+        if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_PE) ||
+             !(v->arch.hvm.guest_cr[4] & X86_CR4_VMXE) )
             goto invalid_op;
     }
     else if ( !nvmx_vcpu_in_vmx(v) )
@@ -1082,7 +1082,7 @@ static void load_shadow_guest_state(struct vcpu *v)
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
     }
 
-    hvm_set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset, 0);
+    hvm_set_tsc_offset(v, v->arch.hvm.cache_tsc_offset, 0);
 
     vvmcs_to_shadow_bulk(v, ARRAY_SIZE(vmentry_fields), vmentry_fields);
 
@@ -1170,7 +1170,7 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
      * hvm_set_efer won't work if CR0.PG = 1, so we change the value
      * directly to make hvm_long_mode_active(v) work in L2.
      * An additional update_paging_modes is also needed if
-     * there is 32/64 switch. v->arch.hvm_vcpu.guest_efer doesn't
+     * there is 32/64 switch. v->arch.hvm.guest_efer doesn't
      * need to be saved, since its value on vmexit is determined by
      * L1 exit_controls
      */
@@ -1178,9 +1178,9 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
     lm_l2 = !!(get_vvmcs(v, VM_ENTRY_CONTROLS) & VM_ENTRY_IA32E_MODE);
 
     if ( lm_l2 )
-        v->arch.hvm_vcpu.guest_efer |= EFER_LMA | EFER_LME;
+        v->arch.hvm.guest_efer |= EFER_LMA | EFER_LME;
     else
-        v->arch.hvm_vcpu.guest_efer &= ~(EFER_LMA | EFER_LME);
+        v->arch.hvm.guest_efer &= ~(EFER_LMA | EFER_LME);
 
     load_shadow_control(v);
     load_shadow_guest_state(v);
@@ -1189,7 +1189,7 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
         paging_update_paging_modes(v);
 
     if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+         !(v->arch.hvm.guest_efer & EFER_LMA) )
         vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdpte_fields), gpdpte_fields);
 
     regs->rip = get_vvmcs(v, GUEST_RIP);
@@ -1236,7 +1236,7 @@ static void sync_vvmcs_guest_state(struct vcpu *v, struct cpu_user_regs *regs)
 
     if ( v->arch.hvm_vmx.cr4_host_mask != ~0UL )
         /* Only need to update nested GUEST_CR4 if not all bits are trapped. */
-        set_vvmcs(v, GUEST_CR4, v->arch.hvm_vcpu.guest_cr[4]);
+        set_vvmcs(v, GUEST_CR4, v->arch.hvm.guest_cr[4]);
 }
 
 static void sync_vvmcs_ro(struct vcpu *v)
@@ -1288,7 +1288,7 @@ static void load_vvmcs_host_state(struct vcpu *v)
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
     }
 
-    hvm_set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset, 0);
+    hvm_set_tsc_offset(v, v->arch.hvm.cache_tsc_offset, 0);
 
     set_vvmcs(v, VM_ENTRY_INTR_INFO, 0);
 }
@@ -1369,7 +1369,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     sync_exception_state(v);
 
     if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         !(v->arch.hvm_vcpu.guest_efer & EFER_LMA) )
+         !(v->arch.hvm.guest_efer & EFER_LMA) )
         shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdpte_fields), gpdpte_fields);
 
     /* This will clear current pCPU bit in p2m->dirty_cpumask */
@@ -1385,9 +1385,9 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     lm_l1 = !!(get_vvmcs(v, VM_EXIT_CONTROLS) & VM_EXIT_IA32E_MODE);
 
     if ( lm_l1 )
-        v->arch.hvm_vcpu.guest_efer |= EFER_LMA | EFER_LME;
+        v->arch.hvm.guest_efer |= EFER_LMA | EFER_LME;
     else
-        v->arch.hvm_vcpu.guest_efer &= ~(EFER_LMA | EFER_LME);
+        v->arch.hvm.guest_efer &= ~(EFER_LMA | EFER_LME);
 
     vmx_update_cpu_exec_control(v);
     vmx_update_secondary_exec_control(v);
@@ -2438,7 +2438,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_DR_ACCESS:
         ctrl = __n2_exec_control(v);
         if ( (ctrl & CPU_BASED_MOV_DR_EXITING) &&
-            v->arch.hvm_vcpu.flag_dr_dirty )
+            v->arch.hvm.flag_dr_dirty )
             nvcpu->nv_vmexit_pending = 1;
         break;
     case EXIT_REASON_INVLPG:
@@ -2620,13 +2620,13 @@ void nvmx_set_cr_read_shadow(struct vcpu *v, unsigned int cr)
          * hardware. It consists of the L2-owned bits from the new
          * value combined with the L1-owned bits from L1's guest cr.
          */
-        v->arch.hvm_vcpu.guest_cr[cr] &= ~virtual_cr_mask;
-        v->arch.hvm_vcpu.guest_cr[cr] |= virtual_cr_mask &
+        v->arch.hvm.guest_cr[cr] &= ~virtual_cr_mask;
+        v->arch.hvm.guest_cr[cr] |= virtual_cr_mask &
             get_vvmcs(v, cr_field);
     }
 
     /* nvcpu.guest_cr is what L2 write to cr actually. */
-    __vmwrite(read_shadow_field, v->arch.hvm_vcpu.nvcpu.guest_cr[cr]);
+    __vmwrite(read_shadow_field, v->arch.hvm.nvcpu.guest_cr[cr]);
 }
 
 /*
xen/arch/x86/hvm/vpt.c +37 -37

246 lines not on this page · raw message

xen/arch/x86/mm/hap/guest_walk.c +1 -1
index cb3f9ce..3b8ee2e 100644
@@ -42,7 +42,7 @@ asm(".file \"" __OBJECT_FILE__ "\"");
 unsigned long hap_gva_to_gfn(GUEST_PAGING_LEVELS)(
     struct vcpu *v, struct p2m_domain *p2m, unsigned long gva, uint32_t *pfec)
 {
-    unsigned long cr3 = v->arch.hvm_vcpu.guest_cr[3];
+    unsigned long cr3 = v->arch.hvm.guest_cr[3];
     return hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)(v, p2m, cr3, gva, pfec, NULL);
 }
 
xen/arch/x86/mm/hap/hap.c +2 -2
index fe10e9d..6031361 100644
@@ -664,7 +664,7 @@ static bool_t hap_invlpg(struct vcpu *v, unsigned long va)
 
 static void hap_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 {
-    v->arch.hvm_vcpu.hw_cr[3] = v->arch.hvm_vcpu.guest_cr[3];
+    v->arch.hvm.hw_cr[3] = v->arch.hvm.guest_cr[3];
     hvm_update_guest_cr3(v, noflush);
 }
 
@@ -680,7 +680,7 @@ hap_paging_get_mode(struct vcpu *v)
 static void hap_update_paging_modes(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    unsigned long cr3_gfn = v->arch.hvm_vcpu.guest_cr[3] >> PAGE_SHIFT;
+    unsigned long cr3_gfn = v->arch.hvm.guest_cr[3] >> PAGE_SHIFT;
     p2m_type_t t;
 
     /* We hold onto the cr3 as it may be modified later, and
xen/arch/x86/mm/shadow/multi.c +5 -7
index 62819eb..2dac8d1 100644
@@ -4070,7 +4070,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 
      ASSERT(shadow_mode_external(d));
      /* Find where in the page the l3 table is */
-     guest_idx = guest_index((void *)v->arch.hvm_vcpu.guest_cr[3]);
+     guest_idx = guest_index((void *)v->arch.hvm.guest_cr[3]);
 
      // Ignore the low 2 bits of guest_idx -- they are really just
      // cache control.
@@ -4208,19 +4208,17 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 
 
     ///
-    /// v->arch.hvm_vcpu.hw_cr[3]
+    /// v->arch.hvm.hw_cr[3]
     ///
     if ( shadow_mode_external(d) )
     {
         ASSERT(is_hvm_domain(d));
 #if SHADOW_PAGING_LEVELS == 3
         /* 2-on-3 or 3-on-3: Use the PAE shadow l3 table we just fabricated */
-        v->arch.hvm_vcpu.hw_cr[3] =
-            virt_to_maddr(&v->arch.paging.shadow.l3table);
+        v->arch.hvm.hw_cr[3] = virt_to_maddr(&v->arch.paging.shadow.l3table);
 #else
         /* 4-on-4: Just use the shadow top-level directly */
-        v->arch.hvm_vcpu.hw_cr[3] =
-            pagetable_get_paddr(v->arch.shadow_table[0]);
+        v->arch.hvm.hw_cr[3] = pagetable_get_paddr(v->arch.shadow_table[0]);
 #endif
         hvm_update_guest_cr3(v, noflush);
     }
@@ -4543,7 +4541,7 @@ static void sh_pagetable_dying(struct vcpu *v, paddr_t gpa)
     unsigned long l3gfn;
     mfn_t l3mfn;
 
-    gcr3 = (v->arch.hvm_vcpu.guest_cr[3]);
+    gcr3 = v->arch.hvm.guest_cr[3];
     /* fast path: the pagetable belongs to the current context */
     if ( gcr3 == gpa )
         fast_path = 1;
xen/arch/x86/time.c +3 -3
index 5922fbf..e964e60 100644
@@ -1041,7 +1041,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
         {
             struct pl_time *pl = v->domain->arch.hvm.pl_time;
 
-            stime += pl->stime_offset + v->arch.hvm_vcpu.stime_offset;
+            stime += pl->stime_offset + v->arch.hvm.stime_offset;
             if ( stime >= 0 )
                 tsc_stamp = gtime_to_gtsc(d, stime);
             else
@@ -1081,7 +1081,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
         _u.flags |= XEN_PVCLOCK_TSC_STABLE_BIT;
 
     if ( is_hvm_domain(d) )
-        _u.tsc_timestamp += v->arch.hvm_vcpu.cache_tsc_offset;
+        _u.tsc_timestamp += v->arch.hvm.cache_tsc_offset;
 
     /* Don't bother unless timestamp record has changed or we are forced. */
     _u.version = u->version; /* make versions match for memcmp test */
@@ -2199,7 +2199,7 @@ void tsc_set_info(struct domain *d,
              */
             d->arch.hvm.sync_tsc = rdtsc();
             hvm_set_tsc_offset(d->vcpu[0],
-                               d->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset,
+                               d->vcpu[0]->arch.hvm.cache_tsc_offset,
                                d->arch.hvm.sync_tsc);
         }
     }
xen/arch/x86/x86_64/asm-offsets.c +4 -4
index 26524c4..555804c 100644
@@ -95,12 +95,12 @@ void __dummy__(void)
     OFFSET(VCPU_vmx_realmode, struct vcpu, arch.hvm_vmx.vmx_realmode);
     OFFSET(VCPU_vmx_emulate, struct vcpu, arch.hvm_vmx.vmx_emulate);
     OFFSET(VCPU_vm86_seg_mask, struct vcpu, arch.hvm_vmx.vm86_segment_mask);
-    OFFSET(VCPU_hvm_guest_cr2, struct vcpu, arch.hvm_vcpu.guest_cr[2]);
+    OFFSET(VCPU_hvm_guest_cr2, struct vcpu, arch.hvm.guest_cr[2]);
     BLANK();
 
-    OFFSET(VCPU_nhvm_guestmode, struct vcpu, arch.hvm_vcpu.nvcpu.nv_guestmode);
-    OFFSET(VCPU_nhvm_p2m, struct vcpu, arch.hvm_vcpu.nvcpu.nv_p2m);
-    OFFSET(VCPU_nsvm_hap_enabled, struct vcpu, arch.hvm_vcpu.nvcpu.u.nsvm.ns_hap_enabled);
+    OFFSET(VCPU_nhvm_guestmode, struct vcpu, arch.hvm.nvcpu.nv_guestmode);
+    OFFSET(VCPU_nhvm_p2m, struct vcpu, arch.hvm.nvcpu.nv_p2m);
+    OFFSET(VCPU_nsvm_hap_enabled, struct vcpu, arch.hvm.nvcpu.u.nsvm.ns_hap_enabled);
     BLANK();
 
     OFFSET(DOMAIN_is_32bit_pv, struct domain, arch.is_32bit_pv);
xen/arch/x86/x86_64/traps.c +4 -4
index 606b1b0..c423bc0 100644
@@ -104,10 +104,10 @@ void show_registers(const struct cpu_user_regs *regs)
     {
         struct segment_register sreg;
         context = CTXT_hvm_guest;
-        fault_crs[0] = v->arch.hvm_vcpu.guest_cr[0];
-        fault_crs[2] = v->arch.hvm_vcpu.guest_cr[2];
-        fault_crs[3] = v->arch.hvm_vcpu.guest_cr[3];
-        fault_crs[4] = v->arch.hvm_vcpu.guest_cr[4];
+        fault_crs[0] = v->arch.hvm.guest_cr[0];
+        fault_crs[2] = v->arch.hvm.guest_cr[2];
+        fault_crs[3] = v->arch.hvm.guest_cr[3];
+        fault_crs[4] = v->arch.hvm.guest_cr[4];
         hvm_get_segment_register(v, x86_seg_cs, &sreg);
         fault_regs.cs = sreg.sel;
         hvm_get_segment_register(v, x86_seg_ds, &sreg);
xen/include/asm-x86/domain.h +3 -3
index 4722c2d..0ea3742 100644
@@ -541,7 +541,7 @@ struct arch_vcpu
     /* Virtual Machine Extensions */
     union {
         struct pv_vcpu pv;
-        struct hvm_vcpu hvm_vcpu;
+        struct hvm_vcpu hvm;
     };
 
     pagetable_t guest_table_user;       /* (MFN) x86/64 user-space pagetable */
@@ -605,8 +605,8 @@ void update_guest_memory_policy(struct vcpu *v,
                                 struct guest_memory_policy *policy);
 
 /* Shorthands to improve code legibility. */
-#define hvm_vmx         hvm_vcpu.u.vmx
-#define hvm_svm         hvm_vcpu.u.svm
+#define hvm_vmx         hvm.u.vmx
+#define hvm_svm         hvm.u.svm
 
 bool update_runstate_area(struct vcpu *);
 bool update_secondary_system_time(struct vcpu *,
xen/include/asm-x86/guest_pt.h +1 -1
index 08031c8..8684b83 100644
@@ -215,7 +215,7 @@ static inline bool guest_can_use_l2_superpages(const struct vcpu *v)
     return (is_pv_vcpu(v) ||
             GUEST_PAGING_LEVELS != 2 ||
             !hvm_paging_enabled(v) ||
-            (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE));
+            (v->arch.hvm.guest_cr[4] & X86_CR4_PSE));
 }
 
 static inline bool guest_can_use_l3_superpages(const struct domain *d)
xen/include/asm-x86/hvm/hvm.h +10 -10
index ac0f035..132e62b 100644
@@ -285,27 +285,27 @@ void vmsi_deliver_pirq(struct domain *d, const struct hvm_pirq_dpci *);
 int hvm_girq_dest_2_vcpu_id(struct domain *d, uint8_t dest, uint8_t dest_mode);
 
 #define hvm_paging_enabled(v) \
-    (!!((v)->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG))
+    (!!((v)->arch.hvm.guest_cr[0] & X86_CR0_PG))
 #define hvm_wp_enabled(v) \
-    (!!((v)->arch.hvm_vcpu.guest_cr[0] & X86_CR0_WP))
+    (!!((v)->arch.hvm.guest_cr[0] & X86_CR0_WP))
 #define hvm_pcid_enabled(v) \
-    (!!((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PCIDE))
+    (!!((v)->arch.hvm.guest_cr[4] & X86_CR4_PCIDE))
 #define hvm_pae_enabled(v) \
-    (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE))
+    (hvm_paging_enabled(v) && ((v)->arch.hvm.guest_cr[4] & X86_CR4_PAE))
 #define hvm_smep_enabled(v) \
-    (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_SMEP))
+    (hvm_paging_enabled(v) && ((v)->arch.hvm.guest_cr[4] & X86_CR4_SMEP))
 #define hvm_smap_enabled(v) \
-    (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_SMAP))
+    (hvm_paging_enabled(v) && ((v)->arch.hvm.guest_cr[4] & X86_CR4_SMAP))
 #define hvm_nx_enabled(v) \
-    ((v)->arch.hvm_vcpu.guest_efer & EFER_NX)
+    ((v)->arch.hvm.guest_efer & EFER_NX)
 #define hvm_pku_enabled(v) \
-    (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PKE))
+    (hvm_paging_enabled(v) && ((v)->arch.hvm.guest_cr[4] & X86_CR4_PKE))
 
 /* Can we use superpages in the HAP p2m table? */
 #define hap_has_1gb (!!(hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_1GB))
 #define hap_has_2mb (!!(hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_2MB))
 
-#define hvm_long_mode_active(v) (!!((v)->arch.hvm_vcpu.guest_efer & EFER_LMA))
+#define hvm_long_mode_active(v) (!!((v)->arch.hvm.guest_efer & EFER_LMA))
 
 enum hvm_intblk
 hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack);
@@ -548,7 +548,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
 #define hvm_msr_tsc_aux(v) ({                                               \
     struct domain *__d = (v)->domain;                                       \
     (__d->arch.tsc_mode == TSC_MODE_PVRDTSCP)                               \
-        ? (u32)__d->arch.incarnation : (u32)(v)->arch.hvm_vcpu.msr_tsc_aux; \
+        ? (u32)__d->arch.incarnation : (u32)(v)->arch.hvm.msr_tsc_aux;      \
 })
 
 int hvm_x2apic_msr_read(struct vcpu *v, unsigned int msr, uint64_t *msr_content);
xen/include/asm-x86/hvm/nestedhvm.h +1 -1
index 4a041e2..9d1c274 100644
@@ -89,7 +89,7 @@ static inline void nestedhvm_set_cr(struct vcpu *v, unsigned int cr,
 {
     if ( !nestedhvm_vmswitch_in_progress(v) &&
          nestedhvm_vcpu_in_guestmode(v) )
-        v->arch.hvm_vcpu.nvcpu.guest_cr[cr] = value;
+        v->arch.hvm.nvcpu.guest_cr[cr] = value;
 }
 
 #endif /* _HVM_NESTEDHVM_H */
xen/include/asm-x86/hvm/svm/nestedsvm.h +1 -1
index abcf2e7..31fb4bf 100644
@@ -94,7 +94,7 @@ struct nestedsvm {
 
 /* True when l1 guest enabled SVM in EFER */
 #define nsvm_efer_svm_enabled(v) \
-    (!!((v)->arch.hvm_vcpu.guest_efer & EFER_SVME))
+    (!!((v)->arch.hvm.guest_efer & EFER_SVME))
 
 int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr);
 void nestedsvm_vmexit_defer(struct vcpu *v,
xen/include/asm-x86/hvm/vcpu.h +2 -2
index 86b4ee2..54ea044 100644
@@ -135,14 +135,14 @@ struct nestedvcpu {
     unsigned long       guest_cr[5];
 };
 
-#define vcpu_nestedhvm(v) ((v)->arch.hvm_vcpu.nvcpu)
+#define vcpu_nestedhvm(v) ((v)->arch.hvm.nvcpu)
 
 struct altp2mvcpu {
     uint16_t    p2midx;         /* alternate p2m index */
     gfn_t       veinfo_gfn;     /* #VE information page gfn */
 };
 
-#define vcpu_altp2m(v) ((v)->arch.hvm_vcpu.avcpu)
+#define vcpu_altp2m(v) ((v)->arch.hvm.avcpu)
 
 struct hvm_vcpu {
     /* Guest control-register and EFER values, just as the guest sees them. */
xen/include/asm-x86/hvm/vlapic.h +3 -3
index 212c36b..8dbec90 100644
@@ -25,10 +25,10 @@
 #include <public/hvm/ioreq.h>
 #include <asm/hvm/vpt.h>
 
-#define vcpu_vlapic(x)   (&(x)->arch.hvm_vcpu.vlapic)
-#define vlapic_vcpu(x)   (container_of((x), struct vcpu, arch.hvm_vcpu.vlapic))
+#define vcpu_vlapic(x)   (&(x)->arch.hvm.vlapic)
+#define vlapic_vcpu(x)   (container_of((x), struct vcpu, arch.hvm.vlapic))
 #define const_vlapic_vcpu(x) (container_of((x), const struct vcpu, \
-                              arch.hvm_vcpu.vlapic))
+                              arch.hvm.vlapic))
 #define vlapic_domain(x) (vlapic_vcpu(x)->domain)
 
 #define _VLAPIC_ID(vlapic, id) (vlapic_x2apic_mode(vlapic) \
xen/include/asm-x86/hvm/vmx/vmx.h +1 -1
index 89619e4..23de869 100644
@@ -552,7 +552,7 @@ static inline void vpid_sync_vcpu_gva(struct vcpu *v, unsigned long gva)
         type = INVVPID_ALL_CONTEXT;
 
 execute_invvpid:
-    __invvpid(type, v->arch.hvm_vcpu.n1asid.asid, (u64)gva);
+    __invvpid(type, v->arch.hvm.n1asid.asid, (u64)gva);
 }
 
 static inline void vpid_sync_all(void)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 4/7
#15 lore raw

Re: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

Quoted 8 lines · Andrew Cooper

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 4/7
#16 lore raw

Re: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

In reply to Andrew Cooper
Quoted 8 lines · Andrew Cooper

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 4/7
#17 lore raw

Re: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

In reply to Andrew Cooper
Quoted 5 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Wednesday, August 29, 2018 1:39 AM

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Quoted 7 lines

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers
where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 4/7
#18 lore raw

Re: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

In reply to Andrew Cooper
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines · On 28.08.18 at 19:39, <[email protected]> wrote:

On 28.08.18 at 19:39, <[email protected]> wrote:

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

I couldn't find any such conversion, so perhaps better to delete that part of the description.

Quoted 3 lines

No functional change.

Quoted 13 lines
xen/arch/x86/hvm/hvm.c +2 -3
@@ -3888,19 +3886,19 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
     v->arch.user_regs.rip = ip;
     memset(&v->arch.debugreg, 0, sizeof(v->arch.debugreg));
 
-    v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_ET;
+    v->arch.hvm.guest_cr[0] = X86_CR0_ET;
     hvm_update_guest_cr(v, 0);
 
-    v->arch.hvm_vcpu.guest_cr[2] = 0;
+    v->arch.hvm.guest_cr[2] = 0;
     hvm_update_guest_cr(v, 2);
 
-    v->arch.hvm_vcpu.guest_cr[3] = 0;

xen/arch/x86/hvm/hvm.c void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip) · line 3902

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +3 -2
+    v->arch.hvm.guest_cr[3] = 0;
     hvm_update_guest_cr(v, 3);
 
-    v->arch.hvm_vcpu.guest_cr[4] = 0;
+    v->arch.hvm.guest_cr[4] = 0;
     hvm_update_guest_cr(v, 4);
 
-    v->arch.hvm_vcpu.guest_efer = 0;
+    v->arch.hvm.guest_efer = 0;
     hvm_update_guest_efer(v);

Noticing this, a thought unrelated to this series: Wouldn't we be better off setting all the structure fields first, and only then invoke all the functions? Just like arch_set_info_hvm_guest() does?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#19 lore raw

Re: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

Quoted 8 lines · Jan Beulich
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines · On 28.08.18 at 19:39, <[email protected]> wrote:

On 28.08.18 at 19:39, <[email protected]> wrote:

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

I couldn't find any such conversion, so perhaps better to delete that part of the description.

Fixed.

Quoted 5 lines
Quoted 4 lines

No functional change.

Thanks.

Quoted 21 lines
Quoted 21 lines
xen/arch/x86/hvm/hvm.c +4 -4
@@ -3888,19 +3886,19 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
     v->arch.user_regs.rip = ip;
     memset(&v->arch.debugreg, 0, sizeof(v->arch.debugreg));
 
-    v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_ET;
+    v->arch.hvm.guest_cr[0] = X86_CR0_ET;
     hvm_update_guest_cr(v, 0);
 
-    v->arch.hvm_vcpu.guest_cr[2] = 0;
+    v->arch.hvm.guest_cr[2] = 0;
     hvm_update_guest_cr(v, 2);
 
-    v->arch.hvm_vcpu.guest_cr[3] = 0;
+    v->arch.hvm.guest_cr[3] = 0;
     hvm_update_guest_cr(v, 3);
 
-    v->arch.hvm_vcpu.guest_cr[4] = 0;
+    v->arch.hvm.guest_cr[4] = 0;
     hvm_update_guest_cr(v, 4);
 
Quoted 6 lines

xen/arch/x86/hvm/hvm.c void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip) · line 3902

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +1 -1
-    v->arch.hvm_vcpu.guest_efer = 0;
+    v->arch.hvm.guest_efer = 0;
     hvm_update_guest_efer(v);

Noticing this, a thought unrelated to this series: Wouldn't we be better off setting all the structure fields first, and only then invoke all the functions? Just like arch_set_info_hvm_guest() does?

Actually, arch_set_info_hvm_guest() is broken in a related way.  When nested virt is in the mix, the usual rules for which control bits can be changed are relaxed, and you can get into a number of corner cases where these helpers don't do the correct thing.  (e.g. when a 32bit PAE guest tries vmexiting to a PCID hypervisor).

Resolving this mess is on the todo list, which includes this function, and others.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 4/7
#20 lore raw

Re: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

In reply to Andrew Cooper
Quoted 16 lines

-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 28 August 2018 18:39
To: Xen-devel <[email protected]>
Cc: Andrew Cooper <[email protected]>; Jan Beulich <[email protected]>; Wei Liu <[email protected]>; Roger Pau Monne <[email protected]>; Tim (Xen.org) <[email protected]>; George Dunlap <[email protected]>; Paul Durrant <[email protected]>; Razvan Cojocaru <[email protected]>; Tamas K Lengyel <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Jun Nakajima <[email protected]>; Kevin Tian <[email protected]>; Boris Ostrovsky <[email protected]>; Suravee Suthikulpanit <[email protected]>; Brian Woods <[email protected]>
Subject: [PATCH 4/7] x86/hvm: Rename v->arch.hvm_vcpu to v->arch.hvm

Quoted 8 lines

The trailing _vcpu suffix is redundant, but adds to code volume. Drop it.

Reflow lines as appropriate, and switch to using the new XFREE/etc wrappers where applicable.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#21 lore raw

PATCH 5/7 x86/vtx: Rename arch_vmx_struct to vmx_vcpu

In reply to Andrew Cooper

The suffix and prefix are redundant, and the name is curiously odd. Rename it to vmx_vcpu to be consistent with all the other similar structures.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

Some of the local pointers are named arch_vmx. I'm open to renaming them to just vmx (like all the other local pointers) if people are happy with the additional patch delta.

---
 xen/arch/x86/hvm/vmx/vmcs.c        | 14 +++++++-------
 xen/arch/x86/hvm/vmx/vmx.c         |  4 ++--
 xen/include/asm-x86/hvm/vcpu.h     |  2 +-
 xen/include/asm-x86/hvm/vmx/vmcs.h |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +7 -7
index 5e4a6b1..bfa3e77 100644
@@ -518,7 +518,7 @@ static void vmx_free_vmcs(paddr_t pa)
 static void __vmx_clear_vmcs(void *info)
 {
     struct vcpu *v = info;
-    struct arch_vmx_struct *arch_vmx = &v->arch.hvm_vmx;
+    struct vmx_vcpu *arch_vmx = &v->arch.hvm_vmx;
 
     /* Otherwise we can nest (vmx_cpu_down() vs. vmx_clear_vmcs()). */
     ASSERT(!local_irq_is_enabled());
@@ -901,7 +901,7 @@ bool vmx_msr_is_intercepted(struct vmx_msr_bitmap *msr_bitmap,
  */
 void vmx_vmcs_switch(paddr_t from, paddr_t to)
 {
-    struct arch_vmx_struct *vmx = &current->arch.hvm_vmx;
+    struct vmx_vcpu *vmx = &current->arch.hvm_vmx;
     spin_lock(&vmx->vmcs_lock);
 
     __vmpclear(from);
@@ -1308,7 +1308,7 @@ static struct vmx_msr_entry *locate_msr_entry(
 struct vmx_msr_entry *vmx_find_msr(const struct vcpu *v, uint32_t msr,
                                    enum vmx_msr_list_type type)
 {
-    const struct arch_vmx_struct *vmx = &v->arch.hvm_vmx;
+    const struct vmx_vcpu *vmx = &v->arch.hvm_vmx;
     struct vmx_msr_entry *start = NULL, *ent, *end;
     unsigned int substart = 0, subend = vmx->msr_save_count;
     unsigned int total = vmx->msr_load_count;
@@ -1349,7 +1349,7 @@ struct vmx_msr_entry *vmx_find_msr(const struct vcpu *v, uint32_t msr,
 int vmx_add_msr(struct vcpu *v, uint32_t msr, uint64_t val,
                 enum vmx_msr_list_type type)
 {
-    struct arch_vmx_struct *vmx = &v->arch.hvm_vmx;
+    struct vmx_vcpu *vmx = &v->arch.hvm_vmx;
     struct vmx_msr_entry **ptr, *start = NULL, *ent, *end;
     unsigned int substart, subend, total;
     int rc;
@@ -1460,7 +1460,7 @@ int vmx_add_msr(struct vcpu *v, uint32_t msr, uint64_t val,
 
 int vmx_del_msr(struct vcpu *v, uint32_t msr, enum vmx_msr_list_type type)
 {
-    struct arch_vmx_struct *vmx = &v->arch.hvm_vmx;
+    struct vmx_vcpu *vmx = &v->arch.hvm_vmx;
     struct vmx_msr_entry *start = NULL, *ent, *end;
     unsigned int substart = 0, subend = vmx->msr_save_count;
     unsigned int total = vmx->msr_load_count;
@@ -1743,7 +1743,7 @@ void vmx_domain_update_eptp(struct domain *d)
 
 int vmx_create_vmcs(struct vcpu *v)
 {
-    struct arch_vmx_struct *arch_vmx = &v->arch.hvm_vmx;
+    struct vmx_vcpu *arch_vmx = &v->arch.hvm_vmx;
     int rc;
 
     if ( (arch_vmx->vmcs_pa = vmx_alloc_vmcs()) == 0 )
@@ -1765,7 +1765,7 @@ int vmx_create_vmcs(struct vcpu *v)
 
 void vmx_destroy_vmcs(struct vcpu *v)
 {
-    struct arch_vmx_struct *arch_vmx = &v->arch.hvm_vmx;
+    struct vmx_vcpu *arch_vmx = &v->arch.hvm_vmx;
 
     vmx_clear_vmcs(v);
 
xen/arch/x86/hvm/vmx/vmx.c +2 -2
index 4abd327..95dec46 100644
@@ -201,7 +201,7 @@ void vmx_pi_desc_fixup(unsigned int cpu)
 {
     unsigned int new_cpu, dest;
     unsigned long flags;
-    struct arch_vmx_struct *vmx, *tmp;
+    struct vmx_vcpu *vmx, *tmp;
     spinlock_t *new_lock, *old_lock = &per_cpu(vmx_pi_blocking, cpu).lock;
     struct list_head *blocked_vcpus = &per_cpu(vmx_pi_blocking, cpu).list;
 
@@ -2356,7 +2356,7 @@ static struct hvm_function_table __initdata vmx_function_table = {
 /* Handle VT-d posted-interrupt when VCPU is blocked. */
 static void pi_wakeup_interrupt(struct cpu_user_regs *regs)
 {
-    struct arch_vmx_struct *vmx, *tmp;
+    struct vmx_vcpu *vmx, *tmp;
     spinlock_t *lock = &per_cpu(vmx_pi_blocking, smp_processor_id()).lock;
     struct list_head *blocked_vcpus =
 		&per_cpu(vmx_pi_blocking, smp_processor_id()).list;
xen/include/asm-x86/hvm/vcpu.h +1 -1
index 54ea044..abf78e4 100644
@@ -176,7 +176,7 @@ struct hvm_vcpu {
     u64                 msr_xss;
 
     union {
-        struct arch_vmx_struct vmx;
+        struct vmx_vcpu vmx;
         struct arch_svm_struct svm;
     } u;
 
xen/include/asm-x86/hvm/vmx/vmcs.h +1 -1
index 46668a7..f964a95 100644
@@ -100,7 +100,7 @@ struct pi_blocking_vcpu {
     spinlock_t           *lock;
 };
 
-struct arch_vmx_struct {
+struct vmx_vcpu {
     /* Physical address of VMCS. */
     paddr_t              vmcs_pa;
     /* VMCS shadow machine address. */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#22 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

Quoted 2 lines · Andrew Cooper

The suffix and prefix are redundant, and the name is curiously odd. Rename it to vmx_vcpu to be consistent with all the other similar structures.

What other similar structures do you have in mind?

The code changes look okay to me.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#23 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

Quoted 4 lines · Wei Liu
Quoted 2 lines · Andrew Cooper

The suffix and prefix are redundant, and the name is curiously odd. Rename it to vmx_vcpu to be consistent with all the other similar structures.

What other similar structures do you have in mind?

Most relevantly, {vmx,svm}_domain, but {pv,hvm}_{domain,vcpu} as well.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by
#24 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

Quoted 7 lines · Andrew Cooper
Quoted 4 lines · Wei Liu
Quoted 2 lines · Andrew Cooper

The suffix and prefix are redundant, and the name is curiously odd. Rename it to vmx_vcpu to be consistent with all the other similar structures.

What other similar structures do you have in mind?

Most relevantly, {vmx,svm}_domain, but {pv,hvm}_{domain,vcpu} as well.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 5/7
#25 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

In reply to Andrew Cooper
Quoted 10 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Wednesday, August 29, 2018 1:39 AM

The suffix and prefix are redundant, and the name is curiously odd. Rename it
to vmx_vcpu to be consistent with all the other similar structures.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 5/7
#26 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

In reply to Andrew Cooper
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:

The suffix and prefix are redundant, and the name is curiously odd. Rename it to vmx_vcpu to be consistent with all the other similar structures.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

Quoted 3 lines

Some of the local pointers are named arch_vmx. I'm open to renaming them to just vmx (like all the other local pointers) if people are happy with the additional patch delta.

I'd be fine with that. With or without

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#27 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:

The suffix and prefix are redundant, and the name is curiously odd. Rename it to vmx_vcpu to be consistent with all the other similar structures.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

Quoted 5 lines
Quoted 3 lines

Some of the local pointers are named arch_vmx. I'm open to renaming them to just vmx (like all the other local pointers) if people are happy with the additional patch delta.

I'd be fine with that. With or without

TBH, I was hoping for a comment from Kevin on this question.

Given that the net diffstat including the pointer renames is:

andrewcoop@andrewcoop:/local/xen.git/xen$ git d HEAD^ --stat
 xen/arch/x86/hvm/vmx/vmcs.c        | 44
++++++++++++++++++++++----------------------
 xen/arch/x86/hvm/vmx/vmx.c         |  4 ++--
 xen/include/asm-x86/hvm/vcpu.h     |  2 +-
 xen/include/asm-x86/hvm/vmx/vmcs.h |  2 +-
 4 files changed, 26 insertions(+), 26 deletions(-)

I've decided to go ahead and do them, to improve the eventual code consistency.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#28 lore raw

Re: [PATCH 5/7] x86/vtx: Rename arch_vmx_struct to vmx_vcpu

Quoted 38 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, August 30, 2018 11:47 PM

Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:

The suffix and prefix are redundant, and the name is curiously odd.

Rename it

Quoted 12 lines
Quoted 12 lines

to vmx_vcpu to be consistent with all the other similar structures.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

Quoted 1 line
Quoted 1 line

Some of the local pointers are named arch_vmx. I'm open to renaming

them to

Quoted 4 lines
Quoted 2 lines

just vmx (like all the other local pointers) if people are happy with the additional patch delta.

I'd be fine with that. With or without

TBH, I was hoping for a comment from Kevin on this question.

Given that the net diffstat including the pointer renames is:

andrewcoop@andrewcoop:/local/xen.git/xen$ git d HEAD^ --stat
 xen/arch/x86/hvm/vmx/vmcs.c        | 44
++++++++++++++++++++++----------------------
 xen/arch/x86/hvm/vmx/vmx.c         |  4 ++--
 xen/include/asm-x86/hvm/vcpu.h     |  2 +-
 xen/include/asm-x86/hvm/vmx/vmcs.h |  2 +-
 4 files changed, 26 insertions(+), 26 deletions(-)
Quoted 2 lines

I've decided to go ahead and do them, to improve the eventual code consistency.

yes, please go ahead. I didn't note that open earlier.

Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#29 lore raw

PATCH 6/7 x86/svm: Rename arch_svm_struct to svm_vcpu

In reply to Andrew Cooper

The suffix and prefix are redundant, and the name is curiously odd. Rename it to svm_vcpu to be consistent with all the other similar structures.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>

All of the local pointers are named arch_svm. I'm open to renaming them to just svm if people are happy with the additional patch delta.

---
 xen/arch/x86/hvm/svm/nestedsvm.c   | 2 +-
 xen/arch/x86/hvm/svm/svm.c         | 4 ++--
 xen/arch/x86/hvm/svm/vmcb.c        | 6 +++---
 xen/include/asm-x86/hvm/svm/vmcb.h | 2 +-
 xen/include/asm-x86/hvm/vcpu.h     | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
xen/arch/x86/hvm/svm/nestedsvm.c +1 -1
index a1f840e..9d0fef1 100644
@@ -350,7 +350,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
 
 static int nsvm_vmrun_permissionmap(struct vcpu *v, bool_t viopm)
 {
-    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
     struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
xen/arch/x86/hvm/svm/svm.c +2 -2
index 92b29b1..e7e944d 100644
@@ -663,7 +663,7 @@ static void svm_update_guest_efer(struct vcpu *v)
 
 static void svm_cpuid_policy_changed(struct vcpu *v)
 {
-    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
     struct vmcb_struct *vmcb = arch_svm->vmcb;
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
     u32 bitmap = vmcb_get_exception_intercepts(vmcb);
@@ -683,7 +683,7 @@ static void svm_cpuid_policy_changed(struct vcpu *v)
 
 static void svm_sync_vmcb(struct vcpu *v, enum vmcb_sync_state new_state)
 {
-    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
 
     if ( new_state == vmcb_needs_vmsave )
     {
xen/arch/x86/hvm/svm/vmcb.c +3 -3
index 3776c53..a7630a0 100644
@@ -53,7 +53,7 @@ void free_vmcb(struct vmcb_struct *vmcb)
 /* This function can directly access fields which are covered by clean bits. */
 static int construct_vmcb(struct vcpu *v)
 {
-    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
     struct vmcb_struct *vmcb = arch_svm->vmcb;
 
     /* Build-time check of the size of VMCB AMD structure. */
@@ -225,7 +225,7 @@ static int construct_vmcb(struct vcpu *v)
 int svm_create_vmcb(struct vcpu *v)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
     int rc;
 
     if ( (nv->nv_n1vmcx == NULL) &&
@@ -252,7 +252,7 @@ int svm_create_vmcb(struct vcpu *v)
 void svm_destroy_vmcb(struct vcpu *v)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-    struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
 
     if ( nv->nv_n1vmcx != NULL )
         free_vmcb(nv->nv_n1vmcx);
xen/include/asm-x86/hvm/svm/vmcb.h +1 -1
index f7974da..3a514f8 100644
@@ -518,7 +518,7 @@ enum vmcb_sync_state {
     vmcb_needs_vmload     /* VMCB dirty (VMLOAD needed)? */
 };
 
-struct arch_svm_struct {
+struct svm_vcpu {
     struct vmcb_struct *vmcb;
     u64    vmcb_pa;
     unsigned long *msrpm;
xen/include/asm-x86/hvm/vcpu.h +1 -1
index abf78e4..c8d0a4e 100644
@@ -177,7 +177,7 @@ struct hvm_vcpu {
 
     union {
         struct vmx_vcpu vmx;
-        struct arch_svm_struct svm;
+        struct svm_vcpu svm;
     } u;
 
     struct tasklet      assert_evtchn_irq_tasklet;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 6/7
#30 lore raw

Re: [PATCH 6/7] x86/svm: Rename arch_svm_struct to svm_vcpu

Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:

The suffix and prefix are redundant, and the name is curiously odd. Rename it to svm_vcpu to be consistent with all the other similar structures.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>

Quoted 2 lines

All of the local pointers are named arch_svm. I'm open to renaming them to just svm if people are happy with the additional patch delta.

Same here - with or without

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#31 lore raw

PATCH 7/7 x86/hvm: Drop hvm_{vmx,svm} shorthands

In reply to Andrew Cooper

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>
CC: George Dunlap <[email protected]>

---
 xen/arch/x86/cpuid.c               |   2 +-
 xen/arch/x86/hvm/svm/asid.c        |   2 +-
 xen/arch/x86/hvm/svm/emulate.c     |   4 +-
 xen/arch/x86/hvm/svm/intr.c        |   8 +-
 xen/arch/x86/hvm/svm/nestedsvm.c   |  28 ++--
 xen/arch/x86/hvm/svm/svm.c         | 178 ++++++++++++------------
 xen/arch/x86/hvm/svm/vmcb.c        |   8 +-
 xen/arch/x86/hvm/vmx/intr.c        |  18 +--
 xen/arch/x86/hvm/vmx/realmode.c    |  18 +--
 xen/arch/x86/hvm/vmx/vmcs.c        | 154 ++++++++++-----------
 xen/arch/x86/hvm/vmx/vmx.c         | 272 ++++++++++++++++++-------------------
 xen/arch/x86/hvm/vmx/vvmx.c        |  64 ++++-----
 xen/arch/x86/mm/p2m-ept.c          |   6 +-
 xen/arch/x86/x86_64/asm-offsets.c  |  12 +-
 xen/drivers/passthrough/io.c       |   2 +-
 xen/include/asm-x86/domain.h       |   4 -
 xen/include/asm-x86/hvm/svm/asid.h |   2 +-
 xen/include/asm-x86/hvm/vcpu.h     |   2 +-
 xen/include/asm-x86/hvm/vmx/vmcs.h |   2 +-
 19 files changed, 390 insertions(+), 396 deletions(-)
xen/arch/x86/cpuid.c +1 -1
index 59d3298..d21e745 100644
@@ -1072,7 +1072,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
     case 0x8000001c:
         if ( (v->arch.xcr0 & X86_XCR0_LWP) && cpu_has_svm )
             /* Turn on available bit and other features specified in lwp_cfg. */
-            res->a = (res->d & v->arch.hvm_svm.guest_lwp_cfg) | 1;
+            res->a = (res->d & v->arch.hvm.svm.guest_lwp_cfg) | 1;
         break;
     }
 }
xen/arch/x86/hvm/svm/asid.c +1 -1
index 7cc54da..e554e25 100644
@@ -40,7 +40,7 @@ void svm_asid_init(const struct cpuinfo_x86 *c)
 void svm_asid_handle_vmrun(void)
 {
     struct vcpu *curr = current;
-    struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = curr->arch.hvm.svm.vmcb;
     struct hvm_vcpu_asid *p_asid =
         nestedhvm_vcpu_in_guestmode(curr)
         ? &vcpu_nestedhvm(curr).nv_n2asid : &curr->arch.hvm.n1asid;
xen/arch/x86/hvm/svm/emulate.c +2 -2
index 535674e..3d04af0 100644
@@ -28,7 +28,7 @@
 
 static unsigned long svm_nextrip_insn_length(struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
 
     if ( !cpu_has_svm_nrips )
         return 0;
@@ -86,7 +86,7 @@ static const struct {
 int __get_instruction_length_from_list(struct vcpu *v,
         const enum instruction_index *list, unsigned int list_count)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     struct hvm_emulate_ctxt ctxt;
     struct x86_emulate_state *state;
     unsigned long inst_len, j;
xen/arch/x86/hvm/svm/intr.c +4 -4
index 8511ff0..a17ec8c 100644
@@ -40,7 +40,7 @@
 
 static void svm_inject_nmi(struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
     eventinj_t event;
 
@@ -62,7 +62,7 @@ static void svm_inject_nmi(struct vcpu *v)
 
 static void svm_inject_extint(struct vcpu *v, int vector)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     eventinj_t event;
 
     event.bytes = 0;
@@ -76,7 +76,7 @@ static void svm_inject_extint(struct vcpu *v, int vector)
 
 static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     uint32_t general1_intercepts = vmcb_get_general1_intercepts(vmcb);
     vintr_t intr;
 
@@ -133,7 +133,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
 void svm_intr_assist(void) 
 {
     struct vcpu *v = current;
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     struct hvm_intack intack;
     enum hvm_intblk intblk;
 
xen/arch/x86/hvm/svm/nestedsvm.c +13 -15
index 9d0fef1..3f4f403 100644
@@ -137,7 +137,7 @@ void nsvm_vcpu_destroy(struct vcpu *v)
      * of l1 vmcb page.
      */
     if (nv->nv_n1vmcx)
-        v->arch.hvm_svm.vmcb = nv->nv_n1vmcx;
+        v->arch.hvm.svm.vmcb = nv->nv_n1vmcx;
 
     if (svm->ns_cached_msrpm) {
         free_xenheap_pages(svm->ns_cached_msrpm,
@@ -272,8 +272,8 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
      */
 
     /* switch vmcb to l1 guest's vmcb */
-    v->arch.hvm_svm.vmcb = n1vmcb;
-    v->arch.hvm_svm.vmcb_pa = nv->nv_n1vmcx_pa;
+    v->arch.hvm.svm.vmcb = n1vmcb;
+    v->arch.hvm.svm.vmcb_pa = nv->nv_n1vmcx_pa;
 
     /* EFER */
     v->arch.hvm.guest_efer = n1vmcb->_efer;
@@ -350,7 +350,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
 
 static int nsvm_vmrun_permissionmap(struct vcpu *v, bool_t viopm)
 {
-    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm.svm;
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
     struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
@@ -390,9 +390,7 @@ static int nsvm_vmrun_permissionmap(struct vcpu *v, bool_t viopm)
     nv->nv_ioport80 = ioport_80;
     nv->nv_ioportED = ioport_ed;
 
-    /* v->arch.hvm_svm.msrpm has type unsigned long, thus
-     * BYTES_PER_LONG.
-     */
+    /* v->arch.hvm.svm.msrpm has type unsigned long, thus BYTES_PER_LONG. */
     for (i = 0; i < MSRPM_SIZE / BYTES_PER_LONG; i++)
         svm->ns_merged_msrpm[i] = arch_svm->msrpm[i] | ns_msrpm_ptr[i];
 
@@ -730,8 +728,8 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct cpu_user_regs *regs,
     }
 
     /* switch vmcb to shadow vmcb */
-    v->arch.hvm_svm.vmcb = nv->nv_n2vmcx;
-    v->arch.hvm_svm.vmcb_pa = nv->nv_n2vmcx_pa;
+    v->arch.hvm.svm.vmcb = nv->nv_n2vmcx;
+    v->arch.hvm.svm.vmcb_pa = nv->nv_n2vmcx_pa;
 
     ret = nsvm_vmcb_prepare4vmrun(v, regs);
     if (ret) {
@@ -800,7 +798,7 @@ nsvm_vcpu_vmexit_inject(struct vcpu *v, struct cpu_user_regs *regs,
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
     struct vmcb_struct *ns_vmcb;
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
 
     if ( vmcb->_vintr.fields.vgif_enable )
         ASSERT(vmcb->_vintr.fields.vgif == 0);
@@ -1348,7 +1346,7 @@ nestedsvm_vmexit_defer(struct vcpu *v,
     uint64_t exitcode, uint64_t exitinfo1, uint64_t exitinfo2)
 {
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
 
     if ( vmcb->_vintr.fields.vgif_enable )
         vmcb->_vintr.fields.vgif = 0;
@@ -1522,7 +1520,7 @@ void nsvm_vcpu_switch(struct cpu_user_regs *regs)
 
     nv = &vcpu_nestedhvm(v);
     svm = &vcpu_nestedsvm(v);
-    ASSERT(v->arch.hvm_svm.vmcb != NULL);
+    ASSERT(v->arch.hvm.svm.vmcb != NULL);
     ASSERT(nv->nv_n1vmcx != NULL);
     ASSERT(nv->nv_n2vmcx != NULL);
     ASSERT(nv->nv_n1vmcx_pa != INVALID_PADDR);
@@ -1607,7 +1605,7 @@ bool_t
 nestedsvm_gif_isset(struct vcpu *v)
 {
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
 
     /* get the vmcb gif value if using vgif */
     if ( vmcb->_vintr.fields.vgif_enable )
@@ -1640,7 +1638,7 @@ void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v)
 
 void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     unsigned int inst_len;
     uint32_t general1_intercepts = vmcb_get_general1_intercepts(vmcb);
     vintr_t intr;
@@ -1672,7 +1670,7 @@ void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v)
  */
 void svm_nested_features_on_efer_update(struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
     struct nestedsvm *svm = &vcpu_nestedsvm(v);
     u32 general2_intercepts;
     vintr_t vintr;
xen/arch/x86/hvm/svm/svm.c +89 -89

593 lines not on this page · raw message

xen/arch/x86/hvm/svm/vmcb.c +4 -4
index a7630a0..4558f57 100644
@@ -53,7 +53,7 @@ void free_vmcb(struct vmcb_struct *vmcb)
 /* This function can directly access fields which are covered by clean bits. */
 static int construct_vmcb(struct vcpu *v)
 {
-    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm.svm;
     struct vmcb_struct *vmcb = arch_svm->vmcb;
 
     /* Build-time check of the size of VMCB AMD structure. */
@@ -225,7 +225,7 @@ static int construct_vmcb(struct vcpu *v)
 int svm_create_vmcb(struct vcpu *v)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm.svm;
     int rc;
 
     if ( (nv->nv_n1vmcx == NULL) &&
@@ -252,7 +252,7 @@ int svm_create_vmcb(struct vcpu *v)
 void svm_destroy_vmcb(struct vcpu *v)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-    struct svm_vcpu *arch_svm = &v->arch.hvm_svm;
+    struct svm_vcpu *arch_svm = &v->arch.hvm.svm;
 
     if ( nv->nv_n1vmcx != NULL )
         free_vmcb(nv->nv_n1vmcx);
@@ -286,7 +286,7 @@ static void vmcb_dump(unsigned char ch)
         for_each_vcpu ( d, v )
         {
             printk("\tVCPU %d\n", v->vcpu_id);
-            svm_vmcb_dump("key_handler", v->arch.hvm_svm.vmcb);
+            svm_vmcb_dump("key_handler", v->arch.hvm.svm.vmcb);
         }
     }
 
xen/arch/x86/hvm/vmx/intr.c +9 -9
index 889067c..5e8cbd4 100644
@@ -106,9 +106,9 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
         ctl = CPU_BASED_VIRTUAL_NMI_PENDING;
     }
 
-    if ( !(v->arch.hvm_vmx.exec_control & ctl) )
+    if ( !(v->arch.hvm.vmx.exec_control & ctl) )
     {
-        v->arch.hvm_vmx.exec_control |= ctl;
+        v->arch.hvm.vmx.exec_control |= ctl;
         vmx_update_cpu_exec_control(v);
     }
 }
@@ -137,7 +137,7 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
  *  Unfortunately, interrupt blocking in L2 won't work with simple
  *  intr_window_open (which depends on L2's IF). To solve this,
  *  the following algorithm can be used:
- *   v->arch.hvm_vmx.exec_control.VIRTUAL_INTR_PENDING now denotes
+ *   v->arch.hvm.vmx.exec_control.VIRTUAL_INTR_PENDING now denotes
  *   only L0 control, physical control may be different from it.
  *       - if in L1, it behaves normally, intr window is written
  *         to physical control as it is
@@ -234,7 +234,7 @@ void vmx_intr_assist(void)
     /* Block event injection when single step with MTF. */
     if ( unlikely(v->arch.hvm.single_step) )
     {
-        v->arch.hvm_vmx.exec_control |= CPU_BASED_MONITOR_TRAP_FLAG;
+        v->arch.hvm.vmx.exec_control |= CPU_BASED_MONITOR_TRAP_FLAG;
         vmx_update_cpu_exec_control(v);
         return;
     }
@@ -352,7 +352,7 @@ void vmx_intr_assist(void)
                     printk("\n");
                 }
 
-                pi_desc = &v->arch.hvm_vmx.pi_desc;
+                pi_desc = &v->arch.hvm.vmx.pi_desc;
                 if ( pi_desc )
                 {
                     word = (const void *)&pi_desc->pir;
@@ -374,12 +374,12 @@ void vmx_intr_assist(void)
                     intack.vector;
         __vmwrite(GUEST_INTR_STATUS, status);
 
-        n = ARRAY_SIZE(v->arch.hvm_vmx.eoi_exit_bitmap);
-        while ( (i = find_first_bit(&v->arch.hvm_vmx.eoi_exitmap_changed,
+        n = ARRAY_SIZE(v->arch.hvm.vmx.eoi_exit_bitmap);
+        while ( (i = find_first_bit(&v->arch.hvm.vmx.eoi_exitmap_changed,
                                     n)) < n )
         {
-            clear_bit(i, &v->arch.hvm_vmx.eoi_exitmap_changed);
-            __vmwrite(EOI_EXIT_BITMAP(i), v->arch.hvm_vmx.eoi_exit_bitmap[i]);
+            clear_bit(i, &v->arch.hvm.vmx.eoi_exitmap_changed);
+            __vmwrite(EOI_EXIT_BITMAP(i), v->arch.hvm.vmx.eoi_exit_bitmap[i]);
         }
 
         pt_intr_post(v, intack);
xen/arch/x86/hvm/vmx/realmode.c +9 -9
index 032a681..bb0b443 100644
@@ -175,8 +175,8 @@ void vmx_realmode(struct cpu_user_regs *regs)
         intr_info = 0;
     }
 
-    curr->arch.hvm_vmx.vmx_emulate = 1;
-    while ( curr->arch.hvm_vmx.vmx_emulate &&
+    curr->arch.hvm.vmx.vmx_emulate = 1;
+    while ( curr->arch.hvm.vmx.vmx_emulate &&
             !softirq_pending(smp_processor_id()) )
     {
         /*
@@ -185,7 +185,7 @@ void vmx_realmode(struct cpu_user_regs *regs)
          * in real mode, because we don't emulate protected-mode IDT vectoring.
          */
         if ( unlikely(!(++emulations & 15)) &&
-             curr->arch.hvm_vmx.vmx_realmode && 
+             curr->arch.hvm.vmx.vmx_realmode &&
              hvm_local_events_need_delivery(curr) )
             break;
 
@@ -195,20 +195,20 @@ void vmx_realmode(struct cpu_user_regs *regs)
             break;
 
         /* Stop emulating unless our segment state is not safe */
-        if ( curr->arch.hvm_vmx.vmx_realmode )
-            curr->arch.hvm_vmx.vmx_emulate = 
-                (curr->arch.hvm_vmx.vm86_segment_mask != 0);
+        if ( curr->arch.hvm.vmx.vmx_realmode )
+            curr->arch.hvm.vmx.vmx_emulate =
+                (curr->arch.hvm.vmx.vm86_segment_mask != 0);
         else
-            curr->arch.hvm_vmx.vmx_emulate = 
+            curr->arch.hvm.vmx.vmx_emulate =
                  ((hvmemul_ctxt.seg_reg[x86_seg_cs].sel & 3)
                   || (hvmemul_ctxt.seg_reg[x86_seg_ss].sel & 3));
     }
 
     /* Need to emulate next time if we've started an IO operation */
     if ( vio->io_req.state != STATE_IOREQ_NONE )
-        curr->arch.hvm_vmx.vmx_emulate = 1;
+        curr->arch.hvm.vmx.vmx_emulate = 1;
 
-    if ( !curr->arch.hvm_vmx.vmx_emulate && !curr->arch.hvm_vmx.vmx_realmode )
+    if ( !curr->arch.hvm.vmx.vmx_emulate && !curr->arch.hvm.vmx.vmx_realmode )
     {
         /*
          * Cannot enter protected mode with bogus selector RPLs and DPLs.
xen/arch/x86/hvm/vmx/vmcs.c +77 -77

476 lines not on this page · raw message

xen/arch/x86/hvm/vmx/vmx.c +136 -136

784 lines not on this page · raw message

xen/arch/x86/hvm/vmx/vvmx.c +32 -32

190 lines not on this page · raw message

xen/arch/x86/mm/p2m-ept.c +3 -3
index 14b5939..1ff4f14 100644
@@ -643,7 +643,7 @@ static int resolve_misconfig(struct p2m_domain *p2m, unsigned long gfn)
         struct vcpu *v;
 
         for_each_vcpu ( p2m->domain, v )
-            v->arch.hvm_vmx.ept_spurious_misconfig = 1;
+            v->arch.hvm.vmx.ept_spurious_misconfig = 1;
     }
 
     return rc;
@@ -658,9 +658,9 @@ bool_t ept_handle_misconfig(uint64_t gpa)
 
     p2m_lock(p2m);
 
-    spurious = curr->arch.hvm_vmx.ept_spurious_misconfig;
+    spurious = curr->arch.hvm.vmx.ept_spurious_misconfig;
     rc = resolve_misconfig(p2m, PFN_DOWN(gpa));
-    curr->arch.hvm_vmx.ept_spurious_misconfig = 0;
+    curr->arch.hvm.vmx.ept_spurious_misconfig = 0;
 
     p2m_unlock(p2m);
 
xen/arch/x86/x86_64/asm-offsets.c +6 -6
index 555804c..0a214e1 100644
@@ -87,14 +87,14 @@ void __dummy__(void)
     DEFINE(_VGCF_syscall_disables_events,  _VGCF_syscall_disables_events);
     BLANK();
 
-    OFFSET(VCPU_svm_vmcb_pa, struct vcpu, arch.hvm_svm.vmcb_pa);
-    OFFSET(VCPU_svm_vmcb, struct vcpu, arch.hvm_svm.vmcb);
+    OFFSET(VCPU_svm_vmcb_pa, struct vcpu, arch.hvm.svm.vmcb_pa);
+    OFFSET(VCPU_svm_vmcb, struct vcpu, arch.hvm.svm.vmcb);
     BLANK();
 
-    OFFSET(VCPU_vmx_launched, struct vcpu, arch.hvm_vmx.launched);
-    OFFSET(VCPU_vmx_realmode, struct vcpu, arch.hvm_vmx.vmx_realmode);
-    OFFSET(VCPU_vmx_emulate, struct vcpu, arch.hvm_vmx.vmx_emulate);
-    OFFSET(VCPU_vm86_seg_mask, struct vcpu, arch.hvm_vmx.vm86_segment_mask);
+    OFFSET(VCPU_vmx_launched, struct vcpu, arch.hvm.vmx.launched);
+    OFFSET(VCPU_vmx_realmode, struct vcpu, arch.hvm.vmx.vmx_realmode);
+    OFFSET(VCPU_vmx_emulate, struct vcpu, arch.hvm.vmx.vmx_emulate);
+    OFFSET(VCPU_vm86_seg_mask, struct vcpu, arch.hvm.vmx.vm86_segment_mask);
     OFFSET(VCPU_hvm_guest_cr2, struct vcpu, arch.hvm.guest_cr[2]);
     BLANK();
 
xen/drivers/passthrough/io.c +1 -1
index bab3aa3..a5668e6 100644
@@ -439,7 +439,7 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            pi_update_irte(vcpu ? &vcpu->arch.hvm_vmx.pi_desc : NULL,
+            pi_update_irte(vcpu ? &vcpu->arch.hvm.vmx.pi_desc : NULL,
                            info, pirq_dpci->gmsi.gvec);
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
xen/include/asm-x86/domain.h +0 -4
index 0ea3742..c216f37 100644
@@ -604,10 +604,6 @@ struct guest_memory_policy
 void update_guest_memory_policy(struct vcpu *v,
                                 struct guest_memory_policy *policy);
 
-/* Shorthands to improve code legibility. */
-#define hvm_vmx         hvm.u.vmx
-#define hvm_svm         hvm.u.svm
-
 bool update_runstate_area(struct vcpu *);
 bool update_secondary_system_time(struct vcpu *,
                                   struct vcpu_time_info *);
xen/include/asm-x86/hvm/svm/asid.h +1 -1
index d3a144c..60cbb7b 100644
@@ -29,7 +29,7 @@ static inline void svm_asid_g_invlpg(struct vcpu *v, unsigned long g_vaddr)
 {
 #if 0
     /* Optimization? */
-    svm_invlpga(g_vaddr, v->arch.hvm_svm.vmcb->guest_asid);
+    svm_invlpga(g_vaddr, v->arch.hvm.svm.vmcb->guest_asid);
 #endif
 
     /* Safe fallback. Take a new ASID. */
xen/include/asm-x86/hvm/vcpu.h +1 -1
index c8d0a4e..c663155 100644
@@ -178,7 +178,7 @@ struct hvm_vcpu {
     union {
         struct vmx_vcpu vmx;
         struct svm_vcpu svm;
-    } u;
+    };
 
     struct tasklet      assert_evtchn_irq_tasklet;
 
xen/include/asm-x86/hvm/vmx/vmcs.h +1 -1
index f964a95..76dd04a 100644
@@ -311,7 +311,7 @@ extern u64 vmx_ept_vpid_cap;
 #define cpu_has_vmx_unrestricted_guest \
     (vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define vmx_unrestricted_guest(v)               \
-    ((v)->arch.hvm_vmx.secondary_exec_control & \
+    ((v)->arch.hvm.vmx.secondary_exec_control & \
      SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define cpu_has_vmx_ple \
     (vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 7/7
#32 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

Quoted 10 lines · Andrew Cooper

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 7/7
#33 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

In reply to Andrew Cooper
Quoted 10 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Wednesday, August 29, 2018 1:39 AM

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with
domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code
refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Quoted 6 lines

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

one small note. In coverletter:

" This series started by trying to address the bug in patch 7,
and ballooned somewhat."

there is no bug per se in this patch, right?

Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#34 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

Quoted 16 lines · Kevin
Quoted 10 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Wednesday, August 29, 2018 1:39 AM

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with
domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code
refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Quoted 6 lines

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

Quoted 8 lines

one small note. In coverletter:

" This series started by trying to address the bug in patch 7,
and ballooned somewhat."

there is no bug per se in this patch, right?

I should probably have said issue rather than bug.  I was referring to the obscuring of data from grep/cscope/tags/etc.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 7/7
#35 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

In reply to Andrew Cooper
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 28.08.18 at 19:39, <[email protected]> wrote:

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 7/7
#36 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

Do we still support pre-4.6 gcc? They have a bug that doesn't allow initializers for anonymous structs/unions. I don't know whether we have any for vmx/svm, but I thought I'd mention this just in case.

Other than that, for SVM bits in patches 3,4,6 and 7

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#37 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

Quoted 6 lines · Boris Ostrovsky
Quoted 5 lines · Andrew Cooper

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Quoted 7 lines
Quoted 6 lines

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

Do we still support pre-4.6 gcc?

Or 4.4.6? I don't remember.

-boris

Quoted 7 lines

They have a bug that doesn't allow
initializers for anonymous structs/unions. I don't know whether we have any for vmx/svm, but I thought I'd mention this just in case.

Other than that, for SVM bits in patches 3,4,6 and 7

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#38 lore raw

Re: [PATCH 7/7] x86/hvm: Drop hvm_{vmx,svm} shorthands

Quoted 7 lines · Boris Ostrovsky
Quoted 6 lines · Boris Ostrovsky
Quoted 5 lines · Andrew Cooper

By making {vmx,svm} in hvm_vcpu into an anonymous union (consistent with domain side of things), the hvm_{vmx,svm} defines can be dropped, and all code refer to the correctly-named fields. This means that the data hierachy is no longer obscured from grep/cscope/tags/etc.

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

Reformat one comment and switch one bool_t to bool while making changes.

No functional change.

Do we still support pre-4.6 gcc?

Or 4.4.6? I don't remember.

I'm aware of that bug and it is 4.6 iirc.

However, in this case there are no initialisers.  The memory starts off as a zeroed heap page and has a plethora of init() functions call on it to set things up.

Quoted 11 lines

-boris

Quoted 7 lines

They have a bug that doesn't allow
initializers for anonymous structs/unions. I don't know whether we have any for vmx/svm, but I thought I'd mention this just in case.

Other than that, for SVM bits in patches 3,4,6 and 7

Thanks.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel