* [PATCHv2] arm64/crashdump-arm64: deduce the paddr of _text
@ 2021-05-26 10:41 Pingfan Liu
2021-06-06 6:54 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Pingfan Liu @ 2021-05-26 10:41 UTC (permalink / raw)
To: kexec; +Cc: Pingfan Liu, Simon Horman
Since kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from
permanent kernel mapping"), the physical address of 'Kernel code' in
/proc/iomem is mapped from _text, instead, from _stext.
Taking the compatibility into account, it had better deduce the paddr of
_text despite of the unavailability through /proc/iomem. It can be
achieved by utilizing the fact _text aligned on 2MB.
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Cc: Simon Horman <horms@verge.net.au>
To: kexec@lists.infradead.org
---
v1 -> v2:
deduce paddr of _text to cope with compability.
kexec/arch/arm64/crashdump-arm64.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
index 38d1a0f..03d6204 100644
--- a/kexec/arch/arm64/crashdump-arm64.c
+++ b/kexec/arch/arm64/crashdump-arm64.c
@@ -90,8 +90,16 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
return mem_regions_alloc_and_add(&system_memory_rgns,
base, length, RANGE_RAM);
- else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
- elf_info.kern_paddr_start = base;
+ else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0) {
+ /*
+ * old: kernel_code.start = __pa_symbol(_text);
+ * new: kernel_code.start = __pa_symbol(_stext);
+ *
+ * By utilizing the fact that paddr(_text) should align on 2MB, plus
+ * _stext - _text <= 64K.
+ */
+ elf_info.kern_paddr_start = base & ((0xffffffffffffffffUL) << 21);
+ }
else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
elf_info.kern_size = base + length - elf_info.kern_paddr_start;
--
2.29.2
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2] arm64/crashdump-arm64: deduce the paddr of _text
2021-05-26 10:41 [PATCHv2] arm64/crashdump-arm64: deduce the paddr of _text Pingfan Liu
@ 2021-06-06 6:54 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2021-06-06 6:54 UTC (permalink / raw)
To: Pingfan Liu; +Cc: kexec
On Wed, May 26, 2021 at 06:41:28PM +0800, Pingfan Liu wrote:
> Since kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from
> permanent kernel mapping"), the physical address of 'Kernel code' in
> /proc/iomem is mapped from _text, instead, from _stext.
>
> Taking the compatibility into account, it had better deduce the paddr of
> _text despite of the unavailability through /proc/iomem. It can be
> achieved by utilizing the fact _text aligned on 2MB.
>
> Signed-off-by: Pingfan Liu <piliu@redhat.com>
> Cc: Simon Horman <horms@verge.net.au>
> To: kexec@lists.infradead.org
> ---
> v1 -> v2:
> deduce paddr of _text to cope with compability.
Thanks, and sorry for the delay.
Applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-06 6:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-26 10:41 [PATCHv2] arm64/crashdump-arm64: deduce the paddr of _text Pingfan Liu
2021-06-06 6:54 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox