{"id":2175785,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2175785/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251218221457.73341-6-philmd@linaro.org>","date":"2025-12-18T22:14:56","name":"[5/6] target/sparc: Use explicit big-endian LD/ST API","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"44409b82a1d0ac98de1af5b3fa9772b81811041a","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/1.0/people/85046/?format=json","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20251218221457.73341-6-philmd@linaro.org/mbox/","series":[{"id":485925,"url":"http://patchwork.ozlabs.org/api/1.0/series/485925/?format=json","date":"2025-12-18T22:14:52","name":"target/sparc64: Stop using the legacy native-endian APIs","version":1,"mbox":"http://patchwork.ozlabs.org/series/485925/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2175785/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=wri4t0v3;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dXQ4Q3vZlz1xpw\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 19 Dec 2025 09:16:38 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vWMII-0002EG-JN; Thu, 18 Dec 2025 17:16:25 -0500","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1vWMHk-0001wD-Fh\n for qemu-devel@nongnu.org; Thu, 18 Dec 2025 17:15:49 -0500","from mail-wm1-x329.google.com ([2a00:1450:4864:20::329])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1vWMHf-00072C-Vj\n for qemu-devel@nongnu.org; Thu, 18 Dec 2025 17:15:47 -0500","by mail-wm1-x329.google.com with SMTP id\n 5b1f17b1804b1-47aa03d3326so6944935e9.3\n for <qemu-devel@nongnu.org>; Thu, 18 Dec 2025 14:15:43 -0800 (PST)","from localhost.localdomain (88-187-86-199.subs.proxad.net.\n [88.187.86.199]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-47be2723b2bsm63348565e9.3.2025.12.18.14.15.39\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Thu, 18 Dec 2025 14:15:40 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1766096142; x=1766700942; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=lQBTMCfea7CrgtYIaGV0TP3JWVGEy3fzFkDzZcaRRcU=;\n b=wri4t0v3y76EXcyHjtssS0hqFbFRfn4K+mSLxHPJaLF4HqBXs8nX2IAJlTDnEqMPJ3\n cWwzPsay2MbdvWqvdqVTTJ15cSLt5sB1hlf9rd4EBX9GmbKDsgg4qYgqrFTKnyQTihe/\n RIoI9GOA6ha32N3NpRrb8/I8PlsQcaNkyHK9aBTJ4dXsLq0Nik4bq0q9U8Y19aZdp4FJ\n r4SiZMOu6cxypWADCO+rLZjn6THq/dWfDVmLNNLsgRI9YvrXZ/5Xc2wA3KwPb3KDU7ZA\n u4oGyBggTiDuDgDYm6PAENeYERMhWDISCmqqkTKCltiDcOqQDJgZbRKgH8MZMFA3cDrW\n RTIw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1766096142; x=1766700942;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=lQBTMCfea7CrgtYIaGV0TP3JWVGEy3fzFkDzZcaRRcU=;\n b=XEdZvxVMcmD5F86weWlYYHOZ8sRYqawSZbIoCzwHxRU5juAp2wr1GGfc1qJ25DXFAx\n pdkb5VQ6b8HBasmS1aLUhWCE3NFu+DqXsUUfWRZcDyLYEzbi+OF+TaIE09jmj//G99Mz\n DFbgeQAlqCMrXTMtZdenaA8pq7+NZsh1RFsx5s6UUn9+ED20JCkcPWE1H6FZ+HnNfxph\n P9cGBu+Knm2NMTIWyMNItMVwJf8Clo36YZM6q0aA5RCDJcx1D69Xq99GkNK4f+18bhnO\n 2xoMIx5Ee5aDWqWLa0491YlpvZASfx+LcbFzrii6BARsYvKbPgP067bAnT953GBwz9OS\n e9hQ==","X-Gm-Message-State":"AOJu0YybsCgBSxr71wbR3M+VQg/8YIY+Yu4+OOc7RNx9C7WtzBaRU4QV\n ruJPbudrdHqGpZ4Rl7TPZ7l/B+L8ufeXmqDKOiPJ66ysbqrYTGJPcjswgEQKDpw0K3QNBc8efQC\n jYFPp62U=","X-Gm-Gg":"AY/fxX7IGdj7e1IM9H1o3mf+DIAj6a7WsHgCgm9o9CrutAdIp5ze/gQcm5fdP5gzkl8\n vNR2Ohv1mhWpC9gkAm7jSmAJYmXDEf8H2G0xd44MwqN+qBSu+VJwXpiuHMZVfg0BBP4W9to0E1c\n KLgTQhdjGdiGZcmuIFggzpbfkkLL7/YPicCNOmQ7yeiCUga1Z1mnxpcZvdw3nFxdfl3muzINwlI\n bdxc2VWV9vlHxt6SGsYVtEY4cxhoJCQDSSVmMvJFt11xGcIea1f5z4QWxl+46qgzAOolWrvdTQO\n SbBMfZfCJIvG2N07c34v5BFVx1TyGa1UTH+puwpQMkyKWSchhbPCM6oiDq+HlmgCxqOK5SEOrVT\n 2v9iDOhJOL+0F31HEEsnZULDieqqfL5WfvNnh8UV2UVAHvvUmigK5fb7zZ1F20XpaR+MrmwR66B\n ewwDctRFWQONeUBkxHNJoFbS0YLh9YEmAyh0ebW8/pQAE2pKZqIxU332sYSeOFw160620hvus=","X-Google-Smtp-Source":"\n AGHT+IF1zd8m+r0uNjInsUOLt97Eed+6ln7aydXlyXRU8sR76Wmgh1KI1R7kt4ezvYxaA16zwHzO1g==","X-Received":"by 2002:a05:600c:3b07:b0:47a:814c:eea1 with SMTP id\n 5b1f17b1804b1-47d195917d2mr5425505e9.35.1766096142163;\n Thu, 18 Dec 2025 14:15:42 -0800 (PST)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"qemu-devel@nongnu.org","Cc":"Anton Johansson <anjo@rev.ng>,\n Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, =?utf-8?q?Cl?=\n\t=?utf-8?q?=C3=A9ment_Chigot?= <chigot@adacore.com>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Richard Henderson <richard.henderson@linaro.org>,\n Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,\n Frederic Konrad <konrad.frederic@yahoo.fr>,\n Artyom Tarasenko <atar4qemu@gmail.com>, =?utf-8?q?Philippe_Mathieu-Daud?=\n\t=?utf-8?q?=C3=A9?= <philmd@linaro.org>","Subject":"[PATCH 5/6] target/sparc: Use explicit big-endian LD/ST API","Date":"Thu, 18 Dec 2025 23:14:56 +0100","Message-ID":"<20251218221457.73341-6-philmd@linaro.org>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251218221457.73341-1-philmd@linaro.org>","References":"<20251218221457.73341-1-philmd@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::329;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"The SPARC architecture uses big endianness. Directly use\nthe big-endian LD/ST API.\n\nMechanical change running:\n\n  $ for a in uw w l q; do \\\n      sed -i -e \"s/ld${a}_p(/ld${a}_be_p(/\" \\\n        $(git grep -wlE '(ld|st)u?[wlq]_p' target/sparc/);\n    done\n\nSigned-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>\n---\n target/sparc/ldst_helper.c | 12 ++++++------\n target/sparc/mmu_helper.c  | 30 ++++++++++++++++--------------\n 2 files changed, 22 insertions(+), 20 deletions(-)","diff":"diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c\nindex 052608c02d8..ed79a506584 100644\n--- a/target/sparc/ldst_helper.c\n+++ b/target/sparc/ldst_helper.c\n@@ -861,10 +861,10 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,\n                 MemTxResult result;\n                 hwaddr access_addr = (env->mxccregs[0] & 0xffffffffULL) + 8 * i;\n \n-                env->mxccdata[i] = address_space_ldq(cs->as,\n-                                                     access_addr,\n-                                                     MEMTXATTRS_UNSPECIFIED,\n-                                                     &result);\n+                env->mxccdata[i] = address_space_ldq_be(cs->as,\n+                                                        access_addr,\n+                                                        MEMTXATTRS_UNSPECIFIED,\n+                                                        &result);\n                 if (result != MEMTX_OK) {\n                     /* TODO: investigate whether this is the right behaviour */\n                     sparc_raise_mmu_fault(cs, access_addr, false, false,\n@@ -889,8 +889,8 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,\n                 MemTxResult result;\n                 hwaddr access_addr = (env->mxccregs[1] & 0xffffffffULL) + 8 * i;\n \n-                address_space_stq(cs->as, access_addr, env->mxccdata[i],\n-                                  MEMTXATTRS_UNSPECIFIED, &result);\n+                address_space_stq_be(cs->as, access_addr, env->mxccdata[i],\n+                                     MEMTXATTRS_UNSPECIFIED, &result);\n \n                 if (result != MEMTX_OK) {\n                     /* TODO: investigate whether this is the right behaviour */\ndiff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c\nindex 46bf500ea83..035be5b4f9a 100644\n--- a/target/sparc/mmu_helper.c\n+++ b/target/sparc/mmu_helper.c\n@@ -102,7 +102,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,\n     /* SPARC reference MMU table walk: Context table->L1->L2->PTE */\n     /* Context base + context number */\n     pde_ptr = (env->mmuregs[1] << 4) + (env->mmuregs[2] << 2);\n-    pde = address_space_ldl(cs->as, pde_ptr, MEMTXATTRS_UNSPECIFIED, &result);\n+    pde = address_space_ldl_be(cs->as, pde_ptr,\n+                               MEMTXATTRS_UNSPECIFIED, &result);\n     if (result != MEMTX_OK) {\n         return 4 << 2; /* Translation fault, L = 0 */\n     }\n@@ -117,8 +118,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,\n         return 4 << 2;\n     case 1: /* L0 PDE */\n         pde_ptr = ((address >> 22) & ~3) + ((pde & ~3) << 4);\n-        pde = address_space_ldl(cs->as, pde_ptr,\n-                                MEMTXATTRS_UNSPECIFIED, &result);\n+        pde = address_space_ldl_be(cs->as, pde_ptr,\n+                                   MEMTXATTRS_UNSPECIFIED, &result);\n         if (result != MEMTX_OK) {\n             return (1 << 8) | (4 << 2); /* Translation fault, L = 1 */\n         }\n@@ -131,8 +132,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,\n             return (1 << 8) | (4 << 2);\n         case 1: /* L1 PDE */\n             pde_ptr = ((address & 0xfc0000) >> 16) + ((pde & ~3) << 4);\n-            pde = address_space_ldl(cs->as, pde_ptr,\n-                                    MEMTXATTRS_UNSPECIFIED, &result);\n+            pde = address_space_ldl_be(cs->as, pde_ptr,\n+                                       MEMTXATTRS_UNSPECIFIED, &result);\n             if (result != MEMTX_OK) {\n                 return (2 << 8) | (4 << 2); /* Translation fault, L = 2 */\n             }\n@@ -145,8 +146,8 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,\n                 return (2 << 8) | (4 << 2);\n             case 1: /* L2 PDE */\n                 pde_ptr = ((address & 0x3f000) >> 10) + ((pde & ~3) << 4);\n-                pde = address_space_ldl(cs->as, pde_ptr,\n-                                        MEMTXATTRS_UNSPECIFIED, &result);\n+                pde = address_space_ldl_be(cs->as, pde_ptr,\n+                                           MEMTXATTRS_UNSPECIFIED, &result);\n                 if (result != MEMTX_OK) {\n                     return (3 << 8) | (4 << 2); /* Translation fault, L = 3 */\n                 }\n@@ -276,7 +277,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)\n     /* Context base + context number */\n     pde_ptr = (hwaddr)(env->mmuregs[1] << 4) +\n         (env->mmuregs[2] << 2);\n-    pde = address_space_ldl(cs->as, pde_ptr, MEMTXATTRS_UNSPECIFIED, &result);\n+    pde = address_space_ldl_be(cs->as, pde_ptr,\n+                               MEMTXATTRS_UNSPECIFIED, &result);\n     if (result != MEMTX_OK) {\n         return 0;\n     }\n@@ -292,8 +294,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)\n             return pde;\n         }\n         pde_ptr = ((address >> 22) & ~3) + ((pde & ~3) << 4);\n-        pde = address_space_ldl(cs->as, pde_ptr,\n-                                MEMTXATTRS_UNSPECIFIED, &result);\n+        pde = address_space_ldl_be(cs->as, pde_ptr,\n+                                   MEMTXATTRS_UNSPECIFIED, &result);\n         if (result != MEMTX_OK) {\n             return 0;\n         }\n@@ -310,8 +312,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)\n                 return pde;\n             }\n             pde_ptr = ((address & 0xfc0000) >> 16) + ((pde & ~3) << 4);\n-            pde = address_space_ldl(cs->as, pde_ptr,\n-                                    MEMTXATTRS_UNSPECIFIED, &result);\n+            pde = address_space_ldl_be(cs->as, pde_ptr,\n+                                       MEMTXATTRS_UNSPECIFIED, &result);\n             if (result != MEMTX_OK) {\n                 return 0;\n             }\n@@ -328,8 +330,8 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)\n                     return pde;\n                 }\n                 pde_ptr = ((address & 0x3f000) >> 10) + ((pde & ~3) << 4);\n-                pde = address_space_ldl(cs->as, pde_ptr,\n-                                        MEMTXATTRS_UNSPECIFIED, &result);\n+                pde = address_space_ldl_be(cs->as, pde_ptr,\n+                                           MEMTXATTRS_UNSPECIFIED, &result);\n                 if (result != MEMTX_OK) {\n                     return 0;\n                 }\n","prefixes":["5/6"]}