diff mbox series

[PATCH-for-8.0,08/10] hw/virtio: Un-inline virtio_access_is_big_endian()

Message ID 20221212230517.28872-9-philmd@linaro.org
State New
Headers show
Series hw/virtio: Build most objects as target independent units | expand

Commit Message

Philippe Mathieu-Daudé Dec. 12, 2022, 11:05 p.m. UTC
In order to avoid target-specific code in VirtIO headers,
move this particular function -- which is only called once
in virtio_init() -- in its own unit.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/virtio/virtio-config.c         | 20 ++++++++++++++++++++
 include/hw/virtio/virtio-access.h | 19 +------------------
 2 files changed, 21 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/hw/virtio/virtio-config.c b/hw/virtio/virtio-config.c
index ad78e0b9bc..aca6ef5e1b 100644
--- a/hw/virtio/virtio-config.c
+++ b/hw/virtio/virtio-config.c
@@ -11,8 +11,28 @@ 
 
 #include "qemu/osdep.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/virtio-access.h"
 #include "cpu.h"
 
+#if defined(TARGET_PPC64) || defined(TARGET_ARM)
+#define LEGACY_VIRTIO_IS_BIENDIAN 1
+#endif
+
+bool virtio_access_is_big_endian(VirtIODevice *vdev)
+{
+#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
+    return virtio_is_big_endian(vdev);
+#elif TARGET_BIG_ENDIAN
+    if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
+        /* Devices conforming to VIRTIO 1.0 or later are always LE. */
+        return false;
+    }
+    return true;
+#else
+    return false;
+#endif
+}
+
 uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr)
 {
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h
index 985f39fe16..7229088b7c 100644
--- a/include/hw/virtio/virtio-access.h
+++ b/include/hw/virtio/virtio-access.h
@@ -20,24 +20,7 @@ 
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-bus.h"
 
-#if defined(TARGET_PPC64) || defined(TARGET_ARM)
-#define LEGACY_VIRTIO_IS_BIENDIAN 1
-#endif
-
-static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
-{
-#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
-    return virtio_is_big_endian(vdev);
-#elif TARGET_BIG_ENDIAN
-    if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
-        /* Devices conforming to VIRTIO 1.0 or later are always LE. */
-        return false;
-    }
-    return true;
-#else
-    return false;
-#endif
-}
+bool virtio_access_is_big_endian(VirtIODevice *vdev);
 
 static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa)
 {