public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Matt Fleming
	<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "Mantas Mikulėnas"
	<grawity-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Anders Darander"
	<anders-7UjN0b3lYz2SbKU13Z4Etw@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Yinghai Lu" <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: [PATCH] x86: only load initrd above 4g on second try
Date: Tue, 26 Aug 2014 14:45:44 -0700	[thread overview]
Message-ID: <1409089544-24221-1-git-send-email-yinghai@kernel.org> (raw)

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.

There are buggy EFI implementations: with EFI run time, kernel need
to load file with 512bytes alignment when buffer is above 4G.

So revert to old way to load initrd on first try,
second try will use above 4G buffer when initrd is more than
2G and does not fit under 4G.

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 |   16 +++++++++-------
 1 file changed, 9 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,18 @@ 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)
+		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;

             reply	other threads:[~2014-08-26 21:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 21:45 Yinghai Lu [this message]
     [not found] ` <1409089544-24221-1-git-send-email-yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-08-26 21:53   ` [PATCH] x86: only load initrd above 4g on second try H. Peter Anvin
     [not found]     ` <53FD01D0.8020203-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2014-08-26 22:05       ` Yinghai Lu
     [not found]         ` <CAE9FiQUF4THLRfzbnhK61QHpM2zyox4E8LTmyzVF7PnPdpb7jQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-26 22:16           ` Mantas Mikulėnas
     [not found]             ` <CAPWNY8WG3E7oZdZDdYsrnGM5pG4kWAKkEq0Eh5Hc_uXJ_8zD5g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-26 22:58               ` Yinghai Lu
2014-08-27 17:49           ` H. Peter Anvin
     [not found]             ` <53FE1A2B.80204-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2014-08-27 18:50               ` Yinghai Lu
2014-08-27 10:59   ` Matt Fleming
     [not found]     ` <20140827105901.GC28116-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-08-27 17:13       ` Yinghai Lu
     [not found]         ` <CAE9FiQWrPtEe3tkJjgOzyJJPPzX=AtMYgR4c91pDHL3q3ZLLKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-30 11:24           ` Matt Fleming
     [not found]             ` <20140830112426.GA2911-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-09-02  6:57               ` Anders Darander

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=1409089544-24221-1-git-send-email-yinghai@kernel.org \
    --to=yinghai-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=anders-7UjN0b3lYz2SbKU13Z4Etw@public.gmane.org \
    --cc=grawity-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /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