From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH 5/6] drm/xe/pm: Don't access device in init_early()
Date: Mon, 25 May 2026 15:47:13 -0300 [thread overview]
Message-ID: <8733zfiaxa.fsf@intel.com> (raw)
In-Reply-To: <20260525160529.15890-6-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> writes:
> We should separate software-only state initialization from anything
> else that requires access to the device's hardware. Extract d3cold
> capability detection into a new function. Add simple kernel-doc for
> updated functions here.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
> ---
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/xe/xe_device.c | 4 ++++
> drivers/gpu/drm/xe/xe_pci.c | 5 +----
> drivers/gpu/drm/xe/xe_pm.c | 27 ++++++++++++++++++++++++++-
> drivers/gpu/drm/xe/xe_pm.h | 1 +
> 4 files changed, 32 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 7ba407f73a02..d224861b6f6f 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -594,6 +594,10 @@ int xe_device_init_early(struct xe_device *xe)
> if (err)
> return err;
>
> + err = xe_pm_init_early(xe);
> + if (err)
> + return err;
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 6b1a4cb7ccb0..35e611cd2e29 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -1167,7 +1167,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> str_yes_no(xe_device_has_sriov(xe)),
> xe_sriov_mode_to_string(xe_device_sriov_mode(xe)));
>
> - err = xe_pm_init_early(xe);
> + err = xe_pm_probe(xe);
> if (err)
> return err;
>
> @@ -1179,9 +1179,6 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> if (err)
> goto err_driver_cleanup;
>
> - drm_dbg(&xe->drm, "d3cold: capable=%s\n",
> - str_yes_no(xe->d3cold.capable));
> -
> return 0;
>
> err_driver_cleanup:
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index d4672eb07476..5d1a3a26cb6e 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -24,6 +24,7 @@
> #include "xe_irq.h"
> #include "xe_late_bind_fw.h"
> #include "xe_pcode.h"
> +#include "xe_printk.h"
> #include "xe_pxp.h"
> #include "xe_sriov_vf_ccs.h"
> #include "xe_sysctrl.h"
> @@ -349,6 +350,15 @@ static void xe_pm_runtime_init(struct xe_device *xe)
> pm_runtime_put(dev);
> }
>
> +/**
> + * xe_pm_init_early() - Initialize Xe Power Management
> + * @xe: the &xe_device instance
> + *
> + * Initialize everything that is a "software-only" state that does not
> + * require access to any of the device's hardware data.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> int xe_pm_init_early(struct xe_device *xe)
> {
> int err;
> @@ -363,11 +373,26 @@ int xe_pm_init_early(struct xe_device *xe)
> if (err)
> return err;
>
> - xe->d3cold.capable = xe_pm_pci_d3cold_capable(xe);
> return 0;
> }
> ALLOW_ERROR_INJECTION(xe_pm_init_early, ERRNO); /* See xe_pci_probe() */
>
> +/**
> + * xe_pm_probe() - Initialize Xe Power Management
> + * @xe: the &xe_device instance
> + *
> + * Check d3cold capability.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_pm_probe(struct xe_device *xe)
> +{
> + xe->d3cold.capable = xe_pm_pci_d3cold_capable(xe);
> + xe_dbg(xe, "d3cold: capable=%s\n", str_yes_no(xe->d3cold.capable));
> +
> + return 0;
> +}
> +
> static u32 vram_threshold_value(struct xe_device *xe)
> {
> if (xe->info.platform == XE_BATTLEMAGE) {
> diff --git a/drivers/gpu/drm/xe/xe_pm.h b/drivers/gpu/drm/xe/xe_pm.h
> index 6b27039e7b2d..6d5ab09cb769 100644
> --- a/drivers/gpu/drm/xe/xe_pm.h
> +++ b/drivers/gpu/drm/xe/xe_pm.h
> @@ -17,6 +17,7 @@ int xe_pm_suspend(struct xe_device *xe);
> int xe_pm_resume(struct xe_device *xe);
>
> int xe_pm_init_early(struct xe_device *xe);
> +int xe_pm_probe(struct xe_device *xe);
> int xe_pm_init(struct xe_device *xe);
> void xe_pm_fini(struct xe_device *xe);
> bool xe_pm_runtime_suspended(struct xe_device *xe);
> --
> 2.47.1
next prev parent reply other threads:[~2026-05-25 18:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 16:05 [PATCH 0/6] drm/xe: Misc initialization improvements Michal Wajdeczko
2026-05-25 16:05 ` [PATCH 1/6] drm/xe: Drop unused param from xe_device_create() Michal Wajdeczko
2026-05-25 18:13 ` Raag Jadav
2026-05-25 18:45 ` Gustavo Sousa
2026-05-25 16:05 ` [PATCH 2/6] drm/xe: Move xe->info.force_execlist initialization Michal Wajdeczko
2026-05-25 18:46 ` Gustavo Sousa
2026-05-25 16:05 ` [PATCH 3/6] drm/xe: Move xe->info.devid|revid initialization Michal Wajdeczko
2026-05-25 17:47 ` Gustavo Sousa
2026-05-25 18:25 ` Michal Wajdeczko
2026-05-25 19:12 ` Gustavo Sousa
2026-05-25 19:41 ` [PATCH v2 " Michal Wajdeczko
2026-05-25 20:01 ` Gustavo Sousa
2026-05-25 16:05 ` [PATCH 4/6] drm/xe: Separate early xe_device initialization Michal Wajdeczko
2026-05-25 18:21 ` Gustavo Sousa
2026-05-25 18:57 ` Michal Wajdeczko
2026-05-25 19:05 ` Gustavo Sousa
2026-05-25 19:00 ` Gustavo Sousa
2026-05-25 19:14 ` Michal Wajdeczko
2026-05-25 18:22 ` Raag Jadav
2026-05-25 16:05 ` [PATCH 5/6] drm/xe/pm: Don't access device in init_early() Michal Wajdeczko
2026-05-25 18:30 ` Raag Jadav
2026-05-25 18:47 ` Gustavo Sousa [this message]
2026-05-27 15:46 ` Rodrigo Vivi
2026-05-25 16:05 ` [PATCH 6/6] drm/xe/pm: Do early initialization " Michal Wajdeczko
2026-05-25 18:47 ` Gustavo Sousa
2026-05-25 16:36 ` ✓ CI.KUnit: success for drm/xe: Misc initialization improvements Patchwork
2026-05-25 17:42 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-25 19:48 ` ✓ CI.KUnit: success for drm/xe: Misc initialization improvements (rev2) Patchwork
2026-05-25 20:49 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-26 1:59 ` ✓ Xe.CI.FULL: " 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=8733zfiaxa.fsf@intel.com \
--to=gustavo.sousa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@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