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 F1B67EB7ED5 for ; Wed, 4 Mar 2026 11:47:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxkhB-0007VA-Ml; Wed, 04 Mar 2026 06:47:17 -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 1vxkh9-0007Ur-R9 for qemu-devel@nongnu.org; Wed, 04 Mar 2026 06:47:15 -0500 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxkh8-0000BJ-0T for qemu-devel@nongnu.org; Wed, 04 Mar 2026 06:47:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=Content-Type:MIME-Version:Message-ID:Subject:From:Date:From :Subject; bh=VgKu0AFQK3TSs5iVFfLlM/mtQw8G5qXKb386ZCubW7o=; b=TZAw5CEu0+bH296A gaWT1E3j14tQuyB0Jsh4lJaivlXxcsXIdb9mfvWwKwUOXZ2xQ3Ka1o9TsvVkAbUxHbUCRZYzZEuLt qK7mkapUKI1ePkL7VVva+EJqlbBq0K7V5Kf3ZqNhwvkASFnD3aXoXvQKdtXXx4pKjZsi7xWe+64gL 7sK3NDuHSP8x8vpJEpFA1sdMyvNgxlhTprWfnk7EQifb+ZK/IPybv4zdG6hgxdAOh1QzsTPqC172V rZ9tVO3cpxrDqyzTMcvArnq24IwELM7wB4X0usYjK6t+iqNddG+1/v1A8v/t+7jb5LUlm7vqrUDoU JXL309VgiZ3Iv9cATw==; Received: from dg by mx.treblig.org with local (Exim 4.98.2) (envelope-from ) id 1vxkh3-000000075in-36ns; Wed, 04 Mar 2026 11:47:09 +0000 Date: Wed, 4 Mar 2026 11:47:09 +0000 From: "Dr. David Alan Gilbert" To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: qemu-devel@nongnu.org Subject: Re: [PULL 02/16] target/alpha: Use explicit little-endian LD/ST API Message-ID: References: <20260202212019.94205-1-philmd@linaro.org> <20260202212019.94205-3-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Chocolate: 70 percent or better cocoa solids preferably X-Operating-System: Linux/6.12.48+deb13-amd64 (x86_64) X-Uptime: 11:46:31 up 128 days, 11:22, 3 users, load average: 0.03, 0.02, 0.00 User-Agent: Mutt/2.2.13 (2024-03-09) Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dg@treblig.org; helo=mx.treblig.org 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, 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: qemu development 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 * Philippe Mathieu-Daudé (philmd@linaro.org) wrote: > On 1/3/26 15:51, Dr. David Alan Gilbert wrote: > > * Philippe Mathieu-Daudé (philmd@linaro.org) wrote: > > > The Alpha architecture uses little endianness. Directly > > > > Wasn't there one, odd case of the T3E running it big-endian? > > (I have no idea how that worked in practice). > > Richard said it was not necessary to mention it in the code: > https://lore.kernel.org/qemu-devel/20260106155755.53646-7-philmd@linaro.org/ > https://lore.kernel.org/qemu-devel/75b13774-93f3-45db-bc1a-5b8687fcb3b9@linaro.org/ > > I could have mentioned it here in the commit description > for clarity but didn't think about it... Ah right, didn't spot that review. Thanks for the reply, Dave > > > > Dave > > > > > use the little-endian LD/ST API. > > > > > > Mechanical change running: > > > > > > $ for a in uw w l q; do \ > > > sed -i -e "s/ld${a}_p(/ld${a}_le_p(/" \ > > > $(git grep -wlE '(ld|st)u?[wlq]_p' target/alpha/); > > > done > > > > > > Signed-off-by: Philippe Mathieu-Daudé > > > Reviewed-by: Manos Pitsidianakis > > > Reviewed-by: Richard Henderson > > > Message-Id: <20251224160040.88612-2-philmd@linaro.org> > > > --- > > > target/alpha/helper.c | 11 ++++++----- > > > 1 file changed, 6 insertions(+), 5 deletions(-) > > > > > > diff --git a/target/alpha/helper.c b/target/alpha/helper.c > > > index a9af52a928f..80542cb0665 100644 > > > --- a/target/alpha/helper.c > > > +++ b/target/alpha/helper.c > > > @@ -214,17 +214,18 @@ static int get_physical_address(CPUAlphaState *env, target_ulong addr, > > > pt = env->ptbr; > > > - /* TODO: rather than using ldq_phys() to read the page table we should > > > + /* > > > + * TODO: rather than using ldq_phys_le() to read the page table we should > > > * use address_space_ldq() so that we can handle the case when > > > * the page table read gives a bus fault, rather than ignoring it. > > > - * For the existing code the zero data that ldq_phys will return for > > > + * For the existing code the zero data that ldq_phys_le will return for > > > * an access to invalid memory will result in our treating the page > > > * table as invalid, which may even be the right behaviour. > > > */ > > > /* L1 page table read. */ > > > index = (addr >> (TARGET_PAGE_BITS + 20)) & 0x3ff; > > > - L1pte = ldq_phys(cs->as, pt + index*8); > > > + L1pte = ldq_phys_le(cs->as, pt + index * 8); > > > if (unlikely((L1pte & PTE_VALID) == 0)) { > > > ret = MM_K_TNV; > > > @@ -237,7 +238,7 @@ static int get_physical_address(CPUAlphaState *env, target_ulong addr, > > > /* L2 page table read. */ > > > index = (addr >> (TARGET_PAGE_BITS + 10)) & 0x3ff; > > > - L2pte = ldq_phys(cs->as, pt + index*8); > > > + L2pte = ldq_phys_le(cs->as, pt + index * 8); > > > if (unlikely((L2pte & PTE_VALID) == 0)) { > > > ret = MM_K_TNV; > > > @@ -250,7 +251,7 @@ static int get_physical_address(CPUAlphaState *env, target_ulong addr, > > > /* L3 page table read. */ > > > index = (addr >> TARGET_PAGE_BITS) & 0x3ff; > > > - L3pte = ldq_phys(cs->as, pt + index*8); > > > + L3pte = ldq_phys_le(cs->as, pt + index * 8); > > > phys = L3pte >> 32 << TARGET_PAGE_BITS; > > > if (unlikely((L3pte & PTE_VALID) == 0)) { > > > -- > > > 2.52.0 > > > > > > > -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/