aboutsummaryrefslogtreecommitdiff
path: root/hw/msi.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-10-27 16:14:56 +0200
committerMichael S. Tsirkin <mst@redhat.com>2010-10-27 19:01:59 +0200
commit531a0b82dd0ad352819d4deffe1ecd7f52975fbf (patch)
tree37cb9cff3e1d650eaad7c357b4fcfbc393163836 /hw/msi.c
parentf9aebe2ef52ff0dcb733999f57e00a7b430303c6 (diff)
msi: simplify range checks
config write handlers should be idempotent. So no need for complex range checks: a simple one checking that we are touching the relevant capability will do. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/msi.c')
-rw-r--r--hw/msi.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/hw/msi.c b/hw/msi.c
index 0f2913aaa2..016e7a478f 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -258,34 +258,29 @@ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)
uint32_t pending;
int i;
-#ifdef MSI_DEBUG
- if (ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
- MSI_DEV_PRINTF(dev, "addr 0x%"PRIx32" val 0x%"PRIx32" len %d\n",
- addr, val, len);
- MSI_DEV_PRINTF(dev, "ctrl: 0x%"PRIx16" address: 0x%"PRIx32,
- flags,
- pci_get_long(dev->config + msi_address_lo_off(dev)));
- if (msi64bit) {
- fprintf(stderr, " addrss-hi: 0x%"PRIx32,
- pci_get_long(dev->config + msi_address_hi_off(dev)));
- }
- fprintf(stderr, " data: 0x%"PRIx16,
- pci_get_word(dev->config + msi_data_off(dev, msi64bit)));
- if (flags & PCI_MSI_FLAGS_MASKBIT) {
- fprintf(stderr, " mask 0x%"PRIx32" pending 0x%"PRIx32,
- pci_get_long(dev->config + msi_mask_off(dev, msi64bit)),
- pci_get_long(dev->config + msi_pending_off(dev, msi64bit)));
- }
- fprintf(stderr, "\n");
+ if (!ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
+ return;
}
-#endif
- /* Are we modified? */
- if (!(ranges_overlap(addr, len, msi_flags_off(dev), 2) ||
- (msi_per_vector_mask &&
- ranges_overlap(addr, len, msi_mask_off(dev, msi64bit), 4)))) {
- return;
+#ifdef MSI_DEBUG
+ MSI_DEV_PRINTF(dev, "addr 0x%"PRIx32" val 0x%"PRIx32" len %d\n",
+ addr, val, len);
+ MSI_DEV_PRINTF(dev, "ctrl: 0x%"PRIx16" address: 0x%"PRIx32,
+ flags,
+ pci_get_long(dev->config + msi_address_lo_off(dev)));
+ if (msi64bit) {
+ fprintf(stderr, " addrss-hi: 0x%"PRIx32,
+ pci_get_long(dev->config + msi_address_hi_off(dev)));
}
+ fprintf(stderr, " data: 0x%"PRIx16,
+ pci_get_word(dev->config + msi_data_off(dev, msi64bit)));
+ if (flags & PCI_MSI_FLAGS_MASKBIT) {
+ fprintf(stderr, " mask 0x%"PRIx32" pending 0x%"PRIx32,
+ pci_get_long(dev->config + msi_mask_off(dev, msi64bit)),
+ pci_get_long(dev->config + msi_pending_off(dev, msi64bit)));
+ }
+ fprintf(stderr, "\n");
+#endif
if (!(flags & PCI_MSI_FLAGS_ENABLE)) {
return;