hv: fix irq leak for MSI IRQ

Current free_irq sequence will release vector first, then use the
released vector to free irq number.It will cause irq leak for MSI IRQ.
At present, there is no one to free the irqs which in irq_static_mappings,
So this patch will only make sure free non-gsi irqs.

Tracked-On: #1359
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Wei Liu 2018-09-28 11:00:37 +08:00 committed by Xie, Nanlin
parent 67ff326e14
commit 965f8d1033

View File

@ -54,20 +54,18 @@ uint32_t alloc_irq_num(uint32_t req_irq)
}
/*
* @pre: irq is not in irq_static_mappings
* free irq num allocated via alloc_irq_num()
*/
void free_irq_num(uint32_t irq)
{
struct irq_desc *desc;
uint64_t rflags;
if (irq >= NR_IRQS) {
return;
}
desc = &irq_desc_array[irq];
if ((irq_is_gsi(irq) == false)
&& (desc->vector <= VECTOR_DYNAMIC_END)) {
if (irq_is_gsi(irq) == false) {
spinlock_irqsave_obtain(&irq_alloc_spinlock, &rflags);
bitmap_test_and_clear_nolock((uint16_t)(irq & 0x3FU),
irq_alloc_bitmap + (irq >> 6U));