[libvirt] [PATCH 2/5] Add virNodeDeviceAttach()/ReAttach()/Reset() APIs

Daniel P. Berrange berrange at redhat.com
Wed Feb 25 17:51:01 UTC 2009

On Tue, Feb 24, 2009 at 10:21:48PM +0000, Mark McLoughlin wrote:
> Before starting a guest virNodeDeviceAttach() is intended
> to be called on all node devices to be assigned to a guest,
> followed by virNodeDeviceReset() on those devices.
> Once the guest has been shutdown, virNodeDeviceReset()
> followed by virNodeDeviceReAttach() should be called in
> order to make the device available to the host again.
> This patch merely adds the APIs and stubs out the driver
> implementations.

While I can see a point in providing public APIs to attach/detach
drivers to devices - because we need this for Xen driver PCI 
passthrough, I'm not sure theres a compelling need for exposing
a reset function, because both Xen & your KVM impl are quite
happy doing the resets themselves.

I think the attach/detach functions should be in the nodedev
driver too, because they're not really part of the HV functionality.
On modern Linux kernels, both Xen & KVM (and any other users) have 
the same pci-stub.ko code for managed driver binding. On older Xen
kernels, there is the functionally equivalent pci-back.ko.

A similar capability is really needed for USB devices, to disconnect
them from any host USB driver, and that's not HV specific either.

|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list