[PATCH v6 08/10] x86/smpwakeup: Add a helper get the address of the wakeup mailbox

Ricardo Neri posted 10 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH v6 08/10] x86/smpwakeup: Add a helper get the address of the wakeup mailbox
Posted by Ricardo Neri 3 months, 3 weeks ago
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.

Reviewed-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Suggested-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
Changes since v5:
 - Added Reviewed-by tag from Dexuan. Thanks!

Changes since v4:
 - None

Changes since v3:
 - Renamed function to acpi_get_mp_wakeup_mailbox_paddr().
 - Added Reviewed-by tag from Michael. Thanks!

Changes since v2:
 - Introduced this patch

Changes since v1:
 - N/A
---
 arch/x86/include/asm/smp.h  | 1 +
 arch/x86/kernel/smpwakeup.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 47ac4381a805..71de1963f984 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -151,6 +151,7 @@ static inline struct cpumask *cpu_l2c_shared_mask(int cpu)
 
 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);
 
 #else /* !CONFIG_SMP */
 #define wbinvd_on_cpu(cpu)     wbinvd()
diff --git a/arch/x86/kernel/smpwakeup.c b/arch/x86/kernel/smpwakeup.c
index 5089bcda615d..f730a66b6fc8 100644
--- a/arch/x86/kernel/smpwakeup.c
+++ b/arch/x86/kernel/smpwakeup.c
@@ -81,3 +81,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;
+}

-- 
2.43.0
Re: [PATCH v6 08/10] x86/smpwakeup: Add a helper get the address of the wakeup mailbox
Posted by Wei Liu 3 months, 3 weeks ago
On Thu, Oct 16, 2025 at 07:57:30PM -0700, Ricardo Neri wrote:
> 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.
> 
> Reviewed-by: Dexuan Cui <decui@microsoft.com>
> Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> Suggested-by: Michael Kelley <mhklinux@outlook.com>
> Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>

Can I get an Ack from x86 maintainers?

> ---
> Changes since v5:
>  - Added Reviewed-by tag from Dexuan. Thanks!
> 
> Changes since v4:
>  - None
> 
> Changes since v3:
>  - Renamed function to acpi_get_mp_wakeup_mailbox_paddr().
>  - Added Reviewed-by tag from Michael. Thanks!
> 
> Changes since v2:
>  - Introduced this patch
> 
> Changes since v1:
>  - N/A
> ---
>  arch/x86/include/asm/smp.h  | 1 +
>  arch/x86/kernel/smpwakeup.c | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> index 47ac4381a805..71de1963f984 100644
> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -151,6 +151,7 @@ static inline struct cpumask *cpu_l2c_shared_mask(int cpu)
>  
>  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);
>  
>  #else /* !CONFIG_SMP */
>  #define wbinvd_on_cpu(cpu)     wbinvd()
> diff --git a/arch/x86/kernel/smpwakeup.c b/arch/x86/kernel/smpwakeup.c
> index 5089bcda615d..f730a66b6fc8 100644
> --- a/arch/x86/kernel/smpwakeup.c
> +++ b/arch/x86/kernel/smpwakeup.c
> @@ -81,3 +81,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;
> +}
> 
> -- 
> 2.43.0
>