Skip to contentSkip to conversation

drm/i915: don't save/restore LBB on Gen5+

PATCH Applied Paulo Zanoni 7 participants 20 messages Sep 12, 2013 – Sep 16, 2013

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

PATCH 1/5 drm/i915: don't save/restore LBB on Gen5+

From: Paulo Zanoni <[email protected]>

Because this PCI config register doesn't exist on Gen5+.

---
 drivers/gpu/drm/i915/i915_suspend.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +6 -2
index 70db618..3538370 100644
@@ -340,7 +340,9 @@ int i915_save_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	pci_read_config_byte(dev->pdev, LBB, &dev_priv->regfile.saveLBB);
+	if (INTEL_INFO(dev)->gen <= 4)
+		pci_read_config_byte(dev->pdev, LBB,
+				     &dev_priv->regfile.saveLBB);
 
 	mutex_lock(&dev->struct_mutex);
 
@@ -390,7 +392,9 @@ int i915_restore_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	pci_write_config_byte(dev->pdev, LBB, dev_priv->regfile.saveLBB);
+	if (INTEL_INFO(dev)->gen <= 4)
+		pci_write_config_byte(dev->pdev, LBB,
+				      dev_priv->regfile.saveLBB);
 
 	mutex_lock(&dev->struct_mutex);
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/5 drm/i915: WARN if the DP aux read is too big

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so add a big WARN. In case we ever hit that WARN, we whould change the size of the reply array.

---
 drivers/gpu/drm/i915/intel_dp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +2 -0
index 20e468c..f30b691 100644
@@ -577,6 +577,8 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 
 	msg_bytes = 4;
 	reply_bytes = recv_bytes + 1;
+	if (WARN_ON(reply_bytes > sizeof(reply)))
+		return -E2BIG;
 
 	for (;;) {
 		ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes,
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 3/5 drm/i915: check for more ASLC interrupts

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Sometimes I see the "non asle set request??" message on my Haswell machine, so I decided to get the spec and see if some bits are missing from the mask. We do have some bits missing from the mask, so this patch adds them. But I still see the "non asle set request??" message on my machine :(

Also use the proper ASLC name to indicate the registers we're talking about.

---
 drivers/gpu/drm/i915/intel_opregion.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +22 -11
index c4fb2ae..a01e0f8 100644
@@ -117,12 +117,17 @@ struct opregion_asle {
 #define ASLE_ARDY_READY		(1 << 0)
 #define ASLE_ARDY_NOT_READY	(0 << 0)
 
-/* ASLE irq request bits */
-#define ASLE_SET_ALS_ILLUM     (1 << 0)
-#define ASLE_SET_BACKLIGHT     (1 << 1)
-#define ASLE_SET_PFIT          (1 << 2)
-#define ASLE_SET_PWM_FREQ      (1 << 3)
-#define ASLE_REQ_MSK           0xf
+/* ASLE Interrupt Command (ASLC) bits */
+#define ASLC_SET_ALS_ILLUM		(1 << 0)
+#define ASLC_SET_BACKLIGHT		(1 << 1)
+#define ASLC_SET_PFIT			(1 << 2)
+#define ASLC_SET_PWM_FREQ		(1 << 3)
+#define ASLC_SUPPORTED_ROTATION_ANGLES	(1 << 4)
+#define ASLC_BUTTON_ARRAY		(1 << 5)
+#define ASLC_CONVERTIBLE_INDICATOR	(1 << 6)
+#define ASLC_DOCKING_INDICATOR		(1 << 7)
+#define ASLC_ISCT_STATE_CHANGE		(1 << 8)
+#define ASLC_REQ_MSK			0x1ff
 
 /* response bits of ASLE irq request */
 #define ASLE_ALS_ILLUM_FAILED	(1<<10)
@@ -421,25 +426,31 @@ void intel_opregion_asle_intr(struct drm_device *dev)
 	if (!asle)
 		return;
 
-	asle_req = ioread32(&asle->aslc) & ASLE_REQ_MSK;
+	asle_req = ioread32(&asle->aslc) & ASLC_REQ_MSK;
 
 	if (!asle_req) {
 		DRM_DEBUG_DRIVER("non asle set request??\n");
 		return;
 	}
 
-	if (asle_req & ASLE_SET_ALS_ILLUM)
+	if (asle_req & ASLC_SET_ALS_ILLUM)
 		asle_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
 
-	if (asle_req & ASLE_SET_BACKLIGHT)
+	if (asle_req & ASLC_SET_BACKLIGHT)
 		asle_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
 
-	if (asle_req & ASLE_SET_PFIT)
+	if (asle_req & ASLC_SET_PFIT)
 		asle_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
 
-	if (asle_req & ASLE_SET_PWM_FREQ)
+	if (asle_req & ASLC_SET_PWM_FREQ)
 		asle_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
 
+	if (asle_req & (ASLC_SUPPORTED_ROTATION_ANGLES | ASLC_BUTTON_ARRAY |
+			ASLC_CONVERTIBLE_INDICATOR | ASLC_DOCKING_INDICATOR |
+			ASLC_ISCT_STATE_CHANGE)) {
+		DRM_DEBUG_DRIVER("ASLC interrupt not supported\n");
+	}
+
 	iowrite32(asle_stat, &asle->aslc);
 }
 
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 4/5 drm/i915: clear opregon->lid_state after we unmap it

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We don't seem to be using the pointer after it's unmapped, so this patch doesn't fix any bug I can reproduce.

---
 drivers/gpu/drm/i915/intel_opregion.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_opregion.c +1 -0
index a01e0f8..dd88c08 100644
@@ -668,6 +668,7 @@ void intel_opregion_fini(struct drm_device *dev)
 	opregion->swsci = NULL;
 	opregion->asle = NULL;
 	opregion->vbt = NULL;
+	opregion->lid_state = NULL;
 }
 
 static void swsci_setup(struct drm_device *dev)
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH 5/5 drm/i915: check for errors on i915_drm_thaw

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Before this patch, i915_drm_thaw would always return 0. After this patch, it returns the error code from __i915_drm_thaw(), since it's the only sub-function that can return an error code.

---
 drivers/gpu/drm/i915/i915_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index ec690ca..f6dc6b8 100644
@@ -650,7 +650,7 @@ static int i915_drm_thaw(struct drm_device *dev)
 		mutex_unlock(&dev->struct_mutex);
 	}
 
