[PATCH v2 4/4] drm/i915: Show bios vbt when read from firmware/spi/oprom

Jani Nikula jani.nikula at linux.intel.com
Tue Feb 27 12:43:34 UTC 2024


On Tue, 20 Feb 2024, Radhakrishna Sripada <radhakrishna.sripada at intel.com> 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 at intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada at intel.com>
> ---
>  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


More information about the Intel-gfx mailing list