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>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 5/9] exec: Replace enum device_endian with MemOp
Date: Sat, 24 Aug 2019 05:42:44 +1000
Message-ID: <ede636b9438e0c6ddc16292fe776b6569fb87cbf.1566588034.git.tony.nguyen@bt.com> (raw)
In-Reply-To: <cover.1566588033.git.tony.nguyen@bt.com>

Simplify endianness comparisons with consistent use of the more
expressive MemOp.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Tony Nguyen <tony.nguyen@bt.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/char/serial.c         |  2 +-
 include/exec/memory.h    |  6 +++---
 include/hw/char/serial.h |  2 +-
 memory.c                 |  2 +-
 memory_ldst.inc.c        | 15 ++++++---------
 5 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index cf41203be6..c725688828 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -1036,7 +1036,7 @@ static const MemoryRegionOps serial_mm_ops[2] = {
 SerialState *serial_mm_init(MemoryRegion *address_space,
                             hwaddr base, int it_shift,
                             qemu_irq irq, int baudbase,
-                            Chardev *chr, enum device_endian end)
+                            Chardev *chr, MemOp end)
 {
     SerialState *s;
 
diff --git a/include/exec/memory.h b/include/exec/memory.h
index c4c86a6ff4..1fa7e03707 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -168,7 +168,7 @@ struct MemoryRegionOps {
                                     unsigned size,
                                     MemTxAttrs attrs);
 
-    enum device_endian endianness;
+    MemOp endianness;
     /* Guest-visible constraints: */
     struct {
         /* If nonzero, specify bounds on access sizes beyond which a machine
@@ -2211,8 +2211,8 @@ address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
     }
 }
 
-/* enum device_endian to MemOp.  */
-MemOp devend_memop(enum device_endian end);
+/* MemOp to MemOp.  */
+MemOp devend_memop(MemOp end);
 
 #endif
 
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 8be3d8a4f9..175b980249 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -90,7 +90,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,
 SerialState *serial_mm_init(MemoryRegion *address_space,
                             hwaddr base, int it_shift,
                             qemu_irq irq, int baudbase,
-                            Chardev *chr, enum device_endian end);
+                            Chardev *chr, MemOp end);
 
 /* serial-isa.c */
 
diff --git a/memory.c b/memory.c
index 52090e18eb..ee2bef7b1e 100644
--- a/memory.c
+++ b/memory.c
@@ -3272,7 +3272,7 @@ static void memory_register_types(void)
 
 type_init(memory_register_types)
 
-MemOp devend_memop(enum device_endian end)
+MemOp devend_memop(MemOp end)
 {
     static MemOp conv[] = {
         [MO_LE] = MO_LE,
diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c
index 45bec83a94..dd1e02d685 100644
--- a/memory_ldst.inc.c
+++ b/memory_ldst.inc.c
@@ -21,8 +21,7 @@
 
 /* warning: addr must be aligned */
 static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL,
-    hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
-    enum device_endian endian)
+    hwaddr addr, MemTxAttrs attrs, MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     uint64_t val;
@@ -89,8 +88,7 @@ uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL,
 
 /* warning: addr must be aligned */
 static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL,
-    hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
-    enum device_endian endian)
+    hwaddr addr, MemTxAttrs attrs, MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     uint64_t val;
@@ -191,8 +189,7 @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
 
 /* warning: addr must be aligned */
 static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
-    hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
-    enum device_endian endian)
+    hwaddr addr, MemTxAttrs attrs, MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     uint64_t val;
@@ -299,7 +296,7 @@ void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL,
 /* warning: addr must be aligned */
 static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL,
     hwaddr addr, uint32_t val, MemTxAttrs attrs,
-    MemTxResult *result, enum device_endian endian)
+    MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     MemoryRegion *mr;
@@ -395,7 +392,7 @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL,
 /* warning: addr must be aligned */
 static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL,
     hwaddr addr, uint32_t val, MemTxAttrs attrs,
-    MemTxResult *result, enum device_endian endian)
+    MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     MemoryRegion *mr;
@@ -459,7 +456,7 @@ void glue(address_space_stw_be, SUFFIX)(ARG1_DECL,
 
 static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL,
     hwaddr addr, uint64_t val, MemTxAttrs attrs,
-    MemTxResult *result, enum device_endian endian)
+    MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     MemoryRegion *mr;
-- 
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 ` Tony Nguyen [this message]
2019-08-23 19:42 ` [Qemu-devel] [PATCH 6/9] memory: Delete devend_memop Tony Nguyen
2019-08-24 22:30   ` 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=ede636b9438e0c6ddc16292fe776b6569fb87cbf.1566588034.git.tony.nguyen@bt.com \
    --to=tony.nguyen@bt.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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
	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.git