Skip to contentSkip to conversation

drm/i915: Handle HPD when it has actually occurred

RFC PATCH In review Sonika Jindal 5 participants 18 messages Jul 6, 2015 – Oct 1, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 drm/i915: Handle HPD when it has actually occurred

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Thanks,
Sonika

 drivers/gpu/drm/i915/i915_irq.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +6 -5
index a6fbe64..2d47372 100644
@@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	u32 dig_hotplug_reg;
 	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
-
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	if (hotplug_trigger) {
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 4 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

Quoted 8 lines

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Nice find, this sounds really intrigueing, at least for cpt/ibx platforms. I'm not sure whether what will happen with atom/i9xx platforms though since the irq bits are different there. But at least bxt has a FIXME comment that suggest we do need to save the sticky bits on those platforms too.

If we can fix this up for all platforms then I think a subsequent patch could try to re-enable the hpd checks in the hdmi ->detect function and make use spec compliant. Then after maybe 1-2 kernel releases of testing we'll know whether it really works.

But I'd really want to enable this everywhere just to have maximal test coverage - we did have reports on all platforms so it seems a generic issue.

Thanks, Daniel

Quoted 36 lines

Thanks,
Sonika

 drivers/gpu/drm/i915/i915_irq.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +6 -5
index a6fbe64..2d47372 100644
@@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	u32 dig_hotplug_reg;
 	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
-
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	if (hotplug_trigger) {
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.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
#2 lore raw
Quoted 20 lines · Daniel Vetter
Quoted 4 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

Quoted 8 lines

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Nice find, this sounds really intrigueing, at least for cpt/ibx platforms. I'm not sure whether what will happen with atom/i9xx platforms though since the irq bits are different there. But at least bxt has a FIXME comment that suggest we do need to save the sticky bits on those platforms too.

Quoted 9 lines

If we can fix this up for all platforms then I think a subsequent patch could try to re-enable the hpd checks in the hdmi ->detect function and make use spec compliant. Then after maybe 1-2 kernel releases of testing we'll know whether it really works.

But I'd really want to enable this everywhere just to have maximal test coverage - we did have reports on all platforms so it seems a generic issue.

I think only cpt/ibx suffer from this. Bxt already set port_hotplug_stat only when hpd occurs. Is there a process to get this checked on all platforms, which the fix I suggested? I can only test on SKL as of now.

Regards,
Sonika

Quoted 34 lines

Thanks, Daniel

Quoted 32 lines

Thanks,
Sonika

  drivers/gpu/drm/i915/i915_irq.c |   11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +6 -6
index a6fbe64..2d47372 100644
@@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
  	u32 dig_hotplug_reg;
  	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
-
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	if (hotplug_trigger) {
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
  	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
  		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
--

1.7.10.4

Quoted 5 lines
Quoted 4 lines

_______________________________________________
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

#3 lore raw
Quoted 32 lines · Sonika
Quoted 20 lines · Daniel Vetter
Quoted 4 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

Quoted 8 lines

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Nice find, this sounds really intrigueing, at least for cpt/ibx platforms. I'm not sure whether what will happen with atom/i9xx platforms though since the irq bits are different there. But at least bxt has a FIXME comment that suggest we do need to save the sticky bits on those platforms too.

Quoted 9 lines

If we can fix this up for all platforms then I think a subsequent patch could try to re-enable the hpd checks in the hdmi ->detect function and make use spec compliant. Then after maybe 1-2 kernel releases of testing we'll know whether it really works.

But I'd really want to enable this everywhere just to have maximal test coverage - we did have reports on all platforms so it seems a generic issue.

Quoted 5 lines

I think only cpt/ibx suffer from this. Bxt already set port_hotplug_stat only when hpd occurs.
Is there a process to get this checked on all platforms, which the fix I suggested?
I can only test on SKL as of now.

Right I was looking at an older version of the bxt hpd handler which still had a FIXME. But we probably still have an issue on bxt/i9xx interrupt handlers since when we've done the original revert to stop looking at the hpd live status bits in

commit 202adf4b9f5957b26a1cb97267d78e0edb319c5e

Author: Daniel Vetter <[email protected]>
Date:   Fri Feb 22 00:53:04 2013 +0100

drm/i915: Revert hdmi HDP pin checks

we had reports from both ibx/cpt systems and g4x. And vlv/chv/bxt hpd seems derived from that (with live status, enable and status all smashed into one register).

Therefore I guess that we need a similar fix of only carefully clearing status bits on these platforms too. I have no idea what it is though, might be good to check how exactly windows is handling hpd on these atom platfroms.
-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
#4 lore raw
In reply to Sonika Jindal
Quoted 28 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Thanks,
Sonika

 drivers/gpu/drm/i915/i915_irq.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -1
index a6fbe64..2d47372 100644
@@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	u32 dig_hotplug_reg;
 	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);

drivers/gpu/drm/i915/i915_irq.c static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1768

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +6 -4
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
-
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	if (hotplug_trigger) {
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}

Deja vu. I think I have the same patch (also for IBX) in my stalled (and never posted) port A HPD branch. So yeah, I think this makes sense.

You can also move the dig_hotplug_reg, pin_mask, and long_mask declarations into the if block since they're not needed elsewhere.

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 44 lines · Ville Syrjälä
Quoted 28 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Thanks,
Sonika

  drivers/gpu/drm/i915/i915_irq.c |   11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -1
index a6fbe64..2d47372 100644
@@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
  	u32 dig_hotplug_reg;
  	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);

drivers/gpu/drm/i915/i915_irq.c static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1768

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +6 -4
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
-
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	if (hotplug_trigger) {
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}

Deja vu. I think I have the same patch (also for IBX) in my stalled (and never posted) port A HPD branch. So yeah, I think this makes sense.

Quoted 2 lines

You can also move the dig_hotplug_reg, pin_mask, and long_mask declarations into the if block since they're not needed elsewhere.

Sure. Do you think I should add this for ibx as well?

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +0 -1
  	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
  		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
--

1.7.10.4

Quoted 5 lines
Quoted 4 lines

_______________________________________________
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

#6 lore raw
Quoted 47 lines · Sonika
Quoted 44 lines · Ville Syrjälä
Quoted 28 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.

---
Hi,

I see we don't check for hotplug_trigger before processing the HPD for any of the platform. Is there any reason for this?
For SKL, if I let write to PCH_PORT_HOTPLUG happen for all interrupts, somehow this register gets an invalid value at one point and it zeroes it out. If I put this check before handling HPD, hotplug behaves fine.
Please let me know if you see any issue with this approach.

Thanks,
Sonika

  drivers/gpu/drm/i915/i915_irq.c |   11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -1
index a6fbe64..2d47372 100644
@@ -1760,11 +1760,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
  	u32 dig_hotplug_reg;
  	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);

