From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 909E1145350; Tue, 27 Feb 2024 14:05:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709042715; cv=none; b=AGhuVEETuS0HDofT+26oHeUK+cbvmO0IQl3XB0bYLkDgeAGXT/ka3UbGLGHgsAfyz0Yi05dpDvXaMLPgIIBV6ahlfL94k1nGtzYw/VyDHHr2Zyq/d/N+ccghh66CnaFoaNBFDhV7Pzg2wb4Huml7W6P/Jbk18ehWOaEFtmJR05k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709042715; c=relaxed/simple; bh=Z9UuI4Sd+UzHXvRbAsNZvb3jWy4v8k1yYYx2fja1Wes=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bFo9jbr5n8/cMjmXYAxCuUHXpjpLoQjPNyuKvgwRga6f4kdThEGj3Qk6PTzCwubRdwemoyU+FZ+buwla6HZWpS9jtS+oLBjZyP+o1tJ+9DZ9sobj7B/RpgP9nkj7rBNgJ4WIZ6F5WFe+SfhdZFW0JsunsMhXSDzwRnuO4/FcE/Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HaYVZ83v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HaYVZ83v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F2F5C43399; Tue, 27 Feb 2024 14:05:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709042715; bh=Z9UuI4Sd+UzHXvRbAsNZvb3jWy4v8k1yYYx2fja1Wes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaYVZ83vaazKJ9J0HWjgnwL0vV72dxNPQan++0zFL+niNSf1Y//o7VDamS4ceqTUb 0F9lVCxFwsAagD7xHAW2WDX+5fEOabWPRR1u+MZVMBsLMaxXqu1rF0qn+EstDJ5zZ/ KxnPZZZakA1oogcXDEdNpZ0zHhP4fef1gZfa61uw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrew Bresticker , Ard Biesheuvel , Sasha Levin Subject: [PATCH 5.15 066/245] efi: Dont add memblocks for soft-reserved memory Date: Tue, 27 Feb 2024 14:24:14 +0100 Message-ID: <20240227131617.388600666@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131615.098467438@linuxfoundation.org> References: <20240227131615.098467438@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Bresticker [ Upstream commit 0bcff59ef7a652fcdc6d535554b63278c2406c8f ] Adding memblocks for soft-reserved regions prevents them from later being hotplugged in by dax_kmem. Signed-off-by: Andrew Bresticker Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- drivers/firmware/efi/efi-init.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c index b2c829e95bd14..4639ac6e4f9af 100644 --- a/drivers/firmware/efi/efi-init.c +++ b/drivers/firmware/efi/efi-init.c @@ -141,15 +141,6 @@ static __init int is_usable_memory(efi_memory_desc_t *md) case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: case EFI_PERSISTENT_MEMORY: - /* - * Special purpose memory is 'soft reserved', which means it - * is set aside initially, but can be hotplugged back in or - * be assigned to the dax driver after boot. - */ - if (efi_soft_reserve_enabled() && - (md->attribute & EFI_MEMORY_SP)) - return false; - /* * According to the spec, these regions are no longer reserved * after calling ExitBootServices(). However, we can only use @@ -194,6 +185,16 @@ static __init void reserve_regions(void) size = npages << PAGE_SHIFT; if (is_memory(md)) { + /* + * Special purpose memory is 'soft reserved', which + * means it is set aside initially. Don't add a memblock + * for it now so that it can be hotplugged back in or + * be assigned to the dax driver after boot. + */ + if (efi_soft_reserve_enabled() && + (md->attribute & EFI_MEMORY_SP)) + continue; + early_init_dt_add_memory_arch(paddr, size); if (!is_usable_memory(md)) -- 2.43.0