Paolo Bonzini <[email protected]> writes: > On 25/09/19 17:04, Sergio Lopez wrote: >> I'm going back to this level of the thread, because after your >> suggestion I took a deeper look at how things work around the PIC, and >> discovered I was completely wrong about my assumptions. >> >> For virtio-mmio devices, given that we don't have the ability to >> configure vectors (as it's done in the PCI case) we're stuck with the >> ones provided by the platform PIC, which in the x86 case is the i8259 >> (at least from Linux's perspective). >> >> So we can get rid of the IOAPIC, but we need to keep the i8259 (we have >> both a userspace and a kernel implementation too, so it should be fine). > > Hmm... I would have thought the vectors are just GSIs, which will be > configured to the IOAPIC if it is present. Maybe something is causing > Linux to ignore the IOAPIC?
Turns out it was a bug in microvm. I was writing 0 to FW_CFG_NB_CPUS
(because I was using x86ms->boot_cpus instead of ms->smp.cpus), which
led to a broken MP table, causing Linux to ignore it and, as a side
effect to disable IOAPIC symmetric I/O mode.
After fixing it we can, indeed, boot without the i8259 \o/ :
/ # dmesg | grep legacy
[ 0.074144] Using NULL legacy PIC
/ # cat /pr[ 12.116930] random: fast init done
/ # cat /proc/interrupts
CPU0 CPU1
4: 0 278 IO-APIC 4-edge ttyS0
12: 48 0 IO-APIC 12-edge virtio0
NMI: 0 0 Non-maskable interrupts
LOC: 124 98 Local timer interrupts
SPU: 0 0 Spurious interrupts
PMI: 0 0 Performance monitoring interrupts
IWI: 0 0 IRQ work interrupts
RTR: 0 0 APIC ICR read retries
RES: 476 535 Rescheduling interrupts
CAL: 0 76 Function call interrupts
TLB: 0 0 TLB shootdowns
HYP: 0 0 Hypervisor callback interrupts
ERR: 0
MIS: 0
PIN: 0 0 Posted-interrupt notification event
NPI: 0 0 Nested posted-interrupt event
PIW: 0 0 Posted-interrupt wakeup event
There's still one problem. If the Guest doesn't have TSC_DEADLINE_TIME,
Linux hangs on APIC timer calibration. I'm looking for a way to work
around this. Worst case scenario, we can check for that feature and add
both PIC and PIT if is missing.
>> As for the PIT, we can omit it if we're running with KVM acceleration,
>> as kvmclock will be used to calculate loops per jiffie and avoid the
>> calibration, leaving it enabled otherwise.
>
> Can you make it an OnOffAuto property, and default to on iff !KVM?
Sure.
Thanks,
Sergio.
signature.asc
Description: PGP signature
