Re: KVM PCI device assignment issues

Mark McLoughlin
2009-02-13T17:06:24Z

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.