Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663AbdFOMzj (ORCPT ); Thu, 15 Jun 2017 08:55:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54264 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbdFOMzg (ORCPT ); Thu, 15 Jun 2017 08:55:36 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C608BC04B92D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eric.auger@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C608BC04B92D From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, pbonzini@redhat.com, marc.zyngier@arm.com, christoffer.dall@linaro.org Cc: drjones@redhat.com, wei@redhat.com Subject: [PATCH v2 7/8] virt: irqbypass: Add a type field to the irqbypass producer Date: Thu, 15 Jun 2017 14:52:39 +0200 Message-Id: <1497531160-29162-8-git-send-email-eric.auger@redhat.com> In-Reply-To: <1497531160-29162-1-git-send-email-eric.auger@redhat.com> References: <1497531160-29162-1-git-send-email-eric.auger@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 15 Jun 2017 12:55:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2938 Lines: 75 On ARM, we are about to introduce a vfio-platform producer. The associated architecture specific consumer only is compatible with this producer and does not work with the dummy vfio-pci msi producer. Adding a type to the producer allows to easily discriminate between producers instead of complexifying things by analyzing the interrupt type. Signed-off-by: Eric Auger --- v2: new --- drivers/vfio/pci/vfio_pci_intrs.c | 1 + drivers/vfio/platform/vfio_platform_irq_bypass.c | 1 + include/linux/irqbypass.h | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 1c46045..40a6b21 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -343,6 +343,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, vdev->ctx[vector].producer.token = trigger; vdev->ctx[vector].producer.irq = irq; + vdev->ctx[vector].producer.type = IRQ_BYPASS_VFIO_PCI_MSI; ret = irq_bypass_register_producer(&vdev->ctx[vector].producer); if (unlikely(ret)) dev_info(&pdev->dev, diff --git a/drivers/vfio/platform/vfio_platform_irq_bypass.c b/drivers/vfio/platform/vfio_platform_irq_bypass.c index 692b081..603b4b3 100644 --- a/drivers/vfio/platform/vfio_platform_irq_bypass.c +++ b/drivers/vfio/platform/vfio_platform_irq_bypass.c @@ -102,6 +102,7 @@ void vfio_platform_register_deoi_producer(struct vfio_platform_device *vdev, prod->token = trigger; prod->irq = host_irq; + prod->type = IRQ_BYPASS_VFIO_PLATFORM; prod->add_consumer = irq_bypass_deoi_add_consumer; prod->del_consumer = irq_bypass_deoi_del_consumer; prod->stop = irq_bypass_deoi_stop; diff --git a/include/linux/irqbypass.h b/include/linux/irqbypass.h index f0f5d26..331c19a 100644 --- a/include/linux/irqbypass.h +++ b/include/linux/irqbypass.h @@ -31,11 +31,17 @@ struct irq_bypass_consumer; * are not supported. */ +enum irq_bypass_producer_type { + IRQ_BYPASS_VFIO_PCI_MSI, + IRQ_BYPASS_VFIO_PLATFORM, +}; + /** * struct irq_bypass_producer - IRQ bypass producer definition * @node: IRQ bypass manager private list management * @token: opaque token to match between producer and consumer (non-NULL) * @irq: Linux IRQ number for the producer device + * @type: type of the producer to easily assess interoperability with consumer * @add_consumer: Connect the IRQ producer to an IRQ consumer (optional) * @del_consumer: Disconnect the IRQ producer from an IRQ consumer (optional) * @stop: Perform any quiesce operations necessary prior to add/del (optional) @@ -49,6 +55,7 @@ struct irq_bypass_producer { struct list_head node; void *token; int irq; + enum irq_bypass_producer_type type; int (*add_consumer)(struct irq_bypass_producer *, struct irq_bypass_consumer *); void (*del_consumer)(struct irq_bypass_producer *, -- 2.5.5