#
# Written by Richard W.M. Jones <rjones@redhat.com>
+arch="@host_cpu@"
qemu="@QEMU@"
image="supernested-@VERSION@-@DISTRO@.qcow2"
format=qcow2
kernel=kernel
initrd=initrd
-append="panic=1 console=ttyS0 udevtimeout=6000 no_timer_check printk.time=1 root=/dev/sda selinux=0"
+append="panic=1 udevtimeout=6000 udev.event-timeout=6000 no_timer_check printk.time=1 root=/dev/sda selinux=0"
smp=
+tcg=
+
+case "$arch" in
+ aarch64)
+ append="$append earlyprintk=pl011,0x9000000 ignore_loglevel efi-rtc=noprobe"
+ ;;
+ *)
+ append="$append console=ttyS0"
+ ;;
+esac
TEMP=`getopt \
-o '' \
- --longoptions 'help,nested,smp:' \
+ --longoptions 'help,nested,smp:,tcg' \
-n run-supernested.sh -- "$@"`
if [ $? != 0 ]; then
echo "$0: problem parsing the command line arguments"
usage ()
{
echo "$0: Run the supernested appliance."
- echo " $0 [--smp=N]"
+ echo " $0 [--smp=N] [--tcg]"
echo "Options:"
echo " --smp=N Use N virtual CPUs (at all levels)."
+ echo " --tcg Use TCG (at all levels) instead of KVM."
}
while true ; do
grep -Eo 'supernested.smp=[[:digit:]]+' /proc/cmdline |
grep -Eo '[[:digit:]]+'
)"
- if [ -n "$smp" ]; then smp="-smp $smp"; fi
+ tcg=
+ if grep -q supernested.tcg=1 /proc/cmdline; then
+ tcg=1
+ fi
shift
;;
--smp)
- smp="-smp $2"
- append="$append supernested.smp=$2"
+ smp="$2"
shift 2
;;
+ --tcg)
+ tcg=1
+ shift
+ ;;
--help)
usage
exit 0
fi
memory=$((memory - 1500))
+# ARM mach_virt (-M virt) model only supports 30GB of RAM.
+if [ $memory -gt 30000 ]; then
+ case "$arch" in
+ arm*|aarch64)
+ echo "$0: limiting memory to 30000 MB for ARM mach_virt"
+ memory=30000
+ ;;
+ *)
+ esac
+fi
+
# Get current nesting level from /proc/cmdline, increment it, add it
# to the command line.
level="$(
if [ -z "$level" ]; then level=0; fi
append="$append supernested.level=$((level+1))"
+# Append other parameters to nested command line.
+append="$append supernested.smp=$smp supernested.tcg=$tcg"
+
+extra_args=
+if [ -n "$smp" ]; then extra_args="$extra_args -smp $smp"; fi
+if [ -n "$tcg" ]; then
+ extra_args="$extra_args -machine accel=tcg"
+else
+ extra_args="$extra_args -cpu host -machine accel=kvm"
+fi
+
echo "Running"
echo " qemu = $qemu"
-echo " smp = $smp"
+echo " extra_args = $extra_args"
echo " memory = $memory"
echo " kernel = $kernel"
echo " initrd = $initrd"
exec \
"$qemu" \
- -cpu host \
- -machine accel=kvm \
- $smp \
+ $extra_args \
-display none \
-m $memory \
-no-reboot \