[libvirt] [PATCHv2 04/12] pci: new iommu_group functions

Daniel P. Berrange berrange at redhat.com
Tue Jun 25 10:34:28 UTC 2013


On Mon, Jun 24, 2013 at 11:05:30PM -0400, Laine Stump wrote:
> Any device which belongs to an "IOMMU group" (used by vfio) will
> have links to all devices of its group listed in
> /sys/bus/pci/$device/iommu_group/devices;
> /sys/bus/pci/$device/iommu_group is actually a link to
> /sys/kernel/iommu_groups/$n, where $n is the group number (there
> will be a corresponding device node at /dev/vfio/$n once the
> devices are bound to the vfio-pci driver)
> 
> The following functions are added:

Naming convention is normally <object><action>, which I would
interpret here as 'virPCIDeviceIOMMUGroup' as the object,
since you're passing a 'virPCIDevice' or 'virPCIDeviceAddress'
type as parameter.


> virPCIDeviceGetIOMMUGroupList
> 
>   Gets a virPCIDeviceList with one virPCIDeviceList for each device
>   in the same IOMMU group as the provided virPCIDevice (a copy of the
>   original device object is included in the list.

ack to this name

> 
> virPCIIOMMUGroupIterate
> 
>   Calls the function @actor once for each device in the group that
>   contains the given virPCIDeviceAddress.

virPCIDeviceIOMMUGroupIterate

> 
> virPCIGetIOMMUGroupAddresses
> 
>   Fills in a virPCIDeviceAddressPtr * with an array of
>   virPCIDeviceAddress, one for each device in the iommu group of the
>   provided virPCIDeviceAddress (including a copy of the original).

virPCIDeviceGetIOMMUGroupAddresses

> 
> virPCIGetIOMMUGroupNum
> 
>   Returns the group number as an int (a valid group number will always
>   be 0 or greater).  If there is no iommu_group link in the device's
>   directory (usually indicating that vfio isn't loaded), -2 will be
>   returned. On any real error, -1 will be returned.

virPCIDeviceGetIOMMUGroupNum


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list