aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_guc_submission.c
diff options
context:
space:
mode:
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>2018-10-22 19:04:24 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2018-10-23 04:42:25 -0400
commitfb0c37f67010cbafd284b2db351a332d9084c86c (patch)
tree21c5079453f8e2191f3513209656af8269c46d9f /drivers/gpu/drm/i915/intel_guc_submission.c
parentbfeabcc87ae0f2dd75bc64f3fedbb6b762b4e5c6 (diff)
drm/i915/guc: doorbell checking cleanup
A collection of very small cleanups/improvements around doorbell checking that do not deserve their own patch: - Move doorbell-related HW defs to intel_guc_reg.h - use GUC_NUM_DOORBELLS instead of GUC_DOORBELL_INVALID where appropriate - do not stop on error in guc_verify_doorbells - do not print drbreg on error: the only content of the register apart from the valid bit is the lower part of the physical memory address, which we can't use even if valid because we don't know which descriptor it came from (since the doorbell is in an unexpected state) - Move the checking of doorbell valid bit to a common helper. v2: add more cleanups (move defs, use GUC_NUM_DOORBELLS, don't stop in guc_verify_doorbells) (Michal) v3: move more things to intel_guc_reg, redefine GUC_DOORBELL_INVALID (Michal), drop guc_doorbell_qw since it just duplicates guc_doorbell_info Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20181022230427.5616-3-daniele.ceraolospurio@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_guc_submission.c')
-rw-r--r--drivers/gpu/drm/i915/intel_guc_submission.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index 8c3b5a9facee..1570dcbe249c 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -192,6 +192,14 @@ static struct guc_doorbell_info *__get_doorbell(struct intel_guc_client *client)
192 return client->vaddr + client->doorbell_offset; 192 return client->vaddr + client->doorbell_offset;
193} 193}
194 194
195static bool __doorbell_valid(struct intel_guc *guc, u16 db_id)
196{
197 struct drm_i915_private *dev_priv = guc_to_i915(guc);
198
199 GEM_BUG_ON(db_id >= GUC_NUM_DOORBELLS);
200 return I915_READ(GEN8_DRBREGL(db_id)) & GEN8_DRB_VALID;
201}
202
195static void __init_doorbell(struct intel_guc_client *client) 203static void __init_doorbell(struct intel_guc_client *client)
196{ 204{
197 struct guc_doorbell_info *doorbell; 205 struct guc_doorbell_info *doorbell;
@@ -203,7 +211,6 @@ static void __init_doorbell(struct intel_guc_client *client)
203 211
204static void __fini_doorbell(struct intel_guc_client *client) 212static void __fini_doorbell(struct intel_guc_client *client)
205{ 213{
206 struct drm_i915_private *dev_priv = guc_to_i915(client->guc);
207 struct guc_doorbell_info *doorbell; 214 struct guc_doorbell_info *doorbell;
208 u16 db_id = client->doorbell_id; 215 u16 db_id = client->doorbell_id;
209 216
@@ -214,7 +221,7 @@ static void __fini_doorbell(struct intel_guc_client *client)
214 * to go to zero after updating db_status before we call the GuC to 221 * to go to zero after updating db_status before we call the GuC to
215 * release the doorbell 222 * release the doorbell
216 */ 223 */
217 if (wait_for_us(!(I915_READ(GEN8_DRBREGL(db_id)) & GEN8_DRB_VALID), 10)) 224 if (wait_for_us(!__doorbell_valid(client->guc, db_id), 10))
218 WARN_ONCE(true, "Doorbell never became invalid after disable\n"); 225 WARN_ONCE(true, "Doorbell never became invalid after disable\n");
219} 226}
220 227
@@ -866,33 +873,31 @@ guc_reset_prepare(struct intel_engine_cs *engine)
866/* Check that a doorbell register is in the expected state */ 873/* Check that a doorbell register is in the expected state */
867static bool doorbell_ok(struct intel_guc *guc, u16 db_id) 874static bool doorbell_ok(struct intel_guc *guc, u16 db_id)
868{ 875{
869 struct drm_i915_private *dev_priv = guc_to_i915(guc);
870 u32 drbregl;
871 bool valid; 876 bool valid;
872 877
873 GEM_BUG_ON(db_id >= GUC_DOORBELL_INVALID); 878 GEM_BUG_ON(db_id >= GUC_NUM_DOORBELLS);
874 879
875 drbregl = I915_READ(GEN8_DRBREGL(db_id)); 880 valid = __doorbell_valid(guc, db_id);
876 valid = drbregl & GEN8_DRB_VALID;
877 881
878 if (test_bit(db_id, guc->doorbell_bitmap) == valid) 882 if (test_bit(db_id, guc->doorbell_bitmap) == valid)
879 return true; 883 return true;
880 884
881 DRM_DEBUG_DRIVER("Doorbell %d has unexpected state (0x%x): valid=%s\n", 885 DRM_DEBUG_DRIVER("Doorbell %u has unexpected state: valid=%s\n",
882 db_id, drbregl, yesno(valid)); 886 db_id, yesno(valid));
883 887
884 return false; 888 return false;
885} 889}
886 890
887static bool guc_verify_doorbells(struct intel_guc *guc) 891static bool guc_verify_doorbells(struct intel_guc *guc)
888{ 892{
893 bool doorbells_ok = true;
889 u16 db_id; 894 u16 db_id;
890 895
891 for (db_id = 0; db_id < GUC_NUM_DOORBELLS; ++db_id) 896 for (db_id = 0; db_id < GUC_NUM_DOORBELLS; ++db_id)
892 if (!doorbell_ok(guc, db_id)) 897 if (!doorbell_ok(guc, db_id))
893 return false; 898 doorbells_ok = false;
894 899
895 return true; 900 return doorbells_ok;
896} 901}
897 902
898/** 903/**