From patchwork Mon Oct 2 17:31:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114631 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp924589qgn; Mon, 2 Oct 2017 10:34:06 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCmZC5CNDkLPPtN3s+ZMSOoUjC2iA/sA//M5VvmMcDqrr9dbCTngWY02ncgtwdVCV8x/YhK X-Received: by 10.107.182.139 with SMTP id g133mr25245129iof.10.1506965646588; Mon, 02 Oct 2017 10:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506965646; cv=none; d=google.com; s=arc-20160816; b=Ml0gLN6A6ADh8aghsPjB08QhrLTxse2Xf3SZ4R9O0OFTCEGZ0DxiIxI/DIuQHm33J4 wmKSWGp3Z73DhfY8iFvNYdgJpjIgi/hrX4GogJE66ZdqB1UOYQWQX1Zxv0DApWfucEtL //u/rraFE7HPDThocem/z+QUz1s6t8bzyswMzLIL41QjBP9SlzWFC1SKqdznYFinzEwL 3vOC+6MeHOaxNjj9Zu9Xi/yvWHQtTMRrKBFGaBEeLK8zBILMp0pCl84i6rgZPZyKgdJQ OJcR4st/FOwILPvTpyKI0KxV+DzEkVSLwtbpHwosW/VnVRy+Dxp/2SaWYE8/e3WML/zx A02A== 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=vu9gSlv2fDjbY95cQ1rWp6UXu+KmVIRgrVAbNXvckog=; b=aWR0oZBkT9VApVf64ecdWanrXLIQ+w8JPqbsd2q/9uBXFRHKfAHjIk+zogAyzPa8wF A+27W2Cp46SbrLLBAe7AYFpo9xjLhNdQOmXPMHWZX4AjrRYkVafJuhDFmCunb1SGGwaN rat2GDCXr/RjaZuGzC5b/7QGAYb106O5xEjiNDeedTJ4TR5Y0g2E/Cwviu97s3mj2jqn 6N5JUOFn37d/Cy8t8KEtoFh37c1RNwb8q6SgASbgtSGLfcwBVAxTW/yAnMf4kbz/GsAU 4A2V1A2sddahvSUnWExXc9zSjLExPl1nS4rRg4wzIeAe3xwz8xnwZv+Q46+rYg0rckJe lXlA== 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 c35si2680357ioa.300.2017.10.02.10.34.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 10:34:06 -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 1dz4Zb-0003ck-Ey; Mon, 02 Oct 2017 17:32:07 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz4Za-0003b4-AQ for xen-devel@lists.xen.org; Mon, 02 Oct 2017 17:32:06 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 06/F0-01778-51872D95; Mon, 02 Oct 2017 17:32:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTVe04lK kwbMeVoslHxezODB6HN39mymAMYo1My8pvyKBNeNe93bWgit8FZ/PXWJsYFzL3cXIxSEksJlR 4v7dC0wQzmlGiSUtd1m6GDk52AQ0Je58/sQEYosISEtc+3yZEcRmFoiUOPzhBzuILSwQJ3Hwz FqwehYBVYkl16czg9i8AhYSs9ctAuuVEJCX2NV2kRXE5hSwlLj95BBYjRBQzenXM5gmMHIvYG RYxahRnFpUllqka2Sml1SUmZ5RkpuYmaNraGCql5taXJyYnpqTmFSsl5yfu4kR6OF6BgbGHYy 3J/sdYpTkYFIS5fXOvxQpxJeUn1KZkVicEV9UmpNafIhRhoNDSYJXrBwoJ1iUmp5akZaZAww1 mLQEB4+SCG8kSJq3uCAxtzgzHSJ1ilGXo+Pm3T9MQix5+XmpUuK8RiBFAiBFGaV5cCNgYX+JU VZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjDvnzKgKTyZeSVwm14BHcEEdMScrgsgR5QkIqSkGh gVSy/uyRVx6f0cp9ayiP3CkYJlmYs0cy+FCCckb/MJfK/jY1l1Tk238JCV+6Ssh1Pv3NW4Wj8 19FPqKb0DtbrT/0bdK+nazLMl9Z/81eWGEx+58fnrn7qheEvgvczzMhaXY++DN52qTk6Kdlmt uP95wKeM4+tDK6Zu0pvcr2V5/WNUknC55VklluKMREMt5qLiRADdvUHrdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-206.messagelabs.com!1506965524!110628016!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 5686 invoked from network); 2 Oct 2017 17:32:04 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-206.messagelabs.com with SMTP; 2 Oct 2017 17:32:04 -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 28FD715A2; Mon, 2 Oct 2017 10:32:04 -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 3DA523F483; Mon, 2 Oct 2017 10:32:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 2 Oct 2017 18:31:47 +0100 Message-Id: <20171002173150.5404-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171002173150.5404-1-julien.grall@arm.com> References: <20171002173150.5404-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 6/9] 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" 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. So document the current layout. At the same time introduce PAGE_AI_MASK to get the memory attribute index easily. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v3: - Add Stefano's reviewed-by Changes in v2: - Slightly update the commit message to specify we describe the current layout. - Add Andre's reviewed-by --- 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 39bade63f5..117f05a1d6 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 0ae1a2587b..aa3e83f5b4 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -65,6 +65,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)