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 3ABE7C4332F for ; Sun, 16 Oct 2022 15:42:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AF8B84DFC; Sun, 16 Oct 2022 17:42:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.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; unprotected) header.d=suse.de header.i=@suse.de header.b="Cv+UNU88"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="qqmmmIiX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0796084ECA; Sun, 16 Oct 2022 17:42:48 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 1C9FC84DF8 for ; Sun, 16 Oct 2022 17:42:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CAA34227B7; Sun, 16 Oct 2022 15:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665934964; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n5haNzA0LtpUuymdQ1iCbgbVm31dBciEOsNxzngt9HE=; b=Cv+UNU88aFYS0b6JaxMiT+zwEkT9X9tgDzj78+UOPOsUiPW5wVRoVfRZckn92ZNw092U6t WaVciG5dXvUdrP9r6/yPWnLrdZSLv5UM9U3+i5BrSJ0f527BwZJi1aycpo2AlfKIYVZUv/ utp7LRmvaspGRw9ryqIYA2B62NUrtE4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665934964; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n5haNzA0LtpUuymdQ1iCbgbVm31dBciEOsNxzngt9HE=; b=qqmmmIiXEplU+hwoWR3dewBbrN8F0z0kdwpYqSZWR0npKlVIfJXWCW3TFAII2RH1Mi8raK zJ0OzGYAAaysaBAA== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id ABF0C2C141; Sun, 16 Oct 2022 15:42:44 +0000 (UTC) Date: Sun, 16 Oct 2022 17:42:43 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Heinrich Schuchardt Cc: Sean Anderson , Lukasz Majewski , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH] clk: k210: Fix error calculation on 32bit Message-ID: <20221016154243.GP28810@kitsune.suse.cz> References: <20221013203429.15200-1-msuchanek@suse.de> <20221016075142.GO28810@kitsune.suse.cz> <31257dd6-2658-ae48-be43-9da7cfbeb6f6@canonical.com> <187c7eb8-2497-8723-4ead-d4e255ace1e8@canonical.com> <0f410376-e06e-a58a-357e-8bf5aa3a66f1@gmail.com> <4c8ae88a-01be-33ad-3089-4befb2d586fa@canonical.com> <0300056b-5ce6-5ec5-4c03-311bf85e9f2c@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0300056b-5ce6-5ec5-4c03-311bf85e9f2c@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Hello, On Sun, Oct 16, 2022 at 05:02:38PM +0200, Heinrich Schuchardt wrote: > > > On 10/16/22 16:57, Sean Anderson wrote: > > On 10/16/22 10:50, Heinrich Schuchardt wrote: > > > > > > > > > On 10/16/22 16:48, Sean Anderson wrote: > > > > On 10/16/22 10:40, Heinrich Schuchardt wrote: > > > > > > > > > > > > > > > On 10/16/22 16:19, Sean Anderson wrote: > > > > > > On 10/16/22 07:46, Heinrich Schuchardt wrote: > > > > > > > > > > > > > > > > > > > > > On 10/16/22 09:51, Michal Suchánek wrote: > > > > > > > > On Thu, Oct 13, 2022 at 10:34:29PM +0200, Michal Suchanek wrote: > > > > > > > > > k210 is 64bit but the driver and tests are > > > > > > > > > also built in sandbox, and > > > > > > > > > that can be built 32bit. > > > > > > > > > > > > > > > > > > BIT(32) does not work on 32bit, shift before > > > > > > > > > subtraction to fit into > > > > > > > > > 32bit integer with BIT values. > > > > > > > > > > > > IMO the driver should just be changed to depend on > > > > > > 64-bit. The k210 is 64-bit, > > > > > > and I didn't write anything with 32-bit in mind. > > > > > > > > > > Michal, Simon, and I are striving to get the sandbox working > > > > > on ilp32 systems. > > > > > > > > > > Do you suggest to remove  the driver from sandbox_defconfig? > > > > > > > > > > This would imply that the unit test is not executed on > > > > > Gitlab CI. You will still be able to execute it on the > > > > > actual hardware. > > > > > > > > It's still enabled for sandbox64, so it should still be executed there. > > > > > > No, the sandbox64 is also to be compiled on ilp32. It models > > > physical address extension (PAE). > > > > Do we have a config for word size? PHYS_64BIT seems to be for the > > address size. > > phys_addr_t is what is used to address physical memory which may be 64bit on > a 32bit PAE system (CONFIG_PHYS_64BIT=y). > > Compiling on armv7 yields 32bit pointers. > > There are two alternative patches in review removing HOST_32BIT and > HOST_64BIT: > > https://patchwork.ozlabs.org/project/uboot/patch/20221014064052.5592-1-heinrich.schuchardt@canonical.com/ > > https://patchwork.ozlabs.org/project/uboot/patch/20221013203429.15200-1-msuchanek@suse.de/ I don't think that we have a config option that can be used to detect that the build is 64bit. Such option may exit per platform but drivers that can be built for multiple platforms will have hard time detecting it. I think that Heinrich's suggestion to use BIT_ULL instead of BIT and abs64 instead of abs is non-controversial. It's technically more correct way to write the expression although relevant only for 32bit. Thanks Michal