drm/i915: Always program CSR if CSR is uninitialized
Subsystems (2)
PATCH 1/1 drm/i915: Always program CSR if CSR is uninitialized
The current CSR loading code depends on the CSR program memory to be cleared after boot. This is unfortunately not true on all hardware. Instead make use of the FW_UNINITIALIZED state in init and check for FW_LOADED to prevent init path from skipping the actual programming.
--- drivers/gpu/drm/i915/intel_csr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_csr.c +3 -1
@@ -271,7 +271,7 @@ void intel_csr_load_program(struct drm_device *dev)* Unfortunately the ACPI subsystem doesn't yet give us a way to * differentiate this, hence figure it out with this hack. */ -if (I915_READ (CSR_PROGRAM (0 ))) +if (I915_READ (CSR_PROGRAM (0 )) && dev_priv->csr.state ==FW_LOADED )return ;mutex_lock (&dev_priv->csr_lock);
@@ -425,6 +425,8 @@ void intel_csr_ucode_init(struct drm_device *dev)struct intel_csr *csr = &dev_priv->csr;int ret; +intel_csr_load_status_set (dev_priv,FW_UNINITIALIZED ); +if (!HAS_CSR (dev))return ;
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
regarding your offline question: yes, I had your patch applied here, so
Quoted 24 lines · Patrik Jakobsson
The current CSR loading code depends on the CSR program memory to be cleared after boot. This is unfortunately not true on all hardware. Instead make use of the
FW_UNINITIALIZEDstate in init and check forFW_LOADEDto prevent init path from skipping the actual programming.Signed-off-by Patrik Jakobsson <[email protected]>--- drivers/gpu/drm/i915/intel_csr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_csr.c +1
-1@@ -271,7 +271,7 @@ void intel_csr_load_program(struct drm_device *dev)* Unfortunately the ACPI subsystem doesn't yet give us a way to * differentiate this, hence figure it out with this hack. */ -if (I915_READ (CSR_PROGRAM (0 ))) +if (I915_READ (CSR_PROGRAM (0 )) && dev_priv->csr.state ==FW_LOADED )return ;mutex_lock (&dev_priv->csr_lock);
drivers/gpu/drm/i915/intel_csr.c void intel_csr_ucode_init(struct drm_device *dev) · line 430
Quoted 6 lines
drivers/gpu/drm/i915/intel_csr.c +2
-0@@ -425,6 +425,8 @@ void intel_csr_ucode_init(struct drm_device *dev)struct intel_csr *csr = &dev_priv->csr;int ret; +intel_csr_load_status_set (dev_priv,FW_UNINITIALIZED ); +if (!HAS_CSR (dev))
My bikesheding here is that I like this kind of HAS_FEATURE() protection before anything else so we are always sure that useless code won't be executed in case you are running it on a platform that doesn't have this feature.
With this change also fell free to use a
Quoted 9 lines
drivers/gpu/drm/i915/intel_csr.c +0
-1return ; --2.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 33 lines · Rodrigo Vivi
regarding your offline question: yes, I had your patch applied here, so
Tested-by Rodrigo Vivi <[email protected]>Quoted 27 lines · Patrik Jakobsson
The current CSR loading code depends on the CSR program memory to be cleared after boot. This is unfortunately not true on all hardware. Instead make use of the
FW_UNINITIALIZEDstate in init and check forFW_LOADEDto prevent init path from skipping the actual programming.Signed-off-by Patrik Jakobsson <[email protected]>--- drivers/gpu/drm/i915/intel_csr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_csr.c +1
-1@@ -271,7 +271,7 @@ void intel_csr_load_program(struct drm_device *dev)* Unfortunately the ACPI subsystem doesn't yet give us a way to * differentiate this, hence figure it out with this hack. */ -if (I915_READ (CSR_PROGRAM (0 ))) +if (I915_READ (CSR_PROGRAM (0 )) && dev_priv->csr.state ==FW_LOADED )return ;mutex_lock (&dev_priv->csr_lock);@@ -425,6 +425,8 @@ void intel_csr_ucode_init(struct drm_device *dev)struct intel_csr *csr = &dev_priv->csr;int ret;
Quoted 8 lines
drivers/gpu/drm/i915/intel_csr.c void intel_csr_ucode_init(struct drm_device *dev) · line 430
Quoted 3 lines
drivers/gpu/drm/i915/intel_csr.c +2
-0+intel_csr_load_status_set (dev_priv,FW_UNINITIALIZED ); +if (!HAS_CSR (dev))My bikesheding here is that I like this kind of
HAS_FEATURE()protection before anything else so we are always sure that useless code won't be executed in case you are running it on a platform that doesn't have this feature.
This also crossed my mind. My reasoning was that it's nice to initialize this value instead of leaving it undefined but on the other hand FW_UNINITIALIZED = 0 so the untouched state is still good. I don't feel strongly about this so I'll change it and send out a v2.
Thanks for the review!
-Patrik
Quoted 16 lines
With this change also fell free to use a
Reviewed-by Rodrigo Vivi <[email protected]>Quoted 9 lines
drivers/gpu/drm/i915/intel_csr.c +0
-1return ; --2.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx