mbox series

[v4,0/3] Add UEFI support for RISC-V

Message ID 20200421033336.9663-1-atish.patra@wdc.com (mailing list archive)
Headers show
Series Add UEFI support for RISC-V | expand

Message

Atish Patra April 21, 2020, 3:33 a.m. UTC
This series adds UEFI support for RISC-V. Currently, only boot time
services have been added. Runtime services will be added in a separate
series. This series depends on some core EFI patches
present in current in efi-next and following other patches.

U-Boot: Adds the boot hartid under chosen node.
https://lists.denx.de/pipermail/u-boot/2020-April/405726.html

Linux kernel: 5.7-rc1

OpenSBI: master

Patch 1 just moves arm-stub code to a generic code so that it can be used
across different architecture.

Patch 3 adds fixmap bindings so that CONFIG_EFI can be compiled and we do not
have create separate config to enable boot time services. 
As runtime services are not enabled at this time, full generic early ioremap
support is also not added in this series.

Patch 4 and 5 adds the PE/COFF header and EFI stub code support for RISC-V
respectively.

The patches can also be found in following git repo.

https://github.com/atishp04/linux/tree/wip_uefi_riscv_v4

The patches have been verified on Qemu using bootefi command in U-Boot.

Changes from v3->v4:
1. Rebased on top of efi-next.
2. Dropped patch 1 & 2 from this series as it is already queued in efi-next.
Changes from v2->v3:
3. Improved handle_kernel_image() for RISC-V.

Changes from v1->v2:
1. Rebased on 5.7-rc1.
2. Fixed minor typos and removed redundant macros/comments.

Changes from previous version:
1. Renamed to the generic efi stub macro.
2. Address all redundant comments.
3. Supported EFI kernel image with normal booti command.
4. Removed runtime service related macro defines.

Atish Patra (3):
RISC-V: Define fixmap bindings for generic early ioremap support
RISC-V: Add PE/COFF header for EFI stub
RISC-V: Add EFI stub support.

arch/riscv/Kconfig                        |  21 +++++
arch/riscv/Makefile                       |   1 +
arch/riscv/configs/defconfig              |   1 +
arch/riscv/include/asm/Kbuild             |   1 +
arch/riscv/include/asm/efi.h              |  44 +++++++++
arch/riscv/include/asm/fixmap.h           |  18 ++++
arch/riscv/include/asm/io.h               |   1 +
arch/riscv/include/asm/sections.h         |  13 +++
arch/riscv/kernel/Makefile                |   4 +
arch/riscv/kernel/efi-header.S            |  99 ++++++++++++++++++++
arch/riscv/kernel/head.S                  |  16 ++++
arch/riscv/kernel/image-vars.h            |  53 +++++++++++
arch/riscv/kernel/vmlinux.lds.S           |  20 +++-
drivers/firmware/efi/Kconfig              |   2 +-
drivers/firmware/efi/libstub/Makefile     |  10 ++
drivers/firmware/efi/libstub/riscv-stub.c | 106 ++++++++++++++++++++++
16 files changed, 407 insertions(+), 3 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/image-vars.h
create mode 100644 drivers/firmware/efi/libstub/riscv-stub.c

--
2.24.0

Comments

Ard Biesheuvel April 21, 2020, 7:24 a.m. UTC | #1
On Tue, 21 Apr 2020 at 05:34, Atish Patra <atish.patra@wdc.com> wrote:
>
> This series adds UEFI support for RISC-V. Currently, only boot time
> services have been added. Runtime services will be added in a separate
> series. This series depends on some core EFI patches
> present in current in efi-next and following other patches.
>
> U-Boot: Adds the boot hartid under chosen node.
> https://lists.denx.de/pipermail/u-boot/2020-April/405726.html
>
> Linux kernel: 5.7-rc1
>
> OpenSBI: master
>
> Patch 1 just moves arm-stub code to a generic code so that it can be used
> across different architecture.
>
> Patch 3 adds fixmap bindings so that CONFIG_EFI can be compiled and we do not
> have create separate config to enable boot time services.
> As runtime services are not enabled at this time, full generic early ioremap
> support is also not added in this series.
>
> Patch 4 and 5 adds the PE/COFF header and EFI stub code support for RISC-V
> respectively.
>
> The patches can also be found in following git repo.
>
> https://github.com/atishp04/linux/tree/wip_uefi_riscv_v4
>
> The patches have been verified on Qemu using bootefi command in U-Boot.
>
> Changes from v3->v4:
> 1. Rebased on top of efi-next.
> 2. Dropped patch 1 & 2 from this series as it is already queued in efi-next.
> Changes from v2->v3:
> 3. Improved handle_kernel_image() for RISC-V.
>

Thanks Atish. This looks nice and simple now.

