diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5b64eb4d67..3dc9423eae 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -216,6 +216,27 @@ static void virtio_check_indirect_feature(VirtIODevice *vdev) } } +static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev, + MemoryRegionCache *cache, + hwaddr pa) +{ + if (virtio_access_is_big_endian(vdev)) { + return lduw_be_phys_cached(cache, pa); + } + return lduw_le_phys_cached(cache, pa); +} + +static inline void virtio_stw_phys_cached(VirtIODevice *vdev, + MemoryRegionCache *cache, + hwaddr pa, uint16_t value) +{ + if (virtio_access_is_big_endian(vdev)) { + stw_be_phys_cached(cache, pa, value); + } else { + stw_le_phys_cached(cache, pa, value); + } +} + /* Called within call_rcu(). */ static void virtio_free_region_cache(VRingMemoryRegionCaches *caches) { diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h index c866769cad..5b5fff5295 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -102,27 +102,6 @@ static inline uint16_t virtio_tswap16(VirtIODevice *vdev, uint16_t s) #endif } -static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev, - MemoryRegionCache *cache, - hwaddr pa) -{ - if (virtio_access_is_big_endian(vdev)) { - return lduw_be_phys_cached(cache, pa); - } - return lduw_le_phys_cached(cache, pa); -} - -static inline void virtio_stw_phys_cached(VirtIODevice *vdev, - MemoryRegionCache *cache, - hwaddr pa, uint16_t value) -{ - if (virtio_access_is_big_endian(vdev)) { - stw_be_phys_cached(cache, pa, value); - } else { - stw_le_phys_cached(cache, pa, value); - } -} - static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s) { *s = virtio_tswap16(vdev, *s);