From owner-freebsd-arch@FreeBSD.ORG Wed Jan 7 18:17:53 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78C10F68; Wed, 7 Jan 2015 18:17:53 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FF02642C5; Wed, 7 Jan 2015 18:17:53 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Y8vB0-0001vg-O4; Wed, 07 Jan 2015 22:17:50 +0400 Date: Wed, 7 Jan 2015 22:17:50 +0400 From: Slawa Olhovchenkov To: John Baldwin Subject: Re: devctl(8): A device control utility Message-ID: <20150107181750.GB5588@zxy.spb.ru> References: <3200196.9ZgXApgRdA@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3200196.9ZgXApgRdA@ralph.baldwin.cx> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jan 2015 18:17:53 -0000 On Mon, Jan 05, 2015 at 03:01:00PM -0500, John Baldwin wrote: > For a long time I've wanted a way to administratively manipulate the state of > new-bus devices from userland. I think the first use case I wanted was a way > to power off the sound controller (and anything else I wasn't using) on my > first laptop (a Dell Inspiron 5000e I got back in 2000). Similarly, it would > be nice to have a way to handle "ejectable" devices (ACPI has a provision for > this, and said laptop had _EJx methods to allow one to swap a CD drive out for > a battery in a bay while the laptop was in S3). There are some other use > cases that would also be nice such as detaching a driver from a PCI device to > decide at runtime that it should be passed through to a bhyve guest (and > possibly undoing that to allow a host driver to take it back over). Forcing a > rescan of a PCI device can be useful if you are using an FPGA and would like > to alter BAR layout/sizes without having to reboot the OS. A way to force > resets at runtime might also be useful (e.g. a FLR for a PCI device). A few > weeks ago I finally sat down and started on an implementation. It can be > found here: > > https://github.com/bsdjhb/freebsd/compare/devctl > > Sample commands look like: > > % devctl disable virtio_pci2 > > # detaches the driver, but leaves the device's name intact similar to > # specifying hint.virtio_pci.2.disabled=1 at boot > > % devctl enable virtio_pci2 > > # enables a disabled device, including attaching it > > % devctl detach uart1 > > # does a full detach, which means the device is now unnamed Can be now this device used for VirtualBox USB passthrough?