diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index 7a8007f07f7..901404b8b43 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -62,6 +62,7 @@ usage() { echo " -i: force boot of the Installation CDROM image" echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" + echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" echo "" [ -n "$msg" ] && errmsg "$msg" @@ -89,8 +90,9 @@ disk_total=0 apic_opt="" gdbport=0 loader_opt="" +pass_total=0 -while getopts ac:C:d:e:g:hH:iI:m:t: c ; do +while getopts ac:C:d:e:g:hH:iI:m:p:t: c ; do case $c in a) apic_opt="-a" @@ -123,6 +125,10 @@ while getopts ac:C:d:e:g:hH:iI:m:t: c ; do m) memsize=${OPTARG} ;; + p) + eval "pass_dev${pass_total}=\"${OPTARG}\"" + pass_total=$(($pass_total + 1)) + ;; t) eval "tap_dev${tap_total}=\"${OPTARG}\"" tap_total=$(($tap_total + 1)) @@ -237,6 +243,14 @@ while [ 1 ]; do i=$(($i + 1)) done + i=0 + while [ $i -lt $pass_total ] ; do + eval "pass=\$pass_dev${i}" + devargs="$devargs -s $nextslot:0,passthru,${pass} " + nextslot=$(($nextslot + 1)) + i=$(($i + 1)) + done + ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P \ -g ${gdbport} \ -s 0:0,hostbridge \