Skip to contentSkip to conversation

msix: allow qword MSI-X table accesses

PATCH In review Michael S. Tsirkin 2 participants 2 messages May 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 msix: allow qword MSI-X table accesses

PCI spec says:

For all accesses to MSI-X Table and MSI-X PBA fields, software must use aligned full DWORD or aligned full QWORD transactions; otherwise, the result is undefined.

However, since MSI-X was converted to use memory API, QEMU started blocking qword transactions, only allowing DWORD ones. Guests do not seem to use QWORD accesses, but let's be spec compliant.

Fixes 95524ae8dc8f ("msix: convert to memory API")
---
 hw/pci/msix.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/pci/msix.c +6 -0
index 29187898f2..e6a5559038 100644
@@ -199,6 +199,9 @@ static const MemoryRegionOps msix_table_mmio_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
     .valid = {
         .min_access_size = 4,
+        .max_access_size = 8,
+    },
+    .impl = {
         .max_access_size = 4,
     },
 };
@@ -227,6 +230,9 @@ static const MemoryRegionOps msix_pba_mmio_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
     .valid = {
         .min_access_size = 4,
+        .max_access_size = 8,
+    },
+    .impl = {
         .max_access_size = 4,
     },
 };
Signature · 1 line
MST
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Michael S. Tsirkin

PCI spec says:

For all accesses to MSI-X Table and MSI-X PBA fields, software must use aligned full DWORD or aligned full QWORD transactions; otherwise, the result is undefined.

Quoted 6 lines

However, since MSI-X was converted to use memory API, QEMU started blocking qword transactions, only allowing DWORD ones. Guests do not seem to use QWORD accesses, but let's be spec compliant.

Fixes 95524ae8dc8f ("msix: convert to memory API")

9 years =)

Quoted 30 lines
---
  hw/pci/msix.c | 6 ++++++
  1 file changed, 6 insertions(+)
hw/pci/msix.c +6 -0
index 29187898f2..e6a5559038 100644
@@ -199,6 +199,9 @@ static const MemoryRegionOps msix_table_mmio_ops = {
      .endianness = DEVICE_LITTLE_ENDIAN,
      .valid = {
          .min_access_size = 4,
+        .max_access_size = 8,
+    },
+    .impl = {
          .max_access_size = 4,
      },
  };
@@ -227,6 +230,9 @@ static const MemoryRegionOps msix_pba_mmio_ops = {
      .endianness = DEVICE_LITTLE_ENDIAN,
      .valid = {
          .min_access_size = 4,
+        .max_access_size = 8,
+    },
+    .impl = {
          .max_access_size = 4,
      },
  };