lkml.org 
[lkml]   [2022]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH v1 0/8] Scrap iommu_attach/detach_group() interfaces
Date
Hi folks,

The iommu_attach_device() added first by commit <fc2100eb4d096> ("add
frontend implementation for the IOMMU API") in 2008. At that time,
there was no concept of iommu group yet.

The iommu group was added by commit <d72e31c937462> ("iommu: IOMMU
Groups") four years later in 2012. The iommu_attach_group() was added
at the same time.

Then, people realized that iommu_attach_device() allowed different
device in a same group to attach different domain. This was not in
line with the concept of iommu group. The commit <426a273834eae>
("iommu: Limit iommu_attach/detach_device to device with their own
group") fixed this problem in 2015.

As the result, we have two coexisting interfaces for device drivers
to do the same thing. But neither is perfect:

- iommu_attach_device() only works for singleton group.
- iommu_attach_group() asks the device drivers to handle iommu group
related staff which is beyond the role of a device driver.

Considering from the perspective of a device driver, its motivation is
very simple: "I want to manage my own I/O address space." Inspired by
the discussion [1], we consider heading in this direction:

Make the iommu_attach_device() the only and generic interface for the
device drivers to use their own private domain (I/O address space)
and replace all iommu_attach_group() uses with iommu_attach_device()
and deprecate the former.

This is a follow-up series of this discussion:
[1] https://lore.kernel.org/linux-iommu/b4405a5e-c4cc-f44a-ab43-8cb62b888565@linux.intel.com/

It depends on the series of "Fix BUG_ON in vfio_iommu_group_notifier()".
The latest version was posted here:
https://lore.kernel.org/linux-iommu/20220104015644.2294354-1-baolu.lu@linux.intel.com/

and the whole patches are available on github:
https://github.com/LuBaolu/intel-iommu/commits/iommu-domain-attach-refactor-v1

Best regards,
baolu

Jason Gunthorpe (1):
drm/tegra: Use iommu_attach/detatch_device()

Lu Baolu (7):
iommu: Add iommu_group_replace_domain()
vfio/type1: Use iommu_group_replace_domain()
iommu: Extend iommu_at[de]tach_device() for multi-device groups
iommu/amd: Use iommu_attach/detach_device()
gpu/host1x: Use iommu_attach/detach_device()
media: staging: media: tegra-vde: Use iommu_attach/detach_device()
iommu: Remove iommu_attach/detach_group()

include/linux/iommu.h | 25 ++---
drivers/gpu/drm/tegra/dc.c | 1 +
drivers/gpu/drm/tegra/drm.c | 47 +++-----
drivers/gpu/drm/tegra/gr2d.c | 1 +
drivers/gpu/drm/tegra/gr3d.c | 1 +
drivers/gpu/drm/tegra/vic.c | 1 +
drivers/gpu/host1x/dev.c | 4 +-
drivers/iommu/amd/iommu_v2.c | 4 +-
drivers/iommu/iommu.c | 136 +++++++++++++++++-------
drivers/staging/media/tegra-vde/iommu.c | 6 +-
drivers/vfio/vfio_iommu_type1.c | 22 ++--
11 files changed, 146 insertions(+), 102 deletions(-)

--
2.25.1

\
 
 \ /
  Last update: 2022-01-06 03:22    [W:0.539 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site