[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v8 25/26] ci: add smoke NS16550-compatible PVH Linux test


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 11 Nov 2026 11:47:59 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 205.220.161.53) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+c1MSCxJS0/AOVa6KVniucG9MfDgHlNN0tvBtE1o1Ng=; b=bxH4W9pYmbXWdzy8jWAHm3QFU8QyG0+fc+cYMgsvbxdZNVnyT/IVpT4QrbOrkMHy8J0uRNiipByz2YND74f+GMGNQEVLkHrEHVt+JZaRQ5yDBmkN7Sy38HQgW++968VzsVAOxuRnyLew2ACKjO8Hyv33WoDj6YnQ4QYHcM29lCQ5fP44VzmqbbnRBn3w9zjSmK2vdx/d9Zyib5yHBDIIkoDdoLLPvgm9r3lpNI0dPus0xmFo3wZ7wcWgTcTFIp5kM/XMsh0AX41RXBwkqqc+gIzp03Ja3YlaC5P/idYbF/MC0mDCSDO8JF9IYBhdyKlNzwQk0e5tSsJiIH4BVeQCEQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=arjtKn3XcoxFGtBDOt02J6WhFgjjATC/kuB2vFPM2tM3TpyO3JSLDw3gjozePAhskSe30Z31JxTw4GMJDlKikkoMXDvcslP2zlJIrKT1yxm0gkA7B9JhTkyfqr0lxbhr1ZJxsMiA66wdgcQPTWaI3rDpFwL3/pbMEm0lqXimgKJqSJrT96xMm3PuOYeK/CPUl7dTxJe4TrTa84M4yKjiFYOMDF8uaEBFVJp9xkp6j+XXWuTtpf8D5MlKZbsAD8SRzGIPsuGCr9E+vZ+itE0RevCrFUNCOVnYWe/fcWg8r9Y5KQfdj28Rmq985TNmlBFIvD791cX1grS+WZxTjgFirQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, xakep.amatop@xxxxxxxxx, dmukhin@xxxxxxx, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Wed, 11 Nov 2026 19:49:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx>

Add smoke test for NS16550-compatible UART emulated for PVH dom0/domU.

The change also overhauls existing qemu-alpine-x86_64.sh by moving
stuff around so it would be possible to extend the functionality
easier in the future.

Note, that new jobs will be likely skipped in the public CI since
/dev/kvm is not exposed for a reason into docker environment. But this
is great for local testing.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 automation/gitlab-ci/test.yaml           |  27 +-
 automation/scripts/qemu-alpine-x86_64.sh | 325 ++++++++++++++++++-----
 2 files changed, 280 insertions(+), 72 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 4f4ce8aab9e9..c4140e850b5f 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -736,7 +736,32 @@ qemu-smoke-dom0less-arm32-gcc-debug-earlyprintk:
 qemu-alpine-x86_64-gcc:
   extends: .qemu-x86_64
   script:
-    - ./automation/scripts/qemu-alpine-x86_64.sh 2>&1 | tee ${LOGFILE}
+    - ./automation/scripts/qemu-alpine-x86_64.sh --dom0-type=pv 2>&1 | tee 
${LOGFILE}
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 300
+  needs:
+    - *x86_64-test-needs
+    - alpine-3.24-x86_64-gcc
+
+qemu-alpine-x86_64-gcc-vuart-hwdom:
+  extends: .qemu-x86_64
+  script:
+    - if [[ "$(stat -c '%a' /dev/kvm)" != "666" ]]; then echo "/dev/kvm is 
missing. Skipping test."; exit 0; fi
+    - ./automation/scripts/qemu-alpine-x86_64.sh --dom0-type=pvh 
--dom0-console=ttyS1 2>&1 | tee ${LOGFILE}
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 300
+  needs:
+    - *x86_64-test-needs
+    - alpine-3.24-x86_64-gcc
+
+qemu-alpine-x86_64-gcc-vuart-pvh:
+  extends: .qemu-x86_64
+  script:
+    - if [[ "$(stat -c '%a' /dev/kvm)" != "666" ]]; then echo "/dev/kvm is 
missing. Skipping test."; exit 0; fi
+    - ./automation/scripts/qemu-alpine-x86_64.sh --dom0-type=pvh 
--domU-type=pvh --domU-console=ttyS1 2>&1 | tee ${LOGFILE}
+  variables:
+    PASSED: "BusyBox"
+    TEST_TIMEOUT_OVERRIDE: 300
   needs:
     - *x86_64-test-needs
     - alpine-3.24-x86_64-gcc
diff --git a/automation/scripts/qemu-alpine-x86_64.sh 
b/automation/scripts/qemu-alpine-x86_64.sh
index 242ffca693fe..5521a2e53e36 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -2,86 +2,269 @@
 
 set -ex -o pipefail
 
