[RFC PATCH v4 06/15] iommu: Split 'addr_merge' argument to iommu_pgsize() into separate parts
Will Deacon
will at kernel.org
Thu Apr 8 14:59:02 BST 2021
On Wed, Apr 07, 2021 at 09:52:32PM -0700, Isaac J. Manjarres wrote:
> From: Will Deacon <will at kernel.org>
>
> The 'addr_merge' parameter to iommu_pgsize() is a fabricated address
> intended to describe the alignment requirements to consider when
> choosing an appropriate page size. On the iommu_map() path, this address
> is the logical OR of the virtual and physical addresses.
>
> Subsequent improvements to iommu_pgsize() will need to check the
> alignment of the virtual and physical components of 'addr_merge'
> independently, so pass them in as separate parameters and reconstruct
> 'addr_merge' locally.
>
> No functional change.
>
> Signed-off-by: Will Deacon <will at kernel.org>
> Signed-off-by: Isaac J. Manjarres <isaacm at codeaurora.org>
> ---
> drivers/iommu/iommu.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index bcd623862bf9..ab689611a03b 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2357,12 +2357,13 @@ phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
> }
> EXPORT_SYMBOL_GPL(iommu_iova_to_phys);
>
> -static size_t iommu_pgsize(struct iommu_domain *domain,
> - unsigned long addr_merge, size_t size)
> +static size_t iommu_pgsize(struct iommu_domain *domain, unsigned long iova,
> + phys_addr_t paddr, size_t size)
> {
> unsigned int pgsize_idx;
> unsigned long pgsizes;
> size_t pgsize;
> + phys_addr_t addr_merge = paddr | iova;
^^^ this needs to be 'unsigned long' as it was before (otherwise using
GENMASK _is_ a problem).
Will
More information about the linux-arm-kernel
mailing list