Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>
Cc: <dnyaneshwar.bhadane@intel.com>,
	<dibin.moolakadan.subrahmanian@intel.com>, <imre.deak@intel.com>
Subject: Re: [PATCH] drm/i915/display: Skip unavailable power wells based on pipe mask
Date: Thu, 17 Jul 2025 09:02:45 -0300	[thread overview]
Message-ID: <175275376596.1809.4970039481532019393@intel.com> (raw)
In-Reply-To: <20250717051603.1036746-1-chaitanya.kumar.borah@intel.com>

Quoting Chaitanya Kumar Borah (2025-07-17 02:16:03-03:00)
>Some power wells are only relevant for certain display pipes. Add a check
>to ensure we only allocate and initialize power wells whose associated
>pipes are available on the platform.
>
>This avoids unnecessary mapping of power wells, particularly when platforms
>support a subset of pipes described in the power well descriptors.
>
>Suggested-by: Imre Deak <imre.deak@intel.com>
>Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
>---
> .../i915/display/intel_display_power_map.c    | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_display_power_map.c b/drivers/gpu/drm/i915/display/intel_display_power_map.c
>index 77268802b55e..ca73e4084354 100644
>--- a/drivers/gpu/drm/i915/display/intel_display_power_map.c
>+++ b/drivers/gpu/drm/i915/display/intel_display_power_map.c
>@@ -1748,6 +1748,16 @@ static void init_power_well_domains(const struct i915_power_well_instance *inst,
>                 for_each_power_well_instance_in_desc_list((_descs)->list, (_descs)->count, \
>                                                           (_desc), (_inst))
> 
>+static bool
>+is_power_well_available(struct intel_display *display, const struct i915_power_well_desc *desc)
>+{
>+        if (desc->irq_pipe_mask &&
>+            !(desc->irq_pipe_mask & DISPLAY_RUNTIME_INFO(display)->pipe_mask))

According to irq_pipe_mask's documentation, that member contains a "mask
of pipes whose IRQ logic is backed by the pw". I think we are
overloading the meaning of that field with this logic.

* Do we have guarantees that irq_pipe_mask will always be associated
  with the power well that powers the pipe?

* If the power well that has irq_pipe_mask is also used to power
  something else than the pipes, we could have issues if pipes in that
  mask are fused off.

I'm leaning more toward a solution that makes POWER_DOMAIN_INIT map to
POWER_DOMAIN_PIPE_* based on DISPLAY_RUNTIME_INFO(display)->pipe_mask. I
have some idea of how to do that without rewriting code to use a
hierarchical structure (which IMO would be ideal, but takes more
effort).

The idea is to, during runtime and initialization of the mapping, set
the bit respective to POWER_DOMAIN_INIT in each power well that has the
bit for POWER_DOMAIN_PIPE_* set for non-fused off pipes. That would
also require removing the POWER_DOMAIN_INIT from the static mapping for
power wells directly responsible for POWER_DOMAIN_PIPE_*.

--
Gustavo Sousa

>+                return false;
>+
>+        return true;
>+}
>+
> static int
> __set_power_wells(struct i915_power_domains *power_domains,
>                   const struct i915_power_well_desc_list *power_well_descs,
>@@ -1763,8 +1773,10 @@ __set_power_wells(struct i915_power_domains *power_domains,
>         int power_well_count = 0;
>         int plt_idx = 0;
> 
>-        for_each_power_well_instance(power_well_descs, power_well_descs_sz, desc_list, desc, inst)
>-                power_well_count++;
>+        for_each_power_well_instance(power_well_descs, power_well_descs_sz, desc_list, desc, inst) {
>+                if (is_power_well_available(display, desc))
>+                        power_well_count++;
>+        }
> 
>         power_domains->power_well_count = power_well_count;
>         power_domains->power_wells =
>@@ -1778,6 +1790,9 @@ __set_power_wells(struct i915_power_domains *power_domains,
>                 struct i915_power_well *pw = &power_domains->power_wells[plt_idx];
>                 enum i915_power_well_id id = inst->id;
> 
>+                if (!is_power_well_available(display, desc))
>+                        continue;
>+
>                 pw->desc = desc;
>                 drm_WARN_ON(display->drm,
>                             overflows_type(inst - desc->instances->list, pw->instance_idx));
>-- 
>2.25.1
>

  parent reply	other threads:[~2025-07-17 12:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  5:16 [PATCH] drm/i915/display: Skip unavailable power wells based on pipe mask Chaitanya Kumar Borah
2025-07-17  5:39 ` ✗ CI.checkpatch: warning for " Patchwork
2025-07-17  5:41 ` ✓ CI.KUnit: success " Patchwork
2025-07-17  7:09 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-17 12:02 ` Gustavo Sousa [this message]
2025-07-18 15:54   ` [PATCH] " Imre Deak
2025-07-18 16:33     ` Gustavo Sousa
2025-07-18 17:17       ` Imre Deak
2025-07-18 20:16         ` Gustavo Sousa
2025-07-19 10:37           ` Imre Deak
2025-07-21 14:17             ` Gustavo Sousa
2025-07-21 15:17             ` Borah, Chaitanya Kumar
2025-07-21 16:21               ` Imre Deak
2025-07-18  8:46 ` ✗ Xe.CI.Full: failure for " Patchwork

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=175275376596.1809.4970039481532019393@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=dibin.moolakadan.subrahmanian@intel.com \
    --cc=dnyaneshwar.bhadane@intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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