
From: Xiang Chen <chenxiang66@hisilicon.com> Add a debugfs file drop_rcache to drop rcache manually. Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com> --- drivers/iommu/iommu-debugfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iommu/iommu-debugfs.c b/drivers/iommu/iommu-debugfs.c index 1904fe9..4e479f9 100644 --- a/drivers/iommu/iommu-debugfs.c +++ b/drivers/iommu/iommu-debugfs.c @@ -124,9 +124,21 @@ static int debugfs_iova_rcache_show(struct seq_file *s, void *p) } DEFINE_SHOW_ATTRIBUTE(debugfs_iova_rcache); +static int debugfs_drop_rcache_set(void *data, u64 value) +{ + struct iommu_domain *domain = data; + struct iova_domain *iovad = iommu_domain_to_iova(domain); + + free_rcache_cached_iovas(iovad); + return 0; +} +DEFINE_DEBUGFS_ATTRIBUTE(debugfs_drop_rcache_fops, NULL, debugfs_drop_rcache_set, "%llu\n"); + void debugfs_create_iova_file(struct iommu_domain *domain) { debugfs_create_file("iova_rcache", 0400, domain->domain_dir, domain, &debugfs_iova_rcache_fops); + debugfs_create_file("drop_rcache", 0200, domain->domain_dir, + domain, &debugfs_drop_rcache_fops); } -- 2.8.1