lkml.org 
[lkml]   [2021]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] RISC-V: Always define XIP_FIXUP
From
Date
Le 4/27/21 à 11:34 PM, Palmer Dabbelt a écrit :
> From: Palmer Dabbelt <palmerdabbelt@google.com>
>
> XIP depends on MMU, but XIP_FIXUP is defined throughout the kernel in
> order to avoid excessive ifdefs. This just makes sure to always define
> XIP_FIXIP, which will fix MMU=n builds.

A small typo here.

>
> Fixes: 44c922572952 ("RISC-V: enable XIP")
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
> ---
> arch/riscv/include/asm/pgtable.h | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 2f1384e14e31..fd749351f432 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -73,18 +73,6 @@
> #endif
> #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
>
> -#ifdef CONFIG_XIP_KERNEL
> -#define XIP_OFFSET SZ_8M
> -#define XIP_FIXUP(addr) ({ \
> - uintptr_t __a = (uintptr_t)(addr); \
> - (__a >= CONFIG_XIP_PHYS_ADDR && __a < CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \
> - __a - CONFIG_XIP_PHYS_ADDR + CONFIG_PHYS_RAM_BASE - XIP_OFFSET :\
> - __a; \
> - })
> -#else
> -#define XIP_FIXUP(addr) (addr)
> -#endif /* CONFIG_XIP_KERNEL */
> -
> #endif
>
> #ifndef __ASSEMBLY__
> @@ -101,6 +89,18 @@
> #include <asm/pgtable-32.h>
> #endif /* CONFIG_64BIT */
>
> +#ifdef CONFIG_XIP_KERNEL
> +#define XIP_OFFSET SZ_8M


XIP_OFFSET is used in head.S and then this breaks XIP_KERNEL. XIP_OFFSET
must live outside the ifndef __ASSEMBLY__.


> +#define XIP_FIXUP(addr) ({ \
> + uintptr_t __a = (uintptr_t)(addr); \
> + (__a >= CONFIG_XIP_PHYS_ADDR && __a < CONFIG_XIP_PHYS_ADDR + SZ_16M) ? \
> + __a - CONFIG_XIP_PHYS_ADDR + CONFIG_PHYS_RAM_BASE - XIP_OFFSET :\
> + __a; \
> + })
> +#else
> +#define XIP_FIXUP(addr) (addr)
> +#endif /* CONFIG_XIP_KERNEL */
> +
> #ifdef CONFIG_MMU
> /* Number of entries in the page global directory */
> #define PTRS_PER_PGD (PAGE_SIZE / sizeof(pgd_t))
>

Thank you for doing that!

Alex

\
 
 \ /
  Last update: 2021-04-28 10:27    [W:0.105 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site