• Felix Kuehling's avatar
    drm/amdkfd: validate vram svm range from TTM · e49fe404
    Felix Kuehling authored
    If svm range perfetch location is not zero, use TTM to alloc
    amdgpu_bo vram nodes to validate svm range, then map vram nodes to GPUs.
    
    Use offset to sub allocate from the same amdgpu_bo to handle overlap
    vram range while adding new range or unmapping range.
    
    svm_bo has ref count to trace the shared ranges. If all ranges of shared
    amdgpu_bo are migrated to ram, ref count becomes 0, then amdgpu_bo is
    released, all ranges svm_bo is set to NULL.
    
    To migrate range from ram back to vram, allocate the same amdgpu_bo
    with previous offset if the range has svm_bo.
    
    If prange migrate to VRAM, no CPU mapping exist, then process exit will
    not have unmap callback for this prange to free prange and svm bo. Free
    outstanding pranges from svms list before process is freed in
    svm_range_list_fini.
    Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
    Signed-off-by: default avatarAlex Sierra <alex.sierra@amd.com>
    Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    e49fe404
kfd_svm.c 58 KB