From: frank.blaschka@de.ibm.com
To: qemu-devel@nongnu.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org
Cc: alex.williamson@redhat.com, pbonzini@redhat.com, agraf@suse.de
Subject: [RFC patch 6/6] vfio: make vfio run on s390 platform
Date: Fri, 19 Sep 2014 13:54:35 +0200 [thread overview]
Message-ID: <20140919115940.596533004@de.ibm.com> (raw)
In-Reply-To: 20140919115429.557279920@de.ibm.com
[-- Attachment #1: 104-qemu_vfio.patch --]
[-- Type: text/plain, Size: 2688 bytes --]
From: Frank Blaschka <frank.blaschka@de.ibm.com>
Following changes are made because of platform differences:
1) s390 does not support mmap'ing of PCI BARs so we have to go via slow path
2) no intx support
3) no classic MSIX interrupts. The pci hw understands the concept
of requesting MSIX irqs but irqs are delivered as s390 adapter irqs.
Introduce s390 specific functions for msix notification (slow path) and
msi routes (kvm fast path).
4) Use type1 iommu but register only for iommu address space
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
---
hw/misc/vfio.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -40,6 +40,9 @@
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
#include "hw/misc/vfio.h"
+#ifdef TARGET_S390X
+#include "hw/s390x/s390-pci-bus.h"
+#endif
/* #define DEBUG_VFIO */
#ifdef DEBUG_VFIO
@@ -51,7 +54,11 @@
#endif
/* Extra debugging, trap acceleration paths for more logging */
+#ifdef TARGET_S390X
+#define VFIO_ALLOW_MMAP 0
+#else
#define VFIO_ALLOW_MMAP 1
+#endif
#define VFIO_ALLOW_KVM_INTX 1
#define VFIO_ALLOW_KVM_MSI 1
#define VFIO_ALLOW_KVM_MSIX 1
@@ -554,6 +561,10 @@ static int vfio_enable_intx(VFIODevice *
struct vfio_irq_set *irq_set;
int32_t *pfd;
+#ifdef TARGET_S390X
+ return 0;
+#endif
+
if (!pin) {
return 0;
}
@@ -664,7 +675,11 @@ static void vfio_msi_interrupt(void *opa
#endif
if (vdev->interrupt == VFIO_INT_MSIX) {
+#ifdef TARGET_S390X
+ s390_msix_notify(&vdev->pdev, nr);
+#else
msix_notify(&vdev->pdev, nr);
+#endif
} else if (vdev->interrupt == VFIO_INT_MSI) {
msi_notify(&vdev->pdev, nr);
} else {
@@ -730,7 +745,11 @@ static void vfio_add_kvm_msi_virq(VFIOMS
return;
}
+#ifdef TARGET_S390X
+ virq = s390_irqchip_add_msi_route(&vector->vdev->pdev, kvm_state, *msg);
+#else
virq = kvm_irqchip_add_msi_route(kvm_state, *msg);
+#endif
if (virq < 0) {
event_notifier_cleanup(&vector->kvm_interrupt);
return;
@@ -3702,8 +3721,13 @@ static int vfio_connect_container(VFIOGr
container->iommu_data.type1.listener = vfio_memory_listener;
container->iommu_data.release = vfio_listener_release;
+#ifdef TARGET_S390X
+ memory_listener_register(&container->iommu_data.type1.listener,
+ container->space->as);
+#else
memory_listener_register(&container->iommu_data.type1.listener,
&address_space_memory);
+#endif
if (container->iommu_data.type1.error) {
ret = container->iommu_data.type1.error;
next prev parent reply other threads:[~2014-09-19 11:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-19 11:54 [RFC patch 0/6] vfio based pci pass-through for qemu/KVM on s390 frank.blaschka
2014-09-19 11:54 ` [RFC patch 1/6] KVM: s390: Enable PCI instructions frank.blaschka
2014-09-19 11:54 ` [RFC patch 2/6] iommu: add iommu for s390 platform frank.blaschka
2014-09-19 11:54 ` [RFC patch 3/6] vfio: make vfio build on s390 frank.blaschka
2014-09-19 11:54 ` [RFC patch 4/6] s390: Add PCI bus support frank.blaschka
2014-09-19 11:54 ` [RFC patch 5/6] s390: implement pci instruction frank.blaschka
2014-09-19 15:12 ` Thomas Huth
2014-09-22 7:40 ` [Qemu-devel] " Frank Blaschka
2014-09-19 11:54 ` frank.blaschka [this message]
2014-09-22 20:47 ` [RFC patch 0/6] vfio based pci pass-through for qemu/KVM on s390 Alex Williamson
2014-09-22 22:08 ` Alexander Graf
2014-09-22 22:28 ` Alex Williamson
2014-09-23 8:33 ` Alexander Graf
2014-09-24 8:47 ` [Qemu-devel] " Frank Blaschka
2014-09-24 16:05 ` Alex Williamson
2014-09-26 6:45 ` Frank Blaschka
2014-09-26 19:59 ` Alex Williamson
2014-10-01 9:11 ` Frank Blaschka
2014-10-01 17:26 ` Alex Williamson
2014-10-02 7:21 ` Frank Blaschka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140919115940.596533004@de.ibm.com \
--to=frank.blaschka@de.ibm.com \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).