[v3,3/5] arm: qemu: implement enable_caches()

Message ID 20200707100711.7446-4-ardb@kernel.org
State Superseded
Headers show
Series
  • Fixes for running U-boot under QEMU/KVM
Related show

Commit Message

Ard Biesheuvel July 7, 2020, 10:07 a.m.
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 at kernel.org>
---
 board/emulation/qemu-arm/qemu-arm.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Heinrich Schuchardt July 7, 2020, 10:51 a.m. | #1
On 07.07.20 12:07, 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 at kernel.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
=?UTF-8?Q?Andr=c3=a9_Przywara?= July 7, 2020, 12:58 p.m. | #2
On 07/07/2020 11:07, 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 at 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();

It looks like there is a stray space after the tab, but regardless:

Reviewed-by: Andre Przywara <andre.przywara at arm.com>

Cheers,
Andre

> +}
> +
>  #if defined(CONFIG_EFI_RNG_PROTOCOL)
>  #include <efi_loader.h>
>  #include <efi_rng.h>
>
Tom Rini July 29, 2020, 1:43 p.m. | #3
On Tue, Jul 07, 2020 at 12:07:09PM +0200, 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>

> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> Reviewed-by: Andre Przywara <andre.przywara@arm.com>


Applied to u-boot/master, thanks!

-- 
Tom

Patch

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();
+}
+
 #if defined(CONFIG_EFI_RNG_PROTOCOL)
 #include <efi_loader.h>
 #include <efi_rng.h>