diff options
author | Milton Miller <miltonm@bga.com> | 2008-10-23 14:41:09 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-10-31 01:11:49 -0400 |
commit | 8b8b0cc1c736ddca39b60bb098bd0a23daaa495f (patch) | |
tree | 16587c61e94ae13ac3494f9a4dd8fdf028f23bd4 /arch/powerpc/kernel/head_64.S | |
parent | 62a8bd6c9246c0e1f19dfb8fc65ad7c4f7cac8bb (diff) |
powerpc/ppc64/kdump: Better flag for running relocatable
The __kdump_flag ABI is overly constraining for future development.
As of 2.6.27, the kernel entry point has 4 constraints: Offset 0 is
the starting point for the master (boot) cpu (entered with r3 pointing
to the device tree structure), offset 0x60 is code for the slave cpus
(entered with r3 set to their device tree physical id), offset 0x20 is
used by the iseries hypervisor, and secondary cpus must be well behaved
when the first 256 bytes are copied to address 0.
Placing the __kdump_flag at 0x18 is bad because:
- It was taking the last 8 bytes before the iseries hypervisor data.
- It was 8 bytes for a boolean flag
- It had no way of identifying that the flag was present
- It does leave any room for the master to add any additional code
before branching, which hurts debug.
- It will be unnecessarily hard for 32 bit code to be common (8 bytes)
Now that we have eliminated the use of __kdump_flag in favor of
the standard is_kdump_kernel(), this flag only controls run without
relocating the kernel to PHYSICAL_START (0), so rename it __run_at_load.
Move the flag to 0x5c, 1 word before the secondary cpu entry point at
0x60. Initialize it with "run0" to say it will run at 0 unless it is
set to 1. It only exists if we are relocatable.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/head_64.S')
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 69489bd3210c..b4bcf5a930fa 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -97,12 +97,6 @@ __secondary_hold_spinloop: | |||
97 | __secondary_hold_acknowledge: | 97 | __secondary_hold_acknowledge: |
98 | .llong 0x0 | 98 | .llong 0x0 |
99 | 99 | ||
100 | /* This flag is set by purgatory if we should be a kdump kernel. */ | ||
101 | /* Do not move this variable as purgatory knows about it. */ | ||
102 | .globl __kdump_flag | ||
103 | __kdump_flag: | ||
104 | .llong 0x0 | ||
105 | |||
106 | #ifdef CONFIG_PPC_ISERIES | 100 | #ifdef CONFIG_PPC_ISERIES |
107 | /* | 101 | /* |
108 | * At offset 0x20, there is a pointer to iSeries LPAR data. | 102 | * At offset 0x20, there is a pointer to iSeries LPAR data. |
@@ -112,6 +106,20 @@ __kdump_flag: | |||
112 | .llong hvReleaseData-KERNELBASE | 106 | .llong hvReleaseData-KERNELBASE |
113 | #endif /* CONFIG_PPC_ISERIES */ | 107 | #endif /* CONFIG_PPC_ISERIES */ |
114 | 108 | ||
109 | #ifdef CONFIG_CRASH_DUMP | ||
110 | /* This flag is set to 1 by a loader if the kernel should run | ||
111 | * at the loaded address instead of the linked address. This | ||
112 | * is used by kexec-tools to keep the the kdump kernel in the | ||
113 | * crash_kernel region. The loader is responsible for | ||
114 | * observing the alignment requirement. | ||
115 | */ | ||
116 | /* Do not move this variable as kexec-tools knows about it. */ | ||
117 | . = 0x5c | ||
118 | .globl __run_at_load | ||
119 | __run_at_load: | ||
120 | .long 0x72756e30 /* "run0" -- relocate to 0 by default */ | ||
121 | #endif | ||
122 | |||
115 | . = 0x60 | 123 | . = 0x60 |
116 | /* | 124 | /* |
117 | * The following code is used to hold secondary processors | 125 | * The following code is used to hold secondary processors |
@@ -1391,8 +1399,8 @@ _STATIC(__after_prom_start) | |||
1391 | lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */ | 1399 | lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */ |
1392 | sldi r25,r25,32 | 1400 | sldi r25,r25,32 |
1393 | #ifdef CONFIG_CRASH_DUMP | 1401 | #ifdef CONFIG_CRASH_DUMP |
1394 | ld r7,__kdump_flag-_stext(r26) | 1402 | lwz r7,__run_at_load-_stext(r26) |
1395 | cmpldi cr0,r7,1 /* kdump kernel ? - stay where we are */ | 1403 | cmplwi cr0,r7,1 /* kdump kernel ? - stay where we are */ |
1396 | bne 1f | 1404 | bne 1f |
1397 | add r25,r25,r26 | 1405 | add r25,r25,r26 |
1398 | #endif | 1406 | #endif |
@@ -1416,11 +1424,11 @@ _STATIC(__after_prom_start) | |||
1416 | #ifdef CONFIG_CRASH_DUMP | 1424 | #ifdef CONFIG_CRASH_DUMP |
1417 | /* | 1425 | /* |
1418 | * Check if the kernel has to be running as relocatable kernel based on the | 1426 | * Check if the kernel has to be running as relocatable kernel based on the |
1419 | * variable __kdump_flag, if it is set the kernel is treated as relocatable | 1427 | * variable __run_at_load, if it is set the kernel is treated as relocatable |
1420 | * kernel, otherwise it will be moved to PHYSICAL_START | 1428 | * kernel, otherwise it will be moved to PHYSICAL_START |
1421 | */ | 1429 | */ |
1422 | ld r7,__kdump_flag-_stext(r26) | 1430 | lwz r7,__run_at_load-_stext(r26) |
1423 | cmpldi cr0,r7,1 | 1431 | cmplwi cr0,r7,1 |
1424 | bne 3f | 1432 | bne 3f |
1425 | 1433 | ||
1426 | li r5,__end_interrupts - _stext /* just copy interrupts */ | 1434 | li r5,__end_interrupts - _stext /* just copy interrupts */ |