-
Notifications
You must be signed in to change notification settings - Fork 14
XTF on arm #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
XTF on arm #4
Changes from all commits
7c6454f
ff0017f
7b67c42
e110999
4bce24e
31e12f6
13eddf5
11bd786
0cb05ca
309fd29
fcdf8db
ea0093e
c14f7dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
*.pyc | ||
*.pyo | ||
*.swp | ||
/arch/x86/*.lds | ||
/arch/*/*.lds | ||
/cscope.* | ||
/dist/ | ||
/docs/autogenerated/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (After the change is made to implement this, as discussed on Aug 17th:) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
MAKEFLAGS += -rR | ||
ROOT := $(abspath $(CURDIR)) | ||
export ROOT | ||
|
||
# $(xtfdir) defaults to $(ROOT) so development and testing can be done | ||
# straight out of the working tree. | ||
|
@@ -19,7 +18,16 @@ endif | |
|
||
xtftestdir := $(xtfdir)/tests | ||
|
||
export DESTDIR xtfdir xtftestdir | ||
# Supported architectures | ||
SUPPORTED_ARCH := x86 arm64 arm32 | ||
# Default architecture | ||
ARCH ?= x86 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Discussed on the 17th Aug:) Switch this to default to the build host arch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #5 |
||
# Check if specified architecture is supported | ||
ifeq ($(filter $(ARCH),$(SUPPORTED_ARCH)),) | ||
$(error Architecture '$(ARCH)' not supported) | ||
endif | ||
|
||
export ROOT DESTDIR ARCH xtfdir xtftestdir | ||
|
||
ifeq ($(LLVM),) # GCC toolchain | ||
CC := $(CROSS_COMPILE)gcc | ||
|
@@ -50,9 +58,16 @@ 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think there could be a way to support having each test indicate its compatibility within the individual test Makefile instead? It will make it easier for maintaining downstream tests since it will avoid changes being needed in these arch-test lists. eg. something like: |
||
|
||
# By default enable all the tests | ||
TESTS ?= $(wildcard tests/*) | ||
|
||
.PHONY: all | ||
all: | ||
@set -e; for D in $(wildcard tests/*); do \ | ||
@set -e; for D in $(TESTS); do \ | ||
[ ! -e $$D/Makefile ] && continue; \ | ||
$(MAKE) -C $$D build; \ | ||
done | ||
|
@@ -61,7 +76,7 @@ all: | |
install: | ||
@$(INSTALL_DIR) $(DESTDIR)$(xtfdir) | ||
$(INSTALL_PROGRAM) xtf-runner $(DESTDIR)$(xtfdir) | ||
@set -e; for D in $(wildcard tests/*); do \ | ||
@set -e; for D in $(TESTS); do \ | ||
[ ! -e $$D/Makefile ] && continue; \ | ||
$(MAKE) -C $$D install; \ | ||
done | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <xtf/asm_macros.h> | ||
|
||
#define ZIMAGE_MAGIC_NUMBER 0x016f2818 | ||
|
||
.arm | ||
|
||
/* | ||
* Common register usage for assembly boot code | ||
* | ||
* r10 - DTB physical address (boot CPU only) | ||
* r9 - Offset between PA and VA ( PA - VA) | ||
*/ | ||
ENTRY(_start) | ||
/* 8 NOPs that make the compressed kernel bootable on legacy ARM systems */ | ||
.rept 8 | ||
mov r0, r0 | ||
.endr | ||
b startup | ||
/* Magic number used to identify this is an ARM Linux zImage */ | ||
.word ZIMAGE_MAGIC_NUMBER | ||
/* The address the zImage starts at (0 = relocatable) */ | ||
.word 0 | ||
/* The address the zImage ends at */ | ||
.word (_end - _start) | ||
startup: | ||
/* Save DTB pointer */ | ||
mov r10, r2 | ||
|
||
/* Calculate where we are */ | ||
ldr r0, =_start /* r0 := vaddr(_start) */ | ||
adr r8, _start /* r8 := paddr(_start) */ | ||
sub r9, r8, r0 /* r9 := phys-offset */ | ||
|
||
/* Start an infinite loop */ | ||
1: b 1b |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <xtf/asm_macros.h> | ||
#include <xen/xen.h> | ||
|
||
#define __HVC(imm16) .long \ | ||
((0xE1400070 | (((imm16) & 0xFFF0) << 4) | ((imm16) & 0x000F)) & 0xFFFFFFFF) | ||
|
||
#define HYPERCALL_SIMPLE(hypercall) \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both .S was borrowed from Linux right? If so, that's fine because the license is not GPL. But please retain the copyright from the author. |
||
ENTRY(hypercall_##hypercall) \ | ||
mov r12, #__HYPERVISOR_##hypercall; \ | ||
__HVC(XEN_HYPERCALL_TAG); \ | ||
mov pc ,lr; \ | ||
ENDFUNC(hypercall_##hypercall) | ||
|
||
#define HYPERCALL0 HYPERCALL_SIMPLE | ||
#define HYPERCALL1 HYPERCALL_SIMPLE | ||
#define HYPERCALL2 HYPERCALL_SIMPLE | ||
#define HYPERCALL3 HYPERCALL_SIMPLE | ||
#define HYPERCALL4 HYPERCALL_SIMPLE | ||
|
||
#define HYPERCALL5(hypercall) \ | ||
ENTRY(hypercall_##hypercall) \ | ||
stmdb sp!, {r4}; \ | ||
ldr r4, [sp, #4]; \ | ||
mov r12, #__HYPERVISOR_##hypercall; \ | ||
__HVC(XEN_HYPERCALL_TAG); \ | ||
ldm sp!, {r4}; \ | ||
mov pc ,lr; \ | ||
ENDFUNC(hypercall_##hypercall) | ||
|
||
.text | ||
|
||
HYPERCALL2(xen_version); | ||
HYPERCALL3(console_io); | ||
HYPERCALL3(grant_table_op); | ||
HYPERCALL2(sched_op); | ||
HYPERCALL2(event_channel_op); | ||
HYPERCALL2(hvm_op); | ||
HYPERCALL2(memory_op); | ||
HYPERCALL2(physdev_op); | ||
HYPERCALL3(vcpu_op); | ||
HYPERCALL1(tmem_op); | ||
HYPERCALL2(multicall); | ||
HYPERCALL2(vm_assist); | ||
HYPERCALL1(sysctl); | ||
HYPERCALL1(domctl); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this hypercall list in any specific order? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The wrappers were borrowed from Linux(with little modifications) and the list is not sorted. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <xtf/asm_macros.h> | ||
|
||
/* | ||
* flush_dcache_range(start, end) | ||
* - x0(start) - start address of a region | ||
* - x1(end) - end address of a region | ||
* Clobbers: x2, x3, x4 | ||
*/ | ||
ENTRY(flush_dcache_range) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was difficult to understand whether the function would clean or just clean & invalidate the cache. How about renaming the function to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will rename it to clean_and_invalidate_dcache |
||
/* Do not modify x0 */ | ||
mov x4, x0 | ||
/* Get the minimum D-cache line size */ | ||
mrs x3, ctr_el0 | ||
ubfm x3, x3, #16, #19 | ||
mov x2, #4 | ||
lsl x2, x2, x3 | ||
sub x3, x2, #1 | ||
bic x4, x4, x3 | ||
/* Clean and invalidate D-cache line */ | ||
1: dc civac, x4 | ||
add x4, x4, x2 | ||
cmp x4, x1 | ||
b.lo 1b | ||
dsb sy | ||
ret | ||
ENDFUNC(flush_dcache_range) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ make ARCH=x86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #5