From: "Michael S. Tsirkin" <mst@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: qemu-kvm: fix infinite recursion in pci
Date: Tue, 15 Dec 2009 14:58:53 +0200 [thread overview]
Message-ID: <20091215125853.GA20690@redhat.com> (raw)
Make config reads for assigned devices work
like they used to: both pci_default_read_config
and pci_default_cap_read_config call to pci_read_config,
which does the actual work.
This fixes infinite recursion introduced by
recent merge from stable-0.12.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Hannes Reinecke <hare@suse.de>
Tested-by: Hannes Reinecke <hare@suse.de>
---
diff --git a/hw/pci.c b/hw/pci.c
index 110a5fc..a74d3d4 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1016,19 +1016,26 @@ static void pci_update_irq_disabled(PCIDevice *d, int was_irq_disabled)
}
}
+static uint32_t pci_read_config(PCIDevice *d,
+ uint32_t address, int len)
+{
+ uint32_t val = 0;
+
+ len = MIN(len, pci_config_size(d) - address);
+ memcpy(&val, d->config + address, len);
+ return le32_to_cpu(val);
+}
+
uint32_t pci_default_read_config(PCIDevice *d,
uint32_t address, int len)
{
- uint32_t val = 0;
assert(len == 1 || len == 2 || len == 4);
if (pci_access_cap_config(d, address, len)) {
return d->cap.config_read(d, address, len);
}
- len = MIN(len, pci_config_size(d) - address);
- memcpy(&val, d->config + address, len);
- return le32_to_cpu(val);
+ return pci_read_config(d, address, len);
}
static void pci_write_config(PCIDevice *pci_dev,
@@ -1052,7 +1059,7 @@ int pci_access_cap_config(PCIDevice *pci_dev, uint32_t address, int len)
uint32_t pci_default_cap_read_config(PCIDevice *pci_dev,
uint32_t address, int len)
{
- return pci_default_read_config(pci_dev, address, len);
+ return pci_read_config(pci_dev, address, len);
}
void pci_default_cap_write_config(PCIDevice *pci_dev,
next reply other threads:[~2009-12-15 13:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 12:58 Michael S. Tsirkin [this message]
2009-12-17 8:25 ` qemu-kvm: fix infinite recursion in pci 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=20091215125853.GA20690@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=hare@suse.de \
--cc=kvm@vger.kernel.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 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.