Skip to content

Commit a566cb7

Browse files
author
Dave Anderson
committed
Determine the ARM64 SECTION_SIZE_BITS value using the following
order of precedence: (1) from the VMCOREINFO data if it exists (2) from the in-kernel configuration data if it exists (3) the default value ([email protected])
1 parent 70e794c commit a566cb7

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

arm64.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static int verify_kimage_voffset(void);
3232
static void arm64_calc_kimage_voffset(void);
3333
static void arm64_calc_phys_offset(void);
3434
static void arm64_calc_virtual_memory_ranges(void);
35+
static void arm64_get_section_size_bits(void);
3536
static int arm64_kdump_phys_base(ulong *);
3637
static ulong arm64_processor_speed(void);
3738
static void arm64_init_kernel_pgd(void);
@@ -375,7 +376,8 @@ arm64_init(int when)
375376

376377
case POST_GDB:
377378
arm64_calc_virtual_memory_ranges();
378-
machdep->section_size_bits = _SECTION_SIZE_BITS;
379+
arm64_get_section_size_bits();
380+
379381
if (!machdep->max_physmem_bits) {
380382
if ((string = pc->read_vmcoreinfo("NUMBER(MAX_PHYSMEM_BITS)"))) {
381383
machdep->max_physmem_bits = atol(string);
@@ -1055,6 +1057,33 @@ arm64_calc_phys_offset(void)
10551057
fprintf(fp, "using %lx as phys_offset\n", ms->phys_offset);
10561058
}
10571059

1060+
/*
1061+
* Determine SECTION_SIZE_BITS either by reading VMCOREINFO or the kernel
1062+
* config, otherwise use the 64-bit ARM default definiton.
1063+
*/
1064+
static void
1065+
arm64_get_section_size_bits(void)
1066+
{
1067+
int ret;
1068+
char *string;
1069+
1070+
machdep->section_size_bits = _SECTION_SIZE_BITS;
1071+
1072+
if ((string = pc->read_vmcoreinfo("NUMBER(SECTION_SIZE_BITS)"))) {
1073+
machdep->section_size_bits = atol(string);
1074+
free(string);
1075+
} else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
1076+
if ((ret = get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL)) == IKCONFIG_Y) {
1077+
if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) == IKCONFIG_STR) {
1078+
machdep->section_size_bits = atol(string);
1079+
free(string);
1080+
}
1081+
}
1082+
}
1083+
1084+
if (CRASHDEBUG(1))
1085+
fprintf(fp, "SECTION_SIZE_BITS: %ld\n", machdep->section_size_bits);
1086+
}
10581087

10591088
/*
10601089
* Determine PHYS_OFFSET either by reading VMCOREINFO or the kernel

0 commit comments

Comments
 (0)