From patchwork Sun May 17 20:03:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48653 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E2C621411 for ; Sun, 17 May 2015 20:07:09 +0000 (UTC) Received: by wiz9 with SMTP id 9sf15345504wiz.3 for ; Sun, 17 May 2015 13:07:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=+94lY72LbDftam1Du5W0hxcWlCHueCym0rEcuQvSYN8=; b=fxdTN7zGOTY8tW9ZdArvt29FpCjPuY4PgVY13HFitt07gKImmXYXeAJjxx+CPPlBhK /DKYPY/8DwnN875d+t7uKGxigzdcGSCWjNFR/uO4dtiklWcDGwag7yiqTXgUhmaQP1Hi T67WoR8FO+ud0w5no/SQBbxaqMIZQRg36yDiHo0n4Ld3GQAxlNqAuaJu8VLBuA0ydCw9 8J8o/VN1bDgclqZQRBplVr/V6GxQm73tnja2a0LQynXPkylTjd4oaJd2ADEfQyvew++C qe0cS9HrM6TEnshZLH1pdeZ+ceSZW0YtX8HcRFqwfBqwupOg3wGY83gqdCX8yuClhurg 7Nsw== X-Gm-Message-State: ALoCoQn+EPVZ39ncS0SX0D2HautPFjV2jKCVYIpANRUm1C5Th9iPZq37RM+mPtuIYpX6M/ZV4JtP X-Received: by 10.180.106.10 with SMTP id gq10mr7296066wib.0.1431893228560; Sun, 17 May 2015 13:07:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.129 with SMTP id m1ls623546laf.76.gmail; Sun, 17 May 2015 13:07:08 -0700 (PDT) X-Received: by 10.112.161.40 with SMTP id xp8mr12843110lbb.71.1431893228403; Sun, 17 May 2015 13:07:08 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id sc4si5329902lbb.99.2015.05.17.13.07.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:07:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lagr1 with SMTP id r1so109752669lag.0 for ; Sun, 17 May 2015 13:07:08 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr14806582lbb.36.1431893228289; Sun, 17 May 2015 13:07:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3508175lbb; Sun, 17 May 2015 13:07:07 -0700 (PDT) X-Received: by 10.140.150.78 with SMTP id 75mr741954qhw.10.1431893226920; Sun, 17 May 2015 13:07:06 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id f50si1894898qgf.106.2015.05.17.13.07.06 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:07:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4pE-000350-Lz; Sun, 17 May 2015 20:06:16 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4pD-00032b-AA for xen-devel@lists.xen.org; Sun, 17 May 2015 20:06:15 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id BE/31-03195-6B4F8555; Sun, 17 May 2015 20:06:14 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1431893172!11111414!1 X-Originating-IP: [209.85.220.45] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3737 invoked from network); 17 May 2015 20:06:13 -0000 Received: from mail-pa0-f45.google.com (HELO mail-pa0-f45.google.com) (209.85.220.45) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:06:13 -0000 Received: by pacwv17 with SMTP id wv17so119773616pac.2 for ; Sun, 17 May 2015 13:06:11 -0700 (PDT) X-Received: by 10.66.102.67 with SMTP id fm3mr37526866pab.25.1431893171851; Sun, 17 May 2015 13:06:11 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.06.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:06:11 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:33:54 +0530 Message-Id: <1431893048-5214-28-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> Cc: keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 27/41] arm : add helper functions to map memory regions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: parth.dixit@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: creates a helper function for mapping with cached attributes Signed-off-by: Parth Dixit --- xen/arch/arm/p2m.c | 26 ++++++++++++++++++++++++++ xen/include/asm-arm/p2m.h | 10 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 903fa3f..fcb8116 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1140,6 +1140,32 @@ int p2m_populate_ram(struct domain *d, d->arch.p2m.default_access); } +int map_regions(struct domain *d, + unsigned long start_gfn, + unsigned long nr, + unsigned long mfn) +{ + return apply_p2m_changes(d, INSERT, + pfn_to_paddr(start_gfn), + pfn_to_paddr(start_gfn + nr), + pfn_to_paddr(mfn), + MATTR_MEM, 0, p2m_mmio_direct, + d->arch.p2m.default_access); +} + +int unmap_regions(struct domain *d, + unsigned long start_gfn, + unsigned long nr, + unsigned long mfn) +{ + return apply_p2m_changes(d, REMOVE, + pfn_to_paddr(start_gfn), + pfn_to_paddr(start_gfn + nr), + pfn_to_paddr(mfn), + MATTR_MEM, 0, p2m_invalid, + d->arch.p2m.default_access); +} + int map_mmio_regions(struct domain *d, unsigned long start_gfn, unsigned long nr, diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 63748ef..5436ae7 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -152,6 +152,16 @@ int p2m_cache_flush(struct domain *d, xen_pfn_t start_mfn, xen_pfn_t end_mfn); /* Setup p2m RAM mapping for domain d from start-end. */ int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end); +int map_regions(struct domain *d, + unsigned long start_gfn, + unsigned long nr_mfns, + unsigned long mfn); + +int unmap_regions(struct domain *d, + unsigned long start_gfn, + unsigned long nr_mfns, + unsigned long mfn); + int guest_physmap_add_entry(struct domain *d, unsigned long gfn, unsigned long mfn,