Skip to contentSkip to conversation

intel_opregion_get_panel_type potential bug fix

PATCH Sean Greenslade 3 participants 3 messages Aug 29, 2016 – Sep 14, 2016

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

Hello, all. I've been attempting to track down a bug with my Panasonic CF-30 laptop. I have a bug report[0] submitted.

In investigating the issue myself, I discovered that the root of the problem seemed to be that the new code for getting the panel type from the opregion seems to believe it is getting good data, but it is not. The function intel_opregion_get_panel_type (introduced in commit a05628195a0d, the one my bisect says caused this issue) seems to do some checks for validity, but apparently not enough.

I see there has already been a fix for one particular laptop[1], however my machine is not a Skylake so this fix does not apply to me. After reading over what Ville Syrjälä wrote in the patch notes for the get_panel_type function, I went and read part of the intel spec[2] that describes this data, and found a discrepancy that I don't fully understand. On page 106 of [2], there is a table that describes the layout of the response that intel_opregion_get_panel_type parses for the panel type. Bit 17 is listed as reserved, must be zero. On my machine, that bit is set to one. Additionally, on my two other Intel graphics laptops that aren't exhibiting this issue, it is also set to one, however they both fail the existing sanity checks in the function and revert to the VBT entry.

But now I'm in a bit over my head. I've attached the patch (applies to drm-intel-nightly) that I used to get the full u32 response of the swsci lookup, as well as a tentative fix. My fix checks for the reserved bit being set incorrectly and reverts to using the VBT entry. This fixes the regression on my CF-30, and doesn't hurt anything on my other two machines, but I have no newer machines to test it on. Can someone look this over and see if I'm taking the correct approach? Additionally, I would love to know if anyone has any more information on why the reserved bit is set (it was set on all three of my machines).

Thanks for your attention,

--Sean

[0]: https://bugs.freedesktop.org/show_bug.cgi?id=97443
[1]: https://lists.freedesktop.org/archives/intel-gfx/2016-July/100573.html
[2]: https://01.org/sites/default/files/documentation/acpi_igd_opregion_spec_0.pdf

drivers/gpu/drm/i915/intel_opregion.c +9 -0
index adca262..1c35eab 100644
@@ -1059,6 +1059,7 @@ intel_opregion_get_panel_type(struct drm_i915_private *dev_priv)
 			      ret);
 		return ret;
 	}
+	DRM_DEBUG_KMS("SEAN: panel_details: 0x%08x\n", panel_details);
 
 	ret = (panel_details >> 8) & 0xff;
 	if (ret > 0x10) {
@@ -1072,6 +1073,14 @@ intel_opregion_get_panel_type(struct drm_i915_private *dev_priv)
 		return -ENODEV;
 	}
 
+	/* Bit 17 is reserved and should be zero. Observed it set to one on
+	 * a Panasonic CF-30, where it also returns the incorrect panel type.
+	 */
+	if (panel_details & (1<<17)) {
+		DRM_DEBUG_KMS("Invalid panel details, ignoring OpRegion panel type (%d)\n", ret - 1);
+		return -ENODEV;
+	}
+
 	/*
 	 * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us
 	 * low vswing for eDP, whereas the VBT panel type (2) gives us normal

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

#1 lore raw

✓ Fi.CI.BAT: success for intel_opregion_get_panel_type potential bug fix

== Series Details ==

== Series Details ==

Series: intel_opregion_get_panel_type potential bug fix
URL : https://patchwork.freedesktop.org/series/11735/
State : success

== Summary ==

Series 11735v1 intel_opregion_get_panel_type potential bug fix
http://patchwork.freedesktop.org/api/1.0/series/11735/revisions/1/mbox/

fi-bdw-5557u     total:252  pass:235  dwarn:0   dfail:0   fail:2   skip:15 
fi-bsw-n3050     total:252  pass:205  dwarn:0   dfail:0   fail:1   skip:46 
fi-hsw-4770k     total:252  pass:228  dwarn:0   dfail:0   fail:2   skip:22 
fi-hsw-4770r     total:252  pass:224  dwarn:0   dfail:0   fail:2   skip:26 
fi-ivb-3520m     total:252  pass:220  dwarn:0   dfail:0   fail:1   skip:31 
fi-skl-6260u     total:252  pass:236  dwarn:0   dfail:0   fail:2   skip:14 
fi-skl-6700k     total:252  pass:222  dwarn:0   dfail:0   fail:2   skip:28 
fi-snb-2520m     total:252  pass:207  dwarn:0   dfail:0   fail:2   skip:43 
fi-snb-2600      total:252  pass:207  dwarn:0   dfail:0   fail:2   skip:43 

Results at /archive/results/CI_IGT_test/Patchwork_2448/

57de27e40b9741c17c6749a366e891faf8b22fcb drm-intel-nightly: 2016y-08m-29d-15h-38m-26s UTC integration manifest cb6ef47 intel_opregion_get_panel_type potential bug fix

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

maintainer
#2 lore raw
In reply to Sean Greenslade
Quoted 6 lines · Sean Greenslade

In investigating the issue myself, I discovered that the root of the problem seemed to be that the new code for getting the panel type from the opregion seems to believe it is getting good data, but it is not. The function intel_opregion_get_panel_type (introduced in commit a05628195a0d, the one my bisect says caused this issue) seems to do some checks for validity, but apparently not enough.

Fixed by

commit ea54ff4008892b46c7a3e6bc8ab8aaec9d198639

Author: Ville Syrjälä <[email protected]>
Date:   Tue Sep 13 12:22:19 2016 +0300

drm/i915: Ignore OpRegion panel type except on select machines

in drm-intel-fixes.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx