From patchwork Fri Sep 23 18:53:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9348603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BB8E607D0 for ; Fri, 23 Sep 2016 18:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 074792AD64 for ; Fri, 23 Sep 2016 18:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F00152AD73; Fri, 23 Sep 2016 18:55:50 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C33B32AD64 for ; Fri, 23 Sep 2016 18:55:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnVbG-0005Zp-8X; Fri, 23 Sep 2016 18:53:30 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnVbF-0005ZL-RM for xen-devel@lists.xen.org; Fri, 23 Sep 2016 18:53:29 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 13/1E-12614-92A75E75; Fri, 23 Sep 2016 18:53:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHIsWRWlGSWpSXmKPExsXiVRvkpKtR9TT c4OgTSYslHxezODB6HN39mymAMYo1My8pvyKBNeNbm13BVNWKxU/2szYwbpboYuTiEBKYwCjx Y/EfZhCHReAli8Tyif9YQRwJgX5WiY9b2hi7GDmBnBiJecuuskHY1RJnVk4AiwsJqEucfreDD WLUdCaJU/8nMoMk2ARMJPb+ecAEYosISEtc+3wZrIFZwFfi5s7jYHFhAT+Jzs57QNs4gFarSi z8FQAS5hXwkLiwYTELxC45iZvnOsFGcgp4Smzs38AEsddD4se+f+wTGAUWMDKsYlQvTi0qSy3 SNdRLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAgMq3oGBsYdjE29zocYJTmYlER5 ldyehgvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4HUwAMoJFqWmp1akZeYAAxwmLcHBoyTCe7cCK M1bXJCYW5yZDpE6xajLsWXqvbVMQix5+XmpUuK8s0CKBECKMkrz4EbAou0So6yUMC8jAwODEE 9BalFuZgmq/CtGcQ5GJWHeSyBTeDLzSuA2vQI6ggnoiG93noAcUZKIkJJqYNST+Xz/zBv2Req +R1//V2aRfyRi4hR3/9+F7HdOHWu9y7c/2iefWZ55OX1L0MsjtlejimtdXnxNev/oXNQ+GT1+ vcfbfjaW/9rT5yyTWeBVmJuSt7NZkXN3+5ZDuS/c49e37mLblfm412BNztFvfRrbhFyT9F+0P fxTu3bRkRoRhcPSu778XaLEUpyRaKjFXFScCABVSxoxsQIAAA== X-Env-Sender: edgar.iglesias@gmail.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1474656808!44015823!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25425 invoked from network); 23 Sep 2016 18:53:28 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-10.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Sep 2016 18:53:28 -0000 Received: by mail-wm0-f66.google.com with SMTP id w84so4130033wmg.0 for ; Fri, 23 Sep 2016 11:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sHkOAMQfozvjVwffSIE6uKZn5Pt/bVwQ7lVqIgBWFfs=; b=fLjT36p2VMAYCm7jW3sITDr8VFHWy2pYmTCt6iPbSR/gNOFokpEsUHb9+lPRhUUYcz sVl2rZKj7B9GYFZFYp41GLWKYOiCP/u7/8OzWZ4lIgNTuZ/2qvIF599KZeSj6ZEQVRq5 yeI5sjYjGiJPJFAMgiguAc4xICzaDd6OjI8eT/GYWX9LKgch7HIpIyhJ+nxayrbHwF8e axBZ0l8+hAnd3nNHUKDR2S0rY6PM3LAOE3273VccYNXsVlD8xaAOwjh5REKs/FhG1GLK DsDVkfPijubF2J5ymmZwFqug/Ua9s9CbtVfVVTO/B9SzKwB8i0iabwBca7eDUt9/sueS WENA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sHkOAMQfozvjVwffSIE6uKZn5Pt/bVwQ7lVqIgBWFfs=; b=Bjrt1Qo/xNZjaezwtXfEHIehrGld5zX0vWdma9Ig46JB80Mmc3a2eAVT6tXDpRZn00 D+qKV5tcXx19sRwZRT7QUoLx1nWvGcIKGI3GY6dotDlS5TIvuakT7148TYDFsXJa58Oj my1vslNXfi8jIzmFAh8QCktYUACgn+QupoI4cvWeznyYJicr+ZNjKpfkG4LVANE6iDnt wWvOGMREYHEehf+nuGHzb0RK55LmIKWF/udJK70EwChotCwaLhRashrwMrF7DgTXlYh1 nSE7Yeq9WQtmvKfeVSU3XCdCUyvBG0G5XH1O7Py6K/fnK55GiS5hwP5C0/svVZ5+M3bo OoSw== X-Gm-Message-State: AE9vXwM0OQ6A7MVqGBitwu+zj/hHmFm4Y2trXB8SEo/SBKMPaT2sG8r/dwoCUazswpuYTQ== X-Received: by 10.194.238.42 with SMTP id vh10mr8178357wjc.111.1474656808007; Fri, 23 Sep 2016 11:53:28 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id xy4sm8545908wjc.2.2016.09.23.11.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Sep 2016 11:53:27 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xen.org Date: Fri, 23 Sep 2016 20:53:18 +0200 Message-Id: <1474656802-24081-4-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474656802-24081-1-git-send-email-edgar.iglesias@gmail.com> References: <1474656802-24081-1-git-send-email-edgar.iglesias@gmail.com> Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [PATCH v4 3/7] xen/arm: Rename and generalize un/map_regions_rw_cache X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Rename and generalize un/map_regions_rw_cache into un/map_regions_p2mt. The new functions take the mapping attributes as an argument. No functional change. Signed-off-by: Edgar E. Iglesias Acked-by: Julien Grall --- xen/arch/arm/domain_build.c | 18 ++++++++++-------- xen/arch/arm/p2m.c | 19 ++++++++++--------- xen/include/asm-arm/p2m.h | 23 ++++++++++++++--------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 35ab08d..f022342 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1518,10 +1518,11 @@ 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_rw_cache(d, - _gfn(paddr_to_pfn(addr)), - DIV_ROUND_UP(size, PAGE_SIZE), - _mfn(paddr_to_pfn(addr))); + res = map_regions_p2mt(d, + _gfn(paddr_to_pfn(addr)), + DIV_ROUND_UP(size, PAGE_SIZE), + _mfn(paddr_to_pfn(addr)), + p2m_mmio_direct_c); if ( res ) { panic(XENLOG_ERR "Unable to map ACPI region 0x%"PRIx64 @@ -1874,10 +1875,11 @@ static int 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_regions_rw_cache(d, - _gfn(paddr_to_pfn(d->arch.efi_acpi_gpa)), - PFN_UP(d->arch.efi_acpi_len), - _mfn(paddr_to_pfn(virt_to_maddr(d->arch.efi_acpi_table)))); + rc = map_regions_p2mt(d, + _gfn(paddr_to_pfn(d->arch.efi_acpi_gpa)), + PFN_UP(d->arch.efi_acpi_len), + _mfn(paddr_to_pfn(virt_to_maddr(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/p2m.c b/xen/arch/arm/p2m.c index 9912658..8e7eb68 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1235,18 +1235,19 @@ static inline int p2m_remove_mapping(struct domain *d, 0, p2m_invalid, d->arch.p2m.default_access); } -int map_regions_rw_cache(struct domain *d, - gfn_t gfn, - unsigned long nr, - mfn_t mfn) +int map_regions_p2mt(struct domain *d, + gfn_t gfn, + unsigned long nr, + mfn_t mfn, + p2m_type_t p2mt) { - return p2m_insert_mapping(d, gfn, nr, mfn, p2m_mmio_direct_c); + return p2m_insert_mapping(d, gfn, nr, mfn, p2mt); } -int unmap_regions_rw_cache(struct domain *d, - gfn_t gfn, - unsigned long nr, - mfn_t mfn) +int unmap_regions_p2mt(struct domain *d, + gfn_t gfn, + unsigned long nr, + mfn_t mfn) { return p2m_remove_mapping(d, gfn, nr, mfn); } diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 9708fdc..a684ed0 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -167,15 +167,20 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t); /* Clean & invalidate caches corresponding to a region of guest address space */ int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr); -int map_regions_rw_cache(struct domain *d, - gfn_t gfn, - unsigned long nr, - mfn_t mfn); - -int unmap_regions_rw_cache(struct domain *d, - gfn_t gfn, - unsigned long nr, - mfn_t mfn); +/* + * Map a region in the guest p2m with a specific p2m type. + * The memory attributes will be derived from the p2m type. + */ +int map_regions_p2mt(struct domain *d, + gfn_t gfn, + unsigned long nr, + mfn_t mfn, + p2m_type_t p2mt); + +int unmap_regions_p2mt(struct domain *d, + gfn_t gfn, + unsigned long nr, + mfn_t mfn); int map_dev_mmio_region(struct domain *d, gfn_t gfn,