I will need an ack from the RISC-V maintainers on these, and it is up
to them to consider whether the changes to core kconfigs and makefiles
are likely to cause trouble or not. If so, I am happy to work out a
way to merge this via a shared stable branch.



> Changes from v1->v2:
> 1. Rebased on 5.7-rc1.
> 2. Fixed minor typos and removed redundant macros/comments.
>
> Changes from previous version:
> 1. Renamed to the generic efi stub macro.
> 2. Address all redundant comments.
> 3. Supported EFI kernel image with normal booti command.
> 4. Removed runtime service related macro defines.
>
> Atish Patra (3):
> RISC-V: Define fixmap bindings for generic early ioremap support
> RISC-V: Add PE/COFF header for EFI stub
> RISC-V: Add EFI stub support.
>
> arch/riscv/Kconfig                        |  21 +++++
> arch/riscv/Makefile                       |   1 +
> arch/riscv/configs/defconfig              |   1 +
> arch/riscv/include/asm/Kbuild             |   1 +
> arch/riscv/include/asm/efi.h              |  44 +++++++++
> arch/riscv/include/asm/fixmap.h           |  18 ++++
> arch/riscv/include/asm/io.h               |   1 +
> arch/riscv/include/asm/sections.h         |  13 +++
> arch/riscv/kernel/Makefile                |   4 +
> arch/riscv/kernel/efi-header.S            |  99 ++++++++++++++++++++
> arch/riscv/kernel/head.S                  |  16 ++++
> arch/riscv/kernel/image-vars.h            |  53 +++++++++++
> arch/riscv/kernel/vmlinux.lds.S           |  20 +++-
> drivers/firmware/efi/Kconfig              |   2 +-
> drivers/firmware/efi/libstub/Makefile     |  10 ++
> drivers/firmware/efi/libstub/riscv-stub.c | 106 ++++++++++++++++++++++
> 16 files changed, 407 insertions(+), 3 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/image-vars.h
> create mode 100644 drivers/firmware/efi/libstub/riscv-stub.c
>
> --
> 2.24.0
>
Atish Patra April 21, 2020, 5:29 p.m. UTC | #2
On Tue, Apr 21, 2020 at 12:24 AM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Tue, 21 Apr 2020 at 05:34, Atish Patra <atish.patra@wdc.com> wrote:
> >
> > This series adds UEFI support for RISC-V. Currently, only boot time
> > services have been added. Runtime services will be added in a separate
> > series. This series depends on some core EFI patches
> > present in current in efi-next and following other patches.
> >
> > U-Boot: Adds the boot hartid under chosen node.
> > https://lists.denx.de/pipermail/u-boot/2020-April/405726.html
> >
> > Linux kernel: 5.7-rc1
> >
> > OpenSBI: master
> >
> > Patch 1 just moves arm-stub code to a generic code so that it can be used
> > across different architecture.
> >
> > Patch 3 adds fixmap bindings so that CONFIG_EFI can be compiled and we do not
> > have create separate config to enable boot time services.
> > As runtime services are not enabled at this time, full generic early ioremap
> > support is also not added in this series.
> >
> > Patch 4 and 5 adds the PE/COFF header and EFI stub code support for RISC-V
> > respectively.
> >
> > The patches can also be found in following git repo.
> >
> > https://github.com/atishp04/linux/tree/wip_uefi_riscv_v4
> >
> > The patches have been verified on Qemu using bootefi command in U-Boot.
> >
> > Changes from v3->v4:
> > 1. Rebased on top of efi-next.
> > 2. Dropped patch 1 & 2 from this series as it is already queued in efi-next.
> > Changes from v2->v3:
> > 3. Improved handle_kernel_image() for RISC-V.
> >
>
> Thanks Atish. This looks nice and simple now.
>
> I will need an ack from the RISC-V maintainers on these, and it is up
> to them to consider whether the changes to core kconfigs and makefiles
> are likely to cause trouble or not. If so, I am happy to work out a
> way to merge this via a shared stable branch.
>
@Palmer Dabbelt : Can you take a look at the series whenever you have
some free cycles ?
We would like to merge the series sooner than later.

