]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/s390x: Use address_space_ldq_be() in read_table_entry()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Wed, 7 Jan 2026 09:19:33 +0000 (10:19 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Mon, 9 Feb 2026 19:51:42 +0000 (20:51 +0100)
address_space_read/write() is meant for accessing random
amount of memory blobs.  When the access size is known,
use the address_space_ld/st() API which can directly swap
endianness.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20260206181953.18683-2-philmd@linaro.org>

target/s390x/mmu_helper.c

index 026502a3e4078fe9a014232eabc01b7c1f72ab7b..30f09ec3de4ac8ed1ba2474e9c2840baf1178832 100644 (file)
@@ -108,6 +108,7 @@ static inline bool read_table_entry(CPUS390XState *env, hwaddr gaddr,
                                     uint64_t *entry)
 {
     CPUState *cs = env_cpu(env);
+    MemTxResult ret;
 
     /*
      * According to the PoP, these table addresses are "unpredictably real
@@ -116,13 +117,9 @@ static inline bool read_table_entry(CPUS390XState *env, hwaddr gaddr,
      *
      * We treat them as absolute addresses and don't wrap them.
      */
-    if (unlikely(address_space_read(cs->as, gaddr, MEMTXATTRS_UNSPECIFIED,
-                                    entry, sizeof(*entry)) !=
-                 MEMTX_OK)) {
-        return false;
-    }
-    *entry = be64_to_cpu(*entry);
-    return true;
+    *entry = address_space_ldq_be(cs->as, gaddr, MEMTXATTRS_UNSPECIFIED, &ret);
+
+    return ret == MEMTX_OK;
 }
 
 static int mmu_translate_asce(CPUS390XState *env, target_ulong vaddr,