mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-13 22:14:20 +08:00
iommu: Split 'addr_merge' argument to iommu_pgsize() into separate parts
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@kernel.org> Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org> Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/1623850736-389584-7-git-send-email-quic_c_gdjako@quicinc.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
e7d6fff6b3
commit
89d5b9601f
@ -2375,12 +2375,13 @@ phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(iommu_iova_to_phys);
|
EXPORT_SYMBOL_GPL(iommu_iova_to_phys);
|
||||||
|
|
||||||
static size_t iommu_pgsize(struct iommu_domain *domain,
|
static size_t iommu_pgsize(struct iommu_domain *domain, unsigned long iova,
|
||||||
unsigned long addr_merge, size_t size)
|
phys_addr_t paddr, size_t size)
|
||||||
{
|
{
|
||||||
unsigned int pgsize_idx;
|
unsigned int pgsize_idx;
|
||||||
unsigned long pgsizes;
|
unsigned long pgsizes;
|
||||||
size_t pgsize;
|
size_t pgsize;
|
||||||
|
unsigned long addr_merge = paddr | iova;
|
||||||
|
|
||||||
/* Page sizes supported by the hardware and small enough for @size */
|
/* Page sizes supported by the hardware and small enough for @size */
|
||||||
pgsizes = domain->pgsize_bitmap & GENMASK(__fls(size), 0);
|
pgsizes = domain->pgsize_bitmap & GENMASK(__fls(size), 0);
|
||||||
@ -2433,7 +2434,7 @@ static int __iommu_map(struct iommu_domain *domain, unsigned long iova,
|
|||||||
pr_debug("map: iova 0x%lx pa %pa size 0x%zx\n", iova, &paddr, size);
|
pr_debug("map: iova 0x%lx pa %pa size 0x%zx\n", iova, &paddr, size);
|
||||||
|
|
||||||
while (size) {
|
while (size) {
|
||||||
size_t pgsize = iommu_pgsize(domain, iova | paddr, size);
|
size_t pgsize = iommu_pgsize(domain, iova, paddr, size);
|
||||||
|
|
||||||
pr_debug("mapping: iova 0x%lx pa %pa pgsize 0x%zx\n",
|
pr_debug("mapping: iova 0x%lx pa %pa pgsize 0x%zx\n",
|
||||||
iova, &paddr, pgsize);
|
iova, &paddr, pgsize);
|
||||||
@ -2521,8 +2522,9 @@ static size_t __iommu_unmap(struct iommu_domain *domain,
|
|||||||
* or we hit an area that isn't mapped.
|
* or we hit an area that isn't mapped.
|
||||||
*/
|
*/
|
||||||
while (unmapped < size) {
|
while (unmapped < size) {
|
||||||
size_t pgsize = iommu_pgsize(domain, iova, size - unmapped);
|
size_t pgsize;
|
||||||
|
|
||||||
|
pgsize = iommu_pgsize(domain, iova, iova, size - unmapped);
|
||||||
unmapped_page = ops->unmap(domain, iova, pgsize, iotlb_gather);
|
unmapped_page = ops->unmap(domain, iova, pgsize, iotlb_gather);
|
||||||
if (!unmapped_page)
|
if (!unmapped_page)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user