>
>
> > Changes from v1->v2:
> > 1. Rebased on 5.7-rc1.
> > 2. Fixed minor typos and removed redundant macros/comments.
> >
> > Changes from previous version:
> > 1. Renamed to the generic efi stub macro.
> > 2. Address all redundant comments.
> > 3. Supported EFI kernel image with normal booti command.
> > 4. Removed runtime service related macro defines.
> >
> > Atish Patra (3):
> > RISC-V: Define fixmap bindings for generic early ioremap support
> > RISC-V: Add PE/COFF header for EFI stub
> > RISC-V: Add EFI stub support.
> >
> > arch/riscv/Kconfig                        |  21 +++++
> > arch/riscv/Makefile                       |   1 +
> > arch/riscv/configs/defconfig              |   1 +
> > arch/riscv/include/asm/Kbuild             |   1 +
> > arch/riscv/include/asm/efi.h              |  44 +++++++++
> > arch/riscv/include/asm/fixmap.h           |  18 ++++
> > arch/riscv/include/asm/io.h               |   1 +
> > arch/riscv/include/asm/sections.h         |  13 +++
> > arch/riscv/kernel/Makefile                |   4 +
> > arch/riscv/kernel/efi-header.S            |  99 ++++++++++++++++++++
> > arch/riscv/kernel/head.S                  |  16 ++++
> > arch/riscv/kernel/image-vars.h            |  53 +++++++++++
> > arch/riscv/kernel/vmlinux.lds.S           |  20 +++-
> > drivers/firmware/efi/Kconfig              |   2 +-
> > drivers/firmware/efi/libstub/Makefile     |  10 ++
> > drivers/firmware/efi/libstub/riscv-stub.c | 106 ++++++++++++++++++++++
> > 16 files changed, 407 insertions(+), 3 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/image-vars.h
> > create mode 100644 drivers/firmware/efi/libstub/riscv-stub.c
> >
> > --
> > 2.24.0
> >
Palmer Dabbelt April 21, 2020, 8:59 p.m. UTC | #3
On Tue, 21 Apr 2020 00:24:04 PDT (-0700), ardb@kernel.org wrote:
> On Tue, 21 Apr 2020 at 05:34, Atish Patra <atish.patra@wdc.com> wrote:
>>
>> This series adds UEFI support for RISC-V. Currently, only boot time
>> services have been added. Runtime services will be added in a separate
>> series. This series depends on some core EFI patches
>> present in current in efi-next and following other patches.
>>
>> U-Boot: Adds the boot hartid under chosen node.
>> https://lists.denx.de/pipermail/u-boot/2020-April/405726.html
>>
>> Linux kernel: 5.7-rc1
>>
>> OpenSBI: master
>>
>> Patch 1 just moves arm-stub code to a generic code so that it can be used
>> across different architecture.
>>
>> Patch 3 adds fixmap bindings so that CONFIG_EFI can be compiled and we do not
>> have create separate config to enable boot time services.
>> As runtime services are not enabled at this time, full generic early ioremap
>> support is also not added in this series.
>>
>> Patch 4 and 5 adds the PE/COFF header and EFI stub code support for RISC-V
>> respectively.
>>
>> The patches can also be found in following git repo.
>>
>> https://github.com/atishp04/linux/tree/wip_uefi_riscv_v4
>>
>> The patches have been verified on Qemu using bootefi command in U-Boot.
>>
>> Changes from v3->v4:
>> 1. Rebased on top of efi-next.
>> 2. Dropped patch 1 & 2 from this series as it is already queued in efi-next.
>> Changes from v2->v3:
>> 3. Improved handle_kernel_image() for RISC-V.
>>
>
> Thanks Atish. This looks nice and simple now.
>
> I will need an ack from the RISC-V maintainers on these, and it is up
> to them to consider whether the changes to core kconfigs and makefiles
> are likely to cause trouble or not. If so, I am happy to work out a
> way to merge this via a shared stable branch.

Sorry it took me a while to get around to these, but they're essentially good
with me.  There's some comments about needing ISA_C/c.li, but that's pretty
trivial.  In terms of mechanics: I don't really ever understand how to do these
multi-tree merges.  In an ideal world I'd like to have the arch/riscv/ stuff
stay in riscv/for-next, both because I don't want to deal with merge conflicts
and because that's where the RISC-V autobuilders look.

The best I can come up with is to split #3 up such that drivers/firmware/efi/
is its own patch and then send that up along with the PE header definitions
into an RC.  It'd be unused code at that point, but at least it'd break the
dependency between the trees and it'll be getting tested in riscv/for-next so
it won't rot.  We can ARMSTUB->GENERIC_STUB by just having the RISC-V support
select woth ARMSTUB and GENERIC_STUB, with a cleanup going in after everything
is merged.

That said, I'm happy if there's a better way to do this...

