Use dom0less to create a hardware+xenstore domain, a control domain,
and a regular domU.
Create a domU-rootfs that does not run the xen scripts, but does have
the xen tools installed. The domU also uses a console on ttyAMA0
instead of hvc0.
We need to increate dom0less test memory or ImageBuilder fails with:
Error, not enough memory to load all binaries
Use C xenstored so hardware/xenstore can grant map control's xenstore
grant.
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
Initially, I tried to put xl list into control. That executes before
dom0 runs init-dom0less, and it hangs. I expected it to recover after
init-dom0less introduces it, but it does not. That needs further
investigation.
---
automation/gitlab-ci/test.yaml | 8 +++
.../scripts/qemu-smoke-dom0less-arm64.sh | 67 ++++++++++++++++---
2 files changed, 66 insertions(+), 9 deletions(-)
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 9530e36e9a..a7f7fbb4bc 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -403,6 +403,14 @@ qemu-smoke-dom0less-arm64-gcc-debug-gicv3:
- *arm64-test-needs
- alpine-3.18-gcc-debug-arm64
+qemu-smoke-dom0less-arm64-gcc-debug-hwdom-control:
+ extends: .qemu-arm64
+ script:
+ - ./automation/scripts/qemu-smoke-dom0less-arm64.sh hwdom-control 2>&1 | tee ${LOGFILE}
+ needs:
+ - *arm64-test-needs
+ - alpine-3.18-gcc-debug-arm64
+
qemu-smoke-dom0less-arm64-gcc-debug-staticmem:
extends: .qemu-arm64
script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 439e07c90f..39614720a4 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -78,6 +78,12 @@ if [[ "${test_variant}" == "gicv3" ]]; then
domU_check="echo \"${passed}\""
fi
+if [[ "${test_variant}" == "hwdom-control" ]]; then
+ gic_version=3
+ passed="hardware xenstore"
+ dom0_check="xl list --verbose"
+fi
+
# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
./binaries/qemu-system-aarch64 \
@@ -114,7 +120,7 @@ cd initrd
find . | cpio --create --format='newc' | gzip > ../binaries/initrd
cd ..
-# DOM0 rootfs
+# DOM0/DOMU rootfs with Xen tools
mkdir -p rootfs
cd rootfs
tar xzf ../binaries/initrd.tar.gz
@@ -125,6 +131,31 @@ mkdir sys
rm var/run
cp -ar ../binaries/dist/install/* .
+echo "rc_verbose=yes" >> etc/rc.conf
+
+# Create a domU variant
+if [ "$test_variant" = "hwdom-control" ] ; then
+ echo "domU" > etc/hostname
+ sed -i 's/hvc0/ttyAMA0/g' etc/inittab
+
+ echo "#!/bin/bash
+
+ export LD_LIBRARY_PATH=/usr/local/lib
+
+ ${domCTL_check}
+ " > etc/local.d/xen.start
+ chmod +x etc/local.d/xen.start
+
+ find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+ # Restore hwdom console
+ sed -i 's/ttyAMA0/hvc0/g' etc/inittab
+
+ # For dom0 - must use xenstored for grant mapping
+ sed -i '/^#XENSTORED=/a XENSTORED=/usr/local/sbin/xenstored' \
+ etc/default/xencommons
+fi
+
+echo "dom0" > etc/hostname
echo "#!/bin/bash
export LD_LIBRARY_PATH=/usr/local/lib
@@ -142,27 +173,45 @@ xl network-attach 1 type=vif
${dom0_check}
" > etc/local.d/xen.start
chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
cd ..
+if [ "$test_variant" != "hwdom-control" ] ; then
+ IB_DOM0='DOM0_KERNEL="Image"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"'
+ IB_XEN_CMD='XEN_CMD="console=dtuart dom0_mem=512M console_timestamps=boot"'
+ IB_DOMU_EXTRA="DOMU_KERNEL[1]='Image'
+DOMU_RAMDISK[1]='initrd'
+DOMU_MEM[1]='256'"
+else
+ IB_DOM0=''
+ IB_XEN_CMD='XEN_CMD="console=dtuart console_timestamps=boot"'
+ IB_DOMU_EXTRA="DOMU_KERNEL[1]='Image'
+DOMU_RAMDISK[1]='dom0-rootfs.cpio.gz'
+DOMU_MEM[1]='700'
+DOMU_CAPS[1]='hardware|xenstore'
+DOMU_CMD[1]='console=hvc0 earlycon=xen earlyprintk=xen clk_ignore_unused'
+DOMU_KERNEL[2]='Image'
+DOMU_RAMDISK[2]='domU-rootfs.cpio.gz'
+DOMU_MEM[2]='700'
+DOMU_CAPS[2]='control'
+DOMU_ENHANCED[2]=1
+NUM_DOMUS=3"
+fi
# ImageBuilder
echo "MEMORY_START='0x40000000'
-MEMORY_END='0x50000000'
+MEMORY_END='0x80000000'
DEVICE_TREE='virt.dtb'
XEN='xen'
-DOM0_KERNEL='Image'
-DOM0_RAMDISK='dom0-rootfs.cpio.gz'
-XEN_CMD='console=dtuart dom0_mem=512M console_timestamps=boot'
+$IB_XEN_CMD
+$IB_DOM0
NUM_DOMUS=1
DOMU_KERNEL[0]='Image'
DOMU_RAMDISK[0]='initrd'
DOMU_MEM[0]='256'
-DOMU_KERNEL[1]='Image'
-DOMU_RAMDISK[1]='initrd'
-DOMU_MEM[1]='256'
+$IB_DOMU_EXTRA
LOAD_CMD='tftpb'
UBOOT_SOURCE='boot.source'
--
2.48.1