summaryrefslogtreecommitdiffstats
path: root/share/examples
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-03-12 15:58:07 +0000
committerglebius <glebius@FreeBSD.org>2015-03-12 15:58:07 +0000
commit4e95be8742951c45e315846b56cd7fc98747a89c (patch)
treec1e2cfe08aaccd14c70d7b924e93d89f134876f0 /share/examples
parentd60dae6d10041ae598ee7c18cdb156dc45777cba (diff)
downloadFreeBSD-src-4e95be8742951c45e315846b56cd7fc98747a89c.zip
FreeBSD-src-4e95be8742951c45e315846b56cd7fc98747a89c.tar.gz
Add -p parameter to list PCI device to pass through to the guest.
Reviewed by: neel
Diffstat (limited to 'share/examples')
-rwxr-xr-xshare/examples/bhyve/vmrun.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh
index 7a8007f..901404b 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 \
OpenPOWER on IntegriCloud