qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com
Subject: [Qemu-devel] [PATCH 2/9] virtio: add virtio_*_phys_cached
Date: Fri, 27 Jan 2017 16:40:13 +0100	[thread overview]
Message-ID: <1485531620-121182-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1485531620-121182-1-git-send-email-pbonzini@redhat.com>

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/virtio/virtio-access.h | 52 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h
index 91ae14d..2e92074 100644
--- a/include/hw/virtio/virtio-access.h
+++ b/include/hw/virtio/virtio-access.h
@@ -156,6 +156,58 @@ 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 uint32_t virtio_ldl_phys_cached(VirtIODevice *vdev,
+                                              MemoryRegionCache *cache,
+                                              hwaddr pa)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        return ldl_be_phys_cached(cache, pa);
+    }
+    return ldl_le_phys_cached(cache, pa);
+}
+
+static inline uint64_t virtio_ldq_phys_cached(VirtIODevice *vdev,
+                                              MemoryRegionCache *cache,
+                                              hwaddr pa)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        return ldq_be_phys_cached(cache, pa);
+    }
+    return ldq_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_stl_phys_cached(VirtIODevice *vdev,
+                                          MemoryRegionCache *cache,
+                                          hwaddr pa, uint32_t value)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        stl_be_phys_cached(cache, pa, value);
+    } else {
+        stl_le_phys_cached(cache, pa, value);
+    }
+}
+
 static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s)
 {
     *s = virtio_tswap16(vdev, *s);
-- 
1.8.3.1

  parent reply	other threads:[~2017-01-27 15:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 15:40 [Qemu-devel] [PATCH v3 0/9] virtio: use MemoryRegionCache for descriptors and rings Paolo Bonzini
2017-01-27 15:40 ` [Qemu-devel] [PATCH 1/9] memory: make memory_listener_unregister idempotent Paolo Bonzini
2017-02-09 22:54   ` Philippe Mathieu-Daudé
2017-01-27 15:40 ` Paolo Bonzini [this message]
2017-01-27 15:40 ` [Qemu-devel] [PATCH 3/9] virtio: use address_space_map/unmap to access descriptors Paolo Bonzini
2017-01-27 15:40 ` [Qemu-devel] [PATCH 4/9] exec: make address_space_cache_destroy idempotent Paolo Bonzini
2017-02-09 22:57   ` Philippe Mathieu-Daudé
2017-01-27 15:40 ` [Qemu-devel] [PATCH 5/9] virtio: use MemoryRegionCache to access descriptors Paolo Bonzini
2017-01-27 15:40 ` [Qemu-devel] [PATCH 6/9] virtio: add MemoryListener to cache ring translations Paolo Bonzini
2017-01-27 15:40 ` [Qemu-devel] [PATCH 7/9] virtio: use VRingMemoryRegionCaches for descriptor ring Paolo Bonzini
2017-01-27 15:40 ` [Qemu-devel] [PATCH 8/9] virtio: check for vring setup in virtio_queue_update_used_idx Paolo Bonzini
2017-02-09 22:59   ` Philippe Mathieu-Daudé
2017-01-27 15:40 ` [Qemu-devel] [PATCH 9/9] virtio: use VRingMemoryRegionCaches for avail and used rings Paolo Bonzini
2017-02-07 15:22 ` [Qemu-devel] [PATCH v3 0/9] virtio: use MemoryRegionCache for descriptors and rings Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485531620-121182-3-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).