From nobody Mon Apr 6 14:57:28 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 0EB3141754; Wed, 4 Mar 2026 23:42:29 +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=1772667751; cv=none; b=dHwS9X+dr82CCa35JuYwsikSIVNNZJO+kFrU/rMb4dFT7GbXX8LWOKv4sv2m4T2EM4rw5/vPRWqWA3m7Rdh9YswGac+tcmJwdSVAdZOl687UNDUrabGH2truOzKdgvSDRsr3qzKo77YQ5U00X1y53172W2I4NhkBqM4r9dI3/bk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667751; c=relaxed/simple; bh=AsC53VQpxshrYaK5CTrmNsNOCmmO1YYSnmYNNFi25DA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FrOtxUaYqEFCOkwCxWvunAaSHlz8zOobFTmu4Y0nRZmaTVPrRAIyOYqCzwNpZJ0T/6LdcpWxU0hAPuY4S5OCr8ZeD9JsulCK21o5Ksq4NblxTJE+2q0htKvXQcocaUSK/TM/84cHwoMchKCoTOzHv3HyU12h8ve7t6ZkEC7i6KI= 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=Fdm0pSz4; 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="Fdm0pSz4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667750; x=1804203750; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=AsC53VQpxshrYaK5CTrmNsNOCmmO1YYSnmYNNFi25DA=; b=Fdm0pSz4I54BnEiReOl120qzb3eIOgYV5wPhvTxG/NhPTQG3/a7ZrWXJ 1dd1CQzRyfMbzK50hGRG9O+DYfDH6WZYcqob3rHfCm1JgVAMrtnagMYOg 6EI8xPL7TRqXWCS6Wm8LGXPp2yTOobjPw6lwtVjKEcQ1Ul0NyeQymzlsK sPEJBSGxC9W2I23Fe19L0ZzBysLYioN+NNFrYAnwO14vhf0F/05cBsj97 uCsijrTcVdOblJqRN7/0BjjDXqsZv8PP/wob8RG3+vRfEzRoO2l7FYkVQ hWJcT5mYQozUqsgbF8fAZAkoMyDWIPOefikXoKmP/iGTXT3QnSVOU2PJu Q==; X-CSE-ConnectionGUID: I6VsfV1uRL+qg+h3ZZoxQg== X-CSE-MsgGUID: Uuy9SolCTuO0vvuiKR/FDg== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359362" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359362" 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:29 -0800 X-CSE-ConnectionGUID: BEGLUdsRQMWyDupAX6ra8Q== X-CSE-MsgGUID: OsSNdvBUSrqLUGRiO0UKfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376892" 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:28 -0800 From: Ricardo Neri Date: Wed, 04 Mar 2026 15:41:12 -0800 Subject: [PATCH v9 01/10] x86/topology: Add missing struct declaration and attribute dependency 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-1-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 , kernel test robot , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=2967; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=AsC53VQpxshrYaK5CTrmNsNOCmmO1YYSnmYNNFi25DA=; b=oTMx0bNW62KmU7FERERGRoTrWCkbfnKuQLaCgJQGZRDr0FKG5kr+bLvT1v0ltjm5m4iKokUus QlnUwRGkdvnAif2ZABY6lZ5ljS5gbc2z+hSnAVsQzURcmj8HBlzdAQr X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= The prototypes for get_topology_cpu_type_name() and get_topology_cpu_type() take a pointer to struct cpuinfo_x86, but asm/topology.h neither includes nor forward-declares the structure. Including asm/topology.h, directly or indirectly, without including asm/processor.h triggers a warning: ./arch/x86/include/asm/topology.h:159:47: error: =E2=80=98struct cpuinf= o_x86=E2=80=99 declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 159 | const char *get_topology_cpu_type_name(struct cpuinfo_x86 *c); | ^~~~~~~~~~~ Since only a pointer is needed, add a forward declaration of struct cpuinfo_x86. Additionally, sysctl_sched_itmt_enabled is declared in asm/topology.h with the __read_mostly attribute, but the header does not include linux/cache.h. This causes a build failure when including asm/topology.h but not linux/ cache.h: ./arch/x86/include/asm/topology.h:264:27: error: expected =E2=80=98=3D= =E2=80=99, =E2=80=98,=E2=80=99, =E2=80=98;=E2=80=99, =E2=80=98asm=E2=80=99 or =E2=80=98__attribute__= =E2=80=99 before =E2=80=98sysctl_sched_itmt_enabled=E2=80=99 264 | extern bool __read_mostly sysctl_sched_itmt_enabled; | ^~~~~~~~~~~~~~~~~~~~~~~~~ Include the required header. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202511181954.UMxCeTV1-lkp@int= el.com/ Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202511190008.AA0NTn3G-lkp@int= el.com/ Signed-off-by: Ricardo Neri --- I independently found this issue when including asm/acpi.h to arch/x86/ hyperv/hv_vtl.c, which implicitly includes asm/topology.h but not asm/ processor.h nor linux/cache.h. --- Changes in v9: - None Changes in v8: - Added this patch. Changes in v7: - N/A Changes in v6: - N/A Changes in v5: - N/A Changes in v4: - N/A Changes in v3: - N/A Changes in v2: - N/A Changes in v3: - N/A Changes in v2: - N/A --- arch/x86/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topolog= y.h index 1fadf0cf520c..630521a03982 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -156,6 +156,8 @@ extern unsigned int __max_threads_per_core; extern unsigned int __num_threads_per_package; extern unsigned int __num_cores_per_package; =20 +struct cpuinfo_x86; + const char *get_topology_cpu_type_name(struct cpuinfo_x86 *c); enum x86_topology_cpu_type get_topology_cpu_type(struct cpuinfo_x86 *c); =20 @@ -259,6 +261,7 @@ extern bool x86_topology_update; =20 #ifdef CONFIG_SCHED_MC_PRIO #include +#include =20 DECLARE_PER_CPU_READ_MOSTLY(int, sched_core_priority); extern bool __read_mostly sysctl_sched_itmt_enabled; --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 49415371D18; Wed, 4 Mar 2026 23:42:31 +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=1772667752; cv=none; b=NbFnCIaNWpVazCoTiPJS51pFI8sqgg8Yxycm7QU9IKZvDlXRHGYDfv+KBul3Tyq0eCkPAq9op4dpGwA7ljUevb0XcryEA+1fIsBEdUdrzrURXhFVew3nox9YnSSMuM3CH8JA7nMdtvW8jGNDCUknlcb7gyQ0sh5miS7ZNtQ4tHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667752; c=relaxed/simple; bh=sW69dOJpj+Zvcx0LGtVJv5/bm8HwObqT3wbBW18B9RQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HpWO9mK11KgujzBi0QL+NtoP24pBU7xOTAOPVEmJfwBXnxOh1JZf+JfUJuVHje4cdpjTU87m6wyH/i/nwYxsf0KLa+X/0QuVS1KNaiNMwQOuUhn6Rug5NoHxUiZ29RkstQ1AWfCQYlz9/ur7R+5f9esRvsVvi6vg8koigz3OexM= 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=P+p2arDU; 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="P+p2arDU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667752; x=1804203752; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=sW69dOJpj+Zvcx0LGtVJv5/bm8HwObqT3wbBW18B9RQ=; b=P+p2arDUcQa4+hTVTGPnwlX+X67lK3ulRSNQCwmMwImFSV7y6M7Sl6T0 aj9kdOyn8G76Krr4WenQrOpeTOhi6TpYY55lcYzYG/Py8pE9xkGFndcTl ovuc7B6OjnVEN+ewxzDI8tP2rLgHRQHUDqEnYxwLB689rZpqpIJVDukz2 +Ba0JuiNrCGybg8UXAuiyLQdN1ydKotHWZ8a//UxcC1cl0n3Sl1bWgCej S5qNOCiRTldoFTOYQUtMy/QOvl0udh4CDe8BmoqF+xQhvOJPszht215YN 9vNnxSjdGg+ZKnjviEkrcpIyHc7k06eui29feAzzblpj3ZS9eolSEPjRy Q==; X-CSE-ConnectionGUID: Ph/JkUX9TteqnAEDu5RvAg== X-CSE-MsgGUID: 5Y+zhKyXRgeJwM1/EvlntA== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359369" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359369" 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:29 -0800 X-CSE-ConnectionGUID: Z5gypgjcTGSg75UTsjnwTw== X-CSE-MsgGUID: QaW84QqxRpSVUkbqab9p5g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376896" 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:28 -0800 From: Ricardo Neri Date: Wed, 04 Mar 2026 15:41:13 -0800 Subject: [PATCH v9 02/10] x86/acpi: Add functions to setup and access the wakeup mailbox 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-2-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=3190; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=sW69dOJpj+Zvcx0LGtVJv5/bm8HwObqT3wbBW18B9RQ=; b=PcyOuEtArfUqX0eO1T9nxSxRHpSmRhQyWPkxT5Ilxwz8XNktxvA5O3ur5EgLsERHPzoOWh5Ef mG4JkPPoW6ZArNKqic8WorwPQttGws2kwl0OiW3LsPpg4kq5C6Jf7RH X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= Systems that describe hardware using DeviceTree graphs may enumerate and implement the wakeup mailbox as defined in the ACPI specification but do not otherwise depend on ACPI. Expose functions to setup and access the location of the wakeup mailbox from outside ACPI code. The function acpi_setup_mp_wakeup_mailbox() stores the physical address of the mailbox and updates the wakeup_secondary_cpu_64() APIC callback. The function acpi_madt_multiproc_wakeup_mailbox() returns a pointer to the mailbox. Acked-by: Rafael J. Wysocki (Intel) Signed-off-by: Ricardo Neri --- Changes in v9: - None Changes in v8: - Added Acked-by tag from Rafael. Thanks! Changes in v7: - Moved function declarations to arch/x86/include/asm/acpi.h - Added stubs for !CONFIG_ACPI. - Do not use these new functions in madt_wakeup.c. - Dropped Acked-by and Reviewed-by tags from Rafael and Dexuan as this patch changed. Changes in v6: - Fixed grammar error in the subject of the patch. (Rafael) - Added Acked-by tag from Rafael. Thanks! - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - None Changes in v4: - Squashed the two first patches of the series into one, both introduce helper functions. (Rafael) - Renamed setup_mp_wakeup_mailbox() as acpi_setup_mp_wakeup_mailbox(). (Rafael) - Dropped the function prototype for !CONFIG_X86_64. (Rafael) Changes in v3: - Introduced this patch. Changes in v2: - N/A --- arch/x86/include/asm/acpi.h | 10 ++++++++++ arch/x86/kernel/acpi/madt_wakeup.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index a03aa6f999d1..820df375df79 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -182,6 +182,9 @@ void __iomem *x86_acpi_os_ioremap(acpi_physical_address= phys, acpi_size size); #define acpi_os_ioremap acpi_os_ioremap #endif =20 +void acpi_setup_mp_wakeup_mailbox(u64 addr); +struct acpi_madt_multiproc_wakeup_mailbox *acpi_get_mp_wakeup_mailbox(void= ); + #else /* !CONFIG_ACPI */ =20 #define acpi_lapic 0 @@ -200,6 +203,13 @@ static inline u64 x86_default_get_root_pointer(void) return 0; } =20 +static inline void acpi_setup_mp_wakeup_mailbox(u64 addr) { } + +static inline struct acpi_madt_multiproc_wakeup_mailbox *acpi_get_mp_wakeu= p_mailbox(void) +{ + return NULL; +} + #endif /* !CONFIG_ACPI */ =20 #define ARCH_HAS_POWER_INIT 1 diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt= _wakeup.c index 6d7603511f52..82caf44b45e3 100644 --- a/arch/x86/kernel/acpi/madt_wakeup.c +++ b/arch/x86/kernel/acpi/madt_wakeup.c @@ -247,3 +247,14 @@ int __init acpi_parse_mp_wake(union acpi_subtable_head= ers *header, =20 return 0; } + +void __init acpi_setup_mp_wakeup_mailbox(u64 mailbox_paddr) +{ + acpi_mp_wake_mailbox_paddr =3D mailbox_paddr; + apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu); +} + +struct acpi_madt_multiproc_wakeup_mailbox *acpi_get_mp_wakeup_mailbox(void) +{ + return acpi_mp_wake_mailbox; +} --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 58FDF382289; Wed, 4 Mar 2026 23:42:31 +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=1772667752; cv=none; b=KVCI0HaaPOjNhM5bhNMImWQubYEm4GH2VqDopc9B+pttjZKFvNX6exlSDQxCmFs8KYtjMlhX7VHQq/Buh08SZO9UKeuMo8s7fNKjjn8RGxidsdJ0bfUCUX6zfug0yhwxZFAE7R/1TMQqYDzQjtHn29y/qi2A+445zzuIjVQMEJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667752; c=relaxed/simple; bh=ciTx6jFLRX+cYPzbQO5DkDfWrCNsSfpCsP/sfCfc7Zk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qHL50y/PMUsuOha3OMy7DpR13+HUaOfBYwu7mLxFkn2fd8CzaffSc0vEkKDeqMmYt3x7kP1B5ZXVHCis4os3eg08GWu1RohwrAOFpXcGgSc4/Jlsd68Lsv4/itjWuP+HsQyb5O2DbovlvHr/qaQA2Gv5KrvqMaaC89g3pSnvPso= 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=TmkaU/Kh; 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="TmkaU/Kh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667752; x=1804203752; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=ciTx6jFLRX+cYPzbQO5DkDfWrCNsSfpCsP/sfCfc7Zk=; b=TmkaU/KhbE6U4Ri6EnjGIZGFMRk7FBbPCojkGISsX+lx4+plo/cKukiW GINHpwdtQUtjePsdMLU/70d5mSXozowAVx3q4W70d3JCAvIjTTSN+kp0M AISGj5T4nOuAEc/RJ2uwKaPzJY27qr090nF+iSL+DxAybaBBjjdiDdeyy xXz/CugUPE2hh/ZRbNdQDjScPzkzarrR/B10g0RuO/MRxIgH1BHw7FW4y T4SkApHRSUXPtvH7qPgYoAcqs1jCCINlV9sJi3dY2wSavoUoPkXbLAeQe 2z+Wpy8ZRVArcX7n+c8L+zddisgXCspEOLb8JyVuSQu1jg7ifFbXLWeO7 g==; X-CSE-ConnectionGUID: 6JeTAXVHSqWI1TPSdo9DPw== X-CSE-MsgGUID: dadBYRQuQfehXh3nBLnvyQ== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359377" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359377" 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:30 -0800 X-CSE-ConnectionGUID: FzfG3nLdRsyG1ScA4+MSFg== X-CSE-MsgGUID: OKXuyCwnRzuw4bEYCc0wqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376899" 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:28 -0800 From: Ricardo Neri Date: Wed, 04 Mar 2026 15:41:14 -0800 Subject: [PATCH v9 03/10] dt-bindings: reserved-memory: Wakeup Mailbox for Intel processors 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-3-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 , "Rafael J. Wysocki (Intel)" , Yunhong Jiang , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=5252; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=ciTx6jFLRX+cYPzbQO5DkDfWrCNsSfpCsP/sfCfc7Zk=; b=XkvYdYE34j1ulN0kd9woS3K+p89IhdGXqj/v3Z6brWdhNW0ROExOuBToSnyI6qtEWrfwjpQMo GrRtrhIKil5CuCo8um3ZIGFfolVbWvyDWos7a1Q7/c8WjUaJedKefSO X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= Add DeviceTree bindings to enumerate the wakeup mailbox used in platform firmware for Intel processors. x86 platforms commonly boot secondary CPUs using an INIT assert, de-assert followed by Start-Up IPI messages. The wakeup mailbox can be used when this mechanism is unavailable. The wakeup mailbox offers more control to the operating system to boot secondary CPUs than a spin-table. It allows the reuse of the same wakeup vector for all CPUs while maintaining control over which CPUs to boot and when. While it is possible to achieve the same level of control using a spin-table, it would require specifying a separate `cpu-release-addr` for each secondary CPU. The operation and structure of the mailbox are described in the Multiprocessor Wakeup Structure defined in the ACPI specification. Note that this structure does not specify how to publish the mailbox to the operating system (ACPI-based platform firmware uses a separate table). No ACPI table is needed in DeviceTree-based firmware to enumerate the mailbox. Nodes that want to refer to the reserved memory usually define a `memory-region` property. /cpus/cpu* nodes would want to refer to the mailbox, but they do not have such property defined in the DeviceTree specification. Moreover, it would imply that there is a memory region per CPU. Instead, add a `compatible` property that the operating system can use to discover the mailbox. Reviewed-by: Dexuan Cui Reviewed-by: Rob Herring (Arm) Acked-by: Rafael J. Wysocki (Intel) Co-developed-by: Yunhong Jiang Signed-off-by: Yunhong Jiang Signed-off-by: Ricardo Neri --- Changes in v9: - Removed a spurious empty line. (Rob's bot) Changes in v8: - None Changes in v7: - Fixed Acked-by tag from Rafael to include the "(Intel)" suffix. Changes in v6: - Reworded the changelog for clarity. - Added Acked-by tag from Rafael. Thanks! - Added Reviewed-by tag from Rob. Thanks! - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - Specified the version and section of the ACPI spec in which the wakeup mailbox is defined. (Rafael) - Fixed a warning from yamllint about line lengths of URLs. Changes in v4: - Removed redefinitions of the mailbox and instead referred to ACPI specification as per discussion on LKML. - Clarified that DeviceTree-based firmware do not require the use of ACPI tables to enumerate the mailbox. (Rob) - Described the need of using a `compatible` property. - Dropped the `alignment` property. (Krzysztof, Rafael) - Used a real address for the mailbox node. (Krzysztof) Changes in v3: - Implemented the mailbox as a reserved-memory node. Add to it a `compatible` property. (Krzysztof) - Explained the relationship between the mailbox and the `enable-mehod` property of the CPU nodes. - Expanded the documentation of the binding. Changes in v2: - Added more details to the description of the binding. - Added requirement a new requirement for cpu@N nodes to add an `enable-method`. --- .../reserved-memory/intel,wakeup-mailbox.yaml | 49 ++++++++++++++++++= ++++ 1 file changed, 49 insertions(+) diff --git a/Documentation/devicetree/bindings/reserved-memory/intel,wakeup= -mailbox.yaml b/Documentation/devicetree/bindings/reserved-memory/intel,wak= eup-mailbox.yaml new file mode 100644 index 000000000000..4362bc058df4 --- /dev/null +++ b/Documentation/devicetree/bindings/reserved-memory/intel,wakeup-mailbo= x.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reserved-memory/intel,wakeup-mailbox.ya= ml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wakeup Mailbox for Intel processors + +description: | + The Wakeup Mailbox provides a mechanism for the operating system to wake= up + secondary CPUs on Intel processors. It is an alternative to the INIT-!IN= IT- + SIPI sequence used on most x86 systems. + + The structure and operation of the mailbox is described in the Multiproc= essor + Wakeup Structure of the ACPI specification version 6.6 section 5.2.12.19= [1]. + + The implementation of the mailbox in platform firmware is described in t= he + Intel TDX Virtual Firmware Design Guide section 4.3.5 [2]. + + 1: https://uefi.org/specs/ACPI/6.6/05_ACPI_Software_Programming_Model.ht= ml#multiprocessor-wakeup-structure + 2: https://www.intel.com/content/www/us/en/content-details/733585/intel-= tdx-virtual-firmware-design-guide.html + +maintainers: + - Ricardo Neri + +allOf: + - $ref: reserved-memory.yaml + +properties: + compatible: + const: intel,wakeup-mailbox + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + reserved-memory { + #address-cells =3D <2>; + #size-cells =3D <1>; + + wakeup-mailbox@ffff0000 { + compatible =3D "intel,wakeup-mailbox"; + reg =3D <0x0 0xffff0000 0x1000>; + }; + }; --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 6C7933845B3; Wed, 4 Mar 2026 23:42:31 +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=1772667752; cv=none; b=YhmBbTb0bx2NJcIDQfBWLyaYnJxDLJ+sOLmgKmwnCv3rnqot5bu2MfBqXfLIP9o/w47SjpLZkr8yK/krjwUTuN1yyWkrhqCNiqf+i3dTnCrkLmZsOTHVGezplaiL40/sliZ8y3iHAMZX0T6nrOCApTzuxMyhJmtO2kS10WAQyd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667752; c=relaxed/simple; bh=qXYoaEms0cS0wZC2ODKoxzgS7jq86FPFbDCJ0PJAAY8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eCiFZsqraeNfoWOCIXU6gqnMyy/S5huuLfkNbFLFV95Jk/DkQL7MRn2YrYsETtOacPHk7VX5+iyL5dM+WmDeR5qyTFGtELkAK4dca/TemxHuRt7PO/uHix3qOF44RBVD6rhVupVmcBs4P8CfSn7qNTqLXoMoR4TmS2+LfAq7YA4= 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=TiQRHS59; 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="TiQRHS59" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667752; x=1804203752; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=qXYoaEms0cS0wZC2ODKoxzgS7jq86FPFbDCJ0PJAAY8=; b=TiQRHS59RL6M2CUPgLmHldNfKSLKuxdRagtxMG10youMLCGZqUEmwMFx 61yQN8nzI14QlXQr0AF2cdq7i1ke0eO9/vlYnx1kwvYLy3urTCNezdinQ I/gaI7nyB9Sg4kCmSdFq6B8K7Lzm2zzJKuKzjFgY+/Y4T/3OxmSaiCA/t +qa5FsMJdUNN0a/gDjJl6N4Bx1RfvGQNeSBZKWQZf/Juih0xs7D8UBvWB y2kYNH0DQeEVNqog3YqYwEtomCGpL9rd2IZB1ujArDE6R37jSLXW9qszV N0E1DUPsn71GhPZ08YUWsWvX3UKRiroCxzRRMK2FHWoLuFhemlp/eFazB g==; X-CSE-ConnectionGUID: DmvOwcpUSxCm9wSy4g7foQ== X-CSE-MsgGUID: VpjcBPklTK6j0w7Dsn719w== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359379" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359379" 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:30 -0800 X-CSE-ConnectionGUID: DpyxQfphQvKbvlEYc1Y6mw== X-CSE-MsgGUID: vvWKmyObRIO42J1Vpg/z9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376902" 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:28 -0800 From: Ricardo Neri Date: Wed, 04 Mar 2026 15:41:15 -0800 Subject: [PATCH v9 04/10] x86/dt: Parse the Wakeup Mailbox for Intel processors 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-4-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 , Yunhong Jiang , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=4553; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=qXYoaEms0cS0wZC2ODKoxzgS7jq86FPFbDCJ0PJAAY8=; b=a0g3m9Q5qiVTigofzAeeCBKtUdDx3rbqCjAs87qGUQ4NPFgf7qEh0lMxPnmPSC9TlUynsog64 x3BjpM1/8q3CglVWda/ewap8tYkawwB5xPLM05Z1Nq/7GiSqJ6RkDiP X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= The Wakeup Mailbox is a mechanism to boot secondary CPUs on systems that do not want or cannot use the INIT + StartUp IPI messages. The platform firmware is expected to implement the mailbox as described in the Multiprocessor Wakeup Structure of the ACPI specification. It is also expected to publish the mailbox to the operating system as described in the corresponding DeviceTree schema that accompanies the documentation of the Linux kernel. Reuse the existing functionality to set the memory location of the mailbox and update the wakeup_secondary_cpu_64() APIC callback. Make this functionality available to DeviceTree-based systems by making CONFIG_X86_ MAILBOX_WAKEUP depend on either CONFIG_OF or CONFIG_ACPI_MADT_WAKEUP. do_boot_cpu() uses wakeup_secondary_cpu_64() when set. It will be set if a wakeup mailbox is enumerated via an ACPI table or a DeviceTree node. For cases in which this behavior is not desired, this APIC callback can be updated later during boot using platform-specific hooks. Reviewed-by: Dexuan Cui Co-developed-by: Yunhong Jiang Signed-off-by: Yunhong Jiang Signed-off-by: Ricardo Neri --- Changes in v9: - None Changes in v8: - None Changes in v7: - #included asm/acpi.h to reflect the updated declaration of the needed functions. - (Kept Reviewed-by tag from Dexuan, as this single change is trivial.) Changes in v6: - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - Made CONFIG_X86_MAILBOX_WAKEUP depend on CONFIG_OF or CONFIG_ACPI_ MADT_WAKEUP. Changes in v4: - Look for the wakeup mailbox unconditionally, regardless of whether cpu@N nodes have an `enable-method` property. - Add a reference to the ACPI specification. (Rafael) Changes in v3: - Added extra sanity checks when parsing the mailbox node. - Probe the mailbox using its `compatible` property - Setup the Wakeup Mailbox if the `enable-method` is found in the CPU nodes. - Cleaned up unneeded ifdeffery. - Clarified the mechanisms used to override the wakeup_secondary_64() callback to not use the mailbox when not desired. (Michael) - Edited the commit message for clarity. Changes in v2: - Disabled CPU offlining. - Modified dtb_parse_mp_wake() to return the address of the mailbox. --- arch/x86/kernel/devicetree.c | 47 ++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 47 insertions(+) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index dd8748c45529..318acaecb5ca 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -18,6 +18,7 @@ #include #include =20 +#include #include #include #include @@ -125,6 +126,51 @@ static void __init dtb_setup_hpet(void) #endif } =20 +#if defined(CONFIG_X86_64) && defined(CONFIG_SMP) + +#define WAKEUP_MAILBOX_SIZE 0x1000 +#define WAKEUP_MAILBOX_ALIGN 0x1000 + +/** dtb_wakeup_mailbox_setup() - Parse the wakeup mailbox from the device = tree + * + * Look for the presence of a wakeup mailbox in the DeviceTree. The mailbo= x is + * expected to follow the structure and operation described in the Multipr= ocessor + * Wakeup Structure of the ACPI specification. + */ +static void __init dtb_wakeup_mailbox_setup(void) +{ + struct device_node *node; + struct resource res; + + node =3D of_find_compatible_node(NULL, NULL, "intel,wakeup-mailbox"); + if (!node) + return; + + if (of_address_to_resource(node, 0, &res)) + goto done; + + /* The mailbox is a 4KB-aligned region.*/ + if (res.start & (WAKEUP_MAILBOX_ALIGN - 1)) + goto done; + + /* The mailbox has a size of 4KB. */ + if (res.end - res.start + 1 !=3D WAKEUP_MAILBOX_SIZE) + goto done; + + /* Not supported when the mailbox is used. */ + cpu_hotplug_disable_offlining(); + + acpi_setup_mp_wakeup_mailbox(res.start); +done: + of_node_put(node); +} +#else /* !CONFIG_X86_64 || !CONFIG_SMP */ +static inline int dtb_wakeup_mailbox_setup(void) +{ + return -EOPNOTSUPP; +} +#endif /* CONFIG_X86_64 && CONFIG_SMP */ + #ifdef CONFIG_X86_LOCAL_APIC =20 static void __init dtb_cpu_setup(void) @@ -287,6 +333,7 @@ static void __init x86_dtb_parse_smp_config(void) =20 dtb_setup_hpet(); dtb_apic_setup(); + dtb_wakeup_mailbox_setup(); } =20 void __init x86_flattree_get_config(void) --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 AD0A83914EB; Wed, 4 Mar 2026 23:42:32 +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=1772667754; cv=none; b=ESJ+uS7t4KbPOLjODknqT3/ZCog1S5A+Eu7Zb15+TKP+aQxlHvMT9fvl5p/2KEQWO/RJo6+2BZMI35rLukJgxTyP2h0xypco7Ik+/5qogQhqVsUiLkatwELt3AgJTKg2vIxPNr7OsFURgONWI50uIl40+/ctRyuhBU6mPoUdDjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667754; c=relaxed/simple; bh=JDBcIU3oLzy6nR7gCTw/cB7hCWrF8Ykxag6iBFuscOw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PbrfJwYK2rZBhKF4mdMysCyyWSCpVVznvHVp1CDvLTY/cfOcVF0HOnGX5dt76cgMQdBW4s96S4qEnaAp3AGJ0r3/zuTdkN1roW8DJNPvpDG9Sk+Xeea0zXtD7qrtv9TbJb0KRdyLOIIgiAe3e3wM8FeYJ4tuquSdvV0/4RHKdF8= 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=CT82jUBl; 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="CT82jUBl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667753; x=1804203753; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=JDBcIU3oLzy6nR7gCTw/cB7hCWrF8Ykxag6iBFuscOw=; b=CT82jUBlZ+oCza2cm/hxPB1Qg8tAxqobgw8JdgNvZs1HpHZ2HnOE0Mbq g1lclwszTvBeVAY+bq5pyyCj5NRYi0gx+uDgqrWQAmM4oPdHMGhuiyMK7 FDUmsPDlav8uwCVij3D3g4yHvsbpw2jPywsc7zhG2KH8guoH7ZsF/468w lKA/jddXR+GVqB6jBPXYfTfclR8e4x9V+tokIkHISPpoNJxDizM1gBi/z F0JdFbu9KNCJ8f/+TISkqpCCmwqjFLiANtkWtbxVtGHcuY7eocvvgT8A6 7LhySxHREnRImJUfJY5eiPYRmRLvPFFor/lWHLL3L2y6z+1zkfalgY7ja g==; X-CSE-ConnectionGUID: jnxZ87f5SYaVQHkkxbRCsA== X-CSE-MsgGUID: 6ap271UcTYSnuINyW51EaQ== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359389" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359389" 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:30 -0800 X-CSE-ConnectionGUID: bQI2OXMkRji1/NWcKKnL/Q== X-CSE-MsgGUID: l6aAjajfSzWu5KxBdIVl+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376906" 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:28 -0800 From: Ricardo Neri Date: Wed, 04 Mar 2026 15:41:16 -0800 Subject: [PATCH v9 05/10] x86/hyperv/vtl: Set real_mode_header in hv_vtl_init_platform() 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-5-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 , Yunhong Jiang , Ricardo Neri , Thomas Gleixner X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=2364; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=3I3YmnN/1McteB5oTgTUDd+p5JYa7dqLPq6/RX+ToAU=; b=decoK6P5d5qSAFB2QaKNVFhE4bD6HhEyCOofVP3dBzQuDa2BSA9cP8meaZPCD7m1O48LrvItr KEYRolCT//LBd8Z2Rr2e1EOibvhz6MvsEurHUwK2tv1DIhc/Qs+LrJA X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= From: Yunhong Jiang Hyper-V VTL clears x86_platform.realmode_{init(), reserve()} in hv_vtl_init_platform() whereas it sets real_mode_header later in hv_vtl_early_init(). There is no need to deal with the settings of real mode memory in two places. Also, both functions are called much earlier than x86_platform.realmode_init() (via an early_initcall), where the real_mode_header is needed. Set real_mode_header in hv_vtl_init_platform() to keep all code dealing with memory for the real mode trampoline in one place. Besides making the code more readable, it prepares it for a subsequent changeset in which the behavior needs to change to support Hyper-V VTL guests in TDX a environment. Reviewed-by: Dexuan Cui Reviewed-by: Michael Kelley Suggested-by: Thomas Gleixner Signed-off-by: Yunhong Jiang Signed-off-by: Ricardo Neri --- Changes in v9: - None Changes in v8: - None Changes in v7: - None Changes in v6: - Corrected reference to hv_vtl_init_platform() in the changelog. (Dexuan) - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - None Changes in v4: - Added Reviewed-by tag from Michael. Thanks! Changes in v3: - Edited the commit message for clarity. Changes in v2: - Introduced this patch. --- arch/x86/hyperv/hv_vtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c index 9b6a9bc4ab76..e045bf3a2c59 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -70,6 +70,7 @@ void __init hv_vtl_init_platform(void) =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; 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; @@ -251,7 +252,6 @@ 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 - real_mode_header =3D &hv_vtl_real_mode_header; apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu= ); =20 return 0; --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 0E05F3750BE; Wed, 4 Mar 2026 23:42:33 +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=1772667754; cv=none; b=iOBSqaaJIy3vFC9vVUpkOEI7vNM6r8105orBxW8ML5pj2jLHVTiV2KbPjOyEm+lY+Nm20FaCd+I7w3ckmqaQCV9jS1xXHCxkdpF3sy4p7ncpyXbd66pvFM3RdkzdzZANIlW4XTY94Ga5rii5q4b7oChRydFHbPHd4LRVZN3UMZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667754; c=relaxed/simple; bh=GN6daPpQzOfVGd6Nv2NhuT5UdbbWKvTexhWrt0VUkRI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pbjHKDsAQ1yM64TP483lsqUO1kmzW8kcGlGxFZoRdxdqsOdq78OuptsU8wPvs0AN7hgLHLi0WoS+07/fzBgawFKE7XyY9eR7/MuyDR35xx4Hb0kdQZ7H/yZT33dN295rAMUsgQIm/ZdgWvJ5+g5+j8xGHFZ2GV5Z8/MpzRR5Sr8= 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=GNNM6kbV; 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="GNNM6kbV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667753; x=1804203753; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=GN6daPpQzOfVGd6Nv2NhuT5UdbbWKvTexhWrt0VUkRI=; b=GNNM6kbVItW3YhUI+7FRfmA666E8kmhtdi4jm/HxIj0r9AVSHgV4DXIH axw/wsX4nBPX9EZfdWuwIk/q0aeoU1Bf8q829Kt4BESbXvAj49mEcPPiP XlTel+oGonXAffDHQw/NiF3rhik6+QOobhgQZPoGVEmN0X3JQmrcOO5t2 QNyU/QYF7He4tzKshYHVX2uuPg9rciMG8mazA9k33XP8lDd8GAHr6JWGu YN8NbDQu/uBJ64/VrSieEuoFJ2epi9aa1EoscbLw+ca7qSGWk1y1bSI/A p5wOig5z+sr12bzCAxsoLv06IUoS44gvwZhfGEEd8XAKXIi3c8tc4KAlU Q==; X-CSE-ConnectionGUID: XdKg2nDzR0WYMoue+i5GJQ== X-CSE-MsgGUID: oUso5Ej1RwmnI/jOPc9mug== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359391" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359391" 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:30 -0800 X-CSE-ConnectionGUID: e2I0jXvjQxm9lPjvTkcAXg== X-CSE-MsgGUID: lZ3PCYpASWKqh7qQUVaAcA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376910" 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:17 -0800 Subject: [PATCH v9 06/10] x86/realmode: Make the location of the trampoline configurable 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-6-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 , Yunhong Jiang , Ricardo Neri , Thomas Gleixner X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=4020; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=mpGPF3jR6AORmhK8ZGU375OgdCDiSrS2mYiIBTZ7o8s=; b=CdqfIDTgrn7FZ78H7swP/gIDIt/LMostWKRS8hxdEcko9yKqjNhwfuvw3/G3emClYG5DGCvgu MlPjmoH7ewNBn9W/xuaCVevSuHLoR/UUK+/NJlV7kkd6T3RWsXvX9UZ X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= From: Yunhong Jiang x86 CPUs boot in real mode. This mode uses a 1MB address space. The trampoline must reside below this 1MB memory boundary. There are platforms in which the firmware boots the secondary CPUs, switches them to long mode and transfers control to the kernel. An example of such a mechanism is the ACPI Multiprocessor Wakeup Structure. In this scenario there is no restriction on locating the trampoline under 1MB memory. Moreover, certain platforms (for example, Hyper-V VTL guests) may not have memory available for allocation below 1MB. Add a new member to struct x86_init_resources to specify the upper bound for the location of the trampoline memory. Preserve the default upper bound of 1MB to conserve the current behavior. Reviewed-by: Dexuan Cui Reviewed-by: Michael Kelley Originally-by: Thomas Gleixner Signed-off-by: Yunhong Jiang 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: - Edited the commit message for clarity. - Minor tweaks to comments. - Removed the option to not reserve the first 1MB of memory as it is not needed. Changes in v2: - Added this patch using code that Thomas suggested: https://lore.kernel.org/lkml/87a5ho2q6x.ffs@tglx/ --- arch/x86/include/asm/x86_init.h | 3 +++ arch/x86/kernel/x86_init.c | 3 +++ arch/x86/realmode/init.c | 7 +++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_ini= t.h index 6c8a6ead84f6..953d3199408a 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h @@ -31,12 +31,15 @@ struct x86_init_mpparse { * platform * @memory_setup: platform specific memory setup * @dmi_setup: platform specific DMI setup + * @realmode_limit: platform specific address limit for the real mode tra= mpoline + * (default 1M) */ struct x86_init_resources { void (*probe_roms)(void); void (*reserve_resources)(void); char *(*memory_setup)(void); void (*dmi_setup)(void); + unsigned long realmode_limit; }; =20 /** diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index ebefb77c37bb..252c5827d063 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c @@ -9,6 +9,7 @@ #include #include #include +#include =20 #include #include @@ -69,6 +70,8 @@ struct x86_init_ops x86_init __initdata =3D { .reserve_resources =3D reserve_standard_io_resources, .memory_setup =3D e820__memory_setup_default, .dmi_setup =3D dmi_setup, + /* Has to be under 1M so we can execute real-mode AP code. */ + .realmode_limit =3D SZ_1M, }, =20 .mpparse =3D { diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index 88be32026768..694d80a5c68e 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -46,7 +46,7 @@ void load_trampoline_pgtable(void) =20 void __init reserve_real_mode(void) { - phys_addr_t mem; + phys_addr_t mem, limit =3D x86_init.resources.realmode_limit; size_t size =3D real_mode_size_needed(); =20 if (!size) @@ -54,10 +54,9 @@ void __init reserve_real_mode(void) =20 WARN_ON(slab_is_available()); =20 - /* Has to be under 1M so we can execute real-mode AP code. */ - mem =3D memblock_phys_alloc_range(size, PAGE_SIZE, 0, 1<<20); + mem =3D memblock_phys_alloc_range(size, PAGE_SIZE, 0, limit); if (!mem) - pr_info("No sub-1M memory is available for the trampoline\n"); + pr_info("No memory below %pa for the real-mode trampoline\n", &limit); else set_real_mode_mem(mem); =20 --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 0E1D73976BB; Wed, 4 Mar 2026 23:42:33 +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=1772667754; cv=none; b=jUSkKQefwlumlG9i/Q9Ys2QD6V5FMIyUClwRan9Jh0OFplOq2QIfgBHHettmOMeaTSQlmBZqEkh39eNv9E0/CqayNSJYN+YqczYd3C4TZDcHnhaHJIIje8TqbH3YeGHiDqz4hiuaRaGJZK4miqI0WBeiRFcN2rUmFZmEK76/WC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667754; c=relaxed/simple; bh=L8Ru1Y1TQTL3fMh3bls020gKDtFIM4GJX2W6RnGN4oA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YzVcubs7a2DaL1zs6IpPhSggdh6j0DoFOvYCnFEMXYjA5TiOb8QCMZf29UJfkl6YNLyXNFhZ/YVNzVLmID79HJ08rQOtIR1eq4kKTimLrGbRF94lfYX9xI2+8GWlS0M07hfJXEpYyCZpTb+6eBT5lBr93dkdXVb5NMP5nhvLpUU= 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=XIJbNVsK; 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="XIJbNVsK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772667753; x=1804203753; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=L8Ru1Y1TQTL3fMh3bls020gKDtFIM4GJX2W6RnGN4oA=; b=XIJbNVsKJ5sqN7Y3Ve0xOZWZAM9+D56WodO3cqvj6yWOOFsU3orXPmbf wvuuOGNbFnirPI/vttRXvi1S4AMMHqerGvLrauKrI8NUgnEIWam4VxijA 41Wi2TjH/Lk0ZUcq7FCbc7n1TFNOl66c+9Q6E3yb1CHXzOSVonT0bpmH+ YOj/AVmrfBqwSf/KoYxvxhMYzOcD3HajhrEsbGrnCdFJBjELYEJGFiIcC 2ij9OqTgqvxyAnaMXIo5dgiZ4sAjH/H7M2co6H0IG5zicn/tWDPjJ1+A4 BldN6N3ZKZ9G81RhWDzrj7zNrG+Dg4CD0rDBdj4IlabZxNtKjs1Xs8dew A==; X-CSE-ConnectionGUID: oBOMegsvRKKurdpgz0JlYg== X-CSE-MsgGUID: uq8zzZIKRRO0Z80ddFkdXA== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359396" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359396" 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:30 -0800 X-CSE-ConnectionGUID: 6xn8DzpJTkeJXjN2O9UDPw== X-CSE-MsgGUID: BhDGoJiYTtm1bJ0ThOlNGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376913" 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:18 -0800 Subject: [PATCH v9 07/10] 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: <20260304-rneri-wakeup-mailbox-v9-7-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 , Yunhong Jiang , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=2745; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=gZ53l7WuF1Dvxd82tcmGZ1N9jujHl1P/hFTFjsVZFn0=; b=s1yOtexGbHwKfPQMvOJrkBmnW+al2MUn7C1xWVdDG+35/vJ1TBIZ9CaDoAYn3jFrxa/oRikSJ Mu7cwdf5u+RBkdioq9WAAcbMPC3XO0PJmUneRoo7zE2d4Ipr2MnMZyw 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 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: - 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 e045bf3a2c59..b94fffa67312 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -68,9 +68,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 From nobody Mon Apr 6 14:57:28 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 40D4739EF3B; 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=1772667755; cv=none; b=NEmQEQohomEwaDs2oNjiBqfPkRn2bYQ+PhxJbKOPUXPY+tTazVdQbfd2qJqwU+qw4OAP2P0PD/3/TsrUoW0Vw3I8vbUDeSW+bC2YdM8YrQPtiP8wahWLu2IkJh9qwPfnHyUns/Q360mn1/kduYFIFjb95shmoyhu0+HqYCRdR8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667755; c=relaxed/simple; bh=t5nYwO5pX4uVzM/aRglX5MIg6SjtwvRmK+6R7EwEGdY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VKmMEIrFXxwDbFnu5extRP2K1pva5DcV22eZqllXe0XE1uzYWHuPaNAMr9F/5V+TkyJrhd486L6HSL5cjvWo3ZLxS3PySunj/FPhAjQk5a/9Bqecm+Dbk9VoLSdm62MrvCZkt+ERjC1AQD7xhYh2XSO6JMe4rmE0qokhK4yJy5c= 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=gfc6NnNB; 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="gfc6NnNB" 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=t5nYwO5pX4uVzM/aRglX5MIg6SjtwvRmK+6R7EwEGdY=; b=gfc6NnNB0URXYFYGp1jxY5nivbOIYhSl6kozNsT7YY0FMO6O1c7xQKGk bu2Ecy9yPet/mmxyrS6Bf2AUBJBoN7Vo58eKV5V8LnepZdvfs5dE82ImS e8bjnJCxHa2PdRfPnb1eNjvd8q86i1qfQ9Vl1P2SxOaWqpyjSmrDcI82k cTmMFV3w0RaLZ/6e/e4OiZ+OSi503vfI3jH/ZI2BLXRuiDL8kiXTqKkn1 utjDy6jQv7IYEbT24MYPlBB4HZyueSKBpgGGJsWO+oHhd+cPAllIWj7U+ ak59uE1kzab+8Zo4YyJtyQQYuw+tRAfjPscAV8HU3riZk67lh1ECM3PcV Q==; X-CSE-ConnectionGUID: IqQbMGXaTVuuwTW1lEk8IQ== X-CSE-MsgGUID: J81eRiySQ++HjI+ZvZYeLA== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359399" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359399" 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:30 -0800 X-CSE-ConnectionGUID: IafsOjuRRW6hlNz2GQ2EXA== X-CSE-MsgGUID: mnrkwTZ4SVu1hi//fyd3qg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376918" 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:19 -0800 Subject: [PATCH v9 08/10] x86/acpi: Add a helper get the address of the wakeup mailbox 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-8-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=2340; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=t5nYwO5pX4uVzM/aRglX5MIg6SjtwvRmK+6R7EwEGdY=; b=5pVLVGPbhpxYRtEKJ6Cs/CU/TZic6fN/6+qFPl0AODwB5tpYIQQWoL9kB8Fgr3rMWpec3ljas K4OHyiZiPUPD6qGRFiM9mo1fiOH9aBMDuHOatV1IAqBBVXQrSkDPHPl X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= A Hyper-V VTL level 2 guest in a TDX environment needs to map the physical page of the ACPI Multiprocessor Wakeup Structure as private (encrypted). It needs to know the physical address of this structure. Add a helper function to retrieve the address. Suggested-by: Michael Kelley Acked-by: Rafael J. Wysocki (Intel) Signed-off-by: Ricardo Neri --- Changes in v9: - None Changes in v8: - Added Acked-by tag from Rafael. Thanks! Changes in v7: - Moved the added function to arch/x86/kernel/acpi/madt_wakeup.c - Dropped Reviewed-by tags from Dexuan and Michael as this patch changed. Changes in v6: - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - None Changes in v4: - Renamed function to acpi_get_mp_wakeup_mailbox_paddr(). - Added Reviewed-by tag from Michael. Thanks! Changes in v3: - Introduced this patch Changes in v2: - N/A --- arch/x86/include/asm/acpi.h | 6 ++++++ arch/x86/kernel/acpi/madt_wakeup.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 820df375df79..c4e6459bd56b 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -184,6 +184,7 @@ void __iomem *x86_acpi_os_ioremap(acpi_physical_address= phys, acpi_size size); =20 void acpi_setup_mp_wakeup_mailbox(u64 addr); struct acpi_madt_multiproc_wakeup_mailbox *acpi_get_mp_wakeup_mailbox(void= ); +u64 acpi_get_mp_wakeup_mailbox_paddr(void); =20 #else /* !CONFIG_ACPI */ =20 @@ -210,6 +211,11 @@ static inline struct acpi_madt_multiproc_wakeup_mailbo= x *acpi_get_mp_wakeup_mail return NULL; } =20 +static inline u64 acpi_get_mp_wakeup_mailbox_paddr(void) +{ + return 0; +} + #endif /* !CONFIG_ACPI */ =20 #define ARCH_HAS_POWER_INIT 1 diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt= _wakeup.c index 82caf44b45e3..48734e4a6e8f 100644 --- a/arch/x86/kernel/acpi/madt_wakeup.c +++ b/arch/x86/kernel/acpi/madt_wakeup.c @@ -258,3 +258,8 @@ struct acpi_madt_multiproc_wakeup_mailbox *acpi_get_mp_= wakeup_mailbox(void) { return acpi_mp_wake_mailbox; } + +u64 acpi_get_mp_wakeup_mailbox_paddr(void) +{ + return acpi_mp_wake_mailbox_paddr; +} --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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 A6EA339FCC6; 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=kll1WwCFxSMTOATS2PnysDPYKDkx5SCDdl1iGW/OjPFaizD/pFXnp4hgDhqR67bWE/9Nai80FxF5iM6RJGQKfEhNWMFDWqHjVOZbYbyHvHJ9q8Z9OVI0EIQT0KfYbfNfFgJhaLbGqBJ7CGGyJYlGwT7SORO7HIDkF508pT2jLyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772667756; c=relaxed/simple; bh=ypGU+Sc9IMTeMy+CkoquJKf6ONAvdn2Y3tywEbk/UAE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HtlObMd0Gv22imu8mkztmSA80wWBKA38N75rJcP0bX574cEmWd2cH1R1ZTjqnkloUKYRcIpvjb78Z/klji75B4b1dEKyPrxiEbHIzvtfhCAM4mpubvp7V+xrpsZFUl3D7nW+f+6ynv+sMBRYyM2ELOHaSxRsXBksDk5cRVdVah0= 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=JqoP30BM; 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="JqoP30BM" 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=ypGU+Sc9IMTeMy+CkoquJKf6ONAvdn2Y3tywEbk/UAE=; b=JqoP30BMAbRIJN04oEfmBtFjVYu2nLHql27/W+VJmRxOcVo2DiLpASzX gV6umhURQ+6Bsp+HM6KAMgsnGDBS1NTDd3IwZnrmjkZLbfG691SCuL10s F6aJEmmC5lQAe7NMScpqVIRiSDpwK7UMCpRqDJuwCnhjkXGRNiq9Y6uLN VWj1wVU3ji4y2OO4dBW98UAhxkwVtGXVM85Fjai3Y9sq90nSClLEk9+GC bQwVrSgqVwreTPUszsU3N5UkgQ82oQLU+knbRC/DgrxJerKy7oTlMN7nb XoEJ5fMWKvzTyEYYBIvFnpVhwPzIoSzRMTvXdIXDnUSZ+ilnOpoGiWHvv Q==; X-CSE-ConnectionGUID: 59doAzelTrmbDydIbr2tMw== X-CSE-MsgGUID: 8+lyaS+MSHS86iQk1RaCHw== X-IronPort-AV: E=McAfee;i="6800,10657,11719"; a="96359401" X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="96359401" 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:30 -0800 X-CSE-ConnectionGUID: dwHfYddrSNGBwzHAyt858w== X-CSE-MsgGUID: A/DFWrCHSjKvdyE6Zh3oTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,324,1763452800"; d="scan'208";a="215376922" 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:20 -0800 Subject: [PATCH v9 09/10] x86/hyperv/vtl: Mark the wakeup mailbox page as private 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-9-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 , Yunhong Jiang , Ricardo Neri X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772667694; l=2907; i=ricardo.neri-calderon@linux.intel.com; s=20250602; h=from:subject:message-id; bh=VnyoIBcxvAxhgqHs1GCVfBflQlo5uE8gnhBmcNxKAEg=; b=knZOuLVG0k9i35fc/VsP1qPjv4qFzbZ855kdi7NQoyFJvDomMRDddLfW6T36fJouBcB9/LWFf Fs/qz5d3QctAYorAvawXk67hKLAss+OLVslMQAfV66X+VLQ6jW1byNW X-Developer-Key: i=ricardo.neri-calderon@linux.intel.com; a=ed25519; pk=NfZw5SyQ2lxVfmNMaMR6KUj3+0OhcwDPyRzFDH9gY2w= From: Yunhong Jiang The current code maps MMIO devices as shared (decrypted) by default in a confidential computing VM. In a TDX environment, secondary CPUs are booted using the Multiprocessor Wakeup Structure defined in the ACPI specification. The virtual firmware and the operating system function in the guest context, without intervention from the VMM. Map the physical memory of the mailbox as private. Use the is_private_mmio() callback. Signed-off-by: Yunhong Jiang Signed-off-by: Ricardo Neri --- Changes in v9: - None Changes in v8: - Included linux/acpi.h to add missing definitions that caused build breaks (kernel test robot) Changes in v7: - Dropped check for !CONFIG_X86_MAILBOX_WAKEUP. The symbol is no longer valid and now we have a stub for !CONFIG_ACPI. - Dropped Reviewed-by tags from Dexuan and Michael as this patch changed. Changes in v6: - Fixed a compile error with !CONFIG_X86_MAILBOX_WAKEUP. - Added Reviewed-by tag from Dexuan. Thanks! Changes in v5: - None Changes in v4: - Updated to use the renamed function acpi_get_mp_wakeup_mailbox_paddr(). - Added Reviewed-by tag from Michael. Thanks! Changes in v3: - Use the new helper function get_mp_wakeup_mailbox_paddr(). - Edited the commit message for clarity. Changes in v2: - Added the helper function within_page() to improve readability - Override the is_private_mmio() callback when detecting a TDX environment. The address of the mailbox is checked in hv_is_private_mmio_tdx(). --- arch/x86/hyperv/hv_vtl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c index b94fffa67312..1e2f5b3ea772 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -6,6 +6,9 @@ * Saurabh Sengar */ =20 +#include + +#include #include #include #include @@ -59,6 +62,18 @@ static void __noreturn hv_vtl_restart(char __maybe_unus= ed *cmd) hv_vtl_emergency_restart(); } =20 +static inline bool within_page(u64 addr, u64 start) +{ + return addr >=3D start && addr < (start + PAGE_SIZE); +} + +static bool hv_vtl_is_private_mmio_tdx(u64 addr) +{ + u64 mb_addr =3D acpi_get_mp_wakeup_mailbox_paddr(); + + return mb_addr && within_page(addr, mb_addr); +} + void __init hv_vtl_init_platform(void) { /* @@ -71,6 +86,8 @@ void __init hv_vtl_init_platform(void) /* There is no paravisor present if we are here. */ if (hv_isolation_type_tdx()) { x86_init.resources.realmode_limit =3D SZ_4G; + x86_platform.hyper.is_private_mmio =3D hv_vtl_is_private_mmio_tdx; + } else { x86_platform.realmode_reserve =3D x86_init_noop; x86_platform.realmode_init =3D x86_init_noop; --=20 2.43.0 From nobody Mon Apr 6 14:57:28 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