On 4/14/2025 11:43 PM, Philippe Mathieu-Daudé wrote:
Hi,

On 14/4/25 23:36, Farhan Ali wrote:
Add a generic API for host PCI MMIO reads/writes
(e.g. Linux VFIO BAR accesses). The functions access
little endian memory and returns the result in
host cpu endianness.

Signed-off-by: Farhan Ali <al...@linux.ibm.com>
---
  include/qemu/host-pci-mmio.h | 141 +++++++++++++++++++++++++++++++++++
  1 file changed, 141 insertions(+)
  create mode 100644 include/qemu/host-pci-mmio.h

diff --git a/include/qemu/host-pci-mmio.h b/include/qemu/host-pci-mmio.h
new file mode 100644
index 0000000000..de17d67e3a
--- /dev/null
+++ b/include/qemu/host-pci-mmio.h
@@ -0,0 +1,141 @@
+/*
+ * API for host PCI MMIO accesses (e.g. Linux VFIO BARs)
+ *
+ * Copyright 2025 IBM Corp.
+ * Author(s): Farhan Ali <al...@linux.ibm.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HOST_PCI_MMIO_H
+#define HOST_PCI_MMIO_H
+
+#include "qemu/bswap.h"
+#include "qemu/s390x_pci_mmio.h"
+
+
+static inline uint8_t host_pci_ldub_p(const void *ioaddr)

Is it really worth inlining?

Hi Philippe,

I think so, we inline the ld/st generic helper functions in bswap.h. Curious, why do you think its not necessary?

Thanks

Farhan

+{
+    uint8_t ret = 0;
+#ifdef __s390x__
+    ret = s390x_pci_mmio_read_8(ioaddr);
+#else
+    ret = ldub_he_p(ioaddr);
+#endif
+
+    return ret;
+}



Reply via email to