From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751483AbaIDEuy (ORCPT ); Thu, 4 Sep 2014 00:50:54 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:27131 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbaIDEuw (ORCPT ); Thu, 4 Sep 2014 00:50:52 -0400 From: Yinghai Lu To: Matt Fleming , "H. Peter Anvin" , Ingo Molnar Cc: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= , Anders Darander , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH -v4] x86: only load initrd above 4g on second try Date: Wed, 3 Sep 2014 21:50:07 -0700 Message-Id: <1409806207-3992-1-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Tested-by: Anders Darander Signed-off-by: Yinghai Lu --- 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;