[PATCH] msix: allow qword MSI-X table accesses

Michael S. Tsirkin posted 1 patch 5 years, 6 months ago
Test docker-mingw@fedora passed
Test checkpatch passed
Test asan passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200514151648.877882-1-mst@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/pci/msix.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] msix: allow qword MSI-X table accesses
Posted by Michael S. Tsirkin 5 years, 6 months ago
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")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pci/msix.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 29187898f2..e6a5559038 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -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,
     },
 };
-- 
MST


Re: [PATCH] msix: allow qword MSI-X table accesses
Posted by Philippe Mathieu-Daudé 5 years, 6 months ago
On 5/14/20 5:16 PM, Michael S. Tsirkin wrote:
> 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")

9 years =)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   hw/pci/msix.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> index 29187898f2..e6a5559038 100644
> --- a/hw/pci/msix.c
> +++ b/hw/pci/msix.c
> @@ -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,
>       },
>   };
>