lkml.org 
[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 0/5] iommu aux-domain APIs extensions
From
Date
Hi Joerg,

On 9/24/20 5:55 PM, Joerg Roedel wrote:
> On Tue, Sep 22, 2020 at 02:10:37PM +0800, Lu Baolu wrote:
>> Hi Jorge and Alex,
>>
>> A description of this patch series could be found here.
>>
>> https://lore.kernel.org/linux-iommu/20200901033422.22249-1-baolu.lu@linux.intel.com/
>
> Hmm, I am wondering if we can avoid all this hassle and special APIs by
> making the mdev framework more visible outside of the vfio code. There
> is an underlying bus implementation for mdevs, so is there a reason
> those can't use the standard iommu-core code to setup IOMMU mappings?

The original purpose of this series is to enable the device driver to
retrieve the aux-domain through iommu core after iommu
ops.aux_attach_dev().

The domain was allocated in vfio/mdev, but it's also needed by the
device driver in mediated callbacks. The idea of this patch series is to
extend the aux-API so that the domain could be saved in group->domain
and get by the mediated driver through the existing
iommu_get_domain_for_dev().

Back when we were developing the aux-domain, I proposed to keep the
domain in vfio/mdev.

https://lore.kernel.org/linux-iommu/20181105073408.21815-7-baolu.lu@linux.intel.com/

It wasn't discussed at that time due to the lack of real consumer. Intel
is now adding aux-domain support in idxd (DMA streaming accelerator)
driver which becomes the first real consumer. So this problem is brought
back to the table.

>
> What speaks against doing:
>
> - IOMMU drivers capable of handling mdevs register iommu-ops
> for the mdev_bus.
>
> - iommu_domain_alloc() takes bus_type as parameter, so there can
> be special domains be allocated for mdevs.
>
> - Group creation and domain allocation will happen
> automatically in the iommu-core when a new mdev is registered
> through device-driver core code.
>
> - There should be no need for special iommu_aux_* APIs, as one
> can attach a domain directly to &mdev->dev with
> iommu_attach_device(domain, &mdev->dev).
>
> Doing it this way will probably also keep the mdev-special code in VFIO
> small.

Fully understand now. Thanks for guide.

>
> Regards,
>
> Joerg
>

Best regards,
baolu

\
 
 \ /
  Last update: 2020-09-25 03:17    [W:0.086 / U:0.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site