Message ID | 20190730181903.17820-3-michal.wajdeczko@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Don't sanitize enable_guc | expand |
Quoting Michal Wajdeczko (2019-07-30 19:19:02) > Instead of relying on enable_guc modparam to represent actual > GuC submission mode, use dedicated flag and look at modparam > only to check if submission was explicitly disabled by the user. > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> > Cc: Chris Wilson <chris@chris-wilson.co.uk> > --- > drivers/gpu/drm/i915/gt/uc/intel_guc.c | 1 + > drivers/gpu/drm/i915/gt/uc/intel_guc.h | 7 +++++++ > .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 16 ++++++++++++++++ > .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 1 + > drivers/gpu/drm/i915/gt/uc/intel_uc.h | 3 +-- > 5 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc.c > index 13fbbffd05c7..a75ef0096f15 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.c > @@ -82,6 +82,7 @@ void intel_guc_init_early(struct intel_guc *guc) > intel_guc_fw_init_early(guc); > intel_guc_ct_init_early(&guc->ct); > intel_guc_log_init_early(&guc->log); > + intel_guc_submission_init_early(guc); > > mutex_init(&guc->send_mutex); > spin_lock_init(&guc->irq_lock); > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h b/drivers/gpu/drm/i915/gt/uc/intel_guc.h > index 5901506672cd..680625a0c722 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h > @@ -64,6 +64,8 @@ struct intel_guc { > struct i915_vma *ads_vma; > struct __guc_ads_blob *ads_blob; > > + bool using_submission; First boolean, but not necessarily the last? > + > struct i915_vma *stage_desc_pool; > void *stage_desc_pool_vaddr; > struct ida stage_ids; > @@ -190,6 +192,11 @@ static inline int intel_guc_sanitize(struct intel_guc *guc) > return 0; > } > > +static inline bool intel_guc_is_submission_supported(struct intel_guc *guc) > +{ > + return guc->using_submission; I still suffer a logical disconnect between using and is. > +} > + > static inline void intel_guc_enable_msg(struct intel_guc *guc, u32 mask) > { > spin_lock_irq(&guc->irq_lock); > 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 b4238fe16a03..b0cdbd9b2365 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > @@ -1163,6 +1163,22 @@ void intel_guc_submission_disable(struct intel_guc *guc) > guc_clients_disable(guc); > } > > +static bool __force_no_guc_submission(void) > +{ > + /* XXX: GuC submission is unavailable for now */ > + return true; > + > + return (i915_modparams.enable_guc == 0) || > + ((i915_modparams.enable_guc > 0) && > + !(i915_modparams.enable_guc & ENABLE_GUC_SUBMISSION)); enable_guc <= 0 || !(enable_guc & ENABLE_SUBMISSION) ? Then in future if you want <-1 for auto enable, s/<=/==/ -Chris
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc.c index 13fbbffd05c7..a75ef0096f15 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.c @@ -82,6 +82,7 @@ void intel_guc_init_early(struct intel_guc *guc) intel_guc_fw_init_early(guc); intel_guc_ct_init_early(&guc->ct); intel_guc_log_init_early(&guc->log); + intel_guc_submission_init_early(guc); mutex_init(&guc->send_mutex); spin_lock_init(&guc->irq_lock); diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h b/drivers/gpu/drm/i915/gt/uc/intel_guc.h index 5901506672cd..680625a0c722 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h @@ -64,6 +64,8 @@ struct intel_guc { struct i915_vma *ads_vma; struct __guc_ads_blob *ads_blob; + bool using_submission; + struct i915_vma *stage_desc_pool; void *stage_desc_pool_vaddr; struct ida stage_ids; @@ -190,6 +192,11 @@ static inline int intel_guc_sanitize(struct intel_guc *guc) return 0; } +static inline bool intel_guc_is_submission_supported(struct intel_guc *guc) +{ + return guc->using_submission; +} + static inline void intel_guc_enable_msg(struct intel_guc *guc, u32 mask) { spin_lock_irq(&guc->irq_lock); 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 b4238fe16a03..b0cdbd9b2365 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -1163,6 +1163,22 @@ void intel_guc_submission_disable(struct intel_guc *guc) guc_clients_disable(guc); } +static bool __force_no_guc_submission(void) +{ + /* XXX: GuC submission is unavailable for now */ + return true; + + return (i915_modparams.enable_guc == 0) || + ((i915_modparams.enable_guc > 0) && + !(i915_modparams.enable_guc & ENABLE_GUC_SUBMISSION)); +} + +void intel_guc_submission_init_early(struct intel_guc *guc) +{ + guc->using_submission = intel_guc_is_supported(guc) && + !__force_no_guc_submission(); +} + #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) #include "selftest_guc.c" #endif 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 87a38cb6faf3..c4ad2702ec8d 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h @@ -77,6 +77,7 @@ struct intel_guc_client { I915_SELFTEST_DECLARE(bool use_nop_wqi); }; +void intel_guc_submission_init_early(struct intel_guc *guc); int intel_guc_submission_init(struct intel_guc *guc); int intel_guc_submission_enable(struct intel_guc *guc); void intel_guc_submission_disable(struct intel_guc *guc); diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.h b/drivers/gpu/drm/i915/gt/uc/intel_uc.h index c8e5ad9807db..96bd9a461c93 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.h @@ -55,8 +55,7 @@ static inline bool intel_uc_is_using_guc(struct intel_uc *uc) static inline bool intel_uc_is_using_guc_submission(struct intel_uc *uc) { - GEM_BUG_ON(i915_modparams.enable_guc < 0); - return i915_modparams.enable_guc & ENABLE_GUC_SUBMISSION; + return intel_guc_is_submission_supported(&uc->guc); } static inline bool intel_uc_is_using_huc(struct intel_uc *uc)
Instead of relying on enable_guc modparam to represent actual GuC submission mode, use dedicated flag and look at modparam only to check if submission was explicitly disabled by the user. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 1 + drivers/gpu/drm/i915/gt/uc/intel_guc.h | 7 +++++++ .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 16 ++++++++++++++++ .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 1 + drivers/gpu/drm/i915/gt/uc/intel_uc.h | 3 +-- 5 files changed, 26 insertions(+), 2 deletions(-)