-	__i915_drm_thaw(dev);
+	error = __i915_drm_thaw(dev);
 
 	return error;
 }
Signature · 1 line
1.8.3.1
#14 lore raw

Re: [PATCH 5/5] drm/i915: check for errors on i915_drm_thaw

Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Before this patch, i915_drm_thaw would always return 0. After this patch, it returns the error code from __i915_drm_thaw(), since it's the only sub-function that can return an error code.

You could go a step further here and pass a parameter to __i915_drm_thaw() to unify the two thaw paths. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw

Re: [PATCH 2/5] drm/i915: WARN if the DP aux read is too big

In reply to Paulo Zanoni
Quoted 17 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so add a big WARN. In case we ever hit that WARN, we whould change the size of the reply array.

---
 drivers/gpu/drm/i915/intel_dp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 20e468c..f30b691 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_aux_native_read(struct intel_dp *intel_dp, · line 581

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -577,6 +577,8 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 
 	msg_bytes = 4;
 	reply_bytes = recv_bytes + 1;
+	if (WARN_ON(reply_bytes > sizeof(reply)))
+		return -E2BIG;

Meh, this would be a programming mistake, and coule be eliminated entirely with:

uint8_t reply[recv_bytes+1];
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Reviewed-by on v1 1/5
#18 lore raw
In reply to Paulo Zanoni
Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because this PCI config register doesn't exist on Gen5+.

Yep. Can't see it in configdb. Actually it's only listed there for CTG and CLN, which I guess makes sense as non-mobile platforms probably don't have backlights. For BLB and ELK it's listed as reserved and RO, so I guess it doesn't hurt to poke it on them. If I'm wrong we could probably slap on an IS_MOBILE() check there too. Older stuff doesn't exist in configdb, so that's as far back as I can go.

Quoted 37 lines
---
 drivers/gpu/drm/i915/i915_suspend.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +6 -2
index 70db618..3538370 100644
@@ -340,7 +340,9 @@ int i915_save_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	pci_read_config_byte(dev->pdev, LBB, &dev_priv->regfile.saveLBB);
+	if (INTEL_INFO(dev)->gen <= 4)
+		pci_read_config_byte(dev->pdev, LBB,
+				     &dev_priv->regfile.saveLBB);
 
 	mutex_lock(&dev->struct_mutex);
 
@@ -390,7 +392,9 @@ int i915_restore_state(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	pci_write_config_byte(dev->pdev, LBB, dev_priv->regfile.saveLBB);
+	if (INTEL_INFO(dev)->gen <= 4)
+		pci_write_config_byte(dev->pdev, LBB,
+				      dev_priv->regfile.saveLBB);
 
 	mutex_lock(&dev->struct_mutex);
 
Signature · 6 lines
1.8.3.1

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

PATCH 2/5 drm/i915: fix intel_dp_aux_native_read's reply array size

In reply to Chris Wilson

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so we may at some point in the future overflow the buffer.

My initial patch just added a WARN in case we were about to overflow the buffer, but Chris suggested to make the size of the array dynamic.

---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 20e468c..bf0b260 100644
@@ -564,7 +564,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 {
 	uint8_t msg[4];
 	int msg_bytes;
-	uint8_t reply[20];
+	uint8_t reply[recv_bytes + 1];
 	int reply_bytes;
 	uint8_t ack;
 	int ret;
Signature · 1 line
1.8.3.1
#15 lore raw

[PATCH 6/5] drm/i915: move more code to __i915_drm_thaw

In reply to Chris Wilson

From: Paulo Zanoni <[email protected]>

Both callers had code to sanitize the uncore and restore the GTT mappings just before calling __i915_drm_thaw, so Chris suggested I should unify the code.

---
 drivers/gpu/drm/i915/i915_drv.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)

I'm not sure if this is really what Chris had in mind, but it's an idea...

drivers/gpu/drm/i915/i915_drv.c +14 -25
index f6dc6b8..75e7550 100644
@@ -576,11 +576,20 @@ static void intel_resume_hotplug(struct drm_device *dev)
 	drm_helper_hpd_irq_event(dev);
 }
 
-static int __i915_drm_thaw(struct drm_device *dev)
+static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int error = 0;
 
+	intel_uncore_sanitize(dev);
+
+	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
+	    restore_gtt_mappings) {
+		mutex_lock(&dev->struct_mutex);
+		i915_gem_restore_gtt_mappings(dev);
+		mutex_unlock(&dev->struct_mutex);
+	}
+
 	i915_restore_state(dev);
 	intel_opregion_setup(dev);
 
