From nobody Thu Apr 9 17:57:50 2026 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.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 51EFE3EBF38 for ; Fri, 6 Mar 2026 15:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772812643; cv=none; b=JOMNyvchvqxDIZiIxyoqX/mOU0Dg1nZ74hR3OADzvhFakxqVRbueA1zf4ok/J+0dTjSfosj4R/3GrGM4/znKepKCd6MTGy6uNteS9q45duM8L9buwRKoMN8stpz5h7ErjVIKp1bcVJFk2Fiszd6KLIs72j77nT/QEc4qsEy4bos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772812643; c=relaxed/simple; bh=DAh2QfDt6t1E53RT+FSV0rNEnP55d2Z3JtOi9oMWG+I=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OvrHEmNrhhfTmoISX3ebyMKgvYpt+W7UlJAE1Ts0hbOvqhDaGsObbJ7rB9z+/gCluvOEWrg3CMerPCHjKDFWpUWQIjNYWJ5i4L1GZ1Z55/R3d136CAkvBXYfiFqPfYfTTuUPb5xO/u3DC08KSuH8Hx4M7Ns0AE8jFGkmVBoYY9s= 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=l1T+WYGt; arc=none smtp.client-ip=209.85.208.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="l1T+WYGt" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-6613513ac46so1812880a12.3 for ; Fri, 06 Mar 2026 07:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772812640; x=1773417440; 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=PyUJVB6MFtFQFvl4CFebEtQPHCRh2l9RlIxPiMDk2SI=; b=l1T+WYGt5rPA0dwN4Bt/RythlEgkPP32EeH0Gzw+ySUDmU7EW1QfSfyTwb7t38/Ajs Ao20OY/zeiNrVkU2UxaKbAcO+zxs5BThbC7XAnQgdUZHVUj+G56DceWKc5NyGkLaiwdT nq6ZBxKGlauUo+18YBh2xSI0d2lOWA76cl3cFG3N6xwwW72Bm8ju2TpXVrY0eV4zI38D d2fLr4TBPbYz4WSbSo7nBJqEVXrLqYMtx+vFMlzsu7QWBQhgfs086eUr66TfDtu6mQmM IMJb8EBvbWGkvydUtjAEXrrl5k8CzQo5wW4FlUkoysHe/M4p9riAB6hjFmZNuYGROv6f 8+fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772812640; x=1773417440; 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=PyUJVB6MFtFQFvl4CFebEtQPHCRh2l9RlIxPiMDk2SI=; b=hRt70Yp+in3E578Qw4U50fu6k2M6ySxcFdPb99deRqvVRBEqvr1iV3iLAhEs67LbMK H7vYLIqLhjp9bRzjyqkR19m6gtMCldW5B5v7sUOZmIeBElZPiwwT/gSfjmPg9y2dfVOM 1iLTtA+terH9v/b3H9KPsy7tgnjp0+XIOXN90NGv/hM+tTBUFrVH33ygNyPvGYKREALr enbz92xYsnoCp7Wo/ThjqXfzhZ6eDyTU0mUhGGCSgzXmh21wSxTtIazbdVGZg98cCBio jkSwRZQwSg8M+NM5d+8BGwJHokUzMpQDob/uAJ1hUBoTzMUPm6gzLr/bYDMiHn7BlCX/ ukUQ== X-Gm-Message-State: AOJu0YwflZIHkdPd/BQ9xiZX4hhBqIh7wqdu6VtbeWXnMMg1pudfI/fI TEju7nV64iWuDYETph0s1Pkj5TdWWNmdMK98ntx+dW9dieILMeKfqKyyUx0i0tiYQ+wsxZjoNBW wiNfGWIDTytS+V9SSS2r0MlkRjmElskZVYBzgYLookfn/9ZZtTiiJu0tfAQepMqQVDJlTebqqbw PIwkb3ss5S6AgPBfJF/P1MIvci27c7ejmZlg== X-Received: from edsq5.prod.google.com ([2002:aa7:da85:0:b0:660:cd0d:914e]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:3491:b0:65b:ec2d:e615 with SMTP id 4fb4d7f45d1cf-6619d49ccc9mr1313854a12.10.1772812639305; Fri, 06 Mar 2026 07:57:19 -0800 (PST) Date: Fri, 6 Mar 2026 16:57:05 +0100 In-Reply-To: <20260306155703.815272-12-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: <20260306155703.815272-12-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=2013; i=ardb@kernel.org; h=from:subject; bh=I4NX+o2ZQ1RbPq3q2GfBRlvmTDgCe/3St3lTTXDwWr8=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIXPVzwDZU4G7L/ndDcmf2VCR7uP4onz/ycTO5etsj9Z9Z mfoSt3QUcrCIMbFICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACbyt5OR4Uxc3/Iw7/jPrVuL jTfqTl6z7e6DjZkz2TcmfxNon5XlOJmR4fdUhbnRnFEcfh+Lee11n51lOXKc43IUi7f1lRCRt9e 0uAA= X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260306155703.815272-13-ardb+git@google.com> Subject: [RFC PATCH 1/9] memblock: Permit existing reserved regions to be marked RSRV_KERN 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 Permit existing memblock reservations to be marked as RSRV_KERN. This will be used by the EFI code on x86 to distinguish between reservations of boot services data regions that have actual significance to the kernel and regions that are reserved temporarily to work around buggy firmware. Signed-off-by: Ard Biesheuvel Acked-by: Mike Rapoport (Microsoft) --- include/linux/memblock.h | 1 + mm/memblock.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 6ec5e9ac0699..9eac4f268359 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -155,6 +155,7 @@ int memblock_mark_mirror(phys_addr_t base, phys_addr_t = size); int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); int memblock_reserved_mark_noinit(phys_addr_t base, phys_addr_t size); +int memblock_reserved_mark_kern(phys_addr_t base, phys_addr_t size); int memblock_mark_kho_scratch(phys_addr_t base, phys_addr_t size); int memblock_clear_kho_scratch(phys_addr_t base, phys_addr_t size); =20 diff --git a/mm/memblock.c b/mm/memblock.c index b3ddfdec7a80..2505ce8b319c 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1115,6 +1115,21 @@ int __init_memblock memblock_reserved_mark_noinit(ph= ys_addr_t base, phys_addr_t MEMBLOCK_RSRV_NOINIT); } =20 +/** + * memblock_reserved_mark_kern - Mark a reserved memory region with flag + * MEMBLOCK_RSRV_KERN + * + * @base: the base phys addr of the region + * @size: the size of the region + * + * Return: 0 on success, -errno on failure. + */ +int __init_memblock memblock_reserved_mark_kern(phys_addr_t base, phys_add= r_t size) +{ + return memblock_setclr_flag(&memblock.reserved, base, size, 1, + MEMBLOCK_RSRV_KERN); +} + /** * memblock_mark_kho_scratch - Mark a memory region as MEMBLOCK_KHO_SCRATC= H. * @base: the base phys addr of the region --=20 2.53.0.473.g4a7958ca14-goog