drm/i915: hotplug cleanup saga continues
Subsystems (2)
cover drm/i915: hotplug cleanup saga continues
Some cleanups, but mostly move all platform independent, generic hotplug code to new intel_hotplug.c.
The expected follow-up would be to document hotplug with a DOC: comment and add kerneldoc for the most important functions.
BR,
Jani.
Jani Nikula (5):
drm/i915/irq: move hotplug even debug print to second connector loop drm/i915/irq: abstract irq storm hotplug disabling drm/i915/irq: clarify irq storm related function naming drm/i915: move generic hotplug code into new intel_hotplug.c file drm/i915: reduce line width in {pch,i9xx}_get_hpd_pins()
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 15 -- drivers/gpu/drm/i915/i915_drv.h | 9 +- drivers/gpu/drm/i915/i915_irq.c | 413 ++------------------------------ drivers/gpu/drm/i915/intel_hotplug.c | 452 +++++++++++++++++++++++++++++++++++ 5 files changed, 480 insertions(+), 410 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_hotplug.c
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 drm/i915/irq: move hotplug even debug print to second connector loop
The hotplug work function has two loops iterating over connectors, the first for handling hotplug disabling due to irq storms and the second for actually handling the hotplug events. Move the debug printing into the second one, so we can abstract the storm handling better. This may change the output ordering slightly when there are multiple simultaneous hotplug events.
--- drivers/gpu/drm/i915/i915_irq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +2 -4
@@ -917,10 +917,6 @@ static void i915_hotplug_work_func(struct work_struct *work) | DRM_CONNECTOR_POLL_DISCONNECT; hpd_disabled = true; } -if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { -DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , - connector->name, intel_encoder->hpd_pin); - } }/* if there were no outputs to poll, poll was disabled, * therefore make sure it's enabled when disabling HPD on
@@ -939,6 +935,8 @@ static void i915_hotplug_work_func(struct work_struct *work)continue ; intel_encoder = intel_connector->encoder;if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { +DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , + connector->name, intel_encoder->hpd_pin);if (intel_encoder->hot_plug) intel_encoder->hot_plug (intel_encoder);if (intel_hpd_irq_event (dev, connector))
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915/irq: move hotplug even debug print to second connector loop
Subject s/even/event/
Quoted 28 lines · Jani Nikula
The hotplug work function has two loops iterating over connectors, the first for handling hotplug disabling due to irq storms and the second for actually handling the hotplug events. Move the debug printing into the second one, so we can abstract the storm handling better. This may change the output ordering slightly when there are multiple simultaneous hotplug events.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-4@@ -917,10 +917,6 @@ static void i915_hotplug_work_func(struct work_struct *work) | DRM_CONNECTOR_POLL_DISCONNECT; hpd_disabled = true; } -if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { -DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , - connector->name, intel_encoder->hpd_pin); - } }/* if there were no outputs to poll, poll was disabled, * therefore make sure it's enabled when disabling HPD on
drivers/gpu/drm/i915/i915_irq.c static void i915_hotplug_work_func(struct work_struct *work) · line 939
Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0@@ -939,6 +935,8 @@ static void i915_hotplug_work_func(struct work_struct *work)continue ; intel_encoder = intel_connector->encoder;if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { +DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , + connector->name, intel_encoder->hpd_pin);
In light of other conversations, is reporting an irq (even a hotplug one) directly related to KMS? I think DRIVER is more specific in this case.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915/irq: move hotplug even debug print to second connector loop
Quoted 1 line · Chris Wilson
Subject s/even/event/
Oops.
Quoted 30 lines · Jani Nikula
Quoted 29 lines
The hotplug work function has two loops iterating over connectors, the first for handling hotplug disabling due to irq storms and the second for actually handling the hotplug events. Move the debug printing into the second one, so we can abstract the storm handling better. This may change the output ordering slightly when there are multiple simultaneous hotplug events.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-4@@ -917,10 +917,6 @@ static void i915_hotplug_work_func(struct work_struct *work) | DRM_CONNECTOR_POLL_DISCONNECT; hpd_disabled = true; } -if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { -DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , - connector->name, intel_encoder->hpd_pin); - } }/* if there were no outputs to poll, poll was disabled, * therefore make sure it's enabled when disabling HPD on @@ -939,6 +935,8 @@ static void i915_hotplug_work_func(struct work_struct *work)continue ;
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c static void i915_hotplug_work_func(struct work_struct *work) · line 939
Quoted 4 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0intel_encoder = intel_connector->encoder;if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { +DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , + connector->name, intel_encoder->hpd_pin);In light of other conversations, is reporting an irq (even a hotplug one) directly related to KMS? I think DRIVER is more specific in this case.
Perhaps; this patch was just about moving the call around. A more thorough cleanup of the debugging could be a follow-up.
BR,
Jani.
Quoted 4 lines
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/5] drm/i915/irq: move hotplug even debug print to second connector loop
Quoted 44 lines · Jani Nikula
Quoted 1 line · Chris Wilson
Subject s/even/event/
Oops.
Quoted 30 lines · Jani Nikula
Quoted 29 lines
The hotplug work function has two loops iterating over connectors, the first for handling hotplug disabling due to irq storms and the second for actually handling the hotplug events. Move the debug printing into the second one, so we can abstract the storm handling better. This may change the output ordering slightly when there are multiple simultaneous hotplug events.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_irq.c +0
-4@@ -917,10 +917,6 @@ static void i915_hotplug_work_func(struct work_struct *work) | DRM_CONNECTOR_POLL_DISCONNECT; hpd_disabled = true; } -if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { -DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , - connector->name, intel_encoder->hpd_pin); - } }/* if there were no outputs to poll, poll was disabled, * therefore make sure it's enabled when disabling HPD on @@ -939,6 +935,8 @@ static void i915_hotplug_work_func(struct work_struct *work)continue ;Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c static void i915_hotplug_work_func(struct work_struct *work) · line 939
Quoted 4 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0intel_encoder = intel_connector->encoder;if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) { +DRM_DEBUG_KMS ("Connector %s (pin %i) received hotplug event.\n" , + connector->name, intel_encoder->hpd_pin);In light of other conversations, is reporting an irq (even a hotplug one) directly related to KMS? I think DRIVER is more specific in this case.
Quoted 2 lines
Perhaps; this patch was just about moving the call around. A more thorough cleanup of the debugging could be a follow-up.
I was looking for filler, I didn't want to just send a spelling fix without at least some discussion of the patch! :)
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915/irq: abstract irq storm hotplug disabling
In reply to Jani NikulaContinue abstracting hotplug storm related functions to clarify the code. This time, abstract hotplug irq storm related hotplug disabling. While at it, clean up the loop iterating over connectors for readability.
--- drivers/gpu/drm/i915/i915_irq.c | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +50 -27
@@ -879,7 +879,7 @@ static void i915_digport_work_func(struct work_struct *work)/* * Handle hotplug events outside the interrupt handler proper. */ -#define I915_REENABLE_HOTPLUG_DELAY (2*60*1000) +static void intel_hpd_irq_storm_disable (struct drm_i915_private *dev_priv);static void i915_hotplug_work_func (struct work_struct *work) {
@@ -890,7 +890,6 @@ static void i915_hotplug_work_func(struct work_struct *work)struct intel_connector *intel_connector;struct intel_encoder *intel_encoder;struct drm_connector *connector; -bool hpd_disabled = false;bool changed = false;u32 hpd_event_bits;
@@ -901,31 +900,9 @@ static void i915_hotplug_work_func(struct work_struct *work) hpd_event_bits = dev_priv->hotplug.event_bits; dev_priv->hotplug.event_bits =0 ; -list_for_each_entry (connector, &mode_config->connector_list, head) { - intel_connector =to_intel_connector (connector); -if (!intel_connector->encoder) -continue ; - intel_encoder = intel_connector->encoder; -if (intel_encoder->hpd_pin >HPD_NONE && - dev_priv->hotplug.stats[intel_encoder->hpd_pin].state ==HPD_MARK_DISABLED && - connector->polled ==DRM_CONNECTOR_POLL_HPD ) { -DRM_INFO ("HPD interrupt storm detected on connector %s: " -"switching from hotplug detection to polling\n" , - connector->name); - dev_priv->hotplug.stats[intel_encoder->hpd_pin].state =HPD_DISABLED ; - connector->polled =DRM_CONNECTOR_POLL_CONNECT - |DRM_CONNECTOR_POLL_DISCONNECT ; - hpd_disabled = true; - } - } -/* if there were no outputs to poll, poll was disabled, -* therefore make sure it's enabled when disabling HPD on -* some connectors */ -if (hpd_disabled) { -drm_kms_helper_poll_enable (dev); -mod_delayed_work (system_wq, &dev_priv->hotplug.reenable_work, -msecs_to_jiffies (I915_REENABLE_HOTPLUG_DELAY )); - } + +/* Disable hotplug on connectors that hit an irq storm. */ +intel_hpd_irq_storm_disable (dev_priv);spin_unlock_irq (&dev_priv->irq_lock);
@@ -1411,6 +1388,52 @@ static bool intel_hpd_irq_storm(struct drm_i915_private *dev_priv,return storm; } +#define I915_REENABLE_HOTPLUG_DELAY (2*60*1000) + +static void intel_hpd_irq_storm_disable (struct drm_i915_private *dev_priv) +{ +struct drm_device *dev = dev_priv->dev; +struct drm_mode_config *mode_config = &dev->mode_config; +struct intel_connector *intel_connector; +struct intel_encoder *intel_encoder; +struct drm_connector *connector; +enum hpd_pin pin; +bool hpd_disabled = false; + +assert_spin_locked (&dev_priv->irq_lock); + +list_for_each_entry (connector, &mode_config->connector_list, head) { +if (connector->polled !=DRM_CONNECTOR_POLL_HPD ) +continue ; + + intel_connector =to_intel_connector (connector); + intel_encoder = intel_connector->encoder; +if (!intel_encoder) +continue ; + + pin = intel_encoder->hpd_pin; +if (pin ==HPD_NONE || + dev_priv->hotplug.stats[pin].state !=HPD_MARK_DISABLED ) +continue ; + +DRM_INFO ("HPD interrupt storm detected on connector %s: " +"switching from hotplug detection to polling\n" , + connector->name); + + dev_priv->hotplug.stats[pin].state =HPD_DISABLED ; + connector->polled =DRM_CONNECTOR_POLL_CONNECT + |DRM_CONNECTOR_POLL_DISCONNECT ; + hpd_disabled = true; + } + +/* Enable polling and queue hotplug re-enabling. */ +if (hpd_disabled) { +drm_kms_helper_poll_enable (dev); +mod_delayed_work (system_wq, &dev_priv->hotplug.reenable_work, +msecs_to_jiffies (I915_REENABLE_HOTPLUG_DELAY )); + } +} +static bool pch_port_hotplug_long_detect (enum port port,u32 val) {switch (port) {
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/5] drm/i915/irq: abstract irq storm hotplug disabling
Quoted 32 lines · Jani Nikula
Continue abstracting hotplug storm related functions to clarify the code. This time, abstract hotplug irq storm related hotplug disabling. While at it, clean up the loop iterating over connectors for readability.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-)drivers/gpu/drm/i915/i915_irq.c +1
-2@@ -879,7 +879,7 @@ static void i915_digport_work_func(struct work_struct *work)/* * Handle hotplug events outside the interrupt handler proper. */ -#define I915_REENABLE_HOTPLUG_DELAY (2*60*1000) +static void intel_hpd_irq_storm_disable (struct drm_i915_private *dev_priv);static void i915_hotplug_work_func (struct work_struct *work) {@@ -890,7 +890,6 @@ static void i915_hotplug_work_func(struct work_struct *work)struct intel_connector *intel_connector;struct intel_encoder *intel_encoder;struct drm_connector *connector; -bool hpd_disabled = false;bool changed = false;u32 hpd_event_bits;
drivers/gpu/drm/i915/i915_irq.c static void i915_hotplug_work_func(struct work_struct *work) · line 904
Quoted 4 lines
drivers/gpu/drm/i915/i915_irq.c +0
-1@@ -901,31 +900,9 @@ static void i915_hotplug_work_func(struct work_struct *work) hpd_event_bits = dev_priv->hotplug.event_bits; dev_priv->hotplug.event_bits =0 ; -list_for_each_entry (connector, &mode_config->connector_list, head) {
Random comment: We have piles of connector_list walking in probe codde, and DP MST adds/removes them without much thought really users of these. Dave? Do we need a connector_list spinlock?
Just grabbing one of the modeset locks won't cut it I think since it'll serialize way too much.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerRe: [Intel-gfx] [PATCH 2/5] drm/i915/irq: abstract irq storm hotplug disabling
Quoted 42 lines · Daniel Vetter
Quoted 32 lines · Jani Nikula
Continue abstracting hotplug storm related functions to clarify the code. This time, abstract hotplug irq storm related hotplug disabling. While at it, clean up the loop iterating over connectors for readability.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-)drivers/gpu/drm/i915/i915_irq.c +1
-2@@ -879,7 +879,7 @@ static void i915_digport_work_func(struct work_struct *work)/* * Handle hotplug events outside the interrupt handler proper. */ -#define I915_REENABLE_HOTPLUG_DELAY (2*60*1000) +static void intel_hpd_irq_storm_disable (struct drm_i915_private *dev_priv);static void i915_hotplug_work_func (struct work_struct *work) {@@ -890,7 +890,6 @@ static void i915_hotplug_work_func(struct work_struct *work)struct intel_connector *intel_connector;struct intel_encoder *intel_encoder;struct drm_connector *connector; -bool hpd_disabled = false;bool changed = false;u32 hpd_event_bits;drivers/gpu/drm/i915/i915_irq.c static void i915_hotplug_work_func(struct work_struct *work) · line 904
Quoted 4 lines
drivers/gpu/drm/i915/i915_irq.c +0
-1@@ -901,31 +900,9 @@ static void i915_hotplug_work_func(struct work_struct *work) hpd_event_bits = dev_priv->hotplug.event_bits; dev_priv->hotplug.event_bits =0 ; -list_for_each_entry (connector, &mode_config->connector_list, head) {Random comment: We have piles of
connector_listwalking in probe codde, and DP MST adds/removes them without much thought really users of these. Dave? Do we need aconnector_listspinlock?
Quoted 2 lines
Just grabbing one of the modeset locks won't cut it I think since it'll serialize way too much.
In my tree currently this code grabs mode_config->mutex, so it should be fine wrt
the connector list disappearing, as removing connectors is protected my mode_config->mutex
as well.
if we do add a spinlock, we need to be careful about dropping it and restarting the loops etc, as I would guess there are a fair few paths we don't want to descend
holding the spin lock, due to possible sleeping/scheduling etc.
I think the intel_hpd_irq_reenable_work is the one that stands out to me, the short
hotplug paths don't traverse connector lists deliberately to avoid the problem.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/5] drm/i915/irq: abstract irq storm hotplug disabling
Quoted 43 lines · Dave Airlie
Quoted 42 lines · Daniel Vetter
Quoted 32 lines · Jani Nikula
Continue abstracting hotplug storm related functions to clarify the code. This time, abstract hotplug irq storm related hotplug disabling. While at it, clean up the loop iterating over connectors for readability.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-)drivers/gpu/drm/i915/i915_irq.c +1
-2@@ -879,7 +879,7 @@ static void i915_digport_work_func(struct work_struct *work)/* * Handle hotplug events outside the interrupt handler proper. */ -#define I915_REENABLE_HOTPLUG_DELAY (2*60*1000) +static void intel_hpd_irq_storm_disable (struct drm_i915_private *dev_priv);static void i915_hotplug_work_func (struct work_struct *work) {@@ -890,7 +890,6 @@ static void i915_hotplug_work_func(struct work_struct *work)struct intel_connector *intel_connector;struct intel_encoder *intel_encoder;struct drm_connector *connector; -bool hpd_disabled = false;bool changed = false;u32 hpd_event_bits;drivers/gpu/drm/i915/i915_irq.c static void i915_hotplug_work_func(struct work_struct *work) · line 904
Quoted 4 lines
drivers/gpu/drm/i915/i915_irq.c +0
-1@@ -901,31 +900,9 @@ static void i915_hotplug_work_func(struct work_struct *work) hpd_event_bits = dev_priv->hotplug.event_bits; dev_priv->hotplug.event_bits =0 ; -list_for_each_entry (connector, &mode_config->connector_list, head) {Random comment: We have piles of
connector_listwalking in probe codde, and DP MST adds/removes them without much thought really users of these. Dave? Do we need aconnector_listspinlock?
Quoted 8 lines
Quoted 2 lines
Just grabbing one of the modeset locks won't cut it I think since it'll serialize way too much.
In my tree currently this code grabs
mode_config->mutex, so it should be fine wrt
the connector list disappearing, as removing connectors is protected mymode_config->mutex
as well.
Hm right I mixed things up and didn't realize this is protected by the mode_config->mutex.
Quoted 8 lines
if we do add a spinlock, we need to be careful about dropping it and restarting the loops etc, as I would guess there are a fair few paths we don't want to descend
holding the spin lock, due to possible sleeping/scheduling etc.I think the
intel_hpd_irq_reenable_workis the one that stands out to me, the short
hotplug paths don't traverse connector lists deliberately to avoid the problem.
I think grabbing the mode_config->mutex in there should be fine. Looks like we can stretch just grabbing mode_config->mutex for a bit longer ;-) Jani, can you perhaps throw this in with your next round of hpd cleanup? -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915/irq: clarify irq storm related function naming
In reply to Jani NikulaWe'll have three functions:
intel_hpd_irq_storm_detect for detecting irq storms, intel_hpd_irq_storm_disable for disabling hotplugs after detected storms, intel_hpd_irq_storm_reenable_work for re-enabling hotplug.
No functional changes.
--- drivers/gpu/drm/i915/i915_irq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +6 -6
@@ -1350,7 +1350,7 @@ static irqreturn_t gen8_gt_irq_handler(struct drm_i915_private *dev_priv,#define HPD_STORM_THRESHOLD 5/** -* intel_hpd_irq_storm - gather stats and detect HPD irq storm on a pin +* intel_hpd_irq_storm_detect - gather stats and detect HPD irq storm on a pin * @dev_priv: private driver data pointer * @pin: the pin to gather stats on *
@@ -1364,8 +1364,8 @@ static irqreturn_t gen8_gt_irq_handler(struct drm_i915_private *dev_priv,* * Return true if an irq storm was detected on @pin. */ -static bool intel_hpd_irq_storm (struct drm_i915_private *dev_priv, -enum hpd_pin pin) +static bool intel_hpd_irq_storm_detect (struct drm_i915_private *dev_priv, +enum hpd_pin pin) {unsigned long start = dev_priv->hotplug.stats[pin].last_jiffies;unsigned long end = start +msecs_to_jiffies (HPD_STORM_DETECT_PERIOD );
@@ -1603,7 +1603,7 @@ static void intel_hpd_irq_handler(struct drm_device *dev, queue_hp = true; } -if (intel_hpd_irq_storm (dev_priv, i)) { +if (intel_hpd_irq_storm_detect (dev_priv, i)) { dev_priv->hotplug.event_bits &= ~BIT (i); storm_detected = true; }
@@ -4367,7 +4367,7 @@ static void i965_irq_uninstall(struct drm_device * dev)I915_WRITE (IIR ,I915_READ (IIR )); } -static void intel_hpd_irq_reenable_work (struct work_struct *work) +static void intel_hpd_irq_storm_reenable_work (struct work_struct *work) {struct drm_i915_private *dev_priv = container_of(work, typeof(*dev_priv),
@@ -4433,7 +4433,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)INIT_DELAYED_WORK (&dev_priv->gpu_error.hangcheck_work, i915_hangcheck_elapsed);INIT_DELAYED_WORK (&dev_priv->hotplug.reenable_work, - intel_hpd_irq_reenable_work); + intel_hpd_irq_storm_reenable_work);pm_qos_add_request (&dev_priv->pm_qos,PM_QOS_CPU_DMA_LATENCY ,PM_QOS_DEFAULT_VALUE );
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: move generic hotplug code into new intel_hotplug.c file
In reply to Jani NikulaWe have enough generic hotplug functions sprinkled all over i915_irq.c to warrant moving them to a file of their own. This should further underline the distinction between generic code in the new file and platform specific hotplug and irq code that remains in i915_irq.c.
Add new intel_hpd_init_work to keep work functions static, and rename get_port_from_pin to intel_hpd_pin_to_port while increasing its visibility, but keep everything else the same.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 15 -- drivers/gpu/drm/i915/i915_drv.h | 9 +- drivers/gpu/drm/i915/i915_irq.c | 409 +------------------------------ drivers/gpu/drm/i915/intel_hotplug.c | 452 +++++++++++++++++++++++++++++++++++ 5 files changed, 464 insertions(+), 422 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_hotplug.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -34,6 +34,7 @@ i915-y += i915_cmd_parser.o \ i915_gpu_error.o \ i915_irq.o \ i915_trace_points.o \ + intel_hotplug.o \ intel_lrc.o \ intel_ringbuffer.o \ intel_uncore.o
drivers/gpu/drm/i915/i915_drv.c +0 -15
@@ -541,21 +541,6 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)return true; } -void intel_hpd_cancel_work (struct drm_i915_private *dev_priv) -{ -spin_lock_irq (&dev_priv->irq_lock); - - dev_priv->hotplug.long_port_mask =0 ; - dev_priv->hotplug.short_port_mask =0 ; - dev_priv->hotplug.event_bits =0 ; - -spin_unlock_irq (&dev_priv->irq_lock); - -cancel_work_sync (&dev_priv->hotplug.dig_port_work); -cancel_work_sync (&dev_priv->hotplug.hotplug_work); -cancel_delayed_work_sync (&dev_priv->hotplug.reenable_work); -} -void i915_firmware_load_error_print (const char *fw_path,int err) {DRM_ERROR ("failed to load firmware %s (%d)\n" , fw_path, err);
drivers/gpu/drm/i915/i915_drv.h +7 -2
@@ -2600,9 +2600,15 @@ extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);extern unsigned long i915_gfx_val (struct drm_i915_private *dev_priv);extern void i915_update_gfx_val (struct drm_i915_private *dev_priv);int vlv_force_gfx_clock (struct drm_i915_private *dev_priv,bool on); -void intel_hpd_cancel_work (struct drm_i915_private *dev_priv);void i915_firmware_load_error_print (const char *fw_path,int err); +/* intel_hotplug.c */ +void intel_hpd_irq_handler (struct drm_device *dev,u32 pin_mask,u32 long_mask); +void intel_hpd_init (struct drm_i915_private *dev_priv); +void intel_hpd_init_work (struct drm_i915_private *dev_priv); +void intel_hpd_cancel_work (struct drm_i915_private *dev_priv); +enum port intel_hpd_pin_to_port (enum hpd_pin pin); +/* i915_irq.c */ void i915_queue_hangcheck (struct drm_device *dev);__printf (3 ,4 )
@@ -2610,7 +2616,6 @@ void i915_handle_error(struct drm_device *dev, bool wedged, const char *fmt, ...);extern void intel_irq_init (struct drm_i915_private *dev_priv); -extern void intel_hpd_init (struct drm_i915_private *dev_priv);int intel_irq_install (struct drm_i915_private *dev_priv);void intel_irq_uninstall (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_irq.c +4 -405
469 lines not on this page · raw message
drivers/gpu/drm/i915/intel_hotplug.c new file +452 -0
452 lines not on this page · raw message
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: reduce line width in {pch, i9xx}_get_hpd_pins()
In reply to Jani NikulaMake Paulo happier.
--- drivers/gpu/drm/i915/i915_irq.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +18 -11
@@ -1257,8 +1257,10 @@ static bool i9xx_port_hotplug_long_detect(enum port port, u32 val)/* Get a bit mask of pins that have triggered, and which ones may be long. */ static void pch_get_hpd_pins (u32 *pin_mask,u32 *long_mask, -u32 hotplug_trigger,u32 dig_hotplug_reg,const u32 hpd[HPD_NUM_PINS ]) +u32 hotplug_trigger,u32 dig_hotplug_reg, +const u32 hpd[HPD_NUM_PINS ]) { +enum port port;int i; *pin_mask =0 ;
@@ -1268,12 +1270,14 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,return ;for_each_hpd_pin (i) { -if (hpd[i] & hotplug_trigger) { - *pin_mask |=BIT (i); +if ((hpd[i] & hotplug_trigger) ==0 ) +continue ; -if (pch_port_hotplug_long_detect (intel_hpd_pin_to_port (i), dig_hotplug_reg)) - *long_mask |=BIT (i); - } + *pin_mask |=BIT (i); + + port =intel_hpd_pin_to_port (i); +if (pch_port_hotplug_long_detect (port, dig_hotplug_reg)) + *long_mask |=BIT (i); } DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x, dig 0x%08x, pins 0x%08x\n",
@@ -1285,6 +1289,7 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,static void i9xx_get_hpd_pins (u32 *pin_mask,u32 *long_mask,u32 hotplug_trigger,const u32 hpd[HPD_NUM_PINS ]) { +enum port port;int i; *pin_mask =0 ;
@@ -1294,12 +1299,14 @@ static void i9xx_get_hpd_pins(u32 *pin_mask, u32 *long_mask,return ;for_each_hpd_pin (i) { -if (hpd[i] & hotplug_trigger) { - *pin_mask |=BIT (i); +if ((hpd[i] & hotplug_trigger) ==0 ) +continue ; -if (i9xx_port_hotplug_long_detect (intel_hpd_pin_to_port (i), hotplug_trigger)) - *long_mask |=BIT (i); - } + *pin_mask |=BIT (i); + + port =intel_hpd_pin_to_port (i); +if (i9xx_port_hotplug_long_detect (port, hotplug_trigger)) + *long_mask |=BIT (i); } DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x, pins 0x%08x\n",
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: reduce line width in {pch, i9xx}_get_hpd_pins()
Quoted 1 line · Jani Nikula
Make Paulo happier.
Cc'ing Paulo next time around would help for him to appreciate this properly ;-)
-Daniel
Quoted 77 lines
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_irq.c +18
-11@@ -1257,8 +1257,10 @@ static bool i9xx_port_hotplug_long_detect(enum port port, u32 val)/* Get a bit mask of pins that have triggered, and which ones may be long. */ static void pch_get_hpd_pins (u32 *pin_mask,u32 *long_mask, -u32 hotplug_trigger,u32 dig_hotplug_reg,const u32 hpd[HPD_NUM_PINS ]) +u32 hotplug_trigger,u32 dig_hotplug_reg, +const u32 hpd[HPD_NUM_PINS ]) { +enum port port;int i; *pin_mask =0 ;@@ -1268,12 +1270,14 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,return ;for_each_hpd_pin (i) { -if (hpd[i] & hotplug_trigger) { - *pin_mask |=BIT (i); +if ((hpd[i] & hotplug_trigger) ==0 ) +continue ; -if (pch_port_hotplug_long_detect (intel_hpd_pin_to_port (i), dig_hotplug_reg)) - *long_mask |=BIT (i); - } + *pin_mask |=BIT (i); + + port =intel_hpd_pin_to_port (i); +if (pch_port_hotplug_long_detect (port, dig_hotplug_reg)) + *long_mask |=BIT (i); } DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x, dig 0x%08x, pins 0x%08x\n",@@ -1285,6 +1289,7 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,static void i9xx_get_hpd_pins (u32 *pin_mask,u32 *long_mask,u32 hotplug_trigger,const u32 hpd[HPD_NUM_PINS ]) { +enum port port;int i; *pin_mask =0 ;@@ -1294,12 +1299,14 @@ static void i9xx_get_hpd_pins(u32 *pin_mask, u32 *long_mask,return ;for_each_hpd_pin (i) { -if (hpd[i] & hotplug_trigger) { - *pin_mask |=BIT (i); +if ((hpd[i] & hotplug_trigger) ==0 ) +continue ; -if (i9xx_port_hotplug_long_detect (intel_hpd_pin_to_port (i), hotplug_trigger)) - *long_mask |=BIT (i); - } + *pin_mask |=BIT (i); + + port =intel_hpd_pin_to_port (i); +if (i9xx_port_hotplug_long_detect (port, hotplug_trigger)) + *long_mask |=BIT (i); } DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x, pins 0x%08x\n",Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Jani Nikula
Some cleanups, but mostly move all platform independent, generic hotplug code to new
intel_hotplug.c.The expected follow-up would be to document hotplug with a DOC: comment and add kerneldoc for the most important functions.
Merged under the assumption that you'll deliver the promised kerneldoc ;-)
Thanks, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx