]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Move page reclaim done_handler to own func
authorBrian Nguyen <brian3.nguyen@intel.com>
Thu, 5 Mar 2026 17:15:49 +0000 (17:15 +0000)
committerMatt Roper <matthew.d.roper@intel.com>
Mon, 16 Mar 2026 16:42:41 +0000 (09:42 -0700)
Originally, page reclamation is handled by the same fence as tlb
invalidation and uses its seqno, so there was no reason to separate out
the handlers. However in hindsight, for readability, and possible
future changes, it seems more beneficial to move this all out to its own
function.

Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Link: https://patch.msgid.link/20260305171546.67691-7-brian3.nguyen@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_guc_ct.c
drivers/gpu/drm/xe/xe_page_reclaim.c
drivers/gpu/drm/xe/xe_page_reclaim.h

index 3b1c03743f83e5571d30449a5eee470d253fb7c6..a11cff7a20be7e1ecdff0faf63ec8d120f2c8567 100644 (file)
@@ -31,6 +31,7 @@
 #include "xe_guc_submit.h"
 #include "xe_guc_tlb_inval.h"
 #include "xe_map.h"
+#include "xe_page_reclaim.h"
 #include "xe_pm.h"
 #include "xe_sleep.h"
 #include "xe_sriov_vf.h"
@@ -1630,17 +1631,11 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
                ret = xe_guc_pagefault_handler(guc, payload, adj_len);
                break;
        case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
-       case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
-               /*
-                * Page reclamation is an extension of TLB invalidation. Both
-                * operations share the same seqno and fence. When either
-                * action completes, we need to signal the corresponding
-                * fence. Since the handling logic (lookup fence by seqno,
-                * fence signalling) is identical, we use the same handler
-                * for both G2H events.
-                */
                ret = xe_guc_tlb_inval_done_handler(guc, payload, adj_len);
                break;
+       case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
+               ret = xe_guc_page_reclaim_done_handler(guc, payload, adj_len);
+               break;
        case XE_GUC_ACTION_GUC2PF_RELAY_FROM_VF:
                ret = xe_guc_relay_process_guc2pf(&guc->relay, hxg, hxg_len);
                break;
@@ -1848,15 +1843,13 @@ static void g2h_fast_path(struct xe_guc_ct *ct, u32 *msg, u32 len)
                ret = xe_guc_pagefault_handler(guc, payload, adj_len);
                break;
        case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
-       case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
-               /*
-                * Seqno and fence handling of page reclamation and TLB
-                * invalidation is identical, so we can use the same handler
-                * for both actions.
-                */
                __g2h_release_space(ct, len);
                ret = xe_guc_tlb_inval_done_handler(guc, payload, adj_len);
                break;
+       case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
+               __g2h_release_space(ct, len);
+               ret = xe_guc_page_reclaim_done_handler(guc, payload, adj_len);
+               break;
        default:
                xe_gt_warn(gt, "NOT_POSSIBLE\n");
        }
index e13c71a89da2cfae3ea3c429ede6fbaf1a80bfca..60b0fda59ce33720ef0ffc888813c9b9bdd79b03 100644 (file)
@@ -11,6 +11,7 @@
 #include "xe_page_reclaim.h"
 
 #include "xe_gt_stats.h"
+#include "xe_guc_tlb_inval.h"
 #include "xe_macros.h"
 #include "xe_pat.h"
 #include "xe_sa.h"
@@ -130,3 +131,22 @@ int xe_page_reclaim_list_alloc_entries(struct xe_page_reclaim_list *prl)
 
        return page ? 0 : -ENOMEM;
 }
+
+/**
+ * xe_guc_page_reclaim_done_handler() - Page reclaim done handler
+ * @guc: guc
+ * @msg: message indicating page reclamation done
+ * @len: length of message
+ *
+ * Page reclamation is an extension of TLB invalidation. Both
+ * operations share the same seqno and fence. When either
+ * action completes, we need to signal the corresponding
+ * fence. Since the handling logic is currently identical, this
+ * function delegates to the TLB invalidation handler.
+ *
+ * Return: 0 on success, -EPROTO for malformed messages.
+ */
+int xe_guc_page_reclaim_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
+{
+       return xe_guc_tlb_inval_done_handler(guc, msg, len);
+}
index 3dd103e37bebb41b5a3b466007cc2f30c7a830a0..0412611f3af77367e1ae00f9814a89f90570925e 100644 (file)
@@ -20,6 +20,7 @@ struct xe_tlb_inval;
 struct xe_tlb_inval_fence;
 struct xe_tile;
 struct xe_gt;
+struct xe_guc;
 struct xe_vma;
 
 struct xe_guc_page_reclaim_entry {
@@ -122,4 +123,6 @@ static inline void xe_page_reclaim_entries_put(struct xe_guc_page_reclaim_entry
                put_page(virt_to_page(entries));
 }
 
+int xe_guc_page_reclaim_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
+
 #endif /* _XE_PAGE_RECLAIM_H_ */