Skip to contentSkip to conversation

virtio-fs-ci: Add support for ppc64le

PATCH Applied Fabiano Rosas 2 participants 7 messages Dec 10, 2019 – Dec 17, 2019

lore
Share & tools
lore
#0 lore raw

cover virtio-fs-ci: Add support for ppc64le

This series adds support for building a ppc64le qemu, kernel and rootfs in a ppc64le machine in both Fedora (untested) and Ubuntu.

For QEMU:
- change the QEMU target name based on the architecture;
- alter configure options because ppc depends on fdt and the no-tcg build is currently broken.

For linux:
- change the kernel image name (ppc does not build bzImage);
- build the kernel config dynamically by adding the virtio-fs options and turning modules to =y.

For rootfs:
- add a more recent config.guess to blogbench otherwise it doesn't build on ppc.

For run-test:
- change qemu binary name based on architecture;
- change the serial console name (ppc uses hvc0);
- change the kernel image name to match what was built (vmlinux).

Fabiano Rosas (5):
build-qemu: Add support for ppc64le
Add virtio-fs kernel config snippet
build-linux: Add support for ppc64le
build-rootfs: Download latest config.guess for blogbench
run-test: Add support for ppc64le

 build-linux.sh                                | 26 ++++++++++++++++---
 build-qemu.sh                                 | 25 +++++++++++++++---
 build-rootfs.sh                               |  2 +-
 configs/virtio-fs                             |  8 ++++++
 ...-virtio-fs => x86_64-monolithic-virtio-fs} |  0
 run-test.sh                                   | 23 ++++++++++++----
 6 files changed, 71 insertions(+), 13 deletions(-)
 create mode 100644 configs/virtio-fs
 rename configs/{config-monolithic-virtio-fs => x86_64-monolithic-virtio-fs} (100%)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/5 build-qemu: Add support for ppc64le

Allow running the script on a ppc64le machine to build a ppc64le QEMU binary.

The configuration differs from x86 in the following:

--enable-fdt:
We need to build with device-tree support because ppc relies on it.

--enable-tcg:
The ppc build without TCG is currently broken.

---
 build-qemu.sh | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
build-qemu.sh +21 -4
index 2dc0580..ff78df9 100755
@@ -7,6 +7,8 @@
 
 set -e
 
+arch=$(uname -m)
+
 if [ ! -f vl.c ]; then
 	echo 'This script must be run from a QEMU source tree.'
 	exit 1
@@ -15,8 +17,23 @@ fi
 rm -rf qemu
 mkdir qemu
 
-./configure --target-list=x86_64-softmmu \
-	--disable-fdt \
+case ${arch} in
+	ppc64le)
+		arch=${arch/le/}
+		arch_config_opts=(
+			--enable-fdt
+			--enable-tcg
+		)
+		;;
+	*)
+		arch_config_opts=(
+			--disable-fdt
+			--disable-tcg
+		)
+		;;
+esac
+
+./configure --target-list=${arch}-softmmu \
 	--disable-glusterfs \
 	--disable-guest-agent \
 	--disable-numa \
@@ -89,13 +106,13 @@ mkdir qemu
 	--disable-mpath \
 	--disable-virglrenderer \
 	--disable-xen-pci-passthrough \
-	--disable-tcg \
 	--disable-sanitizers \
 	--disable-hvf \
 	--disable-whpx \
 	--enable-malloc-trim \
 	--disable-membarrier \
-	--disable-vhost-crypto
+	--disable-vhost-crypto \
+	${arch_config_opts[@]}
 
 make "DESTDIR=$PWD/qemu" -j$(nproc) install
 
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/5 Add virtio-fs kernel config snippet

In reply to Fabiano Rosas

This facilitates the (re)generation of the kernel config:

$ cd linux
$ make defconfig
$ ./scripts/kconfig/merge_config.sh .config ${configs}/virtio-fs
$ make LSMOD=$(mktemp) localyesconfig
---
 configs/virtio-fs | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 configs/virtio-fs
