Skip to content

Commit e4e063d

Browse files
Magnus Dammpmundt
authored andcommitted
sh: rework kexec segment code
Rework the kexec code to avoid using P2SEG. Instead we walk the page list in machine_kexec() and convert the addresses from physical to virtual using C. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent 7be5c55 commit e4e063d

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎arch/sh/kernel/machine_kexec.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ void machine_kexec(struct kimage *image)
7676
unsigned long page_list;
7777
unsigned long reboot_code_buffer;
7878
relocate_new_kernel_t rnk;
79+
unsigned long entry;
80+
unsigned long *ptr;
81+
82+
/*
83+
* Nicked from the mips version of machine_kexec():
84+
* The generic kexec code builds a page list with physical
85+
* addresses. Use phys_to_virt() to convert them to virtual.
86+
*/
87+
for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE);
88+
ptr = (entry & IND_INDIRECTION) ?
89+
phys_to_virt(entry & PAGE_MASK) : ptr + 1) {
90+
if (*ptr & IND_SOURCE || *ptr & IND_INDIRECTION ||
91+
*ptr & IND_DESTINATION)
92+
*ptr = (unsigned long) phys_to_virt(*ptr);
93+
}
7994

8095
/* Interrupts aren't acceptable while we reboot */
8196
local_irq_disable();
@@ -101,7 +116,7 @@ void machine_kexec(struct kimage *image)
101116
#endif
102117
/* now call it */
103118
rnk = (relocate_new_kernel_t) reboot_code_buffer;
104-
(*rnk)(page_list, reboot_code_buffer, P2SEGADDR(image->start));
119+
(*rnk)(page_list, reboot_code_buffer, image->start);
105120
}
106121

107122
void arch_crash_save_vmcoreinfo(void)

‎arch/sh/kernel/relocate_kernel.S‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ relocate_new_kernel:
1818
/* r6 = start_address */
1919

2020
mov.l 10f,r8 /* PAGE_SIZE */
21-
mov.l 11f,r9 /* P2SEG */
2221

2322
/* stack setting */
2423
add r8,r5
@@ -29,9 +28,8 @@ relocate_new_kernel:
2928
0:
3029
mov.l @r4+,r0 /* cmd = *ind++ */
3130

32-
1: /* addr = (cmd | P2SEG) & 0xfffffff0 */
31+
1: /* addr = cmd & 0xfffffff0 */
3332
mov r0,r2
34-
or r9,r2
3533
mov #-16,r1
3634
and r1,r2
3735

@@ -85,8 +83,6 @@ relocate_new_kernel:
8583
.align 2
8684
10:
8785
.long PAGE_SIZE
88-
11:
89-
.long P2SEG
9086

9187
relocate_new_kernel_end:
9288

0 commit comments

Comments
 (0)