From patchwork Mon Aug 14 14:24:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9898997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B716602CA for ; Mon, 14 Aug 2017 14:27:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB03285A2 for ; Mon, 14 Aug 2017 14:27:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12FAD28689; Mon, 14 Aug 2017 14:27:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BD33228610 for ; Mon, 14 Aug 2017 14:27:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-00012S-G7; Mon, 14 Aug 2017 14:25:05 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIi-0000yF-8L for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:04 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id FD/12-22472-FB2B1995; Mon, 14 Aug 2017 14:25:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXf/pom RBkdPMVss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkHd75nKvjCXdF97gxLA+MCzi5GLg4hgU2M Ek+ObWaDcE4zSpybeIe5i5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICsRK/J u0Di7MIqEo0fTnLAmLzClhJPFv1CiwuISAvsavtIiuIzQkU77y7E6xGSMBS4sTq2WwTGLkXMD KsYtQoTi0qSy3SNTTSSyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQI9DADEOxgfNX tfIhRkoNJSZQ3wac3UogvKT+lMiOxOCO+qDQntfgQowwHh5IEb+rGiZFCgkWp6akVaZk5wFCD SUtw8CiJ8M4CSfMWFyTmFmemQ6ROMepyvJrw/xuTEEtefl6qlDhvOUiRAEhRRmke3AhY2F9il JUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMO9mkCk8mXklcJteAR3BBHREH8j9vMUliQgpqQZGyU sXMt/Jvexm/mWzxlP3kMEsvi2SNvUuVyZGi/MYvFZmc/9y79JkG+sNKp13o2OXSWvXbgvUuiD LOU2jZnpQNju/F0O2QFV6l/mnLPbCO5Z/9l3fN0PhVHpkimma4aObe3j/sj3Ui0nJ9eh0WfXA auWE33NL1GvvTJbtWfv7PlNF1a9D28WVWIozEg21mIuKEwF1eKMLdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1502720702!102389843!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 57337 invoked from network); 14 Aug 2017 14:25:02 -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; 14 Aug 2017 14:25:02 -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 4D4AE80D; Mon, 14 Aug 2017 07:25:02 -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 61A113F483; Mon, 14 Aug 2017 07:25:01 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:15 +0100 Message-Id: <20170814142418.13267-25-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 24/27] xen/arm: page: Describe the layout of flags used to update page tables 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" X-Virus-Scanned: ClamAV using ClamSMTP Currently, the flags used to update page tables (i.e PAGE_HYPERVISOR_*) only contains the memory attribute index. Follow-up patches will add more information in it. At the same time introduce PAGE_AI_MASK to get the memory attribute index easily. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/page.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 411fe02842..cd7bcf7aca 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op, } if ( op == RESERVE ) break; - pte = mfn_to_xen_entry(mfn, flags); + pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); pte.pt.table = 1; write_pte(entry, pte); break; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index d9dac92e73..1bf8e9d012 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -63,6 +63,13 @@ #define MAIR0VAL (MAIRVAL & 0xffffffff) #define MAIR1VAL (MAIRVAL >> 32) +/* + * Layout of the flags used for updating the hypervisor page tables + * + * [0:2] Memory Attribute Index + */ +#define PAGE_AI_MASK(x) ((x) & 0x7U) + #define PAGE_HYPERVISOR (MT_NORMAL) #define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) #define PAGE_HYPERVISOR_WC (MT_NORMAL_NC)