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>
This commit is contained in:
Michael S. Tsirkin 2010-10-27 16:14:56 +02:00
parent f9aebe2ef5
commit 531a0b82dd
1 changed files with 21 additions and 26 deletions

View File

@ -258,8 +258,11 @@ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)
uint32_t pending;
int i;
if (!ranges_overlap(addr, len, dev->msi_cap, msi_cap_sizeof(flags))) {
return;
}
#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,
@ -277,16 +280,8 @@ void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len)
pci_get_long(dev->config + msi_pending_off(dev, msi64bit)));
}
fprintf(stderr, "\n");
}
#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;
}
if (!(flags & PCI_MSI_FLAGS_ENABLE)) {
return;
}