]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
arm: Add build support for arm64/arm32
authorMichal Orzel <michal.orzel@arm.com>
Tue, 23 Feb 2021 07:44:33 +0000 (08:44 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 13 Jan 2024 14:36:25 +0000 (14:36 +0000)
Add support for arm64/arm32 in the build
system, modify the common headers to be
aware of the new architectures and update
the documentation.

Architecture can be set using ARCH=arm64
or ARCH=arm32.

Currently only one test: tests/example
is supported allowing the startup code head.S
to be executed ending up in an infinite loop.

Signed-off-by: Michal Orzel <michal.orzel@arm.com>
14 files changed:
INSTALL
Makefile
README
build/arm-common/arch-common.mk [new file with mode: 0644]
build/arm-common/arch-files.mk [new file with mode: 0644]
build/arm32/arch-common.mk [new file with mode: 0644]
build/arm32/arch-files.mk [new file with mode: 0644]
build/arm32/arch-tests.mk [new file with mode: 0644]
build/arm64/arch-common.mk [new file with mode: 0644]
build/arm64/arch-files.mk [new file with mode: 0644]
build/arm64/arch-tests.mk [new file with mode: 0644]
config/default-arm.cfg.in [new file with mode: 0644]
docs/introduction.dox
docs/mainpage.dox

diff --git a/INSTALL b/INSTALL
index ed19623b2f98c5bf443d740823e58e9236debceb..296a0f017c7d083931a6091d0265c0a77f8d4be6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -2,6 +2,24 @@ Xen Test Framework
 
 Build requirements:
  - GNU Make >= 3.81
+For x86:
  - GNU compatible compiler, capable of:
    -std=gnu99
    -m64 and -m32
+For arm64/arm32:
+-when cross-compiling:
+ - GNU compatible cross-compiler toolchain for Aarch64/Aarch32
+-when building natively:
+ - GNU compatible toolchain for Aarch64/Aarch32
+
+To build XTF:
+-for x86:
+  $ make
+-for arm64 natively:
+  $ make ARCH=arm64
+-for arm64 when cross compiling:
+  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
+-for arm32 natively:
+  $ make ARCH=arm32
+-for arm32 when cross compiling:
+  $ make ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabi-
index ecd8928d5b25c40dd39b2cb365145608caa80e2c..e599ee35e358e47e8336c95c6dc907a6bbcdcdbb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ endif
 xtftestdir := $(xtfdir)/tests
 
 # Supported architectures
-SUPPORTED_ARCH := x86
+SUPPORTED_ARCH := x86 arm64 arm32
 # Default architecture
 ARCH ?= x86
 # Check if specified architecture is supported
@@ -65,6 +65,10 @@ PYTHON             ?= $(PYTHON_INTERPRETER)
 
 export CC LD CPP INSTALL INSTALL_DATA INSTALL_DIR INSTALL_PROGRAM OBJCOPY PYTHON
 
+# Some tests are architecture specific. In this case we can have a list of tests
+# supported by a given architecture in $(ROOT)/build/$(ARCH)/arch-tests.mk
+-include $(ROOT)/build/$(ARCH)/arch-tests.mk
+
 # By default enable all the tests
 TESTS ?= $(wildcard tests/*)
 
diff --git a/README b/README
index 20d912702421ae4388f3d89b34a62b33bcea28d0..e601c3f43eb9adb24216b19b81791d1a7bffdca3 100644 (file)
--- a/README
+++ b/README
@@ -9,12 +9,18 @@ Tests for more generic areas are build multiple times into different
 microkernels, to test the same functionality from different types of virtual
 machine.
 
+Currently there are 3 architectures available: x86, arm64 and arm32 although
+only x86 is truly supported. Initial support for arm64 and arm32 is added
+allowing to run a startup code based on the test: tests/example.
+This creates a base for future implementation.
+
 ## The framework consists of:
 
 * PV and HVM, 32 and 64 bit entry points
 * Hypercall interface
 * PV console driver (output)
 * Common reporting framework
+* Initial support for arm64/arm32 (startup code running)
 
 ## TODO List:
 
diff --git a/build/arm-common/arch-common.mk b/build/arm-common/arch-common.mk
new file mode 100644 (file)
index 0000000..0b150b6
--- /dev/null
@@ -0,0 +1,8 @@
+# Common makefile for arm
+
+# Compilation recipe
+# arm needs linking normally, then converting to a binary format
+define build-$(ARCH)
+       $(LD) $$(LDFLAGS_$(ARCH)) $$(DEPS-$(ARCH)) -o $$@-syms
+       $(OBJCOPY) $$@-syms -O binary $$@
+endef
diff --git a/build/arm-common/arch-files.mk b/build/arm-common/arch-files.mk
new file mode 100644 (file)
index 0000000..9d6b7b2
--- /dev/null
@@ -0,0 +1,13 @@
+# Common files compiled and linked for arm
+
+# obj-perenv += $(ROOT)/common/console.o
+# obj-perenv += $(ROOT)/common/lib.o
+# obj-perenv += $(ROOT)/common/libc/stdio.o
+# obj-perenv += $(ROOT)/common/libc/string.o
+# obj-perenv += $(ROOT)/common/libc/vsnprintf.o
+# obj-perenv += $(ROOT)/common/report.o
+# obj-perenv += $(ROOT)/common/setup.o
+# obj-perenv += $(ROOT)/common/xenbus.o
+# obj-perenv += $(ROOT)/common/weak-defaults.o
+
+# obj-perenv += $(ROOT)/arch/arm/setup.o
diff --git a/build/arm32/arch-common.mk b/build/arm32/arch-common.mk
new file mode 100644 (file)
index 0000000..acf6924
--- /dev/null
@@ -0,0 +1,13 @@
+# Architecture specific configuration for arm32
+
+ARCH_PATH := $(ROOT)/arch/arm
+ALL_ENVIRONMENTS := arm32
+
+arm32_arch   := arm32
+arm32_guest  := arm32
+defcfg-arm32 := $(ROOT)/config/default-arm.cfg.in
+
+COMMON_CFLAGS += -marm -march=armv7ve+fp
+
+# Include arm common makefile
+include $(ROOT)/build/arm-common/arch-common.mk
diff --git a/build/arm32/arch-files.mk b/build/arm32/arch-files.mk
new file mode 100644 (file)
index 0000000..c7be088
--- /dev/null
@@ -0,0 +1,7 @@
+# Architecture specific files compiled and linked for arm32
+
+# Include arm common files
+include $(ROOT)/build/arm-common/arch-files.mk
+
+# Specific files for arm32
+obj-perenv += $(ROOT)/arch/arm/arm32/head.o
diff --git a/build/arm32/arch-tests.mk b/build/arm32/arch-tests.mk
new file mode 100644 (file)
index 0000000..11f23a1
--- /dev/null
@@ -0,0 +1,4 @@
+# Supported tests by arm32
+
+# Currently only example test is supported
+TESTS := $(ROOT)/tests/stubarm
diff --git a/build/arm64/arch-common.mk b/build/arm64/arch-common.mk
new file mode 100644 (file)
index 0000000..d9f8974
--- /dev/null
@@ -0,0 +1,13 @@
+# Architecture specific configuration for arm64
+
+ARCH_PATH := $(ROOT)/arch/arm
+ALL_ENVIRONMENTS := arm64
+
+arm64_arch   := arm64
+arm64_guest  := arm64
+defcfg-arm64 := $(ROOT)/config/default-arm.cfg.in
+
+COMMON_CFLAGS += -march=armv8-a
+
+# Include arm common makefile
+include $(ROOT)/build/arm-common/arch-common.mk
diff --git a/build/arm64/arch-files.mk b/build/arm64/arch-files.mk
new file mode 100644 (file)
index 0000000..61be141
--- /dev/null
@@ -0,0 +1,7 @@
+# Architecture specific files compiled and linked for arm64
+
+# Include arm common files
+include $(ROOT)/build/arm-common/arch-files.mk
+
+# Specific files for arm64
+obj-perenv += $(ROOT)/arch/arm/arm64/head.o
diff --git a/build/arm64/arch-tests.mk b/build/arm64/arch-tests.mk
new file mode 100644 (file)
index 0000000..9f5557a
--- /dev/null
@@ -0,0 +1,4 @@
+# Supported tests by arm64
+
+# Currently only example test is supported
+TESTS := $(ROOT)/tests/stubarm
diff --git a/config/default-arm.cfg.in b/config/default-arm.cfg.in
new file mode 100644 (file)
index 0000000..26c0c50
--- /dev/null
@@ -0,0 +1,6 @@
+name="test-@@ENV@@-@@NAME@@@@VARIATION@@"
+
+vcpus=@@VCPUS@@
+
+memory=128
+kernel="@@XTFDIR@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
index 9207941dc28e38171c576bc67552d22e7bf23e78..ff5ceae38729f8911c7620023b100f174a5238b1 100644 (file)
@@ -38,17 +38,29 @@ categories are:
 
 A test is built for one or more environments.  The environment encodes:
 
+For x86 architecture:
 - The Xen VM ABI in use (PV or HVM).
 - The compilation width (32bit or 64bit).
 - The primary paging mode (none, PSE, PAE).
 
-All available environments are:
+For arm64/arm32 there is currently a single environment called arm64/arm32.
+
+All available environments for x86 are:
+@dontinclude build/x86/arch-common.mk
 @skipline ALL_ENVIRONMENTS
 
-Some more specific collections for environments are also available:
+Some more specific collections for x86 environments are also available:
 @skipline PV_ENVIRONMENTS
 @until 64BIT_ENVIRONMENTS
 
+All available environments for arm64 are:
+@dontinclude build/arm64/arch-common.mk
+@skipline ALL_ENVIRONMENTS
+
+All available environments for arm32 are:
+@dontinclude build/arm32/arch-common.mk
+@skipline ALL_ENVIRONMENTS
+
 An individual test, compiled for more than one environment, will end up with a
 individual microkernel binary for each specified environment.
 
index 782f115171de7257df0b9c28cf0034ea6bc8c7ac..37c11b5ff71ac7732338eb0a1d1ca00ee68617ad 100644 (file)
@@ -18,8 +18,14 @@ The build system and library abstractions are specifically designed to make it
 easy to write code once and compile it for multiple different environments
 (virtual machines).
 
+Currently there are 3 architectures available: x86, arm64 and arm32 although
+only x86 is truly supported. Initial support for arm64 and arm32 is added
+allowing to run a startup code based on the test: tests/example.
+This creates a base for future implementation.
+
 The current environments supported are:
 
+x86:
 Environment | Guest | Width | Paging
 :-----------|:------|:------|:---------
 `pv32pae`   | PV    | 32bit | PAE
@@ -29,6 +35,15 @@ Environment | Guest | Width | Paging
 `hvm32pae`  | HVM   | 32bit | PAE
 `hvm64`     | HVM   | 64bit | Long mode
 
+arm64:
+Environment | Guest | Width | Paging
+:-----------|:------|:------|:----------------
+`arm64`     | arm64 | 64bit | Currently no MMU
+
+arm32:
+Environment | Guest | Width | Paging
+:-----------|:------|:------|:----------------
+`arm32`     | arm32 | 32bit | Currently no MMU
 
 @section getting-started Getting Started
 
@@ -46,11 +61,26 @@ For x86:
           `elf32-i386` will be used which will load correctly, but disassemble
           incorrectly.
 
+For arm64/arm32:
+-when cross-compiling:
+ - GNU compatible cross-compiler toolchain for Aarch64/Aarch32
+-when building natively:
+ - GNU compatible toolchain for Aarch64/Aarch32
+
 To obtain and build:
 
     $ git clone git://xenbits.xen.org/xtf.git
     $ cd xtf
+    # To build for x86:
     $ make -j4
+    # To build for arm64 natively:
+    $ make ARCH=arm64
+    # To build for arm32 natively:
+    $ make ARCH=arm32
+    # To build for arm64 when cross compiling:
+    $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
+    # To build for arm32 when cross compiling:
+    $ make ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabi-
 
 To run tests on a Xen host: (see @ref errata first)