drivers/gpu/drm/i915/i915_irq.c static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1768

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +6 -4
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
-
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	if (hotplug_trigger) {
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}

Deja vu. I think I have the same patch (also for IBX) in my stalled (and never posted) port A HPD branch. So yeah, I think this makes sense.

Quoted 3 lines
Quoted 2 lines

You can also move the dig_hotplug_reg, pin_mask, and long_mask declarations into the if block since they're not needed elsewhere.

Sure. Do you think I should add this for ibx as well?

Yes.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 1/1 drm/i915: Handle HPD when it has actually occurred

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins

---
 drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +17 -15
index a6fbe64..ba2c27c 100644
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
 	*pin_mask = 0;
 	*long_mask = 0;
 
-	if (!hotplug_trigger)
-		return;
-
 	for_each_hpd_pin(i) {
 		if ((hpd[i] & hotplug_trigger) == 0)
 			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_ibx);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#8 lore raw
Quoted 18 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins

---
 drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index a6fbe64..ba2c27c 100644

drivers/gpu/drm/i915/i915_irq.c static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask, · line 1271

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +0 -3
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
 	*pin_mask = 0;
 	*long_mask = 0;
 
-	if (!hotplug_trigger)
-		return;
-

Looks like BXT still depends on that. So you should change that too, or leave this in until someone else does it.

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +0 -4
 	for_each_hpd_pin(i) {
 		if ((hpd[i] & hotplug_trigger) == 0)
 			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1666

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +7 -2
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_ibx);