@@ -640,19 +649,7 @@ static int __i915_drm_thaw(struct drm_device *dev)
 
 static int i915_drm_thaw(struct drm_device *dev)
 {
-	int error = 0;
-
-	intel_uncore_sanitize(dev);
-
-	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-		mutex_lock(&dev->struct_mutex);
-		i915_gem_restore_gtt_mappings(dev);
-		mutex_unlock(&dev->struct_mutex);
-	}
-
-	error = __i915_drm_thaw(dev);
-
-	return error;
+	return __i915_drm_thaw(dev, true);
 }
 
 int i915_resume(struct drm_device *dev)
@@ -668,20 +665,12 @@ int i915_resume(struct drm_device *dev)
 
 	pci_set_master(dev->pdev);
 
-	intel_uncore_sanitize(dev);
-
 	/*
 	 * Platforms with opregion should have sane BIOS, older ones (gen3 and
-	 * earlier) need this since the BIOS might clear all our scratch PTEs.
+	 * earlier) need to restore the GTT mappings since the BIOS might clear
+	 * all our scratch PTEs.
 	 */
-	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
-	    !dev_priv->opregion.header) {
-		mutex_lock(&dev->struct_mutex);
-		i915_gem_restore_gtt_mappings(dev);
-		mutex_unlock(&dev->struct_mutex);
-	}
-
-	ret = __i915_drm_thaw(dev);
+	ret = __i915_drm_thaw(dev, !dev_priv->opregion.header);
 	if (ret)
 		return ret;
 
