mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 15:11:00 +07:00
iommu: Use %pa and %zx instead of casting
printk supports using %pa for phys_addr_t and %zx for size_t so use those instead of %lx and casts to unsigned long. Other miscellaneous changes around this: Always use 0x%zx for size instead of one use of decimal. Coalesce format and align arguments. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
This commit is contained in:
parent
c6a8af50b8
commit
6197ca8272
@ -807,20 +807,18 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
|
|||||||
* size of the smallest page supported by the hardware
|
* size of the smallest page supported by the hardware
|
||||||
*/
|
*/
|
||||||
if (!IS_ALIGNED(iova | paddr | size, min_pagesz)) {
|
if (!IS_ALIGNED(iova | paddr | size, min_pagesz)) {
|
||||||
pr_err("unaligned: iova 0x%lx pa 0x%lx size 0x%lx min_pagesz "
|
pr_err("unaligned: iova 0x%lx pa 0x%pa size 0x%zx min_pagesz 0x%x\n",
|
||||||
"0x%x\n", iova, (unsigned long)paddr,
|
iova, &paddr, size, min_pagesz);
|
||||||
(unsigned long)size, min_pagesz);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("map: iova 0x%lx pa 0x%lx size 0x%lx\n", iova,
|
pr_debug("map: iova 0x%lx pa 0x%pa size 0x%zx\n", iova, &paddr, size);
|
||||||
(unsigned long)paddr, (unsigned long)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 0x%lx pgsize %lu\n", iova,
|
pr_debug("mapping: iova 0x%lx pa 0x%pa pgsize 0x%zx\n",
|
||||||
(unsigned long)paddr, (unsigned long)pgsize);
|
iova, &paddr, pgsize);
|
||||||
|
|
||||||
ret = domain->ops->map(domain, iova, paddr, pgsize, prot);
|
ret = domain->ops->map(domain, iova, paddr, pgsize, prot);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -857,13 +855,12 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
|
|||||||
* by the hardware
|
* by the hardware
|
||||||
*/
|
*/
|
||||||
if (!IS_ALIGNED(iova | size, min_pagesz)) {
|
if (!IS_ALIGNED(iova | size, min_pagesz)) {
|
||||||
pr_err("unaligned: iova 0x%lx size 0x%lx min_pagesz 0x%x\n",
|
pr_err("unaligned: iova 0x%lx size 0x%zx min_pagesz 0x%x\n",
|
||||||
iova, (unsigned long)size, min_pagesz);
|
iova, size, min_pagesz);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("unmap this: iova 0x%lx size 0x%lx\n", iova,
|
pr_debug("unmap this: iova 0x%lx size 0x%zx\n", iova, size);
|
||||||
(unsigned long)size);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep iterating until we either unmap 'size' bytes (or more)
|
* Keep iterating until we either unmap 'size' bytes (or more)
|
||||||
@ -876,8 +873,8 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
|
|||||||
if (!unmapped_page)
|
if (!unmapped_page)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pr_debug("unmapped: iova 0x%lx size %lx\n", iova,
|
pr_debug("unmapped: iova 0x%lx size 0x%zx\n",
|
||||||
(unsigned long)unmapped_page);
|
iova, unmapped_page);
|
||||||
|
|
||||||
iova += unmapped_page;
|
iova += unmapped_page;
|
||||||
unmapped += unmapped_page;
|
unmapped += unmapped_page;
|
||||||
|
Loading…
Reference in New Issue
Block a user