Skip to contentSkip to conversation

drm/amdgpu: improve error handling in pcie_bw

PATCH In review Alex Deucher 3 participants 5 messages May 19, 2020 – May 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: improve error handling in pcie_bw

1. Initialize the counters to 0 in case the callback fails to initialize them.
2. The counters don't exist on APUs so return an error for them.
3. Return an error if the callback doesn't exist.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7 -1
index bc7de2f62d12..72bbb8175b22 100644
@@ -1646,9 +1646,15 @@ static ssize_t amdgpu_get_pcie_bw(struct device *dev,
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct amdgpu_device *adev = ddev->dev_private;
-	uint64_t count0, count1;
+	uint64_t count0 = 0, count1 = 0;
 	int ret;
 
+	if (adev->flags & AMD_IS_APU)
+		return -ENODATA;
+
+	if (!adev->asic_funcs->get_pcie_usage)
+		return -ENODATA;
+
 	ret = pm_runtime_get_sync(ddev->dev);
 	if (ret < 0)
 		return ret;
Signature · 6 lines
2.25.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

PATCH 2/2 drm/amdgpu: drop navi pcie bw callback

It's not implemented yet so just drop it so the sysfs pcie bw file returns an appropriate error instead of garbage.

---
 drivers/gpu/drm/amd/amdgpu/nv.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +0 -8
index 9c42316c47c0..6655dd2009b6 100644
@@ -548,13 +548,6 @@ static bool nv_need_full_reset(struct amdgpu_device *adev)
 	return true;
 }
 
-static void nv_get_pcie_usage(struct amdgpu_device *adev,
-			      uint64_t *count0,
-			      uint64_t *count1)
-{
-	/*TODO*/
-}
-
 static bool nv_need_reset_on_init(struct amdgpu_device *adev)
 {
 #if 0
@@ -629,7 +622,6 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
 	.invalidate_hdp = &nv_invalidate_hdp,
 	.init_doorbell_index = &nv_init_doorbell_index,
 	.need_full_reset = &nv_need_full_reset,
-	.get_pcie_usage = &nv_get_pcie_usage,
 	.need_reset_on_init = &nv_need_reset_on_init,
 	.get_pcie_replay_count = &nv_get_pcie_replay_count,
 	.supports_baco = &nv_asic_supports_baco,
Signature · 6 lines
2.25.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: drop navi pcie bw callback

Ping on this series?

Quoted 37 lines · Alex Deucher

It's not implemented yet so just drop it so the sysfs pcie bw file returns an appropriate error instead of garbage.

---
 drivers/gpu/drm/amd/amdgpu/nv.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +0 -9
index 9c42316c47c0..6655dd2009b6 100644
@@ -548,13 +548,6 @@ static bool nv_need_full_reset(struct amdgpu_device *adev)
        return true;
 }
 
-static void nv_get_pcie_usage(struct amdgpu_device *adev,
-                             uint64_t *count0,
-                             uint64_t *count1)
-{
-       /*TODO*/
-}
-
 static bool nv_need_reset_on_init(struct amdgpu_device *adev)
 {
 #if 0
@@ -629,7 +622,6 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
        .invalidate_hdp = &nv_invalidate_hdp,
        .init_doorbell_index = &nv_init_doorbell_index,
        .need_full_reset = &nv_need_full_reset,
-       .get_pcie_usage = &nv_get_pcie_usage,
        .need_reset_on_init = &nv_need_reset_on_init,
        .get_pcie_replay_count = &nv_get_pcie_replay_count,
        .supports_baco = &nv_asic_supports_baco,
--
Quoted 2 lines

2.25.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#3 lore raw

Re: [PATCH 2/2] drm/amdgpu: drop navi pcie bw callback

[AMD Official Use Only - Internal Distribution Only]

The series are

________________________________
From: amd-gfx <[email protected]> on behalf of Alex Deucher <[email protected]>
Sent: Thursday, May 21, 2020 12:52 PM
To: amd-gfx list <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: drop navi pcie bw callback

Ping on this series?

Quoted 37 lines · Alex Deucher

It's not implemented yet so just drop it so the sysfs pcie bw file returns an appropriate error instead of garbage.

---
 drivers/gpu/drm/amd/amdgpu/nv.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +0 -9
index 9c42316c47c0..6655dd2009b6 100644
@@ -548,13 +548,6 @@ static bool nv_need_full_reset(struct amdgpu_device *adev)
        return true;
 }
 
