From nobody Tue Dec 2 03:00:13 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 BF9BC340298; Mon, 17 Nov 2025 17:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763399054; cv=none; b=EaCBbAXuwatyXZM/FD1f+nHAxbuvP1yQSoDz9D3X2nhGTqjAmYa4df35fL87lykXWUh9bSUnC0tKa2smOovDhU65zBELt7rsLpkuQEfjhwPHALR3oeFJHDTgFdSWxbf3EOcNOlRAycifVSsNmYP5NOriei5GZWAn5rDMbae0gf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763399054; c=relaxed/simple; bh=bf6T0fhOw4XHjcwb9k8rbX5w18M9RMmSiJbS2bAV1QA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PpOPn9vobC+6tlbtFMT7YhIMRciwemoT7p+GVCBjVRn+TWl55iIMc4FJLsSF9zDggJLhtwyTvd95yidYtIv6M4IvLKPpOMqXrTDpMWCI/6wTwqYx7yQuvAEpcquebYNnBLvA9K0ahpsJeUrzgHdmsymHuIu7cy0+V5Sg0HbP+QM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i4r5D3aR; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i4r5D3aR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763399051; x=1794935051; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=bf6T0fhOw4XHjcwb9k8rbX5w18M9RMmSiJbS2bAV1QA=; b=i4r5D3aRRsAP0ph2PG/Aurw/0QCevjkYngS2Bat+Rqe8R4MSUfN+ifKb a1c1bIJJ2bZmrl9+HvC21d4H0SmwsCXZMETdGZTVHmUVoyBvAO0NoK5iE d7rO3WrgUm6PzxgvjnRm/2XZi7Hza1zo58im/MR+YGr8uaTb/cBvI/+YR t07oVXN3QAGFiB1ZydN/GX8ujPQ0bstFJZqRh3NDSxFdE+d49Abqn/Qck dNla+CNRmcUunkXw5c/To/rBRdW0cskMy7w+3YgHcYmoJmUGFPx9wGXWj B5aSIusPcZ8ghoDyMDPoKt7eeOJ3Zt8clnb+4Lis1oqF+Ji7nnZYFap/4 Q==; X-CSE-ConnectionGUID: nF2q8AgcQuKkKEmRXVcSpA== X-CSE-MsgGUID: JMu5l8e4Rr2p4rQjbnEgBQ== X-IronPort-AV: E=McAfee;i="6800,10657,11616"; a="69253679" X-IronPort-AV: E=Sophos;i="6.19,312,1754982000"; d="scan'208";a="69253679" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2025 09:04:03 -0800 X-CSE-ConnectionGUID: OxyMCbJER6OSTQFsU+DbzA== X-CSE-MsgGUID: 5iLUmNrMTxGJsbZSGFxAtA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,312,1754982000"; d="scan'208";a="195445206" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by fmviesa004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2025 09:04:02 -0800 From: Ricardo Neri Date: Mon, 17 Nov 2025 09:02:55 -0800 Subject: [PATCH v7 9/9] x86/hyperv/vtl: Use the wakeup mailbox to boot secondary CPUs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251117-rneri-wakeup-mailbox-v7-9-4a8b82ab7c2c@linux.intel.com> References: <20251117-rneri-wakeup-mailbox-v7-0-4a8b82ab7c2c@linux.intel.com> In-Reply-To: <20251117-rneri-wakeup-mailbox-v7-0-4a8b82ab7c2c@linux.intel.com> To: x86@kernel.org, Krzysztof Kozlowski , Conor Dooley , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Michael Kelley , "Rafael J. Wysocki" Cc: Saurabh Sengar , Chris Oo , "Kirill A. Shutemov" , linux-hyperv@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1763398999; l=2005; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=bf6T0fhOw4XHjcwb9k8rbX5w18M9RMmSiJbS2bAV1QA=; b=kRyEvBJR2Vzl6/jihLmGUV2JKi2Su99AgObs1zV1rqoeh3e5TGl9RJSj7Xks4gOgIpVsZazyX 8OO6X+KgrElDAEY5WzNepJR7rj6coyiBwdIvvfjX2CfN6DR9nCHZVqL X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= The hypervisor is an untrusted entity for TDX guests. It cannot be used to boot secondary CPUs. The function hv_vtl_wakeup_secondary_cpu() cannot be used. Instead, the virtual firmware boots the secondary CPUs and places them in a state to transfer control to the kernel using the wakeup mailbox. The firmware enumerates the mailbox via either an ACPI table or a DeviceTree node. If the wakeup mailbox is present, the kernel updates the APIC callback wakeup_secondary_cpu_64() to use it. Reviewed-by: Dexuan Cui Reviewed-by: Michael Kelley Signed-off-by: Ricardo Neri --- Changes in v7: - None Changes in v6: - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - None Changes in v4: - Added Reviewed-by tag from Michael. Thanks! Changes in v3: - Unconditionally use the wakeup mailbox in a TDX confidential VM. (Michael). - Edited the commit message for clarity. Changes in v2: - None --- arch/x86/hyperv/hv_vtl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c index 812d8a434966..431218ad6624 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -265,7 +265,15 @@ int __init hv_vtl_early_init(void) panic("XSAVE has to be disabled as it is not supported by this module.\n" "Please add 'noxsave' to the kernel command line.\n"); =20 - apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu= ); + /* + * TDX confidential VMs do not trust the hypervisor and cannot use it to + * boot secondary CPUs. Instead, they will be booted using the wakeup + * mailbox if detected during boot. See setup_arch(). + * + * There is no paravisor present if we are here. + */ + if (!hv_isolation_type_tdx()) + apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cp= u); =20 return 0; } --=20 2.43.0