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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42323C4332F for ; Sat, 15 Oct 2022 20:28:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C830E84ECA; Sat, 15 Oct 2022 22:27:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="CprRsgf2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ECE1C8039E; Sat, 15 Oct 2022 22:27:55 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 596C384E2A for ; Sat, 15 Oct 2022 22:27:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1665865672; bh=J/6RI4KH6HAe2L2nDvJDch2ZqZQmml4u7PQJOjTrgvE=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=CprRsgf23/clBTK5BEV8JkazysmeCYq+iBwfyFUmqN2J4iXKVZb5VS88buWI4i5kE AtxkxBfromqq3dPQXW+tE54ekAf/Tqv4qNPJqvOZuVmiwfpqKf8ai7MiKFsorhdstd gAJJ7wvxJHW7UZzp9DO1ryq33mYFXL8WjVy8e+Ro= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.94] ([84.118.157.2]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mq2jC-1pVnhq0Rog-00n5vD; Sat, 15 Oct 2022 22:27:52 +0200 Message-ID: Date: Sat, 15 Oct 2022 22:27:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v2] tests: Build correct sandbox configuration on 32bit To: Simon Glass Cc: u-boot@lists.denx.de, Michal Suchanek References: <20221014205234.19385-1-msuchanek@suse.de> <1774657c-51cb-fde7-7f65-a76b8cdcd5f9@gmx.de> <3558da2e-3e66-0b66-cf77-29106653beec@gmx.de> Content-Language: en-US From: Heinrich Schuchardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Wa0gd0wQnDXvQgFEf8j9MTa1t6GLpAUz2jp8UFLLJncV2AKBA9J fszwI1q1ma54N9bP84JHoour8KwDnrWyeLDSyRW5A6kayvAU0iGt4OO4/86CTNW5kQBLF1I CUhUYx+wTfCpCVpOM9SZmxC5iUv2JFmPo40NqEoN1j0ZvF0ex7U0LAj+rEuiM4G9WJQ6aWj 6GSdR9GDqVtqqXWPvTJ0A== X-UI-Out-Filterresults: notjunk:1;V03:K0:Q+M+KZUImZw=:yYi0jXTL6cG5Nvnzb1TVuO euFdnX5eSQrU26vWwgJ5Eniv1AzRBqxseuqAE8bj50erzWOoKtL7nFMD/f5qz+W4G0JIK6bxQ wairpkf55lv3yWL3kaKzhmswSTUs8Vov6rELnbRdFXm6iAZFij/HCXtKzWEtUoWBWDKZnNb7m ZY0pdf22vFytageoYb4UlqIOo1X+B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5GGIWS8MaKXFM0RjJhAiYF1SCKSnrYwpDExqbgun37cMFtMmleT3BnVu sxr3Xoz5CTwzhzFoIL6F0EPQ0u6yhh/kOwfex+/E1F+pL1fYWx+QwwrnyhMiA6zZxPd2onzAI FcmHZNQwDSirw5pmsosXfz21zMr5s1YPIJb+OE6Ke23S740vguI8E8IUOnacHD3gM8b6DfhPT qHfv6Rg8rBEEO+4dUNlhYnTnpvJcfd9AC9EG4yd/Qo8jtrckLczoy3BI9awfH5v2FBHVrrpQz y2UOVlomWsaQJdFIgdWSxo3rWu1svqw2GaoTFF9qGYsU/ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 10/15/22 21:46, Simon Glass wrote: > Hi Heinrich, > > On Sat, 15 Oct 2022 at 13:29, Heinrich Schuchardt w= rote: >> >> >> >> Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass : >>> Hi Heinrich, >>> >>> On Sat, 15 Oct 2022 at 13:05, Heinrich Schuchardt = wrote: >>>> >>>> On 10/15/22 20:39, Simon Glass wrote: >>>>> Hi Heinrich, >>>>> >>>>> On Sat, 15 Oct 2022 at 12:31, Heinrich Schuchardt wrote: >>>>>> >>>>>> On 10/15/22 19:53, Simon Glass wrote: >>>>>>> Hi Michal, >>>>>>> >>>>>>> On Fri, 14 Oct 2022 at 14:53, Michal Suchanek = wrote: >>>>>>>> >>>>>>>> Currently sandbox configuration defautls to 64bit and there is no >>>>>>>> automation for building 32bit sandbox on 32bit hosts. >>>>>>>> >>>>>>>> Use _LP64 macro as heuristic for detecting 64bit targets. >>>>>>>> >>>>>>>> Signed-off-by: Michal Suchanek >>>>>>>> --- >>>>>>>> >>>>>>>> Changes in v2: >>>>>>>> simplify and move detection to kconfig >>>>>>>> >>>>>>>> --- >>>>>>>> arch/sandbox/Kconfig | 18 +++--------------- >>>>>>>> scripts/Kconfig.include | 4 ++++ >>>>>>>> 2 files changed, 7 insertions(+), 15 deletions(-) >>>>>>> >>>>>>> Reviewed-by: Simon Glass >>>>>>> >>>>>>> My only question is whether we can allow building the 32-bit versi= on >>>>>>> on a 64-bit machine? That would need a separate option I think, to >>>>>>> say: >>>>>>> >>>>>>> I don't want you to automatically determine HOST_32/64BIT. Instead= , >>>>>>> use 32 (or 64). >>>>>>> >>>>>>> This is along the lines of what Heinrich is saying, except that I >>>>>>> strongly feel that we must do the right thing by default, as your >>>>>>> patch does. >>>>>> >>>>>> The whole point of phys_addr_t and phys_size_t is that it can be 64= bit >>>>>> or 32bit on ilp32. >>>>>> >>>>>> With this patch we cannot build with CONFIG_PHYS_64BIT=3Dy on ilp32= and >>>>>> that is bad. >>>>>> >>>>>> 32 bit phys_addr_t on lp64 is irrelevant for actual hardware but th= is is >>>>>> what we currently test with sandbox_defconfig on Gitlab CI. >>>>>> >>>>>> My patch is ending up in the same behavior as Michal's patch except= that >>>>>> it allows to have 64bit phys_addr_t on ilp32. >>>>> >>>>> It needs to automatically default to 32 or 64 bit depending on the >>>>> host. If the user wants to fiddle with Kconfig to force it to the >>>>> other one, that should be possible to. >>>>> >>>>> It looks like your patch requires manual configuration, but perhaps = I >>>>> just misunderstood it? >>>> >>>> __LP64__ is a symbol defined by the compiler when compiling for 64bit >>>> and not defined when compiling for 32bit systems. There is nothing >>>> manual about it. >>>> >>>> My patch uses this symbol to replace HOST_32BIT and HOST_64BIT. >>>> >>>> Michal's patch compiles a program tools/bits-per-long.c that ends up >>>> returning 64 on 64 bit systems (where __LP64__ is defined) and 32 on = 32 >>>> bit systems (where __LP64__ is not defined) and then chooses HOST_32B= IT >>>> and HOST_64BIT accordingly. This part of Michal's patch is not wrong. >>>> The solution is only overly complicated. >>>> >>>> What has to be chosen manually with both patches is PHYS_64BIT e.g. b= y >>>> selecting sandbox64_defconfig instead of sandbox_defconfig. >>>> >>>> Unfortunately Michal did not understand that PHYS_64BIT=3Dy, HOST_32B= IT=3Dy >>>> is a necessary test scenario and introduced an invalid dependency. >>>> >>>> With my patch sandbox64_defconfig on a 32bit system uses 64bit phys_a= ddr_t. >>>> >>>> With Michal's patch sandbox64_defconfig on a 32bit system uses 32bit >>>> phys_addr_t. >>> >>> That's all great, thank you, but please can you address my actual ques= tion? >> >> Your question in this thread was if my patch requires extra manual conf= iguration compared to Michal's patch and the answer was no. >> >> What other question do you have? > > "It needs to automatically default to 32 or 64 bit depending on the > host. If the user wants to fiddle with Kconfig to force it to the > other one, that should be possible to." The user forces 32bit or 64bit by selecting a 32bit or 64bit compiler not with Kconfig. PHYS_64BIT is the only thing that needs to be selected via Kconfig. > > I am not talking about anyone's patch, actually, just trying to state > what I think should happen. The physical systems that U-Boot has to deal with are: * 32bit without physical address extension (PAE) Here phys_addr_t must be 32 bit. * 32bit with physical address extension. Here phys_addr_t must be 64 bit. * 64bit systems without PAE. Here phys_addr_t must be 64 bit. We want to model these three scenarios with the sandbox. So we have to build: * Sandbox with PHYS_64BIT=3Dn using a 32bit compiler. * Sandbox with PHYS_64BIT=3Dy using a 32bit compiler. * Sandbox with PHYS_64BIT=3Dy using a 64bit compiler. Sandbox with PHYS_64BIT=3Dn and using a 64bit compiler is irrelevant as it does not match any physical system. PHYS_64BIT selecting HOST_64BIT=3Dy was always wrong. Best regards Heinrich