1#!/usr/bin/env bash 2 3get_qemu_machine () 4{ 5 if [ "$MACHINE" ]; then 6 echo $MACHINE 7 else 8 echo pseries 9 fi 10} 11 12if [ -z "$KUT_STANDALONE" ]; then 13 if [ ! -f config.mak ]; then 14 echo "run ./configure && make first. See ./configure -h" 15 exit 2 16 fi 17 source config.mak 18 source scripts/arch-run.bash 19fi 20 21set_qemu_accelerator || exit $? 22 23MACHINE=$(get_qemu_machine) || 24 exit $? 25 26if [[ "$MACHINE" == "powernv"* ]] && [ "$ACCEL" = "kvm" ]; then 27 echo "PowerNV machine does not support KVM. ACCEL=tcg must be specified." 28 exit 2 29fi 30 31qemu=$(search_qemu_binary) || 32 exit $? 33 34if ! $qemu -machine '?' 2>&1 | grep $MACHINE > /dev/null; then 35 echo "$qemu doesn't support '-machine $MACHINE'. Exiting." 36 exit 2 37fi 38 39A="-accel $ACCEL$ACCEL_PROPS" 40M="-machine $MACHINE" 41B="" 42D="" 43 44if [[ "$MACHINE" == "pseries"* ]] ; then 45 if [[ "$ACCEL" == "tcg" ]] ; then 46 M+=",cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off" 47 elif [[ "$ACCEL" == "kvm" ]] ; then 48 M+=",cap-ccf-assist=off" 49 fi 50 B+="-bios $FIRMWARE" 51fi 52 53if [[ "$MACHINE" == "powernv"* ]] ; then 54 D+="-device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10" 55fi 56 57command="$qemu -nodefaults $A $M $B $D" 58command+=" -display none -serial stdio -kernel" 59command="$(migration_cmd) $(timeout_cmd) $command" 60 61# powerpc tests currently exit with rtas-poweroff, which exits with 0. 62# run_qemu treats that as a failure exit and returns 1, so we need 63# to fixup the fixup below by parsing the true exit code from the output. 64# The second fixup is also a FIXME, because once we add chr-testdev 65# support for powerpc, we won't need the second fixup. 66run_qemu_status $command "$@" 67