Message ID | 1411638824-66243-1-git-send-email-sdu.liu@huawei.com |
---|---|
State | New |
Headers | show |
On 2014/9/25 17:53, Liu Hua wrote: > From: Dave Martin <dave.martin@linaro.org> > > Hi Greg, > > commit e2ccba49085ab5d71b092de2a5176eb9b19cc876 upstream commit XXX upstream. <-- don't forget the dot > > Copying a function with memcpy() and then trying to execute the > result isn't trivially portable to Thumb. > > This patch modifies the kexec soft restart code to copy its > assembler trampoline relocate_new_kernel() using fncpy() instead, > so that relocate_new_kernel can be in the same ISA as the rest of > the kernel without problems. > > Without this patch THUMB2 kernel can not go through kdump process. > I have test it on 3.10. This patch applies to v3.13+. 3.10 stable > and 3.12stable need it. > Please don't stuff this into the middle of the original changelog... > (1) A separate backport is needed for 3.10; Then send out the backport. > (2) it can apply to 3.12 stable directly. 3.12 is maintained by Jiri. > > Signed-off-by: Dave Martin <Dave.Martin@arm.com> > Acked-by: Will Deacon <will.deacon@arm.com> > Reported-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> > Tested-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> > Integrated-by: Liu Hua <sdu.liu@huawei.com> Please remove this line. > Signed-off-by: Liu Hua <sdu.liu@huawei.com> If the commit can be cherry-picked cleanly, just tell the stable maintainer the commit ID, otherwise you should add changelog for what you did to the original patch. Like this: https://lkml.org/lkml/2014/9/22/818 [lizf: Backported to 3.4: - Drop changes to arch/arm/include/asm/cacheflush.h and arch/arm/mach-exynos/mcpm-exynos.c] Signed-off-by: Zefan Li <lizefan@huawei.com>] -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
δΊ 2014/9/25 20:10, Zefan Li ει: > On 2014/9/25 17:53, Liu Hua wrote: >> From: Dave Martin <dave.martin@linaro.org> >> >> Hi Greg, >> >> commit e2ccba49085ab5d71b092de2a5176eb9b19cc876 upstream > > commit XXX upstream. <-- don't forget the dot Thanks, I will change this. > >> >> Copying a function with memcpy() and then trying to execute the >> result isn't trivially portable to Thumb. >> >> This patch modifies the kexec soft restart code to copy its >> assembler trampoline relocate_new_kernel() using fncpy() instead, >> so that relocate_new_kernel can be in the same ISA as the rest of >> the kernel without problems. >> >> Without this patch THUMB2 kernel can not go through kdump process. >> I have test it on 3.10. This patch applies to v3.13+. 3.10 stable >> and 3.12stable need it. >> > > Please don't stuff this into the middle of the original changelog... > >> (1) A separate backport is needed for 3.10; > > Then send out the backport. > >> (2) it can apply to 3.12 stable directly. > > 3.12 is maintained by Jiri. This is to say I should send two mails for this upstreamed patch ? > >> >> Signed-off-by: Dave Martin <Dave.Martin@arm.com> >> Acked-by: Will Deacon <will.deacon@arm.com> >> Reported-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> >> Tested-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> >> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> >> Integrated-by: Liu Hua <sdu.liu@huawei.com> > > Please remove this line. > >> Signed-off-by: Liu Hua <sdu.liu@huawei.com> > > If the commit can be cherry-picked cleanly, just tell the stable > maintainer the commit ID, otherwise you should add changelog > for what you did to the original patch. > > Like this: > > https://lkml.org/lkml/2014/9/22/818 > > [lizf: Backported to 3.4: > - Drop changes to arch/arm/include/asm/cacheflush.h and > arch/arm/mach-exynos/mcpm-exynos.c] > Signed-off-by: Zefan Li <lizefan@huawei.com>] Thank you very much, I will resend the patch? > > > . > -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index c3ef920..70ae735 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -14,10 +14,11 @@ #include <asm/pgalloc.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h> +#include <asm/fncpy.h> #include <asm/mach-types.h> #include <asm/system_misc.h> -extern const unsigned char relocate_new_kernel[]; +extern void relocate_new_kernel(void); extern const unsigned int relocate_new_kernel_size; extern unsigned long kexec_start_address; @@ -133,6 +134,8 @@ void machine_kexec(struct kimage *image) { unsigned long page_list; unsigned long reboot_code_buffer_phys; + unsigned long reboot_entry = (unsigned long)relocate_new_kernel; + unsigned long reboot_entry_phys; void *reboot_code_buffer; if (num_online_cpus() > 1) { @@ -156,18 +159,18 @@ void machine_kexec(struct kimage *image) /* copy our kernel relocation code to the control code page */ - memcpy(reboot_code_buffer, - relocate_new_kernel, relocate_new_kernel_size); + reboot_entry = fncpy(reboot_code_buffer, + reboot_entry, + relocate_new_kernel_size); + reboot_entry_phys = (unsigned long)reboot_entry + + (reboot_code_buffer_phys - (unsigned long)reboot_code_buffer); - - flush_icache_range((unsigned long) reboot_code_buffer, - (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); printk(KERN_INFO "Bye!\n"); if (kexec_reinit) kexec_reinit(); - soft_restart(reboot_code_buffer_phys); + soft_restart(reboot_entry_phys); } void arch_crash_save_vmcoreinfo(void) diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S index d0cdedf..9585896 100644 --- a/arch/arm/kernel/relocate_kernel.S +++ b/arch/arm/kernel/relocate_kernel.S @@ -2,10 +2,12 @@ * relocate_kernel.S - put the kernel image in place to boot */ +#include <linux/linkage.h> #include <asm/kexec.h> - .globl relocate_new_kernel -relocate_new_kernel: + .align 3 /* not needed for this code, but keeps fncpy() happy */ + +ENTRY(relocate_new_kernel) ldr r0,kexec_indirection_page ldr r1,kexec_start_address @@ -79,6 +81,8 @@ kexec_mach_type: kexec_boot_atags: .long 0x0 +ENDPROC(relocate_new_kernel) + relocate_new_kernel_end: .globl relocate_new_kernel_size