From ec56710c9b800587e17a581b8a1a158913789dba Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 23 Sep 2020 10:18:04 +0200 Subject: [PATCH] devices: ioapic: Mask entries by default When created, the IOAPIC entries should be masked, as it is the guest's responsibility (FW and/or OS) to unmask them if/when necessary. This patch saves a full round of port I/O writes from the guest to the IOAPIC, meant for masking the unmasked entries. Because they're now masked, the entries are not enabled, which means they are not connected from a KVM perspective, saving from unneeded registration/unregistration of the irq fds. Signed-off-by: Sebastien Boeuf --- devices/src/ioapic.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/devices/src/ioapic.rs b/devices/src/ioapic.rs index efdd30da2..25ceb9e43 100644 --- a/devices/src/ioapic.rs +++ b/devices/src/ioapic.rs @@ -201,15 +201,13 @@ impl Ioapic { }) .map_err(Error::CreateInterruptSourceGroup)?; - interrupt_source_group - .enable() - .map_err(Error::EnableInterrupt)?; - + // The IOAPIC is created with entries already masked. The guest will be + // in charge of unmasking them if/when necessary. Ok(Ioapic { id, id_reg: 0, reg_sel: 0, - reg_entries: [0; NUM_IOAPIC_PINS], + reg_entries: [0x10000; NUM_IOAPIC_PINS], used_entries: [false; NUM_IOAPIC_PINS], apic_address, interrupt_source_group,