From patchwork Tue Dec 12 12:33:51 2023 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: 753076 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1876992wrs; Tue, 12 Dec 2023 04:39:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHHdKZEpi1tOFoeh0wdDY6lm7Qivba56Wpi8hb5zn1HmY4YLO2sQb7ct57jCB7uRAmgmL1 X-Received: by 2002:a05:6808:229f:b0:3ba:57:1a0b with SMTP id bo31-20020a056808229f00b003ba00571a0bmr5307564oib.7.1702384740084; Tue, 12 Dec 2023 04:39:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702384740; cv=none; d=google.com; s=arc-20160816; b=bdrT5i04zuynzgECJX+SET5xpSRyISJ0UXG9obrM2pRPsjfjDet6BZIYcj/i1T/eWM bsd8bR3fGx+7eYyYJm+TBtIVF/7eYIP+D3/yG86CEEmZp1zjBNr3mNGAea64VeOC789K hQNIsZU1XBXxWodh/ucUp43uD8T/PGGCX9ONxkFpeXZ+VSe+BJHwe5jmgT9uf2inU3Da jaK4YaXv2ABrPgpjDBg2O5JyHoDpczltblG+VJD8Zm8oiHX0QmcumV6trxDXRVNvQDre 0+q+sJSu1mGtJHZK2hwyIKjRvPU7488LY3SvtK/Bemm7vSpHbRNqNTVUaoGnPSymW7zw YUKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=LKqz8+rrRr+9OnCGqaF5kY8vCRVBvOcgtedefIMaXhg=; fh=zFh10cOfJXxh05dYupUjqn/R0oZQPEp3aMoWWRcpFb0=; b=p8VJ0OrT11OpeBUOU43U/rYVlKoor/pPUPiwvT9L8wki5vsh3MeO1l9iR9XqtxAis9 DPBTfEEjpB78PpULa3rpiBVVtwelRIpLUA44ZGYfaY6G68Xnt9m3PBMaugGTKx/qJHIs 3WydC30Abf5tvXcu/S7GS7bNsqEJ7efJ2e1x5foVTsr7GubRGackakxS2aXuW2NnR50M jMnwu5meaWaI9x2Ym3GULkqV9kDjy6iOQVHqEFYGsH39WEertK3/XGIdzaFD5HKsh+y4 Cf7Wg2LpynU9r41EmBoJOq8CEc7I+STm8WYVdmUmtJ/d6Bnly05HZqygiAAxu8B2tPBe LSYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IonMcDD8; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id lw8-20020a05621457c800b0067ef0ab47cfsi323034qvb.551.2023.12.12.04.38.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 04:39:00 -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=IonMcDD8; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD1zm-0002Sn-Vi; Tue, 12 Dec 2023 07:36:19 -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 1rD1za-0001jr-2t for qemu-devel@nongnu.org; Tue, 12 Dec 2023 07:36:07 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD1zN-00085f-Cc for qemu-devel@nongnu.org; Tue, 12 Dec 2023 07:36:05 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-54c5ed26cf6so7251848a12.3 for ; Tue, 12 Dec 2023 04:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702384552; x=1702989352; 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=LKqz8+rrRr+9OnCGqaF5kY8vCRVBvOcgtedefIMaXhg=; b=IonMcDD8GhQ6pJqSAkb/nEnrvUBJk63z5LQINYdN9qYVneL975pvvNghLKHq9sg8dO xXEPizksj2nIzx4PIsV5tRBZRdyaVbKhcLZJr9LvL4G9mZNLOiJ+3v7o84drEoZ79Ge0 qtC0Jh1Gu6apUJGQ1lhs5jD26VedMcKljERswgoR7qMlAK+7rF7OtX9h19iFLG2gFmp5 2Fms/VigDuY05qMge/8GNnYsYBkoSq0bxiFUinBsg6eqZ5GTXwJMEpHlienN1+krOAu+ lQv/szPA/cC6IzqG25Rs9LwIXMYpo7mpz2aBYcYOQKatAfTLX/c1AeFnPiBjMelfF4AG t/+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702384552; x=1702989352; 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=LKqz8+rrRr+9OnCGqaF5kY8vCRVBvOcgtedefIMaXhg=; b=w8jo83vPsCcQT/svnkkq2XeWqjdpttqGvBfTmTYq64+riUaJpCUQ4QSiKamylvCp+8 5kmtXCZ8BP28QGF3mhpzeX8U/4XANmRdonPAogDk8WBIfbwiA35JCmCHzcKjoZb3GF3A ZdYIMB5BB5NRNTwF77rwDMeWwuhlUZ7OxZqb34DyNwBn98mUzhhcVETEbSPlmzwT9RFU nwfDptXhsYi46GBkGaUzrRaQtQFIGCG09zWGh4rEIhnkeJFqV4aH89xA4aqN+tdhoaHR QNohJMAN1GXP7SbtHxDnCjojL3pR+pKZLw19bkM/zKq4LpmiPt04duhj5jh7esbES4Q/ hPhg== X-Gm-Message-State: AOJu0Yy74f6U4Ddfcnf8oOjmOOkKwurw2M+ZkbghDyGv7/ZREd6T1iRw hOUJ8H18LlllKOP8zqUUpvz9ryNApZsxS5iqHP9lRA== X-Received: by 2002:a50:9515:0:b0:54c:6386:a1a3 with SMTP id u21-20020a509515000000b0054c6386a1a3mr3554851eda.15.1702384551619; Tue, 12 Dec 2023 04:35:51 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id n8-20020a50cc48000000b0054c9df4317dsm4657860edi.7.2023.12.12.04.35.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 04:35:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Claudio Fontana , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Richard Henderson , qemu-riscv@nongnu.org, Brian Cain , Thomas Huth , Paolo Bonzini , qemu-arm@nongnu.org, Manos Pitsidianakis , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , Warner Losh , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , "Michael S. Tsirkin" , Alistair Francis , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PATCH v2 15/23] exec: Declare target_words_bigendian() in 'exec/tswap.h' Date: Tue, 12 Dec 2023 13:33:51 +0100 Message-ID: <20231212123401.37493-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231212123401.37493-1-philmd@linaro.org> References: <20231212123401.37493-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=no 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 We usually check target endianess before swapping values, so target_words_bigendian() declaration makes sense in "exec/tswap.h" with the target swapping helpers. Remove "hw/core/cpu.h" when it was only included to get the target_words_bigendian() declaration. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson --- include/exec/tswap.h | 12 +++++++++++- include/hw/core/cpu.h | 11 ----------- cpu-target.c | 1 + disas/disas.c | 1 + hw/audio/virtio-snd.c | 2 +- hw/core/cpu-sysemu.c | 2 +- hw/core/generic-loader.c | 2 +- hw/display/vga.c | 2 +- hw/virtio/virtio.c | 1 + 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/exec/tswap.h b/include/exec/tswap.h index 68944a880b..77954bbc2b 100644 --- a/include/exec/tswap.h +++ b/include/exec/tswap.h @@ -8,9 +8,19 @@ #ifndef TSWAP_H #define TSWAP_H -#include "hw/core/cpu.h" #include "qemu/bswap.h" +/** + * target_words_bigendian: + * Returns true if the (default) endianness of the target is big endian, + * false otherwise. Note that in target-specific code, you can use + * TARGET_BIG_ENDIAN directly instead. On the other hand, common + * code should normally never need to know about the endianness of the + * target, so please do *not* use this function unless you know very well + * what you are doing! + */ +bool target_words_bigendian(void); + /* * If we're in target-specific code, we can hard-code the swapping * condition, otherwise we have to do (slower) run-time checks. diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 3208b938f7..d6b077da71 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1153,17 +1153,6 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); void cpu_exec_reset_hold(CPUState *cpu); -/** - * target_words_bigendian: - * Returns true if the (default) endianness of the target is big endian, - * false otherwise. Note that in target-specific code, you can use - * TARGET_BIG_ENDIAN directly instead. On the other hand, common - * code should normally never need to know about the endianness of the - * target, so please do *not* use this function unless you know very well - * what you are doing! - */ -bool target_words_bigendian(void); - const char *target_name(void); void page_size_init(void); diff --git a/cpu-target.c b/cpu-target.c index 997ca2e846..4c1e19ca81 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -33,6 +33,7 @@ #endif #include "sysemu/cpus.h" #include "sysemu/tcg.h" +#include "exec/tswap.h" #include "exec/replay-core.h" #include "exec/cpu-common.h" #include "exec/exec-all.h" diff --git a/disas/disas.c b/disas/disas.c index 0d2d06c2ec..89a1e7d767 100644 --- a/disas/disas.c +++ b/disas/disas.c @@ -6,6 +6,7 @@ #include "disas/disas.h" #include "disas/capstone.h" #include "hw/core/cpu.h" +#include "exec/tswap.h" #include "exec/memory.h" /* Filled in by elfload.c. Simplistic, but will do for now. */ diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 137fa77a01..a80f23aa71 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -20,11 +20,11 @@ #include "qemu/log.h" #include "qemu/error-report.h" #include "include/qemu/lockable.h" +#include "exec/tswap.h" #include "sysemu/runstate.h" #include "trace.h" #include "qapi/error.h" #include "hw/audio/virtio-snd.h" -#include "hw/core/cpu.h" #define VIRTIO_SOUND_VM_VERSION 1 #define VIRTIO_SOUND_JACK_DEFAULT 0 diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index d0d6a910f9..2a9a2a4eb5 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -20,7 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "hw/core/cpu.h" +#include "exec/tswap.h" #include "hw/core/sysemu-cpu-ops.h" bool cpu_paging_enabled(const CPUState *cpu) diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index d4b5c501d8..ea8628b892 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -31,7 +31,7 @@ */ #include "qemu/osdep.h" -#include "hw/core/cpu.h" +#include "exec/tswap.h" #include "sysemu/dma.h" #include "sysemu/reset.h" #include "hw/boards.h" diff --git a/hw/display/vga.c b/hw/display/vga.c index 37557c3442..d11a30a785 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -26,7 +26,7 @@ #include "qemu/units.h" #include "sysemu/reset.h" #include "qapi/error.h" -#include "hw/core/cpu.h" +#include "exec/tswap.h" #include "hw/display/vga.h" #include "hw/i386/x86.h" #include "hw/pci/pci.h" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 3a160f86ed..28dc1f4c15 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -20,6 +20,7 @@ #include "qemu/log.h" #include "qemu/main-loop.h" #include "qemu/module.h" +#include "exec/tswap.h" #include "qom/object_interfaces.h" #include "hw/core/cpu.h" #include "hw/virtio/virtio.h"