[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [IA64] Cleanup: TLB translation
# HG changeset patch # User Alex Williamson <alex.williamson@xxxxxx> # Date 1206739514 21600 # Node ID 7f04cbf2fa529fcbbe05ae7d606277cb35ec3ef8 # Parent edfb58ca4d9601a51ccec735d8e13f62713f131a [IA64] Cleanup: TLB translation Add a new static inline function for readability. Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx> --- xen/arch/ia64/vmx/vmmu.c | 11 ++++------- xen/arch/ia64/vmx/vmx_fault.c | 3 +-- xen/include/asm-ia64/vmmu.h | 5 +++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff -r edfb58ca4d96 -r 7f04cbf2fa52 xen/arch/ia64/vmx/vmmu.c --- a/xen/arch/ia64/vmx/vmmu.c Tue Mar 25 12:37:17 2008 -0600 +++ b/xen/arch/ia64/vmx/vmmu.c Fri Mar 28 15:25:14 2008 -0600 @@ -167,7 +167,7 @@ fetch_code(VCPU *vcpu, u64 gip, IA64_BUN // if( tlb == NULL ) // tlb = vtlb_lookup(vcpu, gip, DSIDE_TLB ); if (tlb) - gpip = (tlb->ppn >>(tlb->ps-12)<<tlb->ps) | ( gip & (PSIZE(tlb->ps)-1) ); + gpip = thash_translate(tlb, gip); } if( gpip){ mfn = gmfn_to_mfn(vcpu->domain, gpip >>PAGE_SHIFT); @@ -180,8 +180,7 @@ fetch_code(VCPU *vcpu, u64 gip, IA64_BUN ia64_ptcl(gip, ARCH_PAGE_SHIFT << 2); return IA64_RETRY; } - maddr = (tlb->ppn >> (tlb->ps - 12) << tlb->ps) | - (gip & (PSIZE(tlb->ps) - 1)); + maddr = thash_translate(tlb, gip); mfn = maddr >> PAGE_SHIFT; } @@ -536,8 +535,7 @@ IA64FAULT vmx_vcpu_tpa(VCPU *vcpu, u64 v dnat_page_consumption(vcpu, vadr); return IA64_FAULT; } else { - *padr = ((data->ppn >> (data->ps - 12)) << data->ps) | - (vadr & (PSIZE(data->ps) - 1)); + *padr = thash_translate(data, vadr); return IA64_NO_FAULT; } } @@ -554,8 +552,7 @@ IA64FAULT vmx_vcpu_tpa(VCPU *vcpu, u64 v dnat_page_consumption(vcpu, vadr); return IA64_FAULT; } else { - madr = (data->ppn >> (data->ps - 12) << data->ps) | - (vadr & (PSIZE(data->ps) - 1)); + madr = thash_translate(data, vadr); *padr = __mpa_to_gpa(madr); return IA64_NO_FAULT; } diff -r edfb58ca4d96 -r 7f04cbf2fa52 xen/arch/ia64/vmx/vmx_fault.c --- a/xen/arch/ia64/vmx/vmx_fault.c Tue Mar 25 12:37:17 2008 -0600 +++ b/xen/arch/ia64/vmx/vmx_fault.c Fri Mar 28 15:25:14 2008 -0600 @@ -402,8 +402,7 @@ try_again: if ((data->ma == VA_MATTR_UC) || (data->ma == VA_MATTR_UCE)) return vmx_handle_lds(regs); } - gppa = (vadr & ((1UL << data->ps) - 1)) + - (data->ppn >> (data->ps - 12) << data->ps); + gppa = thash_translate(data, vadr); pte = lookup_domain_mpa(v->domain, gppa, NULL); if (pte & GPFN_IO_MASK) { if (misr.sp) diff -r edfb58ca4d96 -r 7f04cbf2fa52 xen/include/asm-ia64/vmmu.h --- a/xen/include/asm-ia64/vmmu.h Tue Mar 25 12:37:17 2008 -0600 +++ b/xen/include/asm-ia64/vmmu.h Fri Mar 28 15:25:14 2008 -0600 @@ -118,6 +118,11 @@ typedef struct thash_data { #define INVALID_TR(hdata) (!(hdata)->p) #define INVALID_ENTRY(hcb, hdata) INVALID_VHPT(hdata) +static inline u64 thash_translate(thash_data_t *hdata, u64 vadr) +{ + int ps = hdata->ps; + return (hdata->ppn >> (ps - 12) << ps) | (vadr & ((1UL << ps) - 1)); +} typedef struct thash_cb { /* THASH base information */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |