From patchwork Wed Mar 5 15:39:21 2025 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: 870560 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:178f:b0:38f:210b:807b with SMTP id e15csp849411wrg; Wed, 5 Mar 2025 07:41:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWKH2K2kHrG6g+6fuQdEeGhOwKKTfagtDceoP1U77E+OqJqt5rh7DHM5z2ab+B1STpLs011eg==@linaro.org X-Google-Smtp-Source: AGHT+IFTZmtWcPznv5vg/hrA/icrKEUuVvX/FmwPwEJpjpzTgoo10egVlNjA7FKhnnXs/UjuSIWz X-Received: by 2002:a05:6214:2526:b0:6e4:4331:aae6 with SMTP id 6a1803df08f44-6e8e6d1ec58mr51986156d6.39.1741189271644; Wed, 05 Mar 2025 07:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741189271; cv=none; d=google.com; s=arc-20240605; b=SzDe8QKzzgsvmXNsJt+LuTP8vJ5JV3IQewUGQqJbA0CmDINSKpmkIAEGt9S8mwr8yV fj2BLAtW1CaCL90K0e8FqBSq+zVOh2DyfQvptuURc8riz51Z4f3Cb0ayAJ12gmY3qNhE iwG4RIuRsv/Iq535RDK1BPHvo2Ax4SCvAtqCzA0xf5FiyLXNKrx20xSB5xc7o2SPDEwC nbtj5gvgjaDJmARu2FVJtMPu6DMvPv92Rp5VdV0kYmq5mCkGQEhgbCA0/jFDCXnX3/Da afM1CC9EalvqVcCB4+FOMAXtzwzmE7drPkfcUJQgKXVVpHraAK842VFA+PtDS0GrEYBg a4BA== 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=h75Q8oFB88c1KxlztseXVkazErFGK1NRT/MtbJI0cyg=; fh=iYS+U9AiAK/hVpJiag4U+eV/XPHIFc9y9I+tcL8yyYE=; b=RPzQgaXakP4gnebQUiDeeObx4+Raj8EoFSjrtaNCwPUhjmi5VoruOGhbyymvSagvlq OR1PviVUCTH7UEYucktd6NRUF9sYd66i/pnbeuwqpKuKZknNZqWjSTOqYch9dIzReVrD f+GIh0qsPZR+j1pKzBD4pD3vOBpE5pnM3IeFWPnPm5LvOCq+TbOlLwQnN84ghhAL8MNB LBvcQi6UPQ2eBlP3c67/JID+tusN9YtqDDq2MTuQvycJf5pUpgd4D2P7EHSZ9EpII9kr uq/JE8Bu3rW+cHxYN57Gv8IacdLqww9Yk7FGoc0b/9cfEdk3r7F4KFXK/W7cZnDluuVV 04vA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CqqxoSQB; 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 6a1803df08f44-6e8977020fbsi129377256d6.498.2025.03.05.07.41.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Mar 2025 07:41:11 -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=CqqxoSQB; 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 1tpqrS-0000Z0-Hw; Wed, 05 Mar 2025 10:40:42 -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 1tpqrF-0000Fe-EJ for qemu-devel@nongnu.org; Wed, 05 Mar 2025 10:40:31 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tpqrD-0002Yw-Dy for qemu-devel@nongnu.org; Wed, 05 Mar 2025 10:40:28 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-38a25d4b9d4so4199817f8f.0 for ; Wed, 05 Mar 2025 07:40:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741189225; x=1741794025; 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=h75Q8oFB88c1KxlztseXVkazErFGK1NRT/MtbJI0cyg=; b=CqqxoSQBo2gAujJYVlE9bT4K1R5IVnfaGIpvyn+fU11FMflWA6FkxGQlJgzGX2ZehC hG+iBBAEpVdRwVcwaOHEV6yehNxNkfJv4NpUzPVAXO7jEPqj24yt4QeEKXD/nH9CXWul Q9BBLJh7MAVn+KRJd88XHXTyC7UOIUlZJW4SCQEusVQt0QdEbDR732W/biXpDnHIGbYi SObWxLDuOGcghisjYGj60y0DnyIG6A3/ONlf09nL5g19H6PvH+DXR/5bg2CyYzDh06Uf SgjoN1UKwFQf6GoBA6k2IArCgj0UMkSGTC3ul+jZwCcZBxLZwzqTEKME1xyvmtHZzI4E 07QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741189225; x=1741794025; 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=h75Q8oFB88c1KxlztseXVkazErFGK1NRT/MtbJI0cyg=; b=MZ+VvvFLMYIVD9C/Tj9Dc7/FsfR4VqMIPc7NFF2C6KwQJikw4M7v6l+xBupZjfsJpt P+D7ySHq21CArkoybKque/+rDMo/MAze8NcIece/y4H/Zt3UVPfiMXQC2cQ78OUdfrXh Qm2wNVbIykUUIJlddYR+yMcsSZDG12kqH1jwq0KwhLG0HnGmuwrg1uBG9G64Cmmr3e+e UFGtuTEz7yRw1x/zebyx+za78ln5L0xjE7V5dwFOk/T1gbTMmgae35hrC5pO6+ExnzK6 yTPGyMqD4OqvvQgeWG94QzjYQDKj49LHA0Tz8FwSsJoCzEfjIjBA3cAj4CjMY7e0pMNK teMw== X-Gm-Message-State: AOJu0YxSjURCaLNWoXUGEJsYMWagH/1ZaPIwfKoMbDKqJfZj+MsoQEgF 4PaY0VZM14ysom0pE2NneqC6BZTISG9FOpnNdgAirYRaggUR97wASko1wupZuQpMhHBVFCyOPpE S4AE= X-Gm-Gg: ASbGncu9ULweRO+zZL74CsEPBCrw6d3kN1XInXK8rQ+bf23uf5hyg9MiqRlQZg2hnAL AGES5zc4MsoKl4/e/xy1hO2wXuIvNk2ci6zjon26JawZrmwvtcsy1dARGKX8TngnDb6+MI2jF/R KZZuvsI13nRQ8mJeXhQe6W+T5M6WTCXY70xMOAQMFn6kRMlivVnBYusssZyq3Aa/E101GCWQLGq E20lIs9ecgurKSKhpa+FotGaZ//vn0yf+IIeOtsa2TYP0i4rRFlaiJDMQ9ylenOwot6dnvDIWuE sgrsagvaFy7cYhibimKeMbSCeuXCsbeo1631/IvLjbfY39gifXbpOtFOUBryq18GgbBFpHzRPtY hFT1q1ZlqcwGy9zOUfB0= X-Received: by 2002:a05:6000:2cf:b0:391:6fd:bb8a with SMTP id ffacd0b85a97d-3911f740597mr3342520f8f.14.1741189224730; Wed, 05 Mar 2025 07:40:24 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-391288b54cbsm243197f8f.28.2025.03.05.07.40.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Mar 2025 07:40:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , Richard Henderson , Pierrick Bouvier , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [RFC PATCH 11/18] hw/mips/jazz: Replace TARGET_BIG_ENDIAN by legacy_binary_is_big_endian Date: Wed, 5 Mar 2025 16:39:21 +0100 Message-ID: <20250305153929.43687-12-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250305153929.43687-1-philmd@linaro.org> References: <20250305153929.43687-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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=ham 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 For legacy binaries, legacy_binary_is_big_endian() is equivalent of the compile time TARGET_BIG_ENDIAN definition. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/jazz.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 1700c3765de..b6f7565f6c5 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qemu/datadir.h" +#include "qemu/legacy_binary_info.h" #include "hw/clock.h" #include "hw/mips/mips.h" #include "hw/intc/i8259.h" @@ -59,12 +60,6 @@ enum jazz_model_e { JAZZ_PICA61, }; -#if TARGET_BIG_ENDIAN -#define BIOS_FILENAME "mips_bios.bin" -#else -#define BIOS_FILENAME "mipsel_bios.bin" -#endif - static void main_cpu_reset(void *opaque) { MIPSCPU *cpu = opaque; @@ -120,7 +115,8 @@ static const MemoryRegionOps dma_dummy_ops = { }; static void mips_jazz_init_net(IOMMUMemoryRegion *rc4030_dma_mr, - DeviceState *rc4030, MemoryRegion *dp8393x_prom) + DeviceState *rc4030, MemoryRegion *dp8393x_prom, + bool is_big_endian) { DeviceState *dev; SysBusDevice *sysbus; @@ -136,7 +132,7 @@ static void mips_jazz_init_net(IOMMUMemoryRegion *rc4030_dma_mr, dev = qdev_new("dp8393x"); qdev_set_nic_properties(dev, nd); qdev_prop_set_uint8(dev, "it_shift", 2); - qdev_prop_set_bit(dev, "big_endian", TARGET_BIG_ENDIAN); + qdev_prop_set_bit(dev, "big_endian", is_big_endian); object_property_set_link(OBJECT(dev), "dma_mr", OBJECT(rc4030_dma_mr), &error_abort); sysbus = SYS_BUS_DEVICE(dev); @@ -194,6 +190,9 @@ static void mips_jazz_init(MachineState *machine, MemoryRegion *bios2 = g_new(MemoryRegion, 1); SysBusESPState *sysbus_esp; ESPState *esp; + bool is_big_endian = legacy_binary_is_big_endian(); + const char *default_bios_filename = is_big_endian ? "mips_bios.bin" + : "mipsel_bios.bin"; static const struct { unsigned freq_hz; unsigned pll_mult; @@ -212,8 +211,7 @@ static void mips_jazz_init(MachineState *machine, * ext_clk[jazz_model].pll_mult); /* init CPUs */ - cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk, - TARGET_BIG_ENDIAN); + cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk, is_big_endian); env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); @@ -245,7 +243,8 @@ static void mips_jazz_init(MachineState *machine, memory_region_add_subregion(address_space, 0xfff00000LL, bios2); /* load the BIOS image. */ - filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: BIOS_FILENAME); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware + ?: default_bios_filename); if (filename) { bios_size = load_image_targphys(filename, 0xfff00000LL, MAGNUM_BIOS_SIZE); @@ -329,7 +328,7 @@ static void mips_jazz_init(MachineState *machine, } /* Network controller */ - mips_jazz_init_net(rc4030_dma_mr, rc4030, dp8393x_prom); + mips_jazz_init_net(rc4030_dma_mr, rc4030, dp8393x_prom, is_big_endian); /* SCSI adapter */ dev = qdev_new(TYPE_SYSBUS_ESP);