From patchwork Fri Nov 8 15:43:13 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: 841746 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp1708724wru; Fri, 8 Nov 2024 07:45:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVL/peBYNi8BDwV3UJamlxWYlcEMoQoeHLDqvAmIq89uHeBtr9p0sRt6fUbtaLlEIrqU6hWZQ==@linaro.org X-Google-Smtp-Source: AGHT+IFczctkcsVw3UGZ3OBOzUg9Zy29yUOnUPkOpJ4CFPnActF3ZBJ/oMzECdR5yQncC5l5RMNg X-Received: by 2002:a05:6830:3592:b0:718:db7:708d with SMTP id 46e09a7af769-71a1c28442emr4945510a34.28.1731080728502; Fri, 08 Nov 2024 07:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731080728; cv=none; d=google.com; s=arc-20240605; b=GV+IIZyjZ1s/rgIFLDjp5JP4poYtIpvwbD7iFJ0cjEACeoTyO2Q9WwsqCwsQwSaQQa Rle5XQRtNZ4bqih9J920i5gs+jclttlhcI+tS5G67XGgg421YvMzeKmM+0iC2FMvPqjI oBkXM1YQhEZ5HKcfcfn4C+DFNdmBPKr/iiniw3T/w42UrpNw2FlxfxvjrezZg582lAOY dsuGwjrs4YoflQMaFv34cKYta0IK2eUPL1fx9lgiKbmLgqsmuIuw/Npqsg9cxI7D7eyi DL+3j/dte9RZTMKAu51+gMGesSlmmTpxQNMFG1gdVhWxBuhkKHKhD+nb2cZWYMwq3ZDu XfUw== 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=0DIqtFDNKbWcFtV6kDPh5+cEk8GapRiCMoHMQdui5B4=; fh=BnUgilU6vFcDkhsiWVmyvhQNOSEJl6nGMmWyFGi3WDs=; b=T8DhEpwKsMP9SsuJGMu9r48QnluZbpjyEtmACF4gP4Ww63uYcuFB5/VxdU/02/W5fs 9bzr/JNII1sqkkphi//8y+JryCw+cyByNCG8Jnftk+5zRNdgPmlB4H6HZUjhw/lxvGA5 Dkoyz4oVOBdqYWxFpvoDhJ8kNwJB6ypDXWAKEL9uQysgsIb4Zq/SB9Etpx3TMss0lVAk zsZSrhD/y8KSWNzHDgQstM0T0TPRXG9kNvl8FhPmmSR7Gv9lzyk1PgiuyF281l9CxUkj 8ayuTs4Vm0OxHUvR0I8h1PAIXAcv6Yf51ppPaafUdd1ShoimBbXn+0bUEv74kpV3aPr8 9Kvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ITVL3nri; 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 d75a77b69052e-462ff5c7d93si28967041cf.284.2024.11.08.07.45.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Nov 2024 07:45:28 -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=ITVL3nri; 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 1t9RAH-0005wV-4o; Fri, 08 Nov 2024 10:44:52 -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 1t9R9w-0005Vv-QC for qemu-devel@nongnu.org; Fri, 08 Nov 2024 10:44:32 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9R9v-0005gQ-9j for qemu-devel@nongnu.org; Fri, 08 Nov 2024 10:44:28 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-37d6ff1cbe1so1638159f8f.3 for ; Fri, 08 Nov 2024 07:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731080663; x=1731685463; 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=0DIqtFDNKbWcFtV6kDPh5+cEk8GapRiCMoHMQdui5B4=; b=ITVL3nriTHO851mw8m2fAmwiEoAoda4MRgweOJZFPsNOfvukPF46Q/xSjCRZcBprI9 BRl/o52GodZHZ0sK4Gad/D9W9NrCWwPMzVDMk2j9FFUdOQ5BIWQ25cTXAAznC8iBnOb3 69RLApZtzggzYP1lh6zTDVA/VuWWdALjKvLYrmIpJswNaJIOnAjwR5Zw9Au9TlvZ9E7q 0jcvFOFMP+0yoNUgvR1T0eh3u4s6JVrsiEz4JYaWNEMAcyc/7kDQrK9S5xt9VmEh521u 5hbhP77PAdjOfx16nG6pYIash4tmqV+r1MLL0Rby8+coTqnA2BtnRexRsaUxXnJ+KX3O q8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731080663; x=1731685463; 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=0DIqtFDNKbWcFtV6kDPh5+cEk8GapRiCMoHMQdui5B4=; b=sCJXUSfie94y24tZz9qzitCsEIDiw55gQEhKgfnIgvLLLSfcmNr0s+uvTDC3/LJkOt 4W+fWKyQetVZ39H/PUY2Ts+Fx7zpJ0KOY+2xGQDSl2pIySfh+C2O9UlQkgpaq+fvtFHE Rz5lwlmyrE2pDROMFtk5iV45dHz7lyrXZ0OnRtMNxZCTixfm//cHuIku5BYY7nn3Nt2E 5Roksk4zsZrN5f/gp80bv3UpUJS2ne2Pn+hK7cFT4bZ38ntBHn3eK2HBssahJP+C3Pdr dPXibknv9pZolV8UK+IA19zF8YjnGR59r8u2meXTVvJMftPZtPt4gMFBmupPhJyxTORb vpPg== X-Gm-Message-State: AOJu0YwPdQDUMt9n79zKi2yNFuZNIiHPzU4H0PLCN0P/mdoZi3mhJY7f oWn5BWXHLdcGfeGf9tBhyDOtZsK+YqK8IdyIxuF/5Jxl1xE8J2Yo9SyFRjskQBIfpYV4wnroMB4 L X-Received: by 2002:a05:6000:21c8:b0:37d:5129:f45e with SMTP id ffacd0b85a97d-381f1721434mr2475433f8f.20.1731080663530; Fri, 08 Nov 2024 07:44:23 -0800 (PST) Received: from localhost.localdomain ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432b05c0d33sm75414505e9.27.2024.11.08.07.44.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 08 Nov 2024 07:44:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Anton Johansson Cc: Jason Wang , Paolo Bonzini , Richard Henderson , devel@lists.libvirt.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Edgar E. Iglesias" , Thomas Huth , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Peter Maydell , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 13/17] target/microblaze: Introduce mo_endian() helper Date: Fri, 8 Nov 2024 15:43:13 +0000 Message-ID: <20241108154317.12129-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241108154317.12129-1-philmd@linaro.org> References: <20241108154317.12129-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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=unavailable 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é Reviewed-by: Richard Henderson --- 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 86f3c19618..0b466db694 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);