From patchwork Thu Apr 11 12:02:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tj X-Patchwork-Id: 788639 Received: from iam.tj (yes.iam.tj [109.74.197.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A8F814B09C for ; Thu, 11 Apr 2024 12:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.74.197.121 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712836958; cv=none; b=qo8QKGbbl/Gqwuv/0X3VHJc7bBL56FskDesP1spDtBXgkUvwUSb4ikfw3BpDpNaxh6PZ3dA8t1EQ+VCQ6Ws8Hl5Z79BRpM4XoEfDXJOsW2NMsLO3AqjEeNAs/XZF8l+1h6+bKxdlXubW0ERNKsblLk8uUqfdL23E9E9C7TrfpnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712836958; c=relaxed/simple; bh=OS0CbYOvbW6s2Xi8WPDzUXh8p2n4qOxDjBxZaUKrcF8=; h=Content-Type:Message-ID:Date:MIME-Version:To:From:Subject:Cc; b=rWFV7YRUIZkr1qRMS79vLuY6xz3oU+ncBP2x+AiCDSuvX9dqDwmt0970Z9d+F4n0Ndd/VUOrTCJ7Ih1mLsk33ajpIOvg5yedv7Qh3IJwuErGVB+h72siQbfOxuRYUnGecIaSGMISPQ/Y7YCzxoR/QXdkoJmCy1NFB1jVI+IfmLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iam.tj; spf=pass smtp.mailfrom=iam.tj; dkim=pass (2048-bit key) header.d=iam.tj header.i=@iam.tj header.b=TVtoJ9bj; arc=none smtp.client-ip=109.74.197.121 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iam.tj Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iam.tj Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=iam.tj header.i=@iam.tj header.b="TVtoJ9bj" Received: from [IPV6:2a0d:3344:11e:1ff0::ff] (unknown [IPv6:2a0d:3344:11e:1ff0::ff]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by iam.tj (Postfix) with ESMTPSA id 9AA57347BC; Thu, 11 Apr 2024 13:02:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=iam.tj; s=2019; t=1712836951; bh=OS0CbYOvbW6s2Xi8WPDzUXh8p2n4qOxDjBxZaUKrcF8=; h=Date:To:From:Subject:Cc:From; b=TVtoJ9bjtjCufFvH/b5HI38GtZthLiu14XleZ8cX46ER3QWh1raQp/qfjAV2HsFBk pwiqHipVMRsKyCDoSbw4kyPcWDUIcnXcnLO3QVY0rhlmqN6GoHvwFuRGWpq6RDZSfe L345Lmpx9ysgc/ciPXDJRZoO903E04lhgGGBKWaVYUCBW96E6iGPxUWmtbUGthbX9w fm/1W1i4rMGrl/qF/sDSxmlF40AYy/ZD/rMuy884l2avH3X5B3MRO6D0qCYDRoNkFX PVbLBdJR8pQBCGm1NRuZaLtG0izvT6BmOdUr/LM9FaQ+bSCiYrrgFnVzY0l8Mp0ofH KGq8RnuHza4DA== Message-ID: Date: Thu, 11 Apr 2024 13:02:28 +0100 Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB To: linux-efi@vger.kernel.org, Bjorn Helgaas From: Tj Subject: Regression: ef/x86: Remove EfiMemoryMappedIO from E820 map Cc: Mateus Kaduk Lenovo Legion 9i fails to set up e820 EFI MMIO regions since v6.2 due to commit 07eab0901ede8b75 "efi/x86: Remove EfiMemoryMappedIO from E820 map" Mateusz Kaduk bisected v6.1..v6.2 and pinpointed this on his Legion 9i and confirms this patch fixes all the reported issues. https://bugzilla.kernel.org/show_bug.cgi?id=218444 This patch is more of a proof of cause since it is quite coarse; it simply disables the effects of 07eab0901ede8b75 with "keep_efi_e820" on command-line; maybe there is a better way than arbitrarily removing mappings larger than 256KiB? I wonder if the removal should be done later once the regions have been read, or if there is some inherent metadata in the regions to describe what range(s) need to be retained. >From 8156a7560be93ce563f45b3ce1f643f63f9e2126 Mon Sep 17 00:00:00 2001 From: Tj Date: Thu, 11 Apr 2024 12:37:46 +0100 Subject: [PATCH] efi/x86: add param keep_efi_e820 Add a command-line option to retain all e820 mappings. Commit 07eab0901ede8b in v6.2 added logic to remove e820 EFI MMIO regions larger than 256KiB. This caused a regression that affects Lenovo Legion 9i and possibly others. Fixes: 07eab0901ede8b ("efi/x86: Remove EfiMemoryMappedIO from E820 map") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218444 Signed-off-by: Tj Tested-by: Mateusz Kaduk --- arch/x86/platform/efi/efi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index f090ec972d7b..9410182942bd 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -103,6 +103,14 @@ static const unsigned long * const efi_tables[] = { u64 efi_setup; /* efi setup_data physical address */ +static int keep_efi_e820 __initdata; +static int __init setup_keep_efi_e820(char *arg) +{ + keep_efi_e820 = 1; + return 0; +} +early_param("keep_efi_e820", setup_keep_efi_e820); + static int add_efi_memmap __initdata; static int __init setup_add_efi_memmap(char *arg) { @@ -333,6 +341,9 @@ static void __init efi_remove_e820_mmio(void) u64 size, start, end; int i = 0; + if (keep_efi_e820) + return; + for_each_efi_memory_desc(md) { if (md->type == EFI_MEMORY_MAPPED_IO) { size = md->num_pages << EFI_PAGE_SHIFT; -- 2.39.2