mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 17:58:30 +00:00
vioapic: add pin_state bitmap to set irq
a guest may use per-cpu vector allocation mechanism which may lead to same vector on different vcpu for different vioapic pins. when we broadcast EOI from vlapic to vioapic, it could trigger ptdev_intx_ack for incorrect vioapic pin which will lead to incorrect vioapic irq deassert. old implementation is recording assert & deassert by acnt, like: - assert -> acnt++ - deassert -> acnt-- which means an incorrect deassert may descrease acnt from 0 to -1, it leads to error. this patch change the recording method for a pin assert/deassert, it just use pin_state bit set/clear to indicate line state: - high -> pin_state bitmap set - low -> pin_state bitmap clear and the irq assert will be triggered based on polarity setting during line state changing. it can avoid the failure of incorrect deassert on old implementation, and for ptdev sharing irq, the dev hardware could re-trigger interrupt after deassert. but for emulated device, there is no mechanism to re-trigger interrupt if there is irq sharing - for DM, we already has constraint to restrict vGSI sharing, so there is no problem of it. Tracked-On: #1269 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
committed by
Xie, Nanlin
parent
ba68bd4190
commit
3b88d3c2ac
@@ -37,6 +37,7 @@
|
||||
#define VIOAPIC_SIZE 4096UL
|
||||
|
||||
#define REDIR_ENTRIES_HW 120U /* SOS align with native ioapic */
|
||||
#define STATE_BITMAP_SIZE INT_DIV_ROUNDUP(REDIR_ENTRIES_HW, 64U)
|
||||
|
||||
struct acrn_vioapic {
|
||||
struct vm *vm;
|
||||
@@ -44,8 +45,8 @@ struct acrn_vioapic {
|
||||
uint32_t id;
|
||||
uint32_t ioregsel;
|
||||
union ioapic_rte rtbl[REDIR_ENTRIES_HW];
|
||||
/* sum of pin asserts (+1) and deasserts (-1) */
|
||||
int32_t acnt[REDIR_ENTRIES_HW];
|
||||
/* pin_state status bitmap: 1 - high, 0 - low */
|
||||
uint64_t pin_state[STATE_BITMAP_SIZE];
|
||||
};
|
||||
|
||||
void vioapic_init(struct vm *vm);
|
||||
@@ -53,6 +54,7 @@ void vioapic_cleanup(struct acrn_vioapic *vioapic);
|
||||
void vioapic_reset(struct acrn_vioapic *vioapic);
|
||||
|
||||
void vioapic_set_irq(struct vm *vm, uint32_t irq, uint32_t operation);
|
||||
void vioapic_set_irq_nolock(struct vm *vm, uint32_t irq, uint32_t operation);
|
||||
void vioapic_update_tmr(struct vcpu *vcpu);
|
||||
|
||||
uint32_t vioapic_pincount(struct vm *vm);
|
||||
|
Reference in New Issue
Block a user