Skip to content

Commit 9f0c09e

Browse files
committed
hv: mshv_vtl: Handle unmapping of redirected interrupts
User space requests the tear down of a redirected interrupt using the APIC ID and the CPU interrupt vector number associated with it. Traverse the list of redirected interrupt and release the resources of the IRQ being teared down. Signed-off-by: Ricardo Neri <[email protected]> --- Changes since v2: * Introduced this patch. Changes since v1: * N/A
1 parent de2841b commit 9f0c09e

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

drivers/hv/mshv_vtl_main.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,24 @@ static int mshv_vtl_map_redirected_intr(u32 proxy_vector, u32 apic_id)
17591759

17601760
static int mshv_vtl_unmap_redirected_intr(u32 hw_vector, u32 apic_id)
17611761
{
1762-
return -ENODEV;
1762+
struct redirected_intr *rintr;
1763+
1764+
if (hw_vector > 255)
1765+
return -EINVAL;
1766+
1767+
guard(mutex)(&redirected_intr_lock);
1768+
list_for_each_entry(rintr, &redirected_intr_list, list) {
1769+
unsigned int vector = irq_cfg(rintr->irq)->vector;
1770+
1771+
if (vector == hw_vector && rintr->apic_id == apic_id) {
1772+
free_irq(rintr->irq, rintr);
1773+
list_del(&rintr->list);
1774+
kfree(rintr);
1775+
return 0;
1776+
}
1777+
}
1778+
1779+
return -ENOENT;
17631780
}
17641781

17651782
static long mshv_vtl_ioctl_setup_redirected_intr(void __user *user_arg)

0 commit comments

Comments
 (0)