summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-05-11 11:42:39 -0300
committerMichael S. Tsirkin <mst@redhat.com>2012-06-07 17:19:00 +0300
commit7c9958b04333a79a1fdb11583aca48a6df2edeb9 (patch)
treeecae498219e60b1993a32e18ab2bed5d03aac780 /hw
parentcbd2d4342b3d42ab33baa99f5b7a23491b5692f2 (diff)
downloadqemu-7c9958b04333a79a1fdb11583aca48a6df2edeb9.tar.gz
qemu-7c9958b04333a79a1fdb11583aca48a6df2edeb9.tar.bz2
qemu-7c9958b04333a79a1fdb11583aca48a6df2edeb9.zip
msi: Guard msi/msix_write_config with msi_present
Terminate msi/msix_write_config early if support is not enabled. This allows to remove checks at the caller site if MSI is optional. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/msi.c3
-rw-r--r--hw/msix.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/hw/msi.c b/hw/msi.c
index b2903fc93c..da12f33728 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -276,7 +276,8 @@ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)
unsigned int vector;
uint32_t pending;
- if (!ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
+ if (!msi_present(dev) ||
+ !ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
return;
}
diff --git a/hw/msix.c b/hw/msix.c
index 59c7a8388f..339e652b81 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -187,7 +187,7 @@ void msix_write_config(PCIDevice *dev, uint32_t addr,
int vector;
bool was_masked;
- if (!range_covers_byte(addr, len, enable_pos)) {
+ if (!msix_present(dev) || !range_covers_byte(addr, len, enable_pos)) {
return;
}