From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
Mikhail Kalashnikov <iuncuim@gmail.com>,
Andre Przywara <andre.przywara@arm.com>
Cc: Samuel Holland <samuel@sholland.org>,
Icenowy Zheng <uwu@icenowy.me>,
Piotr Oniszczuk <piotr.oniszczuk@gmail.com>,
u-boot@lists.denx.de, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 3/5] sunxi: H616: dram: split struct dram_para
Date: Fri, 09 Jun 2023 22:26:21 +0200 [thread overview]
Message-ID: <4810216.GXAFRqVoOG@jernej-laptop> (raw)
In-Reply-To: <20230607000745.10245-4-andre.przywara@arm.com>
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.
>
> Because of this mixture, the compiler cannot properly optimise the code
> for size, as it does not consider constant propagation in its full
> potential.
>
> Help the compiler out by splitting that structure into two: one that only
> contains values known at compile time, and another one where the values
> will actually change. The former can then be declared "const", which will
> let the compiler fold its values directly into the code using it.
>
> 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().
>
> That results in quite some code savings (almost 2KB), and helps to keep
> the code small with the LPDDR3 support added later.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Nice trick. It could be used also in other DRAM drivers.
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
next prev parent reply other threads:[~2023-06-09 20:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 0:07 [PATCH 0/5] sunxi: H616: improve DRAM setup and add LPDDR3 support Andre Przywara
2023-06-07 0:07 ` [PATCH 1/5] sunxi: dram: make MBUS configuration functions static Andre Przywara
2023-06-09 20:24 ` Jernej Škrabec
2023-06-07 0:07 ` [PATCH 2/5] sunxi: H616: dram: const-ify DRAM function parameters Andre Przywara
2023-06-09 20:24 ` Jernej Škrabec
2023-06-07 0:07 ` [PATCH 3/5] sunxi: H616: dram: split struct dram_para Andre Przywara
2023-06-09 20:26 ` Jernej Škrabec [this message]
2023-06-09 22:48 ` Andre Przywara
2023-06-07 0:07 ` [PATCH 4/5] sunxi: H616: add DRAM type selection Andre Przywara
2023-06-09 20:29 ` Jernej Škrabec
2023-06-07 0:07 ` [PATCH 5/5] sunxi: H616: add LPDDR3 DRAM support Andre Przywara
2023-06-09 20:38 ` Jernej Škrabec
2023-06-09 21:15 ` Andre Przywara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4810216.GXAFRqVoOG@jernej-laptop \
--to=jernej.skrabec@gmail.com \
--cc=andre.przywara@arm.com \
--cc=iuncuim@gmail.com \
--cc=jagan@amarulasolutions.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=piotr.oniszczuk@gmail.com \
--cc=samuel@sholland.org \
--cc=u-boot@lists.denx.de \
--cc=uwu@icenowy.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox