[U-Boot] [PATCH 1/4] ARM: qemu-arm: Add support for AArch64

Tuomas Tynkkynen tuomas.tynkkynen at iki.fi
Tue Jan 9 14:34:27 UTC 2018


This adds support for '-machine virt' on AArch64. This is rather simple:
we just add TARGET_QEMU_ARM_xxBIT to select a few different Kconfig
symbols, provide the ARMv8 memory map from the board file and add a new
defconfig based on the 32-bit defconfig.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen at iki.fi>
---
 arch/arm/Kconfig                                   |  2 --
 arch/arm/mach-qemu/Kconfig                         | 11 +++++++
 board/emulation/qemu-arm/MAINTAINERS               |  1 +
 board/emulation/qemu-arm/qemu-arm.c                | 35 ++++++++++++++++++++++
 .../{qemu_arm_defconfig => qemu_arm64_defconfig}   |  1 +
 configs/qemu_arm_defconfig                         |  1 +
 6 files changed, 49 insertions(+), 2 deletions(-)
 copy configs/{qemu_arm_defconfig => qemu_arm64_defconfig} (94%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f2c35e32c6..ee27f07285 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -642,8 +642,6 @@ config ARCH_MX5
 
 config ARCH_QEMU
 	bool "QEMU Virtual Platform"
-	select CPU_V7
-	select ARCH_SUPPORT_PSCI
 	select DM
 	select DM_SERIAL
 	select OF_CONTROL
diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig
index 3500b56cb0..133163aecf 100644
--- a/arch/arm/mach-qemu/Kconfig
+++ b/arch/arm/mach-qemu/Kconfig
@@ -10,3 +10,14 @@ config SYS_CONFIG_NAME
 	default "qemu-arm"
 
 endif
+
+config TARGET_QEMU_ARM_32BIT
+	bool "Support qemu_arm"
+	depends on ARCH_QEMU
+	select CPU_V7
+	select ARCH_SUPPORT_PSCI
+
+config TARGET_QEMU_ARM_64BIT
+	bool "Support qemu_arm64"
+	depends on ARCH_QEMU
+	select ARM64
diff --git a/board/emulation/qemu-arm/MAINTAINERS b/board/emulation/qemu-arm/MAINTAINERS
index a803061ff4..e757ffc64f 100644
--- a/board/emulation/qemu-arm/MAINTAINERS
+++ b/board/emulation/qemu-arm/MAINTAINERS
@@ -4,3 +4,4 @@ S:	Maintained
 F:	board/emulation/qemu-arm/
 F:	include/configs/qemu-arm.h
 F:	configs/qemu_arm_defconfig
+F:	configs/qemu_arm64_defconfig
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index e29ba4630f..1bc7edcfb7 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -6,6 +6,41 @@
 #include <common.h>
 #include <fdtdec.h>
 
+#ifdef CONFIG_ARM64
+#include <asm/armv8/mmu.h>
+
+static struct mm_region qemu_arm64_mem_map[] = {
+	{
+		/* Flash */
+		.virt = 0x00000000UL,
+		.phys = 0x00000000UL,
+		.size = 0x08000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		/* Peripherals */
+		.virt = 0x08000000UL,
+		.phys = 0x08000000UL,
+		.size = 0x38000000,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* RAM */
+		.virt = 0x40000000UL,
+		.phys = 0x40000000UL,
+		.size = 0xc0000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = qemu_arm64_mem_map;
+#endif
+
 int board_init(void)
 {
 	return 0;
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm64_defconfig
similarity index 94%
copy from configs/qemu_arm_defconfig
copy to configs/qemu_arm64_defconfig
index 3cd4d45433..4309bd25eb 100644
--- a/configs/qemu_arm_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARM_SMCCC=y
 CONFIG_ARCH_QEMU=y
+CONFIG_TARGET_QEMU_ARM_64BIT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_DISPLAY_CPUINFO is not set
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig
index 3cd4d45433..db61b12869 100644
--- a/configs/qemu_arm_defconfig
+++ b/configs/qemu_arm_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARM_SMCCC=y
 CONFIG_ARCH_QEMU=y
+CONFIG_TARGET_QEMU_ARM_32BIT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_DISPLAY_CPUINFO is not set
-- 
2.15.0



More information about the U-Boot mailing list