<div dir="ltr">Hi<div><br></div><div><a href="http://www.kernel.org/doc/Documentation/vfio.txt">www.kernel.org/doc/Documentation/vfio.txt</a> says:<br></div><div><br></div><div>"""</div><div><div><span class="" style="white-space:pre">        </span>for (i = 0; i < device_info.num_regions; i++) {</div><div><span class="" style="white-space:pre">         </span>struct vfio_region_info reg = { .argsz = sizeof(reg) };</div><div><br></div><div><span class="" style="white-space:pre">           </span>reg.index = i;</div><div><br></div><div><span class="" style="white-space:pre">            </span>ioctl(device, VFIO_DEVICE_GET_REGION_INFO, &reg);</div><div><br></div><div><span class="" style="white-space:pre">             </span>/* Setup mappings... read/write offsets, mmaps</div><div><span class="" style="white-space:pre">             </span> * For PCI devices, config space is a region */</div><div><span class="" style="white-space:pre">    </span>}</div></div><div>"""</div><div><br></div><div>stating that the pci config space could be mapped using mmap, as any other regions.</div><div>But, (after failing doing that and) looking in linux/drivers/vfio/pci/vfio_pci.c, I can see:</div><div>"""</div><div><br></div><div><div>static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)</div><div>{ </div></div><div>...        if (index >= VFIO_PCI_ROM_REGION_INDEX)</div><div>                return -EINVAL;</div><div>"""</div><div><br></div><div>As VFIO_PCI_ROM_REGION_INDEX is defined as:</div><div><br></div><div>"""</div><div><div>enum { </div><div>        VFIO_PCI_BAR0_REGION_INDEX,</div><div>        VFIO_PCI_BAR1_REGION_INDEX,</div><div>        VFIO_PCI_BAR2_REGION_INDEX,</div><div>        VFIO_PCI_BAR3_REGION_INDEX,</div><div>        VFIO_PCI_BAR4_REGION_INDEX,</div><div>        VFIO_PCI_BAR5_REGION_INDEX,</div><div>        VFIO_PCI_ROM_REGION_INDEX,</div><div>        VFIO_PCI_CONFIG_REGION_INDEX,</div></div><div>...</div><div>"""</div><div><br></div><div>The if statment excludes the possibility to map the pci configuration region as any normal (BAR) region...</div><div><br></div><div>DId I miss something? How am I supposed to perform the configuration space mapping then?</div><div><br></div><div>Thanks in advance for your help.</div><div><br></div><div>Christophe</div><div><br></div></div>