hv: Use ptirq_lookup_entry_by_sid to lookup virtual source id in IOAPIC irq entries

Reverts 538ba08c: hv:Add vpin to ptdev entry mapping for vpic/vioapic

ACRN uses an array of size  per VM to store ptirq entries against the vIOAPIC pin
and an array of size per VM to store ptirq entries against the vPIC pin.
This is done to speed up "ptirq entry" lookup at runtime for Level triggered
interrupts in API ptirq_intx_ack used on EOI.

This patch switches the lookup API for INTx interrupts to the API,
ptirq_lookup_entry_by_sid

This could add delay to processing EOI for Level triggered interrupts.
Trade-off here is space saved for array/s of size CONFIG_MAX_IOAPIC_LINES with 8 bytes
per data. On a server platform, ACRN needs to emulate multiple vIOAPICs for
SOS VM, same as the number of physical IO-APICs. Thereby ACRN would need around
10 such arrays per VM.

Removes the need of "pic_pin" except for the APIs facing the hypercalls
hcall_set_ptdev_intr_info, hcall_reset_ptdev_intr_info

Tracked-On: #4151
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
This commit is contained in:
Sainath Grandhi
2019-11-10 21:34:59 -08:00
committed by wenlingz
parent c3582dcd04
commit 06b59e0bc1
5 changed files with 46 additions and 73 deletions

View File

@@ -122,7 +122,7 @@ int32_t ptirq_add_intx_remapping(struct acrn_vm *vm, uint32_t virt_pin, uint32_t
* @pre vm != NULL
*
*/
void ptirq_remove_intx_remapping(struct acrn_vm *vm, uint32_t virt_pin, bool pic_pin);
void ptirq_remove_intx_remapping(const struct acrn_vm *vm, uint32_t virt_pin, bool pic_pin);
/**
* @brief Remove interrupt remapping entry/entries for MSI/MSI-x.

View File

@@ -42,7 +42,6 @@
#define VIOAPIC_BASE 0xFEC00000UL
#define VIOAPIC_SIZE 4096UL
#define VIOAPIC_MAX_PIN 256U
#define REDIR_ENTRIES_HW 120U /* SOS align with native ioapic */
#define STATE_BITMAP_SIZE INT_DIV_ROUNDUP(REDIR_ENTRIES_HW, 64U)
@@ -58,7 +57,6 @@ struct acrn_vioapic {
union ioapic_rte rtbl[REDIR_ENTRIES_HW];
/* pin_state status bitmap: 1 - high, 0 - low */
uint64_t pin_state[STATE_BITMAP_SIZE];
struct ptirq_remapping_info *vpin_to_pt_entry[VIOAPIC_MAX_PIN];
};
void vioapic_init(struct acrn_vm *vm);
@@ -104,7 +102,7 @@ void vioapic_set_irqline_nolock(const struct acrn_vm *vm, uint32_t irqline, uint
uint32_t vioapic_pincount(const struct acrn_vm *vm);
void vioapic_process_eoi(struct acrn_vm *vm, uint32_t vector);
void vioapic_get_rte(struct acrn_vm *vm, uint32_t pin, union ioapic_rte *rte);
void vioapic_get_rte(const struct acrn_vm *vm, uint32_t pin, union ioapic_rte *rte);
int32_t vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data);
/**

View File

@@ -134,7 +134,6 @@ struct acrn_vpic {
struct acrn_vm *vm;
spinlock_t lock;
struct i8259_reg_state i8259[2];
struct ptirq_remapping_info *vpin_to_pt_entry[NR_VPIC_PINS_TOTAL];
};
void vpic_init(struct acrn_vm *vm);