From nobody Mon Apr 6 15:44:55 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A874B3AA50C for ; Thu, 19 Mar 2026 09:06:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773911168; cv=none; b=UfhmaBLGZbX27CFR5xYzBISphzmKOX3RWDaPJINwHnbcQSWy2JNSif8GvPIgvAcXhYbgoY32H0NHI6RCombfKLW/fDeETwUoD2cPt+3wxQyB9CbfAZ7Uzdh/Ek/uwWOw9nabol2dAV5ajtRCOrOrqqRK56bpaPhQmWL4fHjNGP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773911168; c=relaxed/simple; bh=SnsylKaR6XKsL6r4nGeFPuFvYgu+US9QjRHnBUE+4rc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dH2YqDCkUqDYPHma1Hv54v7YgdDGqiWioty5MbKRHX0UuIiirZU1BSxHVWvLnmVr3ajLRTybpdObTpCWng51/DOLPn+D6AlFmTBaTZmnEiGQKy7W1ivTdpWI8pD36HpH3M4prnayJUgvfUDBiQP9P0EiW6tm7unDNsFuOZPihyE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=g+JloLkZ; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g+JloLkZ" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-43b3a0d25d8so397801f8f.3 for ; Thu, 19 Mar 2026 02:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1773911165; x=1774515965; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=cN0DSOT4FMFHSpYhHh0KxRkDumLq71iDg3aOibYQgUs=; b=g+JloLkZnfVRXXdjfHQVG4MYYYRXgsGdeD1vQrkDP+5yc5xsAeQIhmix8fYr4VbfDv MSLc7jUeRDo5kj4FNRQHWPdzmPSjdyQLhBgdySGuFUHG0Wck2d5ihLJUTBYrzxV5ACSo 1R8X7Vd4Zkj7DWE4wBT5H0t6A9PnYFBzA7fV06t6eKO756dGZ7jayaNg+6E/rer11BH1 BGE5e4HSZCtowx6LVddKHhIseAZwI1z1EOhyTmyyfdj/N8WlUbQZxO+TP0GeeU6E4Z4A RmThAoynODf0978rSSTqTv2TtLGL2vdXMNvwe2svx6ZBnku7yh9MrQyLIRNmj7RtoLQ+ A0CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773911165; x=1774515965; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cN0DSOT4FMFHSpYhHh0KxRkDumLq71iDg3aOibYQgUs=; b=XzlWC1ZK2jP642Qebn4XGyoSpQDf9hwMzkBjLulirLiOMjK3MhH3Z6pkQFsHSzTpp3 HPcKmQ5WLaDF4D2tloZFeOhghi6pU6NbFY0jYRokMpQho40e9LGJl331KWE841zZ1dRO E+NUQJPogOMG143vSKZgBtiCstcsEFMGgaA2UqV4LQrWuO0n/S1CoyUo9f3FOxBeur/Z erXquYWwbgmesfUMIfudQuQRy9yArR8iYpIrAmifrd3Ps8HGdHc/JscgJnRsSVXENflQ +W0cOYBU+guklv26eAjaUVyVk/KUnT0DvA0Q07m+lEipnbEk4ikm8KJVaRmVOKIZIIPC OfzQ== X-Gm-Message-State: AOJu0Yw95lieuzPBQoN6vNQjiRTipvPkAXxvhp1pQ4c3fiL0v55DacRO /D44Co5GVyDIE9F+G/UpsTN25DYauU5MO7uho5cCPM7QH519X417fiFp4k6mtLL/n66k0E3/e9D VQEdOvler9FDD6DlkBUbGeDVATL86AWavHtCpZUr1IKzebmCpp8ZraDXJi9FC7LQ8JOG76WYjeX XlYKe9NAmCEBL3EgL3MVMoObtFL+6LzEl5RQ== X-Received: from wmlu26.prod.google.com ([2002:a05:600c:211a:b0:486:f89b:7f11]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4e49:b0:485:4136:99a8 with SMTP id 5b1f17b1804b1-486f4441072mr95249125e9.22.1773911164511; Thu, 19 Mar 2026 02:06:04 -0700 (PDT) Date: Thu, 19 Mar 2026 10:05:33 +0100 In-Reply-To: <20260319090529.1091660-21-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260319090529.1091660-21-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1532; i=ardb@kernel.org; h=from:subject; bh=JO9hOFF5DJXI3o8vMSXVUdCxa1qCtfQllbLj7lJACi8=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIXP3ntgl865zO81VqV1yL3TyltBDlcfiFzrvC58rtMM7p uWkaPqyjlIWBjEuBlkxRRaB2X/f7Tw9UarWeZYszBxWJpAhDFycAjCRk1sZ/qnf1H3sV7+s+ahI UOeTy5sZLjgs6TojF8GyQ2PPwzNSL5oZfjE1PlD65qXyb10jR/dfiQ2z/Q3muL9WKPfS3vA1X+g kHwMA X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog Message-ID: <20260319090529.1091660-24-ardb+git@google.com> Subject: [PATCH v2 03/19] x86/efi: Unmap kernel-reserved boot regions from EFI page tables From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, x86@kernel.org, Ard Biesheuvel , "Mike Rapoport (Microsoft)" , Benjamin Herrenschmidt Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Currently, the logic that unmaps boot services code and data regions that were mapped temporarily to work around firmware bugs disregards regions that have been marked as EFI_MEMORY_RUNTIME. However, such regions only have significance to the OS, and there is no reason to retain the mapping in the EFI page tables, given that the runtime firmware must never touch those regions. So pull the unmap forward. Signed-off-by: Ard Biesheuvel --- arch/x86/platform/efi/quirks.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index 35caa5746115..30b8012eafaa 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -442,12 +442,6 @@ void __init efi_unmap_boot_services(void) continue; } =20 - /* Do not free, someone else owns it: */ - if (md->attribute & EFI_MEMORY_RUNTIME) { - num_entries++; - continue; - } - /* * Before calling set_virtual_address_map(), EFI boot services * code/data regions were mapped as a quirk for buggy firmware. @@ -455,6 +449,12 @@ void __init efi_unmap_boot_services(void) */ efi_unmap_pages(md); =20 + /* Do not free, someone else owns it: */ + if (md->attribute & EFI_MEMORY_RUNTIME) { + num_entries++; + continue; + } + /* * Nasty quirk: if all sub-1MB memory is used for boot * services, we can get here without having allocated the --=20 2.53.0.851.ga537e3e6e9-goog