On Tue, 20 Feb 2024, Radhakrishna Sripada <radhakrishna.sripada@xxxxxxxxx> wrote: > Make debugfs vbt only shows valid vbt when read from ACPI opregion. > Make it work when read from firmware/spi/pci oprom cases. > > Cc: Jani Nikula <jani.nikula@xxxxxxxxx> > Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_bios.c | 30 +++++++++++++++++------ > 1 file changed, 23 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c > index 4cd338ed362d..b9b4ebc0ecd6 100644 > --- a/drivers/gpu/drm/i915/display/intel_bios.c > +++ b/drivers/gpu/drm/i915/display/intel_bios.c > @@ -3723,14 +3723,30 @@ 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; > > - /* > - * 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); > + 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; > + } We can't duplicate all of that, needs to be a single function that gets used in both intel_bios_init() and here. BR, Jani. > + > + if (!vbt) > + return 0; > + > + seq_write(m, vbt, vbt_size); > + > + if (need_cleanup) > + kfree(vbt); > > return 0; > } -- Jani Nikula, Intel