lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 11 Oct 2023 00:46:31 +0530
From:   "Ritesh Harjani (IBM)" <ritesh.list@...il.com>
To:     Theodore Ts'o <tytso@....edu>
Cc:     linux-ext4@...r.kernel.org, Ojaswin Mujoo <ojaswin@...ux.ibm.com>,
        "Ritesh Harjani (IBM)" <ritesh.list@...il.com>
Subject: [PATCH 2/2] kvm-xfstests: Add support for ppc64

These changes adds support for powerpc ppc64le to kvm-xfstests including
building rootfs image.
(Note: this requires latest qemu i.e. "qemu-system-ppc64 -machine help"
should atleast support pseries-8.1)

Here are the cmds which have been tested.

1. ~/src/tools/xfstests-bld/kernel-build/install-kconfig --arch ppc64le
2. ~/src/tools/xfstests-bld/kernel-build/kbuild --arch ppc64le
3. ~/src/tools/xfstests-bld/run-fstests/kvm-xfstests --arch ppc64le \
	-N -o "fstesttyp=ext4" -n 4 -r 4096M -c 64k generic/001 -v
4. ./kvm-xfstests -N --kernel ~/src/linux/out-qemu/vmlinux --kernel-arch=ppc64le \
            -o "fstesttyp=ext4" -n 4 -r 4096M -c 64k generic/001 -v
5. ./setup-buildchroot --arch=ppc64el && ./build-appliance --chroot=bookworm-ppc64el
6. On a linux build repo, we can directly use
   ~/src/tools/xfstests-bld/run-fstests/kvm-xfstests -c 4k,64k generic/001
7. On x86 it will default to tcg mode instead of kvm.

<log>
-------------------- Summary report
KERNEL:    kernel 6.6.0-rc1-next-20230913-xfstests-dirty #1 SMP Sat Oct  7 13:35:24 IST 2023 ppc64le
CMDLINE:   -c 4k,64k generic/001
CPUS:      2
MEM:       1982.81

ext4/4k: 1 tests, 3 seconds
  generic/001  Pass     3s
ext4/64k: 1 tests, 5 seconds
  generic/001  Pass     4s
Totals: 2 tests, 0 skipped, 0 failures, 0 errors, 7s

Co-developed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
---
 kernel-build/install-kconfig               |  3 ++
 kernel-build/kbuild                        |  9 ++++++
 kernel-build/kernel-configs/ppc64le-config |  9 ++++++
 run-fstests/kvm-xfstests                   | 35 +++++++++++++++++-----
 run-fstests/util/arch-funcs                | 19 ++++++++++++
 run-fstests/util/parse_cli                 |  5 ++++
 run-fstests/util/parse_opt_funcs           |  3 ++
 7 files changed, 76 insertions(+), 7 deletions(-)
 create mode 100644 kernel-build/kernel-configs/ppc64le-config

diff --git a/kernel-build/install-kconfig b/kernel-build/install-kconfig
index f5b2b8e..a79e0e6 100755
--- a/kernel-build/install-kconfig
+++ b/kernel-build/install-kconfig
@@ -31,6 +31,9 @@ do
 	--arm64)
 	    ARCH=arm64
 	    ;;
+	--ppc64le)
+	    ARCH=ppc64le
+	    ;;
 	--arch)
 	    shift
 	    ARCH=$1
diff --git a/kernel-build/kbuild b/kernel-build/kbuild
index 28b81b4..3d5ccaa 100755
--- a/kernel-build/kbuild
+++ b/kernel-build/kbuild
@@ -52,6 +52,9 @@ do
 	--arm64)
 	    ARCH=arm64
 	    ;;
+	--ppc64le)
+	    ARCH=ppc64le
+	    ;;
 	--dpkg)
 	    DO_DPKG=yes
 	    DPKG_EXPLICIT=yes
@@ -104,6 +107,12 @@ case "$ARCH" in
 	    BLD_DIR=$BLD_DIR_X86_64
 	fi
 	;;
+	ppc64le)
+	if test -n "$BLD_DIR_PPC64LE" ; then
+	    BLD_DIR=$BLD_DIR_PPC64LE
+	fi
+	;;
+
     *)
 	echo "unknown architecture: $KERN_ARCH"
 	exit 1
diff --git a/kernel-build/kernel-configs/ppc64le-config b/kernel-build/kernel-configs/ppc64le-config
new file mode 100644
index 0000000..e748d0d
--- /dev/null
+++ b/kernel-build/kernel-configs/ppc64le-config
@@ -0,0 +1,9 @@
+CONFIG_PPC64=y
+CONFIG_CPU_LITTLE_ENDIAN=y
+CONFIG_PAPR_SCM=y
+CONFIG_KVM_BOOK3S_64=y
+CONFIG_KVM_BOOK3S_64_HV=y
+CONFIG_HVC_CONSOLE=y
+CONFIG_HVC_RTAS=y
+CONFIG_HVCS=y
+CONFIG_VIRTIO_CONSOLE=y
diff --git a/run-fstests/kvm-xfstests b/run-fstests/kvm-xfstests
index 2df74c1..f23c9be 100755
--- a/run-fstests/kvm-xfstests
+++ b/run-fstests/kvm-xfstests
@@ -52,16 +52,29 @@ QUIET="quiet loglevel=0"
 
 DOWNLOAD_BASE_URL="https://mirrors.kernel.org/pub/linux/kernel/people/tytso/kvm-xfstests"
 if test -z "$EXPLICIT_ROOT_FS" ; then
