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 v5] drm/i915: Show bios vbt when read from firmware/spi/oprom
Date: Mon, 04 Mar 2024 11:59:22 +0200 [thread overview]
Message-ID: <87edcq5nd1.fsf@intel.com> (raw)
In-Reply-To: <20240301221239.180884-1-radhakrishna.sripada@intel.com>
On Fri, 01 Mar 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. In the cases
> where VBT needs to be read from spi/pci oprom, take the wakeref to
> prevent WARN while reading DE registers during debugfs vbt dump.
>
> 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
> v4: Update commit message and skip waking up runtime while accessing
> vbt from opregion/firmware(Jani)
>
> 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..9a8c7fe381b0 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;
> +
> + 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
> + */
> + with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
> + if (!vbt && IS_DGFX(i915))
> + vbt = spi_oprom_get_vbt(i915, sizep);
> +
> + if (!vbt)
> + vbt = oprom_get_vbt(i915, sizep);
> + }
This will still enable power even if intel_opregion_get_vbt() returned a
non-NULL pointer.
BR,
Jani.
> +
> + 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
next prev parent reply other threads:[~2024-03-04 9:59 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
2024-03-01 22:12 ` [PATCH v5] " Radhakrishna Sripada
2024-03-04 9:59 ` Jani Nikula [this message]
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=87edcq5nd1.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