HV: handle adding ptdev entry failure cases

handle adding pass-through device entry failure cases,
instead of calling ASSERT, to avoid hypervisor crash.

Tracked-On: #1860
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Minggui Cao
2018-11-20 16:14:19 +08:00
committed by lijinxia
parent fe08a44e83
commit e350abe40d
3 changed files with 38 additions and 52 deletions

View File

@@ -160,19 +160,21 @@ static void ptdev_interrupt_handler(__unused uint32_t irq, void *data)
}
/* active intr with irq registering */
void
ptdev_activate_entry(struct ptdev_remapping_info *entry, uint32_t phys_irq)
int32_t ptdev_activate_entry(struct ptdev_remapping_info *entry, uint32_t phys_irq)
{
int32_t retval;
/* register and allocate host vector/irq */
retval = request_irq(phys_irq, ptdev_interrupt_handler,
(void *)entry, IRQF_PT);
retval = request_irq(phys_irq, ptdev_interrupt_handler, (void *)entry, IRQF_PT);
ASSERT(retval >= 0, "dev register failed");
entry->allocated_pirq = (uint32_t)retval;
if (retval < 0) {
pr_err("request irq failed, please check!, phys-irq=%d", phys_irq);
} else {
entry->allocated_pirq = (uint32_t)retval;
atomic_set32(&entry->active, ACTIVE_FLAG);
}
atomic_set32(&entry->active, ACTIVE_FLAG);
return retval;
}
void