From: Vagrant Cascadian <vagrant@debian.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/9] dm: allow 4GB of DRAM on 32bit systems
Date: Sun, 02 Sep 2018 09:04:11 -0700 [thread overview]
Message-ID: <8736ur7uo4.fsf@aikidev.net> (raw)
In-Reply-To: <968d7702-4675-d442-40db-d04ad1c751c2@suse.de>
On 2018-09-02, Alexander Graf <agraf@suse.de> wrote:
> On 02.08.18 23:31, Dr. Philipp Tomsich wrote:
>>
>>> On 2 Aug 2018, at 22:36, Simon Glass <sjg@chromium.org> wrote:
>>>
>>> On 26 July 2018 at 07:59, Philipp Tomsich
>>> <philipp.tomsich at theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>>>> Even on 32bit systems a full 4GB of DRAM may be installed and reported
>>>> by the DRAM controller. Whether these 4GB are larger available
>>>> depends on the size/configuration of address decoding windows and
>>>> architectural features (e.g. consider a hypothetical architecture that
>>>> uses dedicated instructions to access the 'memory-mapped' peripheral
>>>> IO ranges). In U-Boot, the available DRAM, as reported by the
>>>> device-model is independent of the accessible DRAM (i.e. adjusted top
>>>> and effective size).
>>>>
>>>> This was first reported against the RK3288, which may have 4GB DRAM
>>>> attached, but will have a small (e.g. 128MB) window not accessible due
>>>> to address decoding limitations.
>>>>
>>>> The solution is to increase the types used for storing the ram_size to
>>>> have at least 33 bits even on 32bit systems... i.e. we need to use a
>>>> u64 for these always (this was previously only the case for
>>>> PHYS_64BIT, which will have unwanted side-effects for 32bit systems
>>>> and would require more intrusive changes).
>>>>
>>>> This commit changes the size-field in 'struct ram' and the ram_size in
>>>> 'gd' to be a u64.
>>>>
>>>> Reported-by: Marty E. Plummer <hanetzer@startmail.com>
>>>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>>>> ---
>>>>
>>>> include/asm-generic/global_data.h | 2 +-
>>>> include/ram.h | 9 ++++++++-
>>>> 2 files changed, 9 insertions(+), 2 deletions(-)
>>>>
>>>
>>> Reviewed-by: Simon Glass <sjg at chromium.org <mailto:sjg@chromium.org>>
>>>
>>>> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
>>>> index 0fd4900..f3d687c 100644
>>>> --- a/include/asm-generic/global_data.h
>>>> +++ b/include/asm-generic/global_data.h
>>>> @@ -55,7 +55,7 @@ typedef struct global_data {
>>>> unsigned long ram_base; /* Base address of RAM used by U-Boot */
>>>> unsigned long ram_top; /* Top address of RAM used by U-Boot */
>>>> unsigned long relocaddr; /* Start address of U-Boot in RAM */
>>>> - phys_size_t ram_size; /* RAM size */
>>>> + u64 ram_size; /* RAM size */
>>>> unsigned long mon_len; /* monitor len */
>>>> unsigned long irq_sp; /* irq stack pointer */
>>>> unsigned long start_addr_sp; /* start_addr_stackpointer */
>>>> diff --git a/include/ram.h b/include/ram.h
>>>> index 67e22d7..1fe024f 100644
>>>> --- a/include/ram.h
>>>> +++ b/include/ram.h
>>>> @@ -9,7 +9,14 @@
>>>>
>>>> struct ram_info {
>>>> phys_addr_t base;
>>>> - size_t size;
>>>> + /*
>>>> + * We use a 64bit type for the size to correctly handle 32bit
>>>> + * systems with 4GB of DRAM (which would overflow a 32bit type
>>>> + * and read back as 0). For 64bit systems, we assume (for now)
>>>
>>> forever :-)
>>>
>>>> + * that they will always have less than 2^65 byte of DRAM
>>>> + * installed. -- prt
>>>
>>> Is the prt your signature? I suggest dropping it.
>>
>> In fact it is. But I’ll need to rewrite the entire comment anyway for the next
>> version of this series as there’s even more functions and places that the
>> memory size is stored in...
>>
>>>
>>>> + */
>>>> + u64 size;
>
> With LPAE available in all modern ARM cores, shouldn't phys_addr_t just
> be u64? And then we'd probably want to use that throughout the code, right?
Quite a few currently supported boards do not support LPAE, e.g. imx6.
live well,
vagrant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180902/a1a2ae0a/attachment.sig>
next prev parent reply other threads:[~2018-09-02 16:04 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 13:59 [U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems Philipp Tomsich
2018-07-26 13:59 ` [U-Boot] [PATCH 1/9] dm: allow 4GB of DRAM " Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-08-02 21:31 ` Dr. Philipp Tomsich
2018-09-02 11:10 ` Alexander Graf
2018-09-02 16:04 ` Vagrant Cascadian [this message]
2018-09-02 17:49 ` Alexander Graf
2018-09-03 14:29 ` Lokesh Vutla
2018-09-14 10:53 ` Simon Glass
2018-09-14 11:03 ` Philipp Tomsich
2019-01-19 15:21 ` Rask Ingemann Lambertsen
2018-07-26 13:59 ` [U-Boot] [PATCH 2/9] rockchip: support 4GB " Philipp Tomsich
2018-07-26 20:05 ` Carlo Caione
2018-07-26 20:08 ` Dr. Philipp Tomsich
2018-07-26 20:09 ` Dr. Philipp Tomsich
2018-07-26 22:54 ` Dr. Philipp Tomsich
2018-07-27 7:50 ` Carlo Caione
2018-07-27 9:12 ` Dr. Philipp Tomsich
2018-07-26 13:59 ` [U-Boot] [PATCH 3/9] common: include <inttypes.h> always Philipp Tomsich
2018-07-31 1:41 ` Masahiro Yamada
2018-08-02 16:56 ` Simon Glass
2018-08-03 15:01 ` Tom Rini
2018-08-06 2:54 ` Masahiro Yamada
2018-08-02 8:46 ` Patrick DELAUNAY
2018-07-26 13:59 ` [U-Boot] [PATCH 4/9] MIPS: use PRIx64 macros for printing ram size Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-08-07 14:41 ` Daniel Schwierzeck
2018-07-26 13:59 ` [U-Boot] [PATCH 5/9] rockchip: rk3368: change type of ram-size field for a min()-calculation Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 6/9] ram: stm32mp1: use PRIx64 macros for printing ram size Philipp Tomsich
2018-08-02 8:52 ` Patrick DELAUNAY
2018-08-02 16:56 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 7/9] board: keymile: add explicit cast to truncate the 64bit ram size field Philipp Tomsich
2018-08-02 20:36 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 8/9] board: cm_fx6: use PRIx64 macros for printing ram size Philipp Tomsich
2018-07-31 1:42 ` Masahiro Yamada
2018-08-02 20:36 ` Simon Glass
2018-07-26 13:59 ` [U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation Philipp Tomsich
2018-07-26 16:12 ` York Sun
2018-08-11 1:44 ` [U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems Tom Rini
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=8736ur7uo4.fsf@aikidev.net \
--to=vagrant@debian.org \
--cc=u-boot@lists.denx.de \
/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