drm/xe: move page fault descriptors to uc types file
Subsystems (2)
PATCH 1/2 drm/xe: move page fault descriptors to uc types file
Future asic will have different firmware to handle page faults. Meanwhile future asic will have the same pf descriptor as guc so we should move the descriptors to xe_uc_fw_types.c
--- drivers/gpu/drm/xe/xe_gt_pagefault.c | 14 ++--- drivers/gpu/drm/xe/xe_guc_fwif.h | 82 --------------------------- drivers/gpu/drm/xe/xe_uc_fw_types.h | 83 ++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 89 deletions(-)
drivers/gpu/drm/xe/xe_gt_pagefault.c +7 -7
@@ -251,7 +251,7 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf) }static int send_pagefault_reply (struct xe_guc *guc, -struct xe_guc_pagefault_reply *reply) +struct xe_uc_pagefault_reply *reply) {u32 action[] = {XE_GUC_ACTION_PAGE_FAULT_RES_DESC ,
@@ -284,12 +284,12 @@ static void print_pagefault(struct xe_device *xe, struct pagefault *pf)static bool get_pagefault (struct pf_queue *pf_queue,struct pagefault *pf) { -const struct xe_guc_pagefault_desc *desc; +const struct xe_uc_pagefault_desc *desc;bool ret = false;spin_lock_irq (&pf_queue->lock);if (pf_queue->tail != pf_queue->head) { - desc = (const struct xe_guc_pagefault_desc *) + desc = (const struct xe_uc_pagefault_desc *) (pf_queue->data + pf_queue->tail); pf->fault_level =FIELD_GET (PFD_FAULT_LEVEL , desc->dw0);
@@ -369,7 +369,7 @@ static void pf_queue_work_func(struct work_struct *w) struct pf_queue *pf_queue = container_of(w, struct pf_queue, worker);struct xe_gt *gt = pf_queue->gt;struct xe_device *xe =gt_to_xe (gt); -struct xe_guc_pagefault_reply reply = {}; +struct xe_uc_pagefault_reply reply = {};struct pagefault pf = {};unsigned long threshold;int ret;
@@ -395,7 +395,7 @@ static void pf_queue_work_func(struct work_struct *w) reply.dw0 =FIELD_PREP (PFR_VALID ,1 ) |FIELD_PREP (PFR_SUCCESS , pf.fault_unsuccessful) | -FIELD_PREP (PFR_REPLY ,PFR_ACCESS ) | +FIELD_PREP (PFR_REPLY ,PFR_TYPE_ACCESS ) |FIELD_PREP (PFR_DESC_TYPE ,FAULT_RESPONSE_DESC ) |FIELD_PREP (PFR_ASID , pf.asid);
@@ -617,12 +617,12 @@ static int handle_acc(struct xe_gt *gt, struct acc *acc)static bool get_acc (struct acc_queue *acc_queue,struct acc *acc) { -const struct xe_guc_acc_desc *desc; +const struct xe_uc_acc_desc *desc;bool ret = false;spin_lock (&acc_queue->lock);if (acc_queue->tail != acc_queue->head) { - desc = (const struct xe_guc_acc_desc *) + desc = (const struct xe_uc_acc_desc *) (acc_queue->data + acc_queue->tail); acc->granularity =FIELD_GET (ACC_GRANULARITY , desc->dw2);
drivers/gpu/drm/xe/xe_guc_fwif.h +0 -82
91 lines not on this page · raw message
drivers/gpu/drm/xe/xe_uc_fw_types.h +83 -0
89 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/2 drm/xe: upon page fault, use generic uc fw instead of guc
Future asic will have different firmware to handle page faults. Change the code in xe_gt_pagefault.c to use xe_uc_fw instead of xe_guc and add a callback to struct xe_uc_fw to send the page fault replay to the fw.
--- drivers/gpu/drm/xe/xe_gt_pagefault.c | 24 ++++-------------------- drivers/gpu/drm/xe/xe_gt_pagefault.h | 6 +++--- drivers/gpu/drm/xe/xe_gt_types.h | 2 ++ drivers/gpu/drm/xe/xe_guc.c | 15 +++++++++++++++ drivers/gpu/drm/xe/xe_guc_ct.c | 8 ++++---- drivers/gpu/drm/xe/xe_uc_fw_types.h | 5 +++++ 6 files changed, 33 insertions(+), 27 deletions(-)
drivers/gpu/drm/xe/xe_gt_pagefault.c +4 -20
@@ -11,13 +11,10 @@#include <drm/drm_exec.h> #include <drm/drm_managed.h> -#include "abi/guc_actions_abi.h" #include "xe_bo.h" #include "xe_gt.h" #include "xe_gt_stats.h" #include "xe_gt_tlb_invalidation.h" -#include "xe_guc.h" -#include "xe_guc_ct.h" #include "xe_migrate.h" #include "xe_trace_bo.h" #include "xe_vm.h"
@@ -250,18 +247,6 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)return err; } -static int send_pagefault_reply (struct xe_guc *guc, -struct xe_uc_pagefault_reply *reply) -{ -u32 action[] = { -XE_GUC_ACTION_PAGE_FAULT_RES_DESC , - reply->dw0, - reply->dw1, - }; - -return xe_guc_ct_send (&guc->ct, action,ARRAY_SIZE (action),0 ,0 ); -} -static void print_pagefault (struct xe_device *xe,struct pagefault *pf) { drm_dbg(&xe->drm, "\n\tASID: %d\n"
@@ -327,9 +312,8 @@ static bool pf_queue_full(struct pf_queue *pf_queue)PF_MSG_LEN_DW ; } -int xe_guc_pagefault_handler (struct xe_guc *guc,u32 *msg,u32 len) +int xe_pagefault_handler (struct xe_gt *gt,struct xe_uc_fw *fw,u32 *msg,u32 len) { -struct xe_gt *gt =guc_to_gt (guc);struct xe_device *xe =gt_to_xe (gt);struct pf_queue *pf_queue;unsigned long flags;
@@ -341,6 +325,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len) asid =FIELD_GET (PFD_ASID , msg[1 ]); pf_queue = gt->usm.pf_queue + (asid %NUM_PF_QUEUE ); + pf_queue->fw = fw;/* * The below logic doesn't work unless PF_QUEUE_NUM_DW % PF_MSG_LEN_DW == 0
@@ -405,7 +390,7 @@ static void pf_queue_work_func(struct work_struct *w)FIELD_PREP (PFR_ENG_CLASS , pf.engine_class) |FIELD_PREP (PFR_PDATA , pf.pdata); -send_pagefault_reply (>->uc.guc, &reply); + pf_queue->fw->send_pagefault_reply (gt, pf_queue->fw, &reply);if (time_after (jiffies, threshold) && pf_queue->tail != pf_queue->head) {
@@ -679,9 +664,8 @@ static bool acc_queue_full(struct acc_queue *acc_queue)ACC_MSG_LEN_DW ; } -int xe_guc_access_counter_notify_handler (struct xe_guc *guc,u32 *msg,u32 len) +int xe_access_counter_notify_handler (struct xe_gt *gt,struct xe_uc_fw *fw,u32 *msg,u32 len) { -struct xe_gt *gt =guc_to_gt (guc);struct acc_queue *acc_queue;u32 asid;bool full;
drivers/gpu/drm/xe/xe_gt_pagefault.h +3 -3
@@ -9,11 +9,11 @@#include <linux/types.h> struct xe_gt ; -struct xe_guc ; +struct xe_uc_fw ;int xe_gt_pagefault_init (struct xe_gt *gt);void xe_gt_pagefault_reset (struct xe_gt *gt); -int xe_guc_pagefault_handler (struct xe_guc *guc,u32 *msg,u32 len); -int xe_guc_access_counter_notify_handler (struct xe_guc *guc,u32 *msg,u32 len); +int xe_pagefault_handler (struct xe_gt *gt,struct xe_uc_fw *fw,u32 *msg,u32 len); +int xe_access_counter_notify_handler (struct xe_gt *gt,struct xe_uc_fw *fw,u32 *msg,u32 len);#endif /* _XE_GT_PAGEFAULT_ */
drivers/gpu/drm/xe/xe_gt_types.h +2 -0
@@ -288,6 +288,8 @@ struct xe_gt {struct pf_queue {/** @usm.pf_queue.gt: back pointer to GT */ struct xe_gt *gt; +/** @usm.pf_queue.fw the fw that handles the pf */ +struct xe_uc_fw *fw;/** @usm.pf_queue.data: data in the page fault queue */ u32 *data;/**
drivers/gpu/drm/xe/xe_guc.c +15 -0
@@ -5,6 +5,7 @@#include "xe_guc.h" +#include "xe_uc_fw_types.h" #include <drm/drm_managed.h> #include <generated/xe_wa_oob.h>
@@ -664,6 +665,19 @@ static int vf_guc_init(struct xe_guc *guc)return 0 ; } +static int send_pagefault_reply (struct xe_gt *gt,struct xe_uc_fw *fw, +struct xe_uc_pagefault_reply *reply) +{ + struct xe_guc *guc = container_of(fw, struct xe_guc, fw); +u32 action[] = { +XE_GUC_ACTION_PAGE_FAULT_RES_DESC , + reply->dw0, + reply->dw1, + }; + +return xe_guc_ct_send (&guc->ct, action,ARRAY_SIZE (action),0 ,0 ); +} +int xe_guc_init (struct xe_guc *guc) {struct xe_device *xe =guc_to_xe (guc);
@@ -674,6 +688,7 @@ int xe_guc_init(struct xe_guc *guc) ret =xe_uc_fw_init (&guc->fw);if (ret) goto out; + guc->fw.send_pagefault_reply = &send_pagefault_reply;if (!xe_uc_fw_is_enabled (&guc->fw))return 0 ;
drivers/gpu/drm/xe/xe_guc_ct.c +4 -4
@@ -1316,15 +1316,15 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len) adj_len);break ;case XE_GUC_ACTION_REPORT_PAGE_FAULT_REQ_DESC : - ret =xe_guc_pagefault_handler (guc, payload, adj_len); + ret =xe_pagefault_handler (gt, &guc->fw, payload, adj_len);break ;case XE_GUC_ACTION_TLB_INVALIDATION_DONE : ret =xe_guc_tlb_invalidation_done_handler (guc, payload, adj_len);break ;case XE_GUC_ACTION_ACCESS_COUNTER_NOTIFY : - ret =xe_guc_access_counter_notify_handler (guc, payload, - adj_len); + ret =xe_access_counter_notify_handler (gt, &guc->fw, payload, + adj_len);break ;case XE_GUC_ACTION_GUC2PF_RELAY_FROM_VF : ret =xe_guc_relay_process_guc2pf (&guc->relay, hxg, hxg_len);
@@ -1529,7 +1529,7 @@ static void g2h_fast_path(struct xe_guc_ct *ct, u32 *msg, u32 len)switch (action) {case XE_GUC_ACTION_REPORT_PAGE_FAULT_REQ_DESC : - ret =xe_guc_pagefault_handler (guc, payload, adj_len); + ret =xe_pagefault_handler (gt, &guc->fw, payload, adj_len);break ;case XE_GUC_ACTION_TLB_INVALIDATION_DONE :__g2h_release_space (ct, len);
drivers/gpu/drm/xe/xe_uc_fw_types.h +5 -0
@@ -9,6 +9,7 @@#include <linux/types.h> struct xe_bo ; +struct xe_gt ;/* * +------------+---------------------------------------------------+
@@ -231,6 +232,10 @@ struct xe_uc_fw {/** @build_type: Firmware build type (see CSS_INFO_BUILDTYPE for definitions) */ u32 build_type; + +/** a callback to send the page fault replay to the fw */ +int (*send_pagefault_reply)(struct xe_gt *gt,struct xe_uc_fw *xe_fw, + struct xe_uc_pagefault_reply *reply); };#endif
Signature · 1 line
2.34.1
Patchwork
CI✗ CI.Patch_applied: failure for series starting with [1/2] drm/xe: move page fault descriptors to uc types file
In reply to Dafna Hirschfeld== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/xe: move page fault descriptors to uc types file
URL : https://patchwork.freedesktop.org/series/144555/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 7d57a6731f86 drm-tip: 2025y-02m-09d-01h-58m-45s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_guc_fwif.h:266
error: drivers/gpu/drm/xe/xe_guc_fwif.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/xe: move page fault descriptors to uc types file
Patch failed at 0001 drm/xe: move page fault descriptors to uc types file When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".