Localize error capture details within i915_gpu_error.c so we can reduce
the interfaces.

FIXME: I don't know what the function should be called.

Signed-off-by: Jani Nikula <[email protected]>
---
 .../drm/i915/gt/intel_execlists_submission.c  | 22 +-------
 drivers/gpu/drm/i915/i915_gpu_error.c         | 36 ++++++++++---
 drivers/gpu/drm/i915/i915_gpu_error.h         | 51 ++-----------------
 3 files changed, 36 insertions(+), 73 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c 
b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index 7c7e8c3a12e0..aea2fd75f227 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -2222,31 +2222,13 @@ struct execlists_capture {
 static void execlists_capture_work(struct work_struct *work)
 {
        struct execlists_capture *cap = container_of(work, typeof(*cap), work);
-       const gfp_t gfp = __GFP_KSWAPD_RECLAIM | __GFP_RETRY_MAYFAIL |
-               __GFP_NOWARN;
-       struct intel_engine_cs *engine = cap->rq->engine;
-       struct intel_gt_coredump *gt = cap->error->gt;
-       struct intel_engine_capture_vma *vma;
-
-       /* Compress all the objects attached to the request, slow! */
-       vma = intel_engine_coredump_add_request(gt->engine, cap->rq, gfp);
-       if (vma) {
-               struct i915_vma_compress *compress =
-                       i915_vma_capture_prepare(gt);
-
-               intel_engine_coredump_add_vma(gt->engine, vma, compress);
-               i915_vma_capture_finish(gt, compress);
-       }
 
-       gt->simulated = gt->engine->simulated;
-       cap->error->simulated = gt->simulated;
+       i915_gpu_error_execlist_capture(cap->error, cap->rq);
 
-       /* Publish the error state, and announce it to the world */
-       i915_error_state_store(cap->error);
        i915_gpu_coredump_put(cap->error);
 
        /* Return this request and all that depend upon it for signaling */
-       execlists_unhold(engine, cap->rq);
+       execlists_unhold(cap->rq->engine, cap->rq);
        i915_request_put(cap->rq);
 
        kfree(cap);
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
b/drivers/gpu/drm/i915/i915_gpu_error.c
index e4185f30f07c..837542c94b00 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1584,7 +1584,7 @@ engine_coredump_add_context(struct intel_engine_coredump 
*ee,
        return vma;
 }
 
-struct intel_engine_capture_vma *
+static struct intel_engine_capture_vma *
 intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
                                  struct i915_request *rq,
                                  gfp_t gfp)
@@ -1610,7 +1610,7 @@ intel_engine_coredump_add_request(struct 
intel_engine_coredump *ee,
        return vma;
 }
 
-void
+static void
 intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
                              struct intel_engine_capture_vma *capture,
                              struct i915_vma_compress *compress)
@@ -2096,7 +2096,7 @@ intel_gt_coredump_alloc(struct intel_gt *gt, gfp_t gfp, 
u32 dump_flags)
        return gc;
 }
 
-struct i915_vma_compress *
+static struct i915_vma_compress *
 i915_vma_capture_prepare(struct intel_gt_coredump *gt)
 {
        struct i915_vma_compress *compress;
@@ -2113,8 +2113,8 @@ i915_vma_capture_prepare(struct intel_gt_coredump *gt)
        return compress;
 }
 
