From patchwork Mon Oct 9 13:23:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 115208 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2557183qgn; Mon, 9 Oct 2017 06:25:54 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDmjDzzeQc6TLEdvtj6PqdhmeUYxBM6fV1jYz1+t/lI9XuLa8puHXpXFfEQWZbBtXdDP4Ui X-Received: by 10.107.22.65 with SMTP id 62mr13923288iow.269.1507555554182; Mon, 09 Oct 2017 06:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507555554; cv=none; d=google.com; s=arc-20160816; b=lgUJbC5IXWUVuC8W6vzvPLXOh98hKtaoV/k0jyvp1VrkS1LeJBj1gmnVkRZDdC3++m vwzW1pW3RSkO5NsLJJriJ0NsyEVVuagk5/Rs8Pajk3D6V6e2cZkg9dcxlpgcwT6/QMt0 BfY8obTszf+1RleAHAIYWLZt5K4r8ArQi2zbXnx70pV07LBQXSpeGxtlmUJz8iYR/ocM zXOWrohBIOydbWt5f0zNN4nOIiiKgSST0rUJH+izBV1C+AtvPgYdOBKJi1UN5wpq+N0T y9mnPhu1LLgVzCAWvp5yNrhzseWnJE8HZbVDENzi3UDQT6jXQM/SFrTcSHGdOPBxVd8C NWVg== 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=qYsqsWihHS+Unmrh2YeAASdUgneFBivoMKiMjnvLPEM=; b=rS5z9k7FjUqDL2MkQBWo33sLEgbTnW2N9J21RYvQrlTtmiySmkcVLEv3poxb7HI5O6 /gCcxbhlLyOWSzVIHCWhERL0d4KGRMa65NyQPuKJ+4MGDbaHFZ4aldhNtdLZWI3oLPc1 ixO4PxOI0hlqdkY0vDhcl0JkQCnVZjKwI6qOWid3L9towFD9nHVJZsTCF+V9WRn7PrHZ ir4Fblje/QHg8cOCJnklt2sQcpp/KgrLXmDVsqrq/8eARe+xV2qVyzfuoCKrvMH1O/se fNAU6LcA72Lgc2ItaLK/rJfM40RxIro9DkuSlYQ8pScqB1NOHCnap00a0zZVtlQ859VH mJ2A== 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 n130si6979388itn.51.2017.10.09.06.25.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2017 06:25:54 -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 1e1Y2L-00082l-QU; Mon, 09 Oct 2017 13:24:01 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1Y2K-00080x-G9 for xen-devel@lists.xen.org; Mon, 09 Oct 2017 13:24:00 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 5E/49-02039-F687BD95; Mon, 09 Oct 2017 13:23:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTTe/4na kwcNvLBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8an++sZC3rYK37s38vYwNjK2sXIxSEksJlR Yta5dVDOaUaJxhPn2bsYOTnYBDQl7nz+xARiiwhIS1z7fJkRxGYWiJQ4/OEHWI2wQITEpVXzW EBsFgFVibOn9oDFeQUsJf7sBtnAySEhIC+xq+0imM0JFJ+2eToziC0kYCFx+cMO1gmM3AsYGV YxahSnFpWlFukameslFWWmZ5TkJmbm6BoaGOvlphYXJ6an5iQmFesl5+duYgR6uJ6BgXEHY8t ev0OMkhxMSqK8UwpuRwrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4K0sB8oJFqWmp1akZeYAQw0m LcHBoyTCW14KlOYtLkjMLc5Mh0idYjTmuPHw+h8mjo6bd/8wCbHk5eelSonz+oJMEgApzSjNg xsEi4FLjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5M0Cm8GTmlcDtewV0ChPQKYzFN0BOKU lESEk1ME548M54p8rp+dvvpT2XerijuveJpKc896257Ekh9YZyWml2pg+PObnPZlMJ1uLfxFK eb29x6djKWbpcqulZPIUS2RefV4sHhNt+Ef60vel9w7yi92sj7nFUbJgVpHaHPeDG/xDrY0fS 3PXDRbQderJyy14yfNxt6Zo3a9e9vspVpSEfCv/fVWIpzkg01GIuKk4EAI4rOdp8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1507555438!101816037!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 53155 invoked from network); 9 Oct 2017 13:23:58 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-31.messagelabs.com with SMTP; 9 Oct 2017 13:23: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 4C23F1435; Mon, 9 Oct 2017 06:23:58 -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 609583F578; Mon, 9 Oct 2017 06:23:57 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 9 Oct 2017 14:23:40 +0100 Message-Id: <20171009132341.1678-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171009132341.1678-1-julien.grall@arm.com> References: <20171009132341.1678-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v4 09/10] 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 Reviewed-by: Stefano Stabellini --- 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 c1dad61a20..2329ccee83 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;