From patchwork Tue Nov 5 13:04:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 840807 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1ace:b0:37d:45d0:187 with SMTP id i14csp329745wry; Tue, 5 Nov 2024 05:08:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWgBLZOP31T+raXd0AINwz+U4nr8zYkiq1ZgBbbKIvkI/0O967m4EbEoz6nAdFHHk9zALTc1g==@linaro.org X-Google-Smtp-Source: AGHT+IFR9PPh9d/7b8am5rlYuxf0vL4Y7uj1Wu7JkdkF8irKNkuQllpGZ2utevzD4jvSY1ODYGtT X-Received: by 2002:a05:6214:3a84:b0:6cd:4972:59b1 with SMTP id 6a1803df08f44-6d1857030c9mr605870096d6.27.1730812083606; Tue, 05 Nov 2024 05:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730812083; cv=none; d=google.com; s=arc-20240605; b=M5W7EXQu/nGxn3XO7RtAnmV28ZBAm0hG7cPi/fIT8njdNdpzyi43Gz9whjERBztNet NUmuRkHYC1lkWNuj1CiEe2LPTZz8pDVKmoCpmzvIFgK1hcEl2QB47Gl0MOVmkie3mc9E RzOSWIDrNMqAbcRvhMWwIvJD27ZrsQod1hEiUHPXroA++wsJwN8Occ58jUjf/vGSgLiJ Qnzy7qttfklyWagb98Gdv0gWNrlOgTWez0Hq9+fPy5f6WfAKxbm0gW61OAOKAtpykGiZ fWXLk+L1gOKIR0AQFHGHAaWgCQcbkjLxXRu5IPYjKtLwhf2hQ45OfohBcEB7OoHzAMGT 4d0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kbb2EbjAWyPRswDzNr8J6AfAT+vMH4Ts659xVE0GgBY=; fh=t3XyJLi79GAl74vwjx9CHyT1q7cQJdnSqFDS2FXNV/w=; b=Mq0Rd4Nq71TDn8gmTki2+v1rEeB+kTxFJyw2sBSDuVpOHKABm1gvnjTwlJy/5DZUGB AwMBUnNqfAugAgOedsl6jvAvxSt5bjDa8kgQakarfCPBX5o3B0hQvrHFeHl18AJ8djqS 7Et/jgMS+Ah6garaEq67tFdryhgX4fUqkFZLf5BobgLabXIrveFGh4Qku4QzeBAz/lb5 A6bh84MKeHjrb4yQxbbYdezEUlAGlz/rl76winI5Jgqch47nkSs2lkbTp2jaqetEK5Vz 4jpF3/VQXUmGn+WCFO2KGWMmeE1RAXdJI+RTZMN45iH7DxN3pFo7Rl1xWPxh9BFa4O5g cRMA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NMS/MpdH"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d353fd0768si132072736d6.161.2024.11.05.05.08.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 05:08:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NMS/MpdH"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8JHJ-0007TA-9k; Tue, 05 Nov 2024 08:07:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8JH4-0006c1-9Z for qemu-devel@nongnu.org; Tue, 05 Nov 2024 08:07:12 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8JH0-0002gL-Ug for qemu-devel@nongnu.org; Tue, 05 Nov 2024 08:07:09 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-37d808ae924so3014871f8f.0 for ; Tue, 05 Nov 2024 05:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730812024; x=1731416824; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kbb2EbjAWyPRswDzNr8J6AfAT+vMH4Ts659xVE0GgBY=; b=NMS/MpdHv0mL+xXX4MDKMtHhCQD8tUoLFhAHOWTYVdzr25FdS5FjZuabDfzOLGrYTm a7bLb1/DQAfa6SN8YoSaJkhjlM2Hqd1XoF6qPaFjTbpVosaNYxnjYZo3b3tbk4ZR0Mrc u2sat5CPvv3ypxBGsvgr5PmeGHrHpY9jM/FBnWTC0et/Dp9kxqch+mmicDmAfXbLDa5d 783kZgl7DNu7FV5g411uE1MB9RK0hh08hjYF8Li1neIxLmroTy491X8bbqAKkpufpkn5 PhzyZ0UwBuPzNWxkQ9VXcGZJj8+xfA8HhQDzUuIHmsRedQ1PtFOfCuApSPWTGDikV7LV Vl/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730812024; x=1731416824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kbb2EbjAWyPRswDzNr8J6AfAT+vMH4Ts659xVE0GgBY=; b=jfLD7xrBTW+U62hKJtmEDQbudrzl3feTrEVSqoRmGjbt+XZrGe8SrzS+vvOZcZDv7I dBc2m1+mzkRNr9fHVH1Nel3gx5Y+6vxLjrx+lcBySbnX0KWlSelhJep3PoGxyQTs8ckz bUz6lFFZ+hgJ5HKKXNZpDXzsbNsPJt+swslXBNWwi+StTNr3ofhvU7K4D2ZsXhSw0uIU /DimTTNYQ525fxj/5kE4fKid3/TP3RHUJTk2+AhV7MBZZKTmtsMbABjeqE1d97UgIHLK 00eVhxgPbQ+HPxwMbC51GjKk6tlDcj0dudiVu23zcFKyE4PXIWTWJ5lupZUK0d4cK/Eq ielw== X-Gm-Message-State: AOJu0YxD/sN6a9o5MCdmRqMfbdat0R6TPbLpiMk0hUMw/4JvxFqURjYn Ra6juGym4rYoEKf5DL1NveZs6gxTT3IQOSrdQbTBDhO1ALibwZOBHthTLuWX6a9lgeHXIkYQ9z/ T/mE= X-Received: by 2002:a5d:5d09:0:b0:381:dff2:cf08 with SMTP id ffacd0b85a97d-381dff2cff8mr3069929f8f.2.1730812024322; Tue, 05 Nov 2024 05:07:04 -0800 (PST) Received: from localhost.localdomain (86.red-88-29-160.dynamicip.rima-tde.net. [88.29.160.86]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c113e073sm16114234f8f.66.2024.11.05.05.07.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Nov 2024 05:07:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Anton Johansson Cc: "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, =?utf-8?q?Marc-Andr=C3=A9_Lur?= =?utf-8?q?eau?= , Paolo Bonzini , Jason Wang , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 15/19] target/microblaze: Introduce mo_endian() helper Date: Tue, 5 Nov 2024 14:04:27 +0100 Message-ID: <20241105130431.22564-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241105130431.22564-1-philmd@linaro.org> References: <20241105130431.22564-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org mo_endian() returns the target endianness, currently static. Signed-off-by: Philippe Mathieu-Daudé --- target/microblaze/translate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 86f3c196189..0b466db694c 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -707,12 +707,17 @@ static void record_unaligned_ess(DisasContext *dc, int rd, } #endif +static inline MemOp mo_endian(DisasContext *dc) +{ + return MO_TE; +} + static bool do_load(DisasContext *dc, int rd, TCGv addr, MemOp mop, int mem_index, bool rev) { MemOp size = mop & MO_SIZE; - mop |= MO_TE; + mop |= mo_endian(dc); /* * When doing reverse accesses we need to do two things. @@ -847,7 +852,8 @@ static bool trans_lwx(DisasContext *dc, arg_typea *arg) /* lwx does not throw unaligned access errors, so force alignment */ tcg_gen_andi_tl(addr, addr, ~3); - tcg_gen_qemu_ld_i32(cpu_res_val, addr, dc->mem_index, MO_TE | MO_UL); + tcg_gen_qemu_ld_i32(cpu_res_val, addr, dc->mem_index, + mo_endian(dc) | MO_UL); tcg_gen_mov_tl(cpu_res_addr, addr); if (arg->rd) { @@ -864,7 +870,7 @@ static bool do_store(DisasContext *dc, int rd, TCGv addr, MemOp mop, { MemOp size = mop & MO_SIZE; - mop |= MO_TE; + mop |= mo_endian(dc); /* * When doing reverse accesses we need to do two things. @@ -1018,7 +1024,7 @@ static bool trans_swx(DisasContext *dc, arg_typea *arg) tcg_gen_atomic_cmpxchg_i32(tval, cpu_res_addr, cpu_res_val, reg_for_write(dc, arg->rd), - dc->mem_index, MO_TE | MO_UL); + dc->mem_index, mo_endian(dc) | MO_UL); tcg_gen_brcond_i32(TCG_COND_NE, cpu_res_val, tval, swx_fail);