AArch64 EL2 hypervisor for QEMU virt that boots at EL2
1from pathlib import Path
2import re
3import sys
4
5
6root = Path(__file__).resolve().parents[1]
7
8text_files = [
9 *root.glob("core/**/*.c"),
10 *root.glob("drivers/**/*.c"),
11 *root.glob("mm/**/*.c"),
12 *root.glob("arch/**/*.c"),
13 *root.glob("guest/**/*.c"),
14 *root.glob("include/**/*.h"),
15 *root.glob("tools/**/*.py"),
16 *root.glob("scripts/**/*.py"),
17 root / "Makefile",
18 root / "README.md",
19]
20
21blocked = ["HV_" + "VERSION", "0" + ".1.0", "get_hv_" + "version"]
22
23for path in text_files:
24 text = path.read_text()
25 if any(item in text for item in blocked):
26 print(f"project versioning residue in {path.relative_to(root)}")
27 sys.exit(1)
28
29for path in [*root.glob("core/**/*.c"), *root.glob("drivers/**/*.c"), *root.glob("mm/**/*.c"), *root.glob("arch/**/*.c"), *root.glob("guest/**/*.c"), *root.glob("include/**/*.h")]:
30 text = path.read_text()
31 if re.search(r"/\*|//", text):
32 print(f"source comment residue in {path.relative_to(root)}")
33 sys.exit(1)
34
35config = (root / "include/hv/config.h").read_text()
36if "#define CONFIG_MONITOR_MUTATION 0" not in config:
37 print("monitor mutation must default off")
38 sys.exit(1)
39
40monitor = (root / "core/monitor.c").read_text()
41required = [
42 "write64 disabled",
43 "unmap disabled",
44 "irq disabled",
45 "profile disabled",
46 "restore disabled",
47 "log clear disabled",
48]
49for item in required:
50 if item not in monitor:
51 print(f"missing monitor gate: {item}")
52 sys.exit(1)
53
54makefile = (root / "Makefile").read_text()
55for target in ["test-host", "test-diagnostic-smoke", "test-linux-smoke", "ci", "release"]:
56 if f"{target}:" not in makefile:
57 print(f"missing target {target}")
58 sys.exit(1)