public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH 3/5] arm: qemu: implement enable_caches()
Date: Mon, 8 Jun 2020 09:17:43 -0400	[thread overview]
Message-ID: <20200608131743.GO24893@bill-the-cat> (raw)
In-Reply-To: <91cdde60-3bde-5ca3-2fa0-1772b8eea93f@gmx.de>

On Sat, Jun 06, 2020 at 10:50:59PM +0200, Heinrich Schuchardt wrote:
> On 6/6/20 7:15 PM, Ard Biesheuvel wrote:
> > Add an override for enable_caches to enable the I and D caches, along
> > with the cached 1:1 mapping of all of DRAM. This is needed for running
> > U-Boot under virtualization with QEMU/kvm.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> >  board/emulation/qemu-arm/qemu-arm.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> > index 69e8ef46f1f5..1b0d543b93c1 100644
> > --- a/board/emulation/qemu-arm/qemu-arm.c
> > +++ b/board/emulation/qemu-arm/qemu-arm.c
> > @@ -4,6 +4,7 @@
> >   */
> >
> >  #include <common.h>
> > +#include <cpu_func.h>
> >  #include <dm.h>
> >  #include <fdtdec.h>
> >  #include <init.h>
> > @@ -94,6 +95,12 @@ void *board_fdt_blob_setup(void)
> >  	return (void *)CONFIG_SYS_SDRAM_BASE;
> >  }
> >
> > +void enable_caches(void)
> > +{
> > +	 icache_enable();
> > +	 dcache_enable();
> > +}
> > +
> 
> For other ARM architectures I have seen:
> 
> int arch_cpu_init(void)
> {
> ????????icache_enable();
> ??????? return 0;
> }
> 
> void enable_caches(void)
> {
> ??????? dcache_enable();
> }
> 
> Some boards have
> 
> if (!icache_status())
> 	icache_enable();
> 
> others
> 
> #if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
> 	icache_enable();
> #endif
> 
> Tom could you, please, advice what is the correct way to do it.

Off-hand?  Dealing with it per SoC/mach/board as we do today.  Sometimes
we need a dcache_disable() before the dcache_enable() as well to clear
out previous mappings.  So dropping this in here is probably the best
choice for qemu-arm.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200608/30cafd04/attachment.sig>

  reply	other threads:[~2020-06-08 13:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-06 17:15 [PATCH 0/5] Fixes for running U-boot under QEMU/KVM Ard Biesheuvel
2020-06-06 17:15 ` [PATCH 1/5] arm: enable allocate-on-read for LPAE's DCACHE_WRITEBACK Ard Biesheuvel
2020-06-06 20:14   ` Heinrich Schuchardt
2020-06-06 23:17     ` Ard Biesheuvel
2020-06-06 23:46       ` Heinrich Schuchardt
2020-06-06 17:15 ` [PATCH 2/5] arm: qemu: enable LPAE on 32-bit Ard Biesheuvel
2020-06-06 20:32   ` Heinrich Schuchardt
2020-06-06 20:49     ` Heinrich Schuchardt
2020-06-07  8:59       ` Ard Biesheuvel
2020-06-07 11:03         ` Heinrich Schuchardt
2020-06-07 11:04           ` Ard Biesheuvel
2020-06-06 17:15 ` [PATCH 3/5] arm: qemu: implement enable_caches() Ard Biesheuvel
2020-06-06 20:50   ` Heinrich Schuchardt
2020-06-08 13:17     ` Tom Rini [this message]
2020-06-06 17:15 ` [PATCH 4/5] arm: qemu: disable the EFI workaround for older GRUB Ard Biesheuvel
2020-06-06 20:53   ` Heinrich Schuchardt
2020-06-06 17:15 ` [PATCH 5/5] arm: qemu: override flash accessors to use virtualizable instructions Ard Biesheuvel
2020-06-06 21:08   ` Heinrich Schuchardt
2020-06-06 22:59     ` Ard Biesheuvel

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=20200608131743.GO24893@bill-the-cat \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox