iommu/vt-d: Fix to convert mm pfn to dma pfn
authorYanfei Xu <yanfei.xu@intel.com>
Wed, 9 Aug 2023 12:48:05 +0000 (20:48 +0800)
committerJoerg Roedel <jroedel@suse.de>
Wed, 9 Aug 2023 15:46:19 +0000 (17:46 +0200)
commitfb5f50a43d9fd44fd6bc4f4dbcf9d3ec5b556558
treedea317c16a9306b582642e60cc018a1f8228834d
parent8a3b8e63f8371c1247b7aa24ff9c5312f1a6948b
iommu/vt-d: Fix to convert mm pfn to dma pfn

For the case that VT-d page is smaller than mm page, converting dma pfn
should be handled in two cases which are for start pfn and for end pfn.
Currently the calculation of end dma pfn is incorrect and the result is
less than real page frame number which is causing the mapping of iova
always misses some page frames.

Rename the mm_to_dma_pfn() to mm_to_dma_pfn_start() and add a new helper
for converting end dma pfn named mm_to_dma_pfn_end().

Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
Link: https://lore.kernel.org/r/20230625082046.979742-1-yanfei.xu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c