Message ID | 20200421033336.9663-2-atish.patra@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add UEFI support for RISC-V | expand |
I missed that there's a v4 now, so I'm jumping over here On Mon, 20 Apr 2020 20:33:34 PDT (-0700), Atish Patra wrote: > UEFI uses early IO or memory mappings for runtime services before > normal ioremap() is usable. This patch only adds minimum necessary > fixmap bindings and headers for generic ioremap support to work. > > Signed-off-by: Atish Patra <atish.patra@wdc.com> > Acked-by: Ard Biesheuvel <ardb@kernel.org> > --- > arch/riscv/Kconfig | 1 + > arch/riscv/include/asm/Kbuild | 1 + > arch/riscv/include/asm/fixmap.h | 18 ++++++++++++++++++ > arch/riscv/include/asm/io.h | 1 + > 4 files changed, 21 insertions(+) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index a197258595ef..f39e326a7a42 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -68,6 +68,7 @@ config RISCV > select ARCH_HAS_GCOV_PROFILE_ALL > select HAVE_COPY_THREAD_TLS > select HAVE_ARCH_KASAN if MMU && 64BIT > + select GENERIC_EARLY_IOREMAP > > config ARCH_MMAP_RND_BITS_MIN > default 18 if 64BIT > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > index 3d9410bb4de0..59dd7be55005 100644 > --- a/arch/riscv/include/asm/Kbuild > +++ b/arch/riscv/include/asm/Kbuild > @@ -1,4 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0 > +generic-y += early_ioremap.h > generic-y += extable.h > generic-y += flat.h > generic-y += kvm_para.h > diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h > index 2368d49eb4ef..ba5096d65fb0 100644 > --- a/arch/riscv/include/asm/fixmap.h > +++ b/arch/riscv/include/asm/fixmap.h > @@ -30,6 +30,24 @@ enum fixed_addresses { > FIX_TEXT_POKE1, > FIX_TEXT_POKE0, > FIX_EARLYCON_MEM_BASE, > + /* > + * Make sure that it is 2MB aligned. > + */ > +#define NR_FIX_SZ_2M (SZ_2M / PAGE_SIZE) > + FIX_THOLE = NR_FIX_SZ_2M - FIX_PMD - 1, > + > + __end_of_permanent_fixed_addresses, > + /* > + * Temporary boot-time mappings, used by early_ioremap(), > + * before ioremap() is functional. > + */ > +#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) > +#define FIX_BTMAPS_SLOTS 7 > +#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) > + > + FIX_BTMAP_END = __end_of_permanent_fixed_addresses, > + FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, > + > __end_of_fixed_addresses > }; > > diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h > index 0f477206a4ed..047f414b6948 100644 > --- a/arch/riscv/include/asm/io.h > +++ b/arch/riscv/include/asm/io.h > @@ -14,6 +14,7 @@ > #include <linux/types.h> > #include <asm/mmiowb.h> > #include <asm/pgtable.h> > +#include <asm/early_ioremap.h> > > /* > * MMIO access functions are separated out to break dependency cycles Just so it doesn't get lost (the patch is the same) Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
On Tue, Apr 21, 2020 at 12:52 PM Palmer Dabbelt <palmer@dabbelt.com> wrote: > > I missed that there's a v4 now, so I'm jumping over here > Thanks. Just FYI: Ard has already pulled the patches 1 & 2 into efi-next. So the v4 will only have 3 patches, mostly riscv specific stuff. > On Mon, 20 Apr 2020 20:33:34 PDT (-0700), Atish Patra wrote: > > UEFI uses early IO or memory mappings for runtime services before > > normal ioremap() is usable. This patch only adds minimum necessary > > fixmap bindings and headers for generic ioremap support to work. > > > > Signed-off-by: Atish Patra <atish.patra@wdc.com> > > Acked-by: Ard Biesheuvel <ardb@kernel.org> > > --- > > arch/riscv/Kconfig | 1 + > > arch/riscv/include/asm/Kbuild | 1 + > > arch/riscv/include/asm/fixmap.h | 18 ++++++++++++++++++ > > arch/riscv/include/asm/io.h | 1 + > > 4 files changed, 21 insertions(+) > > > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > > index a197258595ef..f39e326a7a42 100644 > > --- a/arch/riscv/Kconfig > > +++ b/arch/riscv/Kconfig > > @@ -68,6 +68,7 @@ config RISCV > > select ARCH_HAS_GCOV_PROFILE_ALL > > select HAVE_COPY_THREAD_TLS > > select HAVE_ARCH_KASAN if MMU && 64BIT > > + select GENERIC_EARLY_IOREMAP > > > > config ARCH_MMAP_RND_BITS_MIN > > default 18 if 64BIT > > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > > index 3d9410bb4de0..59dd7be55005 100644 > > --- a/arch/riscv/include/asm/Kbuild > > +++ b/arch/riscv/include/asm/Kbuild > > @@ -1,4 +1,5 @@ > > # SPDX-License-Identifier: GPL-2.0 > > +generic-y += early_ioremap.h > > generic-y += extable.h > > generic-y += flat.h > > generic-y += kvm_para.h > > diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h > > index 2368d49eb4ef..ba5096d65fb0 100644 > > --- a/arch/riscv/include/asm/fixmap.h > > +++ b/arch/riscv/include/asm/fixmap.h > > @@ -30,6 +30,24 @@ enum fixed_addresses { > > FIX_TEXT_POKE1, > > FIX_TEXT_POKE0, > > FIX_EARLYCON_MEM_BASE, > > + /* > > + * Make sure that it is 2MB aligned. > > + */ > > +#define NR_FIX_SZ_2M (SZ_2M / PAGE_SIZE) > > + FIX_THOLE = NR_FIX_SZ_2M - FIX_PMD - 1, > > + > > + __end_of_permanent_fixed_addresses, > > + /* > > + * Temporary boot-time mappings, used by early_ioremap(), > > + * before ioremap() is functional. > > + */ > > +#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) > > +#define FIX_BTMAPS_SLOTS 7 > > +#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) > > + > > + FIX_BTMAP_END = __end_of_permanent_fixed_addresses, > > + FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, > > + > > __end_of_fixed_addresses > > }; > > > > diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h > > index 0f477206a4ed..047f414b6948 100644 > > --- a/arch/riscv/include/asm/io.h > > +++ b/arch/riscv/include/asm/io.h > > @@ -14,6 +14,7 @@ > > #include <linux/types.h> > > #include <asm/mmiowb.h> > > #include <asm/pgtable.h> > > +#include <asm/early_ioremap.h> > > > > /* > > * MMIO access functions are separated out to break dependency cycles > > Just so it doesn't get lost (the patch is the same) > > Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index a197258595ef..f39e326a7a42 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -68,6 +68,7 @@ config RISCV select ARCH_HAS_GCOV_PROFILE_ALL select HAVE_COPY_THREAD_TLS select HAVE_ARCH_KASAN if MMU && 64BIT + select GENERIC_EARLY_IOREMAP config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild index 3d9410bb4de0..59dd7be55005 100644 --- a/arch/riscv/include/asm/Kbuild +++ b/arch/riscv/include/asm/Kbuild @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +generic-y += early_ioremap.h generic-y += extable.h generic-y += flat.h generic-y += kvm_para.h diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h index 2368d49eb4ef..ba5096d65fb0 100644 --- a/arch/riscv/include/asm/fixmap.h +++ b/arch/riscv/include/asm/fixmap.h @@ -30,6 +30,24 @@ enum fixed_addresses { FIX_TEXT_POKE1, FIX_TEXT_POKE0, FIX_EARLYCON_MEM_BASE, + /* + * Make sure that it is 2MB aligned. + */ +#define NR_FIX_SZ_2M (SZ_2M / PAGE_SIZE) + FIX_THOLE = NR_FIX_SZ_2M - FIX_PMD - 1, + + __end_of_permanent_fixed_addresses, + /* + * Temporary boot-time mappings, used by early_ioremap(), + * before ioremap() is functional. + */ +#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) +#define FIX_BTMAPS_SLOTS 7 +#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) + + FIX_BTMAP_END = __end_of_permanent_fixed_addresses, + FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, + __end_of_fixed_addresses }; diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index 0f477206a4ed..047f414b6948 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -14,6 +14,7 @@ #include <linux/types.h> #include <asm/mmiowb.h> #include <asm/pgtable.h> +#include <asm/early_ioremap.h> /* * MMIO access functions are separated out to break dependency cycles