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 6F32033EB0E; Mon, 17 Nov 2025 17:04:08 +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=1763399050; cv=none; b=bYnwZg5xCvkDR5gP0mDv6plvDUI1KUhd/1A8rjedcUY2v2ZB/dau1LBfbcidhA95yp0r+nhb3aklMPSZndVFWNAPEh8Yv18PhteFHijPR2pIHHonvTxd0fLO4B4KxrdxywVvWpdaVKqkYuS1bLedCe83JrszZ0Mvq0RGGON/S28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763399050; c=relaxed/simple; bh=6eIoVgm4n0XKuFFz/HOHsOcGNCn4t0bQUAVQgQlGqgE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PTlQr6gGWpj9BNdCYjrU7rMbIwXA3RuM6hgtX+LO8NnvJxlciKKGDwQS5LnL//uhUFjdBBmgssFMq/jFWjSxTmMTXDWxThvLUddCneESMbRjmqYlyByyV69nazWHhb5Toh/vbxkEV2k+m07aWYzjDh0ytJuWavcRYV/n0gcWtQM= 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=OZhjhfNH; 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="OZhjhfNH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763399049; x=1794935049; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=6eIoVgm4n0XKuFFz/HOHsOcGNCn4t0bQUAVQgQlGqgE=; b=OZhjhfNHSXO07CoXzNOyuWRGbVLhL2ul5fkHheu9sW8Z2sbmREfIdZmt 79QMPWX23FhU6InF6esdzSyfSrmHiQwxc0rrL5r0ulZ2COfaglQjMzqJC EoyGcg5c8P3HmED7uhf+8tkcK1NhVMuONPZrdam2NuBaqr25jmqvfVfmn tXhJQrvB09TYfghzWjRj0yPFRdh3sPdcj2WFqqeqoGrqNIyIOn6zwBeIq 8qSTzLmVSdJvGWTtciNruML77ltmJYyHcw42/0/yiXrlHj3qrWBXfd9mM ykwOS2zYJqYRKXQht651c8TCiAD8Sca5/ItQro2CA1T8fGaBlGPWVb5x8 w==; X-CSE-ConnectionGUID: WjXWtMbJQmOlFfN5qpNHpw== X-CSE-MsgGUID: RMaCWm6bShKMNKQn5iXAuA== X-IronPort-AV: E=McAfee;i="6800,10657,11616"; a="69253667" X-IronPort-AV: E=Sophos;i="6.19,312,1754982000"; d="scan'208";a="69253667" 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:02 -0800 X-CSE-ConnectionGUID: MjMaK/ANShSFMibi2N1gtA== X-CSE-MsgGUID: Ql4FIDwrRDilsS2B9CvApA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,312,1754982000"; d="scan'208";a="195445191" 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:52 -0800 Subject: [PATCH v7 6/9] x86/hyperv/vtl: Setup the 64-bit trampoline for TDX guests 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-6-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 , Yunhong Jiang , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1763398999; l=2691; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=DbIhi3r9e2yQrYypAYPc0r2FmkGNsXGhWQfmQPK9E1c=; b=2dFxNnvnyBjABfQPzjg1b1dQC9Ee08wvBbR+W6iqs1oDzxAoYJxMJZ2KzWjSmAgHTKAFuEcDK 5KzvONI3ne/C964PsmtNaSiVhvg48C6T/hJHvfkO0NWiNk8Ptq91Jcc X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= From: Yunhong Jiang The hypervisor is an untrusted entity for TDX guests. It cannot be used to boot secondary CPUs - neither via hypercalls nor the INIT assert, de-assert, plus Start-Up IPI messages. Instead, the platform virtual firmware boots the secondary CPUs and puts them in a state to transfer control to the kernel. This mechanism uses the wakeup mailbox described in the Multiprocessor Wakeup Structure of the ACPI specification. The entry point to the kernel is trampoline_start64. Allocate and setup the trampoline using the default x86_platform callbacks. The platform firmware configures the secondary CPUs in long mode. It is no longer necessary to locate the trampoline under 1MB memory. After handoff from firmware, the trampoline code switches briefly to 32-bit addressing mode, which has an addressing limit of 4GB. Set the upper bound of the trampoline memory accordingly. Reviewed-by: Dexuan Cui Reviewed-by: Michael Kelley Signed-off-by: Yunhong Jiang 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: - Added a note regarding there is no need to check for a present paravisor. - Edited commit message for clarity. Changes in v2: - Dropped the function hv_reserve_real_mode(). Instead, used the new members realmode_limit and reserve_bios members of x86_init to set the upper bound of the trampoline memory. (Thomas) --- arch/x86/hyperv/hv_vtl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c index e10b63b7a49f..ca0d23206e67 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -63,9 +63,14 @@ void __init hv_vtl_init_platform(void) */ pr_info("Linux runs in Hyper-V Virtual Trust Level %d\n", ms_hyperv.vtl); =20 - x86_platform.realmode_reserve =3D x86_init_noop; - x86_platform.realmode_init =3D x86_init_noop; - real_mode_header =3D &hv_vtl_real_mode_header; + /* There is no paravisor present if we are here. */ + if (hv_isolation_type_tdx()) { + x86_init.resources.realmode_limit =3D SZ_4G; + } else { + x86_platform.realmode_reserve =3D x86_init_noop; + x86_platform.realmode_init =3D x86_init_noop; + real_mode_header =3D &hv_vtl_real_mode_header; + } x86_init.irqs.pre_vector_init =3D x86_init_noop; x86_init.timers.timer_init =3D x86_init_noop; x86_init.resources.probe_roms =3D x86_init_noop; --=20 2.43.0