* [PATCH] qemu-kvm: Limit MSI vector walk to actual array size
@ 2011-04-29 11:24 Jan Kiszka
2011-05-03 19:19 ` 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
We only need to walk as many vectors on updates as the device supports.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/msi.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/msi.c b/hw/msi.c
index ddcfedd..92773e5 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -134,13 +134,15 @@ static void kvm_msi_message_from_vector(PCIDevice *dev, unsigned vector,
static void kvm_msi_update(PCIDevice *dev)
{
uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));
+ unsigned int max_vectors = 1 <<
+ ((flags & PCI_MSI_FLAGS_QMASK) >> (ffs(PCI_MSI_FLAGS_QMASK) - 1));
unsigned int nr_vectors = msi_nr_vectors(flags);
KVMMsiMessage new_entry, *entry;
bool changed = false;
unsigned int vector;
int r;
- for (vector = 0; vector < 32; vector++) {
+ for (vector = 0; vector < max_vectors; vector++) {
entry = dev->msi_irq_entries + vector;
if (vector >= nr_vectors) {
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qemu-kvm: Limit MSI vector walk to actual array size
2011-04-29 11:24 [PATCH] qemu-kvm: Limit MSI vector walk to actual array size Jan Kiszka
@ 2011-05-03 19:19 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2011-05-03 19:19 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm, Michael S. Tsirkin
On Fri, Apr 29, 2011 at 01:24:59PM +0200, Jan Kiszka wrote:
> We only need to walk as many vectors on updates as the device supports.
>
> 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: Limit MSI vector walk to actual array size Jan Kiszka
2011-05-03 19:19 ` 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).