• Christian Koenig's avatar
    drm/amdgpu: implement TLB flush fence · d8a3f0a0
    Christian Koenig authored
    The problem is that when (for example) 4k pages are replaced
    with a single 2M page we need to wait for change to be flushed
    out by invalidating the TLB before the PT can be freed.
    
    Solve this by moving the TLB flush into a DMA-fence object which
    can be used to delay the freeing of the PT BOs until it is signaled.
    
    V2: (Shashank)
        - rebase
        - set dma_fence_error only in case of error
        - add tlb_flush fence only when PT/PD BO is locked (Felix)
        - use vm->pasid when f is NULL (Mukul)
    
    V4: - add a wait for (f->dependency) in tlb_fence_work (Christian)
        - move the misplaced fence_create call to the end (Philip)
    
    V5: - free the f->dependency properly
    
    V6: (Shashank)
        - light code movement, moved all the clean-up in previous patch
        - introduce params.needs_flush and its usage in this patch
        - rebase without TLB HW sequence patch
    
    V7:
       - Keep the vm->last_update_fence and tlb_cb code until
         we can fix the HW sequencing (Christian)
       - Move all the tlb_fence related code in a separate function so that
         its easier to read and review
    
    V9: Addressed review comments from Christian
        - start PT update only when we have callback memory allocated
    
    V10:
        - handle device unlock in OOM case (Christian, Mukul)
        - added Christian's R-B
    
    Cc: Christian Koenig <christian.koenig@amd.com>
    Cc: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Acked-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
    Acked-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
    Tested-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
    Reviewed-by: default avatarShashank Sharma <shashank.sharma@amd.com>
    Reviewed-by: default avatarChristian Koenig <christian.koenig@amd.com>
    Signed-off-by: default avatarChristian Koenig <christian.koenig@amd.com>
    Signed-off-by: default avatarShashank Sharma <shashank.sharma@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    d8a3f0a0
amdgpu_vm.h 19.5 KB