-# DomU Busybox
-cd binaries
-mkdir -p initrd
-mkdir -p initrd/bin
-mkdir -p initrd/sbin
-mkdir -p initrd/etc
-mkdir -p initrd/dev
-mkdir -p initrd/proc
-mkdir -p initrd/sys
-mkdir -p initrd/lib
-mkdir -p initrd/var
-mkdir -p initrd/mnt
-cp /bin/busybox initrd/bin/busybox
-initrd/bin/busybox --install initrd/bin
-echo "#!/bin/sh
+xen_extra_args=""
+dom0_extra_args=""
+domU_extra_args=""
+domU_type=""
 
-mount -t proc proc /proc
-mount -t sysfs sysfs /sys
-mount -t devtmpfs devtmpfs /dev
-/bin/sh" > initrd/init
-chmod +x initrd/init
-# DomU rootfs
-cd initrd
-find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
-cd ..
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+    --xen-extra-args=*)
+        xen_extra_args="${xen_extra_args} ${1#*=}"
+        shift
+        ;;
+    --dom0-extra-args=*)
+        dom0_extra_args="${1#*=}"
+        shift
+        ;;
+    --dom0-console=*)
+        dom0_console="${1#*=}"
+        shift
+        ;;
+    --dom0-type=*)
+        dom0_type="${1#*=}"
+        shift
+        ;;
+    --domU-extra-args=*)
+        domU_extra_args="${1#*=}"
+        shift
+        ;;
+    --domU-console=*)
+        domU_console="${1#*=}"
+        shift
+        ;;
+    --domU-type=*)
+        domU_type="${1#*=}"
+        shift
+        ;;
+    *)
+        echo "Unknown argument: $1"
+        exit 1
+        ;;
+    esac
+done
 
-# Dom0 rootfs
-cp rootfs.cpio.gz dom0-rootfs.cpio.gz
-cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
+dom0_console="${dom0_console:-hvc0}"
+domU_console="${domU_console:-hvc0}"
 
-# test-local configuration
-mkdir -p rootfs
-cd rootfs
-mkdir -p root etc/local.d
-mv ../domU-rootfs.cpio.gz ./root
-cp ../bzImage ./root
-echo "name=\"domU\"
-memory=512
-vcpus=1
-kernel=\"/root/bzImage\"
-ramdisk=\"/root/domU-rootfs.cpio.gz\"
-extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
-" > root/domU.cfg
-echo "#!/bin/bash
+dom0_type="${dom0_type:-pv}"
 
-set -x
-
-bash /etc/init.d/xencommons start
-
-xl list
-
-xl -vvv create -c /root/domU.cfg
-
-" > etc/local.d/xen.start
-chmod +x etc/local.d/xen.start
-find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
-cd ../..
-
-cat >> binaries/pxelinux.0 << EOF
+# iPXE boot configuration: xen + dom0
+function make_ipxe_config()
+{
+    cat > binaries/pxelinux.0 <<EOF
 #!ipxe
-
-kernel xen console=com1 console_timestamps=boot
-module bzImage console=hvc0
+kernel xen console=com1 console_timestamps=boot dom0_mem=1500M 
dom0=${dom0_type} $xen_extra_args
+module bzImage $dom0_extra_args
 module dom0-rootfs.cpio.gz
 boot
 EOF
+}
 
-# Run the test
-rm -f smoke.serial
-export TEST_CMD="qemu-system-x86_64 \
-    -cpu qemu64,+svm \
-    -m 2G -smp 2 \
-    -monitor none -serial stdio \
-    -nographic \
-    -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
+# Detect the type IOMMU device to emulate.
+# PVH dom0 needs IOMMU.
+function host_iommu_device()
+{
+    if grep -q 'AuthenticAMD' /proc/cpuinfo; then
+        name="amd-iommu"
+    elif grep -q 'GenuineIntel' /proc/cpuinfo; then
+        name="intel-iommu"
+    else
+        name="unknown-iommu"
+    fi
+    printf "%s" "$name"
+}
 