Indentation is fubar.

Quoted 13 lines
drivers/gpu/drm/i915/i915_irq.c +2 -3
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);

drivers/gpu/drm/i915/i915_irq.c static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1767

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +6 -3
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_cpt);

Ditto

With those fixed this is

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +2 -0
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 22 lines · Ville Syrjälä
Quoted 21 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins

---
  drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
  1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index a6fbe64..ba2c27c 100644
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
  	*pin_mask = 0;
  	*long_mask = 0;
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_irq.c static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask, · line 1271

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +0 -3
-	if (!hotplug_trigger)
-		return;
-

Looks like BXT still depends on that. So you should change that too, or leave this in until someone else does it.

No, for bxt, this function is called from bxt_hpd_handler which is called only when "tmp & BXT_DE_PORT_HOTPLUG_MASK" is non-zero. So, it this is fine for bxt.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/i915_irq.c +2 -4
  	for_each_hpd_pin(i) {
  		if ((hpd[i] & hotplug_trigger) == 0)
  			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	int pipe;
  	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_irq.c static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1666

Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +5 -2
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_ibx);

Indentation is fubar.

This was to avoid 80 char limit.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/i915_irq.c +4 -4
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
  	if (pch_iir & SDE_AUDIO_POWER_MASK) {
  		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	int pipe;
  	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_irq.c static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1767

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +4 -2
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_cpt);

Ditto

This was to avoid 80 char limit.

Quoted 11 lines

With those fixed this is

Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +2 -1
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
  	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
  		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
--

1.7.10.4

Quoted 5 lines
Quoted 4 lines

_______________________________________________
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

#10 lore raw
Quoted 31 lines · Sonika
Quoted 22 lines · Ville Syrjälä
Quoted 21 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins

---
  drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
  1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index a6fbe64..ba2c27c 100644
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
  	*pin_mask = 0;
  	*long_mask = 0;
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_irq.c static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask, · line 1271

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +0 -3
-	if (!hotplug_trigger)
-		return;
-

Looks like BXT still depends on that. So you should change that too, or leave this in until someone else does it.

Quoted 3 lines

No, for bxt, this function is called from bxt_hpd_handler which is called only when "tmp & BXT_DE_PORT_HOTPLUG_MASK" is non-zero. So, it this is fine for bxt.

Oh, right you are. No problem then.

Quoted 26 lines
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/i915/i915_irq.c +2 -4
  	for_each_hpd_pin(i) {
  		if ((hpd[i] & hotplug_trigger) == 0)
  			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	int pipe;
  	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_irq.c static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1666

Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +5 -2
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_ibx);

Indentation is fubar.

Quoted 1 line

This was to avoid 80 char limit.

You have it like this
+ pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+ dig_hotplug_reg, hpd_ibx);

and it should look like this
+ pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+ dig_hotplug_reg, hpd_ibx);

that is the arguments on following lines should line up after the opening '(' on the first line. Sane editors can do this automagically for you.

Quoted 45 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/i915_irq.c +4 -4
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
  	if (pch_iir & SDE_AUDIO_POWER_MASK) {
  		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	int pipe;
  	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_irq.c static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) · line 1767

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +4 -2
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_cpt);

Ditto

This was to avoid 80 char limit.

Quoted 16 lines

With those fixed this is

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +2 -1
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
  	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
  		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
--

1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 1/1 drm/i915: Handle HPD when it has actually occurred

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins
v4: Indentation (Ville)

---
 drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +17 -15
index a6fbe64..a897f68 100644
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
 	*pin_mask = 0;
 	*long_mask = 0;
 
-	if (!hotplug_trigger)
-		return;
-
 	for_each_hpd_pin(i) {
 		if ((hpd[i] & hotplug_trigger) == 0)
 			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				 dig_hotplug_reg, hpd_ibx);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				 dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw
Quoted 11 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins
v4: Indentation (Ville)

Queued for -next, thanks for the patch.
-Daniel

Quoted 72 lines
---
 drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +17 -15
index a6fbe64..a897f68 100644
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
 	*pin_mask = 0;
 	*long_mask = 0;
 
-	if (!hotplug_trigger)
-		return;
-
 	for_each_hpd_pin(i) {
 		if ((hpd[i] & hotplug_trigger) == 0)
 			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				 dig_hotplug_reg, hpd_ibx);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				 dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.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
maintainer
#13 lore raw
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Sonika Jindal

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)
v3: Add check for ibx/cpt both (Ville).
While at it, remove the redundant check for hotplug_trigger from pch_get_hpd_pins
v4: Indentation (Ville)

Quoted 4 lines
Quoted 2 lines

Queued for -next, thanks for the patch.

This patch, i.e.

commit aaf5ec2e51ab1d9c5e962b4728a1107ed3ff7a3e

Author: Sonika Jindal <[email protected]>
Date:   Wed Jul 8 17:07:47 2015 +0530

drm/i915: Handle HPD when it has actually occurred

causes *tons* of

[drm:gen8_irq_handler [i915]] *ERROR* The master control interrupt lied (SDE)!

at boot. Suspiciously this happens a lot when doing native AUX on the DP monitor.

Bug with dmesg is at https://bugs.freedesktop.org/show_bug.cgi?id=92084

BR,
Jani.

Quoted 83 lines

-Daniel

Quoted 72 lines
---
 drivers/gpu/drm/i915/i915_irq.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +17 -15
index a6fbe64..a897f68 100644
@@ -1266,9 +1266,6 @@ static void pch_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
 	*pin_mask = 0;
 	*long_mask = 0;
 
-	if (!hotplug_trigger)
-		return;
-
 	for_each_hpd_pin(i) {
 		if ((hpd[i] & hotplug_trigger) == 0)
 			continue;
@@ -1658,14 +1655,17 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_ibx);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				 dig_hotplug_reg, hpd_ibx);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				 dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.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
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#14 lore raw
In reply to Sonika Jindal

Task id: 6740 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  343/343              343/343

BYT -2 287/287 285/287
HSW 380/380 380/380
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*BYT igt@gem_partial_pwrite_pread@reads PASS(1) FAIL(1)
*BYT igt@gem_partial_pwrite_pread@reads-uncached PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

PATCH 1/1 drm/i915: Handle HPD when it has actually occurred

In reply to Ville Syrjälä

Writing to PCH_PORT_HOTPLUG for each interrupt is not required. Handle it only if hpd has actually occurred like we handle other interrupts.
v2: Make few variables local to if block (Ville)

---
 drivers/gpu/drm/i915/i915_irq.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +8 -6
index a6fbe64..cd504dc 100644
@@ -1757,14 +1757,16 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
-	u32 dig_hotplug_reg;
-	u32 pin_mask, long_mask;
 
-	dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
-	I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
 
-	pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, dig_hotplug_reg, hpd_cpt);
-	intel_hpd_irq_handler(dev, pin_mask, long_mask);
+		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
+		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
+		pch_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+						dig_hotplug_reg, hpd_cpt);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) {
 		int port = ffs((pch_iir & SDE_AUDIO_POWER_MASK_CPT) >>
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#16 lore raw

Task id: 6724 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  345/345              345/345

BYT -1 289/289 288/289
HSW 382/382 382/382
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*BYT igt@gem_partial_pwrite_pread@reads-uncached PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Tested-by on v1 1/1
#17 lore raw
In reply to Sonika Jindal

Task id: 6723 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  343/343              343/343

BYT -2 287/287 285/287
HSW 380/380 380/380
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*BYT igt@gem_partial_pwrite_pread@reads PASS(1) FAIL(1)
*BYT igt@gem_tiled_partial_pwrite_pread@reads PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx