[PATCH v6 02/13] drm/amdkfd: Use migrate pfns internally

David Hildenbrand (Arm) david at kernel.org
Wed Mar 4 03:40:55 AEDT 2026


On 2/2/26 12:36, Jordan Niethe wrote:
> A future change will remove device private pages from the physical
> address space. This will mean that device private pages no longer have a
> pfn.
> 
> A MIGRATE_PFN flag will be introduced that distinguishes between mpfns
> that contain a pfn vs an offset into device private memory.
> 
> Replace usages of pfns and page_to_pfn() with mpfns and
> migrate_pfn_to_page() to prepare for handling this distinction. This
> will assist in continuing to use the same code paths for both
> MEMORY_DEVICE_PRIVATE and MEMORY_DEVICE_COHERENT devices.
> 
> Acked-by: Balbir Singh <balbirs at nvidia.com>
> Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>
> Signed-off-by: Jordan Niethe <jniethe at nvidia.com>
> ---
> v2:
>   - New to series
> v3:
>   - No change
> v4:
>   - No change
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 15 +++++++--------
>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.h |  2 +-
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 297fa108ccf9..b6075a2808c2 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -210,17 +210,17 @@ svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence)
>  }
>  
>  unsigned long
> -svm_migrate_addr_to_pfn(struct amdgpu_device *adev, unsigned long addr)
> +svm_migrate_addr_to_mpfn(struct amdgpu_device *adev, unsigned long addr)
>  {
> -	return (addr + adev->kfd.pgmap.range.start) >> PAGE_SHIFT;
> +	return migrate_pfn((addr + adev->kfd.pgmap.range.start) >> PAGE_SHIFT);
>  }

To make it clearer that the result is a "migrate pfn" I'd call this.

svm_addr_to_migrate_pfn()

Not sure if maintainers have any other preference.

Apart from that LGTM (someone should convert this code to use folios ;) ).

-- 
Cheers,

David


More information about the Linuxppc-dev mailing list