Signature · 1 line
1.8.3.1
Reviewed-by
#16 lore raw

Re: [PATCH 6/5] drm/i915: move more code to __i915_drm_thaw

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Both callers had code to sanitize the uncore and restore the GTT mappings just before calling __i915_drm_thaw, so Chris suggested I should unify the code.

Slightly more tricky to prove would be that neither i915_restore_state() nor intel_opregion_setup depends upon the GTT (when modesetting is enabled) and so coalesce the check+lock into the main MODESET block. I think it's okay, there is a general ordering issue where we may point a few registers at the GTT before it is set, but I don't think they are used until afterwards. However, it is uncertain enough that I wouldn't reorder the code without the set of init flags Daniel keeps muttering on about to assert that we don't use partially restored state.

If Jesse wants to shave off a couple of microseconds from the resume time by doing so, he is more than welcome. :)

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
maintainer
#4 lore raw

Re: [PATCH 2/5] drm/i915: fix intel_dp_aux_native_read's reply array size

In reply to Paulo Zanoni
Quoted 8 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so we may at some point in the future overflow the buffer.

My initial patch just added a WARN in case we were about to overflow the buffer, but Chris suggested to make the size of the array dynamic.

VLA on stack in kernel gives me an uneasy feeling, but I'll survive.

intel_dp_aux_native_write() has a range check and an error return for this. Maybe make the same change there, and add a BUG_ON({send,recv}_bytes > 0x100) to both, since that's the max?

Jani.

Quoted 25 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 20e468c..bf0b260 100644
@@ -564,7 +564,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 {
 	uint8_t msg[4];
 	int msg_bytes;
-	uint8_t reply[20];
+	uint8_t reply[recv_bytes + 1];
 	int reply_bytes;
 	uint8_t ack;
 	int ret;
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#17 lore raw

Re: [PATCH 6/5] drm/i915: move more code to __i915_drm_thaw

In reply to Chris Wilson
Quoted 18 lines · Chris Wilson
Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Both callers had code to sanitize the uncore and restore the GTT mappings just before calling __i915_drm_thaw, so Chris suggested I should unify the code.

Slightly more tricky to prove would be that neither i915_restore_state() nor intel_opregion_setup depends upon the GTT (when modesetting is enabled) and so coalesce the check+lock into the main MODESET block. I think it's okay, there is a general ordering issue where we may point a few registers at the GTT before it is set, but I don't think they are used until afterwards. However, it is uncertain enough that I wouldn't reorder the code without the set of init flags Daniel keeps muttering on about to assert that we don't use partially restored state.

Quoted 4 lines

If Jesse wants to shave off a couple of microseconds from the resume time by doing so, he is more than welcome. :)

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#19 lore raw
In reply to Ville Syrjälä
Quoted 7 lines · Ville Syrjälä
Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because this PCI config register doesn't exist on Gen5+.

Quoted 8 lines

Yep. Can't see it in configdb. Actually it's only listed there for CTG and CLN, which I guess makes sense as non-mobile platforms probably don't have backlights. For BLB and ELK it's listed as reserved and RO, so I guess it doesn't hurt to poke it on them. If I'm wrong we could probably slap on an IS_MOBILE() check there too. Older stuff doesn't exist in configdb, so that's as far back as I can go.

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
maintainer
#10 lore raw

Re: [PATCH 3/5] drm/i915: check for more ASLC interrupts

