From: Amos Kong <akong@redhat.com>
To: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com,
kvm@vger.kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org,
avi@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] return available ioeventfds count in kvm_has_many_ioeventfds()
Date: Tue, 13 Mar 2012 18:42:32 +0800 [thread overview]
Message-ID: <20120313104232.8741.89133.stgit@dhcp-8-167.nay.redhat.com> (raw)
In-Reply-To: <20120313103602.8741.71939.stgit@dhcp-8-167.nay.redhat.com>
Older kernels have a 6 device limit on the KVM io bus.
This patch makes kvm_has_many_ioeventfds() return available
ioeventfd count. ioeventfd will be disabled if there is
no 7 available ioeventfds.
Signed-off-by: Amos Kong <akong@redhat.com>
---
hw/virtio-pci.c | 2 +-
kvm-all.c | 9 +++------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index a0fb7c1..d63f303 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -678,7 +678,7 @@ void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev)
pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO,
&proxy->bar);
- if (!kvm_has_many_ioeventfds()) {
+ if (kvm_has_many_ioeventfds() != 7) {
proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;
}
diff --git a/kvm-all.c b/kvm-all.c
index 3c6b4f0..d12694b 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -78,7 +78,6 @@ struct KVMState
int pit_in_kernel;
int pit_state2;
int xsave, xcrs;
- int many_ioeventfds;
int irqchip_inject_ioctl;
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing *irq_routes;
@@ -510,8 +509,8 @@ static int kvm_check_many_ioeventfds(void)
}
}
- /* Decide whether many devices are supported or not */
- ret = i == ARRAY_SIZE(ioeventfds);
+ /* If i equals to 7, many devices are supported */
+ ret = i;
while (i-- > 0) {
kvm_set_ioeventfd_pio_word(ioeventfds[i], 0, i, false);
@@ -1078,8 +1077,6 @@ int kvm_init(void)
kvm_state = s;
memory_listener_register(&kvm_memory_listener, NULL);
- s->many_ioeventfds = kvm_check_many_ioeventfds();
-
cpu_interrupt_handler = kvm_handle_interrupt;
return 0;
@@ -1407,7 +1404,7 @@ int kvm_has_many_ioeventfds(void)
if (!kvm_enabled()) {
return 0;
}
- return kvm_state->many_ioeventfds;
+ return kvm_check_many_ioeventfds();
}
int kvm_has_gsi_routing(void)
next prev parent reply other threads:[~2012-03-13 10:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 10:42 [Qemu-devel] [PATCH 0/2] virtio-pci: fix abort when fail to allocate ioeventfd Amos Kong
2012-03-13 10:42 ` Amos Kong [this message]
2012-03-13 11:50 ` [Qemu-devel] [PATCH 1/2] return available ioeventfds count in kvm_has_many_ioeventfds() Jan Kiszka
2012-03-13 12:00 ` Amos Kong
2012-03-13 12:24 ` Jan Kiszka
2012-03-13 13:05 ` Amos Kong
2012-03-13 10:42 ` [Qemu-devel] [PATCH 2/2] virtio-pci: fallback to userspace when there is no enough available ioeventfd Amos Kong
2012-03-13 11:23 ` [Qemu-devel] [PATCH 0/2] virtio-pci: fix abort when fail to allocate ioeventfd Stefan Hajnoczi
2012-03-13 11:51 ` Amos Kong
2012-03-13 14:30 ` Stefan Hajnoczi
2012-03-13 14:47 ` Amos Kong
2012-03-13 16:36 ` Stefan Hajnoczi
2012-03-14 0:30 ` Amos Kong
2012-03-14 8:57 ` Stefan Hajnoczi
2012-03-14 9:22 ` Avi Kivity
2012-03-14 9:59 ` Stefan Hajnoczi
2012-03-14 10:05 ` Avi Kivity
2012-03-14 10:39 ` Stefan Hajnoczi
2012-03-14 10:46 ` Avi Kivity
2012-03-14 11:46 ` Stefan Hajnoczi
2012-03-16 8:59 ` Amos Kong
2012-03-19 8:21 ` Stefan Hajnoczi
2012-03-19 10:11 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2012-03-13 10:35 [Qemu-devel] [PATCH 1/2] return available ioeventfds count in kvm_has_many_ioeventfds() Amos Kong
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=20120313104232.8741.89133.stgit@dhcp-8-167.nay.redhat.com \
--to=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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 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).