From patchwork Mon Sep 30 12:53:21 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: 1990973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=y0cfUEHL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XHLby6zKSz1xsc for ; Mon, 30 Sep 2024 22:53:50 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svFuB-0007KG-2A; Mon, 30 Sep 2024 08:53:35 -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 1svFu9-0007EC-MJ for qemu-ppc@nongnu.org; Mon, 30 Sep 2024 08:53:33 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svFu8-0006WS-57 for qemu-ppc@nongnu.org; Mon, 30 Sep 2024 08:53:33 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-37ccfbbd467so2515618f8f.0 for ; Mon, 30 Sep 2024 05:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700810; x=1728305610; 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=rooDbjFBHfskknaRJcxcqLhZU7vMreorn+2suTNR1/M=; b=y0cfUEHL5Ooc9asoLqL1bUV7dh49poavofxCK6bhWNMeBqIW/ShyaIQat6vXd85NDb W5YnuRg2mxY40Zqk8RvzZhbCIygtquH61uyfGuTU7JhTBQOxPEptyVvQHUPrOgvalaV7 r/i+BqfraHzavvdUTNBfep+pi0juEH89pyuUukosqVy1mpHUvq6sSlHMH/IcgCAyNllZ iKHbsJLko2B3vM9GjruGproeFC+ibhONtmri1KZAyAhP0Xdf+GJ6VYrNQ5WSgLzNMcHj EoSpwhlbKU0BtdaZo+OBiqYvE4o8Vv50vQJTCYqg3AgCYbWuoveuJH+YWVA2pq1QjLNh Dg0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700810; x=1728305610; 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=rooDbjFBHfskknaRJcxcqLhZU7vMreorn+2suTNR1/M=; b=kUI31EdwV4Q7PO6wcnB4uTIuZUEgylcwI4CmyY20TrvA9wZOxljF+3MPFzMhJI8Ssw dHaY/ksC6feBeqYd+NYNFB4E8otR9knwFRdpwrBf96xaa5a1vySfx4JofE1mU77fVN3N r9/UXzA/g2nY1QD/+R1QCnQOTF0ZmUCj0LLGNdCV4uvFWzhDzHsKBm9VTNBxWZVp7s/Q VF+Sim2op8B4dsfJb97FVDl+MdZqG0hajDEa/59dQojcIbAonuLuuUXKwM9x1V/IYnpL SLv07LcAEhMU64AwLgHR4xUkxcRPcxuSg+sa+S7F+LTJobRysI/DKD6J0FsDHos1e7BW 4bVA== X-Forwarded-Encrypted: i=1; AJvYcCWnlXxPM5w70UntgHaG5/9wylGm1PNTEPQ9ixVlqaIM3CDSVfRRUs/axlUhM4KXZuItVroSgnEiCQ==@nongnu.org X-Gm-Message-State: AOJu0YxyZJfZWAmNNDiSbJU1m6RXtwFJtTaSV7lxgpcs2Am6ruYMJJ2U Cs7eh+JwHPF4DjOhG1SW7avDYlvWlU6//WkP67sQOFN/KgBfC5/B9z3K6WklmCU= X-Google-Smtp-Source: AGHT+IEW8YNikHY5Y4sAcKNQBup7VdcwTIwyAD1x6agouxae3hdwz/Zzb5hqpckP/lZ/7Zz/oUhmBw== X-Received: by 2002:adf:f60f:0:b0:374:b5fc:d31a with SMTP id ffacd0b85a97d-37cd5aaf0dcmr6187060f8f.25.1727700810335; Mon, 30 Sep 2024 05:53:30 -0700 (PDT) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd564d35bsm9034905f8f.21.2024.09.30.05.53.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 05:53:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Daniel Henrique Barboza , BALATON Zoltan , Nicholas Piggin , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/3] target/ppc: Expose ppc_cpu_is_big_endian() prototype in 'cpu.h' Date: Mon, 30 Sep 2024 14:53:21 +0200 Message-ID: <20240930125323.54671-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930125323.54671-1-philmd@linaro.org> References: <20240930125323.54671-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Expose ppc_cpu_is_big_endian() so it can be used by hw/ code. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/cpu.h | 2 ++ target/ppc/cpu_init.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 321ed2da75..4a4911502d 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -3007,6 +3007,8 @@ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv) return ile; } + +bool ppc_cpu_is_big_endian(CPUState *cs); #endif void dump_mmu(CPUPPCState *env); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23881d09e9..00e0a8bf2c 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7343,7 +7343,7 @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type) #ifndef CONFIG_USER_ONLY -static bool ppc_cpu_is_big_endian(CPUState *cs) +bool ppc_cpu_is_big_endian(CPUState *cs) { cpu_synchronize_state(cs); From patchwork Mon Sep 30 12:53:22 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: 1990972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=HNdzUcD4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XHLbv5Lf7z1xsc for ; Mon, 30 Sep 2024 22:53:47 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svFuF-0007Za-2M; Mon, 30 Sep 2024 08:53:39 -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 1svFuD-0007Uu-W4 for qemu-ppc@nongnu.org; Mon, 30 Sep 2024 08:53:38 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svFuC-0006Wr-GS for qemu-ppc@nongnu.org; Mon, 30 Sep 2024 08:53:37 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-37cd0b5515fso2115231f8f.2 for ; Mon, 30 Sep 2024 05:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700815; x=1728305615; 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=A54AZmXL2K4S/evyBU6Z+PuWbfLne3N1JrnXSUgIbU0=; b=HNdzUcD4gvsy9Ns/BR8ooXmFkvlNx2q/oMMNsz/qSsu8GHRUYoRpcOMeWUn3dXXHQg mf5piQpj5tuMcvWOOSkRl3340++lJ0d9DB4jrpXjoc9XgTl/Ni/5jvRCEllMWUeiUFoZ git3ZKWz1ipwDJCx02EGRNtZIWYTpiG4cFknajZr+fKpxkz7s4j56E/JeLoh7QGReEVx FlcWjyHVAeRkFCBYrj/1oW3awCmXhAxhqziwp5Xov8qaFA4HrDhr1SafPuCHmu5R8/Zp xxk6slTEBm9N2DqO/2sPPof9dk7tBrwHPV00HB7xtCgovrsbueZAWaBLTQotMwXvWgmI 3UmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700815; x=1728305615; 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=A54AZmXL2K4S/evyBU6Z+PuWbfLne3N1JrnXSUgIbU0=; b=XIVxiVrU1uUAPrUM37huYmybgM2g97Fc0vCuEdXeBdBaDAY6aTQgTpqbZ3pNq2bPY2 dgXzP23UhNi4yNkmdBSYwtM0U862LybJCJkQ+T4kd2WGZyhyxzZ8hDy4UT4tWCf3FNCB 1GkCIQaJ1NBPlq6eqiYBOdxnsCToHcxRohbshiAjMpOLU9KwjQAqkNFHahYcr60B9CHY xRgVj32EbTCQkSTEX5rMmzgX3yRZTAuwonG2XWtcTahWHKFi/oVIlbMPkyBIQqorsOKz 1Xu13e3nUhcAkg5LvpMc0an2ErnkCWGbtJw/ZTkb1s1RHK+B5whhrUzpTswMUvVCpiae sn1w== X-Forwarded-Encrypted: i=1; AJvYcCWF9lVEvdVz1t2oxPrPhiiXwkVMeWbFXRDT4grEDRvp5WWTci/CZOmKPscWQnYe91v3v1uaxyqaKA==@nongnu.org X-Gm-Message-State: AOJu0Ywe9G661uQKlnyWrbP0I+TOVZtgYGC1Wi/69T1/ieQ0mnS/PJNf eOmCQC61055XN2fFUwnqumD7fzbUK5ObgJ9tYqP123Ou6u55wpohvg+jZA8P25SQonkCJvrjP8b P1Ts= X-Google-Smtp-Source: AGHT+IG6FA1okpu2QB/TxZQl+zaSrG3+73s6gMHVvjez1IzAcrSzTh3/M3PoQrnOI32cQeogUZ+Dig== X-Received: by 2002:adf:f1ce:0:b0:371:82ec:206f with SMTP id ffacd0b85a97d-37cd5aa9c14mr6128167f8f.16.1727700815008; Mon, 30 Sep 2024 05:53:35 -0700 (PDT) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd57450c7sm8943227f8f.101.2024.09.30.05.53.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 05:53:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Daniel Henrique Barboza , BALATON Zoltan , Nicholas Piggin , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/3] hw/ppc/sam460ex: Replace tswap32() by stl_endian_p() Date: Mon, 30 Sep 2024 14:53:22 +0200 Message-ID: <20240930125323.54671-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930125323.54671-1-philmd@linaro.org> References: <20240930125323.54671-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Replace the target-specific tswap32() call by stl_endian_p() which does the same but takes the endianness as argument, thus is target-agnostic. Get the vCPU endianness calling ppc_cpu_is_big_endian(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/sam460ex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 8dc75fb9f0..6257ddbec6 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -248,10 +248,11 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env, static void main_cpu_reset(void *opaque) { PowerPCCPU *cpu = opaque; + CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; struct boot_info *bi = env->load_info; - cpu_reset(CPU(cpu)); + cpu_reset(cs); /* either we have a kernel to boot or we jump to U-Boot */ if (bi->entry != UBOOT_ENTRY) { @@ -261,7 +262,7 @@ static void main_cpu_reset(void *opaque) /* Create a mapping for the kernel. */ mmubooke_create_initial_mapping(env, 0, 0); - env->gpr[6] = tswap32(EPAPR_MAGIC); + stl_endian_p(ppc_cpu_is_big_endian(cs), &env->gpr[6], EPAPR_MAGIC); env->gpr[7] = (16 * MiB) - 8; /* bi->ima_size; */ } else { From patchwork Mon Sep 30 12:53:23 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: 1990977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=i3VM0qHD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XHLcg21kVz1xsc for ; Mon, 30 Sep 2024 22:54:27 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svFuI-0007oW-V1; Mon, 30 Sep 2024 08:53: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 1svFuI-0007mT-Fk for qemu-ppc@nongnu.org; Mon, 30 Sep 2024 08:53:42 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1svFuG-0006XH-W6 for qemu-ppc@nongnu.org; Mon, 30 Sep 2024 08:53:42 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37ce9644daaso747109f8f.3 for ; Mon, 30 Sep 2024 05:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727700819; x=1728305619; 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=Gtv6IX/KV3JKuyckPwlUPbMBU1EPVCs+bl/6v1epcQg=; b=i3VM0qHDQ8Wzpow6zGMOrnoaOKnOGjXReO7NPUhYO1fqCAQPTLwcR8TvPIscWk2YAL U2+xtfTUaKSR83F+s/gt/rFE07001rb4CWsfk/AIYI7CN/BJjRjEe5eT2Uhw003A8Maq 1Pb6f9JXScG5LTsB3pF8/UJ0F5TWHlIUqtS+AuiptIEmIgPwRJMluJCDNIhBIiOCYOew aSOLODDs6gShLWcfJU3B22rWhMOJncJ4KHjCiMIXVm9AYJngw+G/ikrcT3FUSPS4pmKE uiTtvt+erbmY5MoItpSr0qq6lYzv4fBwafISh2tMLV5yJfGSuJvNcV9aFw6DvACtlTvG EBAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727700819; x=1728305619; 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=Gtv6IX/KV3JKuyckPwlUPbMBU1EPVCs+bl/6v1epcQg=; b=rBxGwj91IcdC3DLdD+3n0BYiDe8VpuSgL3N159AXM3YJsjqbbzacseXMLaBZiWELBN oyZYGnzcCJsbSjQK6pyCHQn+D6Gz/KRB86U2DrSU946SvJbmwwlatb5HDTXP0Dswutwq +Sfc4MrBmDCYBYg+IbiKLr++PCpTBIDg+4HItE2meCd9gO/bT+a2W4ZkFZBNUW1/cb2m 8PU9Cm74jGTj0wyBTi6ZrmOefdnq2fO/TDPrjXqFkwDGWqyJGnsSwIp4BBvf1vWgywVM kSahA9hdLdyHXlgmUsrVCyo0k9TqboYDlLnVvwIKk1skTMMZeo/MuBgv8redQ2r8e2At 7avw== X-Forwarded-Encrypted: i=1; AJvYcCUrEp7We3OFFNftgHuSj0Tjsa+rrNz49Uv//jmbRLjnjTxFA5y/56cBGa3qDDy2rL4moPOpahpD3w==@nongnu.org X-Gm-Message-State: AOJu0YxD8xwBK2X/rvOWRvZIK44OO6uYEt1YRzTyS0gwBpdKsfWocb5D sQomIItkII2N2qxcBKgfy0Pz/fcjujZDSUa3xWmc/yvnyXvLuaiX6F3qhfhOHS4= X-Google-Smtp-Source: AGHT+IGvlyMVD8GqdUuXqC7ZuTDpdqn6SoaisFx8JGE/Rxou76lyPx6d2syn+uUCOCW350lIfgVirA== X-Received: by 2002:a5d:4d0e:0:b0:374:cbe8:6f43 with SMTP id ffacd0b85a97d-37cd5a9c921mr6466471f8f.33.1727700819587; Mon, 30 Sep 2024 05:53:39 -0700 (PDT) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd56e6547sm9077147f8f.58.2024.09.30.05.53.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Sep 2024 05:53:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Daniel Henrique Barboza , BALATON Zoltan , Nicholas Piggin , "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/3] hw/ppc/virtex_ml507: Replace tswap32() by stl_endian_p() Date: Mon, 30 Sep 2024 14:53:23 +0200 Message-ID: <20240930125323.54671-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930125323.54671-1-philmd@linaro.org> References: <20240930125323.54671-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Replace the target-specific tswap32() call by stl_endian_p() which does the same but takes the endianness as argument, thus is target-agnostic. Get the vCPU endianness calling ppc_cpu_is_big_endian(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/virtex_ml507.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index c49da1f46f..135dcbde06 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -141,7 +141,7 @@ static void main_cpu_reset(void *opaque) /* Create a mapping for the kernel. */ mmubooke_create_initial_mapping(env, 0, 0); - env->gpr[6] = tswap32(EPAPR_MAGIC); + stl_endian_p(ppc_cpu_is_big_endian(CPU(cpu)), &env->gpr[6], EPAPR_MAGIC); env->gpr[7] = bi->ima_size; }