From: Sergej Proskurin <proskurin@sec.in.tum.de>
To: xen-devel@lists.xenproject.org
Cc: Sergej Proskurin <proskurin@sec.in.tum.de>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH 1/8] arm/mem_access: Add (TCR_|TTBCR_)* defines
Date: Thu, 1 Jun 2017 17:18:59 +0200 [thread overview]
Message-ID: <20170601151906.10213-10-proskurin@sec.in.tum.de> (raw)
In-Reply-To: <20170601151906.10213-1-proskurin@sec.in.tum.de>
This commit adds (TCR_|TTBCR_)* defines to simplify access to the respective
register contents.
Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
---
v2: Define TCR_SZ_MASK in a way so that it can be also applied to 32-bit guests
using the long-descriptor translation table format.
Extend the previous commit by further defines allowing a simplified access
to the registers TCR_EL1 and TTBCR.
---
xen/include/asm-arm/processor.h | 49 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 855ded1b07..c095dad7e9 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -94,6 +94,9 @@
#define TTBCR_N_2KB _AC(0x03,U)
#define TTBCR_N_1KB _AC(0x04,U)
+#define TTBCR_PD0 (_AC(1,U)<<4)
+#define TTBCR_PD1 (_AC(1,U)<<5)
+
/* SCTLR System Control Register. */
/* HSCTLR is a subset of this. */
#define SCTLR_TE (_AC(1,U)<<30)
@@ -155,6 +158,19 @@
/* TCR: Stage 1 Translation Control */
#define TCR_T0SZ(x) ((x)<<0)
+#define TCR_T0SZ_SHIFT (0)
+#define TCR_T1SZ_SHIFT (16)
+
+/*
+ * According to ARM DDI 0487A.g, TCR_EL1.{T0SZ,T1SZ} (Aarch64, Section D7-2021)
+ * comprises 6 bits and TTBCR.{T0SZ,T1SZ} (Aarch32, Section G6-4624) comprises
+ * 3 bits following another 3 bits for RES0. Thus, the mask for both registers
+ * should be 0x3f.
+ */
+#define TCR_SZ_MASK (_AC(0x3f,UL)<<0)
+
+#define TCR_EPD0 (_AC(0x1,UL)<<7)
+#define TCR_EPD1 (_AC(0x1,UL)<<23)
#define TCR_IRGN0_NC (_AC(0x0,UL)<<8)
#define TCR_IRGN0_WBWA (_AC(0x1,UL)<<8)
@@ -173,11 +189,35 @@
#define TCR_TG0_4K (_AC(0x0,UL)<<14)
#define TCR_TG0_64K (_AC(0x1,UL)<<14)
#define TCR_TG0_16K (_AC(0x2,UL)<<14)
+#define TCR_TG0_MASK (_AC(0x3,UL)<<14)
+#define TCR_TG0_SHIFT (14)
+
+#define TCR_TG1_16K (_AC(0x1,UL)<<30)
+#define TCR_TG1_4K (_AC(0x2,UL)<<30)
+#define TCR_TG1_64K (_AC(0x3,UL)<<30)
+#define TCR_TG1_MASK (_AC(0x3,UL)<<30)
+#define TCR_TG1_SHIFT (30)
+
+#define TCR_IPS_32_BIT (_AC(0x0,ULL)<<32)
+#define TCR_IPS_36_BIT (_AC(0x1,ULL)<<32)
+#define TCR_IPS_40_BIT (_AC(0x2,ULL)<<32)
+#define TCR_IPS_42_BIT (_AC(0x3,ULL)<<32)
+#define TCR_IPS_44_BIT (_AC(0x4,ULL)<<32)
+#define TCR_IPS_48_BIT (_AC(0x5,ULL)<<32)
+#define TCR_IPS_MASK (_AC(0x7,ULL)<<32)
+#define TCR_IPS_SHIFT (32)
+
+#define TCR_TB_31 (31)
#ifdef CONFIG_ARM_64
#define TCR_PS(x) ((x)<<16)
#define TCR_TBI (_AC(0x1,UL)<<20)
+#define TCR_TBI0 (_AC(0x1,UL)<<37)
+#define TCR_TBI1 (_AC(0x1,UL)<<38)
+
+#define TCR_TB_63 (63)
+#define TCR_TB_55 (55)
#define TCR_RES1 (_AC(1,UL)<<31|_AC(1,UL)<<23)
@@ -187,6 +227,15 @@
#endif
+#define IPS_MIN (25)
+#define IPS_MAX (48)
+#define IPS_32_BIT (32)
+#define IPS_36_BIT (36)
+#define IPS_40_BIT (40)
+#define IPS_42_BIT (42)
+#define IPS_44_BIT (44)
+#define IPS_48_BIT (48)
+
/* VTCR: Stage 2 Translation Control */
#define VTCR_T0SZ(x) ((x)<<0)
--
2.12.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-06-01 15:19 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-01 15:18 [RFC PATCH v2 0/8] arm/mem_access: Walk guest page tables in SW if mem_access is active Sergej Proskurin
2017-06-01 15:18 ` [RFC PATCH v2 1/8] arm/mem_access: Add (TCR_|TTBCR_)* defines Sergej Proskurin
2017-06-02 7:31 ` Julien Grall
2017-06-07 14:56 ` Sergej Proskurin
2017-06-07 15:07 ` Julien Grall
2017-06-07 15:11 ` Julien Grall
2017-06-01 15:18 ` [RFC PATCH v2 2/8] arm/mem_access: Add defines holding the width of 32/64bit regs Sergej Proskurin
2017-06-01 15:18 ` [RFC PATCH v2 3/8] arm/mem_access: Add defines supporting PTs with varying page sizes Sergej Proskurin
2017-06-02 8:27 ` Julien Grall
2017-06-01 15:18 ` [RFC PATCH v2 4/8] arm/mem_access: Add short-descriptor pte typedefs Sergej Proskurin
2017-06-02 8:50 ` Julien Grall
2017-06-01 15:18 ` [RFC PATCH v2 5/8] arm/mem_access: Add software guest-page-table walk Sergej Proskurin
2017-06-02 9:02 ` Julien Grall
2017-06-08 12:43 ` Sergej Proskurin
2017-06-09 8:19 ` Julien Grall
2017-06-01 15:18 ` [RFC PATCH v2 6/8] arm/mem_access: Add long-descriptor based gpt Sergej Proskurin
2017-06-02 12:55 ` Julien Grall
2017-06-09 11:50 ` Sergej Proskurin
2017-06-09 12:39 ` Julien Grall
2017-06-12 10:12 ` Sergej Proskurin
2017-06-12 10:44 ` Julien Grall
2017-06-12 12:31 ` Sergej Proskurin
2017-06-01 15:18 ` [RFC PATCH v2 7/8] arm/mem_access: Add short-descriptor " Sergej Proskurin
2017-06-02 15:11 ` Julien Grall
2017-06-01 15:18 ` [RFC PATCH v2 8/8] arm/mem_access: Walk the guest's pt in software Sergej Proskurin
2017-06-01 15:18 ` Sergej Proskurin [this message]
2017-06-02 15:13 ` [PATCH 1/8] arm/mem_access: Add (TCR_|TTBCR_)* defines Julien Grall
2017-06-03 8:56 ` Sergej Proskurin
2017-06-01 15:19 ` [PATCH 2/8] arm/mem_access: Add defines holding the width of 32/64bit regs Sergej Proskurin
2017-06-01 15:19 ` [PATCH 3/8] arm/mem_access: Add defines supporting PTs with varying page sizes Sergej Proskurin
2017-06-01 15:19 ` [PATCH 4/8] arm/mem_access: Add short-descriptor pte typedefs Sergej Proskurin
2017-06-01 15:19 ` [PATCH 5/8] arm/mem_access: Add software guest-page-table walk Sergej Proskurin
2017-06-01 15:19 ` [PATCH 6/8] arm/mem_access: Add long-descriptor based gpt Sergej Proskurin
2017-06-01 15:19 ` [PATCH 7/8] arm/mem_access: Add short-descriptor " Sergej Proskurin
2017-06-01 15:19 ` [PATCH 8/8] arm/mem_access: Walk the guest's pt in software Sergej Proskurin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170601151906.10213-10-proskurin@sec.in.tum.de \
--to=proskurin@sec.in.tum.de \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).