From: "Jan Beulich" Subject: [PATCH 2/3] x86: drop is_pv_32on64_domain() Date: Tue, 23 Jun 2015 16:19:36 +0100 Message-ID: <5589952802000078000886DF@mail.emea.novell.com> References: <558993E902000078000886B3@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartD5E10418.2__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z7PzB-0002zI-86 for xen-devel@lists.xenproject.org; Tue, 23 Jun 2015 15:19:41 +0000 In-Reply-To: <558993E902000078000886B3@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Ian Campbell List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartD5E10418.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... as being identical to is_pv_32bit_domain() after the x86-32 removal. In a few cases this includes no longer open-coding is_pv_32bit_vcpu(). Signed-off-by: Jan Beulich --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -367,7 +367,7 @@ int switch_native(struct domain *d) =20 if ( !may_switch_mode(d) ) return -EACCES; - if ( !is_pv_32on64_domain(d) ) + if ( !is_pv_32bit_domain(d) ) return 0; =20 d->arch.is_32bit_pv =3D d->arch.has_32bit_shinfo =3D 0; @@ -392,7 +392,7 @@ int switch_compat(struct domain *d) =20 if ( !may_switch_mode(d) ) return -EACCES; - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) return 0; =20 d->arch.is_32bit_pv =3D d->arch.has_32bit_shinfo =3D 1; @@ -481,7 +481,7 @@ int vcpu_initialise(struct vcpu *v) =20 v->arch.pv_vcpu.ctrlreg[4] =3D real_cr4_to_pv_guest_cr4(mmu_cr4_featur= es); =20 - rc =3D is_pv_32on64_domain(d) ? setup_compat_l4(v) : 0; + rc =3D is_pv_32bit_domain(d) ? setup_compat_l4(v) : 0; done: if ( rc ) { @@ -689,7 +689,7 @@ unsigned long pv_guest_cr4_fixup(const s hv_cr4_mask =3D ~X86_CR4_TSD; if ( cpu_has_de ) hv_cr4_mask &=3D ~X86_CR4_DE; - if ( cpu_has_fsgsbase && !is_pv_32bit_domain(v->domain) ) + if ( cpu_has_fsgsbase && !is_pv_32bit_vcpu(v) ) hv_cr4_mask &=3D ~X86_CR4_FSGSBASE; if ( cpu_has_xsave ) hv_cr4_mask &=3D ~X86_CR4_OSXSAVE; @@ -721,7 +721,7 @@ int arch_set_info_guest( =20 /* The context is a compat-mode one if the target domain is compat-mod= e; * we expect the tools to DTRT even in compat-mode callers. */ - compat =3D is_pv_32on64_domain(d); + compat =3D is_pv_32bit_domain(d); =20 #define c(fld) (compat ? (c.cmp->fld) : (c.nat->fld)) flags =3D c(flags); @@ -1195,7 +1195,7 @@ static void load_segments(struct vcpu *n all_segs_okay &=3D loadsegment(gs, uregs->gs); } =20 - if ( !is_pv_32on64_domain(n->domain) ) + if ( !is_pv_32bit_vcpu(n) ) { /* This can only be non-zero if selector is NULL. */ if ( n->arch.pv_vcpu.fs_base ) @@ -1224,7 +1224,7 @@ static void load_segments(struct vcpu *n (unsigned long *)pv->kernel_sp; unsigned long cs_and_mask, rflags; =20 - if ( is_pv_32on64_domain(n->domain) ) + if ( is_pv_32bit_vcpu(n) ) { unsigned int *esp =3D ring_1(regs) ? (unsigned int *)regs->rsp : @@ -1340,7 +1340,7 @@ static void save_segments(struct vcpu *v if ( regs->es ) dirty_segment_mask |=3D DIRTY_ES; =20 - if ( regs->fs || is_pv_32on64_domain(v->domain) ) + if ( regs->fs || is_pv_32bit_vcpu(v) ) { dirty_segment_mask |=3D DIRTY_FS; v->arch.pv_vcpu.fs_base =3D 0; /* !=3D 0 selector kills fs_base = */ @@ -1350,7 +1350,7 @@ static void save_segments(struct vcpu *v dirty_segment_mask |=3D DIRTY_FS_BASE; } =20 - if ( regs->gs || is_pv_32on64_domain(v->domain) ) + if ( regs->gs || is_pv_32bit_vcpu(v) ) { dirty_segment_mask |=3D DIRTY_GS; v->arch.pv_vcpu.gs_base_user =3D 0; /* !=3D 0 selector kills = gs_base_user */ @@ -1483,8 +1483,8 @@ static void __context_switch(void) =20 psr_ctxt_switch_to(nd); =20 - gdt =3D !is_pv_32on64_domain(nd) ? per_cpu(gdt_table, cpu) : - per_cpu(compat_gdt_table, cpu); + gdt =3D !is_pv_32bit_domain(nd) ? per_cpu(gdt_table, cpu) : + per_cpu(compat_gdt_table, cpu); if ( need_full_gdt(nd) ) { unsigned long mfn =3D virt_to_mfn(gdt); @@ -1568,7 +1568,7 @@ void context_switch(struct vcpu *prev, s if ( is_pv_domain(nextd) && (is_idle_domain(prevd) || has_hvm_container_domain(prevd) || - is_pv_32on64_domain(prevd) !=3D is_pv_32on64_domain(nextd)) = ) + is_pv_32bit_domain(prevd) !=3D is_pv_32bit_domain(nextd)) ) { uint64_t efer =3D read_efer(); if ( !(efer & EFER_SCE) ) --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -293,7 +293,7 @@ static unsigned long __init compute_dom0 avail -=3D (d->max_vcpus - 1UL) << get_order_from_bytes(sizeof(struct vcpu)); /* ...and compat_l4's, if needed. */ - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) avail -=3D d->max_vcpus - 1; =20 /* Reserve memory for iommu_dom0_init() (rough estimate). */ @@ -608,7 +608,7 @@ static __init void dom0_update_physmap(s BUG_ON(rc); return; } - if ( !is_pv_32on64_domain(d) ) + if ( !is_pv_32bit_domain(d) ) ((unsigned long *)vphysmap_s)[pfn] =3D mfn; else ((unsigned int *)vphysmap_s)[pfn] =3D mfn; @@ -718,7 +718,7 @@ static __init void mark_pv_pt_pages_rdon =20 /* Top-level p.t. is pinned. */ if ( (page->u.inuse.type_info & PGT_type_mask) =3D=3D - (!is_pv_32on64_domain(d) ? + (!is_pv_32bit_domain(d) ? PGT_l4_page_table : PGT_l3_page_table) ) { page->count_info +=3D 1; @@ -1048,7 +1048,7 @@ int __init construct_dom0( vinitrd_end =3D vinitrd_start + initrd_len; vphysmap_start =3D round_pgup(vinitrd_end); } - vphysmap_end =3D vphysmap_start + (nr_pages * (!is_pv_32on64_domai= n(d) ? + vphysmap_end =3D vphysmap_start + (nr_pages * (!is_pv_32bit_domain= (d) ? sizeof(unsigned = long) : sizeof(unsigned = int))); if ( parms.p2m_base !=3D UNSET_ADDR ) @@ -1076,9 +1076,9 @@ int __init construct_dom0( #define NR(_l,_h,_s) \ (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \ ((_l) & ~((1UL<<(_s))-1))) >> (_s)) - if ( (!is_pv_32on64_domain(d) + /* # L4 */ + if ( (!is_pv_32bit_domain(d) + /* # L4 */ NR(v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */ - (!is_pv_32on64_domain(d) ? + (!is_pv_32bit_domain(d) ? NR(v_start, v_end, L3_PAGETABLE_SHIFT) : /* # L2 */ 4) + /* # compat L2 */ NR(v_start, v_end, L2_PAGETABLE_SHIFT)) /* # L1 */ @@ -1176,7 +1176,7 @@ int __init construct_dom0( mpt_alloc -=3D PAGE_ALIGN(initrd_len); =20 /* Overlap with Xen protected area? */ - if ( !is_pv_32on64_domain(d) ? + if ( !is_pv_32bit_domain(d) ? ((v_start < HYPERVISOR_VIRT_END) && (v_end > HYPERVISOR_VIRT_START)) : (v_end > HYPERVISOR_COMPAT_VIRT_START(d)) ) @@ -1186,14 +1186,14 @@ int __init construct_dom0( goto out; } =20 - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) { v->arch.pv_vcpu.failsafe_callback_cs =3D FLAT_COMPAT_KERNEL_CS; v->arch.pv_vcpu.event_callback_cs =3D FLAT_COMPAT_KERNEL_CS; } =20 /* WARNING: The new domain must have its 'processor' field filled in! = */ - if ( !is_pv_32on64_domain(d) ) + if ( !is_pv_32bit_domain(d) ) { maddr_to_page(mpt_alloc)->u.inuse.type_info =3D PGT_l4_page_table;= l4start =3D l4tab =3D __va(mpt_alloc); mpt_alloc +=3D PAGE_SIZE; @@ -1211,7 +1211,7 @@ int __init construct_dom0( clear_page(l4tab); init_guest_l4_table(l4tab, d, 0); v->arch.guest_table =3D pagetable_from_paddr(__pa(l4start)); - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) v->arch.guest_table_user =3D v->arch.guest_table; =20 l4tab +=3D l4_table_offset(v_start); @@ -1257,7 +1257,7 @@ int __init construct_dom0( mfn =3D pfn++; else mfn =3D initrd_mfn++; - *l1tab =3D l1e_from_pfn(mfn, (!is_pv_32on64_domain(d) ? + *l1tab =3D l1e_from_pfn(mfn, (!is_pv_32bit_domain(d) ? L1_PROT : COMPAT_L1_PROT)); l1tab++; =20 @@ -1270,7 +1270,7 @@ int __init construct_dom0( } } =20 - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) { /* Ensure the first four L3 entries are all populated. */ for ( i =3D 0, l3tab =3D l3start; i < 4; ++i, ++l3tab ) @@ -1477,7 +1477,7 @@ int __init construct_dom0( if ( is_pvh_domain(d) ) si->shared_info =3D shared_info_paddr; =20 - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) xlat_start_info(si, XLAT_start_info_console_dom0); =20 /* Return to idle domain's page tables. */ @@ -1499,10 +1499,10 @@ int __init construct_dom0( */ regs =3D &v->arch.user_regs; regs->ds =3D regs->es =3D regs->fs =3D regs->gs =3D - !is_pv_32on64_domain(d) ? FLAT_KERNEL_DS : FLAT_COMPAT_KERNEL_DS; - regs->ss =3D (!is_pv_32on64_domain(d) ? + !is_pv_32bit_domain(d) ? FLAT_KERNEL_DS : FLAT_COMPAT_KERNEL_DS; + regs->ss =3D (!is_pv_32bit_domain(d) ? FLAT_KERNEL_SS : FLAT_COMPAT_KERNEL_SS); - regs->cs =3D (!is_pv_32on64_domain(d) ? + regs->cs =3D (!is_pv_32bit_domain(d) ? FLAT_KERNEL_CS : FLAT_COMPAT_KERNEL_CS); regs->eip =3D parms.virt_entry; regs->esp =3D vstack_end; --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -349,7 +349,7 @@ long arch_do_domctl( =20 case XEN_DOMCTL_get_address_size: domctl->u.address_size.size =3D - is_pv_32on64_domain(d) ? 32 : BITS_PER_LONG; + is_pv_32bit_domain(d) ? 32 : BITS_PER_LONG; copyback =3D 1; break; =20 @@ -1183,7 +1183,7 @@ void arch_get_info_guest(struct vcpu *v, { unsigned int i; const struct domain *d =3D v->domain; - bool_t compat =3D is_pv_32on64_domain(d); + bool_t compat =3D is_pv_32bit_domain(d); #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld)) =20 if ( !is_pv_domain(d) ) --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -163,9 +163,8 @@ static uint32_t base_disallow_mask; #define L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLO= BAL) #define L2_DISALLOW_MASK (base_disallow_mask & ~_PAGE_PSE) =20 -#define l3_disallow_mask(d) (!is_pv_32on64_domain(d) ? \ - base_disallow_mask : \ - 0xFFFFF198U) +#define l3_disallow_mask(d) (!is_pv_32bit_domain(d) ? \ + base_disallow_mask : 0xFFFFF198U) =20 #define L4_DISALLOW_MASK (base_disallow_mask) =20 @@ -985,7 +984,7 @@ get_page_from_l4e( #define adjust_guest_l1e(pl1e, d) = \ do { = \ if ( likely(l1e_get_flags((pl1e)) & _PAGE_PRESENT) && = \ - likely(!is_pv_32on64_domain(d)) ) = \ + likely(!is_pv_32bit_domain(d)) ) = \ { = \ /* _PAGE_GUEST_KERNEL page cannot have the Global bit set. */ = \ if ( (l1e_get_flags((pl1e)) & (_PAGE_GUEST_KERNEL|_PAGE_GLOBAL= )) \ @@ -1002,14 +1001,14 @@ get_page_from_l4e( #define adjust_guest_l2e(pl2e, d) \ do { \ if ( likely(l2e_get_flags((pl2e)) & _PAGE_PRESENT) && \ - likely(!is_pv_32on64_domain(d)) ) \ + likely(!is_pv_32bit_domain(d)) ) \ l2e_add_flags((pl2e), _PAGE_USER); \ } while ( 0 ) =20 #define adjust_guest_l3e(pl3e, d) \ do { \ if ( likely(l3e_get_flags((pl3e)) & _PAGE_PRESENT) ) \ - l3e_add_flags((pl3e), likely(!is_pv_32on64_domain(d)) ? \ + l3e_add_flags((pl3e), likely(!is_pv_32bit_domain(d)) ? \ _PAGE_USER : \ _PAGE_USER|_PAGE_RW); \ } while ( 0 ) @@ -1017,13 +1016,13 @@ get_page_from_l4e( #define adjust_guest_l4e(pl4e, d) \ do { \ if ( likely(l4e_get_flags((pl4e)) & _PAGE_PRESENT) && \ - likely(!is_pv_32on64_domain(d)) ) \ + likely(!is_pv_32bit_domain(d)) ) \ l4e_add_flags((pl4e), _PAGE_USER); \ } while ( 0 ) =20 #define unadjust_guest_l3e(pl3e, d) = \ do { = \ - if ( unlikely(is_pv_32on64_domain(d)) && = \ + if ( unlikely(is_pv_32bit_domain(d)) && = \ likely(l3e_get_flags((pl3e)) & _PAGE_PRESENT) ) = \ l3e_remove_flags((pl3e), _PAGE_USER|_PAGE_RW|_PAGE_ACCESSED); = \ } while ( 0 ) @@ -1314,7 +1313,7 @@ static int alloc_l3_table(struct page_in * 512 entries must be valid/verified, which is most easily achieved * by clearing them out. */ - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) memset(pl3e + 4, 0, (L3_PAGETABLE_ENTRIES - 4) * sizeof(*pl3e)); =20 for ( i =3D page->nr_validated_ptes; i < L3_PAGETABLE_ENTRIES; @@ -1391,7 +1390,7 @@ void init_guest_l4_table(l4_pgentry_t l4 l4e_from_pfn(domain_page_map_to_mfn(l4tab), __PAGE_HYPERVISOR); l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =3D l4e_from_page(d->arch.perdomain_l3_pg, __PAGE_HYPERVISOR); - if ( zap_ro_mpt || is_pv_32on64_domain(d) || paging_mode_refcounts(d) = ) + if ( zap_ro_mpt || is_pv_32bit_domain(d) || paging_mode_refcounts(d) = ) l4tab[l4_table_offset(RO_MPT_VIRT_START)] =3D l4e_empty(); } =20 @@ -2707,7 +2706,7 @@ int new_guest_cr3(unsigned long mfn) int rc; unsigned long old_base_mfn; =20 - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) { unsigned long gt_mfn =3D pagetable_get_pfn(curr->arch.guest_table)= ; l4_pgentry_t *pl4e =3D map_domain_page(gt_mfn); @@ -2856,7 +2855,7 @@ static inline int vcpumask_to_pcpumask( unsigned int vcpu_id, vcpu_bias, offs; unsigned long vmask; struct vcpu *v; - bool_t is_native =3D !is_pv_32on64_domain(d); + bool_t is_native =3D !is_pv_32bit_domain(d); =20 cpumask_clear(pmask); for ( vmask =3D 0, offs =3D 0; ; ++offs) @@ -5165,7 +5164,7 @@ int ptwr_do_page_fault(struct vcpu *v, u ptwr_ctxt.ctxt.regs =3D regs; ptwr_ctxt.ctxt.force_writeback =3D 0; ptwr_ctxt.ctxt.addr_size =3D ptwr_ctxt.ctxt.sp_size =3D - is_pv_32on64_domain(d) ? 32 : BITS_PER_LONG; + is_pv_32bit_domain(d) ? 32 : BITS_PER_LONG; ptwr_ctxt.ctxt.swint_emulate =3D x86_swint_emulate_none; ptwr_ctxt.cr2 =3D addr; ptwr_ctxt.pte =3D pte; @@ -5235,10 +5234,9 @@ static const struct x86_emulate_ops mmio int mmio_ro_do_page_fault(struct vcpu *v, unsigned long addr, struct cpu_user_regs *regs) { - l1_pgentry_t pte; - unsigned long mfn; - unsigned int addr_size =3D is_pv_32on64_domain(v->domain) ? - 32 : BITS_PER_LONG; + l1_pgentry_t pte; + unsigned long mfn; + unsigned int addr_size =3D is_pv_32bit_vcpu(v) ? 32 : BITS_PER_LONG; struct mmio_ro_emulate_ctxt mmio_ro_ctxt =3D { .ctxt.regs =3D regs, .ctxt.addr_size =3D addr_size, --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2110,7 +2110,7 @@ void sh_destroy_shadow(struct domain *d, t =3D=3D SH_type_fl1_pae_shadow || t =3D=3D SH_type_fl1_64_shadow || t =3D=3D SH_type_monitor_table || - (is_pv_32on64_domain(d) && t =3D=3D SH_type_l4_64_shadow) || + (is_pv_32bit_domain(d) && t =3D=3D SH_type_l4_64_shadow) || (page_get_owner(mfn_to_page(backpointer(sp))) =3D=3D d)); =20 /* The down-shifts here are so that the switch statement is on nice @@ -2139,7 +2139,7 @@ void sh_destroy_shadow(struct domain *d, SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 4)(d, smfn); break; case SH_type_l2h_64_shadow: - ASSERT(is_pv_32on64_domain(d)); + ASSERT(is_pv_32bit_domain(d)); /* Fall through... */ case SH_type_l2_64_shadow: SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4)(d, smfn); @@ -3472,7 +3472,7 @@ static int sh_enable_log_dirty(struct do /* 32bit PV guests on 64bit xen behave like older 64bit linux: they * change an l4e instead of cr3 to switch tables. Give them the * same optimization */ - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) d->arch.paging.shadow.opt_flags =3D SHOPT_LINUX_L3_TOPLEVEL; #endif =20 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -131,8 +131,8 @@ set_shadow_status(struct domain *d, mfn_ =20 ASSERT(mfn_to_page(smfn)->u.sh.head); =20 - /* 32-on-64 PV guests don't own their l4 pages so can't get_page them = */ - if ( !is_pv_32on64_domain(d) || shadow_type !=3D SH_type_l4_64_shadow = ) + /* 32-bit PV guests don't own their l4 pages so can't get_page them = */ + if ( !is_pv_32bit_domain(d) || shadow_type !=3D SH_type_l4_64_shadow = ) { res =3D get_page(mfn_to_page(gmfn), d); ASSERT(res =3D=3D 1); @@ -159,8 +159,8 @@ delete_shadow_status(struct domain *d, m d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn)); ASSERT(mfn_to_page(smfn)->u.sh.head); shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn); - /* 32-on-64 PV guests don't own their l4 pages; see set_shadow_status = */ - if ( !is_pv_32on64_domain(d) || shadow_type !=3D SH_type_l4_64_shadow = ) + /* 32-bit PV guests don't own their l4 pages; see set_shadow_status = */ + if ( !is_pv_32bit_domain(d) || shadow_type !=3D SH_type_l4_64_shadow = ) put_page(mfn_to_page(gmfn)); } =20 @@ -698,7 +698,7 @@ _sh_propagate(struct vcpu *v, // PV guests in 64-bit mode use two different page tables for user vs // supervisor permissions, making the guest's _PAGE_USER bit = irrelevant. // It is always shadowed as present... - if ( (GUEST_PAGING_LEVELS =3D=3D 4) && !is_pv_32on64_domain(d) + if ( (GUEST_PAGING_LEVELS =3D=3D 4) && !is_pv_32bit_domain(d) && is_pv_domain(d) ) { sflags |=3D _PAGE_USER; @@ -1346,8 +1346,8 @@ do { =20 for ( _i =3D 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) = \ { = \ if ( (!(_xen)) = \ - || !is_pv_32on64_domain(_dom) = \ - || mfn_to_page(_sl2mfn)->u.sh.type !=3D SH_type_l2h_64_shadow= \ + || !is_pv_32bit_domain(_dom) = \ + || mfn_to_page(_sl2mfn)->u.sh.type !=3D SH_type_l2h_64_shadow= \ || (_i < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom)) ) = \ { = \ (_sl2e) =3D _sp + _i; = \ @@ -1435,7 +1435,7 @@ void sh_install_xen_entries_in_l4(struct shadow_l4e_from_mfn(page_to_mfn(d->arch.perdomain_l3_pg), __PAGE_HYPERVISOR); =20 - if ( !shadow_mode_external(d) && !is_pv_32on64_domain(d) && + if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) && !VM_ASSIST(d, m2p_strict) ) { /* open coded zap_ro_mpt(mfn_x(sl4mfn)): */ @@ -1475,7 +1475,7 @@ static void sh_install_xen_entries_in_l2 { shadow_l2e_t *sl2e; =20 - if ( !is_pv_32on64_domain(d) ) + if ( !is_pv_32bit_domain(d) ) return; =20 sl2e =3D sh_map_domain_page(sl2hmfn); @@ -1620,9 +1620,9 @@ sh_make_monitor_table(struct vcpu *v) l3e[0] =3D l3e_from_pfn(mfn_x(m2mfn), __PAGE_HYPERVISOR); sh_unmap_domain_page(l3e); =20 - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) { - /* For 32-on-64 PV guests, we need to map the 32-bit Xen + /* For 32-bit PV guests, we need to map the 32-bit Xen * area into its usual VAs in the monitor tables */ m3mfn =3D shadow_alloc(d, SH_type_monitor_table, 0); mfn_to_page(m3mfn)->shadow_flags =3D 3; @@ -1740,7 +1740,7 @@ static shadow_l2e_t * shadow_get_and_cre unsigned int t =3D SH_type_l2_shadow; =20 /* Tag compat L2 containing hypervisor (m2p) mappings */ - if ( is_pv_32on64_domain(v->domain) && + if ( is_pv_32bit_vcpu(v) && guest_l4_table_offset(gw->va) =3D=3D 0 && guest_l3_table_offset(gw->va) =3D=3D 3 ) t =3D SH_type_l2h_shadow; @@ -2043,7 +2043,7 @@ void sh_destroy_monitor_table(struct vcp sh_unmap_domain_page(l3e); shadow_free(d, m3mfn); =20 - if ( is_pv_32on64_domain(d) ) + if ( is_pv_32bit_domain(d) ) { /* Need to destroy the l3 and l2 monitor pages that map the * Xen VAs at 3GB-4GB */ @@ -3963,7 +3963,7 @@ sh_update_cr3(struct vcpu *v, int do_loc (unsigned long)pagetable_get_pfn(v->arch.guest_table));= =20 #if GUEST_PAGING_LEVELS =3D=3D 4 - if ( !(v->arch.flags & TF_kernel_mode) && !is_pv_32on64_domain(d) ) + if ( !(v->arch.flags & TF_kernel_mode) && !is_pv_32bit_domain(d) ) gmfn =3D pagetable_get_mfn(v->arch.guest_table_user); else #endif @@ -4078,7 +4078,7 @@ sh_update_cr3(struct vcpu *v, int do_loc if ( sh_remove_write_access(d, gmfn, 4, 0) !=3D 0 ) flush_tlb_mask(d->domain_dirty_cpumask); sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow); - if ( !shadow_mode_external(d) && !is_pv_32on64_domain(d) ) + if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) ) { mfn_t smfn =3D pagetable_get_mfn(v->arch.shadow_table[0]); =20 @@ -5104,7 +5104,7 @@ int sh_audit_l3_table(struct vcpu *v, mf gmfn =3D get_shadow_status(d, get_gfn_query_unlocked( d, gfn_x(gfn), &p2mt), ((GUEST_PAGING_LEVELS =3D=3D 3 || - is_pv_32on64_domain(d)) + is_pv_32bit_domain(d)) && !shadow_mode_external(d) && (guest_index(gl3e) % 4) =3D=3D = 3) ? SH_type_l2h_shadow --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -951,7 +951,7 @@ void pv_cpuid(struct cpu_user_regs *regs __clear_bit(X86_FEATURE_LM % 32, &d); __clear_bit(X86_FEATURE_LAHF_LM % 32, &c); } - if ( is_pv_32on64_domain(currd) && + if ( is_pv_32bit_domain(currd) && boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD ) __clear_bit(X86_FEATURE_SYSCALL % 32, &d); __clear_bit(X86_FEATURE_PAGE1GB % 32, &d); @@ -3675,7 +3675,7 @@ long register_guest_nmi_callback(unsigne =20 t->vector =3D TRAP_nmi; t->flags =3D 0; - t->cs =3D (is_pv_32on64_domain(d) ? + t->cs =3D (is_pv_32bit_domain(d) ? FLAT_COMPAT_KERNEL_CS : FLAT_KERNEL_CS); t->address =3D address; TI_SET_IF(t, 1); --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -1188,7 +1188,7 @@ int handle_memadd_fault(unsigned long ad unsigned long mfn, idle_index; int ret =3D 0; =20 - if (!is_pv_32on64_domain(d)) + if (!is_pv_32bit_domain(d)) return 0; =20 if ( (addr < HYPERVISOR_COMPAT_VIRT_START(d)) || @@ -1247,7 +1247,7 @@ unmap: =20 void domain_set_alloc_bitsize(struct domain *d) { - if ( !is_pv_32on64_domain(d) || + if ( !is_pv_32bit_domain(d) || (MACH2PHYS_COMPAT_NR_ENTRIES(d) >=3D max_page) || d->arch.physaddr_bitsize > 0 ) return; --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -495,7 +495,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe break; =20 #ifdef CONFIG_COMPAT - if ( !is_pv_32on64_domain(d) ) + if ( !is_pv_32bit_domain(d) ) ret =3D copy_from_guest(c.nat, op->u.vcpucontext.ctxt, 1); else ret =3D copy_from_guest(c.cmp, @@ -901,7 +901,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe vcpu_unpause(v); =20 #ifdef CONFIG_COMPAT - if ( !is_pv_32on64_domain(d) ) + if ( !is_pv_32bit_domain(d) ) ret =3D copy_to_guest(op->u.vcpucontext.ctxt, c.nat, 1); else ret =3D copy_to_guest(guest_handle_cast(op->u.vcpucontext.ctxt= , --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -872,7 +872,7 @@ static int kexec_load_slot(struct kexec_ static uint16_t kexec_load_v1_arch(void) { #ifdef CONFIG_X86 - return is_pv_32on64_domain(hardware_domain) ? EM_386 : EM_X86_64; + return is_pv_32bit_domain(hardware_domain) ? EM_386 : EM_X86_64; #else return EM_NONE; #endif --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -219,7 +219,7 @@ static int alloc_xenoprof_struct( bufsize =3D sizeof(struct xenoprof_buf); i =3D sizeof(struct event_log); #ifdef CONFIG_COMPAT - d->xenoprof->is_compat =3D is_pv_32on64_domain(is_passive ? hardware_d= omain : d); + d->xenoprof->is_compat =3D is_pv_32bit_domain(is_passive ? hardware_do= main : d); if ( XENOPROF_COMPAT(d->xenoprof) ) { bufsize =3D sizeof(struct compat_oprof_buf); --- a/xen/include/asm-x86/desc.h +++ b/xen/include/asm-x86/desc.h @@ -65,7 +65,7 @@ */ #define guest_gate_selector_okay(d, sel) \ ((((sel)>>3) < FIRST_RESERVED_GDT_ENTRY) || /* Guest seg? */ \ - ((sel) =3D=3D (!is_pv_32on64_domain(d) ? = \ + ((sel) =3D=3D (!is_pv_32bit_domain(d) ? = \ FLAT_KERNEL_CS : /* Xen default seg? */ \ FLAT_COMPAT_KERNEL_CS)) || \ ((sel) & 4)) /* LDT seg? */ --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -14,7 +14,6 @@ #define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo) #define is_pv_32bit_domain(d) ((d)->arch.is_32bit_pv) #define is_pv_32bit_vcpu(v) (is_pv_32bit_domain((v)->domain)) -#define is_pv_32on64_domain(d) (is_pv_32bit_domain(d)) =20 #define is_hvm_pv_evtchn_domain(d) (has_hvm_container_domain(d) && \ d->arch.hvm_domain.irq.callback_via_type =3D=3D HVMIRQ_callback_ve= ctor) --=__PartD5E10418.2__= Content-Type: text/plain; name="x86-drop-is_32on64_domain.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-drop-is_32on64_domain.patch" x86: drop is_pv_32on64_domain()=0A=0A... as being identical to is_pv_32bit_= domain() after the x86-32=0Aremoval.=0A=0AIn a few cases this includes no = longer open-coding is_pv_32bit_vcpu().=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/domain.c=0A+++ b/xen/arch/x86/d= omain.c=0A@@ -367,7 +367,7 @@ int switch_native(struct domain *d)=0A =0A = if ( !may_switch_mode(d) )=0A return -EACCES;=0A- if ( = !is_pv_32on64_domain(d) )=0A+ if ( !is_pv_32bit_domain(d) )=0A = return 0;=0A =0A d->arch.is_32bit_pv =3D d->arch.has_32bit_shinfo =3D = 0;=0A@@ -392,7 +392,7 @@ int switch_compat(struct domain *d)=0A =0A if = ( !may_switch_mode(d) )=0A return -EACCES;=0A- if ( is_pv_32on64= _domain(d) )=0A+ if ( is_pv_32bit_domain(d) )=0A return 0;=0A = =0A d->arch.is_32bit_pv =3D d->arch.has_32bit_shinfo =3D 1;=0A@@ = -481,7 +481,7 @@ int vcpu_initialise(struct vcpu *v)=0A =0A v->arch.pv_= vcpu.ctrlreg[4] =3D real_cr4_to_pv_guest_cr4(mmu_cr4_features);=0A =0A- = rc =3D is_pv_32on64_domain(d) ? setup_compat_l4(v) : 0;=0A+ rc =3D = is_pv_32bit_domain(d) ? setup_compat_l4(v) : 0;=0A done:=0A if ( rc = )=0A {=0A@@ -689,7 +689,7 @@ unsigned long pv_guest_cr4_fixup(const = s=0A hv_cr4_mask =3D ~X86_CR4_TSD;=0A if ( cpu_has_de )=0A = hv_cr4_mask &=3D ~X86_CR4_DE;=0A- if ( cpu_has_fsgsbase && !is_pv_32bit_= domain(v->domain) )=0A+ if ( cpu_has_fsgsbase && !is_pv_32bit_vcpu(v) = )=0A hv_cr4_mask &=3D ~X86_CR4_FSGSBASE;=0A if ( cpu_has_xsave = )=0A hv_cr4_mask &=3D ~X86_CR4_OSXSAVE;=0A@@ -721,7 +721,7 @@ int = arch_set_info_guest(=0A =0A /* The context is a compat-mode one if the = target domain is compat-mode;=0A * we expect the tools to DTRT even = in compat-mode callers. */=0A- compat =3D is_pv_32on64_domain(d);=0A+ = compat =3D is_pv_32bit_domain(d);=0A =0A #define c(fld) (compat ? = (c.cmp->fld) : (c.nat->fld))=0A flags =3D c(flags);=0A@@ -1195,7 = +1195,7 @@ static void load_segments(struct vcpu *n=0A = all_segs_okay &=3D loadsegment(gs, uregs->gs);=0A }=0A =0A- if ( = !is_pv_32on64_domain(n->domain) )=0A+ if ( !is_pv_32bit_vcpu(n) )=0A = {=0A /* This can only be non-zero if selector is NULL. */=0A = if ( n->arch.pv_vcpu.fs_base )=0A@@ -1224,7 +1224,7 @@ static void = load_segments(struct vcpu *n=0A (unsigned long *)pv->kernel_sp;= =0A unsigned long cs_and_mask, rflags;=0A =0A- if ( = is_pv_32on64_domain(n->domain) )=0A+ if ( is_pv_32bit_vcpu(n) )=0A = {=0A unsigned int *esp =3D ring_1(regs) ?=0A = (unsigned int *)regs->rsp :=0A@@ -1340,7 +1340,7 @@ = static void save_segments(struct vcpu *v=0A if ( regs->es )=0A = dirty_segment_mask |=3D DIRTY_ES;=0A =0A- if ( regs->fs || is_pv_32on64_= domain(v->domain) )=0A+ if ( regs->fs || is_pv_32bit_vcpu(v) )=0A = {=0A dirty_segment_mask |=3D DIRTY_FS;=0A v->arch.pv_vcpu.f= s_base =3D 0; /* !=3D 0 selector kills fs_base */=0A@@ -1350,7 +1350,7 @@ = static void save_segments(struct vcpu *v=0A dirty_segment_mask = |=3D DIRTY_FS_BASE;=0A }=0A =0A- if ( regs->gs || is_pv_32on64_domai= n(v->domain) )=0A+ if ( regs->gs || is_pv_32bit_vcpu(v) )=0A {=0A = dirty_segment_mask |=3D DIRTY_GS;=0A v->arch.pv_vcpu.gs_base_= user =3D 0; /* !=3D 0 selector kills gs_base_user */=0A@@ -1483,8 +1483,8 = @@ static void __context_switch(void)=0A =0A psr_ctxt_switch_to(nd);=0A= =0A- gdt =3D !is_pv_32on64_domain(nd) ? per_cpu(gdt_table, cpu) :=0A- = per_cpu(compat_gdt_table, cpu);=0A+ = gdt =3D !is_pv_32bit_domain(nd) ? per_cpu(gdt_table, cpu) :=0A+ = per_cpu(compat_gdt_table, cpu);=0A if ( = need_full_gdt(nd) )=0A {=0A unsigned long mfn =3D virt_to_mfn(g= dt);=0A@@ -1568,7 +1568,7 @@ void context_switch(struct vcpu *prev, s=0A = if ( is_pv_domain(nextd) &&=0A (is_idle_domain(prevd) = ||=0A has_hvm_container_domain(prevd) ||=0A- = is_pv_32on64_domain(prevd) !=3D is_pv_32on64_domain(nextd)) )=0A+ = is_pv_32bit_domain(prevd) !=3D is_pv_32bit_domain(nextd)) )=0A = {=0A uint64_t efer =3D read_efer();=0A if ( !(efer = & EFER_SCE) )=0A--- a/xen/arch/x86/domain_build.c=0A+++ b/xen/arch/x86/doma= in_build.c=0A@@ -293,7 +293,7 @@ static unsigned long __init compute_dom0= =0A avail -=3D (d->max_vcpus - 1UL)=0A << get_order_from_b= ytes(sizeof(struct vcpu));=0A /* ...and compat_l4's, if needed. */=0A- = if ( is_pv_32on64_domain(d) )=0A+ if ( is_pv_32bit_domain(d) )=0A = avail -=3D d->max_vcpus - 1;=0A =0A /* Reserve memory for = iommu_dom0_init() (rough estimate). */=0A@@ -608,7 +608,7 @@ static __init = void dom0_update_physmap(s=0A BUG_ON(rc);=0A return;=0A = }=0A- if ( !is_pv_32on64_domain(d) )=0A+ if ( !is_pv_32bit_domain(d)= )=0A ((unsigned long *)vphysmap_s)[pfn] =3D mfn;=0A else=0A = ((unsigned int *)vphysmap_s)[pfn] =3D mfn;=0A@@ -718,7 +718,7 @@ = static __init void mark_pv_pt_pages_rdon=0A =0A /* Top-level p.t. = is pinned. */=0A if ( (page->u.inuse.type_info & PGT_type_mask) = =3D=3D=0A- (!is_pv_32on64_domain(d) ?=0A+ = (!is_pv_32bit_domain(d) ?=0A PGT_l4_page_table : PGT_l3_page_= table) )=0A {=0A page->count_info +=3D 1;=0A@@ = -1048,7 +1048,7 @@ int __init construct_dom0(=0A vinitrd_end = =3D vinitrd_start + initrd_len;=0A vphysmap_start =3D round_pgup(vi= nitrd_end);=0A }=0A- vphysmap_end =3D vphysmap_start + = (nr_pages * (!is_pv_32on64_domain(d) ?=0A+ vphysmap_end =3D = vphysmap_start + (nr_pages * (!is_pv_32bit_domain(d) ?=0A = sizeof(unsigned long) :=0A = sizeof(unsigned int)));=0A if = ( parms.p2m_base !=3D UNSET_ADDR )=0A@@ -1076,9 +1076,9 @@ int __init = construct_dom0(=0A #define NR(_l,_h,_s) \=0A (((((_h) + ((1UL<<(_s))-1)= ) & ~((1UL<<(_s))-1)) - \=0A ((_l) & ~((1UL<<(_s))-1))) >> = (_s))=0A- if ( (!is_pv_32on64_domain(d) + /* # L4 */=0A+ if = ( (!is_pv_32bit_domain(d) + /* # L4 */=0A NR(v_start, v_end, = L4_PAGETABLE_SHIFT) + /* # L3 */=0A- (!is_pv_32on64_domain(d) = ?=0A+ (!is_pv_32bit_domain(d) ?=0A NR(v_start, = v_end, L3_PAGETABLE_SHIFT) : /* # L2 */=0A 4) + /* # compat = L2 */=0A NR(v_start, v_end, L2_PAGETABLE_SHIFT)) /* # L1 = */=0A@@ -1176,7 +1176,7 @@ int __init construct_dom0(=0A mpt_alloc = -=3D PAGE_ALIGN(initrd_len);=0A =0A /* Overlap with Xen protected = area? */=0A- if ( !is_pv_32on64_domain(d) ?=0A+ if ( !is_pv_32bit_dom= ain(d) ?=0A ((v_start < HYPERVISOR_VIRT_END) &&=0A = (v_end > HYPERVISOR_VIRT_START)) :=0A (v_end > HYPERVISOR_COMPAT_V= IRT_START(d)) )=0A@@ -1186,14 +1186,14 @@ int __init construct_dom0(=0A = goto out;=0A }=0A =0A- if ( is_pv_32on64_domain(d) )=0A+ if = ( is_pv_32bit_domain(d) )=0A {=0A v->arch.pv_vcpu.failsafe_call= back_cs =3D FLAT_COMPAT_KERNEL_CS;=0A v->arch.pv_vcpu.event_callbac= k_cs =3D FLAT_COMPAT_KERNEL_CS;=0A }=0A =0A /* WARNING: The new = domain must have its 'processor' field filled in! */=0A- if ( !is_pv_32o= n64_domain(d) )=0A+ if ( !is_pv_32bit_domain(d) )=0A {=0A = maddr_to_page(mpt_alloc)->u.inuse.type_info =3D PGT_l4_page_table;=0A = l4start =3D l4tab =3D __va(mpt_alloc); mpt_alloc +=3D PAGE_SIZE;=0A@@ = -1211,7 +1211,7 @@ int __init construct_dom0(=0A clear_page(l4tab);=0A = init_guest_l4_table(l4tab, d, 0);=0A v->arch.guest_table =3D = pagetable_from_paddr(__pa(l4start));=0A- if ( is_pv_32on64_domain(d) = )=0A+ if ( is_pv_32bit_domain(d) )=0A v->arch.guest_table_user = =3D v->arch.guest_table;=0A =0A l4tab +=3D l4_table_offset(v_start);=0A= @@ -1257,7 +1257,7 @@ int __init construct_dom0(=0A mfn =3D = pfn++;=0A else=0A mfn =3D initrd_mfn++;=0A- = *l1tab =3D l1e_from_pfn(mfn, (!is_pv_32on64_domain(d) ?=0A+ *l1tab = =3D l1e_from_pfn(mfn, (!is_pv_32bit_domain(d) ?=0A = L1_PROT : COMPAT_L1_PROT));=0A l1tab++;=0A =0A@@ = -1270,7 +1270,7 @@ int __init construct_dom0(=0A }=0A }=0A = =0A- if ( is_pv_32on64_domain(d) )=0A+ if ( is_pv_32bit_domain(d) = )=0A {=0A /* Ensure the first four L3 entries are all = populated. */=0A for ( i =3D 0, l3tab =3D l3start; i < 4; ++i, = ++l3tab )=0A@@ -1477,7 +1477,7 @@ int __init construct_dom0(=0A if ( = is_pvh_domain(d) )=0A si->shared_info =3D shared_info_paddr;=0A = =0A- if ( is_pv_32on64_domain(d) )=0A+ if ( is_pv_32bit_domain(d) = )=0A xlat_start_info(si, XLAT_start_info_console_dom0);=0A =0A = /* Return to idle domain's page tables. */=0A@@ -1499,10 +1499,10 @@ int = __init construct_dom0(=0A */=0A regs =3D &v->arch.user_regs;=0A = regs->ds =3D regs->es =3D regs->fs =3D regs->gs =3D=0A- !is_pv_32o= n64_domain(d) ? FLAT_KERNEL_DS : FLAT_COMPAT_KERNEL_DS;=0A- regs->ss = =3D (!is_pv_32on64_domain(d) ?=0A+ !is_pv_32bit_domain(d) ? = FLAT_KERNEL_DS : FLAT_COMPAT_KERNEL_DS;=0A+ regs->ss =3D (!is_pv_32bit_d= omain(d) ?=0A FLAT_KERNEL_SS : FLAT_COMPAT_KERNEL_SS);=0A- = regs->cs =3D (!is_pv_32on64_domain(d) ?=0A+ regs->cs =3D (!is_pv_32bi= t_domain(d) ?=0A FLAT_KERNEL_CS : FLAT_COMPAT_KERNEL_CS);= =0A regs->eip =3D parms.virt_entry;=0A regs->esp =3D vstack_end;=0A= --- a/xen/arch/x86/domctl.c=0A+++ b/xen/arch/x86/domctl.c=0A@@ -349,7 = +349,7 @@ long arch_do_domctl(=0A =0A case XEN_DOMCTL_get_address_size:= =0A domctl->u.address_size.size =3D=0A- is_pv_32on64_dom= ain(d) ? 32 : BITS_PER_LONG;=0A+ is_pv_32bit_domain(d) ? 32 : = BITS_PER_LONG;=0A copyback =3D 1;=0A break;=0A =0A@@ = -1183,7 +1183,7 @@ void arch_get_info_guest(struct vcpu *v,=0A {=0A = unsigned int i;=0A const struct domain *d =3D v->domain;=0A- bool_t = compat =3D is_pv_32on64_domain(d);=0A+ bool_t compat =3D is_pv_32bit_dom= ain(d);=0A #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld))=0A =0A = if ( !is_pv_domain(d) )=0A--- a/xen/arch/x86/mm.c=0A+++ b/xen/arch/x86/mm= .c=0A@@ -163,9 +163,8 @@ static uint32_t base_disallow_mask;=0A #define = L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL)=0A = #define L2_DISALLOW_MASK (base_disallow_mask & ~_PAGE_PSE)=0A =0A-#define = l3_disallow_mask(d) (!is_pv_32on64_domain(d) ? \=0A- = base_disallow_mask : \=0A- = 0xFFFFF198U)=0A+#define l3_disallow_mask(d) (!is_pv_32bit_domain(d) ? = \=0A+ base_disallow_mask : 0xFFFFF198U)=0A =0A = #define L4_DISALLOW_MASK (base_disallow_mask)=0A =0A@@ -985,7 +984,7 @@ = get_page_from_l4e(=0A #define adjust_guest_l1e(pl1e, d) = \=0A do { = \=0A if ( likely(l1e_get_flags((pl1e= )) & _PAGE_PRESENT) && \=0A- likely(!is_pv_32on6= 4_domain(d)) ) \=0A+ likely(!is_p= v_32bit_domain(d)) ) \=0A { = \=0A = /* _PAGE_GUEST_KERNEL page cannot have the Global bit set. */ \=0A = if ( (l1e_get_flags((pl1e)) & (_PAGE_GUEST_KERNEL|_PAGE_GLOBAL)) = \=0A@@ -1002,14 +1001,14 @@ get_page_from_l4e(=0A #define adjust_guest_l2e(= pl2e, d) \=0A do { = \=0A if ( likely(l2e_get_flags((pl= 2e)) & _PAGE_PRESENT) && \=0A- likely(!is_pv_32on64_domain(d)= ) ) \=0A+ likely(!is_pv_32bit_domain(d)) ) = \=0A l2e_add_flags((pl2e), _PAGE_USER); = \=0A } while ( 0 )=0A =0A #define adjust_guest_l3e(pl3e, d) = \=0A do { = \=0A if ( likely(l3e_get_flags((pl3e)= ) & _PAGE_PRESENT) ) \=0A- l3e_add_flags((pl3e), = likely(!is_pv_32on64_domain(d)) ? \=0A+ l3e_add_flags((pl3e), = likely(!is_pv_32bit_domain(d)) ? \=0A = _PAGE_USER : \=0A = _PAGE_USER|_PAGE_RW); \=0A } while ( 0 )=0A@@ -1017,13 = +1016,13 @@ get_page_from_l4e(=0A #define adjust_guest_l4e(pl4e, d) = \=0A do { = \=0A if ( likely(l4e_get_flags((pl4e)) & = _PAGE_PRESENT) && \=0A- likely(!is_pv_32on64_domain(d)) ) = \=0A+ likely(!is_pv_32bit_domain(d)) ) = \=0A l4e_add_flags((pl4e), _PAGE_USER); = \=0A } while ( 0 )=0A =0A #define unadjust_guest_l3e(pl3e, d) = \=0A do { = \=0A- if ( unlikely(is_pv_32o= n64_domain(d)) && \=0A+ if ( unlikely(is_= pv_32bit_domain(d)) && \=0A = likely(l3e_get_flags((pl3e)) & _PAGE_PRESENT) ) \=0A = l3e_remove_flags((pl3e), _PAGE_USER|_PAGE_RW|_PAGE_ACCESSED); \=0A = } while ( 0 )=0A@@ -1314,7 +1313,7 @@ static int alloc_l3_table(struct = page_in=0A * 512 entries must be valid/verified, which is most easily = achieved=0A * by clearing them out.=0A */=0A- if ( is_pv_32on6= 4_domain(d) )=0A+ if ( is_pv_32bit_domain(d) )=0A memset(pl3e + = 4, 0, (L3_PAGETABLE_ENTRIES - 4) * sizeof(*pl3e));=0A =0A for ( i =3D = page->nr_validated_ptes; i < L3_PAGETABLE_ENTRIES;=0A@@ -1391,7 +1390,7 @@ = void init_guest_l4_table(l4_pgentry_t l4=0A l4e_from_pfn(domain_pag= e_map_to_mfn(l4tab), __PAGE_HYPERVISOR);=0A l4tab[l4_table_offset(PERDO= MAIN_VIRT_START)] =3D=0A l4e_from_page(d->arch.perdomain_l3_pg, = __PAGE_HYPERVISOR);=0A- if ( zap_ro_mpt || is_pv_32on64_domain(d) || = paging_mode_refcounts(d) )=0A+ if ( zap_ro_mpt || is_pv_32bit_domain(d) = || paging_mode_refcounts(d) )=0A l4tab[l4_table_offset(RO_MPT_VIRT_= START)] =3D l4e_empty();=0A }=0A =0A@@ -2707,7 +2706,7 @@ int new_guest_cr3= (unsigned long mfn)=0A int rc;=0A unsigned long old_base_mfn;=0A = =0A- if ( is_pv_32on64_domain(d) )=0A+ if ( is_pv_32bit_domain(d) = )=0A {=0A unsigned long gt_mfn =3D pagetable_get_pfn(curr->arch= .guest_table);=0A l4_pgentry_t *pl4e =3D map_domain_page(gt_mfn);= =0A@@ -2856,7 +2855,7 @@ static inline int vcpumask_to_pcpumask(=0A = unsigned int vcpu_id, vcpu_bias, offs;=0A unsigned long vmask;=0A = struct vcpu *v;=0A- bool_t is_native =3D !is_pv_32on64_domain(d);=0A+ = bool_t is_native =3D !is_pv_32bit_domain(d);=0A =0A cpumask_clear(pmas= k);=0A for ( vmask =3D 0, offs =3D 0; ; ++offs)=0A@@ -5165,7 +5164,7 = @@ int ptwr_do_page_fault(struct vcpu *v, u=0A ptwr_ctxt.ctxt.regs =3D = regs;=0A ptwr_ctxt.ctxt.force_writeback =3D 0;=0A ptwr_ctxt.ctxt.ad= dr_size =3D ptwr_ctxt.ctxt.sp_size =3D=0A- is_pv_32on64_domain(d) ? = 32 : BITS_PER_LONG;=0A+ is_pv_32bit_domain(d) ? 32 : BITS_PER_LONG;= =0A ptwr_ctxt.ctxt.swint_emulate =3D x86_swint_emulate_none;=0A = ptwr_ctxt.cr2 =3D addr;=0A ptwr_ctxt.pte =3D pte;=0A@@ -5235,10 = +5234,9 @@ static const struct x86_emulate_ops mmio=0A int mmio_ro_do_page_= fault(struct vcpu *v, unsigned long addr,=0A = struct cpu_user_regs *regs)=0A {=0A- l1_pgentry_t pte;=0A- = unsigned long mfn;=0A- unsigned int addr_size =3D is_pv_32on64_= domain(v->domain) ?=0A- 32 : BITS_PER_LONG= ;=0A+ l1_pgentry_t pte;=0A+ unsigned long mfn;=0A+ unsigned int = addr_size =3D is_pv_32bit_vcpu(v) ? 32 : BITS_PER_LONG;=0A struct = mmio_ro_emulate_ctxt mmio_ro_ctxt =3D {=0A .ctxt.regs =3D regs,=0A = .ctxt.addr_size =3D addr_size,=0A--- a/xen/arch/x86/mm/shadow/commo= n.c=0A+++ b/xen/arch/x86/mm/shadow/common.c=0A@@ -2110,7 +2110,7 @@ void = sh_destroy_shadow(struct domain *d,=0A t =3D=3D SH_type_fl1_pae_= shadow ||=0A t =3D=3D SH_type_fl1_64_shadow ||=0A t = =3D=3D SH_type_monitor_table ||=0A- (is_pv_32on64_domain(d) && = t =3D=3D SH_type_l4_64_shadow) ||=0A+ (is_pv_32bit_domain(d) && = t =3D=3D SH_type_l4_64_shadow) ||=0A (page_get_owner(mfn_to_page= (backpointer(sp))) =3D=3D d));=0A =0A /* The down-shifts here are so = that the switch statement is on nice=0A@@ -2139,7 +2139,7 @@ void = sh_destroy_shadow(struct domain *d,=0A SHADOW_INTERNAL_NAME(sh_dest= roy_l1_shadow, 4)(d, smfn);=0A break;=0A case SH_type_l2h_64_sh= adow:=0A- ASSERT(is_pv_32on64_domain(d));=0A+ ASSERT(is_pv_32= bit_domain(d));=0A /* Fall through... */=0A case SH_type_l2_64_= shadow:=0A SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4)(d, = smfn);=0A@@ -3472,7 +3472,7 @@ static int sh_enable_log_dirty(struct do=0A = /* 32bit PV guests on 64bit xen behave like older 64bit linux: they=0A = * change an l4e instead of cr3 to switch tables. Give them the=0A = * same optimization */=0A- if ( is_pv_32on64_domain(d) )=0A+ if ( = is_pv_32bit_domain(d) )=0A d->arch.paging.shadow.opt_flags =3D = SHOPT_LINUX_L3_TOPLEVEL;=0A #endif=0A =0A--- a/xen/arch/x86/mm/shadow/multi= .c=0A+++ b/xen/arch/x86/mm/shadow/multi.c=0A@@ -131,8 +131,8 @@ set_shadow_= status(struct domain *d, mfn_=0A =0A ASSERT(mfn_to_page(smfn)->u.sh.hea= d);=0A =0A- /* 32-on-64 PV guests don't own their l4 pages so can't = get_page them */=0A- if ( !is_pv_32on64_domain(d) || shadow_type !=3D = SH_type_l4_64_shadow )=0A+ /* 32-bit PV guests don't own their l4 pages = so can't get_page them */=0A+ if ( !is_pv_32bit_domain(d) || shadow_type= !=3D SH_type_l4_64_shadow )=0A {=0A res =3D get_page(mfn_to_pa= ge(gmfn), d);=0A ASSERT(res =3D=3D 1);=0A@@ -159,8 +159,8 @@ = delete_shadow_status(struct domain *d, m=0A d->domain_id,= mfn_x(gmfn), shadow_type, mfn_x(smfn));=0A ASSERT(mfn_to_page(smfn)->u= .sh.head);=0A shadow_hash_delete(d, mfn_x(gmfn), shadow_type, = smfn);=0A- /* 32-on-64 PV guests don't own their l4 pages; see = set_shadow_status */=0A- if ( !is_pv_32on64_domain(d) || shadow_type = !=3D SH_type_l4_64_shadow )=0A+ /* 32-bit PV guests don't own their l4 = pages; see set_shadow_status */=0A+ if ( !is_pv_32bit_domain(d) || = shadow_type !=3D SH_type_l4_64_shadow )=0A put_page(mfn_to_page(gmf= n));=0A }=0A =0A@@ -698,7 +698,7 @@ _sh_propagate(struct vcpu *v,=0A = // PV guests in 64-bit mode use two different page tables for user vs=0A = // supervisor permissions, making the guest's _PAGE_USER bit irrelevant.= =0A // It is always shadowed as present...=0A- if ( (GUEST_PAGING_LE= VELS =3D=3D 4) && !is_pv_32on64_domain(d)=0A+ if ( (GUEST_PAGING_LEVELS = =3D=3D 4) && !is_pv_32bit_domain(d)=0A && is_pv_domain(d) )=0A = {=0A sflags |=3D _PAGE_USER;=0A@@ -1346,8 +1346,8 @@ do { = =0A for ( _i =3D 0; _i < SHADOW_L2_PAGETABLE= _ENTRIES; _i++ ) \=0A { = \=0A if ( (!(_xen)) = \=0A- || = !is_pv_32on64_domain(_dom) \=0A- = || mfn_to_page(_sl2mfn)->u.sh.type !=3D SH_type_l2h_64_shadow\=0A+ = || !is_pv_32bit_domain(_dom) = \=0A+ || mfn_to_page(_sl2mfn)->u.sh.type !=3D SH_type_l2h_64_sh= adow \=0A || (_i < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom)= ) ) \=0A { = \=0A (_sl2e) =3D _sp + _i; = \=0A@@ -1435,7 +1435,7 @@ void sh_install_xen_e= ntries_in_l4(struct=0A shadow_l4e_from_mfn(page_to_mfn(d->arch.perd= omain_l3_pg),=0A __PAGE_HYPERVISOR);=0A =0A- = if ( !shadow_mode_external(d) && !is_pv_32on64_domain(d) &&=0A+ if ( = !shadow_mode_external(d) && !is_pv_32bit_domain(d) &&=0A = !VM_ASSIST(d, m2p_strict) )=0A {=0A /* open coded zap_ro_mpt(mf= n_x(sl4mfn)): */=0A@@ -1475,7 +1475,7 @@ static void sh_install_xen_entries= _in_l2=0A {=0A shadow_l2e_t *sl2e;=0A =0A- if ( !is_pv_32on64_domain= (d) )=0A+ if ( !is_pv_32bit_domain(d) )=0A return;=0A =0A = sl2e =3D sh_map_domain_page(sl2hmfn);=0A@@ -1620,9 +1620,9 @@ sh_make_monit= or_table(struct vcpu *v)=0A l3e[0] =3D l3e_from_pfn(mfn_x(m2mfn= ), __PAGE_HYPERVISOR);=0A sh_unmap_domain_page(l3e);=0A =0A- = if ( is_pv_32on64_domain(d) )=0A+ if ( is_pv_32bit_doma= in(d) )=0A {=0A- /* For 32-on-64 PV guests, we = need to map the 32-bit Xen=0A+ /* For 32-bit PV guests, we = need to map the 32-bit Xen=0A * area into its usual VAs = in the monitor tables */=0A m3mfn =3D shadow_alloc(d, = SH_type_monitor_table, 0);=0A mfn_to_page(m3mfn)->shadow_fl= ags =3D 3;=0A@@ -1740,7 +1740,7 @@ static shadow_l2e_t * shadow_get_and_cre= =0A unsigned int t =3D SH_type_l2_shadow;=0A =0A /* Tag = compat L2 containing hypervisor (m2p) mappings */=0A- if ( = is_pv_32on64_domain(v->domain) &&=0A+ if ( is_pv_32bit_vcpu(v) = &&=0A guest_l4_table_offset(gw->va) =3D=3D 0 &&=0A = guest_l3_table_offset(gw->va) =3D=3D 3 )=0A t =3D SH_type_l2h= _shadow;=0A@@ -2043,7 +2043,7 @@ void sh_destroy_monitor_table(struct = vcp=0A sh_unmap_domain_page(l3e);=0A shadow_free(d, = m3mfn);=0A =0A- if ( is_pv_32on64_domain(d) )=0A+ if ( = is_pv_32bit_domain(d) )=0A {=0A /* Need to destroy the = l3 and l2 monitor pages that map the=0A * Xen VAs at 3GB-4GB = */=0A@@ -3963,7 +3963,7 @@ sh_update_cr3(struct vcpu *v, int do_loc=0A = (unsigned long)pagetable_get_pfn(v->arch.guest_table));=0A = =0A #if GUEST_PAGING_LEVELS =3D=3D 4=0A- if ( !(v->arch.flags & = TF_kernel_mode) && !is_pv_32on64_domain(d) )=0A+ if ( !(v->arch.flags & = TF_kernel_mode) && !is_pv_32bit_domain(d) )=0A gmfn =3D pagetable_g= et_mfn(v->arch.guest_table_user);=0A else=0A #endif=0A@@ -4078,7 = +4078,7 @@ sh_update_cr3(struct vcpu *v, int do_loc=0A if ( sh_remove_w= rite_access(d, gmfn, 4, 0) !=3D 0 )=0A flush_tlb_mask(d->domain_dir= ty_cpumask);=0A sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow);= =0A- if ( !shadow_mode_external(d) && !is_pv_32on64_domain(d) )=0A+ = if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )=0A {=0A = mfn_t smfn =3D pagetable_get_mfn(v->arch.shadow_table[0]);=0A =0A@@ = -5104,7 +5104,7 @@ int sh_audit_l3_table(struct vcpu *v, mf=0A = gmfn =3D get_shadow_status(d, get_gfn_query_unlocked(=0A = d, gfn_x(gfn), &p2mt),=0A = ((GUEST_PAGING_LEVELS =3D=3D 3 ||=0A- = is_pv_32on64_domain(d))=0A+ = is_pv_32bit_domain(d))=0A && = !shadow_mode_external(d)=0A && = (guest_index(gl3e) % 4) =3D=3D 3)=0A = ? SH_type_l2h_shadow=0A--- a/xen/arch/x86/traps.c=0A+++ b/xen/arch/x86/trap= s.c=0A@@ -951,7 +951,7 @@ void pv_cpuid(struct cpu_user_regs *regs=0A = __clear_bit(X86_FEATURE_LM % 32, &d);=0A __clear_bit(X86= _FEATURE_LAHF_LM % 32, &c);=0A }=0A- if ( is_pv_32on64_domai= n(currd) &&=0A+ if ( is_pv_32bit_domain(currd) &&=0A = boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD )=0A __clear_bit(X= 86_FEATURE_SYSCALL % 32, &d);=0A __clear_bit(X86_FEATURE_PAGE1GB % = 32, &d);=0A@@ -3675,7 +3675,7 @@ long register_guest_nmi_callback(unsigne= =0A =0A t->vector =3D TRAP_nmi;=0A t->flags =3D 0;=0A- t->cs = =3D (is_pv_32on64_domain(d) ?=0A+ t->cs =3D (is_pv_32bit_domai= n(d) ?=0A FLAT_COMPAT_KERNEL_CS : FLAT_KERNEL_CS);=0A = t->address =3D address;=0A TI_SET_IF(t, 1);=0A--- a/xen/arch/x86/x86_6= 4/mm.c=0A+++ b/xen/arch/x86/x86_64/mm.c=0A@@ -1188,7 +1188,7 @@ int = handle_memadd_fault(unsigned long ad=0A unsigned long mfn, idle_index;= =0A int ret =3D 0;=0A =0A- if (!is_pv_32on64_domain(d))=0A+ if = (!is_pv_32bit_domain(d))=0A return 0;=0A =0A if ( (addr < = HYPERVISOR_COMPAT_VIRT_START(d)) ||=0A@@ -1247,7 +1247,7 @@ unmap:=0A =0A = void domain_set_alloc_bitsize(struct domain *d)=0A {=0A- if ( !is_pv_32o= n64_domain(d) ||=0A+ if ( !is_pv_32bit_domain(d) ||=0A = (MACH2PHYS_COMPAT_NR_ENTRIES(d) >=3D max_page) ||=0A d->arch.physa= ddr_bitsize > 0 )=0A return;=0A--- a/xen/common/domctl.c=0A+++ = b/xen/common/domctl.c=0A@@ -495,7 +495,7 @@ long do_domctl(XEN_GUEST_HANDLE= _PARAM(xe=0A break;=0A =0A #ifdef CONFIG_COMPAT=0A- if = ( !is_pv_32on64_domain(d) )=0A+ if ( !is_pv_32bit_domain(d) )=0A = ret =3D copy_from_guest(c.nat, op->u.vcpucontext.ctxt, 1);=0A = else=0A ret =3D copy_from_guest(c.cmp,=0A@@ -901,7 +901,7 = @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe=0A vcpu_unpause(v);=0A = =0A #ifdef CONFIG_COMPAT=0A- if ( !is_pv_32on64_domain(d) )=0A+ = if ( !is_pv_32bit_domain(d) )=0A ret =3D copy_to_guest(op->u= .vcpucontext.ctxt, c.nat, 1);=0A else=0A ret =3D = copy_to_guest(guest_handle_cast(op->u.vcpucontext.ctxt,=0A--- a/xen/common/= kexec.c=0A+++ b/xen/common/kexec.c=0A@@ -872,7 +872,7 @@ static int = kexec_load_slot(struct kexec_=0A static uint16_t kexec_load_v1_arch(void)= =0A {=0A #ifdef CONFIG_X86=0A- return is_pv_32on64_domain(hardware_domai= n) ? EM_386 : EM_X86_64;=0A+ return is_pv_32bit_domain(hardware_domain) = ? EM_386 : EM_X86_64;=0A #else=0A return EM_NONE;=0A #endif=0A--- = a/xen/common/xenoprof.c=0A+++ b/xen/common/xenoprof.c=0A@@ -219,7 +219,7 = @@ static int alloc_xenoprof_struct(=0A bufsize =3D sizeof(struct = xenoprof_buf);=0A i =3D sizeof(struct event_log);=0A #ifdef CONFIG_COMP= AT=0A- d->xenoprof->is_compat =3D is_pv_32on64_domain(is_passive ? = hardware_domain : d);=0A+ d->xenoprof->is_compat =3D is_pv_32bit_domain(= is_passive ? hardware_domain : d);=0A if ( XENOPROF_COMPAT(d->xenoprof)= )=0A {=0A bufsize =3D sizeof(struct compat_oprof_buf);=0A--- = a/xen/include/asm-x86/desc.h=0A+++ b/xen/include/asm-x86/desc.h=0A@@ -65,7 = +65,7 @@=0A */=0A #define guest_gate_selector_okay(d, sel) = \=0A ((((sel)>>3) < FIRST_RESERVED_GDT_ENTRY) || /* = Guest seg? */ \=0A- ((sel) =3D=3D (!is_pv_32on64_domain(d) ? = \=0A+ ((sel) =3D=3D (!is_pv_32bit_domain(d) = ? \=0A FLAT_KERNEL_CS : = /* Xen default seg? */ \=0A FLAT_COMPAT_KERNEL_= CS)) || \=0A ((sel) & 4)) = /* LDT seg? */=0A--- a/xen/include/asm-x86/domain.h=0A+++ = b/xen/include/asm-x86/domain.h=0A@@ -14,7 +14,6 @@=0A #define has_32bit_shi= nfo(d) ((d)->arch.has_32bit_shinfo)=0A #define is_pv_32bit_domain(d) = ((d)->arch.is_32bit_pv)=0A #define is_pv_32bit_vcpu(v) (is_pv_32bit_doma= in((v)->domain))=0A-#define is_pv_32on64_domain(d) (is_pv_32bit_domain(d))= =0A =0A #define is_hvm_pv_evtchn_domain(d) (has_hvm_container_domain(d) && = \=0A d->arch.hvm_domain.irq.callback_via_type =3D=3D HVMIRQ_callbac= k_vector)=0A --=__PartD5E10418.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartD5E10418.2__=--