From patchwork Tue Sep 12 10:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112279 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674582edi; Tue, 12 Sep 2017 03:05:51 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAO5tG2jStQW6Yr9eAT3W08IAMdo2VoAv57P9mUN7P49MSPxDTbVYu2MRZVq6jbs2ftlC0O X-Received: by 10.36.101.12 with SMTP id u12mr199359itb.135.1505210751618; Tue, 12 Sep 2017 03:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210751; cv=none; d=google.com; s=arc-20160816; b=w7dk9fv19SWsw594fgqHTE/NlgykxxQ/5GK6j3LNeRegGAvyvO75PlRJ5nRPrcgDgv WeE+5TCrMVHctS9aEtZoA8nSfCBlWnbcGdOakAhbt5NW9WSii5+ztn7Vk+wJPNhRWWIR zpRd5zCl90JVrGcXPJZlbjJV/iSyWjZREqj3tNoDXFxWoA8J+UdGHzht4btmvup9n+tX wU3kFAIBDlCifykMUMsaJaYfEE8R+QNFpdH6C3ZM3Ho5obDfjahUfKr1lJEHmTEaSWoM A0vRwoVKF4C0djnpvTsMgwa8IhJ//beORfDTXo38Y2aT2aTloRL9mJ4zusrN8XVDK86r Pd7g== 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=gZ5jubc9325f6paR6Y4g36oastkO7CmlpesmdIXtC/Y=; b=qB3ZfIiMLErO9QChVI0eNWxH805lytUWHVKWPBulD/Wj+AbZACW/xRrPa70Unrihm6 nJoB9CyEKDx6r8k2XSArKoru8jr0Lun8ux7OokMyuIgZA6D2M6mn+CAECWd1drIBTKAZ 3s7wwNXfCZ4ns3BB3cJi6mUFGB2wcaitQHi63h5bu5/83TlWzc7iCV+CTzQua+hynReN jHMEPNZ/62c3D306KQC3Jthq9vlOSH97JdhiQsxIYlgysXOf7zDWPcJw5JgtNN04ZHxO G1x556r/zv/H+4Y6Hp8wSU7y2JiXTSgi11+JeaS0YXWZUHy+5ZVH6qhxHwWI+/4VJfXv lOZA== 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 p68si11393689ite.126.2017.09.12.03.05.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:51 -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 1dri35-0003N7-W4; Tue, 12 Sep 2017 10:04: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 1dri34-00038Q-D6 for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:06 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 98/A1-02202-611B7B95; Tue, 12 Sep 2017 10:04:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTVd04/Z Igwcr1S2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozz+3+xFLTwV0w8xt3AeJ67i5GLQ0hgM6PE 39lT2CGc04wSDfP/M3cxcnKwCWhK3Pn8iQnEFhGQlrj2+TIjiM0sEClx+MMPoAYODmGBBImPB 6NBwiwCqhLbnzWzg9i8ApYSPXf2gpVLCMhL7Gq7yApicwLFV3z8xQZiCwlYSHx/+YNxAiP3Ak aGVYwaxalFZalFuoZGeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgd5lAIIdjH2 znA8xSnIwKYnyHlm/PVKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBC/7BqCcYFFqempFWmYOMMxg 0hIcPEoivEIgad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl56VKifO+AZkvAFKUUZoHNwIW8pcYZ aWEeRmBjhLiKUgtys0sQZV/xSjOwagkzCsHsoonM68EbtMroCOYgI7gubQF5IiSRISUVANjyJ PMuUf2Lt+fyP74wI8bPj9OfNX3T3r5v0V710xnrunH1TZILN8ZGjZd6VfHRen/yU1rr+b0/z0 cb9dzYsIu7veWEm+1XdzZj7FftXytzHP2tQaPeHP8g4DdytuWtAfddWS+teBpkUdqlcPdqmNr WFJYjDk+FJ39UWeX2TuJbZf4T7lDHnsqlViKMxINtZiLihMB4yv73HQCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1505210645!108236303!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 28903 invoked from network); 12 Sep 2017 10:04:05 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:04:05 -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 CF4411529; Tue, 12 Sep 2017 03:04: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 E0E6E3F578; Tue, 12 Sep 2017 03:04:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:27 +0100 Message-Id: <20170912100330.2168-22-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 21/24] 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 --- Andre, I have slightly update the commit message to show that we just describe the current layout. Hope you are fine with keeping your 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 3379d29f8a..8a56f37821 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 088746828d..4022b7dc33 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -62,6 +62,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)