QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Tony Nguyen <tony.nguyen@bt.com>
To: qemu-devel@nongnu.org
Cc: Tony Nguyen <tony.nguyen@bt.com>, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel]  [PATCH 6/9] memory: Delete devend_memop
Date: Sat, 24 Aug 2019 05:42:45 +1000
Message-ID: <3bd9a0372fe39837f676ed05b1297ecec894e030.1566588034.git.tony.nguyen@bt.com> (raw)
In-Reply-To: <cover.1566588033.git.tony.nguyen@bt.com>

device_endian has been made redundant by MemOp.

Signed-off-by: Tony Nguyen <tony.nguyen@bt.com>
---
 include/exec/memory.h |  3 ---
 memory.c              | 19 +------------------
 memory_ldst.inc.c     | 18 ++++++------------
 3 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 1fa7e03707..ff80465ac1 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2211,9 +2211,6 @@ address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
     }
 }
 
-/* MemOp to MemOp.  */
-MemOp devend_memop(MemOp end);
-
 #endif
 
 #endif
diff --git a/memory.c b/memory.c
index ee2bef7b1e..d78d6e46db 100644
--- a/memory.c
+++ b/memory.c
@@ -354,7 +354,7 @@ static bool memory_region_big_endian(MemoryRegion *mr)
 
 static void adjust_endianness(MemoryRegion *mr, uint64_t *data, MemOp op)
 {
-    if ((op & MO_BSWAP) != devend_memop(mr->ops->endianness)) {
+    if ((op & MO_BSWAP) != mr->ops->endianness) {
         switch (op & MO_SIZE) {
         case MO_8:
             break;
@@ -3271,20 +3271,3 @@ static void memory_register_types(void)
 }
 
 type_init(memory_register_types)
-
-MemOp devend_memop(MemOp end)
-{
-    static MemOp conv[] = {
-        [MO_LE] = MO_LE,
-        [MO_BE] = MO_BE,
-        [MO_TE] = MO_TE,
-        [DEVICE_HOST_ENDIAN] = 0,
-    };
-    switch (end) {
-    case MO_LE:
-    case MO_BE:
-        return conv[end];
-    default:
-        g_assert_not_reached();
-    }
-}
diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c
index dd1e02d685..028227f52f 100644
--- a/memory_ldst.inc.c
+++ b/memory_ldst.inc.c
@@ -37,8 +37,7 @@ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL,
         release_lock |= prepare_mmio_access(mr);
 
         /* I/O case */
-        r = memory_region_dispatch_read(mr, addr1, &val,
-                                        MO_32 | devend_memop(endian), attrs);
+        r = memory_region_dispatch_read(mr, addr1, &val, MO_32 | endian, attrs);
     } else {
         /* RAM case */
         ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
@@ -104,8 +103,7 @@ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL,
         release_lock |= prepare_mmio_access(mr);
 
         /* I/O case */
-        r = memory_region_dispatch_read(mr, addr1, &val,
-                                        MO_64 | devend_memop(endian), attrs);
+        r = memory_region_dispatch_read(mr, addr1, &val, MO_64 | endian, attrs);
     } else {
         /* RAM case */
         ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
@@ -205,8 +203,7 @@ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
         release_lock |= prepare_mmio_access(mr);
 
         /* I/O case */
-        r = memory_region_dispatch_read(mr, addr1, &val,
-                                        MO_16 | devend_memop(endian), attrs);
+        r = memory_region_dispatch_read(mr, addr1, &val, MO_16 | endian, attrs);
     } else {
         /* RAM case */
         ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
@@ -309,8 +306,7 @@ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL,
     mr = TRANSLATE(addr, &addr1, &l, true, attrs);
     if (l < 4 || !memory_access_is_direct(mr, true)) {
         release_lock |= prepare_mmio_access(mr);
-        r = memory_region_dispatch_write(mr, addr1, val,
-                                         MO_32 | devend_memop(endian), attrs);
+        r = memory_region_dispatch_write(mr, addr1, val, MO_32 | endian, attrs);
     } else {
         /* RAM case */
         ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
@@ -405,8 +401,7 @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL,
     mr = TRANSLATE(addr, &addr1, &l, true, attrs);
     if (l < 2 || !memory_access_is_direct(mr, true)) {
         release_lock |= prepare_mmio_access(mr);
-        r = memory_region_dispatch_write(mr, addr1, val,
-                                         MO_16 | devend_memop(endian), attrs);
+        r = memory_region_dispatch_write(mr, addr1, val, MO_16 | endian, attrs);
     } else {
         /* RAM case */
         ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
@@ -469,8 +464,7 @@ static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL,
     mr = TRANSLATE(addr, &addr1, &l, true, attrs);
     if (l < 8 || !memory_access_is_direct(mr, true)) {
         release_lock |= prepare_mmio_access(mr);
-        r = memory_region_dispatch_write(mr, addr1, val,
-                                         MO_64 | devend_memop(endian), attrs);
+        r = memory_region_dispatch_write(mr, addr1, val, MO_64 | endian, attrs);
     } else {
         /* RAM case */
         ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
-- 
2.23.0



  parent reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 19:42 [Qemu-devel] [PATCH 0/9] Delete enum device_endian Tony Nguyen
2019-08-23 19:42 ` [Qemu-devel] [PATCH 1/9] exec: Map device_endian onto MemOp Tony Nguyen
2019-08-23 19:42 ` [Qemu-devel] [PATCH 2/9] exec: Replace DEVICE_NATIVE_ENDIAN with MO_TE Tony Nguyen
2019-08-23 19:42 ` [Qemu-devel] [PATCH 3/9] exec: Replace DEVICE_LITTLE_ENDIAN with MO_LE Tony Nguyen
2019-08-23 19:42 ` [Qemu-devel] [PATCH 4/9] exec: Replace DEVICE_BIG_ENDIAN with MO_BE Tony Nguyen
2019-08-23 19:42 ` [Qemu-devel] [PATCH 5/9] exec: Replace enum device_endian with MemOp Tony Nguyen
2019-08-23 19:42 ` Tony Nguyen [this message]
2019-08-24 22:30   ` [Qemu-devel] [PATCH 6/9] memory: Delete devend_memop Richard Henderson
2019-08-23 19:42 ` [Qemu-devel] [PATCH 7/9] exec: Delete device_endian Tony Nguyen
2019-08-23 19:42 ` [Qemu-devel] [PATCH 8/9] exec: Delete DEVICE_HOST_ENDIAN Tony Nguyen
2019-08-24 22:31   ` Richard Henderson
2019-08-23 19:42 ` [Qemu-devel] [PATCH 9/9] memory: Delete memory_region_big_endian Tony Nguyen
2019-08-24 22:32   ` Richard Henderson

Reply instructions:

You may reply publically 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=3bd9a0372fe39837f676ed05b1297ecec894e030.1566588034.git.tony.nguyen@bt.com \
    --to=tony.nguyen@bt.com \
    --cc=pbonzini@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

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org qemu-devel@archiver.kernel.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox