From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 4070425A320; Fri, 17 Oct 2025 02:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760669335; cv=none; b=oTfKJsNkB6l75MvqUVlwTrofZRvQ/ViqrjNShYdxHpizN3qJIiPTRzS5zhjaL8mG2qbeYv33cLJG+EXdUMHXelK+zzkO40oB59lcayGf3kiOVyv1d42eJr+jobVR0mINSjkXgeQn3zd5V/9fVI5XasCXQhHCB9tus4zpwto4DTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760669335; c=relaxed/simple; bh=xiKk6PO3Wpl8posmb05B0wVCazkFXgFrrqCFTGy0Tv4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VVucGo+f3SXCJ3UbcYcUdhHKiQ0MRqF1vX0IBXuXDUc0rUNT7pmfX5m73SC8mSOKA07FCWcL/mOKIEvJaLFDfBTxH4EeE2vqIn0WtqKMDzVjdZ9QW77c2H31YFtc9Ua0OSScsfRf37IFiQBPqnghjfiyPEEYAwwrECsJoK/G6i0= 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=Hk7SIsqO; arc=none smtp.client-ip=198.175.65.10 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="Hk7SIsqO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760669334; x=1792205334; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=xiKk6PO3Wpl8posmb05B0wVCazkFXgFrrqCFTGy0Tv4=; b=Hk7SIsqOCQnp5H0BW3+0s8ha/q4P1jlKyt/T56JSVCjE/6K//EXMfZL8 Y3PXrVE94z/uboY3dm9SxFRi3Ns/hgX+hEnbpjeAY4NKbhnQFKWu67Lra sRWMYrNWDbyNryB45/S9BssHEbYp19HyXLrJw/LrvlmKgYVLo985MhmQC obRbMfAytNJIT6758rJJYxcdGX/4jHZT/jxsSVXC/GGTe6CXaC5lnbCQE AffOdO+1Me2m0I1QV6yznB/yVWz8oDeS/HpDqOHrfhUJVLNRqBT4omng4 i4Grteg4rUnx+YwJauxjVC1BI94hgxab/orpD6yv8nIYBSMVkKzTZAM4j A==; X-CSE-ConnectionGUID: UhehunfsRDyuVp5+RWmBKg== X-CSE-MsgGUID: siuSAB/cQwu5+mOoT5CtUQ== X-IronPort-AV: E=McAfee;i="6800,10657,11584"; a="80321927" X-IronPort-AV: E=Sophos;i="6.19,234,1754982000"; d="scan'208";a="80321927" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2025 19:48:51 -0700 X-CSE-ConnectionGUID: 2V3QgfLHQ6m1/C+i/ZNj+g== X-CSE-MsgGUID: wagtWPxbSBOMo8cn5jyL9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,234,1754982000"; d="scan'208";a="219776571" Received: from unknown (HELO [172.25.112.21]) ([172.25.112.21]) by orviesa001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2025 19:48:50 -0700 From: Ricardo Neri Date: Thu, 16 Oct 2025 19:57:29 -0700 Subject: [PATCH v6 07/10] x86/hyperv/vtl: Setup the 64-bit trampoline for TDX guests Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251016-rneri-wakeup-mailbox-v6-7-40435fb9305e@linux.intel.com> References: <20251016-rneri-wakeup-mailbox-v6-0-40435fb9305e@linux.intel.com> In-Reply-To: <20251016-rneri-wakeup-mailbox-v6-0-40435fb9305e@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=1760669902; l=2679; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=MBLpaX0bjtX22TSisCsj/ncNkao4eO5cxcCqH/6INlg=; b=IDF/ylbPdJDayXs+OHBmUFyPJDtuqLGBBk34ZMwIRKaEzUeJNmwBL4iwjSPKXP+giVZhEQSJb FxOJwqBO0DYD7HIP5eLGk1njXSAe8/OPGMd70N/VxsTQ4DPD1a0TRtY 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 since v5: - Added Reviewed-by tag from Dexuan. Thanks! Changes since v4: - None Changes since v3: - Added Reviewed-by tag from Michael. Thanks! Changes since v2: - Added a note regarding there is no need to check for a present paravisor. - Edited commit message for clarity. Changes since v1: - 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); - x86_platform.realmode_reserve = x86_init_noop; - x86_platform.realmode_init = x86_init_noop; - real_mode_header = &hv_vtl_real_mode_header; + /* There is no paravisor present if we are here. */ + if (hv_isolation_type_tdx()) { + x86_init.resources.realmode_limit = SZ_4G; + } else { + x86_platform.realmode_reserve = x86_init_noop; + x86_platform.realmode_init = x86_init_noop; + real_mode_header = &hv_vtl_real_mode_header; + } x86_init.irqs.pre_vector_init = x86_init_noop; x86_init.timers.timer_init = x86_init_noop; x86_init.resources.probe_roms = x86_init_noop; -- 2.43.0