[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200729233635.14406-1-atish.patra@wdc.com>
Date: Wed, 29 Jul 2020 16:36:26 -0700
From: Atish Patra <atish.patra@....com>
To: linux-kernel@...r.kernel.org
Cc: Atish Patra <atish.patra@....com>, Anup Patel <anup.patel@....com>,
Ard Biesheuvel <ardb@...nel.org>,
Arvind Sankar <nivedita@...m.mit.edu>,
Greentime Hu <greentime.hu@...ive.com>,
Ingo Molnar <mingo@...nel.org>,
Kees Cook <keescook@...omium.org>, linux-efi@...r.kernel.org,
linux-riscv@...ts.infradead.org,
Mark Rutland <mark.rutland@....com>,
Masahiro Yamada <masahiroy@...nel.org>,
Mike Rapoport <rppt@...nel.org>,
Nick Hu <nickhu@...estech.com>,
Palmer Dabbelt <palmer@...belt.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>,
Yash Shah <yash.shah@...ive.com>, Zong Li <zong.li@...ive.com>
Subject: [RFT PATCH v4 0/9] Add UEFI support for RISC-V
This series adds UEFI support for RISC-V.
Linux kernel: 5.8-rc7 + 1 exception vector setup patch (queued for for-next)
U-Boot: v2020.07
OpenSBI: master
This series depends on early setup of exeception vector patch
http://lists.infradead.org/pipermail/linux-riscv/2020-July/001207.html
Patch 1-3 are generic riscv feature addition required for UEFI support.
Patch 4-7 adds the efi stub support for RISC-V which was reviewed few months back.
https://www.spinics.net/lists/linux-efi/msg19144.html
Patch 8 just renames arm-init code so that it can be used across different
architectures. Patch 11 adds the runtime services for RISC-V.
The working set of patches can also be found in following git repo.
https://github.com/atishp04/linux/tree/uefi_riscv_5.9_v4
The patches have been verified on Qemu/HiFive unleashed using bootefi command in
U-Boot for both RV32 and RV64.
For RV32, maximum allocated memory should be 1G as RISC-V kernel can not map
beyond 1G of physical memory for RV32.
Runtime services have been verified with fwts. Here is the snippet of the result.
***********************************************************************
This test run on 16/07/20 at 17:54:53 on host Linux fedora-riscv
5.8.0-rc5-00015-g5e61441080fd-dirty #938 SMP Thu Jul 16 14:50:11 PDT 2020
riscv64.
Command: "fwts uefirtvariable".
Running tests: uefirtvariable.
uefirtvariable: UEFI Runtime service variable interface tests.
Test 1 of 9: Test UEFI RT service get variable interface.
SKIPPED: Test 1, Skipping test, SetVariable runtime service is not supported on
this platform.
Test 2 of 9: Test UEFI RT service get next variable name interface.
The runtime service GetNextVariableName interface function test.
SKIPPED: Test 2, Skipping test, SetVariable runtime service is not supported on
this platform.
...
Test 4 of 9: Test UEFI RT service query variable info interface.
SKIPPED: Test 4, Not support the QueryVariableInfo UEFI runtime interface:
cannot test.
ADVICE: Firmware also needs to check if the revision of system table is correct
or not. Linux kernel returns EFI_UNSUPPORTED as well, if the FirmwareRevision of
system table is less than EFI_2_00_SYSTEM_TABLE_REVISION.
...
***********************************************************************
Currently, U-Boot EFI implementation returns EFI_UNSUPPORTED for set_variable
service. That's why all tests have been skipped but I manually verified that the
value is returned from U-Boot not kernel :).
EDK2 can boot quite far into Linux with the current series. However, it crashes
before userspace because of a possible memory corruption by EDK2.
Changes from v3->v4:
1. Used pgd mapping to avoid copying DT to bss.
Changes from v2->v3:
1. Fixed few bugs in run time services page table mapping.
2. Dropped patch 1 as it is already taken into efi-tree.
3. Sent few generic mmu fixes as a separate series to ease the merge conflicts.
Changes from v1->v2:
1. Removed patch 1 as it is already taken into efi-tree.
2. Fixed compilation issues with patch 9.
3. Moved few function prototype declaration to header file to keep kbuild happy.
Changes from previous version:
1. Added full ioremap support.
2. Added efi runtime services support.
3. Fixes mm issues
Anup Patel (1):
RISC-V: Move DT mapping outof fixmap
Atish Patra (8):
RISC-V: Add early ioremap support
RISC-V: Implement late mapping page table allocation functions
include: pe.h: Add RISC-V related PE definition
RISC-V: Add PE/COFF header for EFI stub
RISC-V: Add EFI stub support.
efi: Rename arm-init to efi-init common for all arch
RISC-V: Add EFI runtime services
RISC-V: Add page table dump support for uefi
arch/riscv/Kconfig | 25 +++
arch/riscv/Makefile | 1 +
arch/riscv/configs/defconfig | 1 +
arch/riscv/include/asm/Kbuild | 1 +
arch/riscv/include/asm/efi.h | 56 +++++++
arch/riscv/include/asm/fixmap.h | 16 +-
arch/riscv/include/asm/io.h | 1 +
arch/riscv/include/asm/mmu.h | 2 +
arch/riscv/include/asm/pgtable.h | 5 +
arch/riscv/include/asm/sections.h | 13 ++
arch/riscv/kernel/Makefile | 5 +
arch/riscv/kernel/efi-header.S | 104 +++++++++++++
arch/riscv/kernel/efi.c | 105 +++++++++++++
arch/riscv/kernel/head.S | 17 ++-
arch/riscv/kernel/head.h | 2 -
arch/riscv/kernel/image-vars.h | 51 +++++++
arch/riscv/kernel/setup.c | 17 ++-
arch/riscv/kernel/vmlinux.lds.S | 22 ++-
arch/riscv/mm/init.c | 90 ++++++++---
arch/riscv/mm/ptdump.c | 48 +++++-
drivers/firmware/efi/Kconfig | 3 +-
drivers/firmware/efi/Makefile | 4 +-
.../firmware/efi/{arm-init.c => efi-init.c} | 0
drivers/firmware/efi/libstub/Makefile | 10 ++
drivers/firmware/efi/libstub/efi-stub.c | 11 +-
drivers/firmware/efi/libstub/riscv-stub.c | 110 ++++++++++++++
drivers/firmware/efi/riscv-runtime.c | 143 ++++++++++++++++++
include/linux/pe.h | 3 +
28 files changed, 825 insertions(+), 41 deletions(-)
create mode 100644 arch/riscv/include/asm/efi.h
create mode 100644 arch/riscv/include/asm/sections.h
create mode 100644 arch/riscv/kernel/efi-header.S
create mode 100644 arch/riscv/kernel/efi.c
create mode 100644 arch/riscv/kernel/image-vars.h
rename drivers/firmware/efi/{arm-init.c => efi-init.c} (100%)
create mode 100644 drivers/firmware/efi/libstub/riscv-stub.c
create mode 100644 drivers/firmware/efi/riscv-runtime.c
--
2.24.0
Powered by blists - more mailing lists