From: Sean Anderson Date: Thu, 10 Sep 2020 07:03:23 -0400 Subject: [PATCH 0/3] efi_loader: save global data pointer on RISC-V In-Reply-To: <20200910110048.21446-1-xypron.glpk@gmx.de> References: <20200910110048.21446-1-xypron.glpk@gmx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. --Sean