From nobody Mon Apr 6 16:31:02 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 C9B033A1A57; Wed, 4 Mar 2026 23:42:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667756; cv=none; b=JNwk9SHVr2gSZbBSI6F2uviC9JxviS3SJmbSGny1joBWOaNiyQOdDluY9vLeWdUjUVSy/IeWuh5cqnvyM5Y9xJWh/xvXSJ03YON4m0TJyNZJGPEQXhnS+3x/2W0riFCwruGnfCh2wXqNc+bkBtqNrMhZiP+cSGNw884UlQlH6iQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667756; c=relaxed/simple; bh=4ImPkuHX0JnsNxTdR6Gbhl0L3k7v5fMn2n2Td8f8HKc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DENf5bXdYGFZ+BOiUCh/7LsI8UXpYx5iD2CsQfII+2hSEG8ao3SXCVYxD12sqkMVQZPUbFtnRsxH9YSUzn8RSd3XdtRUjLDeEU0UbzIfI7dxl+ujQu35ERHBbkYUheFPKuGpFaoJrO+1lUAvSvWbLWj3pcESRnNMEFvtpy9Tfkk= 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=ZuQH2l//; arc=none smtp.client-ip=198.175.65.9 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="ZuQH2l//" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667755; x=1804203755; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=4ImPkuHX0JnsNxTdR6Gbhl0L3k7v5fMn2n2Td8f8HKc=; b=ZuQH2l//kCLutBfCK6qyUFznbbmTWf0Axn172nUPbQFGUZ73Gs7jnU/A CKjWZcrNeeJ7cZT1hGmuAWLpMQ/EadxW2KTyqa5/Rd3apGDbuD1PwpVQp 4jdmroWIoSRhiN5FhjWdzJL59Y6cQfDKYBBAgTTGTbaxTJwolnQtmxOkm rPbvWs/sYQHytMN+tVo1AC3vYXq4XoPTWe13UrmGjhwFoubgq1kah+Imv pbly/jy8wkl9XNdKHZVn2OiowBbJ6SW0X9oqSH53zYgEv/bcIWce3pNGV RebH0HcgbzRkJaEgVn8LOzP1ue/BLyAunBVGNkmxy5xXVtjPbyzgUlbAZ w==; X-CSE-ConnectionGUID: IiJvyQoAQP66OgwD3GTQbA== X-CSE-MsgGUID: H7Fhx0ScR4Se3G0hag0vww== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359405" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359405" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2026 15:42:31 -0800 X-CSE-ConnectionGUID: J0MFm4ujRGmzMTlWgVc6+Q== X-CSE-MsgGUID: 4rWWICZlRKSF0AL4A9mFXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376924" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by fmviesa006.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2026 15:42:29 -0800 From: Ricardo Neri Date: Wed, 04 Mar 2026 15:41:21 -0800 Subject: [PATCH v9 10/10] 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: <20260304-rneri-wakeup-mailbox-v9-10-a5c6845e6251@linux.intel.com> References: <20260304-rneri-wakeup-mailbox-v9-0-a5c6845e6251@linux.intel.com> In-Reply-To: <20260304-rneri-wakeup-mailbox-v9-0-a5c6845e6251@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=1772667694; l=2059; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=4ImPkuHX0JnsNxTdR6Gbhl0L3k7v5fMn2n2Td8f8HKc=; b=1fd4O5CSN59eMQ8HBo+M366SHzD8Kqya0ZKIQI1fLSgv3tOoNuq7VkpnEfmfV+o/lnsF8Xlym AmWWZw5zY1DAAShL6EZRRLRipxtnCi4Gg7ddidkqa8+sBaZodpKNQ3y 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 v9: - None Changes in v8: - None 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 1e2f5b3ea772..07fac3d687c3 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -274,7 +274,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