From patchwork Thu Jul 28 14:20:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72957 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp880372qga; Thu, 28 Jul 2016 07:24:17 -0700 (PDT) X-Received: by 10.107.186.2 with SMTP id k2mr45091476iof.119.1469715855313; Thu, 28 Jul 2016 07:24:15 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 187si13343913iov.29.2016.07.28.07.24.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 07:24:15 -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 1bSmAr-00078P-H8; Thu, 28 Jul 2016 14:20:33 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmAp-000775-OA for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:20:31 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 3F/91-23620-FA41A975; Thu, 28 Jul 2016 14:20:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXe9yKx wg+c3WSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1owbV28yF9wVqfi5K6GB8TV/FyMXh5DAJkaJ ixc/MncxcgI5pxklrs/gBLHZBDQl7nz+xARiiwhIS1z7fJkRpIFZoJ1RYm1/L1iDsECoxL2Z/ SwgNouAqsSvt91gcV4BZ4k7y96CNUsIyEmcPDaZFcTmFHCRuNf2nRVimbPE6bvb2Scwci9gZF jFqFGcWlSWWqRrbKCXVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iRHo33oGBsYdjJ0 n/A4xSnIwKYnyhoXODBfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwesmPCtcSLAoNT21Ii0zBxho MGkJDh4lEd5IkDRvcUFibnFmOkTqFKOilDhvLkhCACSRUZoH1wYL7kuMslLCvIwMDAxCPAWpR bmZJajyrxjFORiVhCGm8GTmlcBNfwW0mAlocXHsDJDFJYkIKakGRoUsd+euIOUPDPXfZxzQk9 4T+/kPc8L7+9+unZKba5FqLBb0jMOsqtbLvfx06DEuqW8T7Ba/P8h3KHV9t02dfHmoX1GH0Gs 2JS2O2uI261NhGtdvM7J47uF6zOD+cLGG2+Il12rfymRwMDmWP7J+/Gb6xUPZt+LL80JU9KeH /01c5yV6sStaiaU4I9FQi7moOBEAkEu1k2kCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1469715630!52896590!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 17314 invoked from network); 28 Jul 2016 14:20:30 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-31.messagelabs.com with SMTP; 28 Jul 2016 14:20:30 -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 6BD4FAB4; Thu, 28 Jul 2016 07:21:47 -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 3CD9F3F21A; Thu, 28 Jul 2016 07:20:29 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:20:08 +0100 Message-Id: <1469715620-4670-4-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469715620-4670-1-git-send-email-julien.grall@arm.com> References: <1469715620-4670-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 03/15] 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 Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- 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 851b110..cffb12e 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; @@ -1194,7 +1195,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, @@ -1211,7 +1212,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 */