iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/8] Scrap iommu_attach/detach_group() interfaces
@ 2022-01-06  2:20 Lu Baolu
  2022-01-06  2:20 ` [PATCH v1 1/8] iommu: Add iommu_group_replace_domain() Lu Baolu
                   ` (7 more replies)
  0 siblings, 8 replies; 44+ messages in thread
From: Lu Baolu @ 2022-01-06  2:20 UTC (permalink / raw)
  To: Joerg Roedel, Alex Williamson, Robin Murphy, Jason Gunthorpe,
	Christoph Hellwig, Kevin Tian, Ashok Raj
  Cc: kvm, rafael, David Airlie, linux-pci, Thierry Reding,
	Diana Craciun, Dmitry Osipenko, Will Deacon, Stuart Yoder,
	Jonathan Hunter, Chaitanya Kulkarni, Bjorn Helgaas, Dan Williams,
	Greg Kroah-Hartman, Cornelia Huck, linux-kernel, Li Yang, iommu,
	Jacob jun Pan, Daniel Vetter

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

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2022-02-16 13:55 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06  2:20 [PATCH v1 0/8] Scrap iommu_attach/detach_group() interfaces Lu Baolu
2022-01-06  2:20 ` [PATCH v1 1/8] iommu: Add iommu_group_replace_domain() Lu Baolu
2022-01-06 17:06   ` Jason Gunthorpe via iommu
2022-01-07  0:26     ` Lu Baolu
2022-02-14 12:09   ` Robin Murphy
2022-02-14 12:45     ` Jason Gunthorpe via iommu
2022-02-14 14:10       ` Robin Murphy
2022-02-14 14:56         ` Jason Gunthorpe via iommu
2022-02-14 16:38           ` Robin Murphy
2022-02-14 17:25             ` Jason Gunthorpe via iommu
2022-01-06  2:20 ` [PATCH v1 2/8] vfio/type1: Use iommu_group_replace_domain() Lu Baolu
2022-01-06  2:20 ` [PATCH v1 3/8] iommu: Extend iommu_at[de]tach_device() for multi-device groups Lu Baolu
2022-01-06 17:22   ` Jason Gunthorpe via iommu
2022-01-07  1:14     ` Lu Baolu
2022-01-07  1:19       ` Jason Gunthorpe via iommu
2022-02-14 11:39   ` Joerg Roedel
2022-02-14 13:03     ` Jason Gunthorpe via iommu
2022-02-14 14:39       ` Joerg Roedel
2022-02-14 15:18         ` Robin Murphy
2022-02-14 15:46           ` Jason Gunthorpe via iommu
2022-02-15  8:58             ` Joerg Roedel
2022-02-15 13:47               ` Jason Gunthorpe via iommu
2022-02-16  6:28                 ` Lu Baolu
2022-02-16 13:54                   ` Jason Gunthorpe via iommu
2022-01-06  2:20 ` [PATCH v1 4/8] drm/tegra: Use iommu_attach/detatch_device() Lu Baolu
2022-01-06  2:20 ` [PATCH v1 5/8] iommu/amd: Use iommu_attach/detach_device() Lu Baolu
2022-01-06 14:33   ` Jason Gunthorpe via iommu
2022-01-07  0:23     ` Lu Baolu
2022-02-14 11:27     ` Joerg Roedel
2022-02-14 13:15       ` Jason Gunthorpe via iommu
2022-02-14 13:40         ` Joerg Roedel
2022-02-14 14:02           ` Jason Gunthorpe via iommu
2022-02-14 14:23             ` Joerg Roedel
2022-02-14 15:00               ` Jason Gunthorpe via iommu
2022-02-15  9:11                 ` Joerg Roedel
2022-02-15 13:02                   ` Robin Murphy
2022-02-15 14:37                   ` Jason Gunthorpe via iommu
2022-01-06  2:20 ` [PATCH v1 6/8] gpu/host1x: " Lu Baolu
2022-01-06 15:35   ` Jason Gunthorpe via iommu
2022-01-07  0:35     ` Lu Baolu
2022-01-07  0:48       ` Jason Gunthorpe via iommu
2022-01-07  1:19         ` Lu Baolu
2022-01-06  2:20 ` [PATCH v1 7/8] media: staging: media: tegra-vde: " Lu Baolu
2022-01-06  2:20 ` [PATCH v1 8/8] iommu: Remove iommu_attach/detach_group() Lu Baolu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).