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

Alex Williamson alex.williamson at redhat.com
Fri Oct 30 16:41:09 UTC 2015


On Fri, 2015-10-30 at 17:28 +0100, Christophe Milard wrote:
> Thanks for your quick answer, Alex.
> I did not miss  vfio_region_info.flags: I am actually using its contents to
> get the different regions offset.
> I was not sure the mmap flag would apply to the configuration region
> though, as the documentation comment suggested (at least as I understood
> it), it would be mappable.
> But it looks from the code I quoted that the configuration region will
> never be mappable... right?
> In which case the documentation comments is somehow missleading, I feel.

Well, the header file that you're quoting the region indexes for PCI
does also include:

struct vfio_region_info {
        __u32   argsz;
        __u32   flags;
#define VFIO_REGION_INFO_FLAG_READ      (1 << 0) /* Region supports read */
#define VFIO_REGION_INFO_FLAG_WRITE     (1 << 1) /* Region supports write */
#define VFIO_REGION_INFO_FLAG_MMAP      (1 << 2) /* Region supports mmap */
        ...

So it's clear, at least to me, that different region indexes support
different access mechanism.  x86 for example cannot support mmap of I/O
port BARs, but other architectures could theoretically allow it.  The
size of an MMIO BAR vs the system page size can change whether those
regions support mmap.  The ROM BAR does not support the write flag.  PCI
config space does not support mmap because of the virtualization we do
within that region.

If the documentation can be improved, please post a patch.  Thanks,

Alex




More information about the vfio-users mailing list