Skip to content

Commit 162b424

Browse files
committed
Merge tag 'iommu-fixes-v6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
Pull iommu fixes from Joerg Roedel: - Fix a performance regression cause by the new Generic IO-Page-Table code detected in Intel VT-d driver - Command queue flushing fix for NVidia version of the ARM-SMMU-v3 * tag 'iommu-fixes-v6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux: iommu/tegra241-cmdqv: Reset VCMDQ in tegra241_vcmdq_hw_init_user() iommupt: Only cache flush memory changed by unmap
2 parents d097a07 + 80f1a2c commit 162b424

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,9 @@ static int tegra241_vcmdq_hw_init_user(struct tegra241_vcmdq *vcmdq)
10781078
{
10791079
char header[64];
10801080

1081+
/* Reset VCMDQ */
1082+
tegra241_vcmdq_hw_deinit(vcmdq);
1083+
10811084
/* Configure the vcmdq only; User space does the enabling */
10821085
writeq_relaxed(vcmdq->cmdq.q.q_base, REG_VCMDQ_PAGE1(vcmdq, BASE));
10831086

drivers/iommu/generic_pt/iommu_pt.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,8 @@ static __maybe_unused int __unmap_range(struct pt_range *range, void *arg,
931931
struct pt_table_p *table)
932932
{
933933
struct pt_state pts = pt_init(range, level, table);
934+
unsigned int flush_start_index = UINT_MAX;
935+
unsigned int flush_end_index = UINT_MAX;
934936
struct pt_unmap_args *unmap = arg;
935937
unsigned int num_oas = 0;
936938
unsigned int start_index;
@@ -986,6 +988,9 @@ static __maybe_unused int __unmap_range(struct pt_range *range, void *arg,
986988
iommu_pages_list_add(&unmap->free_list,
987989
pts.table_lower);
988990
pt_clear_entries(&pts, ilog2(1));
991+
if (pts.index < flush_start_index)
992+
flush_start_index = pts.index;
993+
flush_end_index = pts.index + 1;
989994
}
990995
pts.index++;
991996
} else {
@@ -999,15 +1004,19 @@ static __maybe_unused int __unmap_range(struct pt_range *range, void *arg,
9991004
num_contig_lg2 = pt_entry_num_contig_lg2(&pts);
10001005
pt_clear_entries(&pts, num_contig_lg2);
10011006
num_oas += log2_to_int(num_contig_lg2);
1007+
if (pts.index < flush_start_index)
1008+
flush_start_index = pts.index;
10021009
pts.index += log2_to_int(num_contig_lg2);
1010+
flush_end_index = pts.index;
10031011
}
10041012
if (pts.index >= pts.end_index)
10051013
break;
10061014
pts.type = pt_load_entry_raw(&pts);
10071015
} while (true);
10081016

10091017
unmap->unmapped += log2_mul(num_oas, pt_table_item_lg2sz(&pts));
1010-
flush_writes_range(&pts, start_index, pts.index);
1018+
if (flush_start_index != flush_end_index)
1019+
flush_writes_range(&pts, flush_start_index, flush_end_index);
10111020

10121021
return ret;
10131022
}

0 commit comments

Comments
 (0)