Skip to content

RFC iommu: Add support to change default domain of a group

Sai Praneeth Prakhya linux-iommu 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4iommu/vt-d: Modify device_def_domain_type() to use at runtimedrivers/iommu/intel-iommu.c+20 -92 replies
2/4iommu: Add device_def_domain_type() call back function to iommu_opsdrivers/iommu/intel-iommu.c include/linux/iommu.h+9 -30 replies
3/4iommu: Add support to change default domain of a groupdrivers/iommu/iommu.c+177 -10 replies
4/4iommu: Document usage of "/sys/kernel/iommu_groups/<grp_id>/type" fileDocumentation/ABI/testing/sysfs-kernel-iommu_groups+34 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/4] iommu: Add support to change default domain of a group

Presently, the default domain of a group is allocated during boot time and it cannot be changed later. So, the device would typically be either in identity/pass through mode or the device would be in DMA mode as long as the system is up and running. There is no way to change the default domain type dynamically i.e. after booting, a device cannot switch between identity mode and DMA mode.

Assume a use case where-in the priviliged user would want to use the device in pass-through mode when the device is used for host but would want to switch to dma protected mode when switching for VFIO in user space. Presently, this is not supported and hence add support to change default domain of a group dynamically.

Support this through a sysfs file, namely "/sys/kernel/iommu_groups/<grp_id>/type".

Testing:
--------
Tested by dynamically changing USB device from identity mode to dma and from dma to identity. Only for x86_64 (i.e. intel_iommu/vt-d). Haven't tested for other architectures.

Sai Praneeth Prakhya (4):
iommu/vt-d: Modify device_def_domain_type() to use at runtime
iommu: Add device_def_domain_type() call back function to iommu_ops
iommu: Add support to change default domain of a group
iommu: Document usage of "/sys/kernel/iommu_groups/<grp_id>/type" file

 .../ABI/testing/sysfs-kernel-iommu_groups     |  34 ++++
 drivers/iommu/intel-iommu.c                   |  32 +++-
 drivers/iommu/iommu.c                         | 178 +++++++++++++++++-
 include/linux/iommu.h                         |   3 +
 4 files changed, 237 insertions(+), 10 deletions(-)
Cc Christoph Hellwig <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Ashok Raj <[email protected]>
Cc Will Deacon <[email protected]>
Cc Lu Baolu <[email protected]>
Cc Sohil Mehta <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Jacob Pan <[email protected]>
Signature · 6 lines
2.19.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu