public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org
Cc: pbonzini@redhat.com, thuth@redhat.com
Subject: [kvm-unit-tests PATCH v2 06/13] riscv: Tweak the gnu-efi imported code
Date: Tue,  5 Mar 2024 18:09:05 +0100	[thread overview]
Message-ID: <20240305170858.395836-21-andrew.jones@linux.dev> (raw)
In-Reply-To: <20240305170858.395836-15-andrew.jones@linux.dev>

Change _relocate to match the prototype in efi.h (it doesn't
matter that 'handle' and 'sys_tab' are unused). Also add
R_RISCV_RELATIVE to efi.h and replace '_entry' with 'efi_main'.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---
 lib/elf.h                    | 5 +++++
 riscv/efi/crt0-efi-riscv64.S | 2 +-
 riscv/efi/reloc_riscv64.c    | 3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/elf.h b/lib/elf.h
index 7a7db57774cd..fee20289e1fc 100644
--- a/lib/elf.h
+++ b/lib/elf.h
@@ -65,4 +65,9 @@ typedef struct elf64_rela {
 /* The following are used with relocations */
 #define ELF64_R_TYPE(i)		((i) & 0xffffffff)
 
+/*
+ * riscv static relocation types.
+ */
+#define R_RISCV_RELATIVE	3
+
 #endif /* _ELF_H_ */
diff --git a/riscv/efi/crt0-efi-riscv64.S b/riscv/efi/crt0-efi-riscv64.S
index 712ed03fc06e..cc8551a43c6a 100644
--- a/riscv/efi/crt0-efi-riscv64.S
+++ b/riscv/efi/crt0-efi-riscv64.S
@@ -164,7 +164,7 @@ _start:
 	bne		a0, zero, 0f
 	ld		a1, 8(sp)
 	ld		a0, 0(sp)
-	call		_entry
+	call		efi_main
 	ld		ra, 16(sp)
 0:	addi		sp, sp, 24
 	ret
diff --git a/riscv/efi/reloc_riscv64.c b/riscv/efi/reloc_riscv64.c
index e4296026e2a4..8504ad595e51 100644
--- a/riscv/efi/reloc_riscv64.c
+++ b/riscv/efi/reloc_riscv64.c
@@ -44,7 +44,8 @@
 #define Elf_Rela	Elf64_Rela
 #define ELF_R_TYPE	ELF64_R_TYPE
 
-EFI_STATUS EFIAPI _relocate(long ldbase, Elf_Dyn *dyn)
+efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn, efi_handle_t handle,
+		       efi_system_table_t *sys_tab)
 {
 	long relsz = 0, relent = 0;
 	Elf_Rela *rel = NULL;
-- 
2.44.0


  parent reply	other threads:[~2024-03-05 17:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 17:08 [kvm-unit-tests PATCH v2 00/13] Enable EFI support Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 01/13] riscv: Call abort instead of assert on unhandled exceptions Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 02/13] riscv: show_regs: Prepare for EFI images Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 03/13] treewide: lib/stack: Fix backtrace Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 04/13] treewide: lib/stack: Make base_address arch specific Andrew Jones
2024-03-12  5:45   ` Nicholas Piggin
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 05/13] riscv: Import gnu-efi files Andrew Jones
2024-03-05 17:09 ` Andrew Jones [this message]
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 07/13] riscv: Enable building for EFI Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 08/13] riscv: efi: Switch stack in _start Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 09/13] efi: Add support for obtaining the boot hartid Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 10/13] riscv: Refactor setup code Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 11/13] riscv: Enable EFI boot Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 12/13] riscv: efi: Add run script Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 13/13] riscv: efi: Use efi-direct by default Andrew Jones
2024-03-18 17:28 ` [kvm-unit-tests PATCH v2 00/13] Enable EFI support Andrew Jones

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=20240305170858.395836-21-andrew.jones@linux.dev \
    --to=andrew.jones@linux.dev \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.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