drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
Subsystems (2)
PATCH 1/1 drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
Navi12 VK CTS subtest timestamp.calibrated.dev_domain_test failed because mmRLC_CAPTURE_GPU_CLOCK_COUNT register cannot be written in VF due to security policy.
Solution: use a VF-accessible timestamp register pair mmGOLDEN_TSC_COUNT_LOWER/UPPER for SRIOV case.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -3
@@ -35,6 +35,8 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" +#include "smuio/smuio_11_0_0_offset.h" +#include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" #include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h"
@@ -3920,9 +3922,14 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)amdgpu_gfx_off_ctrl (adev, false);mutex_lock (&adev->gfx.gpu_clock_mutex); -WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); - clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | - ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); +if (!amdgpu_sriov_vf (adev)) { +WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); + clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | + ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); + }else { + clock = (uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_LOWER) | + ((uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_UPPER) <<32ULL ); + }mutex_unlock (&adev->gfx.gpu_clock_mutex);amdgpu_gfx_off_ctrl (adev, true);return clock;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
maintainer[AMD Public Use]
Is there any reason to not just use this for bare metal as well?
Alex
________________________________
From: amd-gfx <[email protected]> on behalf of jianzh <[email protected]>
Sent: Thursday, February 27, 2020 6:21 AM
To: [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>; Zhao, Jiange <[email protected]>; Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
Navi12 VK CTS subtest timestamp.calibrated.dev_domain_test failed because mmRLC_CAPTURE_GPU_CLOCK_COUNT register cannot be written in VF due to security policy.
Solution: use a VF-accessible timestamp register pair mmGOLDEN_TSC_COUNT_LOWER/UPPER for SRIOV case.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -3
@@ -35,6 +35,8 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" +#include "smuio/smuio_11_0_0_offset.h" +#include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" #include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h"
@@ -3920,9 +3922,14 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)amdgpu_gfx_off_ctrl (adev, false);mutex_lock (&adev->gfx.gpu_clock_mutex); -WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); - clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | - ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); +if (!amdgpu_sriov_vf (adev)) { +WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); + clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | + ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); + }else { + clock = (uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_LOWER) | + ((uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_UPPER) <<32ULL ); + }mutex_unlock (&adev->gfx.gpu_clock_mutex);amdgpu_gfx_off_ctrl (adev, true);return clock;
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C9b14a49e41fd48f7138f08d7bb773ed9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637183993593225894&sdata=jFUVpgeEcTTJbTJ3a7ibAPOyAU3RVF%2FEIN41zaqS0eM%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi,
I got feedback from Linux team and they simply don't want to change.
I believe that it would work for bare metal as well.
Jiange
________________________________
From: Deucher, Alexander <[email protected]>
Sent: Thursday, February 27, 2020 10:23 PM
To: Zhao, Jiange <[email protected]>; [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
[AMD Public Use]
Is there any reason to not just use this for bare metal as well?
Alex
________________________________
From: amd-gfx <[email protected]> on behalf of jianzh <[email protected]>
Sent: Thursday, February 27, 2020 6:21 AM
To: [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>; Zhao, Jiange <[email protected]>; Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
Navi12 VK CTS subtest timestamp.calibrated.dev_domain_test failed because mmRLC_CAPTURE_GPU_CLOCK_COUNT register cannot be written in VF due to security policy.
Solution: use a VF-accessible timestamp register pair mmGOLDEN_TSC_COUNT_LOWER/UPPER for SRIOV case.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -3
@@ -35,6 +35,8 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" +#include "smuio/smuio_11_0_0_offset.h" +#include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" #include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h"
@@ -3920,9 +3922,14 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)amdgpu_gfx_off_ctrl (adev, false);mutex_lock (&adev->gfx.gpu_clock_mutex); -WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); - clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | - ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); +if (!amdgpu_sriov_vf (adev)) { +WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); + clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | + ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); + }else { + clock = (uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_LOWER) | + ((uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_UPPER) <<32ULL ); + }mutex_unlock (&adev->gfx.gpu_clock_mutex);amdgpu_gfx_off_ctrl (adev, true);return clock;
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C9b14a49e41fd48f7138f08d7bb773ed9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637183993593225894&sdata=jFUVpgeEcTTJbTJ3a7ibAPOyAU3RVF%2FEIN41zaqS0eM%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
maintainerLet's just switch everyone over. I think this should work for both bare metal and SR-IOV. Fewer code pathes to maintain. Feel free to do it as a follow up patch.
Thanks,
Alex
________________________________
From: Zhao, Jiange <[email protected]>
Sent: Thursday, February 27, 2020 10:02 PM
To: Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
Hi,
I got feedback from Linux team and they simply don't want to change.
I believe that it would work for bare metal as well.
Jiange
________________________________
From: Deucher, Alexander <[email protected]>
Sent: Thursday, February 27, 2020 10:23 PM
To: Zhao, Jiange <[email protected]>; [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>; Liu, Monk <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
[AMD Public Use]
Is there any reason to not just use this for bare metal as well?
Alex
________________________________
From: amd-gfx <[email protected]> on behalf of jianzh <[email protected]>
Sent: Thursday, February 27, 2020 6:21 AM
To: [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>; Zhao, Jiange <[email protected]>; Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu/sriov: Use VF-accessible register for gpu_clock_count
Navi12 VK CTS subtest timestamp.calibrated.dev_domain_test failed because mmRLC_CAPTURE_GPU_CLOCK_COUNT register cannot be written in VF due to security policy.
Solution: use a VF-accessible timestamp register pair mmGOLDEN_TSC_COUNT_LOWER/UPPER for SRIOV case.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -3
@@ -35,6 +35,8 @@#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_sh_mask.h" +#include "smuio/smuio_11_0_0_offset.h" +#include "smuio/smuio_11_0_0_sh_mask.h" #include "navi10_enum.h" #include "hdp/hdp_5_0_0_offset.h" #include "ivsrcid/gfx/irqsrcs_gfx_10_1.h"
@@ -3920,9 +3922,14 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)amdgpu_gfx_off_ctrl (adev, false);mutex_lock (&adev->gfx.gpu_clock_mutex); -WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); - clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | - ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); +if (!amdgpu_sriov_vf (adev)) { +WREG32_SOC15 (GC ,0 , mmRLC_CAPTURE_GPU_CLOCK_COUNT,1 ); + clock = (uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_LSB) | + ((uint64_t )RREG32_SOC15 (GC ,0 , mmRLC_GPU_CLOCK_COUNT_MSB) <<32ULL ); + }else { + clock = (uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_LOWER) | + ((uint64_t )RREG32_SOC15 (SMUIO ,0 , mmGOLDEN_TSC_COUNT_UPPER) <<32ULL ); + }mutex_unlock (&adev->gfx.gpu_clock_mutex);amdgpu_gfx_off_ctrl (adev, true);return clock;
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C9b14a49e41fd48f7138f08d7bb773ed9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637183993593225894&sdata=jFUVpgeEcTTJbTJ3a7ibAPOyAU3RVF%2FEIN41zaqS0eM%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx