linux-next: manual merge of the loongarch tree with the efi-fixes tree

From: Stephen Rothwell
Date: Tue Mar 14 2023 - 18:30:18 EST


Hi all,

Today's linux-next merge of the loongarch tree got conflicts in:

drivers/firmware/efi/libstub/efi-stub-entry.c
drivers/firmware/efi/libstub/efi-stub.c

between commit:

ef3efc2af044 ("efi: libstub: Use relocated version of kernel's struct screen_info")

from the efi-fixes tree and commit:

d34b13f27dff ("efi/libstub: Call setup_graphics() before handle_kernel_image()")

from the loongarch tree.

I fixed it up (I think, see below) and can carry the fix as necessary.
This is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc drivers/firmware/efi/libstub/efi-stub-entry.c
index 629840696ea0,c00a73a4518f..000000000000
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@@ -5,19 -5,30 +5,43 @@@

#include "efistub.h"

+#ifndef CONFIG_ARM
+static struct screen_info *si;
+
+struct screen_info *alloc_screen_info(void)
+{
+ return si;
+}
+
+void free_screen_info(struct screen_info *si)
+{
+}
+#endif
+
+ static struct screen_info *setup_graphics(void)
+ {
+ unsigned long size;
+ efi_status_t status;
+ efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
+ void **gop_handle = NULL;
+ struct screen_info *si = NULL;
+
+ size = 0;
+ status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL,
+ &gop_proto, NULL, &size, gop_handle);
+ if (status == EFI_BUFFER_TOO_SMALL) {
+ si = alloc_screen_info();
+ if (!si)
+ return NULL;
+ status = efi_setup_gop(si, &gop_proto, size);
+ if (status != EFI_SUCCESS) {
+ free_screen_info(si);
+ return NULL;
+ }
+ }
+ return si;
+ }
+
/*
* EFI entry point for the generic EFI stub used by ARM, arm64, RISC-V and
* LoongArch. This is the entrypoint that is described in the PE/COFF header
@@@ -69,13 -83,10 +96,15 @@@ efi_status_t __efiapi efi_pe_entry(efi_
return status;
}

+#ifndef CONFIG_ARM
+ /* point si to the relocated copy of struct screen_info */
+ si = (void *)&screen_info + image_addr - (unsigned long)image->image_base;
+#endif
+
status = efi_stub_common(handle, image, image_addr, cmdline_ptr);

+ free_screen_info(si);
+
efi_free(image_size, image_addr);
efi_free(reserve_size, reserve_addr);

diff --cc drivers/firmware/efi/libstub/efi-stub.c
index c4b9eccad0f1,bc67af721412..000000000000
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@@ -47,30 -47,15 +47,6 @@@
static u64 virtmap_base = EFI_RT_VIRTUAL_BASE;
static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0);

- static struct screen_info *setup_graphics(void)
-struct screen_info * __weak alloc_screen_info(void)
--{
- efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
- efi_status_t status;
- unsigned long size;
- void **gop_handle = NULL;
- struct screen_info *si = NULL;
- return &screen_info;
-}
--
- size = 0;
- status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL,
- &gop_proto, NULL, &size, gop_handle);
- if (status == EFI_BUFFER_TOO_SMALL) {
- si = alloc_screen_info();
- if (!si)
- return NULL;
- status = efi_setup_gop(si, &gop_proto, size);
- if (status != EFI_SUCCESS) {
- free_screen_info(si);
- return NULL;
- }
- }
- return si;
-void __weak free_screen_info(struct screen_info *si)
-{
--}
--
static void install_memreserve_table(void)
{
struct linux_efi_memreserve *rsv;

Attachment: pgpsQCnm19dHq.pgp
Description: OpenPGP digital signature