configs/virtio-fs new file +8 -0
new file mode 100644
index 0000000..bdaea03
@@ -0,0 +1,8 @@
+CONFIG_DAX=y
+CONFIG_DAX_DRIVER=y
+CONFIG_FS_DAX=y
+CONFIG_FUSE_FS=y
+CONFIG_VIRTIO=y
+CONFIG_VIRTIO_FS=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_ZONE_DEVICE=y
Signature · 1 line
2.23.0
#3 lore raw

PATCH 3/5 build-linux: Add support for ppc64le

In reply to Fabiano Rosas

Allow running the script on a ppc64le machine to build a ppc64le kernel.

The kernel config is generated based on the pseries defconfig + virtio-fs config.

Note: We need to use the vmlinux kernel image for now while QEMU upstream has not rebased on the latest SLOF which has support for the zImage [1].

1 - https://github.com/aik/SLOF/commit/f9661a257028e49f8fcae77b7cc59d41f4983195

---
 build-linux.sh                                | 26 ++++++++++++++++---
 ...-virtio-fs => x86_64-monolithic-virtio-fs} |  0
 2 files changed, 23 insertions(+), 3 deletions(-)
 rename configs/{config-monolithic-virtio-fs => x86_64-monolithic-virtio-fs} (100%)
build-linux.sh +23 -3
index 472bbe1..5a7e5a7 100755
@@ -7,13 +7,33 @@
 
 set -e
 
+arch=$(uname -m)
+
 if [ ! -d include/uapi/linux ]; then
 	echo 'This script must be run from a Linux source tree.'
 	exit 1
 fi
 
+case ${arch} in
+    x86_64)
+	kernel_image=bzImage
+	;;
+    ppc64le)
+	kernel_image=vmlinux
+	defconfig=pseries_le_defconfig
+	;;
+esac
+
 scriptdir=$(dirname "$0")
-cp "$scriptdir/configs/config-monolithic-virtio-fs" .config
+arch_config="$scriptdir/configs/${arch}-monolithic-virtio-fs"
+
+if [ -f "$arch_config" ]; then
+    cp "$arch_config" .config
+    make oldconfig
+else
+    make $defconfig
+    ./scripts/kconfig/merge_config.sh .config "$scriptdir/configs/virtio-fs"
+    make LSMOD=$(mktemp) localyesconfig
+fi
 
-make -j$(nproc) oldconfig
-make -j$(nproc) bzImage
+make -j$(nproc) $kernel_image
configs/x86_64-monolithic-virtio-fs renamed from configs/config-monolithic-virtio-fs +0 -0
similarity index 100%
rename from configs/config-monolithic-virtio-fs
rename to configs/x86_64-monolithic-virtio-fs
Signature · 1 line
2.23.0
#4 lore raw

PATCH 4/5 build-rootfs: Download latest config.guess for blogbench

In reply to Fabiano Rosas

Blogbench has an outdated config.guess which does not recognize the ppc64le platform. Download the latest one.

https://www.gnu.org/software/gettext/manual/html_node/config_002eguess.html

---
 build-rootfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
build-rootfs.sh +1 -1
index 3b109a8..470973e 100755
@@ -36,5 +36,5 @@ fi
 install -D -m 0755 run-test-in-guest.sh "$PWD/rootfs/root/"
 install -D -m 0644 run-test.service "$PWD/rootfs/etc/systemd/system/"
 run_in_rootfs /bin/bash -c "cd /root && git clone https://github.com/pjd/pjdfstest && cd pjdfstest && autoreconf -ifs && ./configure && make pjdfstest"
-run_in_rootfs /bin/bash -c "cd /root && wget -O blogbench-1.1.tar.gz https://download.pureftpd.org/pub/blogbench/blogbench-1.1.tar.gz && tar xf blogbench-1.1.tar.gz && cd blogbench-1.1 && ./configure && make"
+run_in_rootfs /bin/bash -c "cd /root && wget -O blogbench-1.1.tar.gz https://download.pureftpd.org/pub/blogbench/blogbench-1.1.tar.gz && tar xf blogbench-1.1.tar.gz && cd blogbench-1.1 && wget -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' && ./configure && make"
 tar cJf rootfs.tar.xz rootfs
Signature · 1 line
2.23.0
#5 lore raw

PATCH 5/5 run-test: Add support for ppc64le

In reply to Fabiano Rosas
---
 run-test.sh | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
run-test.sh +18 -5
index 65168df..2d16284 100755
@@ -24,11 +24,24 @@ if [ ! -f qemu.tar.xz ]; then
 	exit 1
 fi
 
-if [ ! -f bzImage ]; then
-	echo 'A bzImage Linux kernel is required'
+if [ ! -f bzImage -a ! -f vmlinux ]; then
+	echo 'A Linux kernel image is required'
 	exit 1
 fi
 
+arch=$(uname -m)
+case ${arch} in
+	x86_64)
+		kernel_image=bzImage
+		serial_console=ttyS0
+		;;
+	ppc64le)
+		arch=${arch/le/}
+		kernel_image=vmlinux
+		serial_console=hvc0
+		;;
+esac
+
 log "Unpacking rootfs..."
 rm -rf rootfs
 tar xf rootfs.tar.xz
@@ -54,9 +67,9 @@ done
 log "Starting QEMU..."
 rm -f qmp.sock
 rm -f serial.log
-qemu/usr/local/bin/qemu-system-x86_64 \
-	-kernel bzImage \
-	-append 'rootfstype=virtio_fs rootflags=default_permissions,allow_other,user_id=0,group_id=0,rootmode=040000,tag=myfs,dax root=none rw console=ttyS0 systemd.unit=run-test.service' \
+qemu/usr/local/bin/qemu-system-${arch} \
+	-kernel ${kernel_image} \
+	-append 'rootfstype=virtio_fs rootflags=default_permissions,allow_other,user_id=0,group_id=0,rootmode=040000,tag=myfs,dax root=none rw console=${serial_console} systemd.unit=run-test.service' \
 	-M accel=kvm \
 	-cpu host \
 	-m 1G,maxmem=4G \
Signature · 1 line
2.23.0
#6 lore raw
In reply to Fabiano Rosas
Quoted 30 lines · Fabiano Rosas

This series adds support for building a ppc64le qemu, kernel and rootfs in a ppc64le machine in both Fedora (untested) and Ubuntu.

For QEMU:
- change the QEMU target name based on the architecture;
- alter configure options because ppc depends on fdt and the no-tcg build is currently broken.

For linux:
- change the kernel image name (ppc does not build bzImage);
- build the kernel config dynamically by adding the virtio-fs options and turning modules to =y.

For rootfs:
- add a more recent config.guess to blogbench otherwise it doesn't build on ppc.

For run-test:
- change qemu binary name based on architecture;
- change the serial console name (ppc uses hvc0);
- change the kernel image name to match what was built (vmlinux).

Fabiano Rosas (5):
build-qemu: Add support for ppc64le
Add virtio-fs kernel config snippet
build-linux: Add support for ppc64le
build-rootfs: Download latest config.guess for blogbench
run-test: Add support for ppc64le

Quoted 13 lines
 build-linux.sh                                | 26 ++++++++++++++++---
 build-qemu.sh                                 | 25 +++++++++++++++---
 build-rootfs.sh                               |  2 +-
 configs/virtio-fs                             |  8 ++++++
 ...-virtio-fs => x86_64-monolithic-virtio-fs} |  0
 run-test.sh                                   | 23 ++++++++++++----
 6 files changed, 71 insertions(+), 13 deletions(-)
 create mode 100644 configs/virtio-fs
 rename configs/{config-monolithic-virtio-fs => x86_64-monolithic-virtio-fs} (100%)
Signature · 1 line
2.23.0

Thanks, applied!

Stefan