Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2774153rdb; Mon, 12 Feb 2024 16:54:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXl32ZaCorUu2diZJejZvxi0quT1IGypW11tk9ZCDVVUtqnBORxlLs/PsikkNNMmEchA2GJBFWTpwRKbYHWDHcT6RqkUZ2TxAc4vcZ/WQ== X-Google-Smtp-Source: AGHT+IHnYAJys+0VM8Vhpy7J0ZYnPMClatX8Nlm6+xSEa6eTJYLNjXvuUvSl+gVWjoKFA3Y9dM2P X-Received: by 2002:a17:906:7cc3:b0:a3c:c323:2069 with SMTP id h3-20020a1709067cc300b00a3cc3232069mr1045082ejp.28.1707785666993; Mon, 12 Feb 2024 16:54:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707785666; cv=pass; d=google.com; s=arc-20160816; b=0XmrP+nhq+D7zDaoUDGkgsAsvx1nNocT+Z9deGLGWaL4T9/Xj+W+7Y4/B7inG79PyU 7cidEHbTtlOjAOAszg/8yqf/iG7JZRhomX3N+zfJdcK8y3dTT64dtxqNYuFu9Yw6lwoG V5+icQycJGRKhc5ZbEz1J7+wHMnZtTaNbiotkEggdAdKyDjI5IqJSA9v36rim4ATpWRP U3YiOtG5yLQep0yKUhhyicK5qClBx8DZijS0/IEMTPZEhbmzg6gtRIZzT3QqSFGsbVH9 uV7ZX1pu/0bOeWIz06MK5CxVNZW6f6MmTnrPyX4sg/Z/h7PKYK3Tj2rLh4/u9e0ALT+w dg+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=h6a2HzhpS/VZEjtrYhjSACPosaPjPPerj5HKuAOBktE=; fh=NbuBLWSMlvx1oC9HqXWbDcOD569Als450MGY21DOObQ=; b=UUAoIw0K+FyVuhYfo74U/EGccd7nYFtr1Y6kdufKUaJwuAtHKCtwwFBjdgko9BC0ml fSSlKWAmUu7XU858zhgOVyx5QQHuVe6aYbiF5Q7GmrdjhhvPTzEEh+G4YMz59pCzWoyg jL4FyzscJQd3zZlVrggbbSTPUlEvoo08ok6LgxvUdwX0djhmSQttE/St9bnog3yMqiQ9 lnNg2n1O6f1hP45k9yO4Q6ci/IRSCiRfvg25bfAPW38Mv9rFYTLcGlBnx2gH4a/FRfyK 1YYvLWT8Ky+9xZ3j0KPcNQb05CR0SdXiEBIdvOCxr4Bq+hC82c2z8mmHZXrImiK2H4bC pQXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sxgd59/5"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62700-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWhE94xsSXHVXJUV07agZbV61BFKijw6FfFdMwHEb1IDKm/2IXyk7db/+YE2uC15Oln1ZGwk98PlacRaYw5SKl81L9TuOW3MK5bhKCwyw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n11-20020a170906b30b00b00a3cf04c5dafsi323018ejz.198.2024.02.12.16.54.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 16:54:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="sxgd59/5"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62700-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A97051F2399E for ; Tue, 13 Feb 2024 00:54:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10FC07E0FB; Tue, 13 Feb 2024 00:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sxgd59/5" 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 35F667D419; Tue, 13 Feb 2024 00:22:57 +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=1707783777; cv=none; b=jFldvJvm+1Fx7eZKvgf0Kxqnu6NhmwhfyxEv+/9D2Q3KCmnp3kZqGvjJJSBIvH3Wb9FhnqahWIknuUGBRV8Nx2CM9chKkcwxS3CdFnoggPIM8W9MlZ2bpnHw/mtAdVidQYMTBW0+1L7g61Exd/7WkdSPJWD8iPdu5sdipRUDbAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783777; c=relaxed/simple; bh=7MoyJqrgQeXbVO7HFNFxHSUbIyJrrVVw15WdcgjXy8M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OkuL6y/VJm4uzkOS329mPC4bcfLVOQc7GZBHKsPWuQwH6N0d7gtqKhUHipVxllCnFPraqWyEeMxVdclg0no/QtC5rRBJTVxAlldgUJ0QzWuO2cMdbg+/h1uknDtfNiyZJYmawR4doVE+ehcpLsWo9AG8aSp4Fuv56VvI3wJ47RE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sxgd59/5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46118C43390; Tue, 13 Feb 2024 00:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707783777; bh=7MoyJqrgQeXbVO7HFNFxHSUbIyJrrVVw15WdcgjXy8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sxgd59/5i5AXXtLWwrnfneEhAFi7MRDcxSQr3YU11LCBaMYScSKNlNblye4MyxZhs 36xrsbPGLnyz1m/spuT9Rcn23tVaaDpNfTmGNC+NnwJ431oimamt91bbqQvC1SbpSg KN4lamE5ECLOGDjKijOD8vueOPaGXFcLviq5hW9V/2FbqypNlkZXASEe/ACNgHGB9Z U84yCx4kGWeINP1MQatYyPzLnDPqaXfGkNdBlQFEu7X1G6m/bpOrtaLCbdrlixLY8q zn5vevdlf+rgWeGHL+XIkxifW4F0cuaUvwaCkESt/S8Af12QWnSUJhGNLS+P7jXzTP wMDgX/Fme4ZlQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andrew Bresticker , Ard Biesheuvel , Sasha Levin , linux-efi@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 16/28] efi: Don't add memblocks for soft-reserved memory Date: Mon, 12 Feb 2024 19:22:14 -0500 Message-ID: <20240213002235.671934-16-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213002235.671934-1-sashal@kernel.org> References: <20240213002235.671934-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.77 Content-Transfer-Encoding: 8bit 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 2fd770b499a3..ff9791ce2e15 100644 --- a/drivers/firmware/efi/efi-init.c +++ b/drivers/firmware/efi/efi-init.c @@ -116,15 +116,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 @@ -169,6 +160,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