Skip to content

Commit 26225be

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu: Expose DMA domain strictness via sysfs
The sysfs interface for default domain types exists primarily so users can choose the performance/security tradeoff relevant to their own workload. As such, the choice between the policies for DMA domains fits perfectly as an additional point on that scale - downgrading a particular device from a strict default to non-strict may be enough to let it reach the desired level of performance, while still retaining more peace of mind than with a wide-open identity domain. Now that we've abstracted non-strict mode as a distinct type of DMA domain, allow it to be chosen through the user interface as well. Reviewed-by: Lu Baolu <[email protected]> Reviewed-by: John Garry <[email protected]> Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/0e08da5ed4069fd3473cfbadda758ca983becdbf.1628682049.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent c208916 commit 26225be

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Documentation/ABI/testing/sysfs-kernel-iommu_groups

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ Description: /sys/kernel/iommu_groups/<grp_id>/type shows the type of default
4242
======== ======================================================
4343
DMA All the DMA transactions from the device in this group
4444
are translated by the iommu.
45+
DMA-FQ As above, but using batched invalidation to lazily
46+
remove translations after use. This may offer reduced
47+
overhead at the cost of reduced memory protection.
4548
identity All the DMA transactions from the device in this group
46-
are not translated by the iommu.
49+
are not translated by the iommu. Maximum performance
50+
but zero protection.
4751
auto Change to the type the device was booted with.
4852
======== ======================================================
4953

drivers/iommu/iommu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,6 +3268,8 @@ static ssize_t iommu_group_store_type(struct iommu_group *group,
32683268
req_type = IOMMU_DOMAIN_IDENTITY;
32693269
else if (sysfs_streq(buf, "DMA"))
32703270
req_type = IOMMU_DOMAIN_DMA;
3271+
else if (sysfs_streq(buf, "DMA-FQ"))
3272+
req_type = IOMMU_DOMAIN_DMA_FQ;
32713273
else if (sysfs_streq(buf, "auto"))
32723274
req_type = 0;
32733275
else

0 commit comments

Comments
 (0)