summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorPratyush Anand <panand@redhat.com>2015-12-06 01:30:49 +0900
committerAtsushi Kumagai <ats-kumagai@wm.jp.nec.com>2015-12-09 08:47:15 +0900
commita93301d85bd054d73d9be7d029cbf238b3199e36 (patch)
tree07eadd7262747db257f4d47977beba64a682fbbf /arch
parent28a4729799c5f5d4ec1a9fbd16eca8f68fb2d8bb (diff)
[PATCH 2/4] ARM64: Decide VA Bits on the basis of _stext symbol value.
Currently we assume that there are only two possible configuration supported by kernel. 1) Page Table Level:2, Page Size 64K and VA Bits 42 1) Page Table Level:3, Page Size 4K and VA Bits 39 Ideally, we should have some mechanism to decide these from kernel symbols, but we have limited symbols in vmcore, and we can not do much. So until some one comes with a better way, we use _stext symbol value for VA bits determination. We also assume that when VA Bits are 39, Page table level will be 3 and Page size will be 4K, while when VA Bits are 42, Page table level will be 2 an Page size will be 64K. Signed-off-by: Pratyush Anand <panand@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/arch/arm64.c b/arch/arm64.c
index 643c21f..4d50012 100644
--- a/arch/arm64.c
+++ b/arch/arm64.c
@@ -115,16 +115,36 @@ get_page_shift_arm64(void)
return page_shift;
}
+#define PAGE_OFFSET_39 (0xffffffffffffffffUL << 39)
+#define PAGE_OFFSET_42 (0xffffffffffffffffUL << 42)
static int calculate_plat_config(void)
{
- /*
- * TODO: Keep it fixed for page level 2, size 64K and VA bits as
- * 42, as of now. Will calculate them from symbol address values
- * latter.
+ unsigned long long stext;
+
+ /* Currently we assume that there are only two possible
+ * configuration supported by kernel.
+ * 1) Page Table Level:2, Page Size 64K and VA Bits 42
+ * 1) Page Table Level:3, Page Size 4K and VA Bits 39
+ * Ideally, we should have some mechanism to decide these values
+ * from kernel symbols, but we have limited symbols in vmcore,
+ * and we can not do much. So until some one comes with a better
+ * way, we use following.
*/
- pgtable_level = 2;
- va_bits = 42;
- page_shift = 16;
+ stext = SYMBOL(_stext);
+
+ /* condition for minimum VA bits must be checked first and so on */
+ if ((stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) {
+ pgtable_level = 3;
+ va_bits = 39;
+ page_shift = 12;
+ } else if ((stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) {
+ pgtable_level = 2;
+ va_bits = 42;
+ page_shift = 16;
+ } else {
+ ERRMSG("Kernel Configuration not supported\n");
+ return FALSE;
+ }
return TRUE;
}