From patchwork Tue Sep 12 10:03:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112270 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674328edi; Tue, 12 Sep 2017 03:05:39 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB+xz5Htv0W+/GNE57hwPzxwGI1uiBHsOvadk/KXY/lWoSzrnzk+ogHuhVjSPfIuidXS9us X-Received: by 10.107.55.135 with SMTP id e129mr22098494ioa.166.1505210738924; Tue, 12 Sep 2017 03:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210738; cv=none; d=google.com; s=arc-20160816; b=pnWc7ml2ZQ3y8fZ+f+3KvYFrBxJuIDmFZ9MMmVikj87weaPlKSgVwJ5Lo4BHig42UK RWrZkMJUJXe0TQWUH6WyEZfVyCEZdOjMol8Mw4g68P56YcrSS04eO+iGnoxse8w8JkFY i6ttuuWxdor4qcmOJoQ0dpGYzUmLVyXtrtG814cF04wIDo02W7kOeH7ZNzV1WFJR1H4F moIJoUg0SEBIuSjo9+XKgIPln8Uk++pNrFOWOnnlhG8GmD5nE9PnRYkuKhVtVqiAYEL5 kED9F0ya4OopZGkvtgrtscRGE1Kd6A34U1Z4GTJJVsphHZi026tveASMM/EJV97HsBbd h8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=v3owfXPiZIjsUFLjf9TspmayFxyt9ZGvmUnCstkL3u8=; b=iZaK3fCAtCE4ACQEFgOS69aBA12CTKaCuqT1+j/+sS1CDF4zmK36RbFSTLMxBQK8nX QWSQkQFuniq15aaL/31mVLilNkS9gb0ZZ04vz6icEK+c/JPFbmO/obgAKIx5gewn1DiX MjbE8yM/5OXYEyQXp9MkcPe1BKZv3nvTY6Gwf/SE4jbAZJ3EpOIs9MRE2n7X9TmHBLOh HtyvAITWpssoyV0yzI7bxikAKr77dOvQFVHtJeH6FWCE2mXtG6YhWZbBWGZYjtaY0gcg X5osaB/PSjuSVTRezPaiHf7bvG78miDnQ3OYBWV8P+QJ/74FB8YNwt0/ltOiXBCUQyBt qoKg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w197si10475655iod.352.2017.09.12.03.05.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:38 -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 1dri38-0003Ti-MH; Tue, 12 Sep 2017 10:04:10 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri37-0003PR-4r for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:09 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id D0/A5-02226-811B7B95; Tue, 12 Sep 2017 10:04:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRWlGSWpSXmKPExsVysyfVTVd84/Z Ig3nvLCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxLTbOYC3rYKz4+v8LWwNjK2sXIxSEksJlR 4sXO6cxdjJxAzmlGid3L+EBsNgFNiTufPzGB2CIC0hLXPl9mBLGZBSIlDn/4wQ5iCwtESMx+d IoFxGYRUJU4ueM4UJyDg1fAUqJ5fTpIWEJAXmJX20VWEJsTKLzi4y82iFUWEt9f/mCcwMi9gJ FhFaNGcWpRWWqRrqG5XlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGoHcZgGAH48v TnocYJTmYlER5j6zfHinEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgpd9A1BOsCg1PbUiLTMHGGYw aQkOHiUR3msgrbzFBYm5xZnpEKlTjMYcNx5e/8PE0XHz7h8mIZa8/LxUKXHeNyClAiClGaV5c INg4X+JUVZKmJcR6DQhnoLUotzMElT5V4ziHIxKwrzzQabwZOaVwO17BXQKE9ApPJe2gJxSko iQkmpg1BHaafXB7MYWh7JUscicBY9uLCgLOX+sosXn1uVdq/5P3m3GPPUou5NpSqzSEaPHl4X OVdxI1Vw/+0ye/7Gpc8W8Z3XbTjXx4X2sFPKDUX2W5OmsNmbVz4cXJooF7Lp/e9rcjl3z3Q3a UnK3m9+trd75iN0q522VwW2P75PYgv+HruDg071kocRSnJFoqMVcVJwIALgrEFt6AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1505210647!106810621!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10850 invoked from network); 12 Sep 2017 10:04:07 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:04:07 -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 2EF391529; Tue, 12 Sep 2017 03:04:07 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 407A93F578; Tue, 12 Sep 2017 03:04:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:29 +0100 Message-Id: <20170912100330.2168-24-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 23/24] xen/arm: mm: Handle permission flags when adding a new mapping 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, all the new mappings will be read-write non-executable. Allow the caller to use other permissions. Signed-off-by: Julien Grall --- Changes in v2: - Switch the runtime check to a BUG_ON() --- xen/arch/arm/mm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 8a56f37821..a6b228ba9b 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1022,6 +1022,9 @@ static int create_xen_entries(enum xenmap_operation op, if ( op == RESERVE ) break; pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); + pte.pt.ro = PAGE_RO_MASK(flags); + pte.pt.xn = PAGE_XN_MASK(flags); + BUG_ON(!pte.pt.ro && !pte.pt.xn); pte.pt.table = 1; write_pte(entry, pte); break;