From: "Poosa, Karthik" <karthik.poosa@intel.com>
To: Badal Nilawar <badal.nilawar@intel.com>,
<intel-xe@lists.freedesktop.org>, <linux-acpi@vger.kernel.org>,
<linux-pci@vger.kernel.org>
Cc: <anshuman.gupta@intel.com>, <rafael@kernel.org>,
<lenb@kernel.org>, <bhelgaas@google.com>,
<ilpo.jarvinen@linux.intel.com>, <lucas.demarchi@intel.com>,
<rodrigo.vivi@intel.com>, <varun.gupta@intel.com>,
<ville.syrjala@linux.intel.com>, <uma.shankar@intel.com>
Subject: Re: [v4,08/11] drm/xe/vrsr: Refactor d3cold.allowed to a enum
Date: Tue, 24 Jun 2025 16:11:55 +0530 [thread overview]
Message-ID: <89c2a2ba-2ed1-4a30-8013-84d7017a7ddd@intel.com> (raw)
In-Reply-To: <20250529111654.3140766-9-badal.nilawar@intel.com>
[-- Attachment #1: Type: text/plain, Size: 6698 bytes --]
On 29-05-2025 16:46, Badal Nilawar wrote:
> From: Anshuman Gupta<anshuman.gupta@intel.com>
>
> Add xe_d3_state enum to add support for VRAM Self Refresh
> d3cold state.
>
> Signed-off-by: Anshuman Gupta<anshuman.gupta@intel.com>
> ---
> drivers/gpu/drm/xe/display/xe_display.c | 6 +++---
> drivers/gpu/drm/xe/xe_device_types.h | 5 +++--
> drivers/gpu/drm/xe/xe_pci.c | 6 +++---
> drivers/gpu/drm/xe/xe_pm.c | 16 ++++++++--------
> drivers/gpu/drm/xe/xe_pm.h | 8 +++++++-
> 5 files changed, 24 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index b3da88b12b35..7ccd9b447ace 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -433,7 +433,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
> if (!xe->info.probe_display)
> return;
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> xe_display_enable_d3cold(xe);
> return;
> }
> @@ -459,7 +459,7 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
> if (!xe->info.probe_display)
> return;
>
> - if (xe->d3cold.allowed)
> + if (xe->d3cold.target_state)
> xe_display_pm_suspend_late(xe);
>
> /*
> @@ -537,7 +537,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
> if (!xe->info.probe_display)
> return;
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> xe_display_disable_d3cold(xe);
> return;
> }
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index 5f9a1a358468..48ca0d8c4c45 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -20,6 +20,7 @@
> #include "xe_memirq_types.h"
> #include "xe_oa_types.h"
> #include "xe_platform_types.h"
> +#include "xe_pm.h"
> #include "xe_pmu_types.h"
> #include "xe_pt_types.h"
> #include "xe_sriov_types.h"
> @@ -510,8 +511,8 @@ struct xe_device {
> /** @d3cold.capable: Indicates if root port is d3cold capable */
> bool capable;
>
> - /** @d3cold.allowed: Indicates if d3cold is a valid device state */
> - bool allowed;
> + /** @d3cold.target_state: Indicates d3cold target state */
> + enum xe_d3_state target_state;
>
> /** @d3cold.vrsr_capable: Indicates if d3cold VRAM Self Refresh is supported */
> bool vrsr_capable;
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 46a99d6ef1a5..5ae1df345416 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -977,7 +977,7 @@ static int xe_pci_runtime_suspend(struct device *dev)
>
> pci_save_state(pdev);
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> d3cold_toggle(pdev, D3COLD_ENABLE);
> pci_disable_device(pdev);
> pci_ignore_hotplug(pdev);
> @@ -1002,7 +1002,7 @@ static int xe_pci_runtime_resume(struct device *dev)
>
> pci_restore_state(pdev);
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> err = pci_enable_device(pdev);
> if (err)
> return err;
> @@ -1018,7 +1018,7 @@ static int xe_pci_runtime_idle(struct device *dev)
> struct pci_dev *pdev = to_pci_dev(dev);
> struct xe_device *xe = pdev_to_xe_device(pdev);
>
> - xe_pm_d3cold_allowed_toggle(xe);
> + xe_pm_d3cold_target_state_toggle(xe);
>
> return 0;
> }
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index c84b9b3f7371..b86e95493cb5 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -606,7 +606,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
>
> xe_display_pm_runtime_suspend(xe);
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> err = xe_bo_evict_all(xe);
> if (err)
> goto out_resume;
> @@ -653,7 +653,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)
>
> xe_rpm_lockmap_acquire(xe);
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> err = xe_pcode_ready(xe, true);
> if (err)
> goto out;
> @@ -676,7 +676,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)
>
> xe_display_pm_runtime_resume(xe);
>
> - if (xe->d3cold.allowed) {
> + if (xe->d3cold.target_state) {
> err = xe_bo_restore_late(xe);
> if (err)
> goto out;
> @@ -918,13 +918,13 @@ int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold)
> }
>
> /**
> - * xe_pm_d3cold_allowed_toggle - Check conditions to toggle d3cold.allowed
> + * xe_pm_d3cold_target_state_toggle - Check conditions to toggle target_state
> * @xe: xe device instance
> *
> * To be called during runtime_pm idle callback.
> * Check for all the D3Cold conditions ahead of runtime suspend.
> */
> -void xe_pm_d3cold_allowed_toggle(struct xe_device *xe)
> +void xe_pm_d3cold_target_state_toggle(struct xe_device *xe)
> {
> struct ttm_resource_manager *man;
> u32 total_vram_used_mb = 0;
> @@ -932,7 +932,7 @@ void xe_pm_d3cold_allowed_toggle(struct xe_device *xe)
> int i;
>
> if (!xe->d3cold.capable) {
> - xe->d3cold.allowed = false;
> + xe->d3cold.target_state = XE_D3HOT;
> return;
> }
>
> @@ -947,9 +947,9 @@ void xe_pm_d3cold_allowed_toggle(struct xe_device *xe)
> mutex_lock(&xe->d3cold.lock);
>
> if (total_vram_used_mb < xe->d3cold.vram_threshold)
> - xe->d3cold.allowed = true;
> + xe->d3cold.target_state = XE_D3COLD_OFF;
> else
> - xe->d3cold.allowed = false;
> + xe->d3cold.target_state = XE_D3HOT;
>
> mutex_unlock(&xe->d3cold.lock);
> }
> diff --git a/drivers/gpu/drm/xe/xe_pm.h b/drivers/gpu/drm/xe/xe_pm.h
> index ba550281b130..c6c2bd6187a5 100644
> --- a/drivers/gpu/drm/xe/xe_pm.h
> +++ b/drivers/gpu/drm/xe/xe_pm.h
> @@ -12,6 +12,12 @@
>
> struct xe_device;
>
> +enum xe_d3_state {
> + XE_D3HOT = 0,
> + XE_D3COLD_VRSR,
> + XE_D3COLD_OFF,
> +};
> +
> int xe_pm_suspend(struct xe_device *xe);
> int xe_pm_resume(struct xe_device *xe);
>
> @@ -30,7 +36,7 @@ void xe_pm_runtime_get_noresume(struct xe_device *xe);
> bool xe_pm_runtime_resume_and_get(struct xe_device *xe);
> void xe_pm_assert_unbounded_bridge(struct xe_device *xe);
> int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold);
> -void xe_pm_d3cold_allowed_toggle(struct xe_device *xe);
> +void xe_pm_d3cold_target_state_toggle(struct xe_device *xe);
> bool xe_rpm_reclaim_safe(const struct xe_device *xe);
> struct task_struct *xe_pm_read_callback_task(struct xe_device *xe);
> int xe_pm_module_init(void);
LGTM.
Reviewed-by: Karthik Poosa <karthik.poosa@intel.com>
[-- Attachment #2: Type: text/html, Size: 42604 bytes --]
next prev parent reply other threads:[~2025-06-24 10:42 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 11:16 [PATCH v4 00/11] VRAM Self Refresh Badal Nilawar
2025-05-29 11:16 ` [PATCH v4 01/11] PCI/ACPI: Add D3cold Aux Power Limit_DSM method Badal Nilawar
2025-05-29 21:36 ` Sathyanarayanan Kuppuswamy
2025-09-02 6:04 ` Nilawar, Badal
2025-07-02 11:08 ` Rafael J. Wysocki
2025-09-02 6:17 ` Nilawar, Badal
2025-09-02 8:10 ` Nilawar, Badal
2025-09-04 18:30 ` Bjorn Helgaas
2025-09-30 6:11 ` Nilawar, Badal
2025-05-29 11:16 ` [PATCH v4 02/11] PCI/ACPI: Per root port allow one Aux power limit request Badal Nilawar
2025-05-29 21:41 ` Sathyanarayanan Kuppuswamy
2025-07-02 11:11 ` Rafael J. Wysocki
2025-07-02 14:03 ` Sathyanarayanan Kuppuswamy
2025-07-02 11:21 ` Rafael J. Wysocki
2025-09-02 8:43 ` Nilawar, Badal
2025-07-02 11:28 ` Ilpo Järvinen
2025-09-02 8:53 ` Nilawar, Badal
2025-09-04 18:36 ` Bjorn Helgaas
2025-09-30 9:36 ` Nilawar, Badal
2025-05-29 11:16 ` [PATCH v4 03/11] PCI/ACPI: Add PERST# Assertion Delay _DSM method Badal Nilawar
2025-05-29 21:57 ` Sathyanarayanan Kuppuswamy
2025-07-02 11:25 ` Rafael J. Wysocki
2025-09-02 8:22 ` Nilawar, Badal
2025-09-04 18:44 ` Bjorn Helgaas
2025-09-30 9:39 ` Nilawar, Badal
2025-05-29 11:16 ` [PATCH v4 04/11] drm/xe/vrsr: Introduce flag has_vrsr Badal Nilawar
2025-06-06 9:38 ` [v4,04/11] " Poosa, Karthik
2025-05-29 11:16 ` [PATCH v4 05/11] drm/xe/vrsr: Detect VRSR Capability Badal Nilawar
2025-05-29 11:16 ` [PATCH v4 06/11] drm/xe/vrsr: Initialize VRSR feature Badal Nilawar
2025-06-24 10:28 ` [v4,06/11] " Poosa, Karthik
2025-09-03 13:39 ` Nilawar, Badal
2025-09-04 13:42 ` Poosa, Karthik
2025-05-29 11:16 ` [PATCH v4 07/11] drm/xe/vrsr: Enable VRSR on default VGA boot device Badal Nilawar
2025-06-06 13:07 ` Jani Nikula
2025-09-03 14:18 ` Nilawar, Badal
2025-05-29 11:16 ` [PATCH v4 08/11] drm/xe/vrsr: Refactor d3cold.allowed to a enum Badal Nilawar
2025-06-24 10:41 ` Poosa, Karthik [this message]
2025-05-29 11:16 ` [PATCH v4 09/11] drm/xe/pm: D3Cold target state Badal Nilawar
2025-06-24 11:10 ` [v4,09/11] " Poosa, Karthik
2025-05-29 11:16 ` [PATCH v4 10/11] drm/xe/vrsr: Enable VRSR Badal Nilawar
2025-06-24 11:45 ` [v4,10/11] " Poosa, Karthik
2025-09-03 14:16 ` Nilawar, Badal
2025-09-04 6:01 ` Poosa, Karthik
2025-05-29 11:16 ` [PATCH v4 11/11] drm/xe/vrsr: Introduce a debugfs node named vrsr_capable Badal Nilawar
2025-06-24 11:14 ` [v4,11/11] " Poosa, Karthik
2025-05-29 11:36 ` ✗ CI.Patch_applied: failure for VRAM Self Refresh (rev4) 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=89c2a2ba-2ed1-4a30-8013-84d7017a7ddd@intel.com \
--to=karthik.poosa@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=rafael@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=uma.shankar@intel.com \
--cc=varun.gupta@intel.com \
--cc=ville.syrjala@linux.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