Author: grehan Date: Thu May 3 22:51:44 2018 New Revision: 333230 URL: https://svnweb.freebsd.org/changeset/base/333230
Log: Allow PCI VGA devices to be detached. GPUs often have a VGA PCI class code and are probed/attached by the VGA driver. Allow them to be detached so they can be presented as passthru devices to VM guests. Submitted by: mmacy Reviewed by: jhb, imp, rgrimes MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D15269 Modified: head/sys/dev/pci/vga_pci.c Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Thu May 3 21:45:59 2018 (r333229) +++ head/sys/dev/pci/vga_pci.c Thu May 3 22:51:44 2018 (r333230) @@ -283,6 +283,17 @@ vga_pci_suspend(device_t dev) } static int +vga_pci_detach(device_t dev) +{ + int error; + + error = bus_generic_detach(dev); + if (error == 0) + error = device_delete_children(dev); + return (error); +} + +static int vga_pci_resume(device_t dev) { @@ -620,6 +631,7 @@ static device_method_t vga_pci_methods[] = { DEVMETHOD(device_attach, vga_pci_attach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, vga_pci_suspend), + DEVMETHOD(device_detach, vga_pci_detach), DEVMETHOD(device_resume, vga_pci_resume), /* Bus interface */ _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"