[PATCH v3 08/23] iommu/vtd: Use virt_to_phys()
Baolu Lu
baolu.lu at linux.intel.com
Sun Mar 9 19:21:03 PDT 2025
On 2/26/25 03:39, Jason Gunthorpe wrote:
> If all the inlines are unwound virt_to_dma_pfn() is simply:
> return page_to_pfn(virt_to_page(p)) << (PAGE_SHIFT - VTD_PAGE_SHIFT);
>
> Which can be re-arranged to:
> (page_to_pfn(virt_to_page(p)) << PAGE_SHIFT) >> VTD_PAGE_SHIFT
>
> The only caller is:
> ((uint64_t)virt_to_dma_pfn(tmp_page) << VTD_PAGE_SHIFT)
>
> re-arranged to:
> ((page_to_pfn(virt_to_page(tmp_page)) << PAGE_SHIFT) >> VTD_PAGE_SHIFT) << VTD_PAGE_SHIFT
>
> Which simplifies to:
> page_to_pfn(virt_to_page(tmp_page)) << PAGE_SHIFT
>
> That is the same as virt_to_phys(tmp_page), so just remove all of this.
>
> Reviewed-by: Lu Baolu<baolu.lu at linux.intel.com>
> Signed-off-by: Jason Gunthorpe<jgg at nvidia.com>
> ---
> drivers/iommu/intel/iommu.c | 3 ++-
> drivers/iommu/intel/iommu.h | 19 -------------------
> 2 files changed, 2 insertions(+), 20 deletions(-)
Queued this cleanup patch for iommu/vt-d.
Thanks,
baolu
More information about the linux-arm-kernel
mailing list