drm/xe: Move d3cold_allowed decision all together.
authorRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 25 Jul 2023 22:11:56 +0000 (18:11 -0400)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:39:15 +0000 (11:39 -0500)
And let's use the VRAM threshold to keep d3cold temporarily disabled.

With this we have the ability to run D3Cold experiments just by
touching the vram_d3cold_threshold sysfs entry.

Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_pci.c
drivers/gpu/drm/xe/xe_pm.c
drivers/gpu/drm/xe/xe_pm.h

index 1a79c6a7dd5ee3a8b7c2b0728bc00030a9748b5e..4cbacc80594bc6751739eaf2eb599cdf228fa4ff 100644 (file)
@@ -806,20 +806,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);
 
-       if (!xe->d3cold.capable) {
-               xe->d3cold.allowed = false;
-       } else {
-               xe_pm_d3cold_allowed_toggle(xe);
-
-               /*
-                * TODO: d3cold should be allowed (true) if
-                * (IS_DGFX(xe) && !xe_device_mem_access_ongoing(xe))
-                * but maybe include some other conditions. So, before
-                * we can re-enable the D3cold, we need to:
-                * 1. rewrite the VRAM save / restore to avoid buffer object locks
-                */
-               xe->d3cold.allowed = false;
-       }
+       xe_pm_d3cold_allowed_toggle(xe);
 
        return 0;
 }
index cb2a00ea28e303f7d0fe07ab657647b1f01ce423..1c62900d29d88ba5a999ba4d18aa97c76fd12326 100644 (file)
@@ -342,6 +342,11 @@ void xe_pm_d3cold_allowed_toggle(struct xe_device *xe)
        u64 vram_used;
        int i;
 
+       if (!xe->d3cold.capable) {
+               xe->d3cold.allowed = false;
+               return;
+       }
+
        for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) {
                man = ttm_manager_type(&xe->ttm, i);
                if (man) {
index 08a633ce5145d587583e296dd59b07fede611dc2..6b9031f7af2439e1c7e739de0363a87fd0e28ac4 100644 (file)
@@ -8,7 +8,12 @@
 
 #include <linux/pm_runtime.h>
 
-#define DEFAULT_VRAM_THRESHOLD 300 /* in MB */
+/*
+ * TODO: Threshold = 0 will block D3Cold.
+ *       Before we can move this to a higher value (like 300), we need to:
+ *           1. rewrite the VRAM save / restore to avoid buffer object locks
+ */
+#define DEFAULT_VRAM_THRESHOLD 0 /* in MB */
 
 struct xe_device;