[vfio-users] trouble mapping the pci config space on vfio-pci

Christophe Milard christophe.milard at linaro.org
Fri Oct 30 11:36:36 UTC 2015


Hi

www.kernel.org/doc/Documentation/vfio.txt says:

"""
for (i = 0; i < device_info.num_regions; i++) {
struct vfio_region_info reg = { .argsz = sizeof(reg) };

reg.index = i;

ioctl(device, VFIO_DEVICE_GET_REGION_INFO, &reg);

/* Setup mappings... read/write offsets, mmaps
* For PCI devices, config space is a region */
}
"""

stating that the pci config space could be mapped using mmap, as any other
regions.
But, (after failing doing that and) looking
in linux/drivers/vfio/pci/vfio_pci.c, I can see:
"""

static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
{
...        if (index >= VFIO_PCI_ROM_REGION_INDEX)
                return -EINVAL;
"""

As VFIO_PCI_ROM_REGION_INDEX is defined as:

"""
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,
...
"""

The if statment excludes the possibility to map the pci configuration
region as any normal (BAR) region...

DId I miss something? How am I supposed to perform the configuration space
mapping then?

Thanks in advance for your help.

Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20151030/24f89ba9/attachment.htm>


More information about the vfio-users mailing list