Merge branch 'for-6.9/amd-sfh' into for-linus
[sfrench/cifs-2.6.git] / drivers / gpu / drm / xe / xe_gt_pagefault.c
index 59a70d2e0a7a33386fdcfca9cc158919aab1e32c..73f08f1924df2ea8d4aaabb87eceaa13eff81d78 100644 (file)
@@ -165,7 +165,8 @@ retry_userptr:
                goto unlock_vm;
        }
 
-       if (!xe_vma_is_userptr(vma) || !xe_vma_userptr_check_repin(vma)) {
+       if (!xe_vma_is_userptr(vma) ||
+           !xe_vma_userptr_check_repin(to_userptr_vma(vma))) {
                downgrade_write(&vm->lock);
                write_locked = false;
        }
@@ -181,11 +182,13 @@ retry_userptr:
        /* TODO: Validate fault */
 
        if (xe_vma_is_userptr(vma) && write_locked) {
+               struct xe_userptr_vma *uvma = to_userptr_vma(vma);
+
                spin_lock(&vm->userptr.invalidated_lock);
-               list_del_init(&vma->userptr.invalidate_link);
+               list_del_init(&uvma->userptr.invalidate_link);
                spin_unlock(&vm->userptr.invalidated_lock);
 
-               ret = xe_vma_userptr_pin_pages(vma);
+               ret = xe_vma_userptr_pin_pages(uvma);
                if (ret)
                        goto unlock_vm;
 
@@ -220,7 +223,7 @@ retry_userptr:
        dma_fence_put(fence);
 
        if (xe_vma_is_userptr(vma))
-               ret = xe_vma_userptr_check_repin(vma);
+               ret = xe_vma_userptr_check_repin(to_userptr_vma(vma));
        vma->usm.tile_invalidated &= ~BIT(tile->id);
 
 unlock_dma_resv:
@@ -332,7 +335,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len)
                return -EPROTO;
 
        asid = FIELD_GET(PFD_ASID, msg[1]);
-       pf_queue = &gt->usm.pf_queue[asid % NUM_PF_QUEUE];
+       pf_queue = gt->usm.pf_queue + (asid % NUM_PF_QUEUE);
 
        spin_lock_irqsave(&pf_queue->lock, flags);
        full = pf_queue_full(pf_queue);