svn commit: r246800 - head/usr.sbin/bhyvectl
Neel Natu
neel at FreeBSD.org
Thu Feb 14 18:41:13 UTC 2013
Author: neel
Date: Thu Feb 14 18:41:12 2013
New Revision: 246800
URL: http://svnweb.freebsd.org/changeset/base/246800
Log:
Add option "--unassign-pptdev=<bus/slot/func>" to allow 'bhyvectl' to detach
passthru devices from the guest.
Obtained from: NetApp
Modified:
head/usr.sbin/bhyvectl/bhyvectl.c
Modified: head/usr.sbin/bhyvectl/bhyvectl.c
==============================================================================
--- head/usr.sbin/bhyvectl/bhyvectl.c Thu Feb 14 17:34:17 2013 (r246799)
+++ head/usr.sbin/bhyvectl/bhyvectl.c Thu Feb 14 18:41:12 2013 (r246800)
@@ -185,6 +185,7 @@ usage(void)
" [--get-vmcs-interruptibility]\n"
" [--set-x2apic-state=<state>]\n"
" [--get-x2apic-state]\n"
+ " [--unassign-pptdev=<bus/slot/func>]\n"
" [--set-lowmem=<memory below 4GB in units of MB>]\n"
" [--get-lowmem]\n"
" [--set-highmem=<memory above 4GB in units of MB>]\n"
@@ -218,6 +219,7 @@ static int set_cs, set_ds, set_es, set_f
static int get_cs, get_ds, get_es, get_fs, get_gs, get_ss, get_tr, get_ldtr;
static int set_x2apic_state, get_x2apic_state;
enum x2apic_state x2apic_state;
+static int unassign_pptdev, bus, slot, func;
static int run;
/*
@@ -376,6 +378,7 @@ enum {
SET_VMCS_ENTRY_INTERRUPTION_INFO,
SET_CAP,
CAPNAME,
+ UNASSIGN_PPTDEV,
};
int
@@ -425,6 +428,7 @@ main(int argc, char *argv[])
{ "set-vmcs-entry-interruption-info",
REQ_ARG, 0, SET_VMCS_ENTRY_INTERRUPTION_INFO },
{ "capname", REQ_ARG, 0, CAPNAME },
+ { "unassign-pptdev", REQ_ARG, 0, UNASSIGN_PPTDEV },
{ "setcap", REQ_ARG, 0, SET_CAP },
{ "getcap", NO_ARG, &getcap, 1 },
{ "get-stats", NO_ARG, &get_stats, 1 },
@@ -672,6 +676,11 @@ main(int argc, char *argv[])
case CAPNAME:
capname = optarg;
break;
+ case UNASSIGN_PPTDEV:
+ unassign_pptdev = 1;
+ if (sscanf(optarg, "%d/%d/%d", &bus, &slot, &func) != 3)
+ usage();
+ break;
default:
usage();
}
@@ -805,6 +814,9 @@ main(int argc, char *argv[])
if (!error && set_x2apic_state)
error = vm_set_x2apic_state(ctx, vcpu, x2apic_state);
+ if (!error && unassign_pptdev)
+ error = vm_unassign_pptdev(ctx, bus, slot, func);
+
if (!error && set_exception_bitmap) {
error = vm_set_vmcs_field(ctx, vcpu, VMCS_EXCEPTION_BITMAP,
exception_bitmap);
More information about the svn-src-all
mailing list