The default domain type of an iommu group can be changed using file
"/sys/kernel/iommu_groups/<grp_id>/type". Hence, document it's usage and
more importantly spell out it's limitations and an example.

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]>
Signed-off-by: Sai Praneeth Prakhya <[email protected]>
---
 .../ABI/testing/sysfs-kernel-iommu_groups     | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-kernel-iommu_groups 
b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
index 017f5bc3920c..0a70b3a66ff3 100644
--- a/Documentation/ABI/testing/sysfs-kernel-iommu_groups
+++ b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
@@ -33,3 +33,38 @@ Description:    In case an RMRR is used only by graphics or 
USB devices
                it is now exposed as "direct-relaxable" instead of "direct".
                In device assignment use case, for instance, those RMRR
                are considered to be relaxable and safe.
+
+What:          /sys/kernel/iommu_groups/<grp_id>/type
+Date:          August 2019
+KernelVersion: v5.4
+Contact:       Sai Praneeth Prakhya <[email protected]>
+Description:   /sys/kernel/iommu_groups/<grp_id>/type lets the user know the
+               type of default domain in use by iommu for this group. A
+               privileged user could request kernel to change the group type by
+               writing to this file. Presently, only three types are supported
+               1. dma: All the DMA transactions from the devices in this group
+                       are translated by the iommu.
+               2. identity: All the DMA transactions from the devices in this
+                            group are *not* translated by the iommu.
+               3. auto: Kernel decides one among dma/identity
+               Note:
+               -----
+               A group type could be modified only when *all* the devices in
+               the group are not binded to any device driver. So, the user has
+               to first unbind the appropriate drivers and then change the
+               default domain type.
+               Caution:
+               --------
+               Unbinding a device driver will take away the drivers control
+               over the device and if done on devices that host root file
+               system could lead to catastrophic effects (the user might
+               need to reboot the machine to get it to normal state). So, it's
+               expected that the user understands what he is doing.
+               Example:
+               --------
+               # Unbind USB device driver
+               1. echo "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/unbind
+               # Put the USB device in identity mode (a.k.a pass through)
+               2. echo "identity" > /sys/kernel/iommu_groups/<grp_id>/type
+               # Re-bind the driver
+               3. echo "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/bind
-- 
2.19.1

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

Reply via email to