17 Apr, 2013
2 commits
-
We already know the trigger mode of a given interrupt when programming
the ioapice entry. So it's not necessary to set it in each interrupt
delivery.Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
Both TMR and EOI exit bitmap need to be updated when ioapic changed
or vcpu's id/ldr/dfr changed. So use common function instead eoi exit
bitmap specific function.Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti
16 Apr, 2013
5 commits
-
Userspace may deliver RTC interrupt without query the status. So we
want to track RTC EOI for this case.Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
restore rtc_status from migration or save/restore
Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
Add a new parameter to know vcpus who received the interrupt.
Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
rtc_status is used to track RTC interrupt delivery status. The pending_eoi
will be increased by vcpu who received RTC interrupt and will be decreased
when EOI to this interrupt.
Also, we use dest_map to record the destination vcpu to avoid the case that
vcpu who didn't get the RTC interupt, but issued EOI with same vector of RTC
and descreased pending_eoi by mistake.Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
Add vcpu info to ioapic_update_eoi, so we can know which vcpu
issued this EOI.Signed-off-by: Yang Zhang
Reviewed-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti
29 Jan, 2013
1 commit
-
Virtual interrupt delivery avoids KVM to inject vAPIC interrupts
manually, which is fully taken care of by the hardware. This needs
some special awareness into existing interrupr injection path:- for pending interrupt, instead of direct injection, we may need
update architecture specific indicators before resuming to guest.- A pending interrupt, which is masked by ISR, should be also
considered in above update action, since hardware will decide
when to inject it at right time. Current has_interrupt and
get_interrupt only returns a valid vector from injection p.o.v.Reviewed-by: Marcelo Tosatti
Signed-off-by: Kevin Tian
Signed-off-by: Yang Zhang
Signed-off-by: Gleb Natapov
21 Jul, 2012
1 commit
-
When more than 1 source id is in use for the same GSI, we have the
following race related to handling irq_states race:CPU 0 clears bit 0. CPU 0 read irq_state as 0. CPU 1 sets level to 1.
CPU 1 calls kvm_ioapic_set_irq(1). CPU 0 calls kvm_ioapic_set_irq(0).
Now ioapic thinks the level is 0 but irq_state is not 0.Fix by performing all irq_states bitmap handling under pic/ioapic lock.
This also removes the need for atomics with irq_states handling.Reported-by: Gleb Natapov
Signed-off-by: Michael S. Tsirkin
Signed-off-by: Marcelo Tosatti
17 Apr, 2012
1 commit
-
Intel spec says that TMR needs to be set/cleared
when IRR is set, but kvm also clears it on EOI.I did some tests on a real (AMD based) system,
and I see same TMR values both before
and after EOI, so I think it's a minor bug in kvm.This patch fixes TMR to be set/cleared on IRR set
only as per spec.And now that we don't clear TMR, we can save
an atomic read of TMR on EOI that's not propagated
to ioapic, by checking whether ioapic needs
a specific vector first and calculating
the mode afterwards.Signed-off-by: Michael S. Tsirkin
Signed-off-by: Marcelo Tosatti
13 May, 2010
1 commit
-
kvm_set_irq is used from non sleepable contexes, so convert ioapic from
mutex to spinlock.KVM-Stable-Tag.
Tested-by: Ralf Bonenkamp
Signed-off-by: Marcelo Tosatti
01 Mar, 2010
2 commits
-
If we fail to init ioapic device or the fail to setup the default irq
routing, the device register by kvm_create_pic() and kvm_ioapic_init()
remain unregister. This patch fixed to do this.Signed-off-by: Wei Yongjun
Signed-off-by: Avi Kivity -
When the guest acknowledges an interrupt, it sends an EOI message to the local
apic, which broadcasts it to the ioapic. To handle the EOI, we need to take
the ioapic mutex.On large guests, this causes a lot of contention on this mutex. Since large
guests usually don't route interrupts via the ioapic (they use msi instead),
this is completely unnecessary.Avoid taking the mutex by introducing a handled_vectors bitmap. Before taking
the mutex, check if the ioapic was actually responsible for the acked vector.
If not, we can return early.Signed-off-by: Avi Kivity
Signed-off-by: Marcelo Tosatti
03 Dec, 2009
2 commits
-
The allows removal of irq_lock from the injection path.
Signed-off-by: Gleb Natapov
Signed-off-by: Avi Kivity -
This removes assumptions that max GSIs is smaller than number of pins.
Sharing is tracked on pin level not GSI level.[avi: no PIC on ia64]
Signed-off-by: Gleb Natapov
Signed-off-by: Avi Kivity
10 Jun, 2009
8 commits
-
Deliver interrupt during destination matching loop.
Signed-off-by: Gleb Natapov
Acked-by: Xiantao Zhang
Signed-off-by: Marcelo Tosatti -
The new way does not require additional loop over vcpus to calculate
the one with lowest priority as one is chosen during delivery bitmap
construction.Signed-off-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
Use kvm_apic_match_dest() in kvm_get_intr_delivery_bitmask() instead
of duplicating the same code. Use kvm_get_intr_delivery_bitmask() in
apic_send_ipi() to figure out ipi destination instead of reimplementing
the logic.Signed-off-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
ioapic_deliver() and kvm_set_msi() have code duplication. Move
the code into ioapic_deliver_entry() function and call it from
both places.Signed-off-by: Gleb Natapov
Signed-off-by: Marcelo Tosatti -
Gleb fixed bitmap ops usage in kvm_ioapic_get_delivery_bitmask.
Sheng merged two functions, as well as fixed several issues in
kvm_get_intr_delivery_bitmask
1. deliver_bitmask is a bitmap rather than a unsigned long intereger.
2. Lowest priority target bitmap wrong calculated by mistake.
3. Prevent potential NULL reference.
4. Declaration in include/kvm_host.h caused powerpc compilation warning.
5. Add warning for guest broadcast interrupt with lowest priority delivery mode.
6. Removed duplicate bitmap clean up in caller of kvm_get_intr_delivery_bitmask.Signed-off-by: Gleb Natapov
Signed-off-by: Sheng Yang
Signed-off-by: Marcelo Tosatti -
Would be used with bit ops, and would be easily extended if KVM_MAX_VCPUS is
increased.Signed-off-by: Sheng Yang
Signed-off-by: Avi Kivity -
In order to use with bit ops.
Signed-off-by: Sheng Yang
Signed-off-by: Avi Kivity -
Prepared for reuse ioapic_redir_entry for MSI.
Signed-off-by: Sheng Yang
Signed-off-by: Avi Kivity
24 Mar, 2009
1 commit
-
IRQ injection status is either -1 (if there was no CPU found
that should except the interrupt because IRQ was masked or
ioapic was misconfigured or ...) or >= 0 in that case the
number indicates to how many CPUs interrupt was injected.
If the value is 0 it means that the interrupt was coalesced
and probably should be reinjected.Signed-off-by: Gleb Natapov
Signed-off-by: Avi Kivity
31 Dec, 2008
1 commit
-
It would be used for MSI in device assignment, for MSI dispatch.
Signed-off-by: Sheng Yang
Signed-off-by: Avi Kivity
15 Oct, 2008
2 commits
-
Moving irqchip_in_kernel() from ioapic.h to irq.h.
Signed-off-by: Xiantao Zhang
Signed-off-by: Avi Kivity -
Based on a patch from: Ben-Ami Yassour
which was based on a patch from: Amit ShahNotify IRQ acking on PIC/APIC emulation. The previous patch missed two things:
- Edge triggered interrupts on IOAPIC
- PIC reset with IRR/ISR set should be equivalent to ack (LAPIC probably
needs something similar).Signed-off-by: Marcelo Tosatti
CC: Amit Shah
CC: Ben-Ami Yassour
Signed-off-by: Avi Kivity
31 Jan, 2008
1 commit
-
Move ioapic code to common, since IA64 also needs it.
Signed-off-by: Zhang Xiantao
Signed-off-by: Avi Kivity