Re: svn commit: r333230 - head/sys/dev/pci

2018-05-04 Thread John Baldwin
On Thursday, May 03, 2018 10:51:44 PM Peter Grehan wrote:
> 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

I forgout about this earlier, sorry.  We probably should also
explicitly release any resources cached in sc->vga_bios and
sc->vga_bars.  In theory they should be clear by the time
bus_generic_detach finishes, but perhaps we should walk the
resources and whine if they aren't released and then release
them.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r333230 - head/sys/dev/pci

2018-05-03 Thread Peter Grehan
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"