Re: [PATCH 1/2] drm/i915/guc: Add GuC method to determine if submission is active.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/6/19 9:40 AM, don.hiatt@xxxxxxxxx wrote:
From: Don Hiatt <don.hiatt@xxxxxxxxx>

Add intel_guc_submission_is_enabled() function to determine if
GuC submission is active. Based on code by Michal Wajdeczko.

Signed-off-by: Don Hiatt <don.hiatt@xxxxxxxxx>
---
  drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c |  2 +-
  drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h |  1 +
  drivers/gpu/drm/i915/i915_drv.h                   | 14 ++++++++++++++
  3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 2498c55e0ea5..0aaef7c07879 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -1081,7 +1081,7 @@ static void guc_interrupts_release(struct intel_gt *gt)
  	rps->pm_intrmsk_mbz &= ~ARAT_EXPIRED_INTRMSK;
  }
-static void guc_set_default_submission(struct intel_engine_cs *engine)
+void guc_set_default_submission(struct intel_engine_cs *engine)
  {
  	/*
  	 * We inherit a bunch of functions from execlists that we'd like
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h
index 54d716828352..a0132f061ebc 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h
@@ -63,5 +63,6 @@ void intel_guc_submission_disable(struct intel_guc *guc);
  void intel_guc_submission_fini(struct intel_guc *guc);
  int intel_guc_preempt_work_create(struct intel_guc *guc);
  void intel_guc_preempt_work_destroy(struct intel_guc *guc);
+void guc_set_default_submission(struct intel_engine_cs *engine);
#endif
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7e0f67babe20..878d574bb1c1 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -78,8 +78,10 @@
#include "gt/intel_lrc.h"
  #include "gt/intel_engine.h"
+#include "gt/intel_gt.h"
  #include "gt/intel_gt_types.h"
  #include "gt/intel_workarounds.h"
+#include "gt/uc/intel_guc_submission.h"
  #include "gt/uc/intel_uc.h"
#include "intel_device_info.h"
@@ -2032,4 +2034,16 @@ i915_coherent_map_type(struct drm_i915_private *i915)
  	return HAS_LLC(i915) ? I915_MAP_WB : I915_MAP_WC;
  }
+static inline bool intel_guc_submission_is_enabled(struct intel_guc *guc)
+{
+	struct intel_gt *gt = guc_to_gt(guc);
+	struct intel_engine_cs *engine;
+	enum intel_engine_id id;
+
+	for_each_engine(engine, gt, id)
+		return engine->set_default_submission ==
+			guc_set_default_submission;
+	return false;

It feels weird that we need to go look into the engines to understand if GuC submission is enabled or not. One of the patches I've sent earlier today ("drm/i915/guc: kill doorbell code and selftests") makes it so that intel_guc_submission_enable() can't fail, so after that it should be possible to have something like:

bool intel_guc_submission_is_enabled(struct intel_guc *guc) {
	return intel_guc_is_submission_supported(guc) &&
		intel_guc_is_running(guc);
}

AFAICS, even without my patch we do sanitize the GuC is intel_guc_submission_enable() fails, so the above should still work. If something like this doesn't fly, my preference would be to set something in intel_guc_submission_enable and check that instead of going inside the engines.
Michal, any input here?

Thanks,
Daniele

+}
+
  #endif

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux