* [PATCH] qemu-kvm: Do not advertise MSI caps on lacking KVM support
@ 2011-04-29 11:24 Jan Kiszka
2011-05-03 19:18 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2011-04-29 11:24 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Michael S. Tsirkin
As suggested by Michael Tsirkin: Move the check for GSI routing from
kvm_msi_message_add to the MSI/MSI-X initalization. If it fails (and KVM
is in in-kernel irqchip mode), do not advertise MSI at all.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/msi.c | 4 ++++
hw/msix.c | 4 +++-
qemu-kvm.c | 4 ----
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/hw/msi.c b/hw/msi.c
index 725b2b7..ddcfedd 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -208,6 +208,10 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
" 64bit %d mask %d\n",
offset, nr_vectors, msi64bit, msi_per_vector_mask);
+ if (kvm_enabled() && kvm_irqchip_in_kernel() && !kvm_has_gsi_routing()) {
+ return -ENOTSUP;
+ }
+
assert(!(nr_vectors & (nr_vectors - 1))); /* power of 2 */
assert(nr_vectors > 0);
assert(nr_vectors <= PCI_MSI_VECTORS_MAX);
diff --git a/hw/msix.c b/hw/msix.c
index 9cee086..d371940 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -350,8 +350,10 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
{
int ret;
/* Nothing to do if MSI is not supported by interrupt controller */
- if (!msix_supported)
+ if (!msix_supported ||
+ (kvm_enabled() && kvm_irqchip_in_kernel() && !kvm_has_gsi_routing())) {
return -ENOTSUP;
+ }
if (nentries > MSIX_MAX_ENTRIES)
return -EINVAL;
diff --git a/qemu-kvm.c b/qemu-kvm.c
index e8c2009..b951146 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -986,10 +986,6 @@ int kvm_msi_message_add(KVMMsiMessage *msg)
struct kvm_irq_routing_entry e;
int ret;
- if (!kvm_has_gsi_routing()) {
- return -EOPNOTSUPP;
- }
-
ret = kvm_get_irq_route_gsi();
if (ret < 0) {
return ret;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qemu-kvm: Do not advertise MSI caps on lacking KVM support
2011-04-29 11:24 [PATCH] qemu-kvm: Do not advertise MSI caps on lacking KVM support Jan Kiszka
@ 2011-05-03 19:18 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2011-05-03 19:18 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm, Michael S. Tsirkin
On Fri, Apr 29, 2011 at 01:24:49PM +0200, Jan Kiszka wrote:
> As suggested by Michael Tsirkin: Move the check for GSI routing from
> kvm_msi_message_add to the MSI/MSI-X initalization. If it fails (and KVM
> is in in-kernel irqchip mode), do not advertise MSI at all.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-03 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29 11:24 [PATCH] qemu-kvm: Do not advertise MSI caps on lacking KVM support Jan Kiszka
2011-05-03 19:18 ` Marcelo Tosatti
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).