11b7dd7d3SSergey Bronnikov#!/usr/bin/env bash 28c85a478SAndrew Jones 38c85a478SAndrew Jonesif [ -z "$STANDALONE" ]; then 48c85a478SAndrew Jones if [ ! -f config.mak ]; then 58c85a478SAndrew Jones echo "run ./configure && make first. See ./configure -h" 68c85a478SAndrew Jones exit 2 78c85a478SAndrew Jones fi 88c85a478SAndrew Jones source config.mak 9b2a2aa5dSAndrew Jones source scripts/arch-run.bash 108c85a478SAndrew Jonesfi 118c85a478SAndrew Jones 128c85a478SAndrew Jonesif [ -c /dev/kvm ]; then 138c85a478SAndrew Jones if [ "$HOST" = "ppc64" ] && [ "$ARCH" = "ppc64" ]; then 148c85a478SAndrew Jones kvm_available=yes 158c85a478SAndrew Jones fi 168c85a478SAndrew Jonesfi 178c85a478SAndrew Jones 188c85a478SAndrew Jonesif [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then 19d5f55dccSRadim Krčmář echo "KVM is needed, but not available on this host" 208c85a478SAndrew Jones exit 2 218c85a478SAndrew Jonesfi 228c85a478SAndrew Jones 238c85a478SAndrew Jonesif [ -z "$ACCEL" ]; then 248c85a478SAndrew Jones if [ "$kvm_available" = "yes" ]; then 258c85a478SAndrew Jones ACCEL="kvm" 268c85a478SAndrew Jones else 278c85a478SAndrew Jones ACCEL="tcg" 288c85a478SAndrew Jones fi 298c85a478SAndrew Jonesfi 308c85a478SAndrew Jones 31*fcf4e0d9SRadim Krčmářqemu=$(search_qemu_binary) || 32*fcf4e0d9SRadim Krčmář exit $? 338c85a478SAndrew Jones 348c85a478SAndrew Jonesif ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then 3504fcca42SBalamuruhan S echo "$qemu doesn't support pSeries ('-machine pseries'). Exiting." 368c85a478SAndrew Jones exit 2 378c85a478SAndrew Jonesfi 388c85a478SAndrew Jones 398c85a478SAndrew JonesM='-machine pseries' 408c85a478SAndrew JonesM+=",accel=$ACCEL" 413695c93aSAndrew Jonescommand="$qemu -nodefaults $M -bios $FIRMWARE" 428b13a5b5SRadim Krčmářcommand+=" -display none -serial stdio -kernel" 4337abdda9SThomas Huthcommand="$(migration_cmd) $(timeout_cmd) $command" 448c85a478SAndrew Jones 45b2a2aa5dSAndrew Jones# powerpc tests currently exit with rtas-poweroff, which exits with 0. 46b2a2aa5dSAndrew Jones# run_qemu treats that as a failure exit and returns 1, so we need 47b2a2aa5dSAndrew Jones# to fixup the fixup below by parsing the true exit code from the output. 48b2a2aa5dSAndrew Jones# The second fixup is also a FIXME, because once we add chr-testdev 49b2a2aa5dSAndrew Jones# support for powerpc, we won't need the second fixup. 50e0a8391eSRadim Krčmářrun_qemu_status $command "$@" 51