From patchwork Tue Apr 30 21:02:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 10924185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 943E0933 for ; Tue, 30 Apr 2019 21:04:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D2128A21 for ; Tue, 30 Apr 2019 21:04:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78EC228A2E; Tue, 30 Apr 2019 21:04:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7DA3F28A22 for ; Tue, 30 Apr 2019 21:04:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLZu1-0007hH-16; Tue, 30 Apr 2019 21:03:01 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLZtz-0007fT-AQ for xen-devel@lists.xenproject.org; Tue, 30 Apr 2019 21:02:59 +0000 X-Inumbo-ID: 53b5f6fa-6b8b-11e9-9b5b-6b811832b473 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 53b5f6fa-6b8b-11e9-9b5b-6b811832b473; Tue, 30 Apr 2019 21:02:56 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 849FC21744; Tue, 30 Apr 2019 21:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556658175; bh=j6kJPk+WMrwDuJdbFuoWtwMssZHx+x0GH564Nr9L33A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejXYas6O5Uxh62SKfb7nkm1+U/CRdT77igQm84VtvzBDsMEZwnhKqx+v6cChm4i/O R/06uaTk1jdoJcO1KqKu9rFE1uytHNutxHdVvKn6pR7hGVr7i4YQML9GxJYoBb+EmB dhaKYYxSnkEzZUP93tNL35ZsA1biynfJQtb4rlsg= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 30 Apr 2019 14:02:44 -0700 Message-Id: <1556658172-8824-2-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v2 02/10] xen: rename un/map_mmio_regions to un/map_regions X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , julien.grall@arm.com, sstabellini@kernel.org, JBeulich@suse.com, andrew.cooper3@citrix.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that map_mmio_regions takes a p2mt parameter, there is no need to keep "mmio" in the name. The p2mt parameter does a better job at expressing what the mapping is about. Let's save the environment 5 characters at a time. Also fix the comment on top of map_mmio_regions. Signed-off-by: Stefano Stabellini CC: JBeulich@suse.com CC: andrew.cooper3@citrix.com --- Changes in v2: - new patch --- xen/arch/arm/acpi/domain_build.c | 20 ++++++++++---------- xen/arch/arm/domain_build.c | 10 +++++----- xen/arch/arm/gic-v2.c | 8 ++++---- xen/arch/arm/p2m.c | 18 +++++++++--------- xen/arch/arm/platforms/exynos5.c | 12 ++++++------ xen/arch/arm/platforms/omap5.c | 24 ++++++++++++------------ xen/arch/arm/traps.c | 2 +- xen/arch/arm/vgic-v2.c | 4 ++-- xen/arch/arm/vgic/vgic-v2.c | 4 ++-- xen/arch/x86/hvm/dom0_build.c | 6 +++--- xen/arch/x86/mm/p2m.c | 18 +++++++++--------- xen/common/domctl.c | 4 ++-- xen/drivers/vpci/header.c | 8 ++++---- xen/include/xen/p2m-common.h | 26 ++++++++++++++------------ 14 files changed, 83 insertions(+), 81 deletions(-) diff --git a/xen/arch/arm/acpi/domain_build.c b/xen/arch/arm/acpi/domain_build.c index f4ac91c..f107f5a 100644 --- a/xen/arch/arm/acpi/domain_build.c +++ b/xen/arch/arm/acpi/domain_build.c @@ -193,11 +193,11 @@ static void __init 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_mmio_regions(d, - gaddr_to_gfn(addr), - PFN_UP(size), - maddr_to_mfn(addr), - p2m_mmio_direct_c); + res = map_regions(d, + gaddr_to_gfn(addr), + PFN_UP(size), + maddr_to_mfn(addr), + p2m_mmio_direct_c); if ( res ) { panic(XENLOG_ERR "Unable to map ACPI region 0x%"PRIx64 @@ -547,11 +547,11 @@ int __init prepare_acpi(struct domain *d, struct kernel_info *kinfo) acpi_create_efi_mmap_table(d, &kinfo->mem, tbl_add); /* Map the EFI and ACPI tables to Dom0 */ - rc = map_mmio_regions(d, - gaddr_to_gfn(d->arch.efi_acpi_gpa), - PFN_UP(d->arch.efi_acpi_len), - virt_to_mfn(d->arch.efi_acpi_table), - p2m_mmio_direct_c); + rc = map_regions(d, + gaddr_to_gfn(d->arch.efi_acpi_gpa), + PFN_UP(d->arch.efi_acpi_len), + virt_to_mfn(d->arch.efi_acpi_table), + p2m_mmio_direct_c); if ( rc != 0 ) { printk(XENLOG_ERR "Unable to map EFI/ACPI table 0x%"PRIx64 diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 1f808b2..5e7f94c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1171,11 +1171,11 @@ static int __init map_range_to_domain(const struct dt_device_node *dev, if ( need_mapping ) { - res = map_mmio_regions(d, - gaddr_to_gfn(addr), - PFN_UP(len), - maddr_to_mfn(addr), - mr_data->p2mt); + res = map_regions(d, + gaddr_to_gfn(addr), + PFN_UP(len), + maddr_to_mfn(addr), + mr_data->p2mt); if ( res < 0 ) { diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index d2ef361..ad2b368 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -699,10 +699,10 @@ 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, gaddr_to_gfn(v2m_data->addr), - PFN_UP(v2m_data->size), - maddr_to_mfn(v2m_data->addr), - p2m_mmio_direct_dev); + ret = map_regions(d, gaddr_to_gfn(v2m_data->addr), + PFN_UP(v2m_data->size), + maddr_to_mfn(v2m_data->addr), + p2m_mmio_direct_dev); if ( ret ) { printk(XENLOG_ERR "GICv2: Map v2m frame to d%d failed.\n", diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index e44c932..d6529ca 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1331,19 +1331,19 @@ static inline int p2m_remove_mapping(struct domain *d, return rc; } -int map_mmio_regions(struct domain *d, - gfn_t gfn, - unsigned long nr, - mfn_t mfn, - p2m_type_t p2mt) +int map_regions(struct domain *d, + gfn_t gfn, + unsigned long nr, + mfn_t mfn, + p2m_type_t p2mt) { return p2m_insert_mapping(d, gfn, nr, mfn, p2mt); } -int unmap_mmio_regions(struct domain *d, - gfn_t start_gfn, - unsigned long nr, - mfn_t mfn) +int unmap_regions(struct domain *d, + gfn_t start_gfn, + unsigned long nr, + mfn_t mfn) { return p2m_remove_mapping(d, start_gfn, nr, mfn); } diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c index 97cd080..261526e 100644 --- a/xen/arch/arm/platforms/exynos5.c +++ b/xen/arch/arm/platforms/exynos5.c @@ -82,14 +82,14 @@ static int exynos5_init_time(void) static int exynos5250_specific_mapping(struct domain *d) { /* Map the chip ID */ - map_mmio_regions(d, gaddr_to_gfn(EXYNOS5_PA_CHIPID), 1, - maddr_to_mfn(EXYNOS5_PA_CHIPID), - p2m_mmio_direct_dev); + map_regions(d, gaddr_to_gfn(EXYNOS5_PA_CHIPID), 1, + maddr_to_mfn(EXYNOS5_PA_CHIPID), + p2m_mmio_direct_dev); /* Map the PWM region */ - map_mmio_regions(d, gaddr_to_gfn(EXYNOS5_PA_TIMER), 2, - maddr_to_mfn(EXYNOS5_PA_TIMER), - p2m_mmio_direct_dev); + map_regions(d, gaddr_to_gfn(EXYNOS5_PA_TIMER), 2, + maddr_to_mfn(EXYNOS5_PA_TIMER), + p2m_mmio_direct_dev); return 0; } diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c index c5701df..3575f6c 100644 --- a/xen/arch/arm/platforms/omap5.c +++ b/xen/arch/arm/platforms/omap5.c @@ -98,24 +98,24 @@ static int omap5_init_time(void) static int omap5_specific_mapping(struct domain *d) { /* Map the PRM module */ - map_mmio_regions(d, gaddr_to_gfn(OMAP5_PRM_BASE), 2, - maddr_to_mfn(OMAP5_PRM_BASE), - p2m_mmio_direct_dev); + map_regions(d, gaddr_to_gfn(OMAP5_PRM_BASE), 2, + maddr_to_mfn(OMAP5_PRM_BASE), + p2m_mmio_direct_dev); /* Map the PRM_MPU */ - map_mmio_regions(d, gaddr_to_gfn(OMAP5_PRCM_MPU_BASE), 1, - maddr_to_mfn(OMAP5_PRCM_MPU_BASE), - p2m_mmio_direct_dev); + map_regions(d, gaddr_to_gfn(OMAP5_PRCM_MPU_BASE), 1, + maddr_to_mfn(OMAP5_PRCM_MPU_BASE), + p2m_mmio_direct_dev); /* Map the Wakeup Gen */ - map_mmio_regions(d, gaddr_to_gfn(OMAP5_WKUPGEN_BASE), 1, - maddr_to_mfn(OMAP5_WKUPGEN_BASE), - p2m_mmio_direct_dev); + map_regions(d, gaddr_to_gfn(OMAP5_WKUPGEN_BASE), 1, + maddr_to_mfn(OMAP5_WKUPGEN_BASE), + p2m_mmio_direct_dev); /* Map the on-chip SRAM */ - map_mmio_regions(d, gaddr_to_gfn(OMAP5_SRAM_PA), 32, - maddr_to_mfn(OMAP5_SRAM_PA), - p2m_mmio_direct_dev); + map_regions(d, gaddr_to_gfn(OMAP5_SRAM_PA), 32, + maddr_to_mfn(OMAP5_SRAM_PA), + p2m_mmio_direct_dev); return 0; } diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index afae5a1..fee5517 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1887,7 +1887,7 @@ static bool try_map_mmio(gfn_t gfn) if ( !iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn) + 1) ) return false; - return !map_mmio_regions(d, gfn, 1, mfn, p2m_mmio_direct_c); + return !map_regions(d, gfn, 1, mfn, p2m_mmio_direct_c); } static void do_trap_stage2_abort_guest(struct cpu_user_regs *regs, diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index 1543625..f33c56a 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -690,8 +690,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, gaddr_to_gfn(cbase), csize / PAGE_SIZE, - maddr_to_mfn(vbase), p2m_mmio_direct_dev); + ret = map_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE, + maddr_to_mfn(vbase), p2m_mmio_direct_dev); if ( ret ) return ret; diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c index 04f34dd..b03af84 100644 --- a/xen/arch/arm/vgic/vgic-v2.c +++ b/xen/arch/arm/vgic/vgic-v2.c @@ -308,8 +308,8 @@ int vgic_v2_map_resources(struct domain *d) * Map the gic virtual cpu interface in the gic cpu interface * region of the guest. */ - ret = map_mmio_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE, - maddr_to_mfn(vbase), p2m_mmio_direct_dev); + ret = map_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE, + maddr_to_mfn(vbase), p2m_mmio_direct_dev); if ( ret ) { gdprintk(XENLOG_ERR, "Unable to remap VGIC CPU to VCPU\n"); diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index 84776fc..800faaa 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -80,10 +80,10 @@ static int __init modify_identity_mmio(struct domain *d, unsigned long pfn, for ( ; ; ) { if ( map ) - rc = map_mmio_regions(d, _gfn(pfn), nr_pages, _mfn(pfn), - p2m_mmio_direct); + rc = map_regions(d, _gfn(pfn), nr_pages, _mfn(pfn), + p2m_mmio_direct); else - rc = unmap_mmio_regions(d, _gfn(pfn), nr_pages, _mfn(pfn)); + rc = unmap_regions(d, _gfn(pfn), nr_pages, _mfn(pfn)); if ( rc == 0 ) break; if ( rc < 0 ) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index a72f012..d976ce9 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -2261,11 +2261,11 @@ static unsigned int mmio_order(const struct domain *d, #define MAP_MMIO_MAX_ITER 64 /* pretty arbitrary */ -int map_mmio_regions(struct domain *d, - gfn_t start_gfn, - unsigned long nr, - mfn_t mfn, - p2m_type_t p2mt) +int map_regions(struct domain *d, + gfn_t start_gfn, + unsigned long nr, + mfn_t mfn, + p2m_type_t p2mt) { int ret = 0; unsigned long i; @@ -2298,10 +2298,10 @@ int map_mmio_regions(struct domain *d, return i == nr ? 0 : i ?: ret; } -int unmap_mmio_regions(struct domain *d, - gfn_t start_gfn, - unsigned long nr, - mfn_t mfn) +int unmap_regions(struct domain *d, + gfn_t start_gfn, + unsigned long nr, + mfn_t mfn) { int ret = 0; unsigned long i; diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 18a0f8f..140f979 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -961,7 +961,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) "memory_map:add: dom%d gfn=%lx mfn=%lx nr=%lx\n", d->domain_id, gfn, mfn, nr_mfns); - ret = map_mmio_regions(d, _gfn(gfn), nr_mfns, _mfn(mfn), p2mt); + ret = map_regions(d, _gfn(gfn), nr_mfns, _mfn(mfn), p2mt); if ( ret < 0 ) printk(XENLOG_G_WARNING "memory_map:fail: dom%d gfn=%lx mfn=%lx nr=%lx ret:%ld\n", @@ -973,7 +973,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) "memory_map:remove: dom%d gfn=%lx mfn=%lx nr=%lx\n", d->domain_id, gfn, mfn, nr_mfns); - ret = unmap_mmio_regions(d, _gfn(gfn), nr_mfns, _mfn(mfn)); + ret = unmap_regions(d, _gfn(gfn), nr_mfns, _mfn(mfn)); if ( ret < 0 && is_hardware_domain(current->domain) ) printk(XENLOG_ERR "memory_map: error %ld removing dom%d access to [%lx,%lx]\n", diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index 6adfa55..7b25acc 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -46,15 +46,15 @@ static int map_range(unsigned long s, unsigned long e, void *data, /* * ARM TODOs: * - On ARM whether the memory is prefetchable or not should be passed - * to map_mmio_regions in order to decide which memory attributes + * to map_regions in order to decide which memory attributes * should be used. * - * - {un}map_mmio_regions doesn't support preemption. + * - {un}map_regions doesn't support preemption. */ - rc = map->map ? map_mmio_regions(map->d, _gfn(s), size, _mfn(s), + rc = map->map ? map_regions(map->d, _gfn(s), size, _mfn(s), p2m_mmio_direct) - : unmap_mmio_regions(map->d, _gfn(s), size, _mfn(s)); + : unmap_regions(map->d, _gfn(s), size, _mfn(s)); if ( rc == 0 ) { *c += size; diff --git a/xen/include/xen/p2m-common.h b/xen/include/xen/p2m-common.h index 69c82cc..728c9a4 100644 --- a/xen/include/xen/p2m-common.h +++ b/xen/include/xen/p2m-common.h @@ -8,18 +8,20 @@ int __must_check guest_physmap_remove_page(struct domain *d, gfn_t gfn, mfn_t mfn, unsigned int page_order); -/* Map MMIO regions in the p2m: start_gfn and nr describe the range in - * * the guest physical address space to map, starting from the machine - * * frame number mfn. */ -int map_mmio_regions(struct domain *d, - gfn_t start_gfn, - unsigned long nr, - mfn_t mfn, - p2m_type_t p2mt); -int unmap_mmio_regions(struct domain *d, - gfn_t start_gfn, - unsigned long nr, - mfn_t mfn); +/* + * Map memory regions in the p2m: start_gfn and nr describe the range in + * the guest physical address space to map, starting from the machine + * frame number mfn. + */ +int map_regions(struct domain *d, + gfn_t start_gfn, + unsigned long nr, + mfn_t mfn, + p2m_type_t p2mt); +int unmap_regions(struct domain *d, + gfn_t start_gfn, + unsigned long nr, + mfn_t mfn); /* * Populate-on-Demand