From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753777AbcGUBdE (ORCPT ); Wed, 20 Jul 2016 21:33:04 -0400 Received: from mail.kernel.org ([198.145.29.136]:36926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753060AbcGUBdA (ORCPT ); Wed, 20 Jul 2016 21:33:00 -0400 From: Andy Lutomirski To: "H. Peter Anvin" , x86@kernel.org Cc: Mario Limonciello , Matthew Garrett , linux-kernel@vger.kernel.org, Andy Lutomirski Subject: [PATCH] x86/ebda: If the EBDA is in lowmem, reserve only 4k for the EBDA Date: Wed, 20 Jul 2016 18:32:51 -0700 Message-Id: <7c190e9b3376002014fb99234ed5e5c64df86322.1469064662.git.luto@kernel.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Under some conditions, my Dell XPS 13 9350 puts the EBDA at 0x2c000 but reports the lowmem cutoff as 0. The old code reserves everything above 0x2c000 and I can't boot [1]. Due to an old quirk, we assume that lowmem ends at 0x9f000. Nonetheless, the old code would reserve everything from 0x2c000 to 0xfffff. Be a little less conservative: when the EBDA is in lowmem, reserve 4k the EBDA and reserve highmem separately. On my laptop, this ends up being more or less a no-op: the EBDA shows up as a single-page of runtime data in the EFI memmap. Go Dell for getting this right. [1] This only breaks boot in practice when some other firmware or GRUB oddity that I don't fully understand kicks in causing the memory below 0x2c000 to be unusable. Signed-off-by: Andy Lutomirski --- This is intentionally not tagged for -stable. I think it's -stable material *eventually*, but the problem that's fixed is not widespread (it's apparently just me for now) and there's plenty of potential to regress something that was worked around by the old code. arch/x86/kernel/ebda.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/ebda.c b/arch/x86/kernel/ebda.c index afe65dffee80..2183a7eac646 100644 --- a/arch/x86/kernel/ebda.c +++ b/arch/x86/kernel/ebda.c @@ -62,10 +62,12 @@ void __init reserve_ebda_region(void) if (lowmem < INSANE_CUTOFF) lowmem = LOWMEM_CAP; - /* Use the lower of the lowmem and EBDA markers as the cutoff */ - lowmem = min(lowmem, ebda_addr); lowmem = min(lowmem, LOWMEM_CAP); /* Absolute cap */ /* reserve all memory between lowmem and the 1MB mark */ memblock_reserve(lowmem, 0x100000 - lowmem); + + /* if the EBDA is in lowmem, reserve it separately. */ + if (ebda_addr < lowmem) + memblock_reserve(ebda_addr, 4096); } -- 2.7.4