>> Changes from v1->v2:
>> 1. Rebased on 5.7-rc1.
>> 2. Fixed minor typos and removed redundant macros/comments.
>>
>> Changes from previous version:
>> 1. Renamed to the generic efi stub macro.
>> 2. Address all redundant comments.
>> 3. Supported EFI kernel image with normal booti command.
>> 4. Removed runtime service related macro defines.
>>
>> Atish Patra (3):
>> RISC-V: Define fixmap bindings for generic early ioremap support
>> RISC-V: Add PE/COFF header for EFI stub
>> RISC-V: Add EFI stub support.
>>
>> arch/riscv/Kconfig                        |  21 +++++
>> arch/riscv/Makefile                       |   1 +
>> arch/riscv/configs/defconfig              |   1 +
>> arch/riscv/include/asm/Kbuild             |   1 +
>> arch/riscv/include/asm/efi.h              |  44 +++++++++
>> arch/riscv/include/asm/fixmap.h           |  18 ++++
>> arch/riscv/include/asm/io.h               |   1 +
>> arch/riscv/include/asm/sections.h         |  13 +++
>> arch/riscv/kernel/Makefile                |   4 +
>> arch/riscv/kernel/efi-header.S            |  99 ++++++++++++++++++++
>> arch/riscv/kernel/head.S                  |  16 ++++
>> arch/riscv/kernel/image-vars.h            |  53 +++++++++++
>> arch/riscv/kernel/vmlinux.lds.S           |  20 +++-
>> drivers/firmware/efi/Kconfig              |   2 +-
>> drivers/firmware/efi/libstub/Makefile     |  10 ++
>> drivers/firmware/efi/libstub/riscv-stub.c | 106 ++++++++++++++++++++++
>> 16 files changed, 407 insertions(+), 3 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/image-vars.h
>> create mode 100644 drivers/firmware/efi/libstub/riscv-stub.c
>>
>> --
>> 2.24.0
>>
Ard Biesheuvel April 22, 2020, 4:39 p.m. UTC | #4
On Tue, 21 Apr 2020 at 22:59, Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Tue, 21 Apr 2020 00:24:04 PDT (-0700), ardb@kernel.org wrote:
> > On Tue, 21 Apr 2020 at 05:34, Atish Patra <atish.patra@wdc.com> wrote:
> >>
> >> This series adds UEFI support for RISC-V. Currently, only boot time
> >> services have been added. Runtime services will be added in a separate
> >> series. This series depends on some core EFI patches
> >> present in current in efi-next and following other patches.
> >>
> >> U-Boot: Adds the boot hartid under chosen node.
> >> https://lists.denx.de/pipermail/u-boot/2020-April/405726.html
> >>
> >> Linux kernel: 5.7-rc1
> >>
> >> OpenSBI: master
> >>
> >> Patch 1 just moves arm-stub code to a generic code so that it can be used
> >> across different architecture.
> >>
> >> Patch 3 adds fixmap bindings so that CONFIG_EFI can be compiled and we do not
> >> have create separate config to enable boot time services.
> >> As runtime services are not enabled at this time, full generic early ioremap
> >> support is also not added in this series.
> >>
> >> Patch 4 and 5 adds the PE/COFF header and EFI stub code support for RISC-V
> >> respectively.
> >>
> >> The patches can also be found in following git repo.
> >>
> >> https://github.com/atishp04/linux/tree/wip_uefi_riscv_v4
> >>
> >> The patches have been verified on Qemu using bootefi command in U-Boot.
> >>
> >> Changes from v3->v4:
> >> 1. Rebased on top of efi-next.
> >> 2. Dropped patch 1 & 2 from this series as it is already queued in efi-next.
> >> Changes from v2->v3:
> >> 3. Improved handle_kernel_image() for RISC-V.
> >>
> >
> > Thanks Atish. This looks nice and simple now.
> >
> > I will need an ack from the RISC-V maintainers on these, and it is up
> > to them to consider whether the changes to core kconfigs and makefiles
> > are likely to cause trouble or not. If so, I am happy to work out a
> > way to merge this via a shared stable branch.
>
> Sorry it took me a while to get around to these, but they're essentially good
> with me.  There's some comments about needing ISA_C/c.li, but that's pretty
> trivial.  In terms of mechanics: I don't really ever understand how to do these
> multi-tree merges.  In an ideal world I'd like to have the arch/riscv/ stuff
> stay in riscv/for-next, both because I don't want to deal with merge conflicts
> and because that's where the RISC-V autobuilders look.
>
> The best I can come up with is to split #3 up such that drivers/firmware/efi/
> is its own patch and then send that up along with the PE header definitions
> into an RC.  It'd be unused code at that point, but at least it'd break the
> dependency between the trees and it'll be getting tested in riscv/for-next so
> it won't rot.  We can ARMSTUB->GENERIC_STUB by just having the RISC-V support
> select woth ARMSTUB and GENERIC_STUB, with a cleanup going in after everything
> is merged.
>
> That said, I'm happy if there's a better way to do this...
>

I'll reshuffle the code a bit, and send out an updated series. If we
are all happy with that, I will stick the first 2 patches on a shared
tag that you can pull into your branch, and you can apply the
remaining 4 patches on top of that. Are you ok with a tag based on
v5.7-rc2?