drm/i915, HD-audio: Don't continue probing when nomodeset is given
Subsystems (3)
PATCH 1/1 drm/i915, HD-audio: Don't continue probing when nomodeset is given
When a machine is booted with nomodeset option, i915 driver skips the whole initialization. Meanwhile, HD-audio tries to bind wth i915 just by request_symbol() without knowing that the initialization was skipped, and eventually it hits WARN_ON() in i915_request_power_well() and i915_release_power_well() wrongly but still continues probing, even though it doesn't work at all.
In this patch, both functions are changed to return an error in case of uninitialized state instead of WARN_ON(), so that HD-audio driver can give up HDMI controller initialization at the right time.
---
The bug actually exists since 3.11, but this commit will be applicable only to recent kernels due to ALSA and i915 code changes, that's why marked with [3.15] for stable.
drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++------ include/drm/i915_powerwell.h | 4 ++-- sound/pci/hda/hda_i915.c | 12 ++++++------ sound/pci/hda/hda_i915.h | 4 ++-- sound/pci/hda/hda_intel.c | 7 ++++++- 5 files changed, 24 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +8 -6
@@ -5706,30 +5706,32 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,static struct i915_power_domains *hsw_pwr;/* Display audio driver power well request */ -void i915_request_power_well (void ) +int i915_request_power_well (void ) {struct drm_i915_private *dev_priv; -if (WARN_ON (!hsw_pwr)) -return ; +if (!hsw_pwr) +return -ENODEV ; dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains);intel_display_power_get (dev_priv,POWER_DOMAIN_AUDIO ); +return 0 ; }EXPORT_SYMBOL_GPL (i915_request_power_well);/* Display audio driver power well release */ -void i915_release_power_well (void ) +int i915_release_power_well (void ) {struct drm_i915_private *dev_priv; -if (WARN_ON (!hsw_pwr)) -return ; +if (!hsw_pwr) +return -ENODEV ; dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains);intel_display_power_put (dev_priv,POWER_DOMAIN_AUDIO ); +return 0 ; }EXPORT_SYMBOL_GPL (i915_release_power_well);
include/drm/i915_powerwell.h +2 -2
@@ -30,7 +30,7 @@#define _I915_POWERWELL_H_/* For use by hda_i915 driver */ -extern void i915_request_power_well (void ); -extern void i915_release_power_well (void ); +extern int i915_request_power_well (void ); +extern int i915_release_power_well (void );#endif /* _I915_POWERWELL_H_ */
sound/pci/hda/hda_i915.c +6 -6
@@ -22,20 +22,20 @@#include <drm/i915_powerwell.h> #include "hda_i915.h" -static void (*get_power)(void ); -static void (*put_power)(void ); +static int (*get_power)(void ); +static int (*put_power)(void ); -void hda_display_power (bool enable) +int hda_display_power (bool enable) {if (!get_power || !put_power) -return ; +return -ENODEV ;pr_debug ("HDA display power %s \n" , enable ?"Enable" :"Disable" );if (enable) -get_power (); +return get_power ();else -put_power (); +return put_power (); }int hda_i915_init (void )
sound/pci/hda/hda_i915.h +2 -2
@@ -17,11 +17,11 @@#define __SOUND_HDA_I915_H#ifdef CONFIG_SND_HDA_I915 -void hda_display_power (bool enable); +int hda_display_power (bool enable);int hda_i915_init (void );int hda_i915_exit (void );#else -static inline void hda_display_power (bool enable) {} +static inline int hda_display_power (bool enable) {return 0 ; }static inline int hda_i915_init (void ) {return -ENODEV ;
sound/pci/hda/hda_intel.c +6 -1
@@ -1656,8 +1656,13 @@ static int azx_probe_continue(struct azx *chip) "Error request power-well from i915\n"); goto out_free; } + err =hda_display_power (true); +if (err <0 ) { +dev_err (chip->card->dev, +"Cannot turn on display power on i915\n" ); + goto out_free; + }#endif -hda_display_power (true); } err =azx_first_init (chip);
Signature · 1 line
1.9.3
Quoted 7 lines · Takashi Iwai
When a machine is booted with nomodeset option, i915 driver skips the whole initialization. Meanwhile, HD-audio tries to bind wth i915 just by
request_symbol()without knowing that the initialization was skipped, and eventually it hitsWARN_ON()ini915_request_power_well()andi915_release_power_well()wrongly but still continues probing, even though it doesn't work at all.
Quoted 6 lines
In this patch, both functions are changed to return an error in case of uninitialized state instead of
WARN_ON(), so that HD-audio driver can give up HDMI controller initialization at the right time.Cc <[email protected]> [3.15]Signed-off-by Takashi Iwai <[email protected]>
I guess you'll merge this through the sound tree?
-Daniel
Quoted 141 lines
---
The bug actually exists since 3.11, but this commit will be applicable only to recent kernels due to ALSA and i915 code changes, that's why marked with [3.15] for stable.
drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++------ include/drm/i915_powerwell.h | 4 ++-- sound/pci/hda/hda_i915.c | 12 ++++++------ sound/pci/hda/hda_i915.h | 4 ++-- sound/pci/hda/hda_intel.c | 7 ++++++- 5 files changed, 24 insertions(+), 17 deletions(-)drivers/gpu/drm/i915/intel_pm.c +8
-6@@ -5706,30 +5706,32 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,static struct i915_power_domains *hsw_pwr;/* Display audio driver power well request */ -void i915_request_power_well (void ) +int i915_request_power_well (void ) {struct drm_i915_private *dev_priv; -if (WARN_ON (!hsw_pwr)) -return ; +if (!hsw_pwr) +return -ENODEV ; dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains);intel_display_power_get (dev_priv,POWER_DOMAIN_AUDIO ); +return 0 ; }EXPORT_SYMBOL_GPL (i915_request_power_well);/* Display audio driver power well release */ -void i915_release_power_well (void ) +int i915_release_power_well (void ) {struct drm_i915_private *dev_priv; -if (WARN_ON (!hsw_pwr)) -return ; +if (!hsw_pwr) +return -ENODEV ; dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains);intel_display_power_put (dev_priv,POWER_DOMAIN_AUDIO ); +return 0 ; }EXPORT_SYMBOL_GPL (i915_release_power_well);include/drm/i915_powerwell.h +2
-2@@ -30,7 +30,7 @@#define _I915_POWERWELL_H_/* For use by hda_i915 driver */ -extern void i915_request_power_well (void ); -extern void i915_release_power_well (void ); +extern int i915_request_power_well (void ); +extern int i915_release_power_well (void );#endif /* _I915_POWERWELL_H_ */ sound/pci/hda/hda_i915.c +6
-6@@ -22,20 +22,20 @@#include <drm/i915_powerwell.h> #include "hda_i915.h" -static void (*get_power)(void ); -static void (*put_power)(void ); +static int (*get_power)(void ); +static int (*put_power)(void ); -void hda_display_power (bool enable) +int hda_display_power (bool enable) {if (!get_power || !put_power) -return ; +return -ENODEV ;pr_debug ("HDA display power %s \n" , enable ?"Enable" :"Disable" );if (enable) -get_power (); +return get_power ();else -put_power (); +return put_power (); }int hda_i915_init (void )sound/pci/hda/hda_i915.h +2
-2@@ -17,11 +17,11 @@#define __SOUND_HDA_I915_H#ifdef CONFIG_SND_HDA_I915 -void hda_display_power (bool enable); +int hda_display_power (bool enable);int hda_i915_init (void );int hda_i915_exit (void );#else -static inline void hda_display_power (bool enable) {} +static inline int hda_display_power (bool enable) {return 0 ; }static inline int hda_i915_init (void ) {return -ENODEV ;sound/pci/hda/hda_intel.c +6
-1@@ -1656,8 +1656,13 @@ static int azx_probe_continue(struct azx *chip) "Error request power-well from i915\n"); goto out_free; } + err =hda_display_power (true); +if (err <0 ) { +dev_err (chip->card->dev, +"Cannot turn on display power on i915\n" ); + goto out_free; + }#endif -hda_display_power (true); } err =azx_first_init (chip);Signature · 1 line
1.9.3
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
At Fri, 13 Jun 2014 18:07:06 +0200,
Quoted 13 lines · Daniel Vetter
Quoted 11 lines · Takashi Iwai
When a machine is booted with nomodeset option, i915 driver skips the whole initialization. Meanwhile, HD-audio tries to bind wth i915 just by
request_symbol()without knowing that the initialization was skipped, and eventually it hitsWARN_ON()ini915_request_power_well()andi915_release_power_well()wrongly but still continues probing, even though it doesn't work at all.In this patch, both functions are changed to return an error in case of uninitialized state instead of
WARN_ON(), so that HD-audio driver can give up HDMI controller initialization at the right time.
Quoted 6 lines
Quoted 2 lines
Cc <[email protected]> [3.15]Signed-off-by Takashi Iwai <[email protected]>Acked-by Daniel Vetter <[email protected]>I guess you'll merge this through the sound tree?
Yes, if you don't mind it.
thanks,
Takashi