aboutsummaryrefslogtreecommitdiff
path: root/hw/msix.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-06-04 16:56:01 +0200
committerMichael S. Tsirkin <mst@robin.(none)>2012-06-18 10:21:04 +0300
commit393a98924eb00df76231384b86652e1d5f964d67 (patch)
tree895f71570b4fff16634eb246deb1413b0497128b /hw/msix.c
parent80aa796bf38b7ef21daa42673b4711510c450d8a (diff)
msix: drop unused msix_bar_size, require valid bar_size
No user in sight for msix_bar_size. bar_size for all users is aligned, let's simply require this instead of trying to fix up invalid input. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/msix.c')
-rw-r--r--hw/msix.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/hw/msix.c b/hw/msix.c
index ded3c55b92..b64f109326 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -55,24 +55,17 @@ static int msix_add_config(struct PCIDevice *pdev, unsigned short nentries,
{
int config_offset;
uint8_t *config;
- uint32_t new_size;
if (nentries < 1 || nentries > PCI_MSIX_FLAGS_QSIZE + 1)
return -EINVAL;
if (bar_size > 0x80000000)
return -ENOSPC;
- /* Add space for MSI-X structures */
- if (!bar_size) {
- new_size = MSIX_PAGE_SIZE;
- } else if (bar_size < MSIX_PAGE_SIZE) {
- bar_size = MSIX_PAGE_SIZE;
- new_size = MSIX_PAGE_SIZE * 2;
- } else {
- new_size = bar_size * 2;
+ /* Require aligned offset for MSI-X structures */
+ if (bar_size & ~(MSIX_PAGE_SIZE - 1)) {
+ return -EINVAL;
}
- pdev->msix_bar_size = new_size;
config_offset = pci_add_capability(pdev, PCI_CAP_ID_MSIX,
0, MSIX_CAP_LENGTH);
if (config_offset < 0)
@@ -382,13 +375,6 @@ int msix_enabled(PCIDevice *dev)
MSIX_ENABLE_MASK);
}
-/* Size of bar where MSI-X table resides, or 0 if MSI-X not supported. */
-uint32_t msix_bar_size(PCIDevice *dev)
-{
- return (dev->cap_present & QEMU_PCI_CAP_MSIX) ?
- dev->msix_bar_size : 0;
-}
-
/* Send an MSI-X message */
void msix_notify(PCIDevice *dev, unsigned vector)
{