Message ID | 20200110162930.88968-5-michal.wajdeczko@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add ops to intel_uc | expand |
Quoting Michal Wajdeczko (2020-01-10 16:29:30) > uC sanitization is only meaningful if we are running with uC present > or enabled. Make this function part of the uc_ops. > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Series is Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> > --- > drivers/gpu/drm/i915/gt/uc/intel_uc.c | 10 ++-------- > drivers/gpu/drm/i915/gt/uc/intel_uc.h | 3 ++- > 2 files changed, 4 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c > index 1b07135a8515..c1d5af775713 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c > @@ -12,6 +12,7 @@ > > #include "i915_drv.h" > > +static int __uc_sanitize(struct intel_uc *uc); > static void __uc_fetch_firmwares(struct intel_uc *uc); > static void __uc_cleanup_firmwares(struct intel_uc *uc); > static void __uc_init(struct intel_uc *uc); > @@ -25,6 +26,7 @@ static const struct intel_uc_ops uc_ops_off = { > }; > > static const struct intel_uc_ops uc_ops_on = { > + .sanitize = __uc_sanitize, > .init_fw = __uc_fetch_firmwares, > .fini_fw = __uc_cleanup_firmwares, > .init = __uc_init, The only nit is that I would use whitespace here more consistently here to break up the phases, and I would suggest making the ops forwards declared rather than every function. -Chris
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c index 1b07135a8515..c1d5af775713 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c @@ -12,6 +12,7 @@ #include "i915_drv.h" +static int __uc_sanitize(struct intel_uc *uc); static void __uc_fetch_firmwares(struct intel_uc *uc); static void __uc_cleanup_firmwares(struct intel_uc *uc); static void __uc_init(struct intel_uc *uc); @@ -25,6 +26,7 @@ static const struct intel_uc_ops uc_ops_off = { }; static const struct intel_uc_ops uc_ops_on = { + .sanitize = __uc_sanitize, .init_fw = __uc_fetch_firmwares, .fini_fw = __uc_cleanup_firmwares, .init = __uc_init, @@ -333,14 +335,6 @@ static int __uc_sanitize(struct intel_uc *uc) return __intel_uc_reset_hw(uc); } -void intel_uc_sanitize(struct intel_uc *uc) -{ - if (!intel_uc_supports_guc(uc)) - return; - - __uc_sanitize(uc); -} - /* Initialize and verify the uC regs related to uC positioning in WOPCM */ static int uc_init_wopcm(struct intel_uc *uc) { diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.h b/drivers/gpu/drm/i915/gt/uc/intel_uc.h index 8c0ce0d9f190..49c913524686 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.h @@ -13,6 +13,7 @@ struct intel_uc; struct intel_uc_ops { + int (*sanitize)(struct intel_uc *uc); void (*init_fw)(struct intel_uc *uc); void (*fini_fw)(struct intel_uc *uc); void (*init)(struct intel_uc *uc); @@ -33,7 +34,6 @@ struct intel_uc { void intel_uc_init_early(struct intel_uc *uc); void intel_uc_driver_late_release(struct intel_uc *uc); void intel_uc_init_mmio(struct intel_uc *uc); -void intel_uc_sanitize(struct intel_uc *uc); void intel_uc_reset_prepare(struct intel_uc *uc); void intel_uc_suspend(struct intel_uc *uc); void intel_uc_runtime_suspend(struct intel_uc *uc); @@ -77,6 +77,7 @@ static inline _TYPE intel_uc_##_NAME(struct intel_uc *uc) \ return uc->ops->_OPS(uc); \ return _RET; \ } +intel_uc_ops_function(sanitize, sanitize, int, 0); intel_uc_ops_function(fetch_firmwares, init_fw, void, ); intel_uc_ops_function(cleanup_firmwares, fini_fw, void, ); intel_uc_ops_function(init, init, void, );
uC sanitization is only meaningful if we are running with uC present or enabled. Make this function part of the uc_ops. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> --- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 10 ++-------- drivers/gpu/drm/i915/gt/uc/intel_uc.h | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-)