[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231011083132.2428720-1-songshuaishuai@tinylab.org>
Date: Wed, 11 Oct 2023 16:31:30 +0800
From: Song Shuai <songshuaishuai@...ylab.org>
To: paul.walmsley@...ive.com, palmer@...belt.com,
aou@...s.berkeley.edu, conor.dooley@...rochip.com,
lihuafei1@...wei.com, songshuaishuai@...ylab.org,
petr.tesarik.ext@...wei.com, duwe@...e.de, ribalda@...omium.org,
akpm@...ux-foundation.org, keescook@...omium.org, hi@...ssa.is,
heiko@...ech.de, alexghiti@...osinc.com, schwab@...e.de
Cc: linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org
Subject: [PATCH V2 0/2] riscv: kexec: cleanup and fixups
Changes since V1:
https://lore.kernel.org/linux-riscv/20230907103304.590739-1-songshuaishuai@tinylab.org/
- the old Patch2 in V1 had been merged to riscv/fixes, so take it out of this series
- Patch1 : replace `.align 2` with `.balign 4` as Andreas suggested
- Patch2 : fix the conflict caused by commit a72ab0361110 ("riscv/purgatory: Disable CFI")
riscv: kexec: Cleanup riscv_kexec_relocate (Patch1)
==================================================
For readability and simplicity, cleanup the riscv_kexec_relocate code:
- Re-sort the first 4 `mv` instructions against `riscv_kexec_method()`
- Eliminate registers for debugging (s9,s10,s11) and storing const-value (s5,s6)
- Replace `jalr` with `jr` for no-link jump
riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS (Patch2 : the Patch3 in V1)
==========================================================================
With CONFIG_RELOCATABLE enabled, KBUILD_CFLAGS had a -fPIE option
and then the purgatory/string.o was built to reference _ctype symbol
via R_RISCV_GOT_HI20 relocations which can't be handled by purgatory.
As a consequence, the kernel failed kexec_load_file() with:
[ 880.386562] kexec_image: The entry point of kernel at 0x80200000
[ 880.388650] kexec_image: Unknown rela relocation: 20
[ 880.389173] kexec_image: Error loading purgatory ret=-8
So remove the -fPIE option for PURGATORY_CFLAGS to generate
R_RISCV_PCREL_HI20 relocations type making puragtory work as it was.
Song Shuai (2):
riscv: kexec: Cleanup riscv_kexec_relocate
riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS
arch/riscv/kernel/kexec_relocate.S | 54 +++++++++++++-----------------
arch/riscv/purgatory/Makefile | 4 +++
2 files changed, 28 insertions(+), 30 deletions(-)
--
2.20.1
Powered by blists - more mailing lists