-export TEST_LOG="smoke.serial"
-export BOOT_MSG="Latest ChangeSet: "
-export LOG_MSG="Domain-0"
-export PASSED="BusyBox"
+function make_qemu_config()
+{
+    local qemu_cmd=""
+
+    case "$dom0_type" in
+    pv)
+        export TEST_CMD="qemu-system-x86_64 \
+            -cpu qemu64,+svm \
+            -m 2G -smp 2 \
+            -monitor none -serial stdio \
+            -nographic \
+            -device virtio-net-pci,netdev=n0 \
+            -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
+            ;;
+
+    pvh)
+        local iommu_device="$(host_iommu_device)"
+        export TEST_CMD="qemu-system-x86_64 \
+            -cpu host \
+            -accel kvm \
+            -machine 
q35,kernel-irqchip=split,sata=off,usb=off,graphics=off,smbus=off,vmport=off \
+            -device ${iommu_device},intremap=on,caching-mode=on \
+            -vga none \
+            -m 4G -smp 2 \
+            -monitor none \
+            -serial stdio \
+            -nographic \
+            -device virtio-net-pci,netdev=n0 \
+            -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
+            ;;
+
+    *)
+        echo "Unsupported dom0 type '$dom0_type'"
+        exit 1
+        ;;
+    esac
+
+    export TEST_LOG="smoke.serial"
+    export BOOT_MSG="Latest ChangeSet: "
+    export PASSED="${PASSED:-Welcome to Alpine Linux}"
+}
+
+function add_udev_settle()
+{
+    mkdir -p etc/init.d
+
+    cat > etc/init.d/udev-settle <<EOF
+#!/sbin/openrc-run
+start()
+{
+    return 0
+}
+EOF
+
+    chmod +x etc/init.d/udev-settle
+}
+
+function add_console()
+{
+    local domid="$1"
+    local tty="$2"
+    local ioport=""
+    local ioname=""
+    local guest_cmdline=""
+
+    mkdir -p etc
+
+    gzip -dc ../rootfs.cpio.gz | cpio -i --to-stdout 'etc/inittab' > 
etc/inittab
+    # Ensure no getty on default consoles.
+    sed -i -E '/^(ttyS0|hvc0)::respawn:/d' etc/inittab
+    # Parametrize guest console.
+    echo "$tty::respawn:/sbin/getty -L $tty 115200 vt100" >> etc/inittab
+    echo $tty >> etc/securetty
+
+    case "$tty" in
+    ttyS0)
+        ioport="0x3f8"
+        ioname="com1"
+        ;;
+    ttyS1)
+        ioport="0x2f8"
+        ioname="com2"
+        ;;
+    ttyS2)
+        ioport="0x3e8"
+        ioname="com3"
+        ;;
+    ttyS3)
+        ioport="0x2e8"
+        ioname="com4"
+        ;;
+    *)
+        ;;
+    esac
+
+    if [ -z "$ioport" ]; then
+        guest_cmdline="console=${tty}"
+    else
+        # NB: ensure guest is not using Xen console
+        guest_cmdline="xen_console_io=off console=uart,io,${ioport},115200n8"
+        xen_extra_args="${xen_extra_args} vuart=$domid:ns16550,$ioname"
+    fi
+
+    if (( $domid > 0 )); then
+        domU_extra_args="${domU_extra_args} ${guest_cmdline}"
+    else
+        dom0_extra_args="${dom0_extra_args} ${guest_cmdline}"
+    fi
+}
+
+function make_domU_rootfs()
+{
+    mkdir -p initrd/{bin,sbin,etc,dev,proc,sys,lib,var,mnt}
+
+    cp /bin/busybox initrd/bin/busybox
+
+    initrd/bin/busybox --install initrd/bin
+    initrd/bin/busybox --install initrd/sbin
+
+    cat > initrd/init <<EOF
+#!/bin/sh
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+mount -t devtmpfs devtmpfs /dev
+/bin/sh
+EOF
+    chmod +x initrd/init
+
+    pushd initrd
+        add_console 1 $domU_console
+        find . | cpio -R 0:0 -H newc -o | gzip > ../domU-rootfs.cpio.gz
+    popd
+
+    mkdir -p rootfs/root
+    mv domU-rootfs.cpio.gz rootfs/root
+    cp bzImage rootfs/root
+
+    cat > rootfs/root/domU.cfg <<EOF
+name="domU"
+type="$domU_type"
+memory=512
+vcpus=1
+kernel="/root/bzImage"
+ramdisk="/root/domU-rootfs.cpio.gz"
+extra="root=/dev/ram0 $domU_extra_args"
+EOF
+
+    mkdir -p rootfs/etc/local.d
+    cat > rootfs/etc/local.d/xen.start <<EOF
+#!/bin/bash
+set -x
+bash /etc/init.d/xencommons start
+xl list
+xl -vvv create -c /root/domU.cfg
+EOF
+
+    chmod +x rootfs/etc/local.d/xen.start
+}
+
+pushd binaries
+    rm -rf \
+        etc \
+        dom0-rootfs.cpio.gz \
+        domU-rootfs.cpio.gz \
+        initrd \
+        pxelinux.0 \
+        rootfs \
+        smoke.serial
+
+    cp rootfs.cpio.gz dom0-rootfs.cpio.gz
+    cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz
+
+    mkdir -p rootfs
+
+    pushd rootfs
+        add_console 0 $dom0_console
+        add_udev_settle
+    popd
+
+    if [ ! -z "${domU_type}" ]; then
+        make_domU_rootfs
+    fi
+
+    pushd rootfs
+        find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
+    popd
+popd
+
+make_ipxe_config
+
+make_qemu_config
 
 ./automation/scripts/console.exp |& sed 's/\r\+$//'
-- 
2.56.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.