Message ID | 3-v2-fd55d00a60b2+c69-arm_no_split_jgg@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Remove split on unmap behavior | expand |
On Mon, Nov 04, 2024 at 01:41:31PM -0400, Jason Gunthorpe wrote: > Describe the most conservative version of the driver implementations. > All drivers should support this. > > Many drivers support extending the range if a large page is hit, but > let's not make that officially approved API. The main point is to > document explicitly that split is not supported. > > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> > --- > drivers/iommu/iommu.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 83c8e617a2c588..d3cf7cc69c797c 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -2586,6 +2586,20 @@ static size_t __iommu_unmap(struct iommu_domain *domain, > return unmapped; > } > > +/** > + * iommu_unmap() - Remove mappings from a range of IOVA > + * @domain: Domain to manipulate > + * @iova: IO virtual address to start > + * @len: Length of the range starting from @iova > + * > + * iommu_unmap() will remove a translation created by iommu_map(). It cannot > + * subdivide a mapping created by iommu_map(), so it should be called with IOVA > + * ranges that match what was passed to iommu_map(). The range can aggregate > + * contiguous iommu_map() calls so long as no individual range is split. > + * > + * Returns: Number of bytes of IOVA unmapped. iova + res will be the point > + * unmapping stopped. I guess 'res' is the return value here. Not my default name for the variable, worth replacing it with "return value" ? Regardless of the acceptance of this nit: Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Best regards, Liviu > + */ > size_t iommu_unmap(struct iommu_domain *domain, > unsigned long iova, size_t size) > { > -- > 2.43.0 >
Hi Jason, kernel test robot noticed the following build warnings: [auto build test WARNING on 8e929cb546ee42c9a61d24fae60605e9e3192354] url: https://github.com/intel-lab-lkp/linux/commits/Jason-Gunthorpe/iommu-io-pgtable-arm-Remove-split-on-unmap-behavior/20241105-014356 base: 8e929cb546ee42c9a61d24fae60605e9e3192354 patch link: https://lore.kernel.org/r/3-v2-fd55d00a60b2%2Bc69-arm_no_split_jgg%40nvidia.com patch subject: [PATCH v2 3/3] iommu: Add a kdoc to iommu_unmap() config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20241105/202411051125.mlgeWlEm-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241105/202411051125.mlgeWlEm-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202411051125.mlgeWlEm-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/iommu/iommu.c:2605: warning: Function parameter or struct member 'size' not described in 'iommu_unmap' >> drivers/iommu/iommu.c:2605: warning: Excess function parameter 'len' description in 'iommu_unmap' vim +2605 drivers/iommu/iommu.c add02cfdc9bc29 drivers/iommu/iommu.c Joerg Roedel 2017-08-23 2588 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2589 /** 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2590 * iommu_unmap() - Remove mappings from a range of IOVA 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2591 * @domain: Domain to manipulate 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2592 * @iova: IO virtual address to start 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2593 * @len: Length of the range starting from @iova 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2594 * 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2595 * iommu_unmap() will remove a translation created by iommu_map(). It cannot 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2596 * subdivide a mapping created by iommu_map(), so it should be called with IOVA 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2597 * ranges that match what was passed to iommu_map(). The range can aggregate 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2598 * contiguous iommu_map() calls so long as no individual range is split. 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2599 * 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2600 * Returns: Number of bytes of IOVA unmapped. iova + res will be the point 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2601 * unmapping stopped. 6aa7e03e9dd8b5 drivers/iommu/iommu.c Jason Gunthorpe 2024-11-04 2602 */ add02cfdc9bc29 drivers/iommu/iommu.c Joerg Roedel 2017-08-23 2603 size_t iommu_unmap(struct iommu_domain *domain, add02cfdc9bc29 drivers/iommu/iommu.c Joerg Roedel 2017-08-23 2604 unsigned long iova, size_t size) add02cfdc9bc29 drivers/iommu/iommu.c Joerg Roedel 2017-08-23 @2605 { a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2606 struct iommu_iotlb_gather iotlb_gather; a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2607 size_t ret; a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2608 a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2609 iommu_iotlb_gather_init(&iotlb_gather); a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2610 ret = __iommu_unmap(domain, iova, size, &iotlb_gather); aae4c8e27bd756 drivers/iommu/iommu.c Tom Murphy 2020-08-17 2611 iommu_iotlb_sync(domain, &iotlb_gather); a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2612 a7d20dc19d9ea7 drivers/iommu/iommu.c Will Deacon 2019-07-02 2613 return ret; add02cfdc9bc29 drivers/iommu/iommu.c Joerg Roedel 2017-08-23 2614 } cefc53c7f49424 drivers/base/iommu.c Joerg Roedel 2010-01-08 2615 EXPORT_SYMBOL_GPL(iommu_unmap); 1460432cb513f0 drivers/iommu/iommu.c Alex Williamson 2011-10-21 2616
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 83c8e617a2c588..d3cf7cc69c797c 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2586,6 +2586,20 @@ static size_t __iommu_unmap(struct iommu_domain *domain, return unmapped; } +/** + * iommu_unmap() - Remove mappings from a range of IOVA + * @domain: Domain to manipulate + * @iova: IO virtual address to start + * @len: Length of the range starting from @iova + * + * iommu_unmap() will remove a translation created by iommu_map(). It cannot + * subdivide a mapping created by iommu_map(), so it should be called with IOVA + * ranges that match what was passed to iommu_map(). The range can aggregate + * contiguous iommu_map() calls so long as no individual range is split. + * + * Returns: Number of bytes of IOVA unmapped. iova + res will be the point + * unmapping stopped. + */ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size) {
Describe the most conservative version of the driver implementations. All drivers should support this. Many drivers support extending the range if a large page is hit, but let's not make that officially approved API. The main point is to document explicitly that split is not supported. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- drivers/iommu/iommu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)