[vfio-users] VFIO for PCIe streaming from/to user space
Alex Williamson
alex.williamson at redhat.com
Wed Feb 14 21:18:54 UTC 2018
On Wed, 14 Feb 2018 22:06:35 +0100
Oliver Heid <oliver.heid at h-next.de> wrote:
> Regarding the vfio_device_info struct: I get 9 device regions, of which
> region 0, 2 and 4 seem to be the three BAR regions. Is that so? Always?
> What do the other regions do?
This is all answered in the API:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vfio.h
/*
* The VFIO-PCI bus driver makes use of the following fixed region and
* IRQ index mapping. Unimplemented regions return a size of zero.
* Unimplemented IRQ types return a count of zero.
*/
enum {
VFIO_PCI_BAR0_REGION_INDEX,
VFIO_PCI_BAR1_REGION_INDEX,
VFIO_PCI_BAR2_REGION_INDEX,
VFIO_PCI_BAR3_REGION_INDEX,
VFIO_PCI_BAR4_REGION_INDEX,
VFIO_PCI_BAR5_REGION_INDEX,
VFIO_PCI_ROM_REGION_INDEX,
VFIO_PCI_CONFIG_REGION_INDEX,
/*
* Expose VGA regions defined for PCI base class 03, subclass 00.
* This includes I/O port ranges 0x3b0 to 0x3bb and 0x3c0 to 0x3df
* as well as the MMIO range 0xa0000 to 0xbffff. Each implemented
* range is found at it's identity mapped offset from the region
* offset, for example 0x3b0 is region_info.offset + 0x3b0. Areas
* between described ranges are unimplemented.
*/
VFIO_PCI_VGA_REGION_INDEX,
VFIO_PCI_NUM_REGIONS = 9 /* Fixed user ABI, region indexes >=9 use */
/* device specific cap to define content. */
};
> And by mmap of PCIe config space you mean mapping the files
> /sys/bus/pci/devices/0000:xx:yy.z/resource0 ?!
No, use the VFIO_PCI_CONFIG_REGION_INDEX region.
More information about the vfio-users
mailing list