From patchwork Fri Oct 4 16:21:11 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: 13822708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2E6DCF884E for ; Fri, 4 Oct 2024 16:22:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl41-0003pB-90; Fri, 04 Oct 2024 12:21:57 -0400 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 1swl40-0003kD-0f for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:21:56 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl3x-0004IH-T7 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:21:55 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2fabe5c8c26so22485441fa.2 for ; Fri, 04 Oct 2024 09:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728058912; x=1728663712; 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=4OOxOqFJJ2HqgakCTfYbfryttytdC4aA+0dIobma124=; b=PlIFSrh0yxcgXCr7mZVxqYAKhAT3qUeLGN30iQtSfFphmadQFpOWytjUbPxsrRQWbM 82pDAMitaOC/fCLMxP7XD9JMwdQL3pBx6hYJzrNtVNxFViaEunDr7W3ZmcziMuhmWrqd w1JWpmHJnYSFziEGsXvYQl+sonDZWdQg5G8gyj1sjwL0QrBlKKUqxn3AG7Heb+MNTTPy fB6Oxwv8+Jvw7ONBGukuxMj1HkT5e0KEBcEIDUAwj81WDRucOUbL/xFoNR071DEt+jGh fGX6tn39k7ts4UBS3XUydKRpAcGuTp7jvNp3ux+cgcIITpYQetcj3VVkbIHSwtqsiYRH xGrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728058912; x=1728663712; 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=4OOxOqFJJ2HqgakCTfYbfryttytdC4aA+0dIobma124=; b=CdZPwYZGP/HnxXW79BzO+AEzEcU3iZsb9hvnyrSFFmVC+bG9kYk0CIGbLJCq60L7gg pcuP312gh9DjsRt7s4iggD3FDRnTMT9oHW7PTkEnDGrapy/oHmiCQvgUns+A6yQc3DSg reW10WGqj3Lh+oZnXqXBLLY8WTND1bq/1PnBwgsQ0Ym9oV9nXrh/HUUnzAuSnfuOEbyO AD3i1dv1eiKF8mRFnLAnRJ0ZR+bJEBbQlxXOuksxIHdxhgVg5w1yT/bFgIbElEygD4Ka vLbgP4We76BTlre+g0JRopg0H9dYohBnx7Mnb48k48i9GPI0oRd87w0W1Q/++qy/DI+J M0zQ== X-Gm-Message-State: AOJu0YzKlr8GGVnygPi0b8ki359uWrFPVjUwBl6kLp9IpthE1Fo81KiJ 2br2GRDym14kNnUpH6Akr0D8v4c/cxpSCG7g8M5sGH8WB1Vz+WKGQZyZARM7t/MPn8pP7rmSVqZ AosAq451l X-Google-Smtp-Source: AGHT+IGaFBUw3LE4B93koRr0LTRyf7pT7g3wbCUSWTVzGXSE6v03WVJje3dU/Fj+fz9bIDFLA+Ocbw== X-Received: by 2002:a05:651c:1994:b0:2fa:d296:6fbf with SMTP id 38308e7fff4ca-2faf3c1419fmr17307381fa.1.1728058911540; Fri, 04 Oct 2024 09:21:51 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b329a7sm146481fa.104.2024.10.04.09.21.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:21:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 1/8] exec/tswap: Massage target_needs_bswap() definition Date: Fri, 4 Oct 2024 13:21:11 -0300 Message-ID: <20241004162118.84570-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=philmd@linaro.org; helo=mail-lj1-x22a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Invert target_needs_bswap() comparison to match the COMPILING_PER_TARGET definition (2 lines upper). Signed-off-by: Philippe Mathieu-Daudé --- include/exec/tswap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/exec/tswap.h b/include/exec/tswap.h index b7a41913475..ecd4faef015 100644 --- a/include/exec/tswap.h +++ b/include/exec/tswap.h @@ -28,7 +28,7 @@ bool target_words_bigendian(void); #ifdef COMPILING_PER_TARGET #define target_needs_bswap() (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN) #else -#define target_needs_bswap() (target_words_bigendian() != HOST_BIG_ENDIAN) +#define target_needs_bswap() (HOST_BIG_ENDIAN != target_words_bigendian()) #endif /* COMPILING_PER_TARGET */ static inline uint16_t tswap16(uint16_t s) From patchwork Fri Oct 4 16:21:12 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: 13822710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C392CF8840 for ; Fri, 4 Oct 2024 16:22:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl4K-0004Ek-S4; Fri, 04 Oct 2024 12:22:17 -0400 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 1swl4G-00049L-0Q for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:22:13 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl4D-0004Jv-Im for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:22:11 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2facf00b0c7so30379521fa.1 for ; Fri, 04 Oct 2024 09:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728058927; x=1728663727; 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=ar5l4AIEpN89iIriQ1A0Rg6FdJgoGAMAWx9ArtF1/do=; b=Ytp0wzKTkW8NIPEum3ch5BKTIUseSEEti4EBj3Va0PjPyzOXXJoBPmz/aCffQCD0kA 9AUmpDDjj30sz3pDRGZWur0HZtaSt5J4HRvZZOvR+oog+v/tgvFbvdXKhi7N6/fA3W5B B32ke9DsYjLwb1GtCMDtnM08oo1cpf8xGqMRmgGicKna3Y6nWbzEpBGfePAT2wsECryq VsEmgIngAoDDO+dbUYA2WWBzT3GrLK8OnlZpctUYcZWmnkNq+eeUSNqUqWvt3J/g98I+ mXgHCcPOHMPgy114mnh6X/Wy1wBB10iKff14hQEw/46i2FQJZZUkyGeh81kMfIFjrwCb CYVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728058927; x=1728663727; 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=ar5l4AIEpN89iIriQ1A0Rg6FdJgoGAMAWx9ArtF1/do=; b=ZxGYrk2bQrMr8ZD7nJ4CgKZNxeTvTJ6j58FixD/HH92/evIBRBsTx7S6UHc15CLDbO +TSPHMYZa7khAYaYk25g3ynW1LxEYcjA5X9Up6TwaqHgpPBuX9bz7VjMSORFx/mF05XL hnS/Mz/SbKiO1stnrXt6gnJdlHFq0GC8z4axKNyN7hTbpGtTWgmudmAL+gCWboTV0B1O po0LEB85lVTs4z/FExY8uTJbNTWspvN8Lt6USvObqUtjHsAxgrF5wZ0DdFeofS07w5Vb zXZJ/HYDk85Txjvpk9S523Xj3vFM9vREJsvUh6w7Q1vXd8Wl9qpNqCi9WveraFcUyGHv JUrA== X-Gm-Message-State: AOJu0YywSJUg5sxywsJ/JjthjhGf/MrBr2zZOGcRtL3rRbzL+TFzrCWG SguuPsPA2a4N3lO9CCZK0IzzIrMoogJdChIKaftKblOSubMy0DN4e+3cO5+hcO0/31A4dRQ8DPY R4SlkvOBv X-Google-Smtp-Source: AGHT+IFsIuCQ7d+7+0RsX/Vd0YwJrvjoi0ry7R5LFTdLE2Ujg5gNPsFFkwQYYRLubJrzHEDme/ZBvA== X-Received: by 2002:a2e:b8c9:0:b0:2fa:cf2c:479a with SMTP id 38308e7fff4ca-2faf39f9266mr9732401fa.24.1728058927479; Fri, 04 Oct 2024 09:22:07 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9b33027sm161171fa.115.2024.10.04.09.21.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:22:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 2/8] hw/core/cpu: Introduce CPUClass::is_big_endian() handler Date: Fri, 4 Oct 2024 13:21:12 -0300 Message-ID: <20241004162118.84570-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Introduce the CPUClass::is_big_endian() handler and its common default. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 3 ++- hw/core/cpu-common.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 04e9ad49968..22ef7a44e86 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -150,6 +150,7 @@ struct CPUClass { ObjectClass *(*class_by_name)(const char *cpu_model); void (*parse_features)(const char *typename, char *str, Error **errp); + bool (*is_big_endian)(CPUState *cpu); bool (*has_work)(CPUState *cpu); int (*mmu_index)(CPUState *cpu, bool ifetch); int (*memory_rw_debug)(CPUState *cpu, vaddr addr, @@ -749,7 +750,7 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs); */ bool cpu_virtio_is_big_endian(CPUState *cpu); -#endif /* CONFIG_USER_ONLY */ +#endif /* !CONFIG_USER_ONLY */ /** * cpu_list_add: diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 7982ecd39a5..aa5ea9761e4 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -26,6 +26,7 @@ #include "qemu/main-loop.h" #include "exec/log.h" #include "exec/gdbstub.h" +#include "exec/tswap.h" #include "sysemu/tcg.h" #include "hw/boards.h" #include "hw/qdev-properties.h" @@ -138,6 +139,11 @@ static void cpu_common_reset_hold(Object *obj, ResetType type) cpu_exec_reset_hold(cpu); } +static bool cpu_common_is_big_endian(CPUState *cs) +{ + return target_words_bigendian(); +} + static bool cpu_common_has_work(CPUState *cs) { return false; @@ -306,6 +312,7 @@ static void cpu_common_class_init(ObjectClass *klass, void *data) k->parse_features = cpu_common_parse_features; k->get_arch_id = cpu_common_get_arch_id; + k->is_big_endian = cpu_common_is_big_endian; k->has_work = cpu_common_has_work; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; From patchwork Fri Oct 4 16:21: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: 13822709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04587CF8840 for ; Fri, 4 Oct 2024 16:22:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl4Z-0004vF-1a; Fri, 04 Oct 2024 12:22:31 -0400 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 1swl4W-0004r7-LV for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:22:28 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl4U-0004LK-9E for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:22:28 -0400 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2faccccbca7so21896121fa.2 for ; Fri, 04 Oct 2024 09:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728058944; x=1728663744; 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=ebEqKdyGGyobi2PRRQ6OMJlevfLMnU19pPI1rOWFDYg=; b=QeOk1omeyi60bBcIQ8fFXbIOsEtajeYXVHvNf/ZvXGDEQVqiA9e3eOVhtCuoieRgfW pXfR5ojRGVXq30WFIY+n9uUf6Q+CKPMRXd45/crn/BYmZvy2SDrgnitmImYGXGhxFuWK PQNaLNqkCyynv4VW8hyF4dIFufKKrG9qm6byjyxUD4vycaOk5KVf6B+pD+YYf46VyMkh b+K0fTw7SJqTwaWk2BU3ZgecbQ4jAiCqkybYpglqakkb9YE9VngeDzdhwuvLahHQt+4O Wrjb3jkEeUscCm12ThSFXXaI9tZ7zDHfIyQmaAI6CeVri2PkPY+2ANKEHC0mV7P0S5IG 7Wqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728058944; x=1728663744; 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=ebEqKdyGGyobi2PRRQ6OMJlevfLMnU19pPI1rOWFDYg=; b=ER0bccNMsrgkhD31HNbbX7UZQaLdPd2CKwnf4T2Pg82tC35lnGLZgEyXJTQFmUOBDB D3FyAykrFCxyZDMl7M2Q/yPAQOV5bfH3e9gkNi7/jRs8/Ljjf8WpO7sxF4y0Efiq+H/1 0j093gv59m586ymVecBfi1I8AbdZOnHVT5+OTmR7eUhcfKy1d1JmjnZThFp5bUIxB604 +EVtFh2jA/FXFVQLffV3lRCdOovWCMIcjtvNqUk9Ow3qevrTUwcadNDQLiCYiB2YJbVv R2l3kpR6LEMFVe4xOcECsz2Wsk0RnN61zJaL8WLi5a9uCNZA00EriRfw9Hg2fVqkBSmf I2Tw== X-Gm-Message-State: AOJu0Yy+TNBYA29B+EjV+iRToDMiQTGRGpeZiTsD/PdAK0i6yaVjr6qT uAezXeVzHb+aDSJMr6NsqThijJNdBgrzFRiy9LgHHUo2JULbN3IsLQAI8NPR3px7xQBVLhVHFgj mgCdJ+A== X-Google-Smtp-Source: AGHT+IHnzVu5caSnTRwtmMQBdLBYvQKhdYxM2GW+30HiKyNW0uitZ/UP7lJ7j00E/xoLoSSMEuJPAA== X-Received: by 2002:a05:651c:a0b:b0:2f7:4ccd:8918 with SMTP id 38308e7fff4ca-2faf3dac918mr20555041fa.43.1728058944270; Fri, 04 Oct 2024 09:22:24 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2faf9ac4415sm164741fa.34.2024.10.04.09.22.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:22:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 3/8] target/arm: Implement CPUClass::is_big_endian Date: Fri, 4 Oct 2024 13:21:13 -0300 Message-ID: <20241004162118.84570-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=philmd@linaro.org; helo=mail-lj1-x234.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/arm/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 19191c23918..2bb87a9299f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -122,6 +122,11 @@ void arm_restore_state_to_opc(CPUState *cs, } #endif /* CONFIG_TCG */ +static bool arm_cpu_is_big_endian(CPUState *cs) +{ + return arm_cpu_data_is_big_endian(cpu_env(cs)); +} + /* * With SCTLR_ELx.NMI == 0, IRQ with Superpriority is masked identically with * IRQ without Superpriority. Moreover, if the GIC is configured so that @@ -2692,6 +2697,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) &acc->parent_phases); cc->class_by_name = arm_cpu_class_by_name; + cc->is_big_endian = arm_cpu_is_big_endian; cc->has_work = arm_cpu_has_work; cc->mmu_index = arm_cpu_mmu_index; cc->dump_state = arm_cpu_dump_state; From patchwork Fri Oct 4 16:21:14 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: 13822712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56F86CF8840 for ; Fri, 4 Oct 2024 16:23:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl4x-0005vL-Je; Fri, 04 Oct 2024 12:22:55 -0400 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 1swl4p-0005hR-8k for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:22:49 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl4m-0004OA-4B for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:22:46 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53993564cb1so2705909e87.2 for ; Fri, 04 Oct 2024 09:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728058961; x=1728663761; 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=mLznYmz+P7vBJ8H0SWJD6m73dHSWXSUG/rbFskhTHcE=; b=aioN/uevlUgE3ioqzYydQ7BAzxp5k+EVy504y2/wi6XeF7jxiAIs1nImK/gD0g/GL0 MV3ZxhK/V+P+91NcWyphMW3u/G4zlBAZn1R/6/JmkWdW6A+wtv06tus0vNSL6pZrjPOE WCuVMJ5htETLtfziJ7/m21quSjpJOXsSPjb732v0bkYth2HOUfDuQD0Jw5UDWjW+vKqT 4bhtdDIUaBZmMS/LRksHJUqY+txsscTeGoUk5cEhb+TwOd7z4cbv3y2hoiEjcrO+TLii fiwDGKINSaHKDc5ua7ttqaT+6Mc29uvf4iX7qx6ITsYXZuBo3CaKK/jXnCAdlsba3x3p Xk+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728058961; x=1728663761; 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=mLznYmz+P7vBJ8H0SWJD6m73dHSWXSUG/rbFskhTHcE=; b=phC+rJVSaxItPDdz+gyKO0xoHBla2dOKSYoBLqMyzoPl+xrDfvkozvtmn5Igjp2brQ 8fJ1H1axXa7DB3c1AxeYOxSgkOirLM9+zZH4v1QmED4tVAIO+BF8mEcvvX24CtvX6JKv fzrSouDczXydPYwKkPPqyGud2EwkU46Gr674kthR9bu39RysTas5X08+MU7rQZWyKeHZ PPVn4rtS04gEaxbxZ8+pgqEgW9PJPzD52a/KVlnS01Sw0/8mLxcqkB86veAMTyJJJGV0 khxij0PscUTWKEzEzL/nFWHUYhq4JI2QalEXZymkQKctd7/3B6ORBZjeOJHLvqTmnFEI +ShA== X-Gm-Message-State: AOJu0Ywm+J3ICdnmMYTP4+W2goiOHpTBpD9kDxn7JEJiHVeOw/6CGyLn jVrk3HBVXdRIkUwfL2Pye31PAM52LhbM5JCZhkr8GY5vDICuEbW/BYHjj05ifXK9VK9ZBE7+KLy I9i9sYg== X-Google-Smtp-Source: AGHT+IElSimH5oZLigLV434JMwrFehY55HhLGGCMlsd7shRaPHsnstY5dok1WJ0KheoDJAapYycJIg== X-Received: by 2002:a05:6512:3d10:b0:533:4522:7409 with SMTP id 2adb3069b0e04-539ab8c2165mr2174945e87.53.1728058961531; Fri, 04 Oct 2024 09:22:41 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539a82973f7sm464073e87.120.2024.10.04.09.22.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:22:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 4/8] target/microblaze: Implement CPUClass::is_big_endian Date: Fri, 4 Oct 2024 13:21:14 -0300 Message-ID: <20241004162118.84570-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/microblaze/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 135947ee800..93c0c6d36c8 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -119,6 +119,13 @@ static bool mb_cpu_has_work(CPUState *cs) return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } +static bool mb_cpu_is_big_endian(CPUState *cs) +{ + MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); + + return !cpu->cfg.endi; +} + static int mb_cpu_mmu_index(CPUState *cs, bool ifetch) { CPUMBState *env = cpu_env(cs); @@ -433,6 +440,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) &mcc->parent_phases); cc->class_by_name = mb_cpu_class_by_name; + cc->is_big_endian = mb_cpu_is_big_endian; cc->has_work = mb_cpu_has_work; cc->mmu_index = mb_cpu_mmu_index; cc->dump_state = mb_cpu_dump_state; From patchwork Fri Oct 4 16:21:15 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: 13822711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69EDACF884E for ; Fri, 4 Oct 2024 16:23:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl5M-0006dV-CP; Fri, 04 Oct 2024 12:23:20 -0400 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 1swl57-0006MX-Ty for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:05 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl55-0004Ql-Qj for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:05 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5398ec2f3c3so3055273e87.1 for ; Fri, 04 Oct 2024 09:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728058982; x=1728663782; 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=Xgf9BvICxNs8M4a+Ynl2kNbkAd0IyBvDVaoxDWmJxpI=; b=JqwwkUTCGAS7MP+bCiTPAeoQsbHN5rRlGRKnOFwamWc0YD3U1gMoWnkDYluQ631gL/ Nn0ovlnL3rNv8k7S50/a3wsgNgtHUKLgKXb5VcX1yUP7IY/elTZhBsKl/1d07OzH9LH6 57V+NrP7bt2HRbzC5va3L4I0gvbb7gU6fc2ohPXMGx639iPiRRPzLbAcAY73c69V0bD4 EGJMoyYwCRH6oWfVuwZJHg6gJFkvV3PSgCuw0g3Hr8INVT97aygSevm9OaR2pRNHEsf0 OMzwIcDdKlF05gqPO5Zj0Vl7Q2bT2lzF9EHjpviFBAiLQfrDE3/T50P0CTsw8s7PF+9B GH6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728058982; x=1728663782; 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=Xgf9BvICxNs8M4a+Ynl2kNbkAd0IyBvDVaoxDWmJxpI=; b=gyz9Eoi4wKN27IgNlh4fO52S+aAq5qoOoW6OWSoeo+esBHerz0lKyHOwYXDXemA1xJ vfYzfyFP6q4hc55Ja5ce+LO9pQzP6j7NYHGcJLYoF86Fo8QpCP3/HBEeP1UhzjN0QY0L HV81EMCKFdNMlrLs3NE8JdRA4foY7Taay5KnO7pxYHe9ulh3O78CWX173iHrBEerqjmb jZSVWs7zQdZ5PQMsisqOteFjQDJoNO6UMGbiOIG4DoA/7MI9Obawcqv1xYukjicbztdE BsDg+1k2lHgWUA80e9PtaEdc8kFAWKefGharqQ+PkE2nGZeQGs1etJUk15h3TIH2RpeO zFdg== X-Gm-Message-State: AOJu0YzwhlmZdKOQvqsSYjwgKHEiYOd2IzqdDkMmUR+udcw88L1G1LnF hq5g8RVVwAQ6fd/o9zFQtO4nm3/w9UqyhNq2h1j/3ODbj1jSPQEC0yz8oY1RRpna1srQA+rzcoP cAbRjkQ== X-Google-Smtp-Source: AGHT+IGO5CpFc7Oka/ybHxIMXEnRPnF/3VXZLfX+84lc9+PIRpdG6uSyhdRxxxul333EJtIgaABAew== X-Received: by 2002:a05:6512:1250:b0:536:a4e1:5fa2 with SMTP id 2adb3069b0e04-539ab88cec1mr2019399e87.26.1728058981712; Fri, 04 Oct 2024 09:23:01 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec8093sm483e87.80.2024.10.04.09.22.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:23:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 5/8] target/mips: Declare mips_env_is_bigendian() in 'internal.h' Date: Fri, 4 Oct 2024 13:21:15 -0300 Message-ID: <20241004162118.84570-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In order to re-use cpu_is_bigendian(), declare it on "internal.h" after renaming it as mips_env_is_bigendian(). Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Signed-off-by: Philippe Mathieu-Daudé --- target/mips/internal.h | 5 +++++ target/mips/tcg/ldst_helper.c | 15 +++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/mips/internal.h b/target/mips/internal.h index a9a22ea00ec..84c8e5e1ae7 100644 --- a/target/mips/internal.h +++ b/target/mips/internal.h @@ -225,6 +225,11 @@ static inline void mips_env_set_pc(CPUMIPSState *env, target_ulong value) } } +static inline bool mips_env_is_bigendian(CPUMIPSState *env) +{ + return extract32(env->CP0_Config0, CP0C0_BE, 1); +} + static inline void restore_pamask(CPUMIPSState *env) { if (env->hflags & MIPS_HFLAG_ELPA) { diff --git a/target/mips/tcg/ldst_helper.c b/target/mips/tcg/ldst_helper.c index 97056d00a27..f92a923d7ad 100644 --- a/target/mips/tcg/ldst_helper.c +++ b/target/mips/tcg/ldst_helper.c @@ -53,11 +53,6 @@ HELPER_LD_ATOMIC(lld, ldq, 0x7, (target_ulong)) #endif /* !CONFIG_USER_ONLY */ -static inline bool cpu_is_bigendian(CPUMIPSState *env) -{ - return extract32(env->CP0_Config0, CP0C0_BE, 1); -} - static inline target_ulong get_lmask(CPUMIPSState *env, target_ulong value, unsigned bits) { @@ -65,7 +60,7 @@ static inline target_ulong get_lmask(CPUMIPSState *env, value &= mask; - if (!cpu_is_bigendian(env)) { + if (!mips_env_is_bigendian(env)) { value ^= mask; } @@ -76,7 +71,7 @@ void helper_swl(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 32); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)(arg1 >> 24), mem_idx, GETPC()); @@ -100,7 +95,7 @@ void helper_swr(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 32); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)arg1, mem_idx, GETPC()); @@ -130,7 +125,7 @@ void helper_sdl(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 64); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)(arg1 >> 56), mem_idx, GETPC()); @@ -174,7 +169,7 @@ void helper_sdr(CPUMIPSState *env, target_ulong arg1, target_ulong arg2, int mem_idx) { target_ulong lmask = get_lmask(env, arg2, 64); - int dir = cpu_is_bigendian(env) ? 1 : -1; + int dir = mips_env_is_bigendian(env) ? 1 : -1; cpu_stb_mmuidx_ra(env, arg2, (uint8_t)arg1, mem_idx, GETPC()); From patchwork Fri Oct 4 16:21:16 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: 13822713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80943CF884D for ; Fri, 4 Oct 2024 16:23:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl5R-00070C-Vv; Fri, 04 Oct 2024 12:23:26 -0400 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 1swl5O-0006sr-JB for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:22 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl5M-0004TR-0V for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:22 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-537a399e06dso2649118e87.1 for ; Fri, 04 Oct 2024 09:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728058998; x=1728663798; 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=8EXxbN9xNIe/fch86Xk2ysVTGoSQLunGFBZDl5pFX4s=; b=zABwxirR9zGdwUzNB/qmkeoWOcE3czRgqCE2MIUHprD3ravoGKBCjx5giPQ7RvDxH/ +7IKAzXLZi9pJ16MT3lXH0KcsqZmApWb6U/CdnCiZ9Den5F9HK+MwtGAY1YQxAlUK4H1 yt4UTmbdT4JNXlIZHHaIJquoiwaSg+yiHTDEh9Gy+P3ypCnYKA5aR7s98HvmNrz94UIw PUiz8xkyDZoFnnbBUpR4aq2/15PQOLmo5Ufhcr2zT5OMg4GYln1FPf2VDlpWYYwgsGl/ aMTwBLPaexHCXtwpDRakeYteYFjU1oqV8G4H/2A+MuFOM9oJIxnHclxJ/L02DL1pZYKA Ul8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728058998; x=1728663798; 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=8EXxbN9xNIe/fch86Xk2ysVTGoSQLunGFBZDl5pFX4s=; b=sYIwpqWIoQEawMjzgEDeDllyua54rDas9BVHIqv9QTheDcXXdHbMrpdMLQ3U4oj2eh ocAM6fnYf+OE027NzKmnn8kXcdJUTy7fKEnQ7Yyg74vgzgGmAFgTpmP9YjVaFoVSJKFl hAARZdMFbv8yDMoaBYIMT/EVL6APoj64uPSH6WtqNgxisJlCVYTwtdq+P5DAZwhoeouj RNE1hcJkW9pVlGGuD5mAhTeCPq2XN4L0ETKtIL/1/zSCv+zyH6eK3MZh+iZ8cKDt0wOz i31jKAeHxa68xmVbvDw2Jg4PrPzsjSy0mAgU8VyKOWGO+GeOEkU8Ohqp6cQz4XUysezb k4mQ== X-Gm-Message-State: AOJu0Yw/rftqwp6jJP48vcEptZYB+AMqPiDf3m1/A701aKg1Or7gJLau MJJS+UYLCszzJjJ7LBfYOQzjGCr6f9lChp6PPMgvvnbaQFScWwEep5nbQRo1mRzsTxAEVXwM+aX CGo/M6g== X-Google-Smtp-Source: AGHT+IGP7Uyh8a1ixCMHilUdIZTXQ+7/tEjRyL1vshJTHe+hR8Py7IE1VpZXDXFtgzpo7y4SOWMAzQ== X-Received: by 2002:a05:6512:33d0:b0:533:cf5a:eb32 with SMTP id 2adb3069b0e04-539ab8741c0mr2171775e87.19.1728058997637; Fri, 04 Oct 2024 09:23:17 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539a82a4f83sm458713e87.236.2024.10.04.09.23.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:23:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 6/8] target/mips: Implement CPUClass::is_big_endian Date: Fri, 4 Oct 2024 13:21:16 -0300 Message-ID: <20241004162118.84570-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 89655b1900f..ad70ad802a7 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -132,6 +132,11 @@ static vaddr mips_cpu_get_pc(CPUState *cs) return cpu->env.active_tc.PC; } +static bool mips_cpu_is_big_endian(CPUState *cs) +{ + return mips_env_is_bigendian(cpu_env(cs)); +} + static bool mips_cpu_has_work(CPUState *cs) { CPUMIPSState *env = cpu_env(cs); @@ -577,6 +582,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) &mcc->parent_phases); cc->class_by_name = mips_cpu_class_by_name; + cc->is_big_endian = mips_cpu_is_big_endian; cc->has_work = mips_cpu_has_work; cc->mmu_index = mips_cpu_mmu_index; cc->dump_state = mips_cpu_dump_state; From patchwork Fri Oct 4 16:21:17 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: 13822714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E22DCCF8840 for ; Fri, 4 Oct 2024 16:23:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl5i-0000TT-Sf; Fri, 04 Oct 2024 12:23:42 -0400 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 1swl5g-0000Og-W6 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:41 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl5e-0004WQ-Km for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:40 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5398b2f43b9so3174816e87.1 for ; Fri, 04 Oct 2024 09:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059017; x=1728663817; 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=VYw3qJQ7kjnbHLJqdL2EvLbi+7yWM9GeS/O5plTTIVE=; b=pqBa/cjCptOFwkDGGZQzF4gpmYN7wFC8jnomAVv2DL4oLcriIcfy7G+HAXf52yxtXm lw3K/iWBrjGYGHO3tKXNr/vZVBVAzueIJnzW8gEx/Dn8O3Z9oHA7X/4ly3Urdq4n8wza 8qje07EuTqqsN4hzM8R2oZ3Chqb+HgP8mSx26kv6dyZfnX48Puv4UwxU+vpKfuz0J1uR TIyJCCmfkINaN3Tn2XIBvxqIkIT4YKqCSsTKbNNbwmt9mx5/8eKRfMmvM7wunDHosaxD ItiJtmyWREecYNKPNaM4LUzS4Dl1iK5/OoEtkYa41mbhwrxEpXOCrumZikohWKXEwjBb B95w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059017; x=1728663817; 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=VYw3qJQ7kjnbHLJqdL2EvLbi+7yWM9GeS/O5plTTIVE=; b=JnWgz13CxxuA/f9MbT7bMd3aKGO3KpWnCUe7KRYuEjVlEAX3vjfQty4QPDk/jaG84g lsnwQlN75nKdCCvjmJO/iLDoLQg70JSuCAOf1+Ffd9guyVZS1NRg6lweFpgg4fx8eG2a mX3gXZawDc/ipcB435uUSvxWaGUT/w4faHMMFz2C519si5V+/NGSbUAmO6Jp9Na6fK3H BDK1hBwpRzeWlmNZ99N8SRjDOhZE3Pd7LV02cAiJUq8UFtjMT3sUlBMGkIvwlwCo99K9 ReuT3USkfbXcIK3H/0juDjs67nJ2S1uOVD88csOa/K12HDA2iF/+Uw7vYsWgEqk55yGh T8uA== X-Gm-Message-State: AOJu0YznormquyWWPz3HDn0hZtUJGX7bv87+TPTcs37nIgedoGFMfrgj WTS7sGJ9pjhy2SuCIpBXg8bHl04/zyYY0zs/NrNTdQ2FAugJtrvDCpatyEEQ0WCD2ZhxljW+XtQ E2g0oug== X-Google-Smtp-Source: AGHT+IEKurLqbxv67rMnOvrLmRo5/uDd4/TXW2NXlMq21DozZSL7E8WXl5bpdYXFcpUGPQkpldPYcw== X-Received: by 2002:a05:6512:6c6:b0:539:9155:e8cb with SMTP id 2adb3069b0e04-539ac0a9e01mr1184983e87.0.1728059016567; Fri, 04 Oct 2024 09:23:36 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539a82a4f83sm458760e87.236.2024.10.04.09.23.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:23:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 7/8] target/ppc: Register CPUClass::is_big_endian Date: Fri, 4 Oct 2024 13:21:17 -0300 Message-ID: <20241004162118.84570-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-lf1-x12a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23881d09e9f..39ec290cdc0 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7341,8 +7341,6 @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type) #endif } -#ifndef CONFIG_USER_ONLY - static bool ppc_cpu_is_big_endian(CPUState *cs) { cpu_synchronize_state(cs); @@ -7350,6 +7348,8 @@ static bool ppc_cpu_is_big_endian(CPUState *cs) return !FIELD_EX64(cpu_env(cs)->msr, MSR, LE); } +#ifndef CONFIG_USER_ONLY + static bool ppc_get_irq_stats(InterruptStatsProvider *obj, uint64_t **irq_counts, unsigned int *nb_irqs) { @@ -7515,6 +7515,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) &pcc->parent_phases); cc->class_by_name = ppc_cpu_class_by_name; + cc->is_big_endian = ppc_cpu_is_big_endian; cc->has_work = ppc_cpu_has_work; cc->mmu_index = ppc_cpu_mmu_index; cc->dump_state = ppc_cpu_dump_state; From patchwork Fri Oct 4 16:21:18 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: 13822715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74F30CF884D for ; Fri, 4 Oct 2024 16:24:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swl6B-00012W-CP; Fri, 04 Oct 2024 12:24:11 -0400 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 1swl60-0000vM-LG for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:24:02 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swl5w-0004Xv-Cu for qemu-devel@nongnu.org; Fri, 04 Oct 2024 12:23:58 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5366fd6fdf1so3343835e87.0 for ; Fri, 04 Oct 2024 09:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728059033; x=1728663833; 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=Nhw11vsNB7sU+tP522HMuXKhN8uIssw/t+jNogdyCDQ=; b=JSCsNJ4/h4mDFcEIhn6sh/a5cHlTQB0CClsvKocKhtPvyhyblvIgqCujFye5hkL9lC P4HGffO9jgJf/A3qRR+AUliJMiJ1vvDTpBAEEpO4bJy8DgfTUAMMi3M3aiOkwy8wkNlJ T6XDK2shCOscBdQjIaeBIzFTLvig6SBCHKtqdTEmn3q3cmjpDN/LqrPoJp9VCf1nsE0r JmbEM1eq6FynZsw93quaNYNC1jDTPNfIPHSunCwGpbTFZB5bKjHZnehhxtLWk6Wp5145 F66b2OaScIJ3gzd4NvFlEBWVMPF5jENLCZZaE7oYbi0tM1lm79ULgYTDppaJWmWhBs5K S1FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728059033; x=1728663833; 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=Nhw11vsNB7sU+tP522HMuXKhN8uIssw/t+jNogdyCDQ=; b=ZM2bfjzkD46huaIEwicHi+Wk2+PpuGQisohq9bwM1ZMAMj5+8Czia5VKPi8ZzEVej5 3Z416jimIIS/AAi5A6lprCUH++uBtPJsLgW6PFiqEA1tRuA0a8rf/YjMo0WZvbm+uRw6 mpFOcIM2/OcIwuV0dZb+ZANEF+9K2xVEjBp30OJY5CoWey6ZK6nBN5jS/ye3UKAd99um Wz9E5yq4xyjzGBlCD2K/PWknfr1Xif6eFvk7uoY+g3KRU30CXgC00i+z6ExyicDaAm57 aN8EcS4fd8FFwWhpcBmQG3WTcflogdmT1LdnBXomloj/W0c8WW1iwQltVGgmXWnJ/pgx YZmA== X-Gm-Message-State: AOJu0YxxYpNtOnUo+l9PSamYjp4CUAJO4N1jtS4F3URGmiv9sQpzu0RR x+EeSk9wQik6UnJfscsL5+G98VB522BgCsEzgH8jBjuhKg2UF6LrKSH7DdJA8AKX7LdrxuGpnE8 9urJKmQ== X-Google-Smtp-Source: AGHT+IHWTTiAZOwthxRrD0LHwYIRgQaHTbQjlLwjBS4Gzn+++9wvg+ZcwP4Fw3jRdEsMVW1LFfnmoQ== X-Received: by 2002:a05:6512:a96:b0:52c:8979:9627 with SMTP id 2adb3069b0e04-539ab84a43cmr2465175e87.3.1728059033509; Fri, 04 Oct 2024 09:23:53 -0700 (PDT) Received: from localhost.localdomain ([91.223.100.208]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-539afec83efsm684e87.75.2024.10.04.09.23.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Oct 2024 09:23:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Eduardo Habkost , Yanan Wang , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Marcel Apfelbaum , Aleksandar Rikalo , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Nicholas Piggin , qemu-arm@nongnu.org, Zhao Liu , Peter Maydell , Jiaxun Yang Subject: [PATCH 8/8] hw/core/cpu: Expose cpu_is_big_endian() method Date: Fri, 4 Oct 2024 13:21:18 -0300 Message-ID: <20241004162118.84570-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241004162118.84570-1-philmd@linaro.org> References: <20241004162118.84570-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 22ef7a44e86..2550bc98dee 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -608,6 +608,14 @@ extern __thread CPUState *current_cpu; extern bool mttcg_enabled; #define qemu_tcg_mttcg_enabled() (mttcg_enabled) +/** + * cpu_is_big_endian: + * @cpu: The CPU whose state is to be inspected. + * + * Returns: %true if the CPU runs in big endianness, %false otherwise. + */ +bool cpu_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 aa5ea9761e4..277c4ee6720 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_is_big_endian(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + return cc->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)