From: Feng Wu Subject: [RFC v1 1/5] vfio: Register/unregister irq_bypass_producer Date: Fri, 10 Jul 2015 11:00:03 +0800 Message-ID: <1436497207-4786-2-git-send-email-feng.wu@intel.com> References: <1436497207-4786-1-git-send-email-feng.wu@intel.com> Cc: alex.williamson@redhat.com, pbonzini@redhat.com, joro@8bytes.org, avi.kivity@gmail.com, eric.auger@linaro.org, feng.wu@intel.com To: kvm@vger.kernel.org Return-path: Received: from mga11.intel.com ([192.55.52.93]:20870 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbbGJDLC (ORCPT ); Thu, 9 Jul 2015 23:11:02 -0400 In-Reply-To: <1436497207-4786-1-git-send-email-feng.wu@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: This patch adds the registration/unregistration of an irq_bypass_producer for MSI/MSIx on vfio pci devices. Signed-off-by: Feng Wu --- drivers/vfio/pci/vfio_pci_intrs.c | 8 ++++++-- drivers/vfio/pci/vfio_pci_private.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 4e053be..6e86292 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -322,7 +322,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, if (vdev->ctx[vector].trigger) { free_irq(irq, vdev->ctx[vector].trigger); - /* irq_bypass_unregister_producer(); */ + irq_bypass_unregister_producer(&vdev->ctx[vector].producer); kfree(vdev->ctx[vector].name); eventfd_ctx_put(vdev->ctx[vector].trigger); vdev->ctx[vector].trigger = NULL; @@ -364,7 +364,11 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, return ret; } - /* irq_bypass_register_producer(); */ + INIT_LIST_HEAD(&vdev->ctx[vector].producer.node); + vdev->ctx[vector].producer.token = trigger; + vdev->ctx[vector].producer.irq = irq; + ret = irq_bypass_register_producer(&vdev->ctx[vector].producer); + WARN_ON(ret); vdev->ctx[vector].trigger = trigger; diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h index ae0e1b4..0e7394f 100644 --- a/drivers/vfio/pci/vfio_pci_private.h +++ b/drivers/vfio/pci/vfio_pci_private.h @@ -13,6 +13,7 @@ #include #include +#include #ifndef VFIO_PCI_PRIVATE_H #define VFIO_PCI_PRIVATE_H @@ -29,6 +30,7 @@ struct vfio_pci_irq_ctx { struct virqfd *mask; char *name; bool masked; + struct irq_bypass_producer producer; }; struct vfio_pci_device { -- 2.1.0