In reply to Paulo Zanoni
Quoted 31 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Sometimes I see the "non asle set request??" message on my Haswell machine, so I decided to get the spec and see if some bits are missing from the mask. We do have some bits missing from the mask, so this patch adds them. But I still see the "non asle set request??" message on my machine :(

Also use the proper ASLC name to indicate the registers we're talking about.

---
 drivers/gpu/drm/i915/intel_opregion.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +1 -6
index c4fb2ae..a01e0f8 100644
@@ -117,12 +117,17 @@ struct opregion_asle {
 #define ASLE_ARDY_READY		(1 << 0)
 #define ASLE_ARDY_NOT_READY	(0 << 0)
 
-/* ASLE irq request bits */
-#define ASLE_SET_ALS_ILLUM     (1 << 0)
-#define ASLE_SET_BACKLIGHT     (1 << 1)
-#define ASLE_SET_PFIT          (1 << 2)
-#define ASLE_SET_PWM_FREQ      (1 << 3)
-#define ASLE_REQ_MSK           0xf
+/* ASLE Interrupt Command (ASLC) bits */

drivers/gpu/drm/i915/intel_opregion.c struct opregion_asle { · line 130

Quoted 10 lines
drivers/gpu/drm/i915/intel_opregion.c +10 -0
+#define ASLC_SET_ALS_ILLUM		(1 << 0)
+#define ASLC_SET_BACKLIGHT		(1 << 1)
+#define ASLC_SET_PFIT			(1 << 2)
+#define ASLC_SET_PWM_FREQ		(1 << 3)
+#define ASLC_SUPPORTED_ROTATION_ANGLES	(1 << 4)
+#define ASLC_BUTTON_ARRAY		(1 << 5)
+#define ASLC_CONVERTIBLE_INDICATOR	(1 << 6)
+#define ASLC_DOCKING_INDICATOR		(1 << 7)
+#define ASLC_ISCT_STATE_CHANGE		(1 << 8)
+#define ASLC_REQ_MSK			0x1ff

While at it, please also s/ASLE/ASLC/ on the response bits, and add the correspoinding response defines for the added bits above.

drivers/gpu/drm/i915/intel_opregion.c void intel_opregion_asle_intr(struct drm_device *dev) · line 432

Quoted 11 lines
drivers/gpu/drm/i915/intel_opregion.c +1 -1
 /* response bits of ASLE irq request */
 #define ASLE_ALS_ILLUM_FAILED	(1<<10)
@@ -421,25 +426,31 @@ void intel_opregion_asle_intr(struct drm_device *dev)
 	if (!asle)
 		return;
 
-	asle_req = ioread32(&asle->aslc) & ASLE_REQ_MSK;
+	asle_req = ioread32(&asle->aslc) & ASLC_REQ_MSK;
 
 	if (!asle_req) {
 		DRM_DEBUG_DRIVER("non asle set request??\n");

Maybe we should log the original ioread32(&asle->aslc) in this case.

Quoted 13 lines
drivers/gpu/drm/i915/intel_opregion.c +3 -3
 		return;
 	}
 
-	if (asle_req & ASLE_SET_ALS_ILLUM)
+	if (asle_req & ASLC_SET_ALS_ILLUM)
 		asle_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
 
-	if (asle_req & ASLE_SET_BACKLIGHT)
+	if (asle_req & ASLC_SET_BACKLIGHT)
 		asle_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
 
-	if (asle_req & ASLE_SET_PFIT)
+	if (asle_req & ASLC_SET_PFIT)

drivers/gpu/drm/i915/intel_opregion.c void intel_opregion_asle_intr(struct drm_device *dev) · line 451

Quoted 10 lines
drivers/gpu/drm/i915/intel_opregion.c +5 -1
 		asle_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
 
-	if (asle_req & ASLE_SET_PWM_FREQ)
+	if (asle_req & ASLC_SET_PWM_FREQ)
 		asle_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
 
+	if (asle_req & (ASLC_SUPPORTED_ROTATION_ANGLES | ASLC_BUTTON_ARRAY |
+			ASLC_CONVERTIBLE_INDICATOR | ASLC_DOCKING_INDICATOR |
+			ASLC_ISCT_STATE_CHANGE)) {
+		DRM_DEBUG_DRIVER("ASLC interrupt not supported\n");

Should we report failure for these, similar to what everything other than the backlight request do?

BR,
Jani.

Quoted 12 lines
drivers/gpu/drm/i915/intel_opregion.c +2 -0
+	}
+
 	iowrite32(asle_stat, &asle->aslc);
 }
 
Signature · 6 lines
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#5 lore raw

Re: [PATCH 2/5] drm/i915: fix intel_dp_aux_native_read's reply array size

In reply to Jani Nikula
Quoted 11 lines · Jani Nikula
Quoted 8 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so we may at some point in the future overflow the buffer.

My initial patch just added a WARN in case we were about to overflow the buffer, but Chris suggested to make the size of the array dynamic.

VLA on stack in kernel gives me an uneasy feeling, but I'll survive.

IIRC sparse will complain about this. Might worth double checking.

Signature · 1 line
Damien
maintainer
#6 lore raw

Re: [PATCH 2/5] drm/i915: fix intel_dp_aux_native_read's reply array size

Quoted 8 lines · Damien Lespiau
Quoted 7 lines · Jani Nikula
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so we may at some point in the future overflow the buffer.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

My initial patch just added a WARN in case we were about to overflow the buffer, but Chris suggested to make the size of the array dynamic.

VLA on stack in kernel gives me an uneasy feeling, but I'll survive.

IIRC sparse will complain about this. Might worth double checking.

True.

CHECK drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dp.c:567:34: error: bad constant expression

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#7 lore raw

Re: [PATCH 2/5] drm/i915: fix intel_dp_aux_native_read's reply array size

Quoted 12 lines · Jani Nikula
Quoted 11 lines · Damien Lespiau
Quoted 10 lines · Jani Nikula
Quoted 8 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so we may at some point in the future overflow the buffer.

My initial patch just added a WARN in case we were about to overflow the buffer, but Chris suggested to make the size of the array dynamic.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

VLA on stack in kernel gives me an uneasy feeling, but I'll survive.

IIRC sparse will complain about this. Might worth double checking.

True.

CHECK drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dp.c:567:34: error: bad constant expression

Also,

https://lkml.org/lkml/2013/3/8/486

Signature · 1 line
Damein
Reviewed-by on v1 4/5
#12 lore raw

Re: [PATCH 4/5] drm/i915: clear opregon->lid_state after we unmap it

In reply to Paulo Zanoni

I think this is just the right thing to do, so:

Quoted 29 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

We don't seem to be using the pointer after it's unmapped, so this patch doesn't fix any bug I can reproduce.

---
 drivers/gpu/drm/i915/intel_opregion.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_opregion.c +1 -1
index a01e0f8..dd88c08 100644
@@ -668,6 +668,7 @@ void intel_opregion_fini(struct drm_device *dev)
        opregion->swsci = NULL;
        opregion->asle = NULL;
        opregion->vbt = NULL;
+       opregion->lid_state = NULL;
 }
 
 static void swsci_setup(struct drm_device *dev)
--

1.8.3.1

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

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#8 lore raw

Re: [PATCH 2/5] drm/i915: fix intel_dp_aux_native_read's reply array size

In reply to Damien Lespiau

2013/9/13 Damien Lespiau <[email protected]>:

Quoted 17 lines · Jani Nikula
Quoted 16 lines · Damien Lespiau
Quoted 14 lines · Jani Nikula
Quoted 11 lines · Paulo Zanoni
Quoted 8 lines

From: Paulo Zanoni <[email protected]>

So far we control all the reads an none of them exceeds the current limit of 20 bytes, but we never think about this when reviewing patches, so we may at some point in the future overflow the buffer.

My initial patch just added a WARN in case we were about to overflow the buffer, but Chris suggested to make the size of the array dynamic.

VLA on stack in kernel gives me an uneasy feeling, but I'll survive.

IIRC sparse will complain about this. Might worth double checking.

Quoted 8 lines
Quoted 4 lines

True.

CHECK drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dp.c:567:34: error: bad constant expression

Also,

https://lkml.org/lkml/2013/3/8/486

I just realized 20 bytes is really the maximum since we only have 5 data registers, so I'll bring back v1 of the patch, but with 2 additional checks: one spotted by Jani and one in intel_dp_aux_ch.

Quoted 3 lines

--
Damein

Signature · 1 line
Paulo Zanoni