Skip to contentSkip to conversation

automation: xilinx: GEM passthrough

PATCH In review Michal Orzel 2 participants 5 messages Apr 27, 2023 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover automation: xilinx: GEM passthrough

Small series to add a GEM passthrough test on a Xilinx HW.

Michal Orzel (2):
automation: xilinx: Set up bridging only for a default test case
automation: xilinx: Add GEM passthrough test

 automation/gitlab-ci/test.yaml                |  8 ++++
 .../scripts/xilinx-smoke-dom0less-arm64.sh    | 40 +++++++++++++++----
 2 files changed, 41 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 automation: xilinx: Set up bridging only for a default test case

At the moment, setting up a network bridge is unconditionally placed in the dom0 xen.start script. Since we might want to use the network interface (there is only one working GEM on the board) for other tests (e.g. passthrough), move the bridge setup to a dom0_check variable being part of a default ping test (i.e. if no test variant specified).

---
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
automation/scripts/xilinx-smoke-dom0less-arm64.sh +8 -7
index 82158ab7ea1b..73ba251f4cc1 100755
@@ -6,6 +6,14 @@ test_variant=$1
 
 if [ -z "${test_variant}" ]; then
     passed="ping test passed"
+    dom0_check="
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+xl network-attach 1 type=vif
+"
     domU_check="
 until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
     sleep 30
@@ -51,13 +59,6 @@ bash /etc/init.d/xencommons start
 
 /usr/local/lib/xen/bin/init-dom0less
 
-brctl addbr xenbr0
-brctl addif xenbr0 eth0
-ifconfig eth0 up
-ifconfig xenbr0 up
-ifconfig xenbr0 192.168.0.1
-
-xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
Signature · 1 line
2.25.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] automation: xilinx: Set up bridging only for a default test case

Quoted 7 lines · Michal Orzel

At the moment, setting up a network bridge is unconditionally placed in the dom0 xen.start script. Since we might want to use the network interface (there is only one working GEM on the board) for other tests (e.g. passthrough), move the bridge setup to a dom0_check variable being part of a default ping test (i.e. if no test variant specified).

Quoted 40 lines
---
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
automation/scripts/xilinx-smoke-dom0less-arm64.sh +8 -7
index 82158ab7ea1b..73ba251f4cc1 100755
@@ -6,6 +6,14 @@ test_variant=$1
 
 if [ -z "${test_variant}" ]; then
     passed="ping test passed"
+    dom0_check="
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+xl network-attach 1 type=vif
+"
     domU_check="
 until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
     sleep 30
@@ -51,13 +59,6 @@ bash /etc/init.d/xencommons start
 
 /usr/local/lib/xen/bin/init-dom0less
 
-brctl addbr xenbr0
-brctl addif xenbr0 eth0
-ifconfig eth0 up
-ifconfig xenbr0 up
-ifconfig xenbr0 192.168.0.1
-
-xl network-attach 1 type=vif
 ${dom0_check}
 " > etc/local.d/xen.start
 chmod +x etc/local.d/xen.start
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/2 automation: xilinx: Add GEM passthrough test

In reply to Michal Orzel

Being able to access a real board with real resources gives a great opportunity to finally test passthroughing devices to guests. Therefore, create a new Xilinx job to test GEM (Gigabit Ethernet MAC) controller passthrough to a dom0less domU.

By passing "gem-passthrough" as a test variant, the test will instruct the ImageBuilder to use "eth0.dtb" (passthrough dtb stored under tftp server root) as a guest dtb and to add "xen,passthrough" dtb property to "/amba/ethernet@ff0e0000" node. The guest itself will try to bringup the network interface, obtain dynamically IP address and ping the default gateway.

---
Example job:
https://gitlab.com/xen-project/people/sstabellini/xen/-/jobs/4189922473

---
 automation/gitlab-ci/test.yaml                |  8 ++++++
 .../scripts/xilinx-smoke-dom0less-arm64.sh    | 25 +++++++++++++++++++
 2 files changed, 33 insertions(+)
automation/gitlab-ci/test.yaml +8 -0
index d68c584269dd..3409d704a7eb 100644
@@ -131,6 +131,14 @@ xilinx-smoke-dom0less-arm64-gcc:
     - *arm64-test-needs
     - alpine-3.12-gcc-arm64
 
+xilinx-smoke-dom0less-arm64-gcc-gem-passthrough:
+  extends: .xilinx-arm64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh gem-passthrough 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-arm64
+
 adl-smoke-x86-64-gcc-debug:
   extends: .adl-x86-64
   script:
