[PATCH v3 4/4] drm/i915: Show bios vbt when read from firmware/spi/oprom
Radhakrishna Sripada
radhakrishna.sripada at intel.com
Mon Feb 26 23:40:34 UTC 2024
Make debugfs vbt only shows valid vbt when read from ACPI opregion.
Make it work when read from firmware/spi/pci oprom cases.
v2: Protect sysfs write with vbt check
Cc: Jani Nikula <jani.nikula at intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada at intel.com>
---
drivers/gpu/drm/i915/display/intel_bios.c | 24 ++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 4cd338ed362d..a9c71afab5e7 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -3723,15 +3723,29 @@ static int intel_bios_vbt_show(struct seq_file *m, void *unused)
struct drm_i915_private *i915 = m->private;
const void *vbt;
size_t vbt_size;
+ bool need_cleanup = false;
+
+ vbt = firmware_get_vbt(i915, &vbt_size);
+
+ if (!vbt)
+ vbt = intel_opregion_get_vbt(i915, &vbt_size);
+
+ if (!vbt && IS_DGFX(i915)) {
+ vbt = spi_oprom_get_vbt(i915, &vbt_size);
+ need_cleanup = true;
+ }
+
+ if (!vbt) {
+ vbt = oprom_get_vbt(i915, &vbt_size);
+ need_cleanup = true;
+ }
- /*
- * FIXME: VBT might originate from other places than opregion, and then
- * this would be incorrect.
- */
- vbt = intel_opregion_get_vbt(i915, &vbt_size);
if (vbt)
seq_write(m, vbt, vbt_size);
+ if (need_cleanup)
+ kfree(vbt);
+
return 0;
}
--
2.34.1
More information about the Intel-gfx-trybot
mailing list