Add basic support for arm64
Subsystems (5)
v5 cover Add basic support for arm64
Chance since v4:
PATCH 14/14 new patch, add documentation about aarch64 qemu virt
Change since v3:
PATCH 2/14 remove hunk belonging to PATCH 3/14
PATCH 3/14 create a lib/ for common code and lib32/ lib64/
PATCH 4/14 add setupc_64, for now setup_c() only memset bss
PATCH 12/14 use default memory layout, chance TEXT_BASE address to let
malloc space below
Change since v2:
PATCH 1/14 add PHYS_ADDR_T_64BIT config
PATCH 3/14 remove modules.c and clean atags functions in armlinux.c,
and fix also parameters passed to linux kernel.
PATCH 12/14 move lowlevel file from mach-qemu/ to boards/ (like others boards)
split dram and flash init
increase dram/flash size
PATCH 13/14 new patch, in case of armv8, swab need to be done on 32-bit wide register
otherwise swapping the value: "0xAAAABBBB" will become "0xAAAABBBB00000000" and see as a null value in uint32_t variable.
PATCH 14/14 new patch, add define to handle arm64 uimage format
Change since v1:
PATCH 2/12: remove hunk which belongs to patch adding mach-qemu
PATCH 3/12: remove unused files
PATCH 4/12: create lowlevel64
PATCH 11/12: create pgtables64 (nothing in common with the arm32 version)
PATCH 12/12: rename "mach-virt" => "mach-qemu"
rename board "qemu_virt64" remove board env files
Hello,
This patch series introduces a basic support for arm64.
The arm64 code is merged in the current arch/arm directory. I try to be iterative in the merge process, and find correct solutions to handle both architecture at some places.
I test the patch series by compiling arm64 virt machine and arm32 vexpress-a9 and test it in qemu, everything seems to work.
Thanks,
Raphaël
Documentation/boards/aarch64-qemu-virt.rst | 13 ++ arch/arm/Kconfig | 28 +++ arch/arm/Makefile | 41 +++- arch/arm/boards/Makefile | 1 + arch/arm/boards/qemu-virt64/Kconfig | 8 + arch/arm/boards/qemu-virt64/Makefile | 2 + arch/arm/boards/qemu-virt64/env/config | 8 + arch/arm/boards/qemu-virt64/init.c | 72 ++++++ arch/arm/boards/qemu-virt64/lowlevel.c | 19 ++ arch/arm/configs/qemu_virt64_defconfig | 47 ++++ arch/arm/cpu/Kconfig | 33 ++- arch/arm/cpu/Makefile | 28 ++- arch/arm/cpu/cache-armv8.S | 168 ++++++++++++++ arch/arm/cpu/cache.c | 19 ++ arch/arm/cpu/cpu.c | 7 + arch/arm/cpu/cpuinfo.c | 58 ++++- arch/arm/cpu/exceptions_64.S | 127 +++++++++++ arch/arm/cpu/interrupts.c | 47 ++++ arch/arm/cpu/lowlevel_64.S | 40 ++++ arch/arm/cpu/mmu.h | 54 +++++ arch/arm/cpu/mmu_64.c | 331 +++++++++++++++++++++++++++ arch/arm/cpu/setupc_64.S | 18 ++ arch/arm/include/asm/bitops.h | 5 + arch/arm/include/asm/cache.h | 9 + arch/arm/include/asm/mmu.h | 14 +- arch/arm/include/asm/pgtable64.h | 140 ++++++++++++ arch/arm/include/asm/swab.h | 4 + arch/arm/include/asm/system.h | 46 +++- arch/arm/include/asm/system_info.h | 38 ++++ arch/arm/lib/.gitignore | 1 - arch/arm/lib/Makefile | 27 --- arch/arm/lib/armlinux.c | 281 ----------------------- arch/arm/lib/ashldi3.S | 50 ---- arch/arm/lib/ashrdi3.S | 50 ---- arch/arm/lib/barebox.lds.S | 126 ----------- arch/arm/lib/bootz.c | 136 ----------- arch/arm/lib/copy_template.S | 268 ---------------------- arch/arm/lib/div0.c | 27 --- arch/arm/lib/findbit.S | 197 ---------------- arch/arm/lib/io-readsb.S | 125 ---------- arch/arm/lib/io-readsl.S | 81 ------- arch/arm/lib/io-readsw-armv4.S | 133 ----------- arch/arm/lib/io-writesb.S | 96 -------- arch/arm/lib/io-writesl.S | 69 ------ arch/arm/lib/io-writesw-armv4.S | 102 --------- arch/arm/lib/io.c | 50 ---- arch/arm/lib/lib1funcs.S | 351 ----------------------------- arch/arm/lib/lshrdi3.S | 50 ---- arch/arm/lib/memcpy.S | 64 ------ arch/arm/lib/memset.S | 124 ---------- arch/arm/lib/module.c | 98 -------- arch/arm/lib/pbl.lds.S | 96 -------- arch/arm/lib/runtime-offset.S | 52 ----- arch/arm/lib/semihosting-trap.S | 28 --- arch/arm/lib/semihosting.c | 227 ------------------- arch/arm/lib/unwind.c | 349 ---------------------------- arch/arm/lib32/.gitignore | 1 + arch/arm/lib32/Makefile | 27 +++ arch/arm/lib32/armlinux.c | 281 +++++++++++++++++++++++ arch/arm/lib32/ashldi3.S | 50 ++++ arch/arm/lib32/ashrdi3.S | 50 ++++ arch/arm/lib32/barebox.lds.S | 126 +++++++++++ arch/arm/lib32/bootz.c | 136 +++++++++++ arch/arm/lib32/copy_template.S | 268 ++++++++++++++++++++++ arch/arm/lib32/div0.c | 27 +++ arch/arm/lib32/findbit.S | 197 ++++++++++++++++ arch/arm/lib32/io-readsb.S | 125 ++++++++++ arch/arm/lib32/io-readsl.S | 81 +++++++ arch/arm/lib32/io-readsw-armv4.S | 133 +++++++++++ arch/arm/lib32/io-writesb.S | 96 ++++++++ arch/arm/lib32/io-writesl.S | 69 ++++++ arch/arm/lib32/io-writesw-armv4.S | 102 +++++++++ arch/arm/lib32/io.c | 50 ++++ arch/arm/lib32/lib1funcs.S | 351 +++++++++++++++++++++++++++++ arch/arm/lib32/lshrdi3.S | 50 ++++ arch/arm/lib32/memcpy.S | 64 ++++++ arch/arm/lib32/memset.S | 124 ++++++++++ arch/arm/lib32/module.c | 98 ++++++++ arch/arm/lib32/pbl.lds.S | 96 ++++++++ arch/arm/lib32/runtime-offset.S | 52 +++++ arch/arm/lib32/semihosting-trap.S | 28 +++ arch/arm/lib32/semihosting.c | 227 +++++++++++++++++++ arch/arm/lib32/unwind.c | 349 ++++++++++++++++++++++++++++ arch/arm/lib64/Makefile | 9 + arch/arm/lib64/armlinux.c | 50 ++++ arch/arm/lib64/barebox.lds.S | 125 ++++++++++ arch/arm/lib64/copy_template.S | 192 ++++++++++++++++ arch/arm/lib64/div0.c | 27 +++ arch/arm/lib64/memcpy.S | 74 ++++++ arch/arm/lib64/memset.S | 215 ++++++++++++++++++ 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 +++ common/image.c | 1 + include/image.h | 5 + 97 files changed, 5449 insertions(+), 3276 deletions(-)
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 1/14 arm64: add armv8 Kconfig entries
--- arch/arm/Kconfig | 23 +++++++++++++++++++++++ arch/arm/cpu/Kconfig | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-)
arch/arm/Kconfig +23 -0
@@ -315,6 +315,29 @@ config ARM_BOARD_APPEND_ATAG endmenu +choice + prompt "Barebox code model" + help + You should only select this option if you have a workload that + actually benefits from 64-bit processing or if your machine has + large memory. You will only be presented a single option in this + menu if your system does not support both 32-bit and 64-bit modes. + +config 32BIT + bool "32-bit barebox" + depends on CPU_SUPPORTS_32BIT_KERNEL && SYS_SUPPORTS_32BIT_KERNEL + help + Select this option if you want to build a 32-bit barebox. + +config 64BIT + bool "64-bit barebox" + depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL + select ARCH_DMA_ADDR_T_64BIT + help + Select this option if you want to build a 64-bit barebox. + +endchoice + menu "ARM specific settings" config ARM_OPTIMZED_STRING_FUNCTIONS
arch/arm/cpu/Kconfig +32 -1
@@ -1,8 +1,14 @@ comment "Processor Type" +config PHYS_ADDR_T_64BIT + bool + config CPU_32 bool - default y + +config CPU_64 + bool + select PHYS_ADDR_T_64BIT # Select CPU types depending on the architecture selected. This selects # which CPUs we support in the kernel image, and the compiler instruction
@@ -69,6 +75,12 @@ config CPU_V7 bool select CPU_32v7 +# ARMv8 +config CPU_V8 + bool + select CPU_64v8 + select CPU_SUPPORTS_64BIT_KERNEL + config CPU_XSC3 bool select CPU_32v4T
@@ -84,15 +96,23 @@ config CPU_XSCALE # This defines the compiler instruction set which depends on the machine type. config CPU_32v4T bool + select CPU_32 config CPU_32v5 bool + select CPU_32 config CPU_32v6 bool + select CPU_32 config CPU_32v7 bool + select CPU_32 + +config CPU_64v8 + bool + select CPU_64 comment "processor features"
@@ -124,3 +144,14 @@ config CACHE_L2X0 bool "Enable L2x0 PrimeCell" depends on MMU && ARCH_HAS_L2X0 +config SYS_SUPPORTS_32BIT_KERNEL + bool + +config SYS_SUPPORTS_64BIT_KERNEL + bool + +config CPU_SUPPORTS_32BIT_KERNEL + bool + +config CPU_SUPPORTS_64BIT_KERNEL + bool
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 2/14 arm: Makefile: rework makefile to handle armv8
In reply to Raphael Poggi--- arch/arm/Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/Makefile +16 -0
@@ -1,7 +1,11 @@ CPPFLAGS += -D__ARM__ -fno-strict-aliasing # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: +ifeq ($(CONFIG_CPU_V8),y) +CPPFLAGS +=$(call cc-option,-maarch64,) +else CPPFLAGS +=$(call cc-option,-marm,) +endif ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) CPPFLAGS += -mbig-endian
@@ -17,13 +21,16 @@ endif # at least some of the code would be executed with MMU off, lets be # conservative and instruct the compiler not to generate any unaligned # accesses +ifeq ($(CONFIG_CPU_V8),n) CFLAGS += -mno-unaligned-access +endif # This selects which instruction set is used. # Note that GCC does not numerically define an architecture version # macro, but instead defines a whole series of macros which makes # testing for a specific architecture or later rather impossible. +arch-$(CONFIG_CPU_64v8) := -D__LINUX_ARM_ARCH__=8 $(call cc-option,-march=armv8-a) arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
@@ -34,11 +41,15 @@ tune-$(CONFIG_CPU_ARM920T) :=-mtune=arm9tdmi tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale +ifeq ($(CONFIG_CPU_V8), y) +CFLAGS_ABI :=-mabi=lp64 +else ifeq ($(CONFIG_AEABI),y) CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork else CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) endif +endif ifeq ($(CONFIG_ARM_UNWIND),y) CFLAGS_ABI +=-funwind-tables
@@ -51,8 +62,13 @@ CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb endif +ifeq ($(CONFIG_CPU_V8), y) +CPPFLAGS += $(CFLAGS_ABI) $(arch-y) $(tune-y) +AFLAGS += -include asm/unified.h +else CPPFLAGS += $(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float $(CFLAGS_THUMB2) AFLAGS += -include asm/unified.h -msoft-float $(AFLAGS_THUMB2) +endif # Machine directory name. This list is sorted alphanumerically # by CONFIG_* macro name.
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 3/14 arm: rework lib directory to support arm64
In reply to Raphael PoggiThis commit create a common directory, lib/,
for arm and arm64 common code.
It also create lib32/ and lib64/ for 32bit
and 64bit code respectively.
--- arch/arm/Makefile | 24 ++- arch/arm/lib/.gitignore | 1 - arch/arm/lib/Makefile | 27 --- arch/arm/lib/armlinux.c | 281 ------------------------------ arch/arm/lib/ashldi3.S | 50 ------ arch/arm/lib/ashrdi3.S | 50 ------ arch/arm/lib/barebox.lds.S | 126 -------------- arch/arm/lib/bootz.c | 136 --------------- arch/arm/lib/copy_template.S | 268 ----------------------------- arch/arm/lib/div0.c | 27 --- arch/arm/lib/findbit.S | 197 --------------------- arch/arm/lib/io-readsb.S | 125 -------------- arch/arm/lib/io-readsl.S | 81 --------- arch/arm/lib/io-readsw-armv4.S | 133 --------------- arch/arm/lib/io-writesb.S | 96 ----------- arch/arm/lib/io-writesl.S | 69 -------- arch/arm/lib/io-writesw-armv4.S | 102 ----------- arch/arm/lib/io.c | 50 ------ arch/arm/lib/lib1funcs.S | 351 -------------------------------------- arch/arm/lib/lshrdi3.S | 50 ------ arch/arm/lib/memcpy.S | 64 ------- arch/arm/lib/memset.S | 124 -------------- arch/arm/lib/module.c | 98 ----------- arch/arm/lib/pbl.lds.S | 96 ----------- arch/arm/lib/runtime-offset.S | 52 ------ arch/arm/lib/semihosting-trap.S | 28 --- arch/arm/lib/semihosting.c | 227 ------------------------ arch/arm/lib/unwind.c | 349 ------------------------------------- arch/arm/lib32/.gitignore | 1 + arch/arm/lib32/Makefile | 27 +++ arch/arm/lib32/armlinux.c | 281 ++++++++++++++++++++++++++++++ arch/arm/lib32/ashldi3.S | 50 ++++++ arch/arm/lib32/ashrdi3.S | 50 ++++++ arch/arm/lib32/barebox.lds.S | 126 ++++++++++++++ arch/arm/lib32/bootz.c | 136 +++++++++++++++ arch/arm/lib32/copy_template.S | 268 +++++++++++++++++++++++++++++ arch/arm/lib32/div0.c | 27 +++ arch/arm/lib32/findbit.S | 197 +++++++++++++++++++++ arch/arm/lib32/io-readsb.S | 125 ++++++++++++++ arch/arm/lib32/io-readsl.S | 81 +++++++++ arch/arm/lib32/io-readsw-armv4.S | 133 +++++++++++++++ arch/arm/lib32/io-writesb.S | 96 +++++++++++ arch/arm/lib32/io-writesl.S | 69 ++++++++ arch/arm/lib32/io-writesw-armv4.S | 102 +++++++++++ arch/arm/lib32/io.c | 50 ++++++ arch/arm/lib32/lib1funcs.S | 351 ++++++++++++++++++++++++++++++++++++++ arch/arm/lib32/lshrdi3.S | 50 ++++++ arch/arm/lib32/memcpy.S | 64 +++++++ arch/arm/lib32/memset.S | 124 ++++++++++++++ arch/arm/lib32/module.c | 98 +++++++++++ arch/arm/lib32/pbl.lds.S | 96 +++++++++++ arch/arm/lib32/runtime-offset.S | 52 ++++++ arch/arm/lib32/semihosting-trap.S | 28 +++ arch/arm/lib32/semihosting.c | 227 ++++++++++++++++++++++++ arch/arm/lib32/unwind.c | 349 +++++++++++++++++++++++++++++++++++++ arch/arm/lib64/Makefile | 9 + arch/arm/lib64/armlinux.c | 50 ++++++ arch/arm/lib64/barebox.lds.S | 125 ++++++++++++++ arch/arm/lib64/copy_template.S | 192 +++++++++++++++++++++ arch/arm/lib64/div0.c | 27 +++ arch/arm/lib64/memcpy.S | 74 ++++++++ arch/arm/lib64/memset.S | 215 +++++++++++++++++++++++ 62 files changed, 3970 insertions(+), 3262 deletions(-) delete mode 100644 arch/arm/lib/.gitignore delete mode 100644 arch/arm/lib/armlinux.c delete mode 100644 arch/arm/lib/ashldi3.S delete mode 100644 arch/arm/lib/ashrdi3.S delete mode 100644 arch/arm/lib/barebox.lds.S delete mode 100644 arch/arm/lib/bootz.c delete mode 100644 arch/arm/lib/copy_template.S delete mode 100644 arch/arm/lib/div0.c delete mode 100644 arch/arm/lib/findbit.S delete mode 100644 arch/arm/lib/io-readsb.S delete mode 100644 arch/arm/lib/io-readsl.S delete mode 100644 arch/arm/lib/io-readsw-armv4.S delete mode 100644 arch/arm/lib/io-writesb.S delete mode 100644 arch/arm/lib/io-writesl.S delete mode 100644 arch/arm/lib/io-writesw-armv4.S delete mode 100644 arch/arm/lib/io.c delete mode 100644 arch/arm/lib/lib1funcs.S delete mode 100644 arch/arm/lib/lshrdi3.S delete mode 100644 arch/arm/lib/memcpy.S delete mode 100644 arch/arm/lib/memset.S delete mode 100644 arch/arm/lib/module.c delete mode 100644 arch/arm/lib/pbl.lds.S delete mode 100644 arch/arm/lib/runtime-offset.S delete mode 100644 arch/arm/lib/semihosting-trap.S delete mode 100644 arch/arm/lib/semihosting.c delete mode 100644 arch/arm/lib/unwind.c create mode 100644 arch/arm/lib32/.gitignore create mode 100644 arch/arm/lib32/Makefile create mode 100644 arch/arm/lib32/armlinux.c create mode 100644 arch/arm/lib32/ashldi3.S create mode 100644 arch/arm/lib32/ashrdi3.S create mode 100644 arch/arm/lib32/barebox.lds.S create mode 100644 arch/arm/lib32/bootz.c create mode 100644 arch/arm/lib32/copy_template.S create mode 100644 arch/arm/lib32/div0.c create mode 100644 arch/arm/lib32/findbit.S create mode 100644 arch/arm/lib32/io-readsb.S create mode 100644 arch/arm/lib32/io-readsl.S create mode 100644 arch/arm/lib32/io-readsw-armv4.S create mode 100644 arch/arm/lib32/io-writesb.S create mode 100644 arch/arm/lib32/io-writesl.S create mode 100644 arch/arm/lib32/io-writesw-armv4.S create mode 100644 arch/arm/lib32/io.c create mode 100644 arch/arm/lib32/lib1funcs.S create mode 100644 arch/arm/lib32/lshrdi3.S create mode 100644 arch/arm/lib32/memcpy.S create mode 100644 arch/arm/lib32/memset.S create mode 100644 arch/arm/lib32/module.c create mode 100644 arch/arm/lib32/pbl.lds.S create mode 100644 arch/arm/lib32/runtime-offset.S create mode 100644 arch/arm/lib32/semihosting-trap.S create mode 100644 arch/arm/lib32/semihosting.c create mode 100644 arch/arm/lib32/unwind.c create mode 100644 arch/arm/lib64/Makefile create mode 100644 arch/arm/lib64/armlinux.c create mode 100644 arch/arm/lib64/barebox.lds.S create mode 100644 arch/arm/lib64/copy_template.S create mode 100644 arch/arm/lib64/div0.c create mode 100644 arch/arm/lib64/memcpy.S create mode 100644 arch/arm/lib64/memset.S
arch/arm/Makefile +20 -4
@@ -291,13 +291,29 @@ MACH := endif common-y += $(BOARD) arch/arm/boards/ $(MACH) -common-y += arch/arm/lib/ arch/arm/cpu/ -common-y += arch/arm/crypto/ +common-y += arch/arm/cpu/ +common-y += arch/arm/lib/ + +ifeq ($(CONFIG_CPU_V8), y) +common-y += arch/arm/lib64/ +else +common-y += arch/arm/lib32/ arch/arm/crypto/ +endif common-$(CONFIG_OFTREE) += arch/arm/dts/ -lds-y := arch/arm/lib/barebox.lds +ifeq ($(CONFIG_CPU_V8), y) +lds-y := arch/arm/lib64/barebox.lds +else +lds-y := arch/arm/lib32/barebox.lds +endif common- += $(patsubst %,arch/arm/boards/%/,$(board-)) -CLEAN_FILES += include/generated/mach-types.h arch/arm/lib/barebox.lds barebox-flash-image +CLEAN_FILES += include/generated/mach-types.h barebox-flash-image + +ifeq ($(CONFIG_CPU_V8), y) +CLEAN_FILES += arch/arm/lib64/barebox.lds +else +CLEAN_FILES += arch/arm/lib32/barebox.lds +endif
arch/arm/lib/.gitignore deleted +0 -1
@@ -1 +0,0 @@ -barebox.lds
arch/arm/lib/Makefile +0 -27
@@ -1,29 +1,2 @@ -obj-$(CONFIG_ARM_LINUX) += armlinux.o obj-$(CONFIG_BOOTM) += bootm.o -obj-$(CONFIG_CMD_BOOTZ) += bootz.o obj-$(CONFIG_CMD_BOOTU) += bootu.o -obj-y += div0.o -obj-y += findbit.o -obj-y += io.o -obj-y += io-readsb.o -obj-y += io-readsw-armv4.o -obj-y += io-readsl.o -obj-y += io-writesb.o -obj-y += io-writesw-armv4.o -obj-y += io-writesl.o -obj-y += lib1funcs.o -obj-y += ashrdi3.o -obj-y += ashldi3.o -obj-y += lshrdi3.o -obj-y += runtime-offset.o -pbl-y += runtime-offset.o -obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memcpy.o -obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memset.o -obj-$(CONFIG_ARM_UNWIND) += unwind.o -obj-$(CONFIG_ARM_SEMIHOSTING) += semihosting-trap.o semihosting.o -obj-$(CONFIG_MODULES) += module.o -extra-y += barebox.lds - -pbl-y += lib1funcs.o -pbl-y += ashldi3.o -pbl-y += div0.o
arch/arm/lib/armlinux.c deleted +0 -281
281 lines not on this page · raw message
arch/arm/lib/ashldi3.S deleted +0 -50
50 lines not on this page · raw message
arch/arm/lib/ashrdi3.S deleted +0 -50
50 lines not on this page · raw message
arch/arm/lib/barebox.lds.S deleted +0 -126
126 lines not on this page · raw message
arch/arm/lib/bootz.c deleted +0 -136
136 lines not on this page · raw message
arch/arm/lib/copy_template.S deleted +0 -268
268 lines not on this page · raw message
arch/arm/lib/div0.c deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* (C) Copyright 2002 -* Wolfgang Denk, DENX Software Engineering, [email protected]. -* -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -*/ -#include <common.h> - -extern void __div0 (void ); - -/* Replacement (=dummy) for GNU/Linux division-by zero handler */ -void __div0 (void ) -{ -panic ("division by zero\n" ); -}
arch/arm/lib/findbit.S deleted +0 -197
197 lines not on this page · raw message
arch/arm/lib/io-readsb.S deleted +0 -125
125 lines not on this page · raw message
arch/arm/lib/io-readsl.S deleted +0 -81
81 lines not on this page · raw message
arch/arm/lib/io-readsw-armv4.S deleted +0 -133
133 lines not on this page · raw message
arch/arm/lib/io-writesb.S deleted +0 -96
96 lines not on this page · raw message
arch/arm/lib/io-writesl.S deleted +0 -69
69 lines not on this page · raw message
arch/arm/lib/io-writesw-armv4.S deleted +0 -102
102 lines not on this page · raw message
arch/arm/lib/io.c deleted +0 -50
50 lines not on this page · raw message
arch/arm/lib/lib1funcs.S deleted +0 -351
351 lines not on this page · raw message
arch/arm/lib/lshrdi3.S deleted +0 -50
50 lines not on this page · raw message
arch/arm/lib/memcpy.S deleted +0 -64
64 lines not on this page · raw message
arch/arm/lib/memset.S deleted +0 -124
124 lines not on this page · raw message
arch/arm/lib/module.c deleted +0 -98
98 lines not on this page · raw message
arch/arm/lib/pbl.lds.S deleted +0 -96
96 lines not on this page · raw message
arch/arm/lib/runtime-offset.S deleted +0 -52
52 lines not on this page · raw message
arch/arm/lib/semihosting-trap.S deleted +0 -28
@@ -1,28 +0,0 @@ -/* - * semihosting-trap.S -- Assembly code needed to make a semihosting call - * - * Copyright (c) 2015 Zodiac Inflight Innovations - * Author: Andrey Smirnov <[email protected]> - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include <linux/linkage.h> -#include <asm/unified.h> - -.section .text.semihosting_trap -ENTRY(semihosting_trap) - @ In supervisor mode SVC would clobber LR - push {lr} - ARM( svc #0x123456 ) - THUMB( svc #0xAB ) - pop {pc} -ENDPROC(semihosting_trap)
arch/arm/lib/semihosting.c deleted +0 -227
227 lines not on this page · raw message
arch/arm/lib/unwind.c deleted +0 -349
56 lines not on this page · raw message
arch/arm/lib32/armlinux.c new file +281 -0
281 lines not on this page · raw message
arch/arm/lib32/ashldi3.S new file +50 -0
50 lines not on this page · raw message
arch/arm/lib32/ashrdi3.S new file +50 -0
50 lines not on this page · raw message
arch/arm/lib32/barebox.lds.S new file +126 -0
126 lines not on this page · raw message
arch/arm/lib32/bootz.c new file +136 -0
136 lines not on this page · raw message
arch/arm/lib32/copy_template.S new file +268 -0
268 lines not on this page · raw message
arch/arm/lib32/findbit.S new file +197 -0
197 lines not on this page · raw message
arch/arm/lib32/io-readsb.S new file +125 -0
125 lines not on this page · raw message
arch/arm/lib32/io-readsl.S new file +81 -0
81 lines not on this page · raw message
arch/arm/lib32/io-readsw-armv4.S new file +133 -0
133 lines not on this page · raw message
arch/arm/lib32/io-writesb.S new file +96 -0
96 lines not on this page · raw message
arch/arm/lib32/io-writesl.S new file +69 -0
69 lines not on this page · raw message
arch/arm/lib32/io-writesw-armv4.S new file +102 -0
102 lines not on this page · raw message
arch/arm/lib32/io.c new file +50 -0
50 lines not on this page · raw message
arch/arm/lib32/lib1funcs.S new file +351 -0
351 lines not on this page · raw message
arch/arm/lib32/lshrdi3.S new file +50 -0
50 lines not on this page · raw message
arch/arm/lib32/memcpy.S new file +64 -0
64 lines not on this page · raw message
arch/arm/lib32/memset.S new file +124 -0
124 lines not on this page · raw message
arch/arm/lib32/module.c new file +98 -0
98 lines not on this page · raw message
arch/arm/lib32/pbl.lds.S new file +96 -0
96 lines not on this page · raw message
arch/arm/lib32/runtime-offset.S new file +52 -0
52 lines not on this page · raw message
arch/arm/lib32/semihosting-trap.S new file +28 -0
Lines of this file are not shown. View the raw message.
arch/arm/lib32/semihosting.c new file +227 -0
227 lines not on this page · raw message
arch/arm/lib32/unwind.c new file +349 -0
349 lines not on this page · raw message
arch/arm/lib64/armlinux.c new file +50 -0
50 lines not on this page · raw message
arch/arm/lib64/barebox.lds.S new file +125 -0
125 lines not on this page · raw message
arch/arm/lib64/copy_template.S new file +192 -0
192 lines not on this page · raw message
arch/arm/lib64/memcpy.S new file +74 -0
74 lines not on this page · raw message
arch/arm/lib64/memset.S new file +215 -0
215 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Part of the diff is not shown here. View the raw message.
PATCH v5 4/14 arm: cpu: add arm64 specific code
In reply to Raphael PoggiThis patch adds arm64 specific codes, which are:
- exception support
- cache support
- rework Makefile to support arm64
--- arch/arm/cpu/Makefile | 26 +++++-- arch/arm/cpu/cache-armv8.S | 168 +++++++++++++++++++++++++++++++++++++++++++ arch/arm/cpu/cache.c | 19 +++++ arch/arm/cpu/exceptions_64.S | 127 ++++++++++++++++++++++++++++++++ arch/arm/cpu/interrupts.c | 47 ++++++++++++ arch/arm/cpu/lowlevel_64.S | 40 +++++++++++ arch/arm/cpu/setupc_64.S | 18 +++++ arch/arm/include/asm/cache.h | 9 +++ 8 files changed, 450 insertions(+), 4 deletions(-) create mode 100644 arch/arm/cpu/cache-armv8.S create mode 100644 arch/arm/cpu/exceptions_64.S create mode 100644 arch/arm/cpu/lowlevel_64.S create mode 100644 arch/arm/cpu/setupc_64.S
arch/arm/cpu/Makefile +22 -4
@@ -1,7 +1,24 @@ obj-y += cpu.o + +ifeq ($(CONFIG_CPU_64v8), y) +obj-$(CONFIG_ARM_EXCEPTIONS) += exceptions_64.o +obj-$(CONFIG_MMU) += mmu_64.o +lwl-y += lowlevel_64.o +else obj-$(CONFIG_ARM_EXCEPTIONS) += exceptions.o +obj-$(CONFIG_MMU) += mmu.o mmu-early.o +pbl-$(CONFIG_MMU) += mmu-early.o +lwl-y += lowlevel.o +endif + obj-$(CONFIG_ARM_EXCEPTIONS) += interrupts.o -obj-y += start.o setupc.o entry.o +obj-y += start.o entry.o + +ifeq ($(CONFIG_CPU_64v8), y) +obj-y += setupc_64.o +else +obj-y += setupc.o +endif # # Any variants can be called as start-armxyz.S
@@ -11,7 +28,6 @@ obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o obj-$(CONFIG_OFDEVICE) += dtb.o obj-$(CONFIG_MMU) += mmu.o cache.o mmu-early.o pbl-$(CONFIG_MMU) += mmu-early.o - ifeq ($(CONFIG_MMU),) obj-y += no-mmu.o endif
@@ -27,6 +43,10 @@ obj-$(CONFIG_CPU_32v7) += cache-armv7.o AFLAGS_pbl-cache-armv7.o :=-Wa,-march=armv7-a pbl-$(CONFIG_CPU_32v7) += cache-armv7.o obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o +AFLAGS_cache-armv8.o :=-Wa,-march=armv8-a +obj-$(CONFIG_CPU_64v8) += cache-armv8.o +AFLAGS_pbl-cache-armv8.o :=-Wa,-march=armv8-a +pbl-$(CONFIG_CPU_64v8) += cache-armv8.o pbl-y += setupc.o entry.o pbl-$(CONFIG_PBL_SINGLE_IMAGE) += start-pbl.o
@@ -34,5 +54,3 @@ pbl-$(CONFIG_PBL_MULTI_IMAGES) += uncompress.o obj-y += common.o cache.o pbl-y += common.o cache.o - -lwl-y += lowlevel.o
arch/arm/cpu/cache-armv8.S new file +168 -0
168 lines not on this page · raw message
arch/arm/cpu/cache.c +19 -0
@@ -36,6 +36,7 @@ DEFINE_CPU_FNS(v4)DEFINE_CPU_FNS (v5)DEFINE_CPU_FNS (v6 )DEFINE_CPU_FNS (v7) +DEFINE_CPU_FNS (v8) void __dma_clean_range(unsigned long start, unsigned long end) {
@@ -101,6 +102,11 @@ int arm_set_cache_functions(void) cache_fns = &cache_fns_armv7;break ;#endif +#ifdef CONFIG_CPU_64v8 +case CPU_ARCH_ARMv8: + cache_fns = &cache_fns_armv8; +break ; +#endif default :while (1 ); }
@@ -138,6 +144,11 @@ void arm_early_mmu_cache_flush(void)v7_mmu_cache_flush ();return ;#endif +#ifdef CONFIG_CPU_64v8 +case CPU_ARCH_ARMv8: +v8_dcache_all (); +return ; +#endif } }
@@ -146,6 +157,7 @@ void v7_mmu_cache_invalidate(void);void arm_early_mmu_cache_invalidate (void ) {switch (arm_early_get_cpu_architecture ()) { +#if __LINUX_ARM_ARCH__ <=7 case CPU_ARCH_ARMv4T:case CPU_ARCH_ARMv5:case CPU_ARCH_ARMv5T:
@@ -159,5 +171,12 @@ void arm_early_mmu_cache_invalidate(void)v7_mmu_cache_invalidate ();return ;#endif +#else +#ifdef CONFIG_CPU_64v8 +case CPU_ARCH_ARMv8: +v8_invalidate_icache_all (); +return ; +#endif +#endif } }
arch/arm/cpu/exceptions_64.S new file +127 -0
127 lines not on this page · raw message
arch/arm/cpu/interrupts.c +47 -0
81 lines not on this page · raw message
arch/arm/cpu/lowlevel_64.S new file +40 -0
@@ -0,0 +1,40 @@ +#include <linux/linkage.h> +#include <init.h> +#include <asm/system.h> + +.section ".text_bare_init_","ax" +ENTRY(arm_cpu_lowlevel_init) + adr x0, vectors + mrs x1, CurrentEL + cmp x1, #0xC /* Check EL3 state */ + b.eq 1f + cmp x1, #0x8 /* Check EL2 state */ + b.eq 2f + cmp x1, #0x4 /* Check EL1 state */ + b.eq 3f + +1: + msr vbar_el3, x0 + mov x0, #1 /* Non-Secure EL0/1 */ + orr x0, x0, #(1 << 10) /* 64-bit EL2 */ + msr scr_el3, x0 + msr cptr_el3, xzr + b done + +2: + msr vbar_el2, x0 + mov x0, #0x33ff /* Enable FP/SIMD */ + msr cptr_el2, x0 + b done + + +3: + msr vbar_el1, x0 + mov x0, #(3 << 20) /* Enable FP/SIMD */ + msr cpacr_el1, x0 + b done + +done: + ret + +ENDPROC(arm_cpu_lowlevel_init)
arch/arm/cpu/setupc_64.S new file +18 -0
@@ -0,0 +1,18 @@ +#include <linux/linkage.h> +#include <asm/sections.h> + +.section .text.setupc + +/* + * setup_c: clear bss + */ +ENTRY(setup_c) + mov x15, x30 + ldr x0, =__bss_start + mov x1, #0 + ldr x2, =__bss_stop + sub x2, x2, x0 + bl memset /* clear bss */ + mov x30, x15 + ret +ENDPROC(setup_c)
arch/arm/include/asm/cache.h +9 -0
@@ -1,9 +1,18 @@#ifndef __ASM_CACHE_H#define __ASM_CACHE_H +#ifdef CONFIG_CPU_64v8 +extern void v8_invalidate_icache_all (void ); +extern void v8_dcache_all (void ); +#endif +static inline void flush_icache (void ) { +#if __LINUX_ARM_ARCH__ <=7 asmvolatile ("mcr p15, 0, %0, c7, c5, 0" : :"r" (0 )); +#else +v8_invalidate_icache_all (); +#endif }int arm_set_cache_functions (void );
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 5/14 arm: include: system: add arm64 helper functions
In reply to Raphael Poggi--- arch/arm/include/asm/system.h | 46 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
arch/arm/include/asm/system.h +45 -1
@@ -3,7 +3,11 @@#if __LINUX_ARM_ARCH__ >=7 #define isb () __asm__ __volatile__ ("isb" : : : "memory") +#ifdef CONFIG_CPU_64v8 +#define dsb () __asm__ __volatile__ ("dsb sy" : : : "memory") +#else #define dsb () __asm__ __volatile__ ("dsb" : : : "memory") +#endif #define dmb () __asm__ __volatile__ ("dmb" : : : "memory")#elif defined(CONFIG_CPU_XSC3 ) || __LINUX_ARM_ARCH__ ==6 #define isb () __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
@@ -57,17 +61,58 @@#define CR_TE (1 << 30)/* Thumb exception enable */ #ifndef __ASSEMBLY__ +#if __LINUX_ARM_ARCH__ >=7 +static inline unsigned int current_el (void ) +{ +unsigned int el; + asmvolatile ("mrs %0, CurrentEL" :"=r" (el) : :"cc" ); +return el >>2 ; +} + +static inline unsigned long read_mpidr (void ) +{ +unsigned long val; + + asmvolatile ("mrs %0, mpidr_el1" :"=r" (val)); + +return val; +} +#endif static inline unsigned int get_cr (void ) {unsigned int val; + +#ifdef CONFIG_CPU_64v8 +unsigned int el =current_el (); +if (el ==1 ) + asmvolatile ("mrs %0, sctlr_el1" :"=r" (val) : :"cc" ); +else if (el ==2 ) + asmvolatile ("mrs %0, sctlr_el2" :"=r" (val) : :"cc" ); +else + asmvolatile ("mrs %0, sctlr_el3" :"=r" (val) : :"cc" ); +#else asmvolatile ("mrc p15, 0, %0, c1, c0, 0 @ get CR" :"=r" (val) : :"cc" ); +#endif +return val; }static inline void set_cr (unsigned int val) { +#ifdef CONFIG_CPU_64v8 +unsigned int el; + + el =current_el (); +if (el ==1 ) + asmvolatile ("msr sctlr_el1, %0" : :"r" (val) :"cc" ); +else if (el ==2 ) + asmvolatile ("msr sctlr_el2, %0" : :"r" (val) :"cc" ); +else + asmvolatile ("msr sctlr_el3, %0" : :"r" (val) :"cc" ); +#else asmvolatile ("mcr p15, 0, %0, c1, c0, 0 @ set CR" : :"r" (val) :"cc" ); +#endif isb (); }
@@ -90,7 +135,6 @@ static inline void set_vbar(unsigned int vbar)static inline unsigned int get_vbar (void ) {return 0 ; }static inline void set_vbar (unsigned int vbar) {}#endif -#endif #endif /* __ASM_ARM_SYSTEM_H */
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 6/14 arm: include: bitops: arm64 use generic __fls
In reply to Raphael Poggi--- arch/arm/include/asm/bitops.h | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/include/asm/bitops.h +5 -0
@@ -177,6 +177,11 @@ static inline unsigned long ffz(unsigned long word)#include <asm-generic/bitops/ffs.h> #include <asm-generic/bitops/fls.h> #endif /* __ARM__USE_GENERIC_FF */ + +#if __LINUX_ARM_ARCH__ ==8 +#include <asm-generic/bitops/__fls.h> +#endif +#include <asm-generic/bitops/fls64.h> #include <asm-generic/bitops/hweight.h>
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 7/14 arm: include: system_info: add armv8 identification
In reply to Raphael Poggi--- arch/arm/include/asm/system_info.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
arch/arm/include/asm/system_info.h +38 -0
@@ -13,6 +13,7 @@#define CPU_ARCH_ARMv5TEJ 7#define CPU_ARCH_ARMv6 8#define CPU_ARCH_ARMv7 9 +#define CPU_ARCH_ARMv8 10#define CPU_IS_ARM720 0x41007200#define CPU_IS_ARM720_MASK 0xff00fff0
@@ -41,6 +42,12 @@#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
@@ -112,6 +119,19 @@#define cpu_is_cortex_a15 () (0)#endif +#ifdef CONFIG_CPU_64v8 +#ifdef ARM_ARCH +#define ARM_MULTIARCH +#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__#ifdef ARM_MULTIARCH
@@ -133,6 +153,23 @@ static inline int arm_early_get_cpu_architecture(void)if (cpu_arch) cpu_arch += CPU_ARCH_ARMv3; }else if ((read_cpuid_id () &0x000f0000 ) ==0x000f0000 ) { +#ifdef CONFIG_CPU_64v8 +unsigned int isar2; + + __asm__ __volatile__( +"mrs %0, id_isar2_el1\n" + :"=r" (isar2) + : + :"memory" ); + + +/* Check Load/Store acquire to check if ARMv8 or not */ + +if (isar2 &0x2 ) + cpu_arch = CPU_ARCH_ARMv8; +else + cpu_arch =CPU_ARCH_UNKNOWN ; +#else unsigned int mmfr0;/* Revised CPUID format. Read the Memory Model Feature
@@ -149,6 +186,7 @@ static inline int arm_early_get_cpu_architecture(void) cpu_arch = CPU_ARCH_UNKNOWN; }else cpu_arch =CPU_ARCH_UNKNOWN ; +#endif return cpu_arch; }
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 8/14 arm: cpu: cpuinfo: add armv8 support
In reply to Raphael Poggi--- arch/arm/cpu/cpuinfo.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-)
arch/arm/cpu/cpuinfo.c +54 -4
@@ -30,12 +30,15 @@#define CPU_ARCH_ARMv5TEJ 7#define CPU_ARCH_ARMv6 8#define CPU_ARCH_ARMv7 9 +#define CPU_ARCH_ARMv8 10#define ARM_CPU_PART_CORTEX_A5 0xC050#define ARM_CPU_PART_CORTEX_A7 0xC070#define ARM_CPU_PART_CORTEX_A8 0xC080#define ARM_CPU_PART_CORTEX_A9 0xC090#define ARM_CPU_PART_CORTEX_A15 0xC0F0 +#define ARM_CPU_PART_CORTEX_A53 0xD030 +#define ARM_CPU_PART_CORTEX_A57 0xD070static void decode_cache (unsigned long size) {
@@ -60,6 +63,25 @@ static int do_cpuinfo(int argc, char *argv[])int i;int cpu_arch; +#ifdef CONFIG_CPU_64v8 + __asm__ __volatile__( +"mrs %0, midr_el1\n" + :"=r" (mainid) + : + :"memory" ); + + __asm__ __volatile__( +"mrs %0, ctr_el0\n" + :"=r" (cache) + : + :"memory" ); + + __asm__ __volatile__( +"mrs %0, sctlr_el1\n" + :"=r" (cr) + : + :"memory" ); +#else __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0 @ read control reg\n" : "=r" (mainid)
@@ -74,9 +96,10 @@ static int do_cpuinfo(int argc, char *argv[]) __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 0 @ read control reg\n" - :"=r" (cr) - : - :"memory" ); + :"=r" (cr) + : + :"memory" ); +#endif switch (mainid >>24 ) {case 0x41 :
@@ -107,6 +130,23 @@ static int do_cpuinfo(int argc, char *argv[])if (cpu_arch) cpu_arch += CPU_ARCH_ARMv3; }else if ((mainid &0x000f0000 ) ==0x000f0000 ) { +#ifdef CONFIG_CPU_64v8 +unsigned int isar2; + + __asm__ __volatile__( +"mrs %0, id_isar2_el1\n" + :"=r" (isar2) + : + :"memory" ); + + +/* Check Load/Store acquire to check if ARMv8 or not */ + +if (isar2 &0x2 ) + cpu_arch = CPU_ARCH_ARMv8; +else + cpu_arch =CPU_ARCH_UNKNOWN ; +#else unsigned int mmfr0;/* Revised CPUID format. Read the Memory Model Feature
@@ -121,6 +161,7 @@ static int do_cpuinfo(int argc, char *argv[]) cpu_arch = CPU_ARCH_ARMv6; else cpu_arch =CPU_ARCH_UNKNOWN ; +#endif }else cpu_arch =CPU_ARCH_UNKNOWN ;
@@ -152,6 +193,9 @@ static int do_cpuinfo(int argc, char *argv[])case CPU_ARCH_ARMv7: architecture ="v7" ;break ; +case CPU_ARCH_ARMv8: + architecture ="v8" ; +break ;case CPU_ARCH_UNKNOWN :default : architecture ="Unknown" ;
@@ -160,7 +204,7 @@ static int do_cpuinfo(int argc, char *argv[])printf ("implementer: %s\narchitecture: %s\n" , implementer, architecture); -if (cpu_arch == CPU_ARCH_ARMv7) { +if (cpu_arch >= CPU_ARCH_ARMv7) {unsigned int major, minor;char *part; major = (mainid >>20 ) &0xf ;
@@ -181,6 +225,12 @@ static int do_cpuinfo(int argc, char *argv[])case ARM_CPU_PART_CORTEX_A15 : part ="Cortex-A15" ;break ; +case ARM_CPU_PART_CORTEX_A53 : + part ="Cortex-A53" ; +break ; +case ARM_CPU_PART_CORTEX_A57 : + part ="Cortex-A57" ; +break ;default : part ="unknown" ; }
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 9/14 arm: cpu: disable code portion in armv8 case
In reply to Raphael PoggiEnclosed by #if directive OMAP specific code
and mmu_disable (ARMv8 code will implemented it somewhere else).
--- arch/arm/cpu/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/cpu/cpu.c +5 -0
@@ -68,6 +68,7 @@ int icache_status(void)return (get_cr () &CR_I ) !=0 ; } +#if __LINUX_ARM_ARCH__ <=7 /* * SoC like the ux500 have the l2x0 always enable * with or without MMU enable
@@ -86,6 +87,7 @@ void mmu_disable(void) }__mmu_cache_off (); } +#endif /** * Disable MMU and D-cache, flush caches
@@ -100,6 +102,8 @@ static void arch_shutdown(void)mmu_disable ();flush_icache (); + +#if __LINUX_ARM_ARCH__ <=7 /* * barebox normally does not use interrupts, but some functionalities * (eg. OMAP4_USBBOOT) require them enabled. So be sure interrupts are
@@ -108,6 +112,7 @@ static void arch_shutdown(void) __asm__ __volatile__("mrs %0, cpsr" :"=r" (r)); r |=PSR_I_BIT ; __asm__ __volatile__("msr cpsr, %0" : :"r" (r)); +#endif }archshutdown_exitcall (arch_shutdown);
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 10/14 arm: cpu: add basic arm64 mmu support
In reply to Raphael PoggiThis commit adds basic mmu support, ie:
- DMA cache handling is not supported
- Remapping memory region also
The current mmu setting is:
- 4KB granularity
- 3 level lookup (skipping L0)
- 33 bits per VA
This is based on coreboot and u-boot mmu configuration.
--- arch/arm/cpu/Makefile | 4 +- arch/arm/cpu/cpu.c | 2 + arch/arm/cpu/mmu.h | 54 +++++++ arch/arm/cpu/mmu_64.c | 331 +++++++++++++++++++++++++++++++++++++++ arch/arm/include/asm/mmu.h | 14 +- arch/arm/include/asm/pgtable64.h | 140 +++++++++++++++++ 6 files changed, 540 insertions(+), 5 deletions(-) create mode 100644 arch/arm/cpu/mmu_64.c create mode 100644 arch/arm/include/asm/pgtable64.h
arch/arm/cpu/Makefile +2 -2
@@ -26,8 +26,8 @@ endif obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o obj-$(CONFIG_OFDEVICE) += dtb.o -obj-$(CONFIG_MMU) += mmu.o cache.o mmu-early.o -pbl-$(CONFIG_MMU) += mmu-early.o +obj-$(CONFIG_MMU) += cache.o + ifeq ($(CONFIG_MMU),) obj-y += no-mmu.o endif
arch/arm/cpu/cpu.c +2 -0
@@ -100,7 +100,9 @@ static void arch_shutdown(void) {uint32_t r; +#ifdef CONFIG_MMU mmu_disable (); +#endif flush_icache ();#if __LINUX_ARM_ARCH__ <=7
arch/arm/cpu/mmu.h +54 -0
60 lines not on this page · raw message
arch/arm/cpu/mmu_64.c new file +331 -0
331 lines not on this page · raw message
arch/arm/include/asm/mmu.h +11 -3
@@ -6,16 +6,24 @@#include <malloc.h> #include <xfuncs.h> +#ifdef CONFIG_CPU_64v8 +#include <asm/pgtable64.h> + +#define DEV_MEM (PMD_ATTRINDX(MT_DEVICE_nGnRnE) | PMD_SECT_AF | PMD_TYPE_SECT) +#define CACHED_MEM (PMD_ATTRINDX(MT_NORMAL) | PMD_SECT_S | PMD_SECT_AF | PMD_TYPE_SECT) +#define UNCACHED_MEM (PMD_ATTRINDX(MT_NORMAL_NC) | PMD_SECT_S | PMD_SECT_AF | PMD_TYPE_SECT) +#else #include <asm/pgtable.h> #define PMD_SECT_DEF_UNCACHED (PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT)#define PMD_SECT_DEF_CACHED (PMD_SECT_WB | PMD_SECT_DEF_UNCACHED) +#endif + +struct arm_memory ; -static inline void mmu_enable (void ) -{ -} +void mmu_enable (void );void mmu_disable (void );static inline void arm_create_section (unsigned long virt,unsigned long phys,int size_m,unsigned int flags)
arch/arm/include/asm/pgtable64.h new file +140 -0
140 lines not on this page · raw message
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 11/14 arm: boards: add mach-qemu and virt64 board
In reply to Raphael PoggiIntroduce mach-qemu and add qemu virt64 board which emulates arm64 board.
--- arch/arm/Kconfig | 5 +++ arch/arm/Makefile | 1 + arch/arm/boards/Makefile | 1 + arch/arm/boards/qemu-virt64/Kconfig | 8 ++++ arch/arm/boards/qemu-virt64/Makefile | 2 + arch/arm/boards/qemu-virt64/env/config | 8 ++++ arch/arm/boards/qemu-virt64/init.c | 72 ++++++++++++++++++++++++++++++ arch/arm/boards/qemu-virt64/lowlevel.c | 19 ++++++++ arch/arm/configs/qemu_virt64_defconfig | 47 +++++++++++++++++++ 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 +++++++++++++ 14 files changed, 249 insertions(+) create mode 100644 arch/arm/boards/qemu-virt64/Kconfig create mode 100644 arch/arm/boards/qemu-virt64/Makefile create mode 100644 arch/arm/boards/qemu-virt64/env/config create mode 100644 arch/arm/boards/qemu-virt64/init.c create mode 100644 arch/arm/boards/qemu-virt64/lowlevel.c create mode 100644 arch/arm/configs/qemu_virt64_defconfig create mode 100644 arch/arm/mach-qemu/Kconfig create mode 100644 arch/arm/mach-qemu/Makefile create mode 100644 arch/arm/mach-qemu/include/mach/debug_ll.h create mode 100644 arch/arm/mach-qemu/include/mach/devices.h create mode 100644 arch/arm/mach-qemu/virt_devices.c
arch/arm/Kconfig +5 -0
@@ -255,6 +255,10 @@ config ARCH_ZYNQ bool "Xilinx Zynq-based boards" select HAS_DEBUG_LL +config ARCH_QEMU + bool "ARM QEMU boards" + select HAS_DEBUG_LL + endchoice source arch/arm/cpu/Kconfig
@@ -280,6 +284,7 @@ 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 config ARM_ASM_UNIFIED bool
arch/arm/Makefile +1 -0
@@ -94,6 +94,7 @@ machine-$(CONFIG_ARCH_VEXPRESS) := vexpress machine-$(CONFIG_ARCH_TEGRA) := tegra machine-$(CONFIG_ARCH_UEMD) := uemd machine-$(CONFIG_ARCH_ZYNQ) := zynq +machine-$(CONFIG_ARCH_QEMU) := qemu # Board directory name. This list is sorted alphanumerically
arch/arm/boards/Makefile +1 -0
@@ -135,3 +135,4 @@ obj-$(CONFIG_MACH_VIRT2REAL) += virt2real/ obj-$(CONFIG_MACH_ZEDBOARD) += avnet-zedboard/ obj-$(CONFIG_MACH_ZYLONITE) += zylonite/ obj-$(CONFIG_MACH_VARISCITE_MX6) += variscite-mx6/ +obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/
arch/arm/boards/qemu-virt64/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ + +if MACH_QEMU + +config ARCH_TEXT_BASE + hex + default 0x40000000 + +endif
arch/arm/boards/qemu-virt64/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += init.o +lwl-y += lowlevel.o
arch/arm/boards/qemu-virt64/env/config new file +8 -0
@@ -0,0 +1,8 @@ +#!/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# "
arch/arm/boards/qemu-virt64/init.c new file +72 -0
72 lines not on this page · raw message
arch/arm/boards/qemu-virt64/lowlevel.c new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* 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 barebox_arm_reset_vector (void ) +{ +arm_cpu_lowlevel_init (); +arm_setup_stack (0x40000000 +SZ_2G -SZ_16K ); + +barebox_arm_entry (0x40000000 ,SZ_2G ,NULL ); +}
arch/arm/configs/qemu_virt64_defconfig new file +47 -0
47 lines not on this page · raw message
arch/arm/mach-qemu/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +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
arch/arm/mach-qemu/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_MACH_QEMU_VIRT64) += virt_devices.o
arch/arm/mach-qemu/include/mach/debug_ll.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright 2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* 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 <asm/debug_ll_pl011.h> + +#endif
arch/arm/mach-qemu/include/mach/devices.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Copyright (C) 2016 Raphaël Poggi <[email protected]> +* +* 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__ */
arch/arm/mach-qemu/virt_devices.c new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (C) 2016 Raphaël Poggi <[email protected]> +* +* 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 ); +}
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 12/14 arm: include: swab: use rigth assembly for armv8
In reply to Raphael Poggi--- arch/arm/include/asm/swab.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/include/asm/swab.h +4 -0
@@ -33,7 +33,11 @@ static inline __attribute_const__ __u16 __arch_swab16(__u16 x) static inline __attribute_const__ __u32 __arch_swab32(__u32 x) { +#if __LINUX_ARM_ARCH__ ==8 + __asm__ ("rev %w0, %w1" :"=r" (x) :"r" (x)); +#else __asm__ ("rev %0, %1" :"=r" (x) :"r" (x)); +#endif return x; }#define __arch_swab32 __arch_swab32
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 13/14 uimage: add define for ARM64 architecture
In reply to Raphael Poggi--- common/image.c | 1 + include/image.h | 5 +++++ 2 files changed, 6 insertions(+)
common/image.c +1 -0
@@ -59,6 +59,7 @@ static table_entry_t arch_name[] = { { IH_ARCH_AVR32, "avr32", "AVR32", }, { IH_ARCH_NDS32, "nds32", "NDS32", }, { IH_ARCH_OPENRISC, "or1k", "OpenRISC 1000",}, + { IH_ARCH_ARM64, "arm64", "AArch64", }, { -1, "", "", }, };
include/image.h +5 -0
@@ -84,11 +84,16 @@#define IH_ARCH_SANDBOX 19/* Sandbox architecture (test only) */ #define IH_ARCH_NDS32 20/* ANDES Technology - NDS32 */ #define IH_ARCH_OPENRISC 21/* OpenRISC 1000 */ +#define IH_ARCH_ARM64 22/* ARM64 */ #if defined(__PPC__)#define IH_ARCH IH_ARCH_PPC#elif defined(__ARM__) +#ifdef CONFIG_CPU_64v8 +#define IH_ARCH IH_ARCH_ARM64 +#else #define IH_ARCH IH_ARCH_ARM +#endif #elif defined(__I386__) || defined(__x86_64__) || defined(__i386__)#define IH_ARCH IH_ARCH_I386#elif defined(__mips__)
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v5 14/14 Documentation: add aarch64-qemu-virt board doc.
In reply to Raphael Poggi--- Documentation/boards/aarch64-qemu-virt.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Documentation/boards/aarch64-qemu-virt.rst
Documentation/boards/aarch64-qemu-virt.rst new file +13 -0
@@ -0,0 +1,13 @@ +=========== + +Aarch64 Qemu virt +------------------------ + +Running barebox on QEMU aarch64 virt machine +^^^^^^^^^^^^^^^^^^^^^^^ + +Usage:: + $ qemu-system-aarch64 -m 2048M \ + -cpu cortex-a57 -machine virt \ + -display none -serial stdio \ + -kernel ../barebox/barebox
Signature · 7 lines
2.1.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 46 lines · Raphael Poggi
Chance since v4:
PATCH 14/14 new patch, add documentation about aarch64 qemu virtChange since v3:
PATCH 2/14 remove hunk belonging to PATCH 3/14PATCH 3/14 create a
lib/for common code and lib32/ lib64/PATCH 4/14 add
setupc_64, for nowsetup_c()only memset bssPATCH 12/14 use default memory layout, chance
TEXT_BASEaddress to let
malloc space belowChange since v2:
PATCH 1/14 addPHYS_ADDR_T_64BITconfigPATCH 3/14 remove
modules.cand clean atags functions inarmlinux.c,
and fix also parameters passed to linux kernel.PATCH 12/14 move lowlevel file from mach-qemu/ to boards/ (like others boards)
split dram and flash init
increase dram/flash sizePATCH 13/14 new patch, in case of armv8, swab need to be done on 32-bit wide register
otherwise swapping the value: "0xAAAABBBB" will become "0xAAAABBBB00000000" and see as a null value inuint32_tvariable.PATCH 14/14 new patch, add define to handle arm64 uimage format
Change since v1:
PATCH 2/12: remove hunk which belongs to patch adding mach-qemuPATCH 3/12: remove unused files
PATCH 4/12: create lowlevel64
PATCH 11/12: create pgtables64 (nothing in common with the arm32 version)
PATCH 12/12: rename "mach-virt" => "mach-qemu"
rename board "qemu_virt64" remove board env filesHello,
Quoted 8 lines
This patch series introduces a basic support for arm64.
The arm64 code is merged in the current
arch/armdirectory. I try to be iterative in the merge process, and find correct solutions to handle both architecture at some places.I test the patch series by compiling arm64 virt machine and arm32 vexpress-a9 and test it in qemu, everything seems to work.
Applied, thanks
This series currently runs through my compile tester, but if that works consider this series applied.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox