x86: don't open-code [gm]fn_to_[gm]addr()
PATCH 1/1 x86: don't open-code [gm]fn_to_[gm]addr()
At least in pure address calculation use the intended basic construct instead of opend-coded left-shifting by PAGE_SHIFT. Leave alone page table entry calculations for now, as those aren't really calculating addresses.
No functional change.
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/guest/xen/xen.c +1 -1
@@ -73,7 +73,7 @@ static void map_shared_info(void)if ( rc )panic ("failed to map shared_info page: %ld\n" , rc); -set_fixmap (FIX_XEN_SHARED_INFO ,mfn_x (mfn) <<PAGE_SHIFT ); +set_fixmap (FIX_XEN_SHARED_INFO ,mfn_to_maddr (mfn));/* Mask all upcalls */ for ( i =0 ; i <ARRAY_SIZE (XEN_shared_info->evtchn_mask); i++ )
xen/arch/x86/include/asm/guest_pt.h +1 -1
@@ -377,7 +377,7 @@ static inline paddr_t guest_walk_to_gpa(if (gfn_eq (gfn,INVALID_GFN ) )return INVALID_PADDR ; -return (gfn_x (gfn) <<PAGE_SHIFT ) | (gw->va & ~PAGE_MASK ); +return gfn_to_gaddr (gfn) | (gw->va & ~PAGE_MASK ); }/* Given a walk_t from a successful walk, return the page-order of the
xen/arch/x86/mm/hap/nested_hap.c +1 -1
@@ -134,7 +134,7 @@ static int nestedhap_walk_L0_p2m( rc =NESTEDHVM_PAGEFAULT_DONE ; direct_mmio_out: - *L0_gpa = (mfn_x (mfn) <<PAGE_SHIFT ) + (L1_gpa & ~PAGE_MASK ); + *L0_gpa =mfn_to_maddr (mfn) + (L1_gpa & ~PAGE_MASK ); out:p2m_put_gfn (p2m,gaddr_to_gfn (L1_gpa));return rc;
xen/arch/x86/mm/p2m-ept.c +3 -4
@@ -565,11 +565,10 @@ int epte_get_entry_emt(struct domain *d,if ( gmtrr_mtype == -EADDRNOTAVAIL )return -1 ; - gmtrr_mtype = v ?mtrr_get_type (&v->arch.hvm.mtrr, -gfn_x (gfn) <<PAGE_SHIFT , order) + gmtrr_mtype = v ?mtrr_get_type (&v->arch.hvm.mtrr,gfn_to_gaddr (gfn), + order) :X86_MT_WB ; - hmtrr_mtype =mtrr_get_type (&mtrr_state,mfn_x (mfn) <<PAGE_SHIFT , - order); + hmtrr_mtype =mtrr_get_type (&mtrr_state,mfn_to_maddr (mfn), order);if ( gmtrr_mtype <0 || hmtrr_mtype <0 )return -1 ;
Quoted 8 lines · Jan Beulich
At least in pure address calculation use the intended basic construct instead of opend-coded left-shifting by
PAGE_SHIFT. Leave alone page table entry calculations for now, as those aren't really calculating addresses.No functional change.
Signed-off-by Jan Beulich <[email protected]>
Reviewed-by Andrew Cooper <[email protected]>