drm/amdgpu: Add NULL checks for function pointers
Subsystems (2)
PATCH 1/3 drm/amdgpu: Add NULL checks for function pointers
Check if function is implemented before making the call.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +8 -4
@@ -1424,9 +1424,11 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)if (amdgpu_sriov_vf (adev)) *flags =0 ; - adev->nbio.funcs->get_clockgating_state (adev, flags); +if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state) + adev->nbio.funcs->get_clockgating_state (adev, flags); - adev->hdp.funcs->get_clock_gating_state (adev, flags); +if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state) + adev->hdp.funcs->get_clock_gating_state (adev, flags);if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) {/* AMD_CG_SUPPORT_DRM_MGCG */
@@ -1441,9 +1443,11 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags) }/* AMD_CG_SUPPORT_ROM_MGCG */ - adev->smuio.funcs->get_clock_gating_state (adev, flags); +if (adev->smuio.funcs && adev->smuio.funcs->get_clock_gating_state) + adev->smuio.funcs->get_clock_gating_state (adev, flags); - adev->df.funcs->get_clockgating_state (adev, flags); +if (adev->df.funcs && adev->df.funcs->get_clockgating_state) + adev->df.funcs->get_clockgating_state (adev, flags); } static int soc15_common_set_powergating_state(void *handle,
Signature · 1 line
2.25.1
PATCH 2/3 drm/amdgpu: Update HDP 4.4.2 clock gating flags
HDP 4.4.2 clockgating is enabled by default, update the flags accordingly.
--- drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c +5 -0
@@ -129,6 +129,11 @@ static void hdp_v4_0_get_clockgating_state(struct amdgpu_device *adev, {int data; +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,4 ,2 )) { +/* Default enabled */ + *flags |=AMD_CG_SUPPORT_HDP_MGCG ; +return ; + }/* AMD_CG_SUPPORT_HDP_LS */ data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS));if (data &HDP_MEM_POWER_LS__LS_ENABLE_MASK )
Signature · 1 line
2.25.1
PATCH 3/3 drm/amdgpu: Avoid querying DRM MGCG status
In reply to Lijo LazarMP0 v13.0.6 SOCs don't support DRM MGCG.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -1
@@ -1430,7 +1430,8 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state) adev->hdp.funcs->get_clock_gating_state (adev, flags); -if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) { +if ((amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) && + (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,6 ))) {/* AMD_CG_SUPPORT_DRM_MGCG */ data =RREG32 (SOC15_REG_OFFSET (MP0 ,0 , mmMP0_MISC_CGTT_CTRL0));if (!(data &0x01000000 ))
Signature · 1 line
2.25.1
RE: [PATCH 3/3] drm/amdgpu: Avoid querying DRM MGCG status
[AMD Official Use Only - General]
Series is
Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 1, 2023 15:37
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Avoid querying DRM MGCG status
MP0 v13.0.6 SOCs don't support DRM MGCG.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -1
@@ -1430,7 +1430,8 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state) adev->hdp.funcs->get_clock_gating_state (adev, flags); -if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) { +if ((amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) && + (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,6 ))) {/* AMD_CG_SUPPORT_DRM_MGCG */ data =RREG32 (SOC15_REG_OFFSET (MP0 ,0 , mmMP0_MISC_CGTT_CTRL0));if (!(data &0x01000000 ))
--
2.25.1
Re: [PATCH 3/3] drm/amdgpu: Avoid querying DRM MGCG status
In reply to Lijo LazarQuoted 25 lines · Lijo Lazar
MP0 v13.0.6 SOCs don't support DRM MGCG.
Signed-off-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/soc15.c +2
-2@@ -1430,7 +1430,8 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state) adev->hdp.funcs->get_clock_gating_state (adev, flags); -if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) { +if ((amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) && + (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,6 ))) {/* AMD_CG_SUPPORT_DRM_MGCG */ data =RREG32 (SOC15_REG_OFFSET (MP0 ,0 , mmMP0_MISC_CGTT_CTRL0));if (!(data &0x01000000 )) --2.25.1
Re: [PATCH 3/3] drm/amdgpu: Avoid querying DRM MGCG status
[AMD Official Use Only - General]
For the series.
________________________________
From: Alex Deucher <[email protected]>
Sent: Friday, December 1, 2023 9:00 AM
To: Lazar, Lijo <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: Avoid querying DRM MGCG status
Quoted 25 lines · Lijo Lazar
MP0 v13.0.6 SOCs don't support DRM MGCG.
Signed-off-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/soc15.c +2
-2@@ -1430,7 +1430,8 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags)if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state) adev->hdp.funcs->get_clock_gating_state (adev, flags); -if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) { +if ((amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) && + (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,6 ))) {/* AMD_CG_SUPPORT_DRM_MGCG */ data =RREG32 (SOC15_REG_OFFSET (MP0 ,0 , mmMP0_MISC_CGTT_CTRL0));if (!(data &0x01000000 )) --2.25.1