Skip to contentSkip to conversation

sh: simplify kexec vbr code V2

PATCH In review Magnus Damm 2 participants 2 messages Mar 18, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: simplify kexec vbr code V2

From: Magnus Damm <[email protected]>

Setup the vbr register in machine_kexec() V2. This instead of passing values to the assembly snippet.

---

Changes since V1:
- added a call to set_bl_bit() to block exceptions

 arch/sh/kernel/machine_kexec.c   |   17 ++++++++---------
 arch/sh/kernel/relocate_kernel.S |    4 ----
 2 files changed, 8 insertions(+), 13 deletions(-)
arch/sh/kernel/machine_kexec.c +8 -9
@@ -23,8 +23,7 @@
 typedef NORET_TYPE void (*relocate_new_kernel_t)(
 				unsigned long indirection_page,
 				unsigned long reboot_code_buffer,
-				unsigned long start_address,
-				unsigned long vbr_reg) ATTRIB_NORET;
+				unsigned long start_address) ATTRIB_NORET;
 
 extern const unsigned char relocate_new_kernel[];
 extern const unsigned int relocate_new_kernel_size;
@@ -76,14 +75,8 @@ void machine_kexec(struct kimage *image)
 
 	unsigned long page_list;
 	unsigned long reboot_code_buffer;
-	unsigned long vbr_reg;
 	relocate_new_kernel_t rnk;
 
-#if defined(CONFIG_SH_STANDARD_BIOS)
-	vbr_reg = ((unsigned long )gdb_vbr_vector) - 0x100;
-#else
-	vbr_reg = 0x80000000;  // dummy
-#endif
 	/* Interrupts aren't acceptable while we reboot */
 	local_irq_disable();
 
@@ -100,9 +93,15 @@ void machine_kexec(struct kimage *image)
         kexec_info(image);
 	flush_cache_all();
 
+	set_bl_bit();
+#if defined(CONFIG_SH_STANDARD_BIOS)
+	asm volatile("ldc %0, vbr" :
+		     : "r" (((unsigned long) gdb_vbr_vector) - 0x100)
+		     : "memory");
+#endif
 	/* now call it */
 	rnk = (relocate_new_kernel_t) reboot_code_buffer;
-	(*rnk)(page_list, reboot_code_buffer, P2SEGADDR(image->start), vbr_reg);
+	(*rnk)(page_list, reboot_code_buffer, P2SEGADDR(image->start));
 }
 
 void arch_crash_save_vmcoreinfo(void)
arch/sh/kernel/relocate_kernel.S +0 -4
@@ -16,7 +16,6 @@ relocate_new_kernel:
 	/* r4 = indirection_page   */
 	/* r5 = reboot_code_buffer */
 	/* r6 = start_address      */
-	/* r7 = vbr_reg            */
 
 	mov.l	10f,r8	  /* PAGE_SIZE */
 	mov.l	11f,r9    /* P2SEG */
@@ -80,9 +79,6 @@ relocate_new_kernel:
 	bra	0b
 	nop
 6:
-#ifdef CONFIG_SH_STANDARD_BIOS
-	ldc   r7, vbr
-#endif
 	jmp @r6
 	nop
 
#1 lore raw
Quoted 2 lines · Magnus Damm

Setup the vbr register in machine_kexec() V2. This instead of passing values to the assembly snippet.

Quoted 3 lines · Magnus Damm

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.

Quoted 10 lines · Magnus Damm

Add kexec jump support to the SuperH architecture V2.

Similar to the x86 implementation, with the following exceptions:

- Instead of separating the assembly code flow into two parts for regular kexec and kexec jump we use a single code path. In the assembly snippet regular kexec is just kexec jump that never comes back.

Quoted 6 lines

- Instead of using a swap page when moving data between pages the page copy assembly routine has been modified to exchange the data between the pages using registers.

- We walk the page list twice in machine_kexec() to do and undo physical to virtual address conversion.

Applied with a few fixups, including ftrace state save/restore.