From patchwork Tue Jul 12 13:59:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 71847 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp493024qga; Tue, 12 Jul 2016 07:03:52 -0700 (PDT) X-Received: by 10.107.35.129 with SMTP id j123mr3396857ioj.4.1468332222789; Tue, 12 Jul 2016 07:03:42 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r84si3021758itd.16.2016.07.12.07.03.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 07:03:42 -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 1bMyEC-00079x-MU; Tue, 12 Jul 2016 14:00:00 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMyEB-00078Z-Jc for xen-devel@lists.xen.org; Tue, 12 Jul 2016 13:59:59 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 00/7D-03032-ED7F4875; Tue, 12 Jul 2016 13:59:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTffe95Z wg7+fZS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyz39QLpghUPLlxn7WB8TB3FyMXh5DAJkaJ Yx/+skI4pxkl+n/+ZOti5ORgE9CUuPP5ExOILSIgLXHt82VGEJtZIFPi0txfzCC2sECCxIr+J 2A2i4CqxJRnb8BqeAVcJD5f/M4KYksIyEmcPDYZzOYUcJX4Ov0kWI0QUM2FZV9ZJzByL2BkWM WoUZxaVJZapGtkrJdUlJmeUZKbmJmja2hgqpebWlycmJ6ak5hUrJecn7uJEejfegYGxh2MO9r 9DjFKcjApifI2M7eEC/El5adUZiQWZ8QXleakFh9ilOHgUJLgPfcNKCdYlJqeWpGWmQMMNJi0 BAePkgjva5A0b3FBYm5xZjpE6hSjopQ47wSQhABIIqM0D64NFtyXGGWlhHkZGRgYhHgKUotyM 0tQ5V8xinMwKgnzNoNM4cnMK4Gb/gpoMRPQ4lqHZpDFJYkIKakGxojZsVWanV6M594WPRW8x3 SNoz9g3nXT12lL5/My/rldzvDZuupGSRC3GMPjpJ/uRzRW9mhJqi0S3MtRVbh6OlNtqNOkvJS 1FaLFtxiSvv/mStG5G/9JOO/Wqf3mcfq3u3rWsPB8e1V8SfN8wh2F0nuX3nuzvpl2Iidbv87O ef+v9AsWPrKiSizFGYmGWsxFxYkADlZsmmkCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1468331996!13328066!2 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 21831 invoked from network); 12 Jul 2016 13:59:58 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-206.messagelabs.com with SMTP; 12 Jul 2016 13:59:58 -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 ED11EAB4; Tue, 12 Jul 2016 07:01:01 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D4DC3F213; Tue, 12 Jul 2016 06:59:57 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Jul 2016 14:59:28 +0100 Message-Id: <1468331975-27331-8-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468331975-27331-1-git-send-email-julien.grall@arm.com> References: <1468331975-27331-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, Shannon Zhao Subject: [Xen-devel] [PATCH v7 07/14] xen/arm: map_regions_rw_cache: Map the region with p2m->default_access 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" The parameter 'access' is used by memaccess to restrict temporarily the permission. This parameter should not be used for other purpose (such as restricting permanently the permission). Instead, we should use the default access requested by memacess. When it is not enabled, the access will be p2m_access_rwx (i.e no restriction applied). The type p2m_mmio_direct will map the region read-write and non-executable before any further restriction by memaccess. Note that this is already the resulting permission with the curreent combination of the type and the access. So there is no functional change. Signed-off-by: Julien Grall --- Cc: Shannon Zhao This patch is a candidate for Xen 4.7. Currently this function is only used to map ACPI regions. I am wondering if we should introduce a new p2m type for it. And map this region RO (I am not sure why a guest would want to modify this region). Changes in v2: - Reword the commit message Changes in v4: - Patch added --- xen/arch/arm/p2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 1cfb62b..fcc4513 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1231,7 +1231,7 @@ int map_regions_rw_cache(struct domain *d, pfn_to_paddr(start_gfn + nr), pfn_to_paddr(mfn), MATTR_MEM, 0, p2m_mmio_direct, - p2m_access_rw); + d->arch.p2m.default_access); } int unmap_regions_rw_cache(struct domain *d, @@ -1244,7 +1244,7 @@ int unmap_regions_rw_cache(struct domain *d, pfn_to_paddr(start_gfn + nr), pfn_to_paddr(mfn), MATTR_MEM, 0, p2m_invalid, - p2m_access_rw); + d->arch.p2m.default_access); } int map_mmio_regions(struct domain *d,