From patchwork Wed Dec 4 20:25:58 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: 847336 Delivered-To: patch@linaro.org Received: by 2002:a5d:434d:0:b0:385:e875:8a9e with SMTP id u13csp530534wrr; Wed, 4 Dec 2024 12:32:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWLjunwHMJvfoaxgiMVRMawTEhZm6iHDWnpjsTILJtCEoHi86xnfkK/mK0BmDCKVxbCXNlIuQ==@linaro.org X-Google-Smtp-Source: AGHT+IGq+A5xky2BE1EDEgEheLFpbKEtnLUpfqMDJW1x79+2r4eIPcxkEehJODguxosUudmkCrFE X-Received: by 2002:a05:6871:3a2a:b0:29e:34ef:bd7d with SMTP id 586e51a60fabf-29e885632d6mr9125746fac.2.1733344353600; Wed, 04 Dec 2024 12:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733344353; cv=none; d=google.com; s=arc-20240605; b=BudwVkS6mxcJjOVyl1Z77w2ajL/nrzT1VJIsiKjy0oCmdGVprWxuz5x3oOrulOFb6m EoXDEDigaZwXwB8f57kg0yCTPBInuF0sBY4F9phe2DhQYoltFckydOPqOidowAjdn0oK W1GYtInYV6xnb1SdoCFi+Y7V+Epvycih/MPnSSqRQRXtyd5KEG9kyf8lE8je12LG3wf0 PPmpsnpua6zWOFXkx/FV4g4xn1Dw4PKddHKtU73rzm+r0ywpVLWlfFsrFkPo80Po6G57 BI7gBrxDO8o3fnD5uOV5G02RnPMi5Z0/bxD5C3PZ1K4s44cSz61p48JoYFITHtdlXEvt UtTw== 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=GX0z7ED1fpqqEX0e3FNGIrRnTBaZqIcam5D8KFO/APw=; fh=L8jp5KII9BO+EuE1/Uny/8be6w87XhXr9oO98kXieYU=; b=eD0ikZwaFs71t2v73CAjJ45MQrhl/NvYbedAKSXYajTIl8N+cFBPw+PQqawdFPtmcQ XOKAt4/Kk6Ph7xgF47T8s/0VKKDH3vpHun9ne3yrNq9kg8MZkx4piuO3uz0Tx3yiVuI3 iESqwGHLCjMZnSYiOWVlWtI+15nJJ43BGFGx9fDLt4+Dnt9tGiV/g6w8/t2vX+LUXCZB kSZgbSx3Go2AwQ9zt8juYSPcSXx7z+5ZbzaThHBcHx3JNqmhrgyWk5IJKdzfFwaKQ0MD PyVfrqMrsMAH4ghkPapP8URWP4wA3buvL22uDKE6fFyoJ6VdQqdv4lFo4wj1aVV9F1NA GEKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TRTYqHQE; 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 af79cd13be357-7b6849d7e95si2026838885a.498.2024.12.04.12.32.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Dec 2024 12:32:33 -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=TRTYqHQE; 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 1tIvyv-0002hf-39; Wed, 04 Dec 2024 15:28:21 -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 1tIvyp-0002ND-9e for qemu-devel@nongnu.org; Wed, 04 Dec 2024 15:28:15 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tIvyn-0002cw-Jq for qemu-devel@nongnu.org; Wed, 04 Dec 2024 15:28:15 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4349e1467fbso1393715e9.1 for ; Wed, 04 Dec 2024 12:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733344089; x=1733948889; 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=GX0z7ED1fpqqEX0e3FNGIrRnTBaZqIcam5D8KFO/APw=; b=TRTYqHQEIK04Y6ULZP4l0E5gbUgQjjF3PfhBSTltnjGYwpC/JHV4jAcApQSmXyCJCA W2zIRLb4VCipt856iw/ACgg71gUSPRwWnHC1+Tx4zFDQduIl98eO4zTbUOeazaEXemCW 4GSC/z5Sb46hTUkXyFbux52R0A9C4G8gk3Us45PaI4kpvQGIw8QJ1aK0m2PL9AYBj1pL J4MnDOsCtfS+GEk+m9/D0yx8wMazQlltqJfRMXxiFxFKKczrhCbvqAUu+XsLsTrHVWRL V6J4tFj9LWGNYLslLXxIvGiyHk9cJDPzKJ/kQgCnJh0EJhP/Tfgn4X97F0/fpA1eGWi7 SEaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733344089; x=1733948889; 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=GX0z7ED1fpqqEX0e3FNGIrRnTBaZqIcam5D8KFO/APw=; b=KmGuC4JZbcuWWhwwf59UaZwqa77BRgV7XNkxcSdo/Qzj7JD29xaH7J4iKpzP1Fn1j2 qhJNelo/OxsCM7oC5Hlb5/O6JnQZJZLJMLPFf2orLSWV6/T7VMyR3wo1lvMk7oaKwVzP zT0f+lE7Cc2/UXnZrMhzPB0628Roy8WrQLtZ+8x8zPvDOc4Md7WItmLlAX6kMg5JeBpz GuwZeXVcf6+0na+iJKUuv5Nospw/FiblPIZI9ECprS/+wRbgdtJuTSOZq61dznI2fq+N HNt/Q2M4NJQYOoF70EowCtT3lvPTNIF8miuIJjJNtTbL0Y7wDyibkbksDdnBqm2o98kF 2vlw== X-Gm-Message-State: AOJu0Yz5/EjUoVC6UysOrMPhSeBcGdDvI/TE9ktci9fLRCHrHnpybzgF IgPdO1/mqpZ6lCr0uocLUP0YxgHbTYs7Wn3HB//ZJ1AQZqgNyqedHpiSii6TJ2rdIdjH1dYwyaR C X-Gm-Gg: ASbGncvPH2h/HskpUMJmDGeu0dSohlHePZk5ozxnC09L4k+eraRbEvFafzFuAM6vN5G /nS/teTENSgMLuF1neXsoILJtusC0G9TJxnJ9zlB1oGcpotT+6+2TfNQPG+fLrKKRvM7bLRTVix IK7NSRM7zuYuO1qYxITBM/ZZRF5QMDaduhqggylAPliUtZkXZowu1SJxXE2WXAZEaZ4SXTTBdJC HeWaCktN6MghFPsXz6hjmEkIraA4sfmr6RJX9fI81jWmcdy7y6EN+iL8VLL+CySrpwUJ/7mZa+B Hx0+2bGuRqpxqgzC8c50gA3C X-Received: by 2002:a05:600c:19d1:b0:434:a4a9:5d54 with SMTP id 5b1f17b1804b1-434d09bf794mr77784015e9.10.1733344089220; Wed, 04 Dec 2024 12:28:09 -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-434d52c0cfdsm36598115e9.33.2024.12.04.12.28.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Dec 2024 12:28:08 -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 16/20] hw/core/cpu: Expose cpu_datapath_is_big_endian() method Date: Wed, 4 Dec 2024 21:25:58 +0100 Message-ID: <20241204202602.58083-17-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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 All target implement their CPUClass::datapath_is_big_endian() helper, we can expose the generic cpu_datapath_is_big_endian() method. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 8 ++++++++ hw/core/cpu-common.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 91c6581f814..5c75fe3a842 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -611,6 +611,14 @@ extern __thread CPUState *current_cpu; extern bool mttcg_enabled; #define qemu_tcg_mttcg_enabled() (mttcg_enabled) +/** + * cpu_datapath_is_big_endian: + * @cpu: The CPU whose state is to be inspected. + * + * Returns: %true if the CPU access data in big endian order, %false otherwise. + */ +bool cpu_datapath_is_big_endian(CPUState *cpu); + /** * cpu_paging_enabled: * @cpu: The CPU whose state is to be inspected. diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 09c79035949..92c0c4c6125 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -66,6 +66,13 @@ CPUState *cpu_create(const char *typename) return cpu; } +bool cpu_datapath_is_big_endian(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + return cc->datapath_is_big_endian(cpu); +} + /* Resetting the IRQ comes from across the code base so we take the * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask)