Re: [PATCH 5/5] RISC-V: Implement compile-time fixed mappings

From: Christoph Hellwig
Date: Tue Jan 15 2019 - 08:47:53 EST


On Mon, Jan 07, 2019 at 09:40:47PM +0530, Anup Patel wrote:
> From: Anup Patel <anup.patel@xxxxxxx>
>
> This patch implements compile-time virtual to physical
> mappings. These compile-time fixed mappings can be used
> by earlycon, ACPI, and early ioremap for creating fixed
> mappings when FIX_EARLYCON_MEM=y.
>
> To start with, we have enabled compile-time fixed
> mappings for earlycon.
>
> Signed-off-by: Anup Patel <anup.patel@xxxxxxx>
> ---
> arch/riscv/Kconfig | 3 ++
> arch/riscv/include/asm/fixmap.h | 52 +++++++++++++++++++++++++++++++++
> arch/riscv/mm/init.c | 32 ++++++++++++++++++++
> 3 files changed, 87 insertions(+)
> create mode 100644 arch/riscv/include/asm/fixmap.h
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index e0d7d61779a6..66094aba9a59 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -86,6 +86,9 @@ config GENERIC_CSUM
> config GENERIC_HWEIGHT
> def_bool y
>
> +config FIX_EARLYCON_MEM
> + def_bool y
> +

Can you please throw in a prep patch to move FIX_EARLYCON_MEM to
drivers/tty/serial/Kconfig and only select it from the architectures
that use it?

> + * fixmap.h: compile-time virtual memory allocation

No need to mention the header name.

> + */
> +
> +#ifndef _ASM_RISCV_FIXMAP_H
> +#define _ASM_RISCV_FIXMAP_H
> +
> +#ifndef __ASSEMBLY__

As far as I can tell we never include this header from assembly files,
so this ifdef should not be needed.

> +/*
> + * Here we define all the compile-time 'special' virtual
> + * addresses. The point is to have a constant address at
> + * compile time, but to set the physical address only
> + * in the boot process.
> + *
> + * These 'compile-time allocated' memory buffers are
> + * page-sized. Use set_fixmap(idx,phys) to associate
> + * physical memory with fixmap indices.
> + */

Please use up the available 80 chars per line for comments.