Message ID | 20190320062046.3895-2-leo.yan@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vfio-pci: Support INTx mode re-enabling | expand |
Hi Leo, Thanks for the patches On 20/03/2019 06:20, Leo Yan wrote: > The PCI device INTx uses event fd 'unmask_fd' to signal the deassertion > of the line from guest to host; but this eventfd isn't released properly > when disable INTx. > > This patch firstly adds field 'unmask_fd' in struct vfio_pci_device for > storing unmask eventfd and close it when disable INTx. > > Signed-off-by: Leo Yan <leo.yan@linaro.org> Reviewed-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> > --- > include/kvm/vfio.h | 1 + > vfio/pci.c | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/include/kvm/vfio.h b/include/kvm/vfio.h > index 60e6c54..28223cf 100644 > --- a/include/kvm/vfio.h > +++ b/include/kvm/vfio.h > @@ -74,6 +74,7 @@ struct vfio_pci_device { > > unsigned long irq_modes; > int intx_fd; > + int unmask_fd; > unsigned int intx_gsi; > struct vfio_pci_msi_common msi; > struct vfio_pci_msi_common msix; > diff --git a/vfio/pci.c b/vfio/pci.c > index 03de3c1..5224fee 100644 > --- a/vfio/pci.c > +++ b/vfio/pci.c > @@ -1008,6 +1008,7 @@ static void vfio_pci_disable_intx(struct kvm *kvm, struct vfio_device *vdev) > irq__del_irqfd(kvm, gsi, pdev->intx_fd); > > close(pdev->intx_fd); > + close(pdev->unmask_fd); > } > > static int vfio_pci_enable_intx(struct kvm *kvm, struct vfio_device *vdev) > @@ -1095,6 +1096,7 @@ static int vfio_pci_enable_intx(struct kvm *kvm, struct vfio_device *vdev) > } > > pdev->intx_fd = trigger_fd; > + pdev->unmask_fd = unmask_fd; > /* Guest is going to ovewrite our irq_line... */ > pdev->intx_gsi = gsi; > >
diff --git a/include/kvm/vfio.h b/include/kvm/vfio.h index 60e6c54..28223cf 100644 --- a/include/kvm/vfio.h +++ b/include/kvm/vfio.h @@ -74,6 +74,7 @@ struct vfio_pci_device { unsigned long irq_modes; int intx_fd; + int unmask_fd; unsigned int intx_gsi; struct vfio_pci_msi_common msi; struct vfio_pci_msi_common msix; diff --git a/vfio/pci.c b/vfio/pci.c index 03de3c1..5224fee 100644 --- a/vfio/pci.c +++ b/vfio/pci.c @@ -1008,6 +1008,7 @@ static void vfio_pci_disable_intx(struct kvm *kvm, struct vfio_device *vdev) irq__del_irqfd(kvm, gsi, pdev->intx_fd); close(pdev->intx_fd); + close(pdev->unmask_fd); } static int vfio_pci_enable_intx(struct kvm *kvm, struct vfio_device *vdev) @@ -1095,6 +1096,7 @@ static int vfio_pci_enable_intx(struct kvm *kvm, struct vfio_device *vdev) } pdev->intx_fd = trigger_fd; + pdev->unmask_fd = unmask_fd; /* Guest is going to ovewrite our irq_line... */ pdev->intx_gsi = gsi;
The PCI device INTx uses event fd 'unmask_fd' to signal the deassertion of the line from guest to host; but this eventfd isn't released properly when disable INTx. This patch firstly adds field 'unmask_fd' in struct vfio_pci_device for storing unmask eventfd and close it when disable INTx. Signed-off-by: Leo Yan <leo.yan@linaro.org> --- include/kvm/vfio.h | 1 + vfio/pci.c | 2 ++ 2 files changed, 3 insertions(+)