From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>,
Alex Williamson <alex.williamson@redhat.com>,
Wen Congyang <wency@cn.fujitsu.com>,
Markus Armbruster <armbru@redhat.com>
Subject: [PATCH] pci-assign: Fall back to host-side MSI if INTx sharing fails
Date: Mon, 19 Mar 2012 10:56:06 +0100 [thread overview]
Message-ID: <4F6702B6.4030003@siemens.com> (raw)
If the host or the device does not support INTx sharing, retry the IRQ
assignment with host-side MSI support enabled but warn about potential
consequences. This allows to preserve the previous behavior where we
defaulted to MSI and did not support INTx sharing at all.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Detecting if the user actually specified prefer_msi=off as property of
pci-assign is non-trivial. So I decided to go for the retry approach,
ignoring potential user requests. The warning should attract the
attention.
hw/device-assignment.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 89823f1..c953713 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -835,6 +835,7 @@ static int assign_irq(AssignedDevice *dev)
dev->irq_requested_type = 0;
}
+retry:
assigned_irq_data.flags = KVM_DEV_IRQ_GUEST_INTX;
if (dev->features & ASSIGNED_DEVICE_PREFER_MSI_MASK &&
dev->cap.available & ASSIGNED_DEVICE_CAP_MSI)
@@ -844,6 +845,17 @@ static int assign_irq(AssignedDevice *dev)
r = kvm_assign_irq(kvm_state, &assigned_irq_data);
if (r < 0) {
+ if (r == -EIO && !(dev->features & ASSIGNED_DEVICE_PREFER_MSI_MASK) &&
+ dev->cap.available & ASSIGNED_DEVICE_CAP_MSI) {
+ /* Retry with host-side MSI. There might be an IRQ conflict and
+ * either the kernel or the device doesn't support sharing. */
+ fprintf(stderr,
+ "Host-side INTx sharing not supported, "
+ "using MSI instead.\n"
+ "Some devices do not to work properly in this mode.\n");
+ dev->features |= ASSIGNED_DEVICE_PREFER_MSI_MASK;
+ goto retry;
+ }
fprintf(stderr, "Failed to assign irq for \"%s\": %s\n",
dev->dev.qdev.id, strerror(-r));
fprintf(stderr, "Perhaps you are assigning a device "
--
1.7.3.4
next reply other threads:[~2012-03-19 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 9:56 Jan Kiszka [this message]
2012-03-19 15:52 ` [PATCH] pci-assign: Fall back to host-side MSI if INTx sharing fails Alex Williamson
2012-03-21 13:13 ` Avi Kivity
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=4F6702B6.4030003@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=wency@cn.fujitsu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.