Thread (39 messages) 39 messages, 5 authors, 2021-07-23

RE: [PATCH 3/6] vfio: remove the unused mdev iommu hook

From: "Tian, Kevin" <kevin.tian@intel.com>
Date: 2021-05-14 13:00:38
Also in: kvm, linux-iommu

From: Jason Gunthorpe <jgg@ziepe.ca>
Sent: Friday, May 14, 2021 8:19 PM

On Fri, May 14, 2021 at 06:54:16AM +0000, Tian, Kevin wrote:
quoted
quoted
From: Tian, Kevin
Sent: Friday, May 14, 2021 2:28 PM
quoted
From: Jason Gunthorpe <jgg@ziepe.ca>
Sent: Thursday, May 13, 2021 8:01 PM

On Thu, May 13, 2021 at 03:28:52AM +0000, Tian, Kevin wrote:
quoted
Are you specially concerned about this iommu_device hack which
directly connects mdev_device to iommu layer or the entire removed
logic including the aux domain concept? For the former we are now
following up the referred thread to find a clean way. But for the latter
we feel it's still necessary regardless of how iommu interface is
redesigned
quoted
quoted
to support device connection from the upper level driver. The reason
is
quoted
quoted
quoted
quoted
that with mdev or subdevice one physical device could be attached to
multiple domains now. there could be a primary domain with
DOMAIN_
quoted
quoted
quoted
quoted
DMA type for DMA_API use by parent driver itself, and multiple
auxiliary
quoted
quoted
quoted
quoted
domains with DOMAIN_UNMANAGED types for subdevices assigned
to
quoted
quoted
quoted
quoted
different VMs.
Why do we need more domains than just the physical domain for the
parent? How does auxdomain appear in /dev/ioasid?
Say the parent device has three WQs. WQ1 is used by parent driver itself,
while WQ2/WQ3 are assigned to VM1/VM2 respectively.

WQ1 is attached to domain1 for an IOVA space to support DMA API
operations in parent driver.
More specifically WQ1 uses a PASID that is represented by an IOASID to
userspace.
No. WQ1 is used by parent driver itself so it's not related to userspace. 
quoted
quoted
WQ2 is attached to domain2 for the GPA space of VM1. Domain2 is
created when WQ2 is assigned to VM1 as a mdev.

WQ3 is attached to domain3 for the GPA space of VM2. Domain3 is
created when WQ3 is assigned to VM2 as a mdev.

In this case domain1 is the primary while the other two are auxiliary
to the parent.

auxdomain represents as a normal domain in /dev/ioasid, with only
care required when doing attachment.

e.g. VM1 is assigned with both a pdev and mdev. Qemu creates
gpa_ioasid which is associated with a single domain for VM1's
GPA space and this domain is shared by both pdev and mdev.
Here pdev/mdev are just conceptual description. Following your
earlier suggestion /dev/ioasid will not refer to explicit mdev_device.
Instead, each vfio device attached to an ioasid is represented by either
"struct device" for pdev or "struct device + pasid" for mdev. The
presence of pasid decides which iommu_attach api should be used.
But you still haven't explained what an aux domain is to /dev/ioasid.
'aux' vs. 'primary' matters only in the iommu layer. For /dev/ioasid
it is just normal iommu domain. The only attention required is to tell
the iommu layer whether this domain should be treated as 'aux' or
'primary' when attaching the domain to a device (based on pdev vs.
mdev). After this point, the domain is managed through existing 
iommu ops (map, unmap, etc.) just like how it works today, applying 
to all pdevs/mdevs attached to this ioasid
Why do I need more public kernel objects to represent a PASID IOASID?
This avoids changing every iommu ops to include a PASID and forcing
the upper-layer drivers to do it differently between pdev and mdev.
Actually this was a main motivation when working out aux domain 
proposal with Joerg two years ago.
Are you creating a domain for every IOASID? Why?
Create a domain for every non-nesting ioasid. For nesting ioasid 
(e.g. ioasid1 on ioasid2), ioasid1 should inherit the domain from 
ioasid2.

The reason is that iommu domain represents an IOVA address
space shareable by multiple devices. It should be created at the 
point where the address space is managed. 

Thanks
Kevin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help