From patchwork Wed Jul 20 16:10:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72437 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp66334qga; Wed, 20 Jul 2016 09:13:58 -0700 (PDT) X-Received: by 10.107.131.170 with SMTP id n42mr45727981ioi.126.1469031238596; Wed, 20 Jul 2016 09:13:58 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y195si2544226iof.181.2016.07.20.09.13.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 09:13:58 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPu5z-0007eI-7T; Wed, 20 Jul 2016 16:11:39 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPu5x-0007ZF-IY for xen-devel@lists.xen.org; Wed, 20 Jul 2016 16:11:37 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 2D/FB-20915-9B2AF875; Wed, 20 Jul 2016 16:11:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTXfHov5 wg+5V+hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bHpwtZC14IV/SfOcLewNjP38XIxSEksIlR 4vL1LewQzmlGiZszZjN1MXJysAloStz5/AnMFhGQlrj2+TIjSBGzQDujxPKN/1hAEsICQRKbG r6ygtgsAqoSb7d1soHYvAKuEq8/v2MEsSUE5CROHpsMVsMJFD9/8idYXEjARWLT22/MExi5Fz AyrGLUKE4tKkst0jU000sqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECPQxAxDsYFy 13fMQoyQHk5Ior6pob7gQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCV6phf3hQoJFqempFWmZOcBg g0lLcPAoifBygaR5iwsSc4sz0yFSpxgVpcR53UESAiCJjNI8uDZYgF9ilJUS5mUEOkSIpyC1K DezBFX+FaM4B6OSMG8ryBSezLwSuOmvgBYzAS2eIwC2uCQRISXVwFi36evm4B3hz+5MubewPT B1H/+b+DtBTw5+v94m+vFhz6w0p5/SjOyWC03iKs85WEaYbRe8tfMEg2Ta3H2qYlLtq2XSVa3 38Ubqf/FfdF9Y/yZnkINGlcYhn6BnqTE6S4/L/i4XCVwpeip571ufPSufPrlQ93pSpcoHq0KN t1MOnOLKYL8bEK/EUpyRaKjFXFScCAC3ZgpDawIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1469031096!47639191!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7961 invoked from network); 20 Jul 2016 16:11:36 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-31.messagelabs.com with SMTP; 20 Jul 2016 16:11:36 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 94D2BBBC; Wed, 20 Jul 2016 09:12:46 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5EA43F387; Wed, 20 Jul 2016 09:11:34 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 20 Jul 2016 17:10:52 +0100 Message-Id: <1469031064-23344-11-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469031064-23344-1-git-send-email-julien.grall@arm.com> References: <1469031064-23344-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, wei.chen@linaro.org, steve.capper@arm.com Subject: [Xen-devel] [PATCH 10/22] xen/arm: p2m: Differentiate cacheable vs non-cacheable MMIO 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" Currently, the p2m type p2m_mmio_direct is used to map in stage-2 cacheable MMIO (via map_regions_rw_cache) and non-cacheable one (via map_mmio_regions). The p2m code is relying on the caller to give the correct memory attribute. In a follow-up patch, the p2m code will rely on the p2m type to find the correct memory attribute. In preparation of this, introduce p2m_mmio_direct_nc and p2m_mimo_direct_c to differentiate the cacheability of the MMIO. Signed-off-by: Julien Grall --- xen/arch/arm/p2m.c | 7 ++++--- xen/include/asm-arm/p2m.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 99be9be..999de2b 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -272,7 +272,8 @@ static void p2m_set_permission(lpae_t *e, p2m_type_t t, p2m_access_t a) case p2m_iommu_map_rw: case p2m_map_foreign: case p2m_grant_map_rw: - case p2m_mmio_direct: + case p2m_mmio_direct_nc: + case p2m_mmio_direct_c: e->p2m.xn = 1; e->p2m.write = 1; break; @@ -1195,7 +1196,7 @@ int map_regions_rw_cache(struct domain *d, mfn_t mfn) { return p2m_insert_mapping(d, gfn, nr, mfn, - MATTR_MEM, p2m_mmio_direct); + MATTR_MEM, p2m_mmio_direct_c); } int unmap_regions_rw_cache(struct domain *d, @@ -1212,7 +1213,7 @@ int map_mmio_regions(struct domain *d, mfn_t mfn) { return p2m_insert_mapping(d, start_gfn, nr, mfn, - MATTR_DEV, p2m_mmio_direct); + MATTR_DEV, p2m_mmio_direct_nc); } int unmap_mmio_regions(struct domain *d, diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 78d37ab..20a220ea 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -87,7 +87,8 @@ typedef enum { p2m_invalid = 0, /* Nothing mapped here */ p2m_ram_rw, /* Normal read/write guest RAM */ p2m_ram_ro, /* Read-only; writes are silently dropped */ - p2m_mmio_direct, /* Read/write mapping of genuine MMIO area */ + p2m_mmio_direct_nc, /* Read/write mapping of genuine MMIO area non-cacheable */ + p2m_mmio_direct_c, /* Read/write mapping of genuine MMIO area cacheable */ p2m_map_foreign, /* Ram pages from foreign domain */ p2m_grant_map_rw, /* Read/write grant mapping */ p2m_grant_map_ro, /* Read-only grant mapping */