1 | This patchset adds a migration test for aarch64. It leverages | 1 | This patchset adds a migration test for aarch64. It leverages |
---|---|---|---|
2 | Dave Gilbert's recent patch "tests/migration: Add source to PC boot block" | 2 | Dave Gilbert's migration boot block patches to create a new test case |
3 | to create a new test case for aarch64. | 3 | for aarch64. |
4 | |||
5 | V7->V8: | ||
6 | * Support cross compilation by searching for CROSS_CC_GUEST option, | ||
7 | instead of using the find-cross-prefix defined in roms/Makefile | ||
8 | * Use the "max" options for ARM guest VM's CPU and GIC types | ||
9 | * $(TARGET)/Makefile rules are rewritten based on Laurent Vivier's comment | ||
10 | * NOTE: because Patch 1/2 is re-written, I remove the "Reviewed-by" for | ||
11 | reviewers to take a look again. Thanks. | ||
4 | 12 | ||
5 | V6->V7: | 13 | V6->V7: |
6 | * Define test memory start/end addresses for all architectures | 14 | * Define test memory start/end addresses for all architectures |
7 | * Check aarch64 kernel binary size, limit under 512KB | 15 | * Check aarch64 kernel binary size, limit under 512KB |
8 | 16 | ||
... | ... | ||
43 | 51 | ||
44 | Thanks, | 52 | Thanks, |
45 | -Wei | 53 | -Wei |
46 | 54 | ||
47 | Wei Huang (4): | 55 | Wei Huang (4): |
48 | rules: Move cross compilation auto detection functions to rules.mak | 56 | tests/migration: Convert x86 boot block compilation script into |
49 | tests/migration: Convert the boot block compilation script into | ||
50 | Makefile | 57 | Makefile |
58 | tests/migration: Support cross compiler in generating boot block | ||
59 | header file | ||
51 | tests/migration: Add migration-test header file | 60 | tests/migration: Add migration-test header file |
52 | tests: Add migration test for aarch64 | 61 | tests: Add migration test for aarch64 |
53 | 62 | ||
54 | roms/Makefile | 24 ++----- | ||
55 | rules.mak | 15 +++++ | ||
56 | tests/Makefile.include | 1 + | 63 | tests/Makefile.include | 1 + |
57 | tests/migration-test.c | 78 +++++++++++++++++----- | 64 | tests/migration-test.c | 68 +++++++++++++++----- |
58 | tests/migration/Makefile | 44 ++++++++++++ | 65 | tests/migration/Makefile | 34 ++++++++++ |
59 | tests/migration/aarch64-a-b-kernel.S | 75 +++++++++++++++++++++ | 66 | tests/migration/aarch64/Makefile | 20 ++++++ |
60 | tests/migration/aarch64-a-b-kernel.h | 19 ++++++ | 67 | tests/migration/aarch64/aarch64-a-b-kernel.S | 75 ++++++++++++++++++++++ |
61 | tests/migration/migration-test.h | 31 +++++++++ | 68 | tests/migration/aarch64/aarch64-a-b-kernel.h | 19 ++++++ |
62 | tests/migration/rebuild-x86-bootblock.sh | 33 --------- | 69 | tests/migration/migration-test.h | 30 +++++++++ |
63 | .../{x86-a-b-bootblock.s => x86-a-b-bootblock.S} | 12 ++-- | 70 | tests/migration/rebuild-x86-bootblock.sh | 33 ---------- |
64 | tests/migration/x86-a-b-bootblock.h | 4 +- | 71 | tests/migration/x86_64/Makefile | 22 +++++++ |
65 | 11 files changed, 260 insertions(+), 76 deletions(-) | 72 | .../x86-a-b-bootblock.S} | 0 |
73 | tests/migration/{ => x86_64}/x86-a-b-bootblock.h | 8 +-- | ||
74 | 11 files changed, 258 insertions(+), 52 deletions(-) | ||
66 | create mode 100644 tests/migration/Makefile | 75 | create mode 100644 tests/migration/Makefile |
67 | create mode 100644 tests/migration/aarch64-a-b-kernel.S | 76 | create mode 100644 tests/migration/aarch64/Makefile |
68 | create mode 100644 tests/migration/aarch64-a-b-kernel.h | 77 | create mode 100644 tests/migration/aarch64/aarch64-a-b-kernel.S |
78 | create mode 100644 tests/migration/aarch64/aarch64-a-b-kernel.h | ||
69 | create mode 100644 tests/migration/migration-test.h | 79 | create mode 100644 tests/migration/migration-test.h |
70 | delete mode 100755 tests/migration/rebuild-x86-bootblock.sh | 80 | delete mode 100755 tests/migration/rebuild-x86-bootblock.sh |
71 | rename tests/migration/{x86-a-b-bootblock.s => x86-a-b-bootblock.S} (88%) | 81 | create mode 100644 tests/migration/x86_64/Makefile |
82 | rename tests/migration/{x86-a-b-bootblock.s => x86_64/x86-a-b-bootblock.S} (100%) | ||
83 | rename tests/migration/{ => x86_64}/x86-a-b-bootblock.h (93%) | ||
72 | 84 | ||
73 | -- | 85 | -- |
74 | 2.14.3 | 86 | 1.8.3.1 |
75 | 87 | ||
76 | 88 | diff view generated by jsdifflib |
1 | The x86 boot block header currently is generated with a shell script. | 1 | The x86 boot block header currently is generated with a shell script. |
---|---|---|---|
2 | To better support other CPUs (e.g. aarch64), we convert the script | 2 | To better support other CPUs (e.g. aarch64), we convert the script |
3 | into Makefile. This allows us to 1) support cross-compilation easily, | 3 | into Makefile. This allows us to 1) support cross-compilation easily, |
4 | and 2) avoid creating a script file for every architecture. | 4 | and 2) avoid creating a script file for every architecture. |
5 | 5 | ||
6 | Note that, in the new design, the cross compiler prefix can be specified by | ||
7 | setting the CROSS_PREFIX in "make" command. Also to allow gcc pre-processor | ||
8 | to include the C-style file correctly, it also renames the | ||
9 | x86-a-b-bootblock.s file extension from .s to .S. | ||
10 | |||
6 | Signed-off-by: Wei Huang <wei@redhat.com> | 11 | Signed-off-by: Wei Huang <wei@redhat.com> |
7 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
8 | --- | 12 | --- |
9 | tests/migration/Makefile | 36 ++++++++++++++++++++++++++++++++ | 13 | tests/migration/Makefile | 31 ++++++++++++++++++++ |
10 | tests/migration/rebuild-x86-bootblock.sh | 33 ----------------------------- | 14 | tests/migration/rebuild-x86-bootblock.sh | 33 ---------------------- |
11 | tests/migration/x86-a-b-bootblock.h | 2 +- | 15 | .../{x86-a-b-bootblock.s => x86-a-b-bootblock.S} | 0 |
12 | tests/migration/x86-a-b-bootblock.s | 5 ++--- | 16 | 3 files changed, 31 insertions(+), 33 deletions(-) |
13 | 4 files changed, 39 insertions(+), 37 deletions(-) | ||
14 | create mode 100644 tests/migration/Makefile | 17 | create mode 100644 tests/migration/Makefile |
15 | delete mode 100755 tests/migration/rebuild-x86-bootblock.sh | 18 | delete mode 100755 tests/migration/rebuild-x86-bootblock.sh |
19 | rename tests/migration/{x86-a-b-bootblock.s => x86-a-b-bootblock.S} (100%) | ||
16 | 20 | ||
17 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile | 21 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile |
18 | new file mode 100644 | 22 | new file mode 100644 |
19 | index XXXXXXX..XXXXXXX | 23 | index XXXXXXX..XXXXXXX |
20 | --- /dev/null | 24 | --- /dev/null |
21 | +++ b/tests/migration/Makefile | 25 | +++ b/tests/migration/Makefile |
22 | @@ -XXX,XX +XXX,XX @@ | 26 | @@ -XXX,XX +XXX,XX @@ |
23 | +# | 27 | +# To specify cross compiler prefix, use CROSS_PREFIX= |
24 | +# Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates | 28 | +# > make CROSS_PREFIX=x86_64-linux-gnu- |
25 | +# | 29 | + |
26 | +# Authors: | ||
27 | +# Dave Gilbert <dgilbert@redhat.com> | ||
28 | +# | ||
29 | +# This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
30 | +# See the COPYING file in the top-level directory. | ||
31 | +# | ||
32 | +export __note | ||
33 | +override define __note | 30 | +override define __note |
34 | +/* This file is automatically generated from | 31 | +/* This file is automatically generated from |
35 | + * tests/migration/$<, edit that and then run | 32 | + * tests/migration/x86-a-b-bootblock.s, edit that and then run |
36 | + * "make $@" inside tests/migration to update, | 33 | + * tests/migration/rebuild-x86-bootblock.sh to update, |
37 | + * and then remember to send both in your patch submission. | 34 | + * and then remember to send both in your patch submission. |
38 | + */ | 35 | + */ |
39 | +endef | 36 | +endef |
37 | +export __note | ||
40 | + | 38 | + |
39 | +.PHONY: all clean | ||
41 | +all: x86-a-b-bootblock.h | 40 | +all: x86-a-b-bootblock.h |
42 | +# Dummy command so that make thinks it has done something | ||
43 | + @true | ||
44 | + | 41 | + |
45 | +SRC_PATH=../.. | 42 | +x86-a-b-bootblock.h: x86.bootsect |
46 | +include $(SRC_PATH)/rules.mak | 43 | + echo "$$__note" > header.tmp |
44 | + xxd -i $< | sed -e 's/.*int.*//' >> header.tmp | ||
45 | + mv header.tmp $@ | ||
47 | + | 46 | + |
48 | +x86_64_cross_prefix := $(call find-cross-prefix,x86_64) | 47 | +x86.bootsect: x86.boot |
48 | + dd if=$< of=$@ bs=256 count=2 skip=124 | ||
49 | + | 49 | + |
50 | +x86-a-b-bootblock.h: x86-a-b-bootblock.s | 50 | +x86.boot: x86.o |
51 | + $(x86_64_cross_prefix)as --32 -march=i486 $< -o x86.o | 51 | + $(CROSS_PREFIX)objcopy -O binary $< $@ |
52 | + $(x86_64_cross_prefix)objcopy -O binary x86.o x86.boot | 52 | + |
53 | + dd if=x86.boot of=x86.bootsect bs=256 count=2 skip=124 | 53 | +x86.o: x86-a-b-bootblock.S |
54 | + echo "$$__note" > $@ | 54 | + $(CROSS_PREFIX)gcc -m32 -march=i486 -c $< -o $@ |
55 | + xxd -i x86.bootsect | sed -e 's/.*int.*//' >> $@ | ||
56 | + | 55 | + |
57 | +clean: | 56 | +clean: |
58 | + rm -f *.bootsect *.boot *.o | 57 | + @rm -rf *.boot *.o *.bootsect |
59 | diff --git a/tests/migration/rebuild-x86-bootblock.sh b/tests/migration/rebuild-x86-bootblock.sh | 58 | diff --git a/tests/migration/rebuild-x86-bootblock.sh b/tests/migration/rebuild-x86-bootblock.sh |
60 | deleted file mode 100755 | 59 | deleted file mode 100755 |
61 | index XXXXXXX..XXXXXXX | 60 | index XXXXXXX..XXXXXXX |
62 | --- a/tests/migration/rebuild-x86-bootblock.sh | 61 | --- a/tests/migration/rebuild-x86-bootblock.sh |
63 | +++ /dev/null | 62 | +++ /dev/null |
... | ... | ||
93 | - */ | 92 | - */ |
94 | -HERE | 93 | -HERE |
95 | - | 94 | - |
96 | -rm x86.hex x86.bootsect x86.boot x86.o | 95 | -rm x86.hex x86.bootsect x86.boot x86.o |
97 | -cd .. && rmdir "$ASM_WORK_DIR" | 96 | -cd .. && rmdir "$ASM_WORK_DIR" |
98 | diff --git a/tests/migration/x86-a-b-bootblock.h b/tests/migration/x86-a-b-bootblock.h | 97 | diff --git a/tests/migration/x86-a-b-bootblock.s b/tests/migration/x86-a-b-bootblock.S |
99 | index XXXXXXX..XXXXXXX 100644 | 98 | similarity index 100% |
100 | --- a/tests/migration/x86-a-b-bootblock.h | 99 | rename from tests/migration/x86-a-b-bootblock.s |
101 | +++ b/tests/migration/x86-a-b-bootblock.h | 100 | rename to tests/migration/x86-a-b-bootblock.S |
102 | @@ -XXX,XX +XXX,XX @@ | ||
103 | /* This file is automatically generated from | ||
104 | * tests/migration/x86-a-b-bootblock.s, edit that and then run | ||
105 | - * tests/migration/rebuild-x86-bootblock.sh to update, | ||
106 | + * "make x86-a-b-bootblock.h" inside tests/migration to update, | ||
107 | * and then remember to send both in your patch submission. | ||
108 | */ | ||
109 | unsigned char x86_bootsect[] = { | ||
110 | diff --git a/tests/migration/x86-a-b-bootblock.s b/tests/migration/x86-a-b-bootblock.s | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/tests/migration/x86-a-b-bootblock.s | ||
113 | +++ b/tests/migration/x86-a-b-bootblock.s | ||
114 | @@ -XXX,XX +XXX,XX @@ | ||
115 | # range. | ||
116 | # Outputs an initial 'A' on serial followed by repeated 'B's | ||
117 | # | ||
118 | -# run tests/migration/rebuild-x86-bootblock.sh | ||
119 | -# to regenerate the hex, and remember to include both the .h and .s | ||
120 | -# in any patches. | ||
121 | +# In tests/migration dir, run 'make x86-a-b-bootblock.h' to regenerate | ||
122 | +# the hex, and remember to include both the .h and .s in any patches. | ||
123 | # | ||
124 | # Copyright (c) 2016 Red Hat, Inc. and/or its affiliates | ||
125 | # This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
126 | -- | 101 | -- |
127 | 2.14.3 | 102 | 1.8.3.1 |
128 | 103 | ||
129 | 104 | diff view generated by jsdifflib |
1 | This patch moves the auto detection functions for cross compilation from | 1 | Recently a new configure option, CROSS_CC_GUEST, was added to |
---|---|---|---|
2 | roms/Makefile to rules.mak. So the functions can be shared among Makefiles | 2 | $(TARGET)-softmmu/config-target.mak to support TCG-related tests. This |
3 | in QEMU. | 3 | patch tries to leverage this option to support cross compilation when the |
4 | migration boot block file is being re-generated: | ||
5 | |||
6 | * The x86_64 related files are moved to a new sub-dir (named ./x86_64). | ||
7 | * A new top-layer Makefile is created in tests/migration/ directory. | ||
8 | This Makefile searches and parses CROSS_CC_GUEST to generate CROSS_PREFIX. | ||
9 | The CROSS_PREFIX, if available, is then passed to migration/$ARCH/Makefile. | ||
4 | 10 | ||
5 | Signed-off-by: Wei Huang <wei@redhat.com> | 11 | Signed-off-by: Wei Huang <wei@redhat.com> |
6 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
7 | --- | 12 | --- |
8 | roms/Makefile | 24 +++++++----------------- | 13 | tests/migration-test.c | 2 +- |
9 | rules.mak | 15 +++++++++++++++ | 14 | tests/migration/Makefile | 43 +++++++++++++----------- |
10 | 2 files changed, 22 insertions(+), 17 deletions(-) | 15 | tests/migration/x86_64/Makefile | 22 ++++++++++++ |
16 | tests/migration/{ => x86_64}/x86-a-b-bootblock.S | 0 | ||
17 | tests/migration/{ => x86_64}/x86-a-b-bootblock.h | 8 ++--- | ||
18 | 5 files changed, 50 insertions(+), 25 deletions(-) | ||
19 | create mode 100644 tests/migration/x86_64/Makefile | ||
20 | rename tests/migration/{ => x86_64}/x86-a-b-bootblock.S (100%) | ||
21 | rename tests/migration/{ => x86_64}/x86-a-b-bootblock.h (93%) | ||
11 | 22 | ||
12 | diff --git a/roms/Makefile b/roms/Makefile | 23 | diff --git a/tests/migration-test.c b/tests/migration-test.c |
13 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/roms/Makefile | 25 | --- a/tests/migration-test.c |
15 | +++ b/roms/Makefile | 26 | +++ b/tests/migration-test.c |
16 | @@ -XXX,XX +XXX,XX @@ pxe-rom-virtio efi-rom-virtio : DID := 1000 | 27 | @@ -XXX,XX +XXX,XX @@ static const char *tmpfs; |
17 | pxe-rom-vmxnet3 efi-rom-vmxnet3 : VID := 15ad | 28 | /* A simple PC boot sector that modifies memory (1-100MB) quickly |
18 | pxe-rom-vmxnet3 efi-rom-vmxnet3 : DID := 07b0 | 29 | * outputting a 'B' every so often if it's still running. |
19 | 30 | */ | |
20 | -# | 31 | -#include "tests/migration/x86-a-b-bootblock.h" |
21 | -# cross compiler auto detection | 32 | +#include "tests/migration/x86_64/x86-a-b-bootblock.h" |
22 | -# | 33 | |
23 | -path := $(subst :, ,$(PATH)) | 34 | static void init_bootfile_x86(const char *bootpath) |
24 | -system := $(shell uname -s | tr "A-Z" "a-z") | 35 | { |
36 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/tests/migration/Makefile | ||
39 | +++ b/tests/migration/Makefile | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | -# To specify cross compiler prefix, use CROSS_PREFIX= | ||
42 | -# > make CROSS_PREFIX=x86_64-linux-gnu- | ||
43 | +# | ||
44 | +# Copyright (c) 2018 Red Hat, Inc. and/or its affiliates | ||
45 | +# | ||
46 | +# This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
47 | +# See the COPYING file in the top-level directory. | ||
48 | +# | ||
49 | + | ||
50 | +TARGET_LIST = x86_64 | ||
51 | + | ||
52 | +SRC_PATH = ../.. | ||
53 | |||
54 | override define __note | ||
55 | -/* This file is automatically generated from | ||
56 | - * tests/migration/x86-a-b-bootblock.s, edit that and then run | ||
57 | - * tests/migration/rebuild-x86-bootblock.sh to update, | ||
58 | - * and then remember to send both in your patch submission. | ||
59 | +/* This file is automatically generated from the assembly file in | ||
60 | + * tests/migration/$@, edit that and then run "make all" | ||
61 | + * inside tests/migration to update, and then remember to send both | ||
62 | + * in your patch submission. | ||
63 | */ | ||
64 | endef | ||
65 | export __note | ||
66 | |||
67 | -.PHONY: all clean | ||
68 | -all: x86-a-b-bootblock.h | ||
25 | - | 69 | - |
26 | -# first find cross binutils in path | 70 | -x86-a-b-bootblock.h: x86.bootsect |
27 | -find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path)))) | 71 | - echo "$$__note" > header.tmp |
28 | -# then check we have cross gcc too | 72 | - xxd -i $< | sed -e 's/.*int.*//' >> header.tmp |
29 | -find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1))))) | 73 | - mv header.tmp $@ |
30 | -# finally strip off path + toolname so we get the prefix | 74 | +parse-cross-prefix = $(subst gcc,,$(patsubst cc,gcc,$(patsubst CROSS_CC_GUEST="%",%,$(shell grep "CROSS_CC_GUEST=" $(SRC_PATH)/$(1)-softmmu/config-target.mak)))) |
31 | -find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) | 75 | +gen-cross-prefix = $(patsubst %-,CROSS_PREFIX=%-,$(call parse-cross-prefix,$(1))) |
32 | - | 76 | |
33 | -powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) | 77 | -x86.bootsect: x86.boot |
34 | -powerpc_cross_prefix := $(call find-cross-prefix,powerpc) | 78 | - dd if=$< of=$@ bs=256 count=2 skip=124 |
35 | -x86_64_cross_prefix := $(call find-cross-prefix,x86_64) | 79 | +.PHONY: all $(TARGET_LIST) |
36 | - | 80 | |
37 | # tag our seabios builds | 81 | -x86.boot: x86.o |
38 | SEABIOS_EXTRAVERSION="-prebuilt.qemu-project.org" | 82 | - $(CROSS_PREFIX)objcopy -O binary $< $@ |
39 | 83 | +all: $(TARGET_LIST) | |
40 | @@ -XXX,XX +XXX,XX @@ default: | 84 | |
41 | @echo " skiboot -- update skiboot.lid" | 85 | -x86.o: x86-a-b-bootblock.S |
42 | @echo " u-boot.e500 -- update u-boot.e500" | 86 | - $(CROSS_PREFIX)gcc -m32 -march=i486 -c $< -o $@ |
43 | 87 | +$(TARGET_LIST): | |
44 | +SRC_PATH=.. | 88 | + $(MAKE) -C $@ $(call gen-cross-prefix,$@) |
45 | +include $(SRC_PATH)/rules.mak | 89 | |
90 | clean: | ||
91 | - @rm -rf *.boot *.o *.bootsect | ||
92 | + for target in $(TARGET_LIST); do \ | ||
93 | + $(MAKE) -C $$target clean; \ | ||
94 | + done | ||
95 | diff --git a/tests/migration/x86_64/Makefile b/tests/migration/x86_64/Makefile | ||
96 | new file mode 100644 | ||
97 | index XXXXXXX..XXXXXXX | ||
98 | --- /dev/null | ||
99 | +++ b/tests/migration/x86_64/Makefile | ||
100 | @@ -XXX,XX +XXX,XX @@ | ||
101 | +# To specify cross compiler prefix, use CROSS_PREFIX= | ||
102 | +# > make CROSS_PREFIX=x86_64-linux-gnu- | ||
46 | + | 103 | + |
47 | +powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) | 104 | +.PHONY: all clean |
48 | +powerpc_cross_prefix := $(call find-cross-prefix,powerpc) | 105 | +all: x86-a-b-bootblock.h |
49 | +x86_64_cross_prefix := $(call find-cross-prefix,x86_64) | ||
50 | + | 106 | + |
51 | bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k | 107 | +x86-a-b-bootblock.h: x86.bootsect |
52 | cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin | 108 | + echo "$$__note" > header.tmp |
53 | cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin | 109 | + xxd -i $< | sed -e 's/.*int.*//' >> header.tmp |
54 | diff --git a/rules.mak b/rules.mak | 110 | + mv header.tmp $@ |
111 | + | ||
112 | +x86.bootsect: x86.boot | ||
113 | + dd if=$< of=$@ bs=256 count=2 skip=124 | ||
114 | + | ||
115 | +x86.boot: x86.o | ||
116 | + $(CROSS_PREFIX)objcopy -O binary $< $@ | ||
117 | + | ||
118 | +x86.o: x86-a-b-bootblock.S | ||
119 | + $(CROSS_PREFIX)gcc -m32 -march=i486 -c $< -o $@ | ||
120 | + | ||
121 | +clean: | ||
122 | + @rm -rf *.boot *.o *.bootsect | ||
123 | diff --git a/tests/migration/x86-a-b-bootblock.S b/tests/migration/x86_64/x86-a-b-bootblock.S | ||
124 | similarity index 100% | ||
125 | rename from tests/migration/x86-a-b-bootblock.S | ||
126 | rename to tests/migration/x86_64/x86-a-b-bootblock.S | ||
127 | diff --git a/tests/migration/x86-a-b-bootblock.h b/tests/migration/x86_64/x86-a-b-bootblock.h | ||
128 | similarity index 93% | ||
129 | rename from tests/migration/x86-a-b-bootblock.h | ||
130 | rename to tests/migration/x86_64/x86-a-b-bootblock.h | ||
55 | index XXXXXXX..XXXXXXX 100644 | 131 | index XXXXXXX..XXXXXXX 100644 |
56 | --- a/rules.mak | 132 | --- a/tests/migration/x86-a-b-bootblock.h |
57 | +++ b/rules.mak | 133 | +++ b/tests/migration/x86_64/x86-a-b-bootblock.h |
58 | @@ -XXX,XX +XXX,XX @@ expand-objs = $(strip $(sort $(filter %.o,$1)) \ | 134 | @@ -XXX,XX +XXX,XX @@ |
59 | $(foreach o,$(filter %.mo,$1),$($o-objs)) \ | 135 | -/* This file is automatically generated from |
60 | $(filter-out %.o %.mo,$1)) | 136 | - * tests/migration/x86-a-b-bootblock.s, edit that and then run |
61 | 137 | - * tests/migration/rebuild-x86-bootblock.sh to update, | |
62 | +# Cross compilation auto detection. Use find-cross-prefix to detect the | 138 | - * and then remember to send both in your patch submission. |
63 | +# target archtecture's prefix, and then append it to the build tool or pass | 139 | +/* This file is automatically generated from the assembly file in |
64 | +# it to CROSS_COMPILE directly. Here is one example: | 140 | + * tests/migration/x86_64, edit that and then run "make all" |
65 | +# x86_64_cross_prefix := $(call find-cross-prefix,x86_64) | 141 | + * inside tests/migration to update, and then remember to send both |
66 | +# $(x86_64_cross_prefix)gcc -c test.c -o test.o | 142 | + * in your patch submission. |
67 | +# make -C testdir CROSS_COMPILE=$(x86_64_cross_prefix) | 143 | */ |
68 | +cross-search-path := $(subst :, ,$(PATH)) | 144 | unsigned char x86_bootsect[] = { |
69 | +cross-host-system := $(shell uname -s | tr "A-Z" "a-z") | 145 | 0xfa, 0x0f, 0x01, 0x16, 0x74, 0x7c, 0x66, 0xb8, 0x01, 0x00, 0x00, 0x00, |
70 | + | ||
71 | +find-cross-ld = $(firstword $(wildcard $(patsubst \ | ||
72 | + %,%/$(1)-*$(cross-host-system)*-ld,$(cross-search-path)))) | ||
73 | +find-cross-gcc = $(firstword $(wildcard \ | ||
74 | + $(patsubst %ld,%gcc,$(call find-cross-ld,$(1))))) | ||
75 | +find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) | ||
76 | + | ||
77 | %.o: %.c | ||
78 | $(call quiet-command,$(CC) $(QEMU_LOCAL_INCLUDES) $(QEMU_INCLUDES) \ | ||
79 | $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) \ | ||
80 | -- | 146 | -- |
81 | 2.14.3 | 147 | 1.8.3.1 |
82 | 148 | ||
83 | 149 | diff view generated by jsdifflib |
1 | This patch moves the settings related migration-test from the | 1 | This patch moves the settings related migration-test from the |
---|---|---|---|
2 | migration-test.c file to a seperate header file. It also renames the | 2 | migration-test.c file to a new header file. |
3 | x86-a-b-bootblock.s file extension from .s to .S, allowing gcc | ||
4 | pre-processor to include the C-style header file correctly. | ||
5 | 3 | ||
6 | Signed-off-by: Wei Huang <wei@redhat.com> | 4 | Signed-off-by: Wei Huang <wei@redhat.com> |
7 | --- | 5 | --- |
8 | tests/migration-test.c | 34 +++++++++++++--------- | 6 | tests/migration-test.c | 28 ++++++++++++++++++---------- |
9 | tests/migration/Makefile | 4 +-- | 7 | tests/migration/migration-test.h | 21 +++++++++++++++++++++ |
10 | tests/migration/migration-test.h | 22 ++++++++++++++ | 8 | 2 files changed, 39 insertions(+), 10 deletions(-) |
11 | .../{x86-a-b-bootblock.s => x86-a-b-bootblock.S} | 7 +++-- | ||
12 | tests/migration/x86-a-b-bootblock.h | 2 +- | ||
13 | 5 files changed, 49 insertions(+), 20 deletions(-) | ||
14 | create mode 100644 tests/migration/migration-test.h | 9 | create mode 100644 tests/migration/migration-test.h |
15 | rename tests/migration/{x86-a-b-bootblock.s => x86-a-b-bootblock.S} (94%) | ||
16 | 10 | ||
17 | diff --git a/tests/migration-test.c b/tests/migration-test.c | 11 | diff --git a/tests/migration-test.c b/tests/migration-test.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tests/migration-test.c | 13 | --- a/tests/migration-test.c |
20 | +++ b/tests/migration-test.c | 14 | +++ b/tests/migration-test.c |
21 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ |
16 | #include "chardev/char.h" | ||
22 | #include "sysemu/sysemu.h" | 17 | #include "sysemu/sysemu.h" |
23 | #include "hw/nvram/chrp_nvram.h" | 18 | |
24 | |||
25 | -#define MIN_NVRAM_SIZE 8192 /* from spapr_nvram.c */ | ||
26 | +#include "migration/migration-test.h" | 19 | +#include "migration/migration-test.h" |
20 | + | ||
21 | /* TODO actually test the results and get rid of this */ | ||
22 | #define qtest_qmp_discard_response(...) qobject_unref(qtest_qmp(__VA_ARGS__)) | ||
27 | 23 | ||
28 | -const unsigned start_address = 1024 * 1024; | 24 | -const unsigned start_address = 1024 * 1024; |
29 | -const unsigned end_address = 100 * 1024 * 1024; | 25 | -const unsigned end_address = 100 * 1024 * 1024; |
30 | +unsigned start_address; | 26 | +unsigned start_address; |
31 | +unsigned end_address; | 27 | +unsigned end_address; |
32 | bool got_stop; | 28 | bool got_stop; |
33 | 29 | static bool uffd_feature_thread_id; | |
34 | #if defined(__linux__) | 30 | |
35 | @@ -XXX,XX +XXX,XX @@ static bool ufd_version_check(void) | 31 | @@ -XXX,XX +XXX,XX @@ static bool ufd_version_check(void) |
36 | 32 | ||
37 | static const char *tmpfs; | 33 | static const char *tmpfs; |
38 | 34 | ||
39 | -/* A simple PC boot sector that modifies memory (1-100MB) quickly | 35 | -/* A simple PC boot sector that modifies memory (1-100MB) quickly |
40 | - * outputting a 'B' every so often if it's still running. | 36 | - * outputting a 'B' every so often if it's still running. |
41 | +/* The boot file modifies memory area in [start_address, end_address) | 37 | +/* The boot file modifies memory area in [start_address, end_address) |
42 | + * repeatedly. It outputs a 'B' at a fixed rate while it's still running. | 38 | + * repeatedly. It outputs a 'B' at a fixed rate while it's still running. |
43 | */ | 39 | */ |
44 | #include "tests/migration/x86-a-b-bootblock.h" | 40 | #include "tests/migration/x86_64/x86-a-b-bootblock.h" |
45 | 41 | ||
46 | @@ -XXX,XX +XXX,XX @@ static void init_bootfile_ppc(const char *bootpath) | ||
47 | memcpy(header->name, "common", 6); | ||
48 | chrp_nvram_finish_partition(header, MIN_NVRAM_SIZE); | ||
49 | |||
50 | - /* FW_MAX_SIZE is 4MB, but slof.bin is only 900KB, | ||
51 | - * so let's modify memory between 1MB and 100MB | ||
52 | - * to do like PC bootsector | ||
53 | + /* FW_MAX_SIZE is 4MB, but slof.bin is only 900KB. So it is OK to modify | ||
54 | + * memory between start_address and end_address like PC bootsector does. | ||
55 | */ | ||
56 | |||
57 | sprintf(buf + 16, | ||
58 | @@ -XXX,XX +XXX,XX @@ static void wait_for_migration_pass(QTestState *who) | 42 | @@ -XXX,XX +XXX,XX @@ static void wait_for_migration_pass(QTestState *who) |
59 | static void check_guests_ram(QTestState *who) | 43 | static void check_guests_ram(QTestState *who) |
60 | { | 44 | { |
61 | /* Our ASM test will have been incrementing one byte from each page from | 45 | /* Our ASM test will have been incrementing one byte from each page from |
62 | - * 1MB to <100MB in order. | 46 | - * 1MB to <100MB in order. |
... | ... | ||
80 | + for (address = start_address + TEST_MEM_PAGE_SIZE; address < end_address; | 64 | + for (address = start_address + TEST_MEM_PAGE_SIZE; address < end_address; |
81 | + address += TEST_MEM_PAGE_SIZE) | 65 | + address += TEST_MEM_PAGE_SIZE) |
82 | { | 66 | { |
83 | uint8_t b; | 67 | uint8_t b; |
84 | qtest_memread(who, address, &b, 1); | 68 | qtest_memread(who, address, &b, 1); |
85 | @@ -XXX,XX +XXX,XX @@ static void test_migrate_start(QTestState **from, QTestState **to, | 69 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, |
86 | " -drive file=%s,format=raw" | 70 | " -drive file=%s,format=raw" |
87 | " -incoming %s", | 71 | " -incoming %s", |
88 | accel, tmpfs, bootpath, uri); | 72 | accel, tmpfs, bootpath, uri); |
89 | + | ||
90 | + start_address = X86_TEST_MEM_START; | 73 | + start_address = X86_TEST_MEM_START; |
91 | + end_address = X86_TEST_MEM_END; | 74 | + end_address = X86_TEST_MEM_END; |
92 | } else if (strcmp(arch, "ppc64") == 0) { | 75 | } else if (strcmp(arch, "ppc64") == 0) { |
93 | 76 | cmd_src = g_strdup_printf("-machine accel=%s -m 256M" | |
94 | /* On ppc64, the test only works with kvm-hv, but not with kvm-pr */ | 77 | " -name source,debug-threads=on" |
95 | @@ -XXX,XX +XXX,XX @@ static void test_migrate_start(QTestState **from, QTestState **to, | 78 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, |
96 | " -serial file:%s/dest_serial" | 79 | " -serial file:%s/dest_serial" |
97 | " -incoming %s", | 80 | " -incoming %s", |
98 | accel, tmpfs, uri); | 81 | accel, tmpfs, uri); |
99 | + | 82 | + |
100 | + start_address = PPC_TEST_MEM_START; | 83 | + start_address = PPC_TEST_MEM_START; |
101 | + end_address = PPC_TEST_MEM_END; | 84 | + end_address = PPC_TEST_MEM_END; |
102 | } else { | 85 | } else { |
103 | g_assert_not_reached(); | 86 | g_assert_not_reached(); |
104 | } | 87 | } |
105 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/tests/migration/Makefile | ||
108 | +++ b/tests/migration/Makefile | ||
109 | @@ -XXX,XX +XXX,XX @@ include $(SRC_PATH)/rules.mak | ||
110 | |||
111 | x86_64_cross_prefix := $(call find-cross-prefix,x86_64) | ||
112 | |||
113 | -x86-a-b-bootblock.h: x86-a-b-bootblock.s | ||
114 | - $(x86_64_cross_prefix)as --32 -march=i486 $< -o x86.o | ||
115 | +x86-a-b-bootblock.h: x86-a-b-bootblock.S | ||
116 | + $(x86_64_cross_prefix)gcc -m32 -march=i486 -c $< -o x86.o | ||
117 | $(x86_64_cross_prefix)objcopy -O binary x86.o x86.boot | ||
118 | dd if=x86.boot of=x86.bootsect bs=256 count=2 skip=124 | ||
119 | echo "$$__note" > $@ | ||
120 | diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h | 88 | diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h |
121 | new file mode 100644 | 89 | new file mode 100644 |
122 | index XXXXXXX..XXXXXXX | 90 | index XXXXXXX..XXXXXXX |
123 | --- /dev/null | 91 | --- /dev/null |
124 | +++ b/tests/migration/migration-test.h | 92 | +++ b/tests/migration/migration-test.h |
... | ... | ||
140 | +#define X86_TEST_MEM_END (100 * 1024 * 1024) | 108 | +#define X86_TEST_MEM_END (100 * 1024 * 1024) |
141 | + | 109 | + |
142 | +/* PPC */ | 110 | +/* PPC */ |
143 | +#define PPC_TEST_MEM_START (1 * 1024 * 1024) | 111 | +#define PPC_TEST_MEM_START (1 * 1024 * 1024) |
144 | +#define PPC_TEST_MEM_END (100 * 1024 * 1024) | 112 | +#define PPC_TEST_MEM_END (100 * 1024 * 1024) |
145 | +#define MIN_NVRAM_SIZE 8192 /* from spapr_nvram.c */ | ||
146 | + | 113 | + |
147 | +#endif /* _TEST_MIGRATION_H_ */ | 114 | +#endif /* _TEST_MIGRATION_H_ */ |
148 | diff --git a/tests/migration/x86-a-b-bootblock.s b/tests/migration/x86-a-b-bootblock.S | ||
149 | similarity index 94% | ||
150 | rename from tests/migration/x86-a-b-bootblock.s | ||
151 | rename to tests/migration/x86-a-b-bootblock.S | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/tests/migration/x86-a-b-bootblock.s | ||
154 | +++ b/tests/migration/x86-a-b-bootblock.S | ||
155 | @@ -XXX,XX +XXX,XX @@ | ||
156 | # | ||
157 | # Author: dgilbert@redhat.com | ||
158 | |||
159 | +#include "migration-test.h" | ||
160 | |||
161 | .code16 | ||
162 | .org 0x7c00 | ||
163 | @@ -XXX,XX +XXX,XX @@ start: # at 0x7c00 ? | ||
164 | mov $0, %bl | ||
165 | mainloop: | ||
166 | # Start from 1MB | ||
167 | - mov $(1024*1024),%eax | ||
168 | + mov $X86_TEST_MEM_START,%eax | ||
169 | innerloop: | ||
170 | incb (%eax) | ||
171 | - add $4096,%eax | ||
172 | - cmp $(100*1024*1024),%eax | ||
173 | + add $TEST_MEM_PAGE_SIZE,%eax | ||
174 | + cmp $X86_TEST_MEM_END,%eax | ||
175 | jl innerloop | ||
176 | |||
177 | inc %bl | ||
178 | diff --git a/tests/migration/x86-a-b-bootblock.h b/tests/migration/x86-a-b-bootblock.h | ||
179 | index XXXXXXX..XXXXXXX 100644 | ||
180 | --- a/tests/migration/x86-a-b-bootblock.h | ||
181 | +++ b/tests/migration/x86-a-b-bootblock.h | ||
182 | @@ -XXX,XX +XXX,XX @@ | ||
183 | /* This file is automatically generated from | ||
184 | - * tests/migration/x86-a-b-bootblock.s, edit that and then run | ||
185 | + * tests/migration/x86-a-b-bootblock.S, edit that and then run | ||
186 | * "make x86-a-b-bootblock.h" inside tests/migration to update, | ||
187 | * and then remember to send both in your patch submission. | ||
188 | */ | ||
189 | -- | 115 | -- |
190 | 2.14.3 | 116 | 1.8.3.1 |
191 | 117 | ||
192 | 118 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
8 | * The serial output is sent to PL011 directly. | 8 | * The serial output is sent to PL011 directly. |
9 | * The physical memory base for mach-virt machine is 0x40000000. We change | 9 | * The physical memory base for mach-virt machine is 0x40000000. We change |
10 | the start_address and end_address for aarch64. | 10 | the start_address and end_address for aarch64. |
11 | 11 | ||
12 | In addition to providing the binary, this patch also includes the source | 12 | In addition to providing the binary, this patch also includes the source |
13 | code and the build script in tests/migration/. So users can change the | 13 | code and the build script in tests/migration/aarch64. So users can change |
14 | source and/or re-compile the binary as they wish. | 14 | the source and/or re-compile the binary as they wish. |
15 | 15 | ||
16 | Signed-off-by: Wei Huang <wei@redhat.com> | 16 | Signed-off-by: Wei Huang <wei@redhat.com> |
17 | --- | 17 | --- |
18 | tests/Makefile.include | 1 + | 18 | tests/Makefile.include | 1 + |
19 | tests/migration-test.c | 44 +++++++++++++++++++-- | 19 | tests/migration-test.c | 38 ++++++++++++-- |
20 | tests/migration/Makefile | 12 +++++- | 20 | tests/migration/Makefile | 2 +- |
21 | tests/migration/aarch64-a-b-kernel.S | 75 ++++++++++++++++++++++++++++++++++++ | 21 | tests/migration/aarch64/Makefile | 20 ++++++++ |
22 | tests/migration/aarch64-a-b-kernel.h | 19 +++++++++ | 22 | tests/migration/aarch64/aarch64-a-b-kernel.S | 75 ++++++++++++++++++++++++++++ |
23 | tests/migration/migration-test.h | 9 +++++ | 23 | tests/migration/aarch64/aarch64-a-b-kernel.h | 19 +++++++ |
24 | 6 files changed, 154 insertions(+), 6 deletions(-) | 24 | tests/migration/migration-test.h | 9 ++++ |
25 | create mode 100644 tests/migration/aarch64-a-b-kernel.S | 25 | 7 files changed, 159 insertions(+), 5 deletions(-) |
26 | create mode 100644 tests/migration/aarch64-a-b-kernel.h | 26 | create mode 100644 tests/migration/aarch64/Makefile |
27 | create mode 100644 tests/migration/aarch64/aarch64-a-b-kernel.S | ||
28 | create mode 100644 tests/migration/aarch64/aarch64-a-b-kernel.h | ||
27 | 29 | ||
28 | diff --git a/tests/Makefile.include b/tests/Makefile.include | 30 | diff --git a/tests/Makefile.include b/tests/Makefile.include |
29 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/tests/Makefile.include | 32 | --- a/tests/Makefile.include |
31 | +++ b/tests/Makefile.include | 33 | +++ b/tests/Makefile.include |
32 | @@ -XXX,XX +XXX,XX @@ check-qtest-arm-y += tests/sdhci-test$(EXESUF) | 34 | @@ -XXX,XX +XXX,XX @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF) |
33 | check-qtest-aarch64-y = tests/numa-test$(EXESUF) | 35 | check-qtest-aarch64-y = tests/numa-test$(EXESUF) |
34 | check-qtest-aarch64-y += tests/sdhci-test$(EXESUF) | 36 | check-qtest-aarch64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF) |
35 | check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF) | 37 | check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF) |
36 | +check-qtest-aarch64-y += tests/migration-test$(EXESUF) | 38 | +check-qtest-aarch64-y += tests/migration-test$(EXESUF) |
37 | 39 | ||
38 | check-qtest-microblazeel-y = $(check-qtest-microblaze-y) | 40 | check-qtest-microblazeel-y = $(check-qtest-microblaze-y) |
39 | 41 | ||
40 | diff --git a/tests/migration-test.c b/tests/migration-test.c | 42 | diff --git a/tests/migration-test.c b/tests/migration-test.c |
41 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/tests/migration-test.c | 44 | --- a/tests/migration-test.c |
43 | +++ b/tests/migration-test.c | 45 | +++ b/tests/migration-test.c |
44 | @@ -XXX,XX +XXX,XX @@ | 46 | @@ -XXX,XX +XXX,XX @@ static bool uffd_feature_thread_id; |
45 | */ | 47 | #if defined(__linux__) |
46 | 48 | #include <sys/syscall.h> | |
47 | #include "qemu/osdep.h" | 49 | #include <sys/vfs.h> |
48 | +#include <sys/utsname.h> | 50 | +#include <sys/utsname.h> |
49 | 51 | #endif | |
50 | #include "libqtest.h" | 52 | |
51 | #include "qapi/qmp/qdict.h" | 53 | #if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD) |
52 | @@ -XXX,XX +XXX,XX @@ static const char *tmpfs; | 54 | @@ -XXX,XX +XXX,XX @@ static const char *tmpfs; |
53 | * repeatedly. It outputs a 'B' at a fixed rate while it's still running. | 55 | * repeatedly. It outputs a 'B' at a fixed rate while it's still running. |
54 | */ | 56 | */ |
55 | #include "tests/migration/x86-a-b-bootblock.h" | 57 | #include "tests/migration/x86_64/x86-a-b-bootblock.h" |
56 | +#include "tests/migration/aarch64-a-b-kernel.h" | 58 | +#include "tests/migration/aarch64/aarch64-a-b-kernel.h" |
57 | 59 | ||
58 | -static void init_bootfile_x86(const char *bootpath) | 60 | -static void init_bootfile_x86(const char *bootpath) |
59 | +static void init_bootfile(const char *bootpath, void *content) | 61 | +static void init_bootfile(const char *bootpath, void *content) |
60 | { | 62 | { |
61 | FILE *bootfile = fopen(bootpath, "wb"); | 63 | FILE *bootfile = fopen(bootpath, "wb"); |
62 | 64 | ||
63 | - g_assert_cmpint(fwrite(x86_bootsect, 512, 1, bootfile), ==, 1); | 65 | - g_assert_cmpint(fwrite(x86_bootsect, 512, 1, bootfile), ==, 1); |
64 | + g_assert_cmpint(fwrite(content, 512, 1, bootfile), ==, 1); | 66 | + g_assert_cmpint(fwrite(content, 512, 1, bootfile), ==, 1); |
65 | fclose(bootfile); | 67 | fclose(bootfile); |
66 | } | 68 | } |
67 | 69 | ||
68 | @@ -XXX,XX +XXX,XX @@ static void test_migrate_start(QTestState **from, QTestState **to, | 70 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, |
69 | got_stop = false; | 71 | got_stop = false; |
70 | 72 | ||
71 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { | 73 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { |
72 | - init_bootfile_x86(bootpath); | 74 | - init_bootfile_x86(bootpath); |
73 | + init_bootfile(bootpath, x86_bootsect); | 75 | + init_bootfile(bootpath, x86_bootsect); |
74 | cmd_src = g_strdup_printf("-machine accel=%s -m 150M" | 76 | cmd_src = g_strdup_printf("-machine accel=%s -m 150M" |
75 | " -name source,debug-threads=on" | 77 | " -name source,debug-threads=on" |
76 | " -serial file:%s/src_serial" | 78 | " -serial file:%s/src_serial" |
77 | @@ -XXX,XX +XXX,XX @@ static void test_migrate_start(QTestState **from, QTestState **to, | 79 | @@ -XXX,XX +XXX,XX @@ static int test_migrate_start(QTestState **from, QTestState **to, |
78 | 80 | ||
79 | start_address = PPC_TEST_MEM_START; | 81 | start_address = PPC_TEST_MEM_START; |
80 | end_address = PPC_TEST_MEM_END; | 82 | end_address = PPC_TEST_MEM_END; |
81 | + } else if (strcmp(arch, "aarch64") == 0) { | 83 | + } else if (strcmp(arch, "aarch64") == 0) { |
82 | + const char *cpu; | ||
83 | + const char *gic_ver; | ||
84 | + struct utsname utsname; | 84 | + struct utsname utsname; |
85 | + | 85 | + |
86 | + /* kvm and tcg need different cpu and gic-version configs */ | 86 | + /* kvm and tcg need different cpu and gic-version configs */ |
87 | + if (access("/dev/kvm", F_OK) == 0 && uname(&utsname) == 0 && | 87 | + if (access("/dev/kvm", F_OK) == 0 && uname(&utsname) == 0 && |
88 | + strcmp(utsname.machine, "aarch64") == 0) { | 88 | + strcmp(utsname.machine, "aarch64") == 0) { |
89 | + accel = "kvm"; | 89 | + accel = "kvm"; |
90 | + cpu = "host"; | ||
91 | + gic_ver = "host"; | ||
92 | + } else { | 90 | + } else { |
93 | + accel = "tcg"; | 91 | + accel = "tcg"; |
94 | + cpu = "cortex-a57"; | ||
95 | + gic_ver = "2"; | ||
96 | + } | 92 | + } |
97 | + | 93 | + |
98 | + init_bootfile(bootpath, aarch64_kernel); | 94 | + init_bootfile(bootpath, aarch64_kernel); |
99 | + cmd_src = g_strdup_printf("-machine virt,accel=%s,gic-version=%s " | 95 | + cmd_src = g_strdup_printf("-machine virt,accel=%s,gic-version=max " |
100 | + "-name vmsource,debug-threads=on -cpu %s " | 96 | + "-name vmsource,debug-threads=on -cpu max " |
101 | + "-m 150M -serial file:%s/src_serial " | 97 | + "-m 150M -serial file:%s/src_serial " |
102 | + "-kernel %s ", | 98 | + "-kernel %s ", |
103 | + accel, gic_ver, cpu, tmpfs, bootpath); | 99 | + accel, tmpfs, bootpath); |
104 | + cmd_dst = g_strdup_printf("-machine virt,accel=%s,gic-version=%s " | 100 | + cmd_dst = g_strdup_printf("-machine virt,accel=%s,gic-version=max " |
105 | + "-name vmdest,debug-threads=on -cpu %s " | 101 | + "-name vmdest,debug-threads=on -cpu max " |
106 | + "-m 150M -serial file:%s/dest_serial " | 102 | + "-m 150M -serial file:%s/dest_serial " |
107 | + "-kernel %s " | 103 | + "-kernel %s " |
108 | + "-incoming %s ", | 104 | + "-incoming %s ", |
109 | + accel, gic_ver, cpu, tmpfs, bootpath, uri); | 105 | + accel, tmpfs, bootpath, uri); |
110 | + | 106 | + |
111 | + start_address = ARM_TEST_MEM_START; | 107 | + start_address = ARM_TEST_MEM_START; |
112 | + end_address = ARM_TEST_MEM_END; | 108 | + end_address = ARM_TEST_MEM_END; |
113 | + | 109 | + |
114 | + g_assert(sizeof(aarch64_kernel) <= ARM_TEST_MAX_KERNEL_SIZE); | 110 | + g_assert(sizeof(aarch64_kernel) <= ARM_TEST_MAX_KERNEL_SIZE); |
... | ... | ||
121 | 117 | ||
122 | - from = qtest_start(""); | 118 | - from = qtest_start(""); |
123 | + from = qtest_start("-machine none"); | 119 | + from = qtest_start("-machine none"); |
124 | 120 | ||
125 | deprecated_set_downtime(from, 0.12345); | 121 | deprecated_set_downtime(from, 0.12345); |
126 | deprecated_set_speed(from, "12345"); | 122 | deprecated_set_speed(from, 12345); |
127 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile | 123 | diff --git a/tests/migration/Makefile b/tests/migration/Makefile |
128 | index XXXXXXX..XXXXXXX 100644 | 124 | index XXXXXXX..XXXXXXX 100644 |
129 | --- a/tests/migration/Makefile | 125 | --- a/tests/migration/Makefile |
130 | +++ b/tests/migration/Makefile | 126 | +++ b/tests/migration/Makefile |
131 | @@ -XXX,XX +XXX,XX @@ override define __note | 127 | @@ -XXX,XX +XXX,XX @@ |
132 | */ | 128 | # See the COPYING file in the top-level directory. |
133 | endef | 129 | # |
134 | 130 | ||
135 | -all: x86-a-b-bootblock.h | 131 | -TARGET_LIST = x86_64 |
136 | +all: x86-a-b-bootblock.h aarch64-a-b-kernel.h | 132 | +TARGET_LIST = x86_64 aarch64 |
137 | # Dummy command so that make thinks it has done something | 133 | |
138 | @true | 134 | SRC_PATH = ../.. |
139 | 135 | ||
140 | @@ -XXX,XX +XXX,XX @@ SRC_PATH=../.. | 136 | diff --git a/tests/migration/aarch64/Makefile b/tests/migration/aarch64/Makefile |
141 | include $(SRC_PATH)/rules.mak | ||
142 | |||
143 | x86_64_cross_prefix := $(call find-cross-prefix,x86_64) | ||
144 | +aarch64_cross_prefix := $(call find-cross-prefix,aarch64) | ||
145 | |||
146 | x86-a-b-bootblock.h: x86-a-b-bootblock.S | ||
147 | $(x86_64_cross_prefix)gcc -m32 -march=i486 -c $< -o x86.o | ||
148 | @@ -XXX,XX +XXX,XX @@ x86-a-b-bootblock.h: x86-a-b-bootblock.S | ||
149 | echo "$$__note" > $@ | ||
150 | xxd -i x86.bootsect | sed -e 's/.*int.*//' >> $@ | ||
151 | |||
152 | +aarch64-a-b-kernel.h: aarch64-a-b-kernel.S | ||
153 | + $(aarch64_cross_prefix)gcc -o aarch64.elf -nostdlib \ | ||
154 | + -Wl,--build-id=none $< | ||
155 | + $(aarch64_cross_prefix)objcopy -O binary aarch64.elf aarch64.kernel | ||
156 | + echo "$$__note" > $@ | ||
157 | + xxd -i aarch64.kernel | sed -e 's/.*int.*//' >> $@ | ||
158 | + | ||
159 | clean: | ||
160 | - rm -f *.bootsect *.boot *.o | ||
161 | + rm -f *.bootsect *.boot *.o *.elf *.kernel | ||
162 | diff --git a/tests/migration/aarch64-a-b-kernel.S b/tests/migration/aarch64-a-b-kernel.S | ||
163 | new file mode 100644 | 137 | new file mode 100644 |
164 | index XXXXXXX..XXXXXXX | 138 | index XXXXXXX..XXXXXXX |
165 | --- /dev/null | 139 | --- /dev/null |
166 | +++ b/tests/migration/aarch64-a-b-kernel.S | 140 | +++ b/tests/migration/aarch64/Makefile |
141 | @@ -XXX,XX +XXX,XX @@ | ||
142 | +# To specify cross compiler prefix, use CROSS_PREFIX= | ||
143 | +# > make CROSS_PREFIX=aarch64-linux-gnu- | ||
144 | + | ||
145 | +.PHONY: all clean | ||
146 | +all: aarch64-a-b-kernel.h | ||
147 | + | ||
148 | +aarch64-a-b-kernel.h: aarch64.kernel | ||
149 | + echo "$$__note" > header.tmp | ||
150 | + xxd -i $< | sed -e 's/.*int.*//' >> header.tmp | ||
151 | + mv header.tmp $@ | ||
152 | + | ||
153 | +aarch64.kernel: aarch64.elf | ||
154 | + $(CROSS_PREFIX)objcopy -O binary $< $@ | ||
155 | + | ||
156 | +aarch64.elf: aarch64-a-b-kernel.S | ||
157 | + $(CROSS_PREFIX)gcc -o $@ -nostdlib -Wl,--build-id=none $< | ||
158 | + | ||
159 | +clean: | ||
160 | + @rm -rf *.kernel *.elf | ||
161 | + | ||
162 | diff --git a/tests/migration/aarch64/aarch64-a-b-kernel.S b/tests/migration/aarch64/aarch64-a-b-kernel.S | ||
163 | new file mode 100644 | ||
164 | index XXXXXXX..XXXXXXX | ||
165 | --- /dev/null | ||
166 | +++ b/tests/migration/aarch64/aarch64-a-b-kernel.S | ||
167 | @@ -XXX,XX +XXX,XX @@ | 167 | @@ -XXX,XX +XXX,XX @@ |
168 | +# | 168 | +# |
169 | +# Copyright (c) 2018 Red Hat, Inc. and/or its affiliates | 169 | +# Copyright (c) 2018 Red Hat, Inc. and/or its affiliates |
170 | +# | 170 | +# |
171 | +# Author: | 171 | +# Author: |
... | ... | ||
176 | +# | 176 | +# |
177 | +# Note: Please make sure the compiler compiles the assembly code below with | 177 | +# Note: Please make sure the compiler compiles the assembly code below with |
178 | +# pc-relative address. Also the branch instructions should use relative | 178 | +# pc-relative address. Also the branch instructions should use relative |
179 | +# addresses only. | 179 | +# addresses only. |
180 | + | 180 | + |
181 | +#include "migration-test.h" | 181 | +#include "../migration-test.h" |
182 | + | 182 | + |
183 | +.section .text | 183 | +.section .text |
184 | + | 184 | + |
185 | + .globl _start | 185 | + .globl _start |
186 | + | 186 | + |
... | ... | ||
238 | + /* output char 'B' to PL011 */ | 238 | + /* output char 'B' to PL011 */ |
239 | + mov w3, 'B' | 239 | + mov w3, 'B' |
240 | + strb w3, [x2] | 240 | + strb w3, [x2] |
241 | + | 241 | + |
242 | + b mainloop | 242 | + b mainloop |
243 | diff --git a/tests/migration/aarch64-a-b-kernel.h b/tests/migration/aarch64-a-b-kernel.h | 243 | diff --git a/tests/migration/aarch64/aarch64-a-b-kernel.h b/tests/migration/aarch64/aarch64-a-b-kernel.h |
244 | new file mode 100644 | 244 | new file mode 100644 |
245 | index XXXXXXX..XXXXXXX | 245 | index XXXXXXX..XXXXXXX |
246 | --- /dev/null | 246 | --- /dev/null |
247 | +++ b/tests/migration/aarch64-a-b-kernel.h | 247 | +++ b/tests/migration/aarch64/aarch64-a-b-kernel.h |
248 | @@ -XXX,XX +XXX,XX @@ | 248 | @@ -XXX,XX +XXX,XX @@ |
249 | +/* This file is automatically generated from | 249 | +/* This file is automatically generated from the assembly file in |
250 | + * tests/migration/aarch64-a-b-kernel.S, edit that and then run | 250 | + * tests/migration/aarch64, edit that and then run "make all" |
251 | + * "make aarch64-a-b-kernel.h" inside tests/migration to update, | 251 | + * inside tests/migration to update, and then remember to send both |
252 | + * and then remember to send both in your patch submission. | 252 | + * in your patch submission. |
253 | + */ | 253 | + */ |
254 | +unsigned char aarch64_kernel[] = { | 254 | +unsigned char aarch64_kernel[] = { |
255 | + 0x00, 0x10, 0x38, 0xd5, 0x00, 0xf8, 0x7f, 0x92, 0x00, 0x10, 0x18, 0xd5, | 255 | + 0x00, 0x10, 0x38, 0xd5, 0x00, 0xf8, 0x7f, 0x92, 0x00, 0x10, 0x18, 0xd5, |
256 | + 0xdf, 0x3f, 0x03, 0xd5, 0x00, 0x02, 0xa8, 0xd2, 0x01, 0xc8, 0xa8, 0xd2, | 256 | + 0xdf, 0x3f, 0x03, 0xd5, 0x00, 0x02, 0xa8, 0xd2, 0x01, 0xc8, 0xa8, 0xd2, |
257 | + 0x23, 0x08, 0x80, 0x52, 0x02, 0x20, 0xa1, 0xd2, 0x43, 0x00, 0x00, 0x39, | 257 | + 0x23, 0x08, 0x80, 0x52, 0x02, 0x20, 0xa1, 0xd2, 0x43, 0x00, 0x00, 0x39, |
... | ... | ||
268 | diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h | 268 | diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h |
269 | index XXXXXXX..XXXXXXX 100644 | 269 | index XXXXXXX..XXXXXXX 100644 |
270 | --- a/tests/migration/migration-test.h | 270 | --- a/tests/migration/migration-test.h |
271 | +++ b/tests/migration/migration-test.h | 271 | +++ b/tests/migration/migration-test.h |
272 | @@ -XXX,XX +XXX,XX @@ | 272 | @@ -XXX,XX +XXX,XX @@ |
273 | #define PPC_TEST_MEM_START (1 * 1024 * 1024) | ||
273 | #define PPC_TEST_MEM_END (100 * 1024 * 1024) | 274 | #define PPC_TEST_MEM_END (100 * 1024 * 1024) |
274 | #define MIN_NVRAM_SIZE 8192 /* from spapr_nvram.c */ | ||
275 | 275 | ||
276 | +/* ARM */ | 276 | +/* ARM */ |
277 | +#define ARM_TEST_MEM_START (0x40000000 + 1 * 1024 * 1024) | 277 | +#define ARM_TEST_MEM_START (0x40000000 + 1 * 1024 * 1024) |
278 | +#define ARM_TEST_MEM_END (0x40000000 + 100 * 1024 * 1024) | 278 | +#define ARM_TEST_MEM_END (0x40000000 + 100 * 1024 * 1024) |
279 | +#define ARM_MACH_VIRT_UART 0x09000000 | 279 | +#define ARM_MACH_VIRT_UART 0x09000000 |
... | ... | ||
282 | + */ | 282 | + */ |
283 | +#define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024) | 283 | +#define ARM_TEST_MAX_KERNEL_SIZE (512 * 1024) |
284 | + | 284 | + |
285 | #endif /* _TEST_MIGRATION_H_ */ | 285 | #endif /* _TEST_MIGRATION_H_ */ |
286 | -- | 286 | -- |
287 | 2.14.3 | 287 | 1.8.3.1 |
288 | 288 | ||
289 | 289 | diff view generated by jsdifflib |