Message ID | 1436365487-19242-2-git-send-email-animesh.manna@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Jul 08, 2015 at 07:54:42PM +0530, Animesh Manna wrote: > v1: As per review comments from Daniel, removed the csr-lock > and csr-state which was used before in dmc firmware loading. > Planning to have a single async task which will responsible > for firmware loading and register programming for dc5/dc6, > so removed csr-lock and csr-state from intel_csr structure. > > Signed-off-by: Animesh Manna <animesh.manna@intel.com> This patch split-up breaks correctness of the code since here you remove the existing dmc loading coordination code before the new code is in place. This should be done the other way round when splitting patches, i.e. first add the new code (or replace parts of the existing code as you go), then remove the old one. Patches for existing features should never degrade functionality. -Daniel > --- > drivers/gpu/drm/i915/i915_dma.c | 1 - > drivers/gpu/drm/i915/i915_drv.c | 6 ---- > drivers/gpu/drm/i915/i915_drv.h | 10 ------- > drivers/gpu/drm/i915/intel_csr.c | 52 --------------------------------- > drivers/gpu/drm/i915/intel_drv.h | 3 -- > drivers/gpu/drm/i915/intel_runtime_pm.c | 17 ++--------- > 6 files changed, 3 insertions(+), 86 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c > index c5349fa..1ebf0e1 100644 > --- a/drivers/gpu/drm/i915/i915_dma.c > +++ b/drivers/gpu/drm/i915/i915_dma.c > @@ -820,7 +820,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) > spin_lock_init(&dev_priv->mmio_flip_lock); > mutex_init(&dev_priv->sb_lock); > mutex_init(&dev_priv->modeset_restore_lock); > - mutex_init(&dev_priv->csr_lock); > > intel_pm_setup(dev); > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index e44dc0d..4d8d2d8 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -1019,12 +1019,6 @@ static int skl_suspend_complete(struct drm_i915_private *dev_priv) > { > /* Enabling DC6 is not a hard requirement to enter runtime D3 */ > > - /* > - * This is to ensure that CSR isn't identified as loaded before > - * CSR-loading program is called during runtime-resume. > - */ > - intel_csr_load_status_set(dev_priv, FW_UNINITIALIZED); > - > skl_uninit_cdclk(dev_priv); > > return 0; > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 1dbd957..b3a0fd6 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -737,12 +737,6 @@ struct intel_uncore { > #define for_each_fw_domain(domain__, dev_priv__, i__) \ > for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__) > > -enum csr_state { > - FW_UNINITIALIZED = 0, > - FW_LOADED, > - FW_FAILED > -}; > - > struct intel_csr { > const char *fw_path; > __be32 *dmc_payload; > @@ -750,7 +744,6 @@ struct intel_csr { > uint32_t mmio_count; > uint32_t mmioaddr[8]; > uint32_t mmiodata[8]; > - enum csr_state state; > }; > > #define DEV_INFO_FOR_EACH_FLAG(func, sep) \ > @@ -1689,9 +1682,6 @@ struct drm_i915_private { > > struct intel_csr csr; > > - /* Display CSR-related protection */ > - struct mutex csr_lock; > - > struct intel_gmbus gmbus[GMBUS_NUM_PINS]; > > /** gmbus_mutex protects against concurrent usage of the single hw gmbus > diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c > index 6d8a7bf..62fd1b0 100644 > --- a/drivers/gpu/drm/i915/intel_csr.c > +++ b/drivers/gpu/drm/i915/intel_csr.c > @@ -32,13 +32,6 @@ > * onwards to drive newly added DMC (Display microcontroller) in display > * engine to save and restore the state of display engine when it enter into > * low-power state and comes back to normal. > - * > - * Firmware loading status will be one of the below states: FW_UNINITIALIZED, > - * FW_LOADED, FW_FAILED. > - * > - * Once the firmware is written into the registers status will be moved from > - * FW_UNINITIALIZED to FW_LOADED and for any erroneous condition status will > - * be moved to FW_FAILED. > */ > > #define I915_CSR_SKL "i915/skl_dmc_ver1.bin" > @@ -200,40 +193,6 @@ static char intel_get_substepping(struct drm_device *dev) > } > > /** > - * intel_csr_load_status_get() - to get firmware loading status. > - * @dev_priv: i915 device. > - * > - * This function helps to get the firmware loading status. > - * > - * Return: Firmware loading status. > - */ > -enum csr_state intel_csr_load_status_get(struct drm_i915_private *dev_priv) > -{ > - enum csr_state state; > - > - mutex_lock(&dev_priv->csr_lock); > - state = dev_priv->csr.state; > - mutex_unlock(&dev_priv->csr_lock); > - > - return state; > -} > - > -/** > - * intel_csr_load_status_set() - help to set firmware loading status. > - * @dev_priv: i915 device. > - * @state: enumeration of firmware loading status. > - * > - * Set the firmware loading status. > - */ > -void intel_csr_load_status_set(struct drm_i915_private *dev_priv, > - enum csr_state state) > -{ > - mutex_lock(&dev_priv->csr_lock); > - dev_priv->csr.state = state; > - mutex_unlock(&dev_priv->csr_lock); > -} > - > -/** > * intel_csr_load_program() - write the firmware from memory to register. > * @dev: drm device. > * > @@ -252,7 +211,6 @@ void intel_csr_load_program(struct drm_device *dev) > return; > } > > - mutex_lock(&dev_priv->csr_lock); > fw_size = dev_priv->csr.dmc_fw_size; > for (i = 0; i < fw_size; i++) > I915_WRITE(CSR_PROGRAM_BASE + i * 4, > @@ -262,9 +220,6 @@ void intel_csr_load_program(struct drm_device *dev) > I915_WRITE(dev_priv->csr.mmioaddr[i], > dev_priv->csr.mmiodata[i]); > } > - > - dev_priv->csr.state = FW_LOADED; > - mutex_unlock(&dev_priv->csr_lock); > } > > static void finish_csr_load(const struct firmware *fw, void *context) > @@ -393,8 +348,6 @@ static void finish_csr_load(const struct firmware *fw, void *context) > out: > if (fw_loaded) > intel_runtime_pm_put(dev_priv); > - else > - intel_csr_load_status_set(dev_priv, FW_FAILED); > > release_firmware(fw); > } > @@ -419,7 +372,6 @@ void intel_csr_ucode_init(struct drm_device *dev) > csr->fw_path = I915_CSR_SKL; > else { > DRM_ERROR("Unexpected: no known CSR firmware for platform\n"); > - intel_csr_load_status_set(dev_priv, FW_FAILED); > return; > } > > @@ -438,7 +390,6 @@ void intel_csr_ucode_init(struct drm_device *dev) > finish_csr_load); > if (ret) { > i915_firmware_load_error_print(csr->fw_path, ret); > - intel_csr_load_status_set(dev_priv, FW_FAILED); > } > } > > @@ -456,14 +407,11 @@ void intel_csr_ucode_fini(struct drm_device *dev) > if (!HAS_CSR(dev)) > return; > > - intel_csr_load_status_set(dev_priv, FW_FAILED); > kfree(dev_priv->csr.dmc_payload); > } > > void assert_csr_loaded(struct drm_i915_private *dev_priv) > { > - WARN(intel_csr_load_status_get(dev_priv) != FW_LOADED, > - "CSR is not loaded.\n"); > WARN(!I915_READ(CSR_PROGRAM_BASE), > "CSR program storage start is NULL\n"); > WARN(!I915_READ(CSR_SSP_BASE), "CSR SSP Base Not fine\n"); > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 3f0a890..f437a90 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -1163,9 +1163,6 @@ u32 skl_plane_ctl_rotation(unsigned int rotation); > > /* intel_csr.c */ > void intel_csr_ucode_init(struct drm_device *dev); > -enum csr_state intel_csr_load_status_get(struct drm_i915_private *dev_priv); > -void intel_csr_load_status_set(struct drm_i915_private *dev_priv, > - enum csr_state state); > void intel_csr_load_program(struct drm_device *dev); > void intel_csr_ucode_fini(struct drm_device *dev); > void assert_csr_loaded(struct drm_i915_private *dev_priv); > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c > index 1a45385..0b81d6f 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c > @@ -644,21 +644,10 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, > > if ((GEN9_ENABLE_DC5(dev) || SKL_ENABLE_DC6(dev)) && > power_well->data == SKL_DISP_PW_2) { > - enum csr_state state; > - /* TODO: wait for a completion event or > - * similar here instead of busy > - * waiting using wait_for function. > - */ > - wait_for((state = intel_csr_load_status_get(dev_priv)) != > - FW_UNINITIALIZED, 1000); > - if (state != FW_LOADED) > - DRM_ERROR("CSR firmware not ready (%d)\n", > - state); > + if (SKL_ENABLE_DC6(dev)) > + skl_enable_dc6(dev_priv); > else > - if (SKL_ENABLE_DC6(dev)) > - skl_enable_dc6(dev_priv); > - else > - gen9_enable_dc5(dev_priv); > + gen9_enable_dc5(dev_priv); > } > } > } > -- > 2.0.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c5349fa..1ebf0e1 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -820,7 +820,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) spin_lock_init(&dev_priv->mmio_flip_lock); mutex_init(&dev_priv->sb_lock); mutex_init(&dev_priv->modeset_restore_lock); - mutex_init(&dev_priv->csr_lock); intel_pm_setup(dev); diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e44dc0d..4d8d2d8 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1019,12 +1019,6 @@ static int skl_suspend_complete(struct drm_i915_private *dev_priv) { /* Enabling DC6 is not a hard requirement to enter runtime D3 */ - /* - * This is to ensure that CSR isn't identified as loaded before - * CSR-loading program is called during runtime-resume. - */ - intel_csr_load_status_set(dev_priv, FW_UNINITIALIZED); - skl_uninit_cdclk(dev_priv); return 0; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 1dbd957..b3a0fd6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -737,12 +737,6 @@ struct intel_uncore { #define for_each_fw_domain(domain__, dev_priv__, i__) \ for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__) -enum csr_state { - FW_UNINITIALIZED = 0, - FW_LOADED, - FW_FAILED -}; - struct intel_csr { const char *fw_path; __be32 *dmc_payload; @@ -750,7 +744,6 @@ struct intel_csr { uint32_t mmio_count; uint32_t mmioaddr[8]; uint32_t mmiodata[8]; - enum csr_state state; }; #define DEV_INFO_FOR_EACH_FLAG(func, sep) \ @@ -1689,9 +1682,6 @@ struct drm_i915_private { struct intel_csr csr; - /* Display CSR-related protection */ - struct mutex csr_lock; - struct intel_gmbus gmbus[GMBUS_NUM_PINS]; /** gmbus_mutex protects against concurrent usage of the single hw gmbus diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c index 6d8a7bf..62fd1b0 100644 --- a/drivers/gpu/drm/i915/intel_csr.c +++ b/drivers/gpu/drm/i915/intel_csr.c @@ -32,13 +32,6 @@ * onwards to drive newly added DMC (Display microcontroller) in display * engine to save and restore the state of display engine when it enter into * low-power state and comes back to normal. - * - * Firmware loading status will be one of the below states: FW_UNINITIALIZED, - * FW_LOADED, FW_FAILED. - * - * Once the firmware is written into the registers status will be moved from - * FW_UNINITIALIZED to FW_LOADED and for any erroneous condition status will - * be moved to FW_FAILED. */ #define I915_CSR_SKL "i915/skl_dmc_ver1.bin" @@ -200,40 +193,6 @@ static char intel_get_substepping(struct drm_device *dev) } /** - * intel_csr_load_status_get() - to get firmware loading status. - * @dev_priv: i915 device. - * - * This function helps to get the firmware loading status. - * - * Return: Firmware loading status. - */ -enum csr_state intel_csr_load_status_get(struct drm_i915_private *dev_priv) -{ - enum csr_state state; - - mutex_lock(&dev_priv->csr_lock); - state = dev_priv->csr.state; - mutex_unlock(&dev_priv->csr_lock); - - return state; -} - -/** - * intel_csr_load_status_set() - help to set firmware loading status. - * @dev_priv: i915 device. - * @state: enumeration of firmware loading status. - * - * Set the firmware loading status. - */ -void intel_csr_load_status_set(struct drm_i915_private *dev_priv, - enum csr_state state) -{ - mutex_lock(&dev_priv->csr_lock); - dev_priv->csr.state = state; - mutex_unlock(&dev_priv->csr_lock); -} - -/** * intel_csr_load_program() - write the firmware from memory to register. * @dev: drm device. * @@ -252,7 +211,6 @@ void intel_csr_load_program(struct drm_device *dev) return; } - mutex_lock(&dev_priv->csr_lock); fw_size = dev_priv->csr.dmc_fw_size; for (i = 0; i < fw_size; i++) I915_WRITE(CSR_PROGRAM_BASE + i * 4, @@ -262,9 +220,6 @@ void intel_csr_load_program(struct drm_device *dev) I915_WRITE(dev_priv->csr.mmioaddr[i], dev_priv->csr.mmiodata[i]); } - - dev_priv->csr.state = FW_LOADED; - mutex_unlock(&dev_priv->csr_lock); } static void finish_csr_load(const struct firmware *fw, void *context) @@ -393,8 +348,6 @@ static void finish_csr_load(const struct firmware *fw, void *context) out: if (fw_loaded) intel_runtime_pm_put(dev_priv); - else - intel_csr_load_status_set(dev_priv, FW_FAILED); release_firmware(fw); } @@ -419,7 +372,6 @@ void intel_csr_ucode_init(struct drm_device *dev) csr->fw_path = I915_CSR_SKL; else { DRM_ERROR("Unexpected: no known CSR firmware for platform\n"); - intel_csr_load_status_set(dev_priv, FW_FAILED); return; } @@ -438,7 +390,6 @@ void intel_csr_ucode_init(struct drm_device *dev) finish_csr_load); if (ret) { i915_firmware_load_error_print(csr->fw_path, ret); - intel_csr_load_status_set(dev_priv, FW_FAILED); } } @@ -456,14 +407,11 @@ void intel_csr_ucode_fini(struct drm_device *dev) if (!HAS_CSR(dev)) return; - intel_csr_load_status_set(dev_priv, FW_FAILED); kfree(dev_priv->csr.dmc_payload); } void assert_csr_loaded(struct drm_i915_private *dev_priv) { - WARN(intel_csr_load_status_get(dev_priv) != FW_LOADED, - "CSR is not loaded.\n"); WARN(!I915_READ(CSR_PROGRAM_BASE), "CSR program storage start is NULL\n"); WARN(!I915_READ(CSR_SSP_BASE), "CSR SSP Base Not fine\n"); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 3f0a890..f437a90 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1163,9 +1163,6 @@ u32 skl_plane_ctl_rotation(unsigned int rotation); /* intel_csr.c */ void intel_csr_ucode_init(struct drm_device *dev); -enum csr_state intel_csr_load_status_get(struct drm_i915_private *dev_priv); -void intel_csr_load_status_set(struct drm_i915_private *dev_priv, - enum csr_state state); void intel_csr_load_program(struct drm_device *dev); void intel_csr_ucode_fini(struct drm_device *dev); void assert_csr_loaded(struct drm_i915_private *dev_priv); diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index 1a45385..0b81d6f 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c @@ -644,21 +644,10 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, if ((GEN9_ENABLE_DC5(dev) || SKL_ENABLE_DC6(dev)) && power_well->data == SKL_DISP_PW_2) { - enum csr_state state; - /* TODO: wait for a completion event or - * similar here instead of busy - * waiting using wait_for function. - */ - wait_for((state = intel_csr_load_status_get(dev_priv)) != - FW_UNINITIALIZED, 1000); - if (state != FW_LOADED) - DRM_ERROR("CSR firmware not ready (%d)\n", - state); + if (SKL_ENABLE_DC6(dev)) + skl_enable_dc6(dev_priv); else - if (SKL_ENABLE_DC6(dev)) - skl_enable_dc6(dev_priv); - else - gen9_enable_dc5(dev_priv); + gen9_enable_dc5(dev_priv); } } }
v1: As per review comments from Daniel, removed the csr-lock and csr-state which was used before in dmc firmware loading. Planning to have a single async task which will responsible for firmware loading and register programming for dc5/dc6, so removed csr-lock and csr-state from intel_csr structure. Signed-off-by: Animesh Manna <animesh.manna@intel.com> --- drivers/gpu/drm/i915/i915_dma.c | 1 - drivers/gpu/drm/i915/i915_drv.c | 6 ---- drivers/gpu/drm/i915/i915_drv.h | 10 ------- drivers/gpu/drm/i915/intel_csr.c | 52 --------------------------------- drivers/gpu/drm/i915/intel_drv.h | 3 -- drivers/gpu/drm/i915/intel_runtime_pm.c | 17 ++--------- 6 files changed, 3 insertions(+), 86 deletions(-)