Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp825705lqh; Thu, 28 Mar 2024 19:12:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGFNCKVPVuM2Y/vxlkZEeG+Uyj/o34nhJPs70Psr1jxs3A+JXN/ZKzyDlMG+TQdxrmfUxthhp22OZorBFKeSNQPFLcTeXXyuU0R+p0iA== X-Google-Smtp-Source: AGHT+IFtUThs9wEALLcK/X8pvR+0vKLVud9Ie4nBYaECIR5lKfl9d+VIOWLZ8GvZ49OCxzUAp/r3 X-Received: by 2002:a0d:efc6:0:b0:611:9104:b450 with SMTP id y189-20020a0defc6000000b006119104b450mr1215656ywe.15.1711678354432; Thu, 28 Mar 2024 19:12:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711678354; cv=pass; d=google.com; s=arc-20160816; b=vH3l2bTIb7/dY4HitOix4tDouSruLZrJTYL1lTeIELhO65OeNuV5OCQYXDWKGqkR5w 4njlpIx4K8buy+cMNHsdLtfqGvIh+Pd1NO7e0xH0PHw6jpuktY4xxcOrd/EWvwiavICh ISDbeR9OhJNRWr0z8zsw0Drbc8UFgcANiw2OqCWSeAb74DjLWYR+P1iaYcU0zKtOqkkm WeTNF/dviRE9Z66SqcoCqP++E9s1p9C2U1nii3Pa15e4EOFbWvSvjzyYqRF1J/6xYzRu 7mW+AreDTHN0XYqSxM7EdVj5wRZQ+RdqwbmCEx/yLTU6a+UgeoCtTZLLu7oj0DJ5bWEQ p3FQ== 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=W/h5/IVXwZ0RiUGtCDSOnAcX2O/95tGImP25Vgeyn7A=; fh=29JuZU/mkmt6iqKNfX8Ps0lW2mlphe1qXNNK5vTxAb0=; b=CPZmcig/gsq6dwAuhS9yJnrF3WXWb/yjJbJthN58msJAT8Cq7SZjgi+ChqbjqclAzF oVtFvqU+2+KDnlqmJa3FJqSTkssesB2UUctAQBMkyku7Lbk7+S3L0xoFJ0B8j2o5ZR9u ZF32ICZRT6YRtxVxlg++7+xfw28J2Kk57uNliScHzEGoMdM0qdAdes9Cosvc4QOHTPEa W6zmcd7beF37NkW+b6qaCzTF6GajVSs8ZUB9OwbdoTFDdbkEnde+hiJJzOB2PYL+657C duUvqHIeu3kxVTNDSakUOkbUsJCGh6ivhqAugz8jHqhqaVzt+P4NHvti+kKPLHp7OMXY 6s7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GaISkusb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-crypto+bounces-3047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z3-20020ac87f83000000b00431651420cbsi2719449qtj.755.2024.03.28.19.12.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 19:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GaISkusb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-crypto+bounces-3047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2C99C1C28A80 for ; Fri, 29 Mar 2024 02:12:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45B3D405C6; Fri, 29 Mar 2024 02:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GaISkusb" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 689473C48D; Fri, 29 Mar 2024 02:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711678190; cv=none; b=kJFK/Fc4WnWwlzDtba38ugaTFd0x5ixurergrA0s79snsP0pX2E8G/hgEztlrkC3o4AwUUcr4Ku+DQBN8PUoBLKCxjcw0HFuFgwxqoWINbmVLxwgNxvi40YFxfnxLPeVyP8WlRoKgiQ1enTNbzptnD5RJaKTY7E7fm96aHkhVbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711678190; c=relaxed/simple; bh=qoYT81wmdpJZjtmAFrTyCEr2wuBbIWdL55Nla8I0oJk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qBGuqH7X9nnvve/JMiyntL1FgBj6UhXG5y458I2wpQnKKqf/iyLYbK6+xSek1Bshtt3hbq82M+145dml7Vg9VLAkEShqWjOGyRAMHxBrN9d7KlSoL8SKQA9ee+xKjLAsPlffwOVX6uQzU5/9MZlK+c5fG2kFccHHUStdistjZms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GaISkusb; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711678188; x=1743214188; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qoYT81wmdpJZjtmAFrTyCEr2wuBbIWdL55Nla8I0oJk=; b=GaISkusbB+5r4l38BYA9FEU1Mr2MHpYRMHxRlIMN4pLDfrli/9ZEp/3l 2+ySldoqh/glJUm8O/KAcaPp+j0w4YiQDjQiR9MNgbcCeKL9Pv/fvU+VA fqFpXHqKgnzkJ3x9Rzfu60sqqq9p3FrwDID8WuYLP2AlpNzX4Inq323EX Cek5tHv1aLwSPc1161Mt8fyzp+Ni1pnRaDMXZGTGLaCE7/V2TAS7QJLYv IrtQzbX2Tji/LD1oP69rqh7eSeFVXVnrmNFfCv+HHoJcigeoW4sDhf5gG 54d6PNsmFpmylhEGjPsmPNKwZc+C9cMa9vjPraoDnW7sm5bUieLjChjTw w==; X-CSE-ConnectionGUID: taYdZxwOQGykpoHSUgKvAg== X-CSE-MsgGUID: fr9bq4GhRn2jABf43DSJMA== X-IronPort-AV: E=McAfee;i="6600,9927,11027"; a="6700095" X-IronPort-AV: E=Sophos;i="6.07,162,1708416000"; d="scan'208";a="6700095" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2024 19:09:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,162,1708416000"; d="scan'208";a="17301417" Received: from chang-linux-3.sc.intel.com ([172.25.66.175]) by orviesa006.jf.intel.com with ESMTP; 28 Mar 2024 19:09:47 -0700 From: "Chang S. Bae" To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dm-devel@redhat.com Cc: ebiggers@kernel.org, luto@kernel.org, dave.hansen@linux.intel.com, tglx@linutronix.de, bp@alien8.de, mingo@kernel.org, x86@kernel.org, herbert@gondor.apana.org.au, ardb@kernel.org, elliott@hpe.com, dan.j.williams@intel.com, bernie.keany@intel.com, charishma1.gairuboyina@intel.com, chang.seok.bae@intel.com, Sangwhan Moon Subject: [PATCH v9 09/14] x86/hotplug/keylocker: Ensure wrapping key backup capability Date: Thu, 28 Mar 2024 18:53:41 -0700 Message-Id: <20240329015346.635933-10-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329015346.635933-1-chang.seok.bae@intel.com> References: <20230603152227.12335-1-chang.seok.bae@intel.com> <20240329015346.635933-1-chang.seok.bae@intel.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To facilitate CPU hotplug, the wrapping key needs to be loaded during CPU hotplug bringup. setup_keylocker() already establishes the routine for the wakeup path by copying the key from the backup state. Disable the feature if it's missing with CONFIG_HOTPLUG_CPU=y. Also, update the code comment to indicate support for CPU hotplug. Signed-off-by: Chang S. Bae Cc: Sangwhan Moon --- Changes from v8: * Add as a new patch. --- arch/x86/kernel/keylocker.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/keylocker.c b/arch/x86/kernel/keylocker.c index d5d11d0263b7..1b57e11d93ad 100644 --- a/arch/x86/kernel/keylocker.c +++ b/arch/x86/kernel/keylocker.c @@ -69,6 +69,8 @@ static bool copy_keylocker(void) * On wakeup, APs copy a wrapping key after the boot CPU verifies a valid * backup status through restore_keylocker(). Subsequently, they adhere * to the error handling protocol by invalidating the flag. + * + * This setup routine is also invoked in the hotplug bringup path. */ void setup_keylocker(void) { @@ -135,11 +137,11 @@ static int __init init_keylocker(void) /* * The backup is critical for restoring the wrapping key upon - * wakeup. + * wakeup or during hotplug bringup. */ backup_available = !!(ebx & KEYLOCKER_CPUID_EBX_BACKUP); - if (!backup_available && IS_ENABLED(CONFIG_SUSPEND)) { - pr_debug("x86/keylocker: No key backup with possible S3/4.\n"); + if (!backup_available && (IS_ENABLED(CONFIG_SUSPEND) || IS_ENABLED(CONFIG_HOTPLUG_CPU))) { + pr_debug("x86/keylocker: No key backup with possible S3/4 or CPU hotplug.\n"); goto clear_cap; } -- 2.34.1