diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-10-04 13:15:55 -0700 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-12-03 10:11:15 -0800 |
commit | 315c540d46f8f11fe2a84e627d9473e90441ae96 (patch) | |
tree | 24544028c66196efce7dcd113a51549c04585fc5 /tools/testing/selftests/rcutorture/bin/functions.sh | |
parent | 2bcdf4e31ae4e215b1e61831d9defa3632cb7bd3 (diff) |
rcutorture: Refactor to enable non-x86 architectures
This commit expands the checks for what architecture is running to generate
additional qemu-system- commands, then uses the resulting qemu-system-
command name to choose different qemu arguments as needed for different
architectures.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/functions.sh')
-rw-r--r-- | tools/testing/selftests/rcutorture/bin/functions.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh index c974414ef7a5..d0d19ebd2a94 100644 --- a/tools/testing/selftests/rcutorture/bin/functions.sh +++ b/tools/testing/selftests/rcutorture/bin/functions.sh @@ -78,3 +78,81 @@ identify_qemu () { exit 1 fi } + +# identify_qemu_append qemu-cmd +# +# Output arguments for the qemu "-append" string based on CPU type +# and the RCU_QEMU_INTERACTIVE environment variable. +identify_qemu_append () { + case "$1" in + qemu-system-x86_64|qemu-system-i386) + echo noapic selinux=0 initcall_debug debug + ;; + esac + if test -n "$RCU_QEMU_INTERACTIVE" + then + echo root=/dev/sda + else + echo console=ttyS0 + fi +} + +# identify_qemu_args qemu-cmd serial-file +# +# Output arguments for qemu arguments based on the RCU_QEMU_MAC +# and RCU_QEMU_INTERACTIVE environment variables. +identify_qemu_args () { + case "$1" in + qemu-system-x86_64|qemu-system-i386) + ;; + qemu-system-ppc64) + echo -enable-kvm -M pseries -cpu POWER7 -nodefaults + echo -device spapr-vscsi + if test -n "$RCU_QEMU_INTERACTIVE" -a -n "$RCU_QEMU_MAC" + then + echo -device spapr-vlan,netdev=net0,mac=$RCU_QEMU_MAC + echo -netdev bridge,br=br0,id=net0 + elif test -n "$RCU_QEMU_INTERACTIVE" + then + echo -net nic -net user + fi + ;; + esac + if test -n "$RCU_QEMU_INTERACTIVE" + then + echo -monitor stdio -serial pty -S + else + echo -serial file:$2 + fi +} + +# identify_qemu_vcpus +# +# Returns the number of virtual CPUs available to the aggregate of the +# guest OSes. +identify_qemu_vcpus () { + lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://' +} + +# specify_qemu_cpus qemu-cmd qemu-args #cpus +# +# Appends a string containing "-smp XXX" to qemu-args, unless the incoming +# qemu-args already contains "-smp". +specify_qemu_cpus () { + local nt; + + if echo $2 | grep -q -e -smp + then + echo $2 + else + case "$1" in + qemu-system-x86_64|qemu-system-i386) + echo $2 -smp $3 + ;; + qemu-system-ppc64) + nt="`lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'`" + echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / $nt`,threads=$nt + ;; + esac + fi +} |