All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francesco Dolcini <francesco@dolcini.it>
To: "Pali Rohár" <pali@kernel.org>,
	u-boot@lists.denx.de, "Tom Rini" <trini@konsulko.com>,
	"Simon Glass" <sjg@chromium.org>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>
Subject: [PATCH v2 0/2] common/memsize.c: Fix get_ram_size() when cache is enabled
Date: Tue, 30 May 2023 15:33:25 +0200	[thread overview]
Message-ID: <20230530133327.178278-1-francesco@dolcini.it> (raw)

From: Francesco Dolcini <francesco.dolcini@toradex.com>

Ensure that every write is flushed to memory and afterward reads are
from memory.
Since the algorithm rely on the fact that accessing to not existent
memory lead to write at addr / 2 without this modification accesses
to aliased (not physically present) addresses are cached and
wrong size is returned.

This was discovered while working on a TI AM625 based board
where cache is normally enabled, see commit c02712a74849 ("arm: mach-k3: Enable dcache in SPL").

Test results here: https://github.com/u-boot/u-boot/pull/293

v2:
 * added additional patch to fix sandbox build
 * ensure that the changes are fine with every arch/build,
   check if cache is enabled and check for cache line size define

Emanuele Ghidoli (2):
  sandbox: Add a dummy dcache_status() function
  common/memsize.c: Fix get_ram_size() when cache is enabled

 arch/sandbox/cpu/cpu.c |  5 +++++
 common/memsize.c       | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

-- 
2.25.1


             reply	other threads:[~2023-05-30 13:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 13:33 Francesco Dolcini [this message]
2023-05-30 13:33 ` [PATCH v2 1/2] sandbox: Add a dummy dcache_status() function Francesco Dolcini
2023-06-01  3:28   ` Simon Glass
2023-05-30 13:33 ` [PATCH v2 2/2] common/memsize.c: Fix get_ram_size() when cache is enabled Francesco Dolcini
2023-05-30 13:42   ` Michael Nazzareno Trimarchi
2023-05-30 13:48     ` Francesco Dolcini
2023-05-30 14:04       ` Michael Nazzareno Trimarchi
2023-06-22 14:00 ` [PATCH v2 0/2] " 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=20230530133327.178278-1-francesco@dolcini.it \
    --to=francesco@dolcini.it \
    --cc=francesco.dolcini@toradex.com \
    --cc=pali@kernel.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.