lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 1 May 2021 23:59:59 -0700 From: Nadav Amit <nadav.amit@...il.com> To: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org> Cc: Nadav Amit <namit@...are.com>, Jiajun Cao <caojiajun@...are.com>, iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org Subject: [PATCH 3/4] iommu/amd: Do not sync on page size changes From: Nadav Amit <namit@...are.com> Some IOMMU architectures perform invalidations regardless of the page size. In such architectures there is no need to sync when the page size changes or to regard pgsize when making interim flush in iommu_iotlb_gather_add_page(). Add a "ignore_gather_pgsize" property for each IOMMU-ops to decide whether gather's pgsize is tracked and triggers a flush. Cc: Joerg Roedel <joro@...tes.org> Cc: Will Deacon <will@...nel.org> Cc: Jiajun Cao <caojiajun@...are.com> Cc: iommu@...ts.linux-foundation.org Cc: linux-kernel@...r.kernel.org Signed-off-by: Nadav Amit <namit@...are.com> --- drivers/iommu/amd/iommu.c | 1 + include/linux/iommu.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index b8cabbbeed71..1849b53f2149 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2215,6 +2215,7 @@ const struct iommu_ops amd_iommu_ops = { .put_resv_regions = generic_iommu_put_resv_regions, .is_attach_deferred = amd_iommu_is_attach_deferred, .pgsize_bitmap = AMD_IOMMU_PGSIZES, + .ignore_gather_pgsize = true, .flush_iotlb_all = amd_iommu_flush_iotlb_all, .iotlb_sync = amd_iommu_iotlb_sync, .def_domain_type = amd_iommu_def_domain_type, diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 32d448050bf7..1fb2695418e9 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -284,6 +284,7 @@ struct iommu_ops { int (*def_domain_type)(struct device *dev); unsigned long pgsize_bitmap; + bool ignore_gather_pgsize; struct module *owner; }; @@ -508,7 +509,7 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain, * a different granularity, then sync the TLB so that the gather * structure can be rewritten. */ - if (gather->pgsize != size || + if ((gather->pgsize != size && !domain->ops->ignore_gather_pgsize) || end + 1 < gather->start || start > gather->end + 1) { if (gather->pgsize) iommu_iotlb_sync(domain, gather); -- 2.25.1
Powered by blists - more mailing lists