automation/scripts/xilinx-smoke-dom0less-arm64.sh +25 -0
index 73ba251f4cc1..075305241c8d 100755
@@ -22,6 +22,22 @@ echo \"${passed}\"
 "
 fi
 
+if [[ "${test_variant}" == "gem-passthrough" ]]; then
+    passed="${test_variant} test passed"
+
+    # For a passthroughed GEM:
+    # - bring up the network interface
+    # - dynamically assign IP
+    # - ping the default gateway
+    domU_check="
+set -ex
+ifconfig eth0 up
+udhcpc -i eth0 -n
+ping -c 10 \$(ip route | awk '/^default/ {print \$3}')
+echo \"${passed}\"
+"
+fi
+
 # DomU
 mkdir -p rootfs
 cd rootfs
@@ -96,6 +112,15 @@ cp -f binaries/domU-rootfs.cpio.gz $TFTP/
 # export dtb to artifacts
 cp $TFTP/mpsoc_smmu.dtb .
 
+if [[ "${test_variant}" == "gem-passthrough" ]]; then
+    echo "
+    DOMU_PASSTHROUGH_DTB[0]=\"eth0.dtb\"
+    DOMU_PASSTHROUGH_PATHS[0]=\"/amba/ethernet@ff0e0000\"" >> $TFTP/config
+
+    # export passthrough dtb to artifacts
+    cp $TFTP/eth0.dtb .
+fi
+
 rm -rf imagebuilder
 git clone https://gitlab.com/ViryaOS/imagebuilder
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d $TFTP/ -c $TFTP/config
Signature · 1 line
2.25.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] automation: xilinx: Add GEM passthrough test

Quoted 5 lines · Michal Orzel

Being able to access a real board with real resources gives a great opportunity to finally test passthroughing devices to guests. Therefore, create a new Xilinx job to test GEM (Gigabit Ethernet MAC) controller passthrough to a dom0less domU.

Quoted 8 lines

By passing "gem-passthrough" as a test variant, the test will instruct the ImageBuilder to use "eth0.dtb" (passthrough dtb stored under tftp server root) as a guest dtb and to add "xen,passthrough" dtb property to "/amba/ethernet@ff0e0000" node. The guest itself will try to bringup the network interface, obtain dynamically IP address and ping the default gateway.

Quoted 73 lines

---
Example job:
https://gitlab.com/xen-project/people/sstabellini/xen/-/jobs/4189922473

---
 automation/gitlab-ci/test.yaml                |  8 ++++++
 .../scripts/xilinx-smoke-dom0less-arm64.sh    | 25 +++++++++++++++++++
 2 files changed, 33 insertions(+)
automation/gitlab-ci/test.yaml +8 -0
index d68c584269dd..3409d704a7eb 100644
@@ -131,6 +131,14 @@ xilinx-smoke-dom0less-arm64-gcc:
     - *arm64-test-needs
     - alpine-3.12-gcc-arm64
 
+xilinx-smoke-dom0less-arm64-gcc-gem-passthrough:
+  extends: .xilinx-arm64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh gem-passthrough 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-arm64
+
 adl-smoke-x86-64-gcc-debug:
   extends: .adl-x86-64
   script:
automation/scripts/xilinx-smoke-dom0less-arm64.sh +25 -0
index 73ba251f4cc1..075305241c8d 100755
@@ -22,6 +22,22 @@ echo \"${passed}\"
 "
 fi
 
+if [[ "${test_variant}" == "gem-passthrough" ]]; then
+    passed="${test_variant} test passed"
+
+    # For a passthroughed GEM:
+    # - bring up the network interface
+    # - dynamically assign IP
+    # - ping the default gateway
+    domU_check="
+set -ex
+ifconfig eth0 up
+udhcpc -i eth0 -n
+ping -c 10 \$(ip route | awk '/^default/ {print \$3}')
+echo \"${passed}\"
+"
+fi
+
 # DomU
 mkdir -p rootfs
 cd rootfs
@@ -96,6 +112,15 @@ cp -f binaries/domU-rootfs.cpio.gz $TFTP/
 # export dtb to artifacts
 cp $TFTP/mpsoc_smmu.dtb .
 
+if [[ "${test_variant}" == "gem-passthrough" ]]; then
+    echo "
+    DOMU_PASSTHROUGH_DTB[0]=\"eth0.dtb\"
+    DOMU_PASSTHROUGH_PATHS[0]=\"/amba/ethernet@ff0e0000\"" >> $TFTP/config
+
+    # export passthrough dtb to artifacts
+    cp $TFTP/eth0.dtb .
+fi
+
 rm -rf imagebuilder
 git clone https://gitlab.com/ViryaOS/imagebuilder
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d $TFTP/ -c $TFTP/config
Signature · 1 line
2.25.1