linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/hyperv: Allow 15-bit APIC IDs for VTL platforms
@ 2024-01-15 17:57 Saurabh Sengar
  2024-01-16 15:25 ` Michael Kelley
  0 siblings, 1 reply; 3+ messages in thread
From: Saurabh Sengar @ 2024-01-15 17:57 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, tglx, mingo, bp, dave.hansen, x86,
	hpa, linux-hyperv, linux-kernel
  Cc: ssengar

The current method for signaling the compatibility of a Hyper-V host
with MSIs featuring 15-bit APIC IDs relies on a synthetic cpuid leaf.
However, for higher VTLs, this leaf is not reported, due to the absence
of an IO-APIC.

As an alternative, assume that when running at a high VTL, the host
supports 15-bit APIC IDs. This assumption is safe, as Hyper-V does not
employ any architectural MSIs at higher VTLs

This unblocks startup of VTL2 environments with more than 256 CPUs.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
[V2]
 - Modify commit message

 arch/x86/hyperv/hv_vtl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c
index 96e6c51..cf1b78c 100644
--- a/arch/x86/hyperv/hv_vtl.c
+++ b/arch/x86/hyperv/hv_vtl.c
@@ -16,6 +16,11 @@
 extern struct boot_params boot_params;
 static struct real_mode_header hv_vtl_real_mode_header;
 
+static bool __init hv_vtl_msi_ext_dest_id(void)
+{
+	return true;
+}
+
 void __init hv_vtl_init_platform(void)
 {
 	pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
@@ -38,6 +43,8 @@ void __init hv_vtl_init_platform(void)
 	x86_platform.legacy.warm_reset = 0;
 	x86_platform.legacy.reserve_bios_regions = 0;
 	x86_platform.legacy.devices.pnpbios = 0;
+
+	x86_init.hyper.msi_ext_dest_id = hv_vtl_msi_ext_dest_id;
 }
 
 static inline u64 hv_vtl_system_desc_base(struct ldttss_desc *desc)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] x86/hyperv: Allow 15-bit APIC IDs for VTL platforms
  2024-01-15 17:57 [PATCH v2] x86/hyperv: Allow 15-bit APIC IDs for VTL platforms Saurabh Sengar
@ 2024-01-16 15:25 ` Michael Kelley
  2024-03-01  9:26   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kelley @ 2024-01-16 15:25 UTC (permalink / raw)
  To: Saurabh Sengar, kys@microsoft.com, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org
  Cc: ssengar@microsoft.com

From: Saurabh Sengar <ssengar@linux.microsoft.com> Sent: Monday, January 15, 2024 9:58 AM
> 
> The current method for signaling the compatibility of a Hyper-V host
> with MSIs featuring 15-bit APIC IDs relies on a synthetic cpuid leaf.
> However, for higher VTLs, this leaf is not reported, due to the absence
> of an IO-APIC.
> 
> As an alternative, assume that when running at a high VTL, the host
> supports 15-bit APIC IDs. This assumption is safe, as Hyper-V does not
> employ any architectural MSIs at higher VTLs
> 
> This unblocks startup of VTL2 environments with more than 256 CPUs.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
> [V2]
>  - Modify commit message
> 
>  arch/x86/hyperv/hv_vtl.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c
> index 96e6c51..cf1b78c 100644
> --- a/arch/x86/hyperv/hv_vtl.c
> +++ b/arch/x86/hyperv/hv_vtl.c
> @@ -16,6 +16,11 @@
>  extern struct boot_params boot_params;
>  static struct real_mode_header hv_vtl_real_mode_header;
> 
> +static bool __init hv_vtl_msi_ext_dest_id(void)
> +{
> +	return true;
> +}
> +
>  void __init hv_vtl_init_platform(void)
>  {
>  	pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
> @@ -38,6 +43,8 @@ void __init hv_vtl_init_platform(void)
>  	x86_platform.legacy.warm_reset = 0;
>  	x86_platform.legacy.reserve_bios_regions = 0;
>  	x86_platform.legacy.devices.pnpbios = 0;
> +
> +	x86_init.hyper.msi_ext_dest_id = hv_vtl_msi_ext_dest_id;
>  }
> 
>  static inline u64 hv_vtl_system_desc_base(struct ldttss_desc *desc)
> --
> 1.8.3.1
> 

Reviewed-by: Michael Kelley <mhklinux@outlook.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] x86/hyperv: Allow 15-bit APIC IDs for VTL platforms
  2024-01-16 15:25 ` Michael Kelley
@ 2024-03-01  9:26   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2024-03-01  9:26 UTC (permalink / raw)
  To: Michael Kelley
  Cc: Saurabh Sengar, kys@microsoft.com, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, ssengar@microsoft.com

On Tue, Jan 16, 2024 at 03:25:47PM +0000, Michael Kelley wrote:
> From: Saurabh Sengar <ssengar@linux.microsoft.com> Sent: Monday, January 15, 2024 9:58 AM
> > 
> > The current method for signaling the compatibility of a Hyper-V host
> > with MSIs featuring 15-bit APIC IDs relies on a synthetic cpuid leaf.
> > However, for higher VTLs, this leaf is not reported, due to the absence
> > of an IO-APIC.
> > 
> > As an alternative, assume that when running at a high VTL, the host
> > supports 15-bit APIC IDs. This assumption is safe, as Hyper-V does not
> > employ any architectural MSIs at higher VTLs
> > 
> > This unblocks startup of VTL2 environments with more than 256 CPUs.
> > 
> > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
[...]
> 
> Reviewed-by: Michael Kelley <mhklinux@outlook.com>

Applied. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-01  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15 17:57 [PATCH v2] x86/hyperv: Allow 15-bit APIC IDs for VTL platforms Saurabh Sengar
2024-01-16 15:25 ` Michael Kelley
2024-03-01  9:26   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).