From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: KVM PCI device assignment issues Date: Fri, 13 Feb 2009 17:06:16 +0000 Message-ID: <1234544776.23746.87.camel@blaa> References: <1234542767.23746.81.camel@blaa> <20090213165615.GA31338@kroah.com> Reply-To: Mark McLoughlin Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm , "linux-pci@vger.kernel.org" , Chris Wright , "Dugger, Donald D" , "Kay, Allen M" To: Greg KH Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33866 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbZBMRGY (ORCPT ); Fri, 13 Feb 2009 12:06:24 -0500 In-Reply-To: <20090213165615.GA31338@kroah.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 2009-02-13 at 08:56 -0800, Greg KH wrote: > On Fri, Feb 13, 2009 at 04:32:47PM +0000, Mark McLoughlin wrote: > > Driver Unbinding > > ================ > > > > Before a device is assigned to a guest, we should make sure that no host > > device driver is currently bound to the device. > > > > We can do that with e.g. > > > > $> echo -n "8086 10de" > /sys/bus/pci/drivers/pci-stub/new_id > > $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind > > $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers/pci-stub/bind > > > > One minor problem with this scheme is that at this point you can't > > unbind from pci-stub and trigger a re-probe and have e1000e bind to it. > > Are you sure? It should work if you manually tell the e1000e driver to > bind to it, after unbinding it from the pci-stub driver. Yes, that works - I meant using /sys/bus/pci/drivers_probe. The problem is that it would suck for management tools to have to remember which device driver it was originally bound to. > > In order to support that, we need a "remove_id" interface to remove the > > dynamic ID. > > Why? Before assignment: $> echo -n "8086 10de" > /sys/bus/pci/drivers/pci-stub/new_id $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers/pci-stub/bind $> echo -n "8086 10de" > /sys/bus/pci/drivers/pci-stub/remove_id After assignment: $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers_probe > > What we don't support is a way to unbind permanently. Xen has a > > pciback.hide module param which tries to achieve this, but you end up > > with the inevitable issues around making sure pciback is loaded before > > the device driver etc. > > What do you mean, unbind "permanently"? For every reboot? Or just > within the same boot time? Across reboots, yeah. Cheers, Mark.