Missing ISA IRQ entries will cause the guest kernel to report some warnings or errors, for examples: 1, If none of the pci devices are registered, the guest kernel will report: [ 0.022503] BIOS bug, no explicit IRQ entries, using default mptable. (tell your hw vendor) 2, If the guest kernel cmdline does not have the "noapic" parameter and one or more pci devices are registered, the guest kernel will report: [ 0.033913] BUG: kernel NULL pointer dereference, address: 0000000000000004 [ 0.034313] #PF: supervisor read access in kernel mode [ 0.034614] #PF: error_code(0x0000) - not-present page [ 0.034911] PGD 0 P4D 0 [ 0.035062] Oops: Oops: 0000 [#1] SMP [ 0.035277] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.10.0 #95 [ 0.035628] RIP: 0010:setup_IO_APIC+0x23e/0x7e0 [ 0.035892] Code: ff e8 16 f6 ff ff 89 45 88 e8 5e f6 ff ff 83 3d e3 93 e1 ff 00 8b 1d d9 23 f1 ff 89 85 78 ff ff ff 44 8b 25 d0 23 f1 ff 78 1b <41> 8b 76 04 8b 4d 88 41 89 d9 45 89 e0 89 c2 48 c7 c7 70 fe 8e 81 [ 0.036965] RSP: 0000:ffffffff81a03e20 EFLAGS: 00010002 [ 0.037267] RAX: 00000000ffffffff RBX: 00000000ffffffff RCX: 0000000000000001 [ 0.037681] RDX: 0000000000000001 RSI: 0000000000000001 RDI: 0000000000000000 [ 0.038092] RBP: ffffffff81a03eb0 R08: 0000000000052da5 R09: 0000000000000000 [ 0.038503] R10: ffffffff81a920c0 R11: 0000000000000000 R12: 00000000ffffffff [ 0.038918] R13: ffff88800205f628 R14: 0000000000000000 R15: 0000000000000005 [ 0.039329] FS: 0000000000000000(0000) GS:ffff88807dc00000(0000) knlGS:0000000000000000 [ 0.039798] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.040130] CR2: 0000000000000004 CR3: 0000000001a13000 CR4: 00000000000000b0 [ 0.040542] Call Trace: [ 0.040692] <TASK> [ 0.040818] ? show_regs.part.0+0x1d/0x20 [ 0.041053] ? __die+0x52/0x91 [ 0.041234] ? page_fault_oops+0x56/0x1b0 [ 0.041469] ? exc_page_fault+0x3d9/0x5f0 [ 0.041707] ? asm_exc_page_fault+0x27/0x30 [ 0.041952] ? setup_IO_APIC+0x23e/0x7e0 [ 0.042181] ? clear_IO_APIC_pin+0x127/0x1f0 [ 0.042430] ? clear_IO_APIC+0x34/0x60 [ 0.042656] apic_intr_mode_init+0xb5/0xc0 [ 0.042896] x86_late_time_init+0x16/0x30 [ 0.043131] start_kernel+0x546/0x5b0 [ 0.043345] x86_64_start_reservations+0x29/0x30 [ 0.043619] x86_64_start_kernel+0x78/0x80 [ 0.043858] common_startup_64+0x13b/0x148 [ 0.044097] </TASK> This is because there is no ISA IRQ 0 entry in the mptable which is required by the PIT. In addition, interrupts for the 8250 serial device will also be unavailable because there is also no ISA IRQ 4 entry in mptable. Solve the above problem by adding all standard ISA IRQ entries. Fixes: 0c7c14a7 ("kvm tools: Add MP tables support") Signed-off-by: Dongli Si <sidongli1997@xxxxxxxxx> --- x86/mptable.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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) */ -- 2.44.0