mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
iommu: Add "iommu.strict" command line option
Add a generic command line option to enable lazy unmapping via IOVA flush queues, which will initally be suuported by iommu-dma. This echoes the semantics of "intel_iommu=strict" (albeit with the opposite default value), but in the driver-agnostic fashion of "iommu.passthrough". Signed-off-by: Zhen Lei <[email protected]> [rm: move handling out of SMMUv3 driver, clean up documentation] Signed-off-by: Robin Murphy <[email protected]> [will: dropped broken printk when parsing command-line option] Signed-off-by: Will Deacon <[email protected]>
This commit is contained in:
parent
2da274cdf9
commit
68a6efe86f
2 changed files with 26 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
|
|||
#else
|
||||
static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA;
|
||||
#endif
|
||||
static bool iommu_dma_strict __read_mostly = true;
|
||||
|
||||
struct iommu_callback_data {
|
||||
const struct iommu_ops *ops;
|
||||
|
|
@ -131,6 +132,12 @@ static int __init iommu_set_def_domain_type(char *str)
|
|||
}
|
||||
early_param("iommu.passthrough", iommu_set_def_domain_type);
|
||||
|
||||
static int __init iommu_dma_setup(char *str)
|
||||
{
|
||||
return kstrtobool(str, &iommu_dma_strict);
|
||||
}
|
||||
early_param("iommu.strict", iommu_dma_setup);
|
||||
|
||||
static ssize_t iommu_group_attr_show(struct kobject *kobj,
|
||||
struct attribute *__attr, char *buf)
|
||||
{
|
||||
|
|
@ -1072,6 +1079,13 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
|
|||
group->default_domain = dom;
|
||||
if (!group->domain)
|
||||
group->domain = dom;
|
||||
|
||||
if (dom && !iommu_dma_strict) {
|
||||
int attr = 1;
|
||||
iommu_domain_set_attr(dom,
|
||||
DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE,
|
||||
&attr);
|
||||
}
|
||||
}
|
||||
|
||||
ret = iommu_group_add_device(group, dev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue