From patchwork Wed Dec 4 20:25:50 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: 847320 Delivered-To: patch@linaro.org Received: by 2002:a5d:434d:0:b0:385:e875:8a9e with SMTP id u13csp528745wrr; Wed, 4 Dec 2024 12:27:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUaZzuqA2zw3ix/EerFC2eg+32vVeRolZqcjiQfdB/hunRjnJU5UqgeA8YShNGGE/OyWKXdxA==@linaro.org X-Google-Smtp-Source: AGHT+IE+sccKri/+1DyIxwNogMSsiHrQhwS7vAstP5MVdyFEIdjKxUVhMnM9xB90ilaYHFeBxHZJ X-Received: by 2002:a05:620a:1a26:b0:7b1:5143:8d9e with SMTP id af79cd13be357-7b6a61cbff2mr906803185a.47.1733344070155; Wed, 04 Dec 2024 12:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733344070; cv=none; d=google.com; s=arc-20240605; b=dR5ruUddBjlu5GTFchhRXRRfPtXZoxAl9Yn2T1wwzsxqxd2syreQVRLO/8w1Tipf78 PWONs7FbIq/crdWJDdlkB8iyAkde6kNL9lDtC7EaSMat8SOCVnMIlwEFhg2+6XxaoMNM vorD5fStltr6lKTALROWXjfKiqfpvPwApZRK/R5xjTJH0PFoNuk91tCq8hMYyeTZ+qUk vwFoBTidEDfcbcoBJOWvABPyO4L92pnBezTXkzVUjIJh/Tbc8IQHhnOFMCiiZv+n6mgG kyqlRU0G8vm5ND4bXFN/Ugw3nZo6NdfDWOg/MMkIoc0XJy09nPv6UeBZ9s04SSD9IYrc wm/g== 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=IbFwYvNsoagTIF3RGxGTKY4/+lkaBIKwukflDbrm8ec=; fh=L8jp5KII9BO+EuE1/Uny/8be6w87XhXr9oO98kXieYU=; b=GWLcXAFe7hDSdI5V2brKepL1ao7b0oI26qSv1LeKrf9BTf6WMgyAu2P0mxftfhDKYn jiR6Tc/nTYswsEY06M9lCig7T3Zj+MZQBM0aV2ohj+Zhpp9K+dt5eOeebWH1syQHzSCA Wnquk3z7tvSV/J4l2Xn2oy4WdG9VeekDf4Vp3JCinMqLtVjp4KqO6tqvurRdlHtB56fW ty7gJmpdjIYV9hO1fU57GJnIlbJTWlpf91cWB8XR7znpdmRr9RF634QRSJf3siHDMTL7 4zLAyW+tHkGzv3tJkOmkiStSr1CH1eP99m+eereOVqcW0NRFvG8HWEQi4JJ0OXWN+Lwv pMaQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oHBrfr6S; 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-466c4225feesi168207631cf.379.2024.12.04.12.27.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Dec 2024 12:27:50 -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=oHBrfr6S; 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 1tIvy9-0000Os-Nc; Wed, 04 Dec 2024 15:27:33 -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 1tIvy6-0000HO-AW for qemu-devel@nongnu.org; Wed, 04 Dec 2024 15:27:30 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tIvy3-0008Rs-Q9 for qemu-devel@nongnu.org; Wed, 04 Dec 2024 15:27:30 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43494a20379so1934995e9.0 for ; Wed, 04 Dec 2024 12:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733344046; x=1733948846; 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=IbFwYvNsoagTIF3RGxGTKY4/+lkaBIKwukflDbrm8ec=; b=oHBrfr6SsSMQbt/j6NX5wd20ZGGqyEI5YuWHRMKKgBYkc0pio5Ce00gY3VLUJ89gQg U/JzuvVTUwha3wWQYqXdi5UGPO6B3x/zd8IactEvSvybmy+gx9HtW37JODkuvmfFB/DD x5emvj/G3Z/QBlpQ2/AwWWC9svvg5P7Sh4bwQXrguY3AHGPSEFGJ2iskLwb6+3tQfqqK 4PHBDLYlWUZwlYSG/Dg7SiA3GlpL3VSYW+UZew1nlBfCsKo3tBLwov1jpl5Ero4ycld9 CFdhacWsEtPLMOFx7TaiG4DJM3KaVfOv5OnOtvOoyQlanmG/u99jDmUvg+q4fKPK9meQ h1+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733344046; x=1733948846; 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=IbFwYvNsoagTIF3RGxGTKY4/+lkaBIKwukflDbrm8ec=; b=eLqnO3v4113ewNYwfGqKRb8Rx8K7CnYPm1TBCB//WAdsIF4Q01wpU+OyJCKcGIEEBZ T+Ve5LNEmnMwpF/jkOgu0d4o1qCe3WIPV+RXkW7J5eVMbRXjGbhPAUDga94AsIqEqJnV zNwuKNRsLpB8S2+u1iC7VEwyEsbCO3D4jevPDeRUjR/ueypcpmi3062lUwzCPrtar1td hgr3JcmAwzvcBsFBSVKPX+I5mEj2QFX0/OhJHGSGQCWSPYa5SK7679uh0MG7nB5dSD/R BVsSo42tgRGZpNoFYpBweWthikZiPo3S2Y7wicBY94B01n6d5YxiupFYLihQM4prgv35 24MQ== X-Gm-Message-State: AOJu0Yzgq90g+CvJhLtwYx2LTJ0wng8FgHwzSzBORy9Uh9D116BOinib oW4Kd3D9WCsqAz2smduTwyvRz8Up0kmFhPGkK9H/Fv+ITXqpJzvHQ/2PGNvvxcwqGMrbMYuIp8B t X-Gm-Gg: ASbGncuVojNYhdfDqYe0m8C91MBJqPK6g2W+yYBf3BnfIC01dhwwAWo2HYas3k8xuVs LzSDVfMVVLWsEtBqoSylgVXJhbR68p9lqqgUICroT1ykcTu7aE2gAAS67ZKSw0r0whfIURwJwEw ywGohKDMylH6NLXUk0P5d1pjNLQdE/SNOARKX4POLHoXSVyy/s7LhqHKxwck7aP95dSbb+j8wZe RM+9ed2AJP7qc6DvRc9GeX8MOxM9VnfYHbz82ibN9JHHjepMSxBaDIfa94Zpn6PZIZW1lwVEehk SR0Qgdjecht3F/3haYPETxIh X-Received: by 2002:a05:600c:3594:b0:434:a7e3:db56 with SMTP id 5b1f17b1804b1-434d09abf4emr70062685e9.6.1733344046119; Wed, 04 Dec 2024 12:27:26 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d5272b78sm34941055e9.9.2024.12.04.12.27.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Dec 2024 12:27:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , "Michael S. Tsirkin" , Peter Maydell , Laurent Vivier , Mark Cave-Ayland , Alistair Francis , Anton Johansson , Zhao Liu , "Edgar E. Iglesias" , David Hildenbrand , qemu-s390x@nongnu.org, Max Filippov , Paolo Bonzini , Nicholas Piggin , qemu-arm@nongnu.org, Thomas Huth , qemu-riscv@nongnu.org, Alistair Francis , qemu-ppc@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 08/20] target/sh4: Expose CPUSH4State::little_endian property Date: Wed, 4 Dec 2024 21:25:50 +0100 Message-ID: <20241204202602.58083-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241204202602.58083-1-philmd@linaro.org> References: <20241204202602.58083-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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 SH4 CPUs endianness is set with an external pin in a power-on reset. Signed-off-by: Philippe Mathieu-Daudé --- target/sh4/cpu.h | 6 ++++++ target/sh4/cpu.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index d928bcf0067..2502ddba102 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -198,6 +198,12 @@ typedef struct CPUArchState { /* Fields from here on are preserved over CPU reset. */ int id; /* CPU model */ + /* + * The endian is set with an external pin in a power-on reset. + * The endian cannot be changed dynamically. + */ + bool little_endian; + /* The features that we should emulate. See sh_features above. */ uint32_t features; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 8f07261dcfd..f54005644c9 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -23,6 +23,7 @@ #include "qapi/error.h" #include "qemu/qemu-print.h" #include "cpu.h" +#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "exec/exec-all.h" #include "fpu/softfloat-helpers.h" @@ -231,6 +232,12 @@ static void superh_cpu_initfn(Object *obj) env->movcal_backup_tail = &(env->movcal_backup); } +static Property superh_cpu_properties[] = { + DEFINE_PROP_BOOL("little-endian", SuperHCPU, + env.little_endian, !TARGET_BIG_ENDIAN), + DEFINE_PROP_END_OF_LIST(), +}; + #ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_sh_cpu = { .name = "cpu", @@ -270,6 +277,7 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) device_class_set_parent_realize(dc, superh_cpu_realizefn, &scc->parent_realize); + device_class_set_props(dc, superh_cpu_properties); resettable_class_set_parent_phases(rc, NULL, superh_cpu_reset_hold, NULL, &scc->parent_phases);