[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 3/3] vfio-pci: rework of EOI
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-ppc] [PATCH 3/3] vfio-pci: rework of EOI |
Date: |
Mon, 23 Jul 2012 15:32:47 +1000 |
Originally VFIO is coded to support IOAPIC only (i.e. x86).
The patch adds XICS (POWERPC interrupt controller) and replaces
ioapic_add_gsi_eoi_notifier with unified macro to have as little
#ifdef TARGET_PPC64 as possible.
Still needs some rework to get rid of #ifdef TARGET_PPC64.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
hw/vfio_pci.c | 24 ++++++++++++++++--------
hw/vfio_pci.h | 1 -
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/hw/vfio_pci.c b/hw/vfio_pci.c
index fd65731..cd68fe0 100644
--- a/hw/vfio_pci.c
+++ b/hw/vfio_pci.c
@@ -21,7 +21,6 @@
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
-#include <sys/io.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
@@ -44,6 +43,15 @@
#include "range.h"
#include "vfio_pci.h"
+#ifndef TARGET_PPC64
+#include <sys/io.h>
+#include "ioapic.h"
+#define vfio_irq_add_eoi_notifier ioapic_add_gsi_eoi_notifier
+#else
+#include "xics.h"
+#define vfio_irq_add_eoi_notifier xics_add_eoi_notifier
+#endif
+
//#define DEBUG_VFIO
#ifdef DEBUG_VFIO
#define DPRINTF(fmt, ...) \
@@ -258,7 +266,7 @@ static void vfio_enable_intx_kvm(VFIODevice *vdev)
irqfd.fd = event_notifier_get_fd(&vdev->intx.interrupt);
qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev);
- ioapic_remove_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ notifier_remove(&vdev->intx.eoi);
vfio_mask_intx(vdev);
vdev->intx.pending = false;
qemu_set_irq(vdev->pdev.irq[vdev->intx.pin], 0);
@@ -294,7 +302,7 @@ static void vfio_enable_intx_kvm(VFIODevice *vdev)
return;
fail:
- ioapic_add_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ vfio_irq_add_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev);
vfio_unmask_intx(vdev);
#endif
@@ -341,7 +349,7 @@ static void vfio_disable_intx_kvm(VFIODevice *vdev)
event_notifier_cleanup(&vdev->intx.unmask);
- ioapic_add_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ vfio_irq_add_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev);
vfio_unmask_intx(vdev);
@@ -366,7 +374,7 @@ static void vfio_update_irq(Notifier *notify, void *data)
vdev->host.func, vdev->intx.irq, irq);
vfio_disable_intx_kvm(vdev);
- ioapic_remove_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ notifier_remove(&vdev->intx.eoi);
vdev->intx.irq = irq;
@@ -375,7 +383,7 @@ static void vfio_update_irq(Notifier *notify, void *data)
return;
}
- ioapic_add_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ vfio_irq_add_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
vfio_enable_intx_kvm(vdev);
/* Re-enable the interrupt in cased we missed an EOI */
@@ -404,7 +412,7 @@ static int vfio_enable_intx(VFIODevice *vdev)
vdev->intx.pin = pin - 1; /* Pin A (1) -> irq[0] */
vdev->intx.irq = pci_get_irq(&vdev->pdev, vdev->intx.pin);
vdev->intx.eoi.notify = vfio_eoi;
- ioapic_add_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ vfio_irq_add_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
vdev->intx.update_irq.notify = vfio_update_irq;
pci_add_irq_update_notifier(&vdev->pdev, &vdev->intx.update_irq);
@@ -441,7 +449,7 @@ static void vfio_disable_intx(VFIODevice *vdev)
vfio_disable_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX);
pci_remove_irq_update_notifier(&vdev->intx.update_irq);
- ioapic_remove_gsi_eoi_notifier(&vdev->intx.eoi, vdev->intx.irq);
+ notifier_remove(&vdev->intx.eoi);
fd = event_notifier_get_fd(&vdev->intx.interrupt);
qemu_set_fd_handler(fd, NULL, NULL, vdev);
diff --git a/hw/vfio_pci.h b/hw/vfio_pci.h
index 00bb3dd..d1a7434 100644
--- a/hw/vfio_pci.h
+++ b/hw/vfio_pci.h
@@ -4,7 +4,6 @@
#include "qemu-common.h"
#include "qemu-queue.h"
#include "pci.h"
-#include "ioapic.h"
#include "event_notifier.h"
typedef struct VFIOPCIHostDevice {
--
1.7.10.4
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, (continued)
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alex Williamson, 2012/07/12
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alexey Kardashevskiy, 2012/07/12
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alex Williamson, 2012/07/12
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alexey Kardashevskiy, 2012/07/12
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alex Williamson, 2012/07/12
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alexey Kardashevskiy, 2012/07/12
- Re: [Qemu-ppc] [PATCH 0/2] RFC: powerpc-vfio: adding support, Alexey Kardashevskiy, 2012/07/15
- [Qemu-ppc] [PATCH 0/3] vfio-pci: reworking end-of-interrupt, Alexey Kardashevskiy, 2012/07/23
- [Qemu-ppc] [PATCH 1/3] xics: added end-of-interrupt (EOI) handlers, Alexey Kardashevskiy, 2012/07/23
- [Qemu-ppc] [PATCH 2/3] ioapic: removed obsolete ioapic_remove_gsi_eoi_notifier, Alexey Kardashevskiy, 2012/07/23
- [Qemu-ppc] [PATCH 3/3] vfio-pci: rework of EOI,
Alexey Kardashevskiy <=
[Qemu-ppc] [PATCH] RFC: vfio-powerpc: added VFIO support (v2), Alexey Kardashevskiy, 2012/07/12
Re: [Qemu-ppc] [PATCH] RFC: vfio-powerpc: added VFIO support (v2), Scott Wood, 2012/07/12
Re: [Qemu-ppc] [PATCH] RFC: vfio-powerpc: added VFIO support (v2), Alex Williamson, 2012/07/12
[Qemu-ppc] [PATCH] RFC: vfio-powerpc: added VFIO support (v3), Alexey Kardashevskiy, 2012/07/13