summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-03-08 20:32:12 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-17 11:56:57 +0100
commit79f3310451fcf32a27b357a6311e03413b5c93ca (patch)
tree6dba960466245de3c36450aff51d4825b1438b0a /arch
parent2613ac868df391a22cf2e35dbd719c47b64fae41 (diff)
downloadbarebox-79f3310451fcf32a27b357a6311e03413b5c93ca.tar.gz
barebox-79f3310451fcf32a27b357a6311e03413b5c93ca.tar.xz
ARM64: qemu-virt64: migrate to generic DT image
Current qemu-virt64 barebox support doesn't look much like what's offered on physical boards. It's not relocatable, lacks PBL and doesn't use device tree. As qemu-system-aarch64 -M virt -kernel already supplies an external device tree, we could just replace all existing support with BOARD_ARM_GENERIC_DT, which builds a barebox image that reuses an externally passed device tree. The 32-bit ARM VIRT support has some board code for host name setting and overlay applying to handle environment and state on flash. We could do without that, given the new virtio-blk support, but the code is already there, so reuse it and drop all current virt64-specific board code. As the barebox ELF image resulting from the build can no longer be directly booted as before and only with -kernel, not -bios, rename the Kconfig symbol, so existing users can notice this during build. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig19
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/boards/Makefile3
-rw-r--r--arch/arm/boards/qemu-virt/board.c10
-rw-r--r--arch/arm/boards/qemu-virt64/Makefile3
-rw-r--r--arch/arm/boards/qemu-virt64/defaultenv-qemu-virt64/config8
-rw-r--r--arch/arm/boards/qemu-virt64/init.c59
-rw-r--r--arch/arm/boards/qemu-virt64/lowlevel.c21
-rw-r--r--arch/arm/boards/qemu-virt64/lowlevel_init.S12
-rw-r--r--arch/arm/configs/qemu_virt64_defconfig6
-rw-r--r--arch/arm/mach-qemu/Kconfig18
-rw-r--r--arch/arm/mach-qemu/Makefile1
-rw-r--r--arch/arm/mach-qemu/include/mach/debug_ll.h24
-rw-r--r--arch/arm/mach-qemu/include/mach/devices.h13
-rw-r--r--arch/arm/mach-qemu/virt_devices.c30
-rw-r--r--arch/arm/mach-vexpress/Kconfig3
16 files changed, 29 insertions, 202 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ab0bf03013..24188d5c71 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -277,9 +277,16 @@ config ARCH_ZYNQMP
select SYS_SUPPORTS_64BIT_KERNEL
select HAS_MACB
-config ARCH_QEMU
- bool "ARM QEMU boards"
- select HAS_DEBUG_LL
+config ARCH_ARM64_VIRT
+ bool "ARM64 QEMU Virt board"
+ select CPU_V8
+ select HAVE_PBL_MULTI_IMAGES
+ select OFDEVICE
+ select OFTREE
+ select RELOCATABLE
+ select SYS_SUPPORTS_64BIT_KERNEL
+ select ARM_AMBA
+ select BOARD_ARM_VIRT
endchoice
@@ -307,9 +314,13 @@ source "arch/arm/mach-vexpress/Kconfig"
source "arch/arm/mach-tegra/Kconfig"
source "arch/arm/mach-uemd/Kconfig"
source "arch/arm/mach-zynq/Kconfig"
-source "arch/arm/mach-qemu/Kconfig"
source "arch/arm/mach-zynqmp/Kconfig"
+config BOARD_ARM_VIRT
+ bool
+ select BOARD_ARM_GENERIC_DT
+ select OF_OVERLAY
+
config BOARD_ARM_GENERIC_DT
select LIBFDT
select ARM_AMBA
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 9dc0897e58..ccfd244e17 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -106,7 +106,6 @@ machine-$(CONFIG_ARCH_TEGRA) := tegra
machine-$(CONFIG_ARCH_UEMD) := uemd
machine-$(CONFIG_ARCH_ZYNQ) := zynq
machine-$(CONFIG_ARCH_ZYNQMP) := zynqmp
-machine-$(CONFIG_ARCH_QEMU) := qemu
# Board directory name. This list is sorted alphanumerically
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index f8cdd90ed6..4c2bce4283 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -163,8 +163,7 @@ obj-$(CONFIG_MACH_ZEDBOARD) += avnet-zedboard/
obj-$(CONFIG_MACH_ZYLONITE) += zylonite/
obj-$(CONFIG_MACH_VARISCITE_MX6) += variscite-mx6/
obj-$(CONFIG_MACH_VSCOM_BALTOS) += vscom-baltos/
-obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/
-obj-$(CONFIG_MACH_VIRT) += qemu-virt/
+obj-$(CONFIG_BOARD_ARM_VIRT) += qemu-virt/
obj-$(CONFIG_MACH_WARP7) += element14-warp7/
obj-$(CONFIG_MACH_WEBASTO_CCBV2) += webasto-ccbv2/
obj-$(CONFIG_MACH_VF610_TWR) += freescale-vf610-twr/
diff --git a/arch/arm/boards/qemu-virt/board.c b/arch/arm/boards/qemu-virt/board.c
index 9d8c90eb5b..d0a7e3da4f 100644
--- a/arch/arm/boards/qemu-virt/board.c
+++ b/arch/arm/boards/qemu-virt/board.c
@@ -9,6 +9,12 @@
#include <asm/system_info.h>
#include <asm/barebox-arm.h>
+#ifdef CONFIG_64BIT
+#define MACHINE "virt64"
+#else
+#define MACHINE "virt"
+#endif
+
extern char __dtb_overlay_of_flash_start[];
static int replace_dtb(void) {
@@ -43,14 +49,14 @@ pure_initcall(replace_dtb);
static int virt_probe(struct device_d *dev)
{
- char *hostname = "virt";
+ const char *hostname = MACHINE;
if (cpu_is_cortex_a7())
hostname = "virt-a7";
else if (cpu_is_cortex_a15())
hostname = "virt-a15";
- barebox_set_model("ARM QEMU virt");
+ barebox_set_model("ARM QEMU " MACHINE);
barebox_set_hostname(hostname);
return 0;
diff --git a/arch/arm/boards/qemu-virt64/Makefile b/arch/arm/boards/qemu-virt64/Makefile
deleted file mode 100644
index b394dde0a1..0000000000
--- a/arch/arm/boards/qemu-virt64/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-obj-y += init.o
-lwl-y += lowlevel.o lowlevel_init.o
-bbenv-$(CONFIG_DEFAULT_ENVIRONMENT_GENERIC) += defaultenv-qemu-virt64
diff --git a/arch/arm/boards/qemu-virt64/defaultenv-qemu-virt64/config b/arch/arm/boards/qemu-virt64/defaultenv-qemu-virt64/config
deleted file mode 100644
index 781dbfefa6..0000000000
--- a/arch/arm/boards/qemu-virt64/defaultenv-qemu-virt64/config
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-autoboot_timeout=3
-
-bootargs="console=ttyAMA0,115200"
-
-# set a fancy prompt (if support is compiled in)
-PS1="\e[1;31m[barebox@\h]:\w\e[0m\n# "
diff --git a/arch/arm/boards/qemu-virt64/init.c b/arch/arm/boards/qemu-virt64/init.c
deleted file mode 100644
index c2e7af77bb..0000000000
--- a/arch/arm/boards/qemu-virt64/init.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
- *
- * GPLv2 only
- */
-
-#include <common.h>
-#include <init.h>
-#include <asm/armlinux.h>
-#include <asm/system_info.h>
-#include <asm/pgtable64.h>
-#include <mach/devices.h>
-#include <environment.h>
-#include <linux/sizes.h>
-#include <io.h>
-#include <envfs.h>
-#include <globalvar.h>
-#include <asm/mmu.h>
-
-static int virt_mem_init(void)
-{
- virt_add_ddram(SZ_2G);
-
- return 0;
-}
-mem_initcall(virt_mem_init);
-
-static int virt_env_init(void)
-{
- add_cfi_flash_device(0, 0x00000000, SZ_128M, 0);
-
- devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self0");
- devfs_add_partition("nor0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env0");
-
- if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC))
- defaultenv_append_directory(defaultenv_qemu_virt64);
-
- return 0;
-}
-device_initcall(virt_env_init);
-
-static int virt_console_init(void)
-{
- virt_register_uart(0);
-
- return 0;
-}
-console_initcall(virt_console_init);
-
-static int virt_core_init(void)
-{
- char *hostname = "virt64";
-
- barebox_set_model("ARM QEMU virt64");
- barebox_set_hostname(hostname);
-
- return 0;
-}
-postcore_initcall(virt_core_init);
diff --git a/arch/arm/boards/qemu-virt64/lowlevel.c b/arch/arm/boards/qemu-virt64/lowlevel.c
deleted file mode 100644
index fcb052369a..0000000000
--- a/arch/arm/boards/qemu-virt64/lowlevel.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
- *
- * GPLv2 only
- */
-
-#include <common.h>
-#include <linux/sizes.h>
-#include <asm/barebox-arm-head.h>
-#include <asm/barebox-arm.h>
-#include <asm/system_info.h>
-
-void qemu_virt64_start(uint32_t, uint32_t, uint32_t);
-
-void noinline qemu_virt64_start(uint32_t r0, uint32_t r1, uint32_t r2)
-{
- arm_cpu_lowlevel_init();
- arm_setup_stack(0x40000000 + SZ_2G - SZ_16K);
-
- barebox_arm_entry(0x40000000, SZ_2G, NULL);
-}
diff --git a/arch/arm/boards/qemu-virt64/lowlevel_init.S b/arch/arm/boards/qemu-virt64/lowlevel_init.S
deleted file mode 100644
index 1967fadb6c..0000000000
--- a/arch/arm/boards/qemu-virt64/lowlevel_init.S
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <linux/linkage.h>
-#include <asm/barebox-arm64.h>
-
-/* The DRAM is already setup */
-#define STACK_TOP 0x80000000
-
-ENTRY_PROC(barebox_arm_reset_vector)
- mov x0, #STACK_TOP
- mov sp, x0
- b qemu_virt64_start
-ENTRY_PROC_END(barebox_arm_reset_vector)
diff --git a/arch/arm/configs/qemu_virt64_defconfig b/arch/arm/configs/qemu_virt64_defconfig
index 6f9bb9591c..f138dc648d 100644
--- a/arch/arm/configs/qemu_virt64_defconfig
+++ b/arch/arm/configs/qemu_virt64_defconfig
@@ -1,5 +1,4 @@
-CONFIG_TEXT_BASE=0x41000000
-CONFIG_ARCH_QEMU=y
+CONFIG_ARCH_ARM64_VIRT=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
# CONFIG_MMU_EARLY is not set
@@ -32,10 +31,13 @@ CONFIG_CMD_PASSWD=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_OFTREE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
CONFIG_SERIAL_AMBA_PL011=y
# CONFIG_SPI is not set
CONFIG_MTD=y
CONFIG_DRIVER_CFI=y
CONFIG_CFI_BUFFER_WRITE=y
+# CONFIG_PINCTRL is not set
CONFIG_DIGEST_SHA1_GENERIC=y
CONFIG_DIGEST_SHA256_GENERIC=y
diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig
deleted file mode 100644
index d30bae4c6f..0000000000
--- a/arch/arm/mach-qemu/Kconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-if ARCH_QEMU
-
-config ARCH_TEXT_BASE
- hex
- default 0x40000000
-
-choice
- prompt "ARM Board type"
-
-config MACH_QEMU_VIRT64
- bool "QEMU arm64 virt machine"
- select CPU_V8
- select SYS_SUPPORTS_64BIT_KERNEL
- select ARM_AMBA
- select HAVE_CONFIGURABLE_MEMORY_LAYOUT
-
-endchoice
-endif
diff --git a/arch/arm/mach-qemu/Makefile b/arch/arm/mach-qemu/Makefile
deleted file mode 100644
index ece277ce0e..0000000000
--- a/arch/arm/mach-qemu/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-$(CONFIG_MACH_QEMU_VIRT64) += virt_devices.o
diff --git a/arch/arm/mach-qemu/include/mach/debug_ll.h b/arch/arm/mach-qemu/include/mach/debug_ll.h
deleted file mode 100644
index d59f68ea19..0000000000
--- a/arch/arm/mach-qemu/include/mach/debug_ll.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2013 Jean-Christophe PLAGNIOL-VILLARD <plagniol@jcrosoft.com>
- *
- * GPLv2 only
- */
-
-#ifndef __MACH_DEBUG_LL_H__
-#define __MACH_DEBUG_LL_H__
-
-#include <linux/amba/serial.h>
-#include <io.h>
-
-#define DEBUG_LL_PHYS_BASE 0x10000000
-#define DEBUG_LL_PHYS_BASE_RS1 0x1c000000
-
-#ifdef MP
-#define DEBUG_LL_UART_ADDR DEBUG_LL_PHYS_BASE
-#else
-#define DEBUG_LL_UART_ADDR DEBUG_LL_PHYS_BASE_RS1
-#endif
-
-#include <debug_ll/pl011.h>
-
-#endif
diff --git a/arch/arm/mach-qemu/include/mach/devices.h b/arch/arm/mach-qemu/include/mach/devices.h
deleted file mode 100644
index 9872c61b49..0000000000
--- a/arch/arm/mach-qemu/include/mach/devices.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
- *
- * GPLv2 only
- */
-
-#ifndef __ASM_ARCH_DEVICES_H__
-#define __ASM_ARCH_DEVICES_H__
-
-void virt_add_ddram(u32 size);
-void virt_register_uart(unsigned id);
-
-#endif /* __ASM_ARCH_DEVICES_H__ */
diff --git a/arch/arm/mach-qemu/virt_devices.c b/arch/arm/mach-qemu/virt_devices.c
deleted file mode 100644
index 999f463125..0000000000
--- a/arch/arm/mach-qemu/virt_devices.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
- *
- * GPLv2 only
- */
-
-#include <common.h>
-#include <linux/amba/bus.h>
-#include <asm/memory.h>
-#include <mach/devices.h>
-#include <linux/ioport.h>
-
-void virt_add_ddram(u32 size)
-{
- arm_add_mem_device("ram0", 0x40000000, size);
-}
-
-void virt_register_uart(unsigned id)
-{
- resource_size_t start;
-
- switch (id) {
- case 0:
- start = 0x09000000;
- break;
- default:
- return;
- }
- amba_apb_device_add(NULL, "uart-pl011", id, start, 4096, NULL, 0);
-}
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 557c9653f4..b72684caa7 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -9,8 +9,7 @@ config MACH_VEXPRESS
config MACH_VIRT
bool "QEMU virt"
+ select BOARD_ARM_VIRT
select ARM_PSCI_CLIENT
- select BOARD_ARM_GENERIC_DT
- select OF_OVERLAY
endif