From: Atish Patra <atish.patra@wdc.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>,
linux-efi@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Kees Cook <keescook@chromium.org>, Nick Hu <nickhu@andestech.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Anup Patel <anup.patel@wdc.com>, Yash Shah <yash.shah@sifive.com>,
Ard Biesheuvel <ardb@kernel.org>,
Atish Patra <atish.patra@wdc.com>,
Arvind Sankar <nivedita@alum.mit.edu>,
Palmer Dabbelt <palmer@dabbelt.com>, Zong Li <zong.li@sifive.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Greentime Hu <greentime.hu@sifive.com>,
linux-riscv@lists.infradead.org, Will Deacon <will@kernel.org>,
Ingo Molnar <mingo@kernel.org>, Mike Rapoport <rppt@kernel.org>
Subject: [RFT PATCH v4 0/9] Add UEFI support for RISC-V
Date: Wed, 29 Jul 2020 16:36:26 -0700 [thread overview]
Message-ID: <20200729233635.14406-1-atish.patra@wdc.com> (raw)
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2020-07-29 23:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 23:36 Atish Patra [this message]
2020-07-29 23:36 ` [RFT PATCH v4 1/9] RISC-V: Move DT mapping outof fixmap Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 2/9] RISC-V: Add early ioremap support Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 3/9] RISC-V: Implement late mapping page table allocation functions Atish Patra
2020-07-30 9:14 ` Mike Rapoport
2020-08-03 0:55 ` Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 4/9] include: pe.h: Add RISC-V related PE definition Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 5/9] RISC-V: Add PE/COFF header for EFI stub Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 6/9] RISC-V: Add EFI stub support Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 7/9] efi: Rename arm-init to efi-init common for all arch Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 8/9] RISC-V: Add EFI runtime services Atish Patra
2020-07-29 23:36 ` [RFT PATCH v4 9/9] RISC-V: Add page table dump support for uefi Atish Patra
2020-07-31 13:25 ` [RFT PATCH v4 0/9] Add UEFI support for RISC-V Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200729233635.14406-1-atish.patra@wdc.com \
--to=atish.patra@wdc.com \
--cc=anup.patel@wdc.com \
--cc=ardb@kernel.org \
--cc=greentime.hu@sifive.com \
--cc=keescook@chromium.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mingo@kernel.org \
--cc=nickhu@andestech.com \
--cc=nivedita@alum.mit.edu \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=paulmck@kernel.org \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=yash.shah@sifive.com \
--cc=zong.li@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).