drm/xe/xe2: Respond to TRTT faults as unsuccessful page fault
authorBrian Welty <brian.welty@intel.com>
Tue, 21 Nov 2023 20:10:37 +0000 (12:10 -0800)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:45:10 +0000 (11:45 -0500)
SW is not expected to handle TRTT faults and should report these as
unsuccessful page fault in the reply, such that HW can respond by
raising a CAT error.

Signed-off-by: Brian Welty <brian.welty@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_gt_pagefault.c

index ccf5a6671faf84299d001417a946abd327ab3a8e..a5358064a4e0f80a40bb69d05561424e690de2d0 100644 (file)
@@ -34,6 +34,7 @@ struct pagefault {
        u8 engine_class;
        u8 engine_instance;
        u8 fault_unsuccessful;
+       bool trva_fault;
 };
 
 enum access_type {
@@ -138,6 +139,10 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
        int ret = 0;
        bool atomic;
 
+       /* SW isn't expected to handle TRTT faults */
+       if (pf->trva_fault)
+               return -EFAULT;
+
        /* ASID to VM */
        mutex_lock(&xe->usm.lock);
        vm = xa_load(&xe->usm.asid_to_vm, pf->asid);
@@ -282,6 +287,7 @@ static bool get_pagefault(struct pf_queue *pf_queue, struct pagefault *pf)
                        (pf_queue->data + pf_queue->head);
 
                pf->fault_level = FIELD_GET(PFD_FAULT_LEVEL, desc->dw0);
+               pf->trva_fault = FIELD_GET(XE2_PFD_TRVA_FAULT, desc->dw0);
                pf->engine_class = FIELD_GET(PFD_ENG_CLASS, desc->dw0);
                pf->engine_instance = FIELD_GET(PFD_ENG_INSTANCE, desc->dw0);
                pf->pdata = FIELD_GET(PFD_PDATA_HI, desc->dw1) <<