Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Radhakrishna Sripada <radhakrishna.sripada@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Subject: Re: [PATCH v4] drm/i915: Show bios vbt when read from firmware/spi/oprom
Date: Fri, 01 Mar 2024 12:06:24 +0200	[thread overview]
Message-ID: <87le725krj.fsf@intel.com> (raw)
In-Reply-To: <20240301031457.2015603-1-radhakrishna.sripada@intel.com>

On Thu, 29 Feb 2024, Radhakrishna Sripada <radhakrishna.sripada@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.

The commit message (not just the changelog) should explain why the
runtime pm wakeref is needed.

I presume this only happens in spi_oprom_get_vbt() and/or
oprom_get_vbt() via debugfs, because we've not seen this before. So I'm
wondering about waking up the device for vbt debugfs for no reason in
the most common case, getting the vbt from opregion.

BR,
Jani.


>
> v2: Extract getting vbt from different sources to its own function.
>     Protect sysfs write with vbt check(Jani)
> v3: Fix CI error by probing bios vbt with runtime_pm wakeref
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 62 ++++++++++++-----------
>  1 file changed, 33 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 44c9dfe86a00..3260aab63875 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -3135,6 +3135,32 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *i915,
>  	return NULL;
>  }
>  
> +static const struct vbt_header *intel_bios_get_vbt(struct drm_i915_private *i915,
> +						   size_t *sizep)
> +{
> +	const struct vbt_header *vbt = NULL;
> +	intel_wakeref_t wakeref;
> +
> +	with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
> +		vbt = firmware_get_vbt(i915, sizep);
> +
> +		if (!vbt)
> +			vbt = intel_opregion_get_vbt(i915, sizep);
> +
> +		/*
> +		 * If the OpRegion does not have VBT, look in SPI flash
> +		 * through MMIO or PCI mapping
> +		 */
> +		if (!vbt && IS_DGFX(i915))
> +			vbt = spi_oprom_get_vbt(i915, sizep);
> +
> +		if (!vbt)
> +			vbt = oprom_get_vbt(i915, sizep);
> +	}
> +
> +	return vbt;
> +}
> +
>  /**
>   * intel_bios_init - find VBT and initialize settings from the BIOS
>   * @i915: i915 device instance
> @@ -3146,7 +3172,6 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *i915,
>  void intel_bios_init(struct drm_i915_private *i915)
>  {
>  	const struct vbt_header *vbt;
> -	struct vbt_header *oprom_vbt = NULL;
>  	const struct bdb_header *bdb;
>  
>  	INIT_LIST_HEAD(&i915->display.vbt.display_devices);
> @@ -3160,27 +3185,7 @@ void intel_bios_init(struct drm_i915_private *i915)
>  
>  	init_vbt_defaults(i915);
>  
> -	oprom_vbt = firmware_get_vbt(i915, NULL);
> -	vbt = oprom_vbt;
> -
> -	if (!vbt) {
> -		oprom_vbt = intel_opregion_get_vbt(i915, NULL);
> -		vbt = oprom_vbt;
> -	}
> -
> -	/*
> -	 * If the OpRegion does not have VBT, look in SPI flash through MMIO or
> -	 * PCI mapping
> -	 */
> -	if (!vbt && IS_DGFX(i915)) {
> -		oprom_vbt = spi_oprom_get_vbt(i915, NULL);
> -		vbt = oprom_vbt;
> -	}
> -
> -	if (!vbt) {
> -		oprom_vbt = oprom_get_vbt(i915, NULL);
> -		vbt = oprom_vbt;
> -	}
> +	vbt = intel_bios_get_vbt(i915, NULL);
>  
>  	if (!vbt)
>  		goto out;
> @@ -3213,7 +3218,7 @@ void intel_bios_init(struct drm_i915_private *i915)
>  	parse_sdvo_device_mapping(i915);
>  	parse_ddi_ports(i915);
>  
> -	kfree(oprom_vbt);
> +	kfree(vbt);
>  }
>  
>  static void intel_bios_init_panel(struct drm_i915_private *i915,
> @@ -3743,13 +3748,12 @@ static int intel_bios_vbt_show(struct seq_file *m, void *unused)
>  	const void *vbt;
>  	size_t vbt_size;
>  
> -	/*
> -	 * 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)
> +	vbt = intel_bios_get_vbt(i915, &vbt_size);
> +
> +	if (vbt) {
>  		seq_write(m, vbt, vbt_size);
> +		kfree(vbt);
> +	}
>  
>  	return 0;
>  }

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-03-01 10:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 21:32 [PATCH v3 0/6] VBT read cleanup Radhakrishna Sripada
2024-02-28 21:32 ` [PATCH v3 1/6] drm/i915: Pass size to oprom_get_vbt Radhakrishna Sripada
2024-02-28 21:32 ` [PATCH v3 2/6] drm/i915: Pass size to spi_oprom_get_vbt Radhakrishna Sripada
2024-02-28 21:32 ` [PATCH v3 3/6] drm/i915: Move vbt read from firmware to intel_bios.c Radhakrishna Sripada
2024-02-28 21:32 ` [PATCH v3 4/6] drm/i915: Extract opregion vbt presence check Radhakrishna Sripada
2024-03-12 11:05   ` Thomas Weißschuh
2024-03-12 12:01     ` Jani Nikula
2024-02-28 21:32 ` [PATCH v3 5/6] drm/i915: Duplicate opregion vbt memory Radhakrishna Sripada
2024-02-28 21:32 ` [PATCH v3 6/6] drm/i915: Show bios vbt when read from firmware/spi/oprom Radhakrishna Sripada
2024-03-01  3:14   ` [PATCH v4] " Radhakrishna Sripada
2024-03-01 10:06     ` Jani Nikula [this message]
2024-03-01 22:12     ` [PATCH v5] " Radhakrishna Sripada
2024-03-04  9:59       ` Jani Nikula
2024-03-04 21:23       ` [PATCH v6] " Radhakrishna Sripada
2024-02-29  3:31 ` ✗ Fi.CI.SPARSE: warning for VBT read cleanup Patchwork
2024-02-29  3:41 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-29 15:10 ` [PATCH v3 0/6] " Jani Nikula
2024-03-01  0:39 ` ✗ Fi.CI.IGT: failure for " Patchwork
2024-03-01  4:00 ` ✗ Fi.CI.SPARSE: warning for VBT read cleanup (rev2) Patchwork
2024-03-01  4:14 ` ✓ Fi.CI.BAT: success " Patchwork
2024-03-01 22:49 ` ✗ Fi.CI.SPARSE: warning for VBT read cleanup (rev3) Patchwork
2024-03-01 23:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-02  0:21 ` ✓ Fi.CI.BAT: success for VBT read cleanup (rev4) Patchwork
2024-03-02  0:21 ` ✗ Fi.CI.SPARSE: warning " Patchwork
2024-03-02  1:31 ` ✗ Fi.CI.IGT: failure for VBT read cleanup (rev2) Patchwork
2024-03-02 17:42 ` ✗ Fi.CI.IGT: failure for VBT read cleanup (rev4) Patchwork
2024-03-05  4:40 ` ✗ Fi.CI.SPARSE: warning for VBT read cleanup (rev5) Patchwork
2024-03-05  4:58 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-05  7:37 ` ✗ Fi.CI.SPARSE: warning for VBT read cleanup (rev6) Patchwork
2024-03-05  7:54 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-08 13:37 ` ✗ Fi.CI.SPARSE: warning for VBT read cleanup (rev7) Patchwork
2024-03-08 13:53 ` ✓ Fi.CI.BAT: success " Patchwork
2024-03-09  3:00 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-11 10:44 ` [PATCH v3 0/6] VBT read cleanup Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87le725krj.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=radhakrishna.sripada@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox