On 19/12/25 15:51, Cédric Le Goater wrote:
Hello,

On 12/17/25 19:42, Farhan Ali wrote:
The VFIO pread/pwrite functions use little-endian data format.
When enabling the Bus Master bit, the value must be correctly converted
from the CPU's native endianess to little-endian format.

How did you find the issue ?

I presumed using VFIO on s390x hosts...


Thanks,

C.


Signed-off-by: Farhan Ali <[email protected]>
---
  util/vfio-helpers.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index fdff042ab4..3c8284284f 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -443,7 +443,7 @@ static int qemu_vfio_init_pci(QEMUVFIOState *s, const char *device,
      if (ret) {
          goto fail;
      }
-    pci_cmd |= PCI_COMMAND_MASTER;
+    pci_cmd = cpu_to_le16(le16_to_cpu(pci_cmd) | PCI_COMMAND_MASTER);
      ret = qemu_vfio_pci_write_config(s, &pci_cmd, sizeof(pci_cmd), PCI_COMMAND);
      if (ret) {
          goto fail;





Reply via email to