hv: vioapic: expose ioapic to guest unconditionally

Some OSes assume the platform must have the IOAPIC. For example:
Linux Kernel allocates IRQ force from GSI (0 if there's no PIC and IOAPIC) on x86.
And it thinks IRQ 0 is an architecture special IRQ, not for device driver. As a
result, the device driver may goes wrong if the allocated IRQ is 0 for RTVM.

This patch expose vIOAPIC to RTVM with LAPIC passthru even though the RTVM can't
use IOAPIC, it servers as a place holder to fullfil the guest assumption.

After vIOAPIC has exposed to guest unconditionally, the 'ready' field could be
removed since we do vIOAPIC initialization for each guest.

Tracked-On: #4691
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Li Fei1
2020-04-21 10:18:10 +08:00
committed by wenlingz
parent f2479f6489
commit 80c7da8f1c
4 changed files with 19 additions and 24 deletions

View File

@@ -272,17 +272,17 @@ basl_fwrite_madt(FILE *fp, struct vmctx *ctx)
EFPRINTF(fp, "\n");
}
if (!is_rtvm) {
/* Always a single IOAPIC entry, with ID 0 */
EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n");
EFPRINTF(fp, "[0001]\t\tLength : 0C\n");
/* iasl expects a hex value for the i/o apic id */
EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0);
EFPRINTF(fp, "[0001]\t\tReserved : 00\n");
EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n");
EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n");
EFPRINTF(fp, "\n");
/* Always a single IOAPIC entry, with ID 0 */
EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n");
EFPRINTF(fp, "[0001]\t\tLength : 0C\n");
/* iasl expects a hex value for the i/o apic id */
EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0);
EFPRINTF(fp, "[0001]\t\tReserved : 00\n");
EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n");
EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n");
EFPRINTF(fp, "\n");
if (!is_rtvm) {
/* Legacy IRQ0 is connected to pin 2 of the IOAPIC */
EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n");
EFPRINTF(fp, "[0001]\t\tLength : 0A\n");