From owner-svn-src-head@freebsd.org Thu May 3 22:51:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03070FBEDAF; Thu, 3 May 2018 22:51:45 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA1E77A61C; Thu, 3 May 2018 22:51:44 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A534D26485; Thu, 3 May 2018 22:51:44 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w43Mpihh067396; Thu, 3 May 2018 22:51:44 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w43MpihV067395; Thu, 3 May 2018 22:51:44 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201805032251.w43MpihV067395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Thu, 3 May 2018 22:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333230 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 333230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 22:51:45 -0000 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 */