* [PATCH 2/4] ARM64: qemu-virt64: migrate to generic DT image
2021-03-08 19:32 [PATCH 1/4] ARM64: qemu-virt64: remove dead CPU identification code Ahmad Fatoum
@ 2021-03-08 19:32 ` Ahmad Fatoum
2021-03-09 22:39 ` [PATCH] doc: qemu-virt64: fix reST literal block syntax Roland Hieber
2021-03-08 19:32 ` [PATCH 3/4] ARM64: qemu-virt64: enable Virt IO and other useful options Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Ahmad Fatoum @ 2021-03-08 19:32 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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>
---
Documentation/boards/aarch64-qemu-virt.rst | 2 +-
arch/arm/Kconfig | 19 ++++--
arch/arm/Makefile | 1 -
arch/arm/boards/Makefile | 3 +-
arch/arm/boards/qemu-virt/board.c | 10 +++-
arch/arm/boards/qemu-virt64/Makefile | 3 -
.../qemu-virt64/defaultenv-qemu-virt64/config | 8 ---
arch/arm/boards/qemu-virt64/init.c | 59 -------------------
arch/arm/boards/qemu-virt64/lowlevel.c | 21 -------
arch/arm/boards/qemu-virt64/lowlevel_init.S | 12 ----
arch/arm/configs/qemu_virt64_defconfig | 6 +-
arch/arm/mach-qemu/Kconfig | 18 ------
arch/arm/mach-qemu/Makefile | 1 -
arch/arm/mach-qemu/include/mach/debug_ll.h | 24 --------
arch/arm/mach-qemu/include/mach/devices.h | 13 ----
arch/arm/mach-qemu/virt_devices.c | 30 ----------
arch/arm/mach-vexpress/Kconfig | 3 +-
17 files changed, 30 insertions(+), 203 deletions(-)
delete mode 100644 arch/arm/boards/qemu-virt64/Makefile
delete mode 100644 arch/arm/boards/qemu-virt64/defaultenv-qemu-virt64/config
delete mode 100644 arch/arm/boards/qemu-virt64/init.c
delete mode 100644 arch/arm/boards/qemu-virt64/lowlevel.c
delete mode 100644 arch/arm/boards/qemu-virt64/lowlevel_init.S
delete mode 100644 arch/arm/mach-qemu/Kconfig
delete mode 100644 arch/arm/mach-qemu/Makefile
delete mode 100644 arch/arm/mach-qemu/include/mach/debug_ll.h
delete mode 100644 arch/arm/mach-qemu/include/mach/devices.h
delete mode 100644 arch/arm/mach-qemu/virt_devices.c
diff --git a/Documentation/boards/aarch64-qemu-virt.rst b/Documentation/boards/aarch64-qemu-virt.rst
index 5f6cd882d546..cadc4e5543c1 100644
--- a/Documentation/boards/aarch64-qemu-virt.rst
+++ b/Documentation/boards/aarch64-qemu-virt.rst
@@ -11,4 +11,4 @@ Usage::
$ qemu-system-aarch64 -m 2048M \
-cpu cortex-a57 -machine virt \
-display none -serial stdio \
- -kernel ../barebox/barebox
+ -kernel ./images/barebox-dt-2nd.img
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ab0bf030131c..24188d5c7186 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 9dc0897e5833..ccfd244e17e6 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 b6ddbd8f6359..d4272e18a18b 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -164,8 +164,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 9d8c90eb5b1d..3e2c00ca1763 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>
+#if 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 b394dde0a1fe..000000000000
--- 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 781dbfefa676..000000000000
--- 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 c2e7af77bba1..000000000000
--- 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 fcb052369abc..000000000000
--- 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 1967fadb6cbe..000000000000
--- 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 6f9bb9591c20..f138dc648de8 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 d30bae4c6fcc..000000000000
--- 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 ece277ce0e20..000000000000
--- 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 d59f68ea1973..000000000000
--- 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 9872c61b49ff..000000000000
--- 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 999f463125c6..000000000000
--- 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 557c9653f425..b72684caa722 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
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] ARM64: board-dt-2nd: adopt kernel image header
2021-03-08 19:32 [PATCH 1/4] ARM64: qemu-virt64: remove dead CPU identification code Ahmad Fatoum
2021-03-08 19:32 ` [PATCH 2/4] ARM64: qemu-virt64: migrate to generic DT image Ahmad Fatoum
2021-03-08 19:32 ` [PATCH 3/4] ARM64: qemu-virt64: enable Virt IO and other useful options Ahmad Fatoum
@ 2021-03-08 19:32 ` Ahmad Fatoum
2021-03-11 9:53 ` [PATCH 1/4] ARM64: qemu-virt64: remove dead CPU identification code Sascha Hauer
3 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2021-03-08 19:32 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The ARM64 generic DT image is meant to be interchangeable with a
kernel image to aid in debugging and testing. To achieve this, it
reuses an externally passed device tree in x0, just like Linux does.
The ARM barebox image format used however imposes some limitations:
- Commands verifying the header before boot, like U-Boot's booti
won't boot the barebox image
- The barebox image is not fully relocatable. It has the implicit
assumption that the barebox stack can grow into the memory space
preceding the barebox image while the /memory node is parsed
from the FDT.
Adopting the Linux ARM64 header solves both issues. booti won't be
able to tell us apart and we can specify an image load offset to
reserve a stack space that won't interfere with anything else.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/cpu/board-dt-2nd-aarch64.S | 31 +++++++++++++--
arch/arm/cpu/board-dt-2nd.c | 4 +-
arch/arm/include/asm/image.h | 59 +++++++++++++++++++++++++++++
3 files changed, 87 insertions(+), 7 deletions(-)
create mode 100644 arch/arm/include/asm/image.h
diff --git a/arch/arm/cpu/board-dt-2nd-aarch64.S b/arch/arm/cpu/board-dt-2nd-aarch64.S
index 0540a1690dbe..d32b4066cae2 100644
--- a/arch/arm/cpu/board-dt-2nd-aarch64.S
+++ b/arch/arm/cpu/board-dt-2nd-aarch64.S
@@ -1,11 +1,34 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <linux/linkage.h>
#include <asm/barebox-arm64.h>
+#include <asm/image.h>
-ENTRY_PROC(start_dt_2nd)
- adr x1, stack
+#define IMAGE_FLAGS \
+ (ARM64_IMAGE_FLAG_PAGE_SIZE_4K << ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT) | \
+ (ARM64_IMAGE_FLAG_PHYS_BASE << ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT)
+
+.section .text_head_entry_start_dt_2nd
+ENTRY("start_dt_2nd")
+1:
+ adr x1, 1b /* code0 */
+ b 2f /* code1 */
+ .xword 0x80000 /* Image load offset */
+ .xword _barebox_image_size /* Effective Image size */
+ .xword IMAGE_FLAGS /* Kernel flags */
+ .xword 0 /* reserved */
+ .xword 0 /* reserved */
+ .xword 0 /* reserved */
+ .ascii ARM64_IMAGE_MAGIC /* magic number */
+ .int 0 /* reserved (PE-COFF offset) */
+ .asciz "barebox" /* unused for now */
+2:
+ ldr x2, linkadr
+ subs x1, x1, x2 /* get runtime image load offset */
mov sp, x1
+ /* Stack now grows into the 0x80000 image load offset specified
+ * above. This is more than enough until FDT /memory is decoded.
+ */
b dt_2nd_aarch64
-.word 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-stack:
+linkadr:
+.xword start_dt_2nd
ENTRY_PROC_END(start_dt_2nd)
diff --git a/arch/arm/cpu/board-dt-2nd.c b/arch/arm/cpu/board-dt-2nd.c
index bb131807859c..6f6f53591844 100644
--- a/arch/arm/cpu/board-dt-2nd.c
+++ b/arch/arm/cpu/board-dt-2nd.c
@@ -29,9 +29,7 @@ void dt_2nd_aarch64(void *fdt);
void dt_2nd_aarch64(void *fdt)
{
- unsigned long image_start = (unsigned long)_text + global_variable_offset();
-
- arm_setup_stack(image_start);
+ /* entry point already set up stack */
relocate_to_current_adr();
setup_c();
diff --git a/arch/arm/include/asm/image.h b/arch/arm/include/asm/image.h
new file mode 100644
index 000000000000..c2b13213c720
--- /dev/null
+++ b/arch/arm/include/asm/image.h
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __ASM_IMAGE_H
+#define __ASM_IMAGE_H
+
+#define ARM64_IMAGE_MAGIC "ARM\x64"
+
+#define ARM64_IMAGE_FLAG_BE_SHIFT 0
+#define ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT (ARM64_IMAGE_FLAG_BE_SHIFT + 1)
+#define ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT \
+ (ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT + 2)
+#define ARM64_IMAGE_FLAG_BE_MASK 0x1
+#define ARM64_IMAGE_FLAG_PAGE_SIZE_MASK 0x3
+#define ARM64_IMAGE_FLAG_PHYS_BASE_MASK 0x1
+
+#define ARM64_IMAGE_FLAG_LE 0
+#define ARM64_IMAGE_FLAG_BE 1
+#define ARM64_IMAGE_FLAG_PAGE_SIZE_4K 1
+#define ARM64_IMAGE_FLAG_PAGE_SIZE_16K 2
+#define ARM64_IMAGE_FLAG_PAGE_SIZE_64K 3
+#define ARM64_IMAGE_FLAG_PHYS_BASE 1
+
+#ifndef __ASSEMBLY__
+
+#define arm64_image_flag_field(flags, field) \
+ (((flags) >> field##_SHIFT) & field##_MASK)
+
+/*
+ * struct arm64_image_header - arm64 kernel image header
+ * See Documentation/arm64/booting.rst for details
+ *
+ * @code0: Executable code, or
+ * @mz_header alternatively used for part of MZ header
+ * @code1: Executable code
+ * @text_offset: Image load offset
+ * @image_size: Effective Image size
+ * @flags: kernel flags
+ * @reserved: reserved
+ * @magic: Magic number
+ * @reserved5: reserved, or
+ * @pe_header: alternatively used for PE COFF offset
+ */
+
+struct arm64_image_header {
+ __le32 code0;
+ __le32 code1;
+ __le64 text_offset;
+ __le64 image_size;
+ __le64 flags;
+ __le64 res2;
+ __le64 res3;
+ __le64 res4;
+ __le32 magic;
+ __le32 res5;
+};
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ASM_IMAGE_H */
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] ARM64: qemu-virt64: remove dead CPU identification code
2021-03-08 19:32 [PATCH 1/4] ARM64: qemu-virt64: remove dead CPU identification code Ahmad Fatoum
` (2 preceding siblings ...)
2021-03-08 19:32 ` [PATCH 4/4] ARM64: board-dt-2nd: adopt kernel image header Ahmad Fatoum
@ 2021-03-11 9:53 ` Sascha Hauer
3 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2021-03-11 9:53 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Mar 08, 2021 at 08:32:11PM +0100, Ahmad Fatoum wrote:
> cpu_is_arm(cpu) masks the read_cpuid_id() return value and compares with
> a CPU-specific value. The used masks for the Cortex A53/57 zeroes bits
> that are set in the value, so the comparison will never return true.
>
> In fact the compiler already optimizes it away completely, because
> read_cpuid_id() is only implemented for ARM32 anyway.
>
> Drop the dead code.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/arm/boards/qemu-virt64/init.c | 5 -----
> arch/arm/include/asm/system_info.h | 11 -----------
> 2 files changed, 16 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/boards/qemu-virt64/init.c b/arch/arm/boards/qemu-virt64/init.c
> index 19cfcae1f0d8..c2e7af77bba1 100644
> --- a/arch/arm/boards/qemu-virt64/init.c
> +++ b/arch/arm/boards/qemu-virt64/init.c
> @@ -51,11 +51,6 @@ static int virt_core_init(void)
> {
> char *hostname = "virt64";
>
> - if (cpu_is_cortex_a53())
> - hostname = "virt64-a53";
> - else if (cpu_is_cortex_a57())
> - hostname = "virt64-a57";
> -
> barebox_set_model("ARM QEMU virt64");
> barebox_set_hostname(hostname);
>
> diff --git a/arch/arm/include/asm/system_info.h b/arch/arm/include/asm/system_info.h
> index a27b79e6dd08..1e3dfc845c8d 100644
> --- a/arch/arm/include/asm/system_info.h
> +++ b/arch/arm/include/asm/system_info.h
> @@ -42,12 +42,6 @@
> #define CPU_IS_CORTEX_A15 0x410fc0f0
> #define CPU_IS_CORTEX_A15_MASK 0xff0ffff0
>
> -#define CPU_IS_CORTEX_A53 0x410fd034
> -#define CPU_IS_CORTEX_A53_MASK 0xff0ffff0
> -
> -#define CPU_IS_CORTEX_A57 0x411fd070
> -#define CPU_IS_CORTEX_A57_MASK 0xff0ffff0
> -
> #define CPU_IS_PXA250 0x69052100
> #define CPU_IS_PXA250_MASK 0xfffff7f0
>
> @@ -125,11 +119,6 @@
> #else
> #define ARM_ARCH CPU_ARCH_ARMv8
> #endif
> -#define cpu_is_cortex_a53() cpu_is_arm(CORTEX_A53)
> -#define cpu_is_cortex_a57() cpu_is_arm(CORTEX_A57)
> -#else
> -#define cpu_is_cortex_a53() (0)
> -#define cpu_is_cortex_a57() (0)
> #endif
>
> #ifndef __ASSEMBLY__
> --
> 2.29.2
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread