Skip to content

Commit d0e108b

Browse files
Zhen Leijoergroedel
authored andcommitted
iommu/vt-d: Add support for IOMMU default DMA mode build options
Make IOMMU_DEFAULT_LAZY default for when INTEL_IOMMU config is set, as is current behaviour. Also delete global flag intel_iommu_strict: - In intel_iommu_setup(), call iommu_set_dma_strict(true) directly. Also remove the print, as iommu_subsys_init() prints the mode and we have already marked this param as deprecated. - For cap_caching_mode() check in intel_iommu_setup(), call iommu_set_dma_strict(true) directly; also reword the accompanying print with a level downgrade and also add the missing '\n'. - For Ironlake GPU, again call iommu_set_dma_strict(true) directly and keep the accompanying print. [jpg: Remove intel_iommu_strict] Signed-off-by: Zhen Lei <[email protected]> Signed-off-by: John Garry <[email protected]> Reviewed-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 712d8f2 commit d0e108b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

drivers/iommu/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ choice
9494
prompt "IOMMU default DMA IOTLB invalidation mode"
9595
depends on IOMMU_DMA
9696

97+
default IOMMU_DEFAULT_LAZY if INTEL_IOMMU
9798
default IOMMU_DEFAULT_STRICT
9899
help
99100
This option allows an IOMMU DMA IOTLB invalidation mode to be

drivers/iommu/intel/iommu.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ int intel_iommu_enabled = 0;
361361
EXPORT_SYMBOL_GPL(intel_iommu_enabled);
362362

363363
static int dmar_map_gfx = 1;
364-
static int intel_iommu_strict;
365364
static int intel_iommu_superpage = 1;
366365
static int iommu_identity_mapping;
367366
static int iommu_skip_te_disable;
@@ -455,8 +454,7 @@ static int __init intel_iommu_setup(char *str)
455454
iommu_dma_forcedac = true;
456455
} else if (!strncmp(str, "strict", 6)) {
457456
pr_warn("intel_iommu=strict deprecated; use iommu.strict=1 instead\n");
458-
pr_info("Disable batched IOTLB flush\n");
459-
intel_iommu_strict = 1;
457+
iommu_set_dma_strict(true);
460458
} else if (!strncmp(str, "sp_off", 6)) {
461459
pr_info("Disable supported super page\n");
462460
intel_iommu_superpage = 0;
@@ -4394,9 +4392,9 @@ int __init intel_iommu_init(void)
43944392
* is likely to be much lower than the overhead of synchronizing
43954393
* the virtual and physical IOMMU page-tables.
43964394
*/
4397-
if (!intel_iommu_strict && cap_caching_mode(iommu->cap)) {
4398-
pr_warn("IOMMU batching is disabled due to virtualization");
4399-
intel_iommu_strict = 1;
4395+
if (cap_caching_mode(iommu->cap)) {
4396+
pr_info_once("IOMMU batching disallowed due to virtualization\n");
4397+
iommu_set_dma_strict(true);
44004398
}
44014399
iommu_device_sysfs_add(&iommu->iommu, NULL,
44024400
intel_iommu_groups,
@@ -4405,7 +4403,6 @@ int __init intel_iommu_init(void)
44054403
}
44064404
up_read(&dmar_global_lock);
44074405

4408-
iommu_set_dma_strict(intel_iommu_strict);
44094406
bus_set_iommu(&pci_bus_type, &intel_iommu_ops);
44104407
if (si_domain && !hw_pass_through)
44114408
register_memory_notifier(&intel_iommu_memory_nb);
@@ -5715,8 +5712,8 @@ static void quirk_calpella_no_shadow_gtt(struct pci_dev *dev)
57155712
} else if (dmar_map_gfx) {
57165713
/* we have to ensure the gfx device is idle before we flush */
57175714
pci_info(dev, "Disabling batched IOTLB flush on Ironlake\n");
5718-
intel_iommu_strict = 1;
5719-
}
5715+
iommu_set_dma_strict(true);
5716+
}
57205717
}
57215718
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0040, quirk_calpella_no_shadow_gtt);
57225719
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0044, quirk_calpella_no_shadow_gtt);

0 commit comments

Comments
 (0)