-    ROOT_FS="$(dirname $DIR)/test-appliance/root_fs.img.$ARCH"
+    if [ "$ARCH" == "ppc64le" ]
+    then
+        # root_fs follows debian naming convention ie ppc64le -> ppc64el
+        ROOT_FS="$(dirname $DIR)/test-appliance/root_fs.img.ppc64el"
+    else
+        ROOT_FS="$(dirname $DIR)/test-appliance/root_fs.img.$ARCH"
+    fi
+
     if ! test -f "$ROOT_FS" ; then
-	ROOT_FS="$(dirname $DIR)/test-appliance/root_fs.img"
+        ROOT_FS="$(dirname $DIR)/test-appliance/root_fs.img"
     fi
     if ! test -f "$ROOT_FS" ; then
-	f=root_fs.img.$ARCH
-	ROOT_FS="$(dirname $DIR)/test-appliance/$f"
-	echo "Downloading $f..."
-	wget -nv --show-progress -O "$ROOT_FS.new" "$DOWNLOAD_BASE_URL/$f"
-	mv "$ROOT_FS.new" "$ROOT_FS"
+        if [ "$ARCH" == "ppc64le" ]
+        then
+            # root_fs follows debian naming convention ie ppc64le -> ppc64el
+            f=root_fs.img.ppc64el
+        else
+            f=root_fs.img.$ARCH
+        fi
+        ROOT_FS="$(dirname $DIR)/test-appliance/$f"
+        echo "Downloading $f..."
+        wget -nv --show-progress -O "$ROOT_FS.new" "$DOWNLOAD_BASE_URL/$f"
+        mv "$ROOT_FS.new" "$ROOT_FS"
     fi
 fi
 
@@ -206,6 +219,14 @@ case "$ARCH" in
 	MACHINE_TYPE=virt
 	CPU_TYPE=max
 	;;
+    ppc64le)
+	QEMU_ARCH=ppc64
+	ACCEL=kvm:tcg
+	CONSOLE_DEV=hvc0
+	MACHINE_TYPE=pseries,cap-ail-mode-3=off
+	CPU_TYPE=max
+	GDB=""
+	;;
     *)
 	echo "Unsupported architecture: $ARCH"
 	exit 1;
diff --git a/run-fstests/util/arch-funcs b/run-fstests/util/arch-funcs
index 3933867..bc7cf47 100644
--- a/run-fstests/util/arch-funcs
+++ b/run-fstests/util/arch-funcs
@@ -21,6 +21,7 @@ function set_my_arch () {
 	aarch64)   MY_ARCH=arm64  ;;
 	i386|i686) MY_ARCH=i386   ;;
 	x86_64)    MY_ARCH=amd64  ;;
+	ppc64le)   MY_ARCH=ppc64le ;;
 	*)         MY_ARCH=$arch  ;;
     esac
 }
@@ -60,6 +61,12 @@ function set_canonicalized_arch () {
 	    GCE_ARCH="X86_64"
 	    KERN_ARCH="x86_64"
 	    ;;
+	# setup_buildchroot uses ppc64el
+	ppc64el|ppc64le)
+	    ARCH="ppc64le"
+	    GCE_ARCH="ppc64le"
+	    KERN_ARCH="powerpc"
+	    ;;
 	*)
 	    echo "Architecture $ARCH not supported"
 	    exit 1
@@ -76,6 +83,11 @@ function set_cross_compile ()
 		CROSS_COMPILE=aarch64-linux-gnu-
 	    fi
 	    ;;
+	ppc64le)
+	    if test "$MY_ARCH" != ppc64le ; then
+		CROSS_COMPILE=powerpc64le-linux-gnu-
+	    fi
+	    ;;
     esac
 }
 
@@ -133,6 +145,13 @@ function get_kernel_file_info () {
 		KERNEL_VERSION=$(dpkg -I "$KERNEL" | grep "^ Version: " | \
 			  awk '{print $2}')
 		;;
+	    *"PowerPC"*)
+		KERNEL_ARCH=ppc64le
+		d=$(dirname $(dirname $(dirname $(dirname "$KERNEL"))))
+		if test -f "$d/.git_version" ; then
+		    KERNEL_VERSION=$(cat "$d/.git_version")
+		fi
+		;;
 	    *)
 		echo "get-kernel-arch $i is not a kernel" >&2
 		echo "$info"
diff --git a/run-fstests/util/parse_cli b/run-fstests/util/parse_cli
index c7e133f..9dc574b 100644
--- a/run-fstests/util/parse_cli
+++ b/run-fstests/util/parse_cli
@@ -422,6 +422,11 @@ while (( $# >= 1 )); do
 	    ARCH="$1"
 	    EXPLICIT_ARCH=yes
 	    ;;
+	--ppc64le)
+	    supported_flavors kvm
+	    ARCH="ppc64le"
+	    EXPLICIT_ARCH=yes
+	    ;;
 	--arm64)
 	    supported_flavors kvm gce
 	    ARCH="arm64"
diff --git a/run-fstests/util/parse_opt_funcs b/run-fstests/util/parse_opt_funcs
index 5457760..83df45a 100644
--- a/run-fstests/util/parse_opt_funcs
+++ b/run-fstests/util/parse_opt_funcs
@@ -25,6 +25,9 @@ find_kernel_to_use()
 	arm64)
 	    kernel_in_build=arch/arm64/boot/Image
 	    ;;
+	ppc64le)
+	    kernel_in_build=arch/powerpc/boot/zImage
+	    ;;
 	*)
 	    echo "Unknown architecture in find_kernel_to_use: $ARCH"
 	    exit 1
-- 
2.41.0

Powered by blists - more mailing lists