public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v4] x86: only load initrd above 4g on second try
@ 2014-09-04  4:50 Yinghai Lu
       [not found] ` <20140904100137.GK3001@console-pimps.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Yinghai Lu @ 2014-09-04  4:50 UTC (permalink / raw)
  To: Matt Fleming, H. Peter Anvin, Ingo Molnar
  Cc: Mantas Mikulėnas, Anders Darander,
	linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Yinghai Lu

Mantas found that after commit 4bf7111f5016 ("x86/efi: Support initrd
loaded above 4G"), the kernel freezes at the earliest possible moment
when trying to boot via UEFI on Asus laptop.

Revert to old way to load initrd under 4G on first try,
second try will use above 4G buffer when initrd is too big
and does not fit under 4G.

-v2: add print out for second try, and print out files buf address.
-v3: can not snprintf
-v4: drop address print out for files buf

Reported-by: Mantas Mikulėnas <grawity-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Tested-by: Anders Darander <anders-7UjN0b3lYz2SbKU13Z4Etw@public.gmane.org>
Signed-off-by: Yinghai Lu <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

---
 arch/x86/boot/compressed/eboot.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Index: linux-2.6/arch/x86/boot/compressed/eboot.c
===================================================================
--- linux-2.6.orig/arch/x86/boot/compressed/eboot.c
+++ linux-2.6/arch/x86/boot/compressed/eboot.c
@@ -1032,7 +1032,6 @@ struct boot_params *make_boot_params(str
 	int i;
 	unsigned long ramdisk_addr;
 	unsigned long ramdisk_size;
-	unsigned long initrd_addr_max;
 
 	efi_early = c;
 	sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
@@ -1095,15 +1094,20 @@ struct boot_params *make_boot_params(str
 
 	memset(sdt, 0, sizeof(*sdt));
 
-	if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)
-		initrd_addr_max = -1UL;
-	else
-		initrd_addr_max = hdr->initrd_addr_max;
-
 	status = handle_cmdline_files(sys_table, image,
 				      (char *)(unsigned long)hdr->cmd_line_ptr,
-				      "initrd=", initrd_addr_max,
+				      "initrd=", hdr->initrd_addr_max,
 				      &ramdisk_addr, &ramdisk_size);
+
+	if (status != EFI_SUCCESS &&
+	    hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
+		efi_printk(sys_table, "Trying to load files to higher address\n");
+		status = handle_cmdline_files(sys_table, image,
+				      (char *)(unsigned long)hdr->cmd_line_ptr,
+				      "initrd=", -1UL,
+				      &ramdisk_addr, &ramdisk_size);
+	}
+
 	if (status != EFI_SUCCESS)
 		goto fail2;
 	hdr->ramdisk_image = ramdisk_addr & 0xffffffff;

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-09-08 15:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04  4:50 [PATCH -v4] x86: only load initrd above 4g on second try Yinghai Lu
     [not found] ` <20140904100137.GK3001@console-pimps.org>
2014-09-04 20:59   ` H. Peter Anvin
2014-09-04 21:29     ` Matt Fleming
     [not found]       ` <20140904212925.GL3001-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-09-05  1:19         ` Yinghai Lu
     [not found]           ` <CAE9FiQUDLoARj-Z3ipPTf2sZgGn71SxrxM+FqLE1Cyb-OEoP+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-05  5:47             ` Anders Darander
2014-09-05  6:38               ` Laszlo Ersek
     [not found]                 ` <54095A5B.4030606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-09-05 17:03                   ` Yinghai Lu
     [not found]                     ` <CAE9FiQV7XLwKsYWprmKAkZGGyuFeK=o_b1_ABMbEGVZzZxtp2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-05 19:20                       ` Laszlo Ersek
     [not found]     ` <5408D299.5000300-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2014-09-05 22:16       ` Matt Fleming
     [not found]         ` <20140905221616.GP3001-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-09-06 19:05           ` Anders Darander
2014-09-06 20:09         ` Mantas Mikulėnas
2014-09-06 20:10           ` Mantas Mikulėnas
     [not found]           ` <CAPWNY8V6Vw0JBZ=VE_ZLZ1hiKVhrDbYyWfkLXMQtKYHZjmewRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-08 15:58             ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox