On Tue, Dec 21, 2021 at 04:32:05AM +0000, Jag Raman wrote:
> > On Dec 20, 2021, at 9:36 AM, Stefan Hajnoczi <stefa...@redhat.com> wrote:
> > On Fri, Dec 17, 2021 at 08:00:35PM +0000, Jag Raman wrote:
> >>> On Dec 16, 2021, at 9:40 AM, Stefan Hajnoczi <stefa...@redhat.com> wrote:
> >>> On Wed, Dec 15, 2021 at 10:35:35AM -0500, Jagannathan Raman wrote:
> >>> Also, why is PCI Memory Space isolated via VFUIOMMU but PCI IO Space is
> >>> not?
> >> 
> >> If I understand correctly, the IO address space translates sysmem address 
> >> to
> >> direct device access (such as I2C). Once we are inside a device, we already
> >> have access to all parts of the device (unlike RAM which sits outside the 
> >> device).
> >> So didn’t think device would go via IOMMU to access IO. Also didn’t see any
> >> other IOMMU translating IO address space accesses.
> > 
> > I reviewed how BARs are configured with VFIO:
> > 
> > 1. When the guest writes to the vfio-pci PCIDevice's Configuration Space
> >   the write is forwarded to the VFIO device (i.e. vfio-user or VFIO
> >   kernel ioctl).
> > 
> > 2. The vfio-user server receives the Configuration Space write and
> >   forwards it to pci_dev (the PCIDevice we're serving up). BAR mappings
> >   are updated in the vfio-user server so the BAR MemoryRegions are
> >   mapped/unmapped at the locations given by the guest.
> > 
> > This applies for both Memory and IO Space accesses.
> > 
> > Because this patch series does not isolate IO Space between VfuObject
> > instances the MemoryRegions will collide when two guests map IO Space
> > BARs of different devices at the same IO Space address. In other words,
> > vfu_object_bar_rw() uses the global address_space_io and that means
> > collisions can occur.
> 
> I agree that collision could occur from the CPU end. But I'm not if IOMMU
> needs to translate IO space.

QEMU's IOMMUs do not translate IO Space addresses AFAIK.

IO Space just needs to be isolated between vfio-user server instances so
there is no collision when one client maps an IO Space BAR to the same
address as another client.

I think the cleanest way of achieving that is by creating a
per-vfio-user server PCI bus with an address_space_io MemoryRegion.

Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to