[PATCH] makedumpfile: mips64: Replace hardcoded values with macros

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Sep 15 00:18:40 PDT 2022


On 2022/09/14 19:13, Chetan Kankotiya wrote:
> Replace hardcoded values of PAGE_OFFSET, XKPHS start and end address,
> and _MAX_PHYSMEM_BITS with macros that may differ based on kernel-defined
> values for different MIPS SoCs. We can override these macros to align
> with kernel values at compile time.
> 
> Signed-off-by: Chetan Kankotiya <ckankoti at cisco.com>

Thanks, applied.
https://github.com/makedumpfile/makedumpfile/commit/36cdfd91d7870649c186457c5051f5c435ab199e

Kazu

> ---
>   arch/mips64.c  |  4 ++--
>   makedumpfile.h | 17 +++++++++++++++++
>   2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips64.c b/arch/mips64.c
> index d541c3e..ab45b6e 100644
> --- a/arch/mips64.c
> +++ b/arch/mips64.c
> @@ -52,7 +52,7 @@ get_machdep_info_mips64(void)
>   int
>   get_versiondep_info_mips64(void)
>   {
> -	info->page_offset  = 0x9800000000000000ULL;
> +	info->page_offset  = _PAGE_OFFSET;
>   
>   	DEBUG_MSG("page_offset : %lx\n", info->page_offset);
>   
> @@ -79,7 +79,7 @@ vaddr_to_paddr_mips64(unsigned long vaddr)
>   	/*
>   	 * XKPHYS
>   	 */
> -	if (vaddr >= 0x9000000000000000ULL && vaddr < 0xc000000000000000ULL)
> +	if (vaddr >= _XKPHYS_START_ADDR && vaddr < _XKPHYS_END_ADDR)
>   		return vaddr & ((1ULL << MAX_PHYSMEM_BITS()) - 1);
>   
>   	if (SYMBOL(swapper_pg_dir) == NOT_FOUND_SYMBOL) {
> diff --git a/makedumpfile.h b/makedumpfile.h
> index 2084ed5..49b9242 100644
> --- a/makedumpfile.h
> +++ b/makedumpfile.h
> @@ -965,8 +965,25 @@ typedef unsigned long pgd_t;
>   
>   #ifdef __mips64__ /* mips64 */
>   #define KVBASE			PAGE_OFFSET
> +
> +#ifndef _XKPHYS_START_ADDR
> +#define _XKPHYS_START_ADDR	0x9000000000000000ULL /* _LOONGSON_XKPHYS_START_ADDR */
> +#endif
> +
> +#ifndef _XKPHYS_END_ADDR
> +#define _XKPHYS_END_ADDR	0xc000000000000000ULL /* _LOONGSON_XKPHYS_END_ADDR */
> +#endif
> +
> +#ifndef _PAGE_OFFSET
> +#define _PAGE_OFFSET		0x9800000000000000ULL
> +#endif
> +
>   #define _SECTION_SIZE_BITS	(28)
> +
> +#ifndef _MAX_PHYSMEM_BITS
>   #define _MAX_PHYSMEM_BITS	(48)
> +#endif
> +
>   #define _PAGE_PRESENT		(1 << 0)
>   #define _PAGE_HUGE		(1 << 4)
>   


More information about the kexec mailing list