[AMD Public Use]


-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Friday, March 19, 2021 2:42 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: disable runpm if other reset method not runpm 
capable is chosen

Otherwise, the runpm will be always enabled on a BACO capable target even the 
reset method was forced as like mode1.

Change-Id: If6bf55c533e91470c9c83383788466161608f68d
Signed-off-by: Evan Quan <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-  
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/cik.c        | 2 +-
 drivers/gpu/drm/amd/amdgpu/nv.c         | 2 +-
 drivers/gpu/drm/amd/amdgpu/si.c         | 2 +-
 drivers/gpu/drm/amd/amdgpu/soc15.c      | 2 +-
 drivers/gpu/drm/amd/amdgpu/vi.c         | 2 +-
 8 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 963ecfd84347..be12dd2550b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -589,6 +589,7 @@ struct amdgpu_allowed_register_entry {  };
 
 enum amd_reset_method {
+       AMD_RESET_METHOD_AUTO = -1,
        AMD_RESET_METHOD_LEGACY = 0,
        AMD_RESET_METHOD_MODE0,
        AMD_RESET_METHOD_MODE1,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 6a06234dbcad..78e5445b28b5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -168,7 +168,7 @@ int amdgpu_noretry = -1;  int amdgpu_force_asic_type = -1;  
int amdgpu_tmz = -1; /* auto */  uint amdgpu_freesync_vid_mode; -int 
amdgpu_reset_method = -1; /* auto */
+int amdgpu_reset_method = AMD_RESET_METHOD_AUTO; /* auto */
 int amdgpu_num_kcq = -1;
 
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 8844f650b17f..49068ad698a6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -168,6 +168,8 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, 
unsigned long flags)
                adev->runpm = true;
                dev_info(adev->dev, "Using BOCO for runtime pm\n");
        } else if (amdgpu_device_supports_baco(dev) &&
+                  (amdgpu_reset_method == AMD_RESET_METHOD_AUTO ||
+                   amdgpu_reset_method == AMD_RESET_METHOD_BACO) &&

< > Why to link runpm suspend method with reset method?

Thanks,
Lijo
                   (amdgpu_runtime_pm != 0)) {
                switch (adev->asic_type) {
                case CHIP_VEGA20:
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index c0fcc41ee574..e671871f4d28 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1395,7 +1395,7 @@ cik_asic_reset_method(struct amdgpu_device *adev)
            amdgpu_reset_method == AMD_RESET_METHOD_BACO)
                return amdgpu_reset_method;
 
-       if (amdgpu_reset_method != -1)
+       if (amdgpu_reset_method != AMD_RESET_METHOD_AUTO)
                dev_warn(adev->dev, "Specified reset:%d isn't supported, using 
AUTO instead.\n",
                                  amdgpu_reset_method);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c 
index 2670ae00c2e5..1e751d415f15 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -529,7 +529,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)
            amdgpu_reset_method == AMD_RESET_METHOD_PCI)
                return amdgpu_reset_method;
 
-       if (amdgpu_reset_method != -1)
+       if (amdgpu_reset_method != AMD_RESET_METHOD_AUTO)
                dev_warn(adev->dev, "Specified reset method:%d isn't supported, 
using AUTO instead.\n",
                                  amdgpu_reset_method);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c 
index 7cbc2bb03bc6..b9db761a7cc5 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -1420,7 +1420,7 @@ si_asic_reset_method(struct amdgpu_device *adev)
        if (amdgpu_reset_method == AMD_RESET_METHOD_PCI)
                return amdgpu_reset_method;
        else if (amdgpu_reset_method != AMD_RESET_METHOD_LEGACY &&
-                amdgpu_reset_method != -1)
+                amdgpu_reset_method != AMD_RESET_METHOD_AUTO)
                dev_warn(adev->dev, "Specified reset method:%d isn't supported, 
using AUTO instead.\n",
                         amdgpu_reset_method);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index c354a11e2fd9..ad11f2e1f4db 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -689,7 +689,7 @@ soc15_asic_reset_method(struct amdgpu_device *adev)
                 return amdgpu_reset_method;
         }
 
-       if (amdgpu_reset_method != -1)
+       if (amdgpu_reset_method != AMD_RESET_METHOD_AUTO)
                dev_warn(adev->dev, "Specified reset method:%d isn't supported, 
using AUTO instead.\n",
                                  amdgpu_reset_method);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c 
index ea338de5818a..6b380a25e22e 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -895,7 +895,7 @@ vi_asic_reset_method(struct amdgpu_device *adev)
            amdgpu_reset_method == AMD_RESET_METHOD_BACO)
                return amdgpu_reset_method;
 
-       if (amdgpu_reset_method != -1)
+       if (amdgpu_reset_method != AMD_RESET_METHOD_AUTO)
                dev_warn(adev->dev, "Specified reset method:%d isn't supported, 
using AUTO instead.\n",
                                  amdgpu_reset_method);
 
--
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Clijo.lazar%40amd.com%7Ce8308bfec7e047a7552b08d8eab7231c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637517419584010454%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=OuWg%2B92YCNnINVD%2BEtasOsEbOutT1XMFMZYsmRkh1Os%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to