mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: pirq: refactor irq num alloc/free
This commit refactors the alloc/free irq num, two functions are defined: - uint32_t alloc_irq_num(uint32_t irq) - if irq is valid, mark the irq_desc as used; if it's IRQ_INVALID, alloc a free irq, or else do nothing; - return: irq num on success, or IRQ_INVALID on failure. - void free_irq_num(uint32_t irq) - free the irq num allocated via alloc_irq_num(); And a global spinlock to protect it from concurrent allocation/free. Signed-off-by: Yan, Like <like.yan@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -361,7 +361,7 @@ void setup_ioapic_irq(void)
|
||||
}
|
||||
|
||||
/* pinned irq before use it */
|
||||
if (irq_mark_used(gsi) >= NR_IRQS) {
|
||||
if (alloc_irq_num(gsi) == IRQ_INVALID) {
|
||||
pr_err("failed to alloc IRQ[%d]", gsi);
|
||||
gsi++;
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user