diff options
author | neel <neel@FreeBSD.org> | 2013-02-14 18:41:12 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2013-02-14 18:41:12 +0000 |
commit | 2daa6fd67957bfe644eb480eb90ce4ef1e820c0c (patch) | |
tree | 3cfd5d518fb64bb3f4994126d67f03c64d6fd6b1 /usr.sbin/bhyvectl | |
parent | fb6cb8223947248dbf294635cb6ff851db85f2ba (diff) | |
download | FreeBSD-src-2daa6fd67957bfe644eb480eb90ce4ef1e820c0c.zip FreeBSD-src-2daa6fd67957bfe644eb480eb90ce4ef1e820c0c.tar.gz |
Add option "--unassign-pptdev=<bus/slot/func>" to allow 'bhyvectl' to detach
passthru devices from the guest.
Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyvectl')
-rw-r--r-- | usr.sbin/bhyvectl/bhyvectl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index 4eb87f9..26c6c92 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -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_fs, set_gs, set_ss, set_tr, set_ldtr; 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); |