-void i915_vma_capture_finish(struct intel_gt_coredump *gt,
-                            struct i915_vma_compress *compress)
+static void i915_vma_capture_finish(struct intel_gt_coredump *gt,
+                                   struct i915_vma_compress *compress)
 {
        if (!compress)
                return;
@@ -2189,7 +2189,7 @@ i915_gpu_coredump(struct intel_gt *gt, 
intel_engine_mask_t engine_mask, u32 dump
        return dump;
 }
 
-void i915_error_state_store(struct i915_gpu_coredump *error)
+static void i915_error_state_store(struct i915_gpu_coredump *error)
 {
        struct drm_i915_private *i915;
        static bool warned;
@@ -2244,6 +2244,30 @@ void i915_capture_error_state(struct intel_gt *gt,
        i915_gpu_coredump_put(error);
 }
 
+void i915_gpu_error_execlist_capture(struct i915_gpu_coredump *error,
+                                    struct i915_request *rq)
+{
+       struct intel_gt_coredump *gt = error->gt;
+       struct intel_engine_capture_vma *vma;
+       const gfp_t gfp = __GFP_KSWAPD_RECLAIM | __GFP_RETRY_MAYFAIL | 
__GFP_NOWARN;
+
+       /* Compress all the objects attached to the request, slow! */
+       vma = intel_engine_coredump_add_request(gt->engine, rq, gfp);
+       if (vma) {
+               struct i915_vma_compress *compress =
+                       i915_vma_capture_prepare(gt);
+
+               intel_engine_coredump_add_vma(gt->engine, vma, compress);
+               i915_vma_capture_finish(gt, compress);
+       }
+
+       gt->simulated = gt->engine->simulated;
+       error->simulated = gt->simulated;
+
+       /* Publish the error state, and announce it to the world */
+       i915_error_state_store(error);
+}
+
 static struct i915_gpu_coredump *
 i915_first_error_state(struct drm_i915_private *i915)
 {
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.h 
b/drivers/gpu/drm/i915/i915_gpu_error.h
index 0439dde95344..c2c15e29e266 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.h
+++ b/drivers/gpu/drm/i915/i915_gpu_error.h
@@ -27,8 +27,6 @@
 #include "i915_scheduler.h"
 
 struct drm_i915_private;
-struct i915_vma_compress;
-struct intel_engine_capture_vma;
 struct intel_overlay_error_state;
 
 struct i915_vma_coredump {
@@ -282,22 +280,8 @@ void i915_capture_error_state(struct intel_gt *gt,
 struct i915_gpu_coredump *
 i915_gpu_coredump_alloc(struct intel_engine_cs *engine, gfp_t gfp);
 
-struct intel_engine_capture_vma *
-intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
-                                 struct i915_request *rq,
-                                 gfp_t gfp);
-
-void intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
-                                  struct intel_engine_capture_vma *capture,
-                                  struct i915_vma_compress *compress);
-
-struct i915_vma_compress *
-i915_vma_capture_prepare(struct intel_gt_coredump *gt);
-
-void i915_vma_capture_finish(struct intel_gt_coredump *gt,
-                            struct i915_vma_compress *compress);
-
-void i915_error_state_store(struct i915_gpu_coredump *error);
+void i915_gpu_error_execlist_capture(struct i915_gpu_coredump *error,
+                                    struct i915_request *rq);
 
 ssize_t
 i915_gpu_coredump_copy_to_buffer(struct i915_gpu_coredump *error,
@@ -331,35 +315,8 @@ i915_gpu_coredump_alloc(struct drm_i915_private *i915, 
gfp_t gfp)
        return NULL;
 }
 
-static inline struct intel_engine_capture_vma *
-intel_engine_coredump_add_request(struct intel_engine_coredump *ee,
-                                 struct i915_request *rq,
-                                 gfp_t gfp)
-{
-       return NULL;
-}
-
-static inline void
-intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
-                             struct intel_engine_capture_vma *capture,
-                             struct i915_vma_compress *compress)
-{
-}
-
-static inline struct i915_vma_compress *
-i915_vma_capture_prepare(struct intel_gt_coredump *gt)
-{
-       return NULL;
-}
-
-static inline void
-i915_vma_capture_finish(struct intel_gt_coredump *gt,
-                       struct i915_vma_compress *compress)
-{
-}
-
-static inline void
-i915_error_state_store(struct i915_gpu_coredump *error)
+static inline void i915_gpu_error_execlist_capture(struct i915_gpu_coredump 
*error,
+                                                  struct i915_request *rq)
 {
 }
 
-- 
2.39.2

Reply via email to