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 129AF13A26F; Tue, 27 Feb 2024 14:27:14 +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=1709044034; cv=none; b=ViWbrZcGoW2yFbk/H5oy8FE8bhNK+auDf1RLHjzBMGGKipE4KYhrr7yV6qkGyE5MFLB3jkfLSijNn8uD/SNx7+0uM1Ee4TOUbkFeWezoqf6WtkmyfSBmgVdIeiImQqBelABBnAEgxQUfyFUea8yv4vJ2gJJYYiGlohUZq1hNL9k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709044034; c=relaxed/simple; bh=qt3FGnxffgmIVUPxMES5VnpbOw2Iy5twOHhLqRoBVDs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ogc2+bLZ2ROjeND3D/d5neO0i6XMUklkAPvsk10TGzsh0RSb26Tn/vG5iDrfilEN5XTDG4TfQEmLncrmGoqDOSYsOnOEQzhyE1cEZeIjtjlGxMqghrr+7IBB09PBOj7scYv8rIPc8+S/9VAVABpfcd7sMnbfh3wVa70BUrpxPHw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hEFFVgwm; 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="hEFFVgwm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88BB0C433F1; Tue, 27 Feb 2024 14:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709044033; bh=qt3FGnxffgmIVUPxMES5VnpbOw2Iy5twOHhLqRoBVDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hEFFVgwmd6Y8vYN25fuFCKricnmlkDp1gLOyaZCHQYUyaHh8ik9KnQ7VuIcEPRGhl r3Zv+fu+SIFQ+1wmm7haI41p3DUrhtGO1xIGRe8v9LEZgQ1RP7wqirZbuHbLSfztPH iZNE68x4txEVEAFJhUwBt+fI1+Ofvn9O1LSyLh9I= 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.10 037/122] efi: Dont add memblocks for soft-reserved memory Date: Tue, 27 Feb 2024 14:26:38 +0100 Message-ID: <20240227131559.920685751@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131558.694096204@linuxfoundation.org> References: <20240227131558.694096204@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.10-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 f55a92ff12c0f..86da3c7a5036a 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