Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1649919
| From | Eric Auger <eric.auger@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 04/10] VFIO: pci: Add automasked field to vfio_pci_irq_ctx |
| Date | 2017-05-24 22:20 +0200 |
| Message-ID | <tKKVc-6Ww-31@gated-at.bofh.it> (permalink) |
| References | <tKKVb-6Ww-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
For direct EOI modality we will need to differentiate a userspace
masking from the IRQ handler auto-masking.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
drivers/vfio/pci/vfio_pci_intrs.c | 15 +++++++++------
drivers/vfio/pci/vfio_pci_private.h | 1 +
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index 1c46045..d4d377b 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -52,7 +52,7 @@ void vfio_pci_intx_mask(struct vfio_pci_device *vdev)
if (unlikely(!is_intx(vdev))) {
if (vdev->pci_2_3)
pci_intx(pdev, 0);
- } else if (!vdev->ctx[0].masked) {
+ } else if (!vdev->ctx[0].masked && !vdev->ctx[0].automasked) {
/*
* Can't use check_and_mask here because we always want to
* mask, not just when something is pending.
@@ -90,7 +90,8 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *unused)
if (unlikely(!is_intx(vdev))) {
if (vdev->pci_2_3)
pci_intx(pdev, 1);
- } else if (vdev->ctx[0].masked && !vdev->virq_disabled) {
+ } else if ((vdev->ctx[0].masked || vdev->ctx[0].automasked) &&
+ !vdev->virq_disabled) {
/*
* A pending interrupt here would immediately trigger,
* but we can avoid that overhead by just re-sending
@@ -103,6 +104,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *unused)
enable_irq(pdev->irq);
vdev->ctx[0].masked = (ret > 0);
+ vdev->ctx[0].automasked = (ret > 0);
}
spin_unlock_irqrestore(&vdev->irqlock, flags);
@@ -126,11 +128,12 @@ static irqreturn_t vfio_intx_handler(int irq, void *dev_id)
if (!vdev->pci_2_3) {
disable_irq_nosync(vdev->pdev->irq);
- vdev->ctx[0].masked = true;
+ vdev->ctx[0].automasked = true;
ret = IRQ_HANDLED;
- } else if (!vdev->ctx[0].masked && /* may be shared */
- pci_check_and_mask_intx(vdev->pdev)) {
- vdev->ctx[0].masked = true;
+ } else if (!vdev->ctx[0].masked && !vdev->ctx[0].automasked &&
+ pci_check_and_mask_intx(vdev->pdev)) {
+ /* shared INTx */
+ vdev->ctx[0].automasked = true;
ret = IRQ_HANDLED;
}
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index f561ac1..f7f1101 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -35,6 +35,7 @@ struct vfio_pci_irq_ctx {
struct virqfd *mask;
char *name;
bool masked;
+ bool automasked;
struct irq_bypass_producer producer;
};
--
2.5.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/10] ARM/ARM64 Direct EOI setup for VFIO wired interrupts Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
[PATCH 02/10] VFIO: platform: Introduce direct EOI interrupt handler Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
Re: [PATCH 02/10] VFIO: platform: Introduce direct EOI interrupt handler Alex Williamson <alex.williamson@redhat.com> - 2017-05-31 20:30 +0200
[PATCH 06/10] irqbypass: Add a private field in the producer Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
[PATCH 01/10] vfio: platform: Add automasked field to vfio_platform_irq Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
Re: [PATCH 01/10] vfio: platform: Add automasked field to vfio_platform_irq Marc Zyngier <marc.zyngier@arm.com> - 2017-05-25 20:10 +0200
Re: [PATCH 01/10] vfio: platform: Add automasked field to vfio_platform_irq Auger Eric <eric.auger@redhat.com> - 2017-05-30 14:50 +0200
Re: [PATCH 01/10] vfio: platform: Add automasked field to vfio_platform_irq Alex Williamson <alex.williamson@redhat.com> - 2017-05-31 19:50 +0200
[PATCH 07/10] VFIO: pci: Direct EOI irq bypass for ARM/ARM64 Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
[PATCH 04/10] VFIO: pci: Add automasked field to vfio_pci_irq_ctx Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
Re: [PATCH 04/10] VFIO: pci: Add automasked field to vfio_pci_irq_ctx Alex Williamson <alex.williamson@redhat.com> - 2017-05-31 20:30 +0200
[PATCH 10/10] KVM: arm/arm64: register DEOI irq bypass consumer on ARM/ARM64 Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
[PATCH 08/10] KVM: arm/arm64: vgic: Handle unshared mapped interrupts Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
Re: [PATCH 08/10] KVM: arm/arm64: vgic: Handle unshared mapped interrupts Marc Zyngier <marc.zyngier@arm.com> - 2017-05-25 21:20 +0200
Re: [PATCH 08/10] KVM: arm/arm64: vgic: Handle unshared mapped interrupts Auger Eric <eric.auger@redhat.com> - 2017-05-30 15:00 +0200
Re: [PATCH 08/10] KVM: arm/arm64: vgic: Handle unshared mapped interrupts Christoffer Dall <cdall@linaro.org> - 2017-06-02 15:40 +0200
Re: [PATCH 08/10] KVM: arm/arm64: vgic: Handle unshared mapped interrupts Marc Zyngier <marc.zyngier@arm.com> - 2017-06-02 16:20 +0200
Re: [PATCH 08/10] KVM: arm/arm64: vgic: Handle unshared mapped interrupts Christoffer Dall <cdall@linaro.org> - 2017-06-02 18:40 +0200
[PATCH 03/10] VFIO: platform: Direct EOI irq bypass for ARM/ARM64 Eric Auger <eric.auger@redhat.com> - 2017-05-24 22:20 +0200
Re: [PATCH 03/10] VFIO: platform: Direct EOI irq bypass for ARM/ARM64 Alex Williamson <alex.williamson@redhat.com> - 2017-05-31 20:30 +0200
Re: [PATCH 03/10] VFIO: platform: Direct EOI irq bypass for ARM/ARM64 Auger Eric <eric.auger@redhat.com> - 2017-05-31 21:40 +0200
Re: [PATCH 03/10] VFIO: platform: Direct EOI irq bypass for ARM/ARM64 Marc Zyngier <marc.zyngier@arm.com> - 2017-06-01 12:50 +0200
csiph-web