diff mbox series

[kvmtool,2/4] x86: Add the ISA I/O interrupt assignment entries of mptable

Message ID 20240819010421.13843-1-sidongli1997@gmail.com (mailing list archive)
State New, archived
Headers show
Series [kvmtool,1/4] x86: Set the correct srcbusirq of pci irq mptable | expand

Commit Message

Dongli Si Aug. 19, 2024, 1:04 a.m. UTC
According to Intel MultiProcessor Specification:
"There is one entry for each I/O APIC interrupt input that is connected."

Missing this will cause the guest kernel to report some
warnings or errors when enabling the io apic.

Fixes: 0c7c14a7 ("kvm tools: Add MP tables support")
Signed-off-by: Dongli Si <sidongli1997@gmail.com>
---
 x86/mptable.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/x86/mptable.c b/x86/mptable.c
index f4753bd..82b692e 100644
--- a/x86/mptable.c
+++ b/x86/mptable.c
@@ -171,10 +171,8 @@  int mptable__init(struct kvm *kvm)
 	nentries++;
 
 	/*
-	 * IRQ sources.
-	 * Also note we use PCI irqs here, no for ISA bus yet.
+	 * PCI IRQ sources.
 	 */
-
 	dev_hdr = device__first_dev(DEVICE_BUS_PCI);
 	while (dev_hdr) {
 		unsigned char srcbusirq;
@@ -189,6 +187,23 @@  int mptable__init(struct kvm *kvm)
 		dev_hdr = device__next_dev(dev_hdr);
 	}
 
+	/*
+	 * ISA IRQ sources.
+	 */
+	for (i = 0; i < 16; i++) {
+		if (i == 2)
+			continue;
+
+		mpc_intsrc = last_addr;
+		if (i == 0)
+			mptable_add_irq_src(mpc_intsrc, isabusid, i, ioapicid, 2);
+		else
+			mptable_add_irq_src(mpc_intsrc, isabusid, i, ioapicid, i);
+
+		last_addr = (void *)&mpc_intsrc[1];
+		nentries++;
+	}
+
 	/*
 	 * Local IRQs assignment (LINT0, LINT1)
 	 */