-static void nv_get_pcie_usage(struct amdgpu_device *adev,
-                             uint64_t *count0,
-                             uint64_t *count1)
-{
-       /*TODO*/
-}
-
 static bool nv_need_reset_on_init(struct amdgpu_device *adev)
 {
 #if 0
@@ -629,7 +622,6 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
        .invalidate_hdp = &nv_invalidate_hdp,
        .init_doorbell_index = &nv_init_doorbell_index,
        .need_full_reset = &nv_need_full_reset,
-       .get_pcie_usage = &nv_get_pcie_usage,
        .need_reset_on_init = &nv_need_reset_on_init,
        .get_pcie_replay_count = &nv_get_pcie_replay_count,
        .supports_baco = &nv_asic_supports_baco,
--
Quoted 2 lines

2.25.4

_______________________________________________
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=02%7C01%7Cyong.zhao%40amd.com%7C1a6de00e60b447bad54a08d7fda76316%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637256767681371342&amp;sdata=EWwfgYQtOR1TGw6%2BL6w8Cw7Y9e7ixVI1xDJoWTUsWtk%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Yong Zhao
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: drop navi pcie bw callback

Sorry I missed this.
Series is Reviewed-By: Kent Russell <[email protected]>

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: amd-gfx <[email protected]> on behalf of Zhao, Yong <[email protected]>
Sent: Thursday, May 21, 2020 1:27 PM
To: Alex Deucher <[email protected]>; amd-gfx list <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: drop navi pcie bw callback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

The series are

________________________________
From: amd-gfx <[email protected]> on behalf of Alex Deucher <[email protected]>
Sent: Thursday, May 21, 2020 12:52 PM
To: amd-gfx list <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: drop navi pcie bw callback

Ping on this series?

Quoted 37 lines · Alex Deucher

It's not implemented yet so just drop it so the sysfs pcie bw file returns an appropriate error instead of garbage.

---
 drivers/gpu/drm/amd/amdgpu/nv.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +0 -9
index 9c42316c47c0..6655dd2009b6 100644
@@ -548,13 +548,6 @@ static bool nv_need_full_reset(struct amdgpu_device *adev)
        return true;
 }
 
-static void nv_get_pcie_usage(struct amdgpu_device *adev,
-                             uint64_t *count0,
-                             uint64_t *count1)
-{
-       /*TODO*/
-}
-
 static bool nv_need_reset_on_init(struct amdgpu_device *adev)
 {
 #if 0
@@ -629,7 +622,6 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
        .invalidate_hdp = &nv_invalidate_hdp,
        .init_doorbell_index = &nv_init_doorbell_index,
        .need_full_reset = &nv_need_full_reset,
-       .get_pcie_usage = &nv_get_pcie_usage,
        .need_reset_on_init = &nv_need_reset_on_init,
        .get_pcie_replay_count = &nv_get_pcie_replay_count,
        .supports_baco = &nv_asic_supports_baco,
--
Quoted 2 lines

2.25.4

_______________________________________________
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=02%7C01%7Cyong.zhao%40amd.com%7C1a6de00e60b447bad54a08d7fda76316%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637256767681371342&amp;sdata=EWwfgYQtOR1TGw6%2BL6w8Cw7Y9e7ixVI1xDJoWTUsWtk%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Ckent.russell%40amd.com%7Cb24bbf754a294cc666ba08d7fdac5228%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637256789747127637&sdata=m%2BJ73URIHmwFL3IH%2BC%2BSgryLmztoLuXswA33XTFiy90%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx