From mboxrd@z Thu Jan 1 00:00:00 1970 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 423C3C4332F for ; Tue, 13 Dec 2022 16:28:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p588J-0002my-Kg; Tue, 13 Dec 2022 11:27:55 -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 1p588E-0002kW-IC for qemu-devel@nongnu.org; Tue, 13 Dec 2022 11:27:53 -0500 Received: from mail-ot1-x330.google.com ([2607:f8b0: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 1p588B-0000br-Gv for qemu-devel@nongnu.org; Tue, 13 Dec 2022 11:27:50 -0500 Received: by mail-ot1-x330.google.com with SMTP id l8-20020a056830054800b006705fd35eceso142890otb.12 for ; Tue, 13 Dec 2022 08:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/oMA+z00Yw19B/Cul8IeNaINjwJ1SCer6liwMab+nsM=; b=ewQ5LxezpxJAB2m1ksaGJtzd5kpUg+nh//lXQo7PNwYyfXdnQ1ZwTy7jknLprxh9Rn dQpa68hWHKRMeUvlFCvZp/8L1F/hc82kaDy7O3cibZvJFIva5jSuZcXjZWUi45ZPnOkG fkncDL/wRR3a2is5wx6x6G6tGIxWM7VBXXdAjAEItVMcuSiM0hE6rcxmmRnJogPKgJXr 0m4H+K6u9aM/kQiKjVYE43QdSB1EomqzNiFW+d+J2onUt9BYzWwF3G/gzWnax9fhQKls qqD0VS1P6Aqq6aLtfhTrZBbQmCiQ6LsGgRGDt21y+vIFi1HwGuZ1QQWTl9X66dV8Bz4m 2HfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/oMA+z00Yw19B/Cul8IeNaINjwJ1SCer6liwMab+nsM=; b=cws9BgA9mmxSwL1uCPgeNkllPn+zItQPG3Exi5bEoIOOklV9hsF6urXUP+4s5ocRvc IKs8qCEqnFU53uNjPKJlrKADx3lHaxFGKkHspQrAPKuS/X9gQilAH0gXcnwYzJNuIob9 4hYir5qS58hjHfZqV0sEedMhFcB/mQCLmWO9cEBMk6jBNofyRVrgIv6jeMb+cV4uilKs zfopcm53YXQx0X7nHMMuNbonG4oZbIQv6RhN29u3dSapo3L6zAFlsxRwpi+k8vrH2m5/ hwEV7DtooTmhlAF8qzM/YlCn5QdbgdHzlRcgAlt5S7XmNrWnIOkohQyyt5sIJ0wRSHSG JuTQ== X-Gm-Message-State: ANoB5pnvWyaSW1eOQjCF4A2/4DzSu9dwqheaQ4frn8BvWp/dbcj3RJnj hjj3CfyvH1dbT7ouDEIXxF4q6A== X-Google-Smtp-Source: AA0mqf4bUBNp8VKszMMkYf4/flL3vsYNf0SBOhkGZZeY/vokVqYz0t9j9xhdQLOpPWBiDUnH4QC5UQ== X-Received: by 2002:a05:6830:2a05:b0:66b:b674:5a5b with SMTP id y5-20020a0568302a0500b0066bb6745a5bmr11202969otu.21.1670948864753; Tue, 13 Dec 2022 08:27:44 -0800 (PST) Received: from ?IPV6:2806:102e:18:2efc:c63:85ed:4256:8ad0? ([2806:102e:18:2efc:c63:85ed:4256:8ad0]) by smtp.gmail.com with ESMTPSA id q5-20020a9d7c85000000b00670763270fcsm1321216otn.71.2022.12.13.08.27.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Dec 2022 08:27:44 -0800 (PST) Message-ID: Date: Tue, 13 Dec 2022 10:27:41 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32() Content-Language: en-US To: Peter Maydell Cc: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org, Daniel Henrique Barboza , BALATON Zoltan , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Alistair Francis , David Gibson , Jason Wang , =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Greg Kurz , qemu-arm@nongnu.org, "Edgar E. Iglesias" , qemu-ppc@nongnu.org References: <20221213125218.39868-1-philmd@linaro.org> <20221213125218.39868-2-philmd@linaro.org> <8d47b826-2011-3203-c682-aa32a76b8dc2@linaro.org> From: Richard Henderson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-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, NICE_REPLY_A=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 12/13/22 10:21, Peter Maydell wrote: > On Tue, 13 Dec 2022 at 16:14, Richard Henderson > wrote: >> >> On 12/13/22 10:10, Philippe Mathieu-Daudé wrote: >>> On 13/12/22 17:00, Richard Henderson wrote: >>>> On 12/13/22 06:52, Philippe Mathieu-Daudé wrote: >>>>> Assuming the developers of commits 2c50e26efd ("powerpc: Add >>>>> a virtex5 ml507 refdesign board") and 4b387f9ee1 ("ppc: Add >>>>> aCube Sam460ex board") were testing on a little-endian setup, >>>>> they meant to use const_le32() instead of tswap32() here, >>>>> since tswap32() depends on the host endianness. >>>> >>>> tswap depends on target endianness. >>> >>> Yes, it depends on both host/target endianness. What I meant >>> is we shouldn't have system code depending on host endianness. >> >> It compares host vs target endianness, to determine if a swap is needed. But the real >> dependency is target endianness. > > It does seem odd, though. We have a value in host endianness > (the EPAPR_MAGIC constant, which is host-endian by virtue of > being a C constant). But we're storing it to env->gpr[], which > is to say the CPUPPCState general purpose register array. Isn't > that array *also* kept in host endianness order? Yes indeed. > If so, then the right thing here is "don't swap at all", So it would seem... > i.e. just "env->gpr[6] = EPAPR_MAGIC;". But that would imply > that the current code is setting the wrong value for the GPR > on little-endian hosts, which seems a bit unlikely... ... unless this board has only been tested on matching hosts. r~