Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>, <lucas.demarchi@intel.com>
Subject: Re: [PATCH 04/10] drm/i915/display: change GMD ID display ip ver propagation at probe
Date: Wed, 22 May 2024 16:15:28 -0400	[thread overview]
Message-ID: <Zk5SYGeCoPY4gzBB@intel.com> (raw)
In-Reply-To: <1610e9f5675b4d0d4f16ecd10a86486ce309a283.1716399081.git.jani.nikula@intel.com>

On Wed, May 22, 2024 at 08:33:41PM +0300, Jani Nikula wrote:
> Add a name to the display ip version structure, and pass that around
> instead of a triplet of u16's.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  .../drm/i915/display/intel_display_device.c   | 40 ++++++++-----------
>  .../drm/i915/display/intel_display_device.h   |  2 +-
>  2 files changed, 17 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
> index f548a7b0ec23..56b27546d1b3 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> @@ -862,22 +862,14 @@ static const struct {
>  };
>  
>  static const struct intel_display_device_info *
> -probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step)
> +probe_gmdid_display(struct drm_i915_private *i915, struct intel_display_ip_ver *ip_ver)
>  {
>  	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
> +	struct intel_display_ip_ver gmd_id;

hmm... technically it is just d_id here. or perhaps gmd_id_disp ?

But I'm bad with nameing, so up to you:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


>  	void __iomem *addr;
>  	u32 val;
>  	int i;
>  
> -	/* The caller expects to ver, rel and step to be initialized
> -	 * here, and there's no good way to check when there was a
> -	 * failure and no_display was returned.  So initialize all these
> -	 * values here zero, to be sure.
> -	 */
> -	*ver = 0;
> -	*rel = 0;
> -	*step = 0;
> -
>  	addr = pci_iomap_range(pdev, 0, i915_mmio_reg_offset(GMD_ID_DISPLAY), sizeof(u32));
>  	if (!addr) {
>  		drm_err(&i915->drm, "Cannot map MMIO BAR to read display GMD_ID\n");
> @@ -892,17 +884,20 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step
>  		return NULL;
>  	}
>  
> -	*ver = REG_FIELD_GET(GMD_ID_ARCH_MASK, val);
> -	*rel = REG_FIELD_GET(GMD_ID_RELEASE_MASK, val);
> -	*step = REG_FIELD_GET(GMD_ID_STEP, val);
> +	gmd_id.ver = REG_FIELD_GET(GMD_ID_ARCH_MASK, val);
> +	gmd_id.rel = REG_FIELD_GET(GMD_ID_RELEASE_MASK, val);
> +	gmd_id.step = REG_FIELD_GET(GMD_ID_STEP, val);
>  
> -	for (i = 0; i < ARRAY_SIZE(gmdid_display_map); i++)
> -		if (*ver == gmdid_display_map[i].ver &&
> -		    *rel == gmdid_display_map[i].rel)
> +	for (i = 0; i < ARRAY_SIZE(gmdid_display_map); i++) {
> +		if (gmd_id.ver == gmdid_display_map[i].ver &&
> +		    gmd_id.rel == gmdid_display_map[i].rel) {
> +			*ip_ver = gmd_id;
>  			return gmdid_display_map[i].display;
> +		}
> +	}
>  
>  	drm_err(&i915->drm, "Unrecognized display IP version %d.%02d; disabling display.\n",
> -		*ver, *rel);
> +		gmd_id.ver, gmd_id.rel);
>  	return NULL;
>  }
>  
> @@ -927,7 +922,7 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>  {
>  	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>  	const struct intel_display_device_info *info;
> -	u16 ver, rel, step;
> +	struct intel_display_ip_ver ip_ver = {};
>  
>  	/* Add drm device backpointer as early as possible. */
>  	i915->display.drm = &i915->drm;
> @@ -940,7 +935,7 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>  	}
>  
>  	if (HAS_GMD_ID(i915))
> -		info = probe_gmdid_display(i915, &ver, &rel, &step);
> +		info = probe_gmdid_display(i915, &ip_ver);
>  	else
>  		info = probe_display(i915);
>  
> @@ -953,11 +948,8 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>  	       &DISPLAY_INFO(i915)->__runtime_defaults,
>  	       sizeof(*DISPLAY_RUNTIME_INFO(i915)));
>  
> -	if (HAS_GMD_ID(i915)) {
> -		DISPLAY_RUNTIME_INFO(i915)->ip.ver = ver;
> -		DISPLAY_RUNTIME_INFO(i915)->ip.rel = rel;
> -		DISPLAY_RUNTIME_INFO(i915)->ip.step = step;
> -	}
> +	if (ip_ver.ver || ip_ver.rel || ip_ver.step)
> +		DISPLAY_RUNTIME_INFO(i915)->ip = ip_ver;
>  
>  	return;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
> index 17ddf82f0b6e..fd2d03bfe8a6 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
> @@ -111,7 +111,7 @@ struct drm_printer;
>  	(DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until))
>  
>  struct intel_display_runtime_info {
> -	struct {
> +	struct intel_display_ip_ver {
>  		u16 ver;
>  		u16 rel;
>  		u16 step;
> -- 
> 2.39.2
> 

  reply	other threads:[~2024-05-22 20:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 17:33 [PATCH 00/10] drm/i915: identify all platforms in display probe Jani Nikula
2024-05-22 17:33 ` [PATCH 01/10] drm/i915/display: move params copy at probe earlier Jani Nikula
2024-05-22 19:53   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 02/10] drm/i915/display: change probe for no display case Jani Nikula
2024-05-22 19:57   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 03/10] drm/i915/display: check platforms without display one level higher Jani Nikula
2024-05-22 19:58   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 04/10] drm/i915/display: change GMD ID display ip ver propagation at probe Jani Nikula
2024-05-22 20:15   ` Rodrigo Vivi [this message]
2024-05-22 17:33 ` [PATCH 05/10] drm/i915/display: add platform descriptors Jani Nikula
2024-05-23 18:47   ` Rodrigo Vivi
2024-05-24  8:17     ` Jani Nikula
2024-05-24 14:04       ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 06/10] drm/i915: add LNL PCI IDs Jani Nikula
2024-05-23 18:31   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 07/10] drm/i915/display: change display probe to identify GMD ID based platforms Jani Nikula
2024-05-23 18:39   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 08/10] drm/i915/display: identify platforms with enum and name Jani Nikula
2024-05-23 18:38   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 09/10] drm/i915/display: add support for subplatforms Jani Nikula
2024-05-23 18:37   ` Rodrigo Vivi
2024-05-22 17:33 ` [PATCH 10/10] drm/i915/display: add probe message Jani Nikula
2024-05-23 18:33   ` Rodrigo Vivi
2024-05-22 18:14 ` [PATCH 00/10] drm/i915: identify all platforms in display probe Gustavo Sousa
2024-05-22 18:36   ` Jani Nikula
2024-05-22 19:48     ` Rodrigo Vivi
2024-05-22 18:19 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2024-05-22 18:27 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-23 14:12 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-30 10:55 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: identify all platforms in display probe (rev2) Patchwork
2024-05-30 10:55 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-05-30 11:04 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-31  1:57 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-31  8:28 ` [PATCH 00/10] drm/i915: identify all platforms in display probe 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=Zk5SYGeCoPY4gzBB@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@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