forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From 9045b72bdb703bf58a6586d77461eea8f59f50f7 Mon Sep 17 00:00:00 2001
From: Alexandru Moise <alexandru.moise@windriver.com>
Date: Fri, 29 Apr 2016 07:40:46 +0000
Subject: [PATCH] mem_section: Support only 46 bit for MAX_PHYSMEM_BITS on
 PPC64
 
Related to change:
http://lists.infradead.org/pipermail/kexec/2013-January/007849.html
 
Linux on PPC64 has supported only 46 bit MAX_PHYSMEM_BITS since commit:
048ee0993ec8360abb0b51bdf8f8721e9ed62ec4
 
Also remove set_ppc64_max_physmem_bits and set info->max_physmem_bits in
get_machdep_info_ppc64 instead. set_ppc64_max_physmem_bits is broken
for all kernels compiled with CONFIG_SPARSEMEM=n. makedumpfile is
unable to get mem_section field from powerpc kernel since commit:
fd59d231f81cb02870b9cf15f456a897f3669b4e
 
Upstream-Status: Pending
 
Signed-off-by: Alexandru Moise <alexandru.moise@windriver.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
 
[hqBai: adjusted patch for context, no logical change]
Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 arch/ppc64.c | 38 ++------------------------------------
 1 file changed, 2 insertions(+), 36 deletions(-)
 
--- a/arch/ppc64.c
+++ b/arch/ppc64.c
@@ -462,44 +462,6 @@ ppc64_vtop_level4(unsigned long vaddr)
     return paddr;
 }
 
-int
-set_ppc64_max_physmem_bits(void)
-{
-    long array_len = ARRAY_LENGTH(mem_section);
-
-    /* Check if we can get MAX_PHYSMEM_BITS from vmcoreinfo */
-    if (NUMBER(MAX_PHYSMEM_BITS) != NOT_FOUND_NUMBER) {
-        info->max_physmem_bits = NUMBER(MAX_PHYSMEM_BITS);
-        return TRUE;
-    }
-
-    /*
-     * The older ppc64 kernels uses _MAX_PHYSMEM_BITS as 42 and the
-     * newer kernels 3.7 onwards uses 46 bits.
-     */
-
-    info->max_physmem_bits  = _MAX_PHYSMEM_BITS_ORIG ;
-    if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
-        || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT())))
-        return TRUE;
-
-    info->max_physmem_bits  = _MAX_PHYSMEM_BITS_3_7;
-    if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
-        || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT())))
-        return TRUE;
-
-    info->max_physmem_bits  = _MAX_PHYSMEM_BITS_4_19;
-    if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
-        || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT())))
-        return TRUE;
-
-    info->max_physmem_bits  = _MAX_PHYSMEM_BITS_4_20;
-    if ((array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
-        || (array_len == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT())))
-        return TRUE;
-
-    return FALSE;
-}
 
 int
 get_machdep_info_ppc64(void)
@@ -507,10 +469,8 @@ get_machdep_info_ppc64(void)
     unsigned long vmlist, vmap_area_list, vmalloc_start;
 
     info->section_size_bits = _SECTION_SIZE_BITS;
-    if (!set_ppc64_max_physmem_bits()) {
-        ERRMSG("Can't detect max_physmem_bits.\n");
-        return FALSE;
-    }
+    info->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7;
+
     info->page_offset = __PAGE_OFFSET;
 
     if (SYMBOL(_stext) == NOT_FOUND_SYMBOL) {