Skip to contentSkip to conversation

x86/hyperv: Allow 15-bit APIC IDs for VTL platforms

PATCH Superseded Saurabh Sengar 2 participants 3 messages Jan 5, 2024 – Jan 14, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hyperv: Allow 15-bit APIC IDs for VTL platforms

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 now deemed safe, as no architectural MSIs are employed at higher VTLs.

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

---
 arch/x86/hyperv/hv_vtl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/hyperv/hv_vtl.c +7 -0
index 539c7b5cfa2b..1c225362f88e 100644
@@ -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");
@@ -39,6 +44,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)
Signature · 1 line
2.25.1
#1 lore raw

From: Saurabh Sengar <[email protected]> Sent: Friday, January 5, 2024 2:29 AM

Quoted 9 lines

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 now deemed safe, as no architectural MSIs are employed at higher VTLs.

I'm trying to fully understand this last sentence. It has the words "now" and "deemed" as qualifiers. Can you say anything more about why "now" (implying it wasn't safe at some point in the past)? And what are the implications of "deemed"? Or are both just wordiness, and it would be just as good to say "This assumption is safe, as Hyper-V does not employ any architectural MSIs at higher VTLs." ?

The code LGTM.

Michael

Quoted 36 lines

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

---
 arch/x86/hyperv/hv_vtl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/hyperv/hv_vtl.c +7 -1
index 539c7b5cfa2b..1c225362f88e 100644
@@ -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");
@@ -39,6 +44,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)
--

2.25.1

#2 lore raw
Quoted 11 lines · Michael Kelley

From: Saurabh Sengar <[email protected]> Sent: Friday, January 5, 2024 2:29 AM

Quoted 9 lines

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 now deemed safe, as no architectural MSIs are employed at higher VTLs.

Quoted 8 lines

I'm trying to fully understand this last sentence. It has the words "now" and "deemed" as qualifiers. Can you say anything more about why "now" (implying it wasn't safe at some point in the past)? And what are the implications of "deemed"? Or are both just wordiness, and it would be just as good to say "This assumption is safe, as Hyper-V does not employ any architectural MSIs at higher VTLs." ?

The code LGTM.

Thank you for your review. Your phrasing appears better to me. I will revise the commit message as per your suggestions and submit V2.

- Saurabh

Quoted 40 lines

Michael

Quoted 36 lines

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

---
 arch/x86/hyperv/hv_vtl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/hyperv/hv_vtl.c +7 -1
index 539c7b5cfa2b..1c225362f88e 100644
@@ -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");
@@ -39,6 +44,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)
--

2.25.1