[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 15/24] xen/arm: Use the newly introduced MFN <-> MADDR and GFN <-> MADDR helpers
Replace the following constructions: - _gfn(paddr_to_pfn(...)) => gaddr_to_gfn(...) - _mfn(paddr_to_pfn(...)) => maddr_to_mfn(...) - pfn_to_paddr(mfn_x(...)) => mfn_to_maddr(...) - pfn_to_paddr(gfn_x(...)) => gfn_to_gaddr(...) - _mfn(... >> PAGE_SHIFT) => maddr_to_mfn(...) Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> --- xen/arch/arm/domain_build.c | 12 ++++++------ xen/arch/arm/gic-v2.c | 4 ++-- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 10 +++++----- xen/arch/arm/mm.c | 14 +++++++------- xen/arch/arm/p2m.c | 10 +++++----- xen/arch/arm/platforms/exynos5.c | 8 ++++---- xen/arch/arm/platforms/omap5.c | 16 ++++++++-------- xen/arch/arm/traps.c | 14 +++++++------- xen/arch/arm/vgic-v2.c | 4 ++-- 10 files changed, 47 insertions(+), 47 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index a3243bdb5d..c6776d76fc 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1007,9 +1007,9 @@ static int map_range_to_domain(const struct dt_device_node *dev, if ( need_mapping ) { res = map_regions_p2mt(d, - _gfn(paddr_to_pfn(addr)), + gaddr_to_gfn(addr), PFN_UP(len), - _mfn(paddr_to_pfn(addr)), + maddr_to_mfn(addr), mr_data->p2mt); if ( res < 0 ) @@ -1544,9 +1544,9 @@ static void acpi_map_other_tables(struct domain *d) addr = acpi_gbl_root_table_list.tables[i].address; size = acpi_gbl_root_table_list.tables[i].length; res = map_regions_p2mt(d, - _gfn(paddr_to_pfn(addr)), + gaddr_to_gfn(addr), PFN_UP(size), - _mfn(paddr_to_pfn(addr)), + maddr_to_mfn(addr), p2m_mmio_direct_c); if ( res ) { @@ -1901,7 +1901,7 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) /* Map the EFI and ACPI tables to Dom0 */ rc = map_regions_p2mt(d, - _gfn(paddr_to_pfn(d->arch.efi_acpi_gpa)), + gaddr_to_gfn(d->arch.efi_acpi_gpa), PFN_UP(d->arch.efi_acpi_len), _mfn(virt_to_mfn(d->arch.efi_acpi_table)), p2m_mmio_direct_c); @@ -2014,7 +2014,7 @@ static void initrd_load(struct kernel_info *kinfo) return; } - dst = map_domain_page(_mfn(paddr_to_pfn(ma))); + dst = map_domain_page(maddr_to_mfn(ma)); copy_from_paddr(dst + s, paddr + offs, l); diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 0482b1fe32..5bf7d35a7e 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -597,9 +597,9 @@ static int gicv2_map_hwdown_extra_mappings(struct domain *d) d->domain_id, v2m_data->addr, v2m_data->size, v2m_data->spi_start, v2m_data->nr_spis); - ret = map_mmio_regions(d, _gfn(paddr_to_pfn(v2m_data->addr)), + ret = map_mmio_regions(d, gaddr_to_gfn(v2m_data->addr), PFN_UP(v2m_data->size), - _mfn(paddr_to_pfn(v2m_data->addr))); + maddr_to_mfn(v2m_data->addr)); if ( ret ) { printk(XENLOG_ERR "GICv2: Map v2m frame to d%d failed.\n", diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 0ed8b6005c..1b32d55284 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -183,7 +183,7 @@ static void kernel_zimage_load(struct kernel_info *info) return; } - dst = map_domain_page(_mfn(paddr_to_pfn(ma))); + dst = map_domain_page(maddr_to_mfn(ma)); copy_from_paddr(dst + s, paddr + offs, l); diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c index 04b1506b00..bcf49f5c15 100644 --- a/xen/arch/arm/mem_access.c +++ b/xen/arch/arm/mem_access.c @@ -113,7 +113,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, if ( rc < 0 ) goto err; - gfn = _gfn(paddr_to_pfn(ipa)); + gfn = gaddr_to_gfn(ipa); /* * We do this first as this is faster in the default case when no @@ -203,7 +203,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec) if ( !p2m->mem_access_enabled ) return true; - rc = p2m_get_mem_access(v->domain, _gfn(paddr_to_pfn(gpa)), &xma); + rc = p2m_get_mem_access(v->domain, gaddr_to_gfn(gpa), &xma); if ( rc ) return true; @@ -245,13 +245,13 @@ bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec) /* First, handle rx2rw and n2rwx conversion automatically. */ if ( npfec.write_access && xma == XENMEM_access_rx2rw ) { - rc = p2m_set_mem_access(v->domain, _gfn(paddr_to_pfn(gpa)), 1, + rc = p2m_set_mem_access(v->domain, gaddr_to_gfn(gpa), 1, 0, ~0, XENMEM_access_rw, 0); return false; } else if ( xma == XENMEM_access_n2rwx ) { - rc = p2m_set_mem_access(v->domain, _gfn(paddr_to_pfn(gpa)), 1, + rc = p2m_set_mem_access(v->domain, gaddr_to_gfn(gpa), 1, 0, ~0, XENMEM_access_rwx, 0); } @@ -273,7 +273,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec) { /* A listener is not required, so clear the access * restrictions. */ - rc = p2m_set_mem_access(v->domain, _gfn(paddr_to_pfn(gpa)), 1, + rc = p2m_set_mem_access(v->domain, gaddr_to_gfn(gpa), 1, 0, ~0, XENMEM_access_rwx, 0); } } diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index f5df669d92..0014c24ecc 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -315,7 +315,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) break; } - ASSERT(!(pfn_to_paddr(mfn_x(mfn)) & ~PADDR_MASK)); + ASSERT(!(mfn_to_maddr(mfn) & ~PADDR_MASK)); e.pt.base = mfn_x(mfn); @@ -536,8 +536,8 @@ void __init arch_init_memory(void) static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; - unsigned long mfn = ma >> PAGE_SHIFT; - return mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); + + return mfn_to_xen_entry(maddr_to_mfn(ma), WRITEALLOC); } /* Map the FDT in the early boot page table */ @@ -646,7 +646,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Initialise xen second level entries ... */ /* ... Xen's text etc */ - pte = mfn_to_xen_entry(_mfn(xen_paddr>>PAGE_SHIFT), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); pte.pt.xn = 0;/* Contains our text mapping! */ xen_second[second_table_offset(XEN_VIRT_START)] = pte; @@ -663,7 +663,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* ... Boot Misc area for xen relocation */ dest_va = BOOT_RELOC_VIRT_START; - pte = mfn_to_xen_entry(_mfn(xen_paddr >> PAGE_SHIFT), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); /* Map the destination in xen_second. */ xen_second[second_table_offset(dest_va)] = pte; /* Map the destination in boot_second. */ @@ -690,11 +690,11 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Break up the Xen mapping into 4k pages and protect them separately. */ for ( i = 0; i < LPAE_ENTRIES; i++ ) { - unsigned long mfn = paddr_to_pfn(xen_paddr) + i; + mfn_t mfn = mfn_add(maddr_to_mfn(xen_paddr), i); unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT); if ( !is_kernel(va) ) break; - pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); + pte = mfn_to_xen_entry(mfn, WRITEALLOC); pte.pt.table = 1; /* 4k mappings always have this bit set */ if ( is_kernel_text(va) || is_kernel_inittext(va) ) { diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index b7bbea1d81..266d1c3bd6 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -311,7 +311,7 @@ mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, p2m_type_t *t, p2m_access_t *a, unsigned int *page_order) { - paddr_t addr = pfn_to_paddr(gfn_x(gfn)); + paddr_t addr = gfn_to_gaddr(gfn); unsigned int level = 0; lpae_t entry, *table; int rc; @@ -542,7 +542,7 @@ static lpae_t mfn_to_p2m_entry(mfn_t mfn, p2m_type_t t, p2m_access_t a) p2m_set_permission(&e, t, a); - ASSERT(!(pfn_to_paddr(mfn_x(mfn)) & ~PADDR_MASK)); + ASSERT(!(mfn_to_maddr(mfn) & ~PADDR_MASK)); e.p2m.base = mfn_x(mfn); @@ -803,7 +803,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m, p2m_type_t t, p2m_access_t a) { - paddr_t addr = pfn_to_paddr(gfn_x(sgfn)); + paddr_t addr = gfn_to_gaddr(sgfn); unsigned int level = 0; unsigned int target = 3 - (page_order / LPAE_SHIFT); lpae_t *entry, *table, orig_pte; @@ -1440,10 +1440,10 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, if ( rc ) goto err; - if ( !mfn_valid(_mfn(maddr >> PAGE_SHIFT)) ) + if ( !mfn_valid(maddr_to_mfn(maddr)) ) goto err; - page = mfn_to_page(maddr >> PAGE_SHIFT); + page = mfn_to_page(mfn_x(maddr_to_mfn(maddr))); ASSERT(page); if ( unlikely(!get_page(page, d)) ) diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c index 492cd3e11f..2ae5fa66e0 100644 --- a/xen/arch/arm/platforms/exynos5.c +++ b/xen/arch/arm/platforms/exynos5.c @@ -82,12 +82,12 @@ static int exynos5_init_time(void) static int exynos5250_specific_mapping(struct domain *d) { /* Map the chip ID */ - map_mmio_regions(d, _gfn(paddr_to_pfn(EXYNOS5_PA_CHIPID)), 1, - _mfn(paddr_to_pfn(EXYNOS5_PA_CHIPID))); + map_mmio_regions(d, gaddr_to_gfn(EXYNOS5_PA_CHIPID), 1, + maddr_to_mfn(EXYNOS5_PA_CHIPID)); /* Map the PWM region */ - map_mmio_regions(d, _gfn(paddr_to_pfn(EXYNOS5_PA_TIMER)), 2, - _mfn(paddr_to_pfn(EXYNOS5_PA_TIMER))); + map_mmio_regions(d, gaddr_to_gfn(EXYNOS5_PA_TIMER), 2, + maddr_to_mfn(EXYNOS5_PA_TIMER)); return 0; } diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c index eadc4f8382..1e1f9fa970 100644 --- a/xen/arch/arm/platforms/omap5.c +++ b/xen/arch/arm/platforms/omap5.c @@ -101,20 +101,20 @@ static int omap5_init_time(void) static int omap5_specific_mapping(struct domain *d) { /* Map the PRM module */ - map_mmio_regions(d, _gfn(paddr_to_pfn(OMAP5_PRM_BASE)), 2, - _mfn(paddr_to_pfn(OMAP5_PRM_BASE))); + map_mmio_regions(d, gaddr_to_gfn(OMAP5_PRM_BASE), 2, + maddr_to_mfn(OMAP5_PRM_BASE)); /* Map the PRM_MPU */ - map_mmio_regions(d, _gfn(paddr_to_pfn(OMAP5_PRCM_MPU_BASE)), 1, - _mfn(paddr_to_pfn(OMAP5_PRCM_MPU_BASE))); + map_mmio_regions(d, gaddr_to_gfn(OMAP5_PRCM_MPU_BASE), 1, + maddr_to_mfn(OMAP5_PRCM_MPU_BASE)); /* Map the Wakeup Gen */ - map_mmio_regions(d, _gfn(paddr_to_pfn(OMAP5_WKUPGEN_BASE)), 1, - _mfn(paddr_to_pfn(OMAP5_WKUPGEN_BASE))); + map_mmio_regions(d, gaddr_to_gfn(OMAP5_WKUPGEN_BASE), 1, + maddr_to_mfn(OMAP5_WKUPGEN_BASE)); /* Map the on-chip SRAM */ - map_mmio_regions(d, _gfn(paddr_to_pfn(OMAP5_SRAM_PA)), 32, - _mfn(paddr_to_pfn(OMAP5_SRAM_PA))); + map_mmio_regions(d, gaddr_to_gfn(OMAP5_SRAM_PA), 32, + maddr_to_mfn(OMAP5_SRAM_PA)); return 0; } diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index ce19021f01..c07999b518 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2481,12 +2481,12 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr) uint32_t *first = NULL, *second = NULL; mfn_t mfn; - mfn = gfn_to_mfn(d, _gfn(paddr_to_pfn(ttbr0))); + mfn = gfn_to_mfn(d, gaddr_to_gfn(ttbr0)); printk("dom%d VA 0x%08"PRIvaddr"\n", d->domain_id, addr); printk(" TTBCR: 0x%08"PRIregister"\n", ttbcr); printk(" TTBR0: 0x%016"PRIx64" = 0x%"PRIpaddr"\n", - ttbr0, pfn_to_paddr(mfn_x(mfn))); + ttbr0, mfn_to_maddr(mfn)); if ( ttbcr & TTBCR_EAE ) { @@ -2508,12 +2508,12 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr) offset = addr >> (12+8); printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n", - offset, pfn_to_paddr(mfn_x(mfn)), first[offset]); + offset, mfn_to_maddr(mfn), first[offset]); if ( !(first[offset] & 0x1) || (first[offset] & 0x2) ) goto done; - mfn = gfn_to_mfn(d, _gfn(paddr_to_pfn(first[offset]))); + mfn = gfn_to_mfn(d, gaddr_to_gfn(first[offset])); if ( mfn_eq(mfn, INVALID_MFN) ) { @@ -2523,7 +2523,7 @@ void dump_guest_s1_walk(struct domain *d, vaddr_t addr) second = map_domain_page(mfn); offset = (addr >> 12) & 0x3FF; printk("2ND[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n", - offset, pfn_to_paddr(mfn_x(mfn)), second[offset]); + offset, mfn_to_maddr(mfn), second[offset]); done: if (second) unmap_domain_page(second); @@ -2759,11 +2759,11 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, * with the Stage-2 page table. Walk the Stage-2 PT to check * if the entry exists. If it's the case, return to the guest */ - mfn = gfn_to_mfn(current->domain, _gfn(paddr_to_pfn(info.gpa))); + mfn = gfn_to_mfn(current->domain, gaddr_to_gfn(info.gpa)); if ( !mfn_eq(mfn, INVALID_MFN) ) return; - if ( try_map_mmio(_gfn(paddr_to_pfn(info.gpa))) ) + if ( try_map_mmio(gaddr_to_gfn(info.gpa)) ) return; break; diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index dc9f95b948..e5cfa33d8a 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -686,8 +686,8 @@ static int vgic_v2_domain_init(struct domain *d) * Map the gic virtual cpu interface in the gic cpu interface * region of the guest. */ - ret = map_mmio_regions(d, _gfn(paddr_to_pfn(cbase)), csize / PAGE_SIZE, - _mfn(paddr_to_pfn(vbase))); + ret = map_mmio_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE, + maddr_to_mfn(vbase)); if ( ret ) return ret; -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |