From: Alex Williamson <alex.williamson@redhat.com>
To: aliguori@amazon.com
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] [PULL 4/5] vfio-pci: Add debug config options to disable MSI/X KVM support
Date: Fri, 06 Dec 2013 13:48:42 -0700 [thread overview]
Message-ID: <20131206204842.16731.29998.stgit@bling.home> (raw)
In-Reply-To: <20131206204715.16731.12627.stgit@bling.home>
It's sometimes useful to be able to verify interrupts are passing
through correctly.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/misc/vfio.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 09bdddf..f367537 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -52,6 +52,8 @@
/* Extra debugging, trap acceleration paths for more logging */
#define VFIO_ALLOW_MMAP 1
#define VFIO_ALLOW_KVM_INTX 1
+#define VFIO_ALLOW_KVM_MSI 1
+#define VFIO_ALLOW_KVM_MSIX 1
struct VFIODevice;
@@ -590,9 +592,21 @@ static void vfio_msi_interrupt(void *opaque)
return;
}
- DPRINTF("%s(%04x:%02x:%02x.%x) vector %d\n", __func__,
+#ifdef VFIO_DEBUG
+ MSIMessage msg;
+
+ if (vdev->interrupt == VFIO_INT_MSIX) {
+ msg = msi_get_message(&vdev->pdev, nr);
+ } else if (vdev->interrupt == VFIO_INT_MSI) {
+ msg = msix_get_message(&vdev->pdev, nr);
+ } else {
+ abort();
+ }
+
+ DPRINTF("%s(%04x:%02x:%02x.%x) vector %d 0x%"PRIx64"/0x%x\n", __func__,
vdev->host.domain, vdev->host.bus, vdev->host.slot,
- vdev->host.function, nr);
+ vdev->host.function, nr, msg.address, msg.data);
+#endif
if (vdev->interrupt == VFIO_INT_MSIX) {
msix_notify(&vdev->pdev, nr);
@@ -660,7 +674,8 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
* Attempt to enable route through KVM irqchip,
* default to userspace handling if unavailable.
*/
- vector->virq = msg ? kvm_irqchip_add_msi_route(kvm_state, *msg) : -1;
+ vector->virq = msg && VFIO_ALLOW_KVM_MSIX ?
+ kvm_irqchip_add_msi_route(kvm_state, *msg) : -1;
if (vector->virq < 0 ||
kvm_irqchip_add_irqfd_notifier(kvm_state, &vector->interrupt,
NULL, vector->virq) < 0) {
@@ -827,7 +842,8 @@ retry:
* Attempt to enable route through KVM irqchip,
* default to userspace handling if unavailable.
*/
- vector->virq = kvm_irqchip_add_msi_route(kvm_state, vector->msg);
+ vector->virq = VFIO_ALLOW_KVM_MSI ?
+ kvm_irqchip_add_msi_route(kvm_state, vector->msg) : -1;
if (vector->virq < 0 ||
kvm_irqchip_add_irqfd_notifier(kvm_state, &vector->interrupt,
NULL, vector->virq) < 0) {
next prev parent reply other threads:[~2013-12-06 20:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 20:48 [Qemu-devel] [PULL 0/5] vfio-pci updates for QEMU 2.0 Alex Williamson
2013-12-06 20:48 ` [Qemu-devel] [PULL 1/5] linux-headers: Update from v3.13-rc3 Alex Williamson
2013-12-11 11:09 ` Greg Kurz
2013-12-11 13:15 ` [Qemu-devel] [PATCH] target-ppc: add stubs for KVM breakpoints Greg Kurz
2013-12-11 13:20 ` Alexander Graf
2013-12-11 14:44 ` [Qemu-devel] [PULL 1/5] linux-headers: Update from v3.13-rc3 Alex Williamson
2013-12-11 14:49 ` Alexander Graf
2013-12-06 20:48 ` [Qemu-devel] [PULL 2/5] vfio-pci: Make use of new KVM-VFIO device Alex Williamson
2013-12-06 20:48 ` [Qemu-devel] [PULL 3/5] vfio-pci: Fix Nvidia MSI ACK through 0x88000 quirk Alex Williamson
2013-12-06 20:48 ` Alex Williamson [this message]
2013-12-06 22:06 ` [Qemu-devel] [PULL 4/5] vfio-pci: Add debug config options to disable MSI/X KVM support Paolo Bonzini
2013-12-06 22:36 ` Alex Williamson
2013-12-09 9:48 ` Paolo Bonzini
2013-12-06 20:48 ` [Qemu-devel] [PULL 5/5] vfio-pci: Release all MSI-X vectors when disabled Alex Williamson
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=20131206204842.16731.29998.stgit@bling.home \
--to=alex.williamson@redhat.com \
--cc=aliguori@amazon.com \
--cc=kvm@vger.kernel.org \
--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).