Skip to content

Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.

C

tools/soc-args-test.sh: regression test that soc-args.py reproduces all 16 POCO X5 Pro soc_* values from its device tree and that soc.args is in step; wired into ci/github-check.yml so a change that shifts the addresses a port would get is caught

shimoku74ed59c4cf33ed
diff --git a/ci/github-check.yml b/ci/github-check.yml
index 8e6989f..b9c5459 100644
--- a/ci/github-check.yml
+++ b/ci/github-check.yml
@@ -27,3 +27,5 @@ jobs:
- name: APFS tools self-test
run: |
[ -x tools/apfs/run-tests.sh ] && tools/apfs/run-tests.sh || echo "no self-test on this runner"
+ - name: SoC args generator reproduces the POCO X5 Pro values
+ run: sh tools/soc-args-test.sh
diff --git a/tools/soc-args-test.sh b/tools/soc-args-test.sh
new file mode 100755
index 0000000..fa3ce2e
--- /dev/null
+++ b/tools/soc-args-test.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Check that tools/soc-args.py still reproduces the POCO X5 Pro's soc_* arguments from its own
+# device tree, and that devices/poco-x5-pro/soc.args is in step with it. A guard against a change
+# to the generator (or the parser) silently shifting the addresses a port would get.
+set -eu
+root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+dtb="$root/devices/poco-x5-pro/prebuilt/device-tree.dtb"
+want="$root/devices/poco-x5-pro/soc.args"
+got=$(python3 "$root/tools/soc-args.py" "$dtb")
+
+# the values the kernel carries as defaults (bsd/dev/hakios.mpss.c, hakios.ipa.c): the generator
+# must reproduce exactly these for the first phone, or a port built from a real tree is suspect
+expected='soc_ipa_base=0x1e40000
+soc_gsi_base=0x1e04000
+soc_ipcc=0x408000
+soc_aoss=0xc300000
+soc_rsc=0x18220000
+soc_apps_smmu=0x15000000
+soc_cmd_db=0x80860000
+soc_mpss_mem=0x8b800000
+modem_ipa_fw_at=0x8b710000
+soc_smem=0x80900000
+soc_imem=0x14600000
+soc_ipa_stream=0x480
+soc_ipa_stream_uc=0x482
+soc_pas_mpss=0x4
+soc_pas_ipa=0xf
+soc_ipa_fw=yupik_ipa_fws'
+
+if [ "$got" != "$expected" ]; then
+ echo "soc-args-test: FAIL -- the generator no longer reproduces the POCO X5 Pro's values"
+ tmp=$(mktemp); printf '%s\n' "$expected" > "$tmp"
+ printf '%s\n' "$got" | diff -u "$tmp" - || true
+ rm -f "$tmp"
+ exit 1
+fi
+if [ "$got" != "$(cat "$want")" ]; then
+ echo "soc-args-test: FAIL -- devices/poco-x5-pro/soc.args is out of step with the generator (regenerate it)"
+ exit 1
+fi
+echo "soc-args-test: the generator reproduces all 16 POCO X5 Pro soc_* values, and soc.args matches"