Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Violet Monti <violet.monti@intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/9] drm/xe: Add framework for info probing
Date: Tue, 16 Jun 2026 11:51:27 -0700	[thread overview]
Message-ID: <ajGbLyL1Is86P24D@vmonti-desk> (raw)
In-Reply-To: <20260609-xe-probe-info-v1-1-21e83e188e60@intel.com>

On Tue, Jun 09, 2026 at 05:17:33PM -0300, Gustavo Sousa wrote:
> Functions xe_info_init_early() and xe_info_init() currently probe some
> information from the hardware while doing initialization of info
> fields.  Besides mixing responsibilities, another issue from this
> approach is that kunit tests need to implement static stubs for the
> probing part.
> 
> Let's prepare the ground to ensuring that those functions stop probing
> the information from the hardware by creating the necessary framework
> for extracting the probing bits out of them.  Do that by creating a
> new struct type called xe_probed_info and the functions responsible
> for populating it.
> 
> In upcoming changes, we will gradually refactor the code so that all
> info needed by xe_info_init_early() and xe_info_init() that is probed
> from the hardware is passed to them via struct xe_probed_info.
> 
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>

Reviewed-by: Violet Monti <violet.monti@intel.com>

> ---
>  drivers/gpu/drm/xe/tests/xe_pci.c | 16 +++++++++++++--
>  drivers/gpu/drm/xe/xe_pci.c       | 41 +++++++++++++++++++++++++++++++++++----
>  2 files changed, 51 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c
> index 9240aff779da..51d032a9e01a 100644
> --- a/drivers/gpu/drm/xe/tests/xe_pci.c
> +++ b/drivers/gpu/drm/xe/tests/xe_pci.c
> @@ -338,13 +338,21 @@ static void fake_xe_info_probe_tile_count(struct xe_device *xe)
>  	/* Nothing to do, just use the statically defined value. */
>  }
>  
> +static int fake_probe_info(struct xe_device *xe,
> +			   struct xe_probed_info *probed_info)
> +{
> +	return 0;
> +}
> +
>  int xe_pci_fake_device_init(struct xe_device *xe)
>  {
>  	struct kunit *test = kunit_get_current_test();
>  	struct xe_pci_fake_data *data = test->priv;
> +	struct xe_probed_info probed_info = {};
>  	const struct pci_device_id *ent = pciidlist;
>  	const struct xe_device_desc *desc;
>  	const struct xe_subplatform_desc *subplatform_desc;
> +	int err;
>  
>  	if (!data) {
>  		desc = (const void *)ent->driver_data;
> @@ -379,8 +387,12 @@ int xe_pci_fake_device_init(struct xe_device *xe)
>  	kunit_activate_static_stub(test, xe_info_probe_tile_count,
>  				   fake_xe_info_probe_tile_count);
>  
> -	xe_info_init_early(xe, desc, subplatform_desc);
> -	xe_info_init(xe, desc);
> +	err = fake_probe_info(xe, &probed_info);
> +	if (err)
> +		return err;
> +
> +	xe_info_init_early(xe, desc, subplatform_desc, &probed_info);
> +	xe_info_init(xe, desc, &probed_info);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 78fc2e4dcfc6..7f1da6d25011 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -737,13 +737,27 @@ static void init_devid(struct xe_device *xe)
>  	xe->info.revid = pdev->revision;
>  }
>  
> +struct xe_probed_info {
> +	/* Nothing for now. */
> +};
> +
> +/*
> + * Probe from the hardware the info required by xe_info_init_early().
> + */
> +static int xe_probe_info_early(struct xe_device *xe,
> +			       struct xe_probed_info *probed_info)
> +{
> +	return 0;
> +}
> +
>  /*
>   * Initialize device info content that only depends on static driver_data
>   * passed to the driver at probe time from PCI ID table.
>   */
>  static int xe_info_init_early(struct xe_device *xe,
>  			      const struct xe_device_desc *desc,
> -			      const struct xe_subplatform_desc *subplatform_desc)
> +			      const struct xe_subplatform_desc *subplatform_desc,
> +			      struct xe_probed_info *probed_info)
>  {
>  	int err;
>  
> @@ -910,6 +924,15 @@ static struct xe_gt *alloc_media_gt(struct xe_tile *tile,
>  	return gt;
>  }
>  
> +/*
> + * Probe from the hardware the info required by xe_info_init().
> + */
> +static int xe_probe_info(struct xe_device *xe,
> +			 struct xe_probed_info *probed_info)
> +{
> +	return 0;
> +}
> +
>  /*
>   * Initialize device info content that does require knowledge about
>   * graphics / media IP version.
> @@ -917,7 +940,8 @@ static struct xe_gt *alloc_media_gt(struct xe_tile *tile,
>   * present in device info.
>   */
>  static int xe_info_init(struct xe_device *xe,
> -			const struct xe_device_desc *desc)
> +			const struct xe_device_desc *desc,
> +			struct xe_probed_info *probed_info)
>  {
>  	u32 graphics_gmdid_revid = 0, media_gmdid_revid = 0;
>  	const struct xe_ip *graphics_ip;
> @@ -1073,6 +1097,7 @@ static void xe_pci_remove(struct pci_dev *pdev)
>   */
>  static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  {
> +	struct xe_probed_info probed_info = {};
>  	const struct xe_device_desc *desc = (const void *)ent->driver_data;
>  	const struct xe_subplatform_desc *subplatform_desc;
>  	struct xe_device *xe;
> @@ -1117,7 +1142,11 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	pci_set_master(pdev);
>  
> -	err = xe_info_init_early(xe, desc, subplatform_desc);
> +	err = xe_probe_info_early(xe, &probed_info);
> +	if (err)
> +		return err;
> +
> +	err = xe_info_init_early(xe, desc, subplatform_desc, &probed_info);
>  	if (err)
>  		return err;
>  
> @@ -1136,7 +1165,11 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (err)
>  		return err;
>  
> -	err = xe_info_init(xe, desc);
> +	err = xe_probe_info(xe, &probed_info);
> +	if (err)
> +		return err;
> +
> +	err = xe_info_init(xe, desc, &probed_info);
>  	if (err)
>  		return err;
>  
> 
> -- 
> 2.53.0
> 

-- 
--
Violet Monti

  reply	other threads:[~2026-06-16 18:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 20:17 [PATCH 0/9] drm/xe: Probe info outside of xe_info_init() and xe_info_init_early() Gustavo Sousa
2026-06-09 20:17 ` [PATCH 1/9] drm/xe: Add framework for info probing Gustavo Sousa
2026-06-16 18:51   ` Violet Monti [this message]
2026-06-16 21:56   ` Matt Roper
2026-06-17 12:43     ` Gustavo Sousa
2026-06-09 20:17 ` [PATCH 2/9] drm/xe/step: Pass xe_step_info to xe_step_*_get() functions Gustavo Sousa
2026-06-16 19:31   ` Violet Monti
2026-06-09 20:17 ` [PATCH 3/9] drm/xe: Add devid and revid to xe_probed_info Gustavo Sousa
2026-06-16 19:33   ` Violet Monti
2026-06-09 20:17 ` [PATCH 4/9] drm/xe/step: Make xe_step_platform_get() independent from xe->info Gustavo Sousa
2026-06-16 19:37   ` Violet Monti
2026-06-09 20:17 ` [PATCH 5/9] drm/xe: Add platform-level step info to xe_probed_info Gustavo Sousa
2026-06-16 19:50   ` Violet Monti
2026-06-09 20:17 ` [PATCH 6/9] drm/xe/tests: Set non-GMDID graphics step in xe_pci_fake_device_init() Gustavo Sousa
2026-06-16 19:58   ` Violet Monti
2026-06-09 20:17 ` [PATCH 7/9] drm/xe: Add graphics/media IPs and their step info to xe_probed_info Gustavo Sousa
2026-06-16 20:22   ` Violet Monti
2026-06-09 20:17 ` [PATCH 8/9] drm/xe: Don't initialize tile_count in xe_info_init_early() Gustavo Sousa
2026-06-16 21:07   ` Violet Monti
2026-06-09 20:17 ` [PATCH 9/9] drm/xe: Add tile_count to xe_probed_info Gustavo Sousa
2026-06-16 21:16   ` Violet Monti
2026-06-09 20:58 ` ✓ CI.KUnit: success for drm/xe: Probe info outside of xe_info_init() and xe_info_init_early() Patchwork
2026-06-09 22:06 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-10 12:22 ` ✗ Xe.CI.FULL: failure " 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=ajGbLyL1Is86P24D@vmonti-desk \
    --to=violet.monti@intel.com \
    --cc=gustavo.sousa@intel.com \
    --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