Skip to content

Commit 02252b3

Browse files
Zhen Leijoergroedel
authored andcommitted
iommu/amd: Add support for IOMMU default DMA mode build options
Make IOMMU_DEFAULT_LAZY default for when AMD_IOMMU config is set, which matches current behaviour. For "fullflush" param, just call iommu_set_dma_strict(true) directly. Since we get a strict vs lazy mode print already in iommu_subsys_init(), and maintain a deprecation print when "fullflush" param is passed, drop the prints in amd_iommu_init_dma_ops(). Finally drop global flag amd_iommu_unmap_flush, as it has no longer has any purpose. [jpg: Rebase for relocated file and drop amd_iommu_unmap_flush] Signed-off-by: Zhen Lei <[email protected]> Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent d0e108b commit 02252b3

File tree

4 files changed

+2
-15
lines changed

4 files changed

+2
-15
lines changed

drivers/iommu/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +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
97+
default IOMMU_DEFAULT_LAZY if (AMD_IOMMU || INTEL_IOMMU)
9898
default IOMMU_DEFAULT_STRICT
9999
help
100100
This option allows an IOMMU DMA IOTLB invalidation mode to be

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,6 @@ extern u16 amd_iommu_last_bdf;
779779
/* allocation bitmap for domain ids */
780780
extern unsigned long *amd_iommu_pd_alloc_bitmap;
781781

782-
/*
783-
* If true, the addresses will be flushed on unmap time, not when
784-
* they are reused
785-
*/
786-
extern bool amd_iommu_unmap_flush;
787-
788782
/* Smallest max PASID supported by any IOMMU in the system */
789783
extern u32 amd_iommu_max_pasid;
790784

drivers/iommu/amd/init.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have
161161
to handle */
162162
LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings
163163
we find in ACPI */
164-
bool amd_iommu_unmap_flush; /* if true, flush on every unmap */
165164

166165
LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
167166
system */
@@ -3100,7 +3099,7 @@ static int __init parse_amd_iommu_options(char *str)
31003099
for (; *str; ++str) {
31013100
if (strncmp(str, "fullflush", 9) == 0) {
31023101
pr_warn("amd_iommu=fullflush deprecated; use iommu.strict=1 instead\n");
3103-
amd_iommu_unmap_flush = true;
3102+
iommu_set_dma_strict(true);
31043103
}
31053104
if (strncmp(str, "force_enable", 12) == 0)
31063105
amd_iommu_force_enable = true;

drivers/iommu/amd/iommu.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,12 +1775,6 @@ void amd_iommu_domain_update(struct protection_domain *domain)
17751775
static void __init amd_iommu_init_dma_ops(void)
17761776
{
17771777
swiotlb = (iommu_default_passthrough() || sme_me_mask) ? 1 : 0;
1778-
1779-
if (amd_iommu_unmap_flush)
1780-
pr_info("IO/TLB flush on unmap enabled\n");
1781-
else
1782-
pr_info("Lazy IO/TLB flushing enabled\n");
1783-
iommu_set_dma_strict(amd_iommu_unmap_flush);
17841778
}
17851779

17861780
int __init amd_iommu_init_api(void)

0 commit comments

Comments
 (0)