mirror of https://github.com/xemu-project/xemu.git
hw/vfio/pci: generalize mask/unmask to any IRQ index
To prepare for platform device introduction, rename vfio_mask_intx and vfio_unmask_intx into vfio_mask_single_irqindex and respectively unmask_single_irqindex. Also use a nex index parameter. With that name and prototype the function will be usable for other indexes than VFIO_PCI_INTX_IRQ_INDEX. Signed-off-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
9ee27d7381
commit
079eb19cbb
|
@ -293,12 +293,12 @@ static void vfio_disable_irqindex(VFIOPCIDevice *vdev, int index)
|
||||||
/*
|
/*
|
||||||
* INTx
|
* INTx
|
||||||
*/
|
*/
|
||||||
static void vfio_unmask_intx(VFIOPCIDevice *vdev)
|
static void vfio_unmask_single_irqindex(VFIOPCIDevice *vdev, int index)
|
||||||
{
|
{
|
||||||
struct vfio_irq_set irq_set = {
|
struct vfio_irq_set irq_set = {
|
||||||
.argsz = sizeof(irq_set),
|
.argsz = sizeof(irq_set),
|
||||||
.flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_UNMASK,
|
.flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_UNMASK,
|
||||||
.index = VFIO_PCI_INTX_IRQ_INDEX,
|
.index = index,
|
||||||
.start = 0,
|
.start = 0,
|
||||||
.count = 1,
|
.count = 1,
|
||||||
};
|
};
|
||||||
|
@ -307,12 +307,12 @@ static void vfio_unmask_intx(VFIOPCIDevice *vdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KVM /* Unused outside of CONFIG_KVM code */
|
#ifdef CONFIG_KVM /* Unused outside of CONFIG_KVM code */
|
||||||
static void vfio_mask_intx(VFIOPCIDevice *vdev)
|
static void vfio_mask_single_irqindex(VFIOPCIDevice *vdev, int index)
|
||||||
{
|
{
|
||||||
struct vfio_irq_set irq_set = {
|
struct vfio_irq_set irq_set = {
|
||||||
.argsz = sizeof(irq_set),
|
.argsz = sizeof(irq_set),
|
||||||
.flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_MASK,
|
.flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_MASK,
|
||||||
.index = VFIO_PCI_INTX_IRQ_INDEX,
|
.index = index,
|
||||||
.start = 0,
|
.start = 0,
|
||||||
.count = 1,
|
.count = 1,
|
||||||
};
|
};
|
||||||
|
@ -381,7 +381,7 @@ static void vfio_eoi(VFIOPCIDevice *vdev)
|
||||||
|
|
||||||
vdev->intx.pending = false;
|
vdev->intx.pending = false;
|
||||||
pci_irq_deassert(&vdev->pdev);
|
pci_irq_deassert(&vdev->pdev);
|
||||||
vfio_unmask_intx(vdev);
|
vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
|
static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
|
||||||
|
@ -404,7 +404,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
|
||||||
|
|
||||||
/* Get to a known interrupt state */
|
/* Get to a known interrupt state */
|
||||||
qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev);
|
qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev);
|
||||||
vfio_mask_intx(vdev);
|
vfio_mask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||||
vdev->intx.pending = false;
|
vdev->intx.pending = false;
|
||||||
pci_irq_deassert(&vdev->pdev);
|
pci_irq_deassert(&vdev->pdev);
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Let'em rip */
|
/* Let'em rip */
|
||||||
vfio_unmask_intx(vdev);
|
vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||||
|
|
||||||
vdev->intx.kvm_accel = true;
|
vdev->intx.kvm_accel = true;
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ fail_irqfd:
|
||||||
event_notifier_cleanup(&vdev->intx.unmask);
|
event_notifier_cleanup(&vdev->intx.unmask);
|
||||||
fail:
|
fail:
|
||||||
qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev);
|
qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev);
|
||||||
vfio_unmask_intx(vdev);
|
vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev)
|
||||||
* Get to a known state, hardware masked, QEMU ready to accept new
|
* Get to a known state, hardware masked, QEMU ready to accept new
|
||||||
* interrupts, QEMU IRQ de-asserted.
|
* interrupts, QEMU IRQ de-asserted.
|
||||||
*/
|
*/
|
||||||
vfio_mask_intx(vdev);
|
vfio_mask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||||
vdev->intx.pending = false;
|
vdev->intx.pending = false;
|
||||||
pci_irq_deassert(&vdev->pdev);
|
pci_irq_deassert(&vdev->pdev);
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev)
|
||||||
vdev->intx.kvm_accel = false;
|
vdev->intx.kvm_accel = false;
|
||||||
|
|
||||||
/* If we've missed an event, let it re-fire through QEMU */
|
/* If we've missed an event, let it re-fire through QEMU */
|
||||||
vfio_unmask_intx(vdev);
|
vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
|
||||||
|
|
||||||
trace_vfio_disable_intx_kvm(vdev->host.domain, vdev->host.bus,
|
trace_vfio_disable_intx_kvm(vdev->host.domain, vdev->host.bus,
|
||||||
vdev->host.slot, vdev->host.function);
|
vdev->host.slot, vdev->host.function);
|
||||||
|
|
Loading…
Reference in New Issue