[PATCH 0/3] efi_loader: save global data pointer on RISC-V

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Sep 10 13:06:27 CEST 2020


On 10.09.20 13:03, Sean Anderson wrote:
>
> On 9/10/20 7:00 AM, Heinrich Schuchardt wrote:
>> On the RISC-V platform register gp (x3) is used as global data pointer in
>> U-Boot. When executing a UEFI binary we cannot assume that the payload
>> will restore the register before calling the UEFI API. So U-Boot must
>> take care of saving the register value before invoking the payload and
>> restoring it whenever the API is called or the payload returns.
>>
>> On some system like the Sipeed Maix we do not have a UEFI runtime reset
>> implementation. Hence we call do_reset() in the UEFI selftest. Here too we
>> need to restore the global data pointer before invoking the U-Boot API.
>>
>> Heinrich Schuchardt (3):
>>   riscv: define function set_gd()
>>   efi_loader: save global data pointer on RISC-V
>>   efi_selftest: restore gd before do_reset()
>>
>>  arch/riscv/include/asm/global_data.h |  9 +++++
>>  lib/efi_loader/efi_boottime.c        | 54 ++++++++++++++--------------
>>  lib/efi_selftest/efi_selftest.c      |  6 ++--
>>  3 files changed, 40 insertions(+), 29 deletions(-)
>>
>> --
>> 2.28.0
>>
>
> Do we need to save tp as well? It is used by secondary harts to save the
> hartid for handle_ipi.

Only the boot hart enters the UEFI payload.

Best regards

>
> --Sean
>



More information about the U-Boot mailing list