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 8B506C7EE25 for ; Fri, 9 Jun 2023 22:49:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 125D78471B; Sat, 10 Jun 2023 00:48:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 646CD8472A; Sat, 10 Jun 2023 00:48:56 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id B7506846E9 for ; Sat, 10 Jun 2023 00:48:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F5F62F4; Fri, 9 Jun 2023 15:49:38 -0700 (PDT) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5BC413F663; Fri, 9 Jun 2023 15:48:51 -0700 (PDT) Date: Fri, 9 Jun 2023 23:48:23 +0100 From: Andre Przywara To: Jernej =?UTF-8?B?xaBrcmFiZWM=?= Cc: Jagan Teki , Mikhail Kalashnikov , Samuel Holland , Icenowy Zheng , Piotr Oniszczuk , u-boot@lists.denx.de, linux-sunxi@lists.linux.dev Subject: Re: [PATCH 3/5] sunxi: H616: dram: split struct dram_para Message-ID: <20230609234823.0920c02c@slackpad.lan> In-Reply-To: <4810216.GXAFRqVoOG@jernej-laptop> References: <20230607000745.10245-1-andre.przywara@arm.com> <20230607000745.10245-4-andre.przywara@arm.com> <4810216.GXAFRqVoOG@jernej-laptop> Organization: Arm Ltd. X-Mailer: Claws Mail 4.1.1 (GTK 3.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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.8 at phobos.denx.de X-Virus-Status: Clean On Fri, 09 Jun 2023 22:26:21 +0200 Jernej =C5=A0krabec wrote: Hi, > Dne sreda, 07. junij 2023 ob 02:07:43 CEST je Andre Przywara napisal(a): > > Currently there is one DRAM parameter struct for the Allwinner H616 DRAM > > "driver". It contains many fields that are compile time constants > > (set by Kconfig variables), though there are also some fields that are > > probed and changed over the runtime of the DRAM initialisation. > >=20 > > Because of this mixture, the compiler cannot properly optimise the code > > for size, as it does not consider constant propagation in its full > > potential. > >=20 > > Help the compiler out by splitting that structure into two: one that on= ly > > contains values known at compile time, and another one where the values > > will actually change. The former can then be declared "const", which wi= ll > > let the compiler fold its values directly into the code using it. > >=20 > > We also add "const" tags for some new "struct dram_config" pointers, to > > further increase code optimisation. > > To help the compiler optimise the code further, the definition of the > > now "const struct dram_para" has to happen at a file-global level, so > > move that part out of sunxi_dram_init(). > >=20 > > That results in quite some code savings (almost 2KB), and helps to keep > > the code small with the LPDDR3 support added later. > >=20 > > Signed-off-by: Andre Przywara =20 >=20 > Nice trick. It could be used also in other DRAM drivers. You bet ;-) I have a patch for the H6 already. It doesn't save as much there (merely 500 bytes), I guess because we don't have as many build time parameters, but the H6 SPL is very big, so every byte saved there is a win. Will post this ASAP. > Reviewed-by: Jernej Skrabec Many thanks for that! Cheers, Andre