Add SMUIO 14.0.2 support
Subsystems (2)
Alex Deucher
maintainercover Add SMUIO 14.0.2 support
SMUIO is the IO subset of the SMU block. It handles a variety of functionality on the GPU including reading the ROM image and accessing the GPU clock counter. This adds support for SMUIO 14.0.2.
Note that patch 1 adds register headers and is very large so it has been omitted.
Hawking Zhang (4):
drm/amdgpu: Add smuio v14_0_2 ip headers (v4) drm/amdgpu: Add smuio v14_0_2 ip block support drm/amdgpu: Add smuio callback to get gpu clk counter drm/amdgpu: Enable smuio v14_0_2 callbacks
drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 + drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 1 + drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c | 62 + drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.h | 30 + .../asic_reg/smuio/smuio_14_0_2_offset.h | 511 ++++++++ .../asic_reg/smuio/smuio_14_0_2_sh_mask.h | 1106 +++++++++++++++++ 7 files changed, 1716 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_14_0_2_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_14_0_2_sh_mask.h
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 2/4 drm/amdgpu: Add smuio v14_0_2 ip block support
From: Hawking Zhang <[email protected]>
Add smuio v14_0_2 ip block support
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c | 41 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.h | 30 ++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c create mode 100644 drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -247,7 +247,8 @@ amdgpu-y += \ smuio_v11_0_6.o \ smuio_v13_0.o \ smuio_v13_0_3.o \ - smuio_v13_0_6.o + smuio_v13_0_6.o \ + smuio_v14_0_2.o # add reset block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c new file +41 -0
41 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#ifndef __SMUIO_V14_0_2_H__ +#define __SMUIO_V14_0_2_H__ + +#include "soc15_common.h" + +extern const struct amdgpu_smuio_funcs smuio_v14_0_2_funcs; + +#endif /* __SMUIO_V14_0_2_H__ */
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 3/4 drm/amdgpu: Add smuio callback to get gpu clk counter
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
Add smuio callback to get gpu clk counter
--- drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h | 1 + drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_smuio.h +1 -0
@@ -44,6 +44,7 @@ struct amdgpu_smuio_funcs {u32 (*get_socket_id)(struct amdgpu_device *adev);enum amdgpu_pkg_type (*get_pkg_type)(struct amdgpu_device *adev);bool (*is_host_gpu_xgmi_supported)(struct amdgpu_device *adev); +u64 (*get_gpu_clock_counter)(struct amdgpu_device *adev); };struct amdgpu_smuio {
drivers/gpu/drm/amd/amdgpu/smuio_v14_0_2.c +21 -0
@@ -24,6 +24,7 @@#include "smuio_v14_0_2.h" #include "smuio/smuio_14_0_2_offset.h" #include "smuio/smuio_14_0_2_sh_mask.h" +#include <linux/preempt.h> static u32 smuio_v14_0_2_get_rom_index_offset (struct amdgpu_device *adev) {
@@ -35,7 +36,27 @@ static u32 smuio_v14_0_2_get_rom_data_offset(struct amdgpu_device *adev)return SOC15_REG_OFFSET (SMUIO ,0 , regROM_DATA); } +static u64 smuio_v14_0_2_get_gpu_clock_counter (struct amdgpu_device *adev) +{ +u64 clock; +u64 clock_counter_lo, clock_counter_hi_pre, clock_counter_hi_after; + +preempt_disable (); + clock_counter_hi_pre = (u64 )RREG32_SOC15 (SMUIO ,0 , regGOLDEN_TSC_COUNT_UPPER); + clock_counter_lo = (u64 )RREG32_SOC15 (SMUIO ,0 , regGOLDEN_TSC_COUNT_LOWER); +/* the clock counter may be udpated during polling the counters */ + clock_counter_hi_after = (u64 )RREG32_SOC15 (SMUIO ,0 , regGOLDEN_TSC_COUNT_UPPER); +if (clock_counter_hi_pre != clock_counter_hi_after) + clock_counter_lo = (u64 )RREG32_SOC15 (SMUIO ,0 , regGOLDEN_TSC_COUNT_LOWER); +preempt_enable (); + + clock = clock_counter_lo | (clock_counter_hi_after <<32ULL ); + +return clock; +} +const struct amdgpu_smuio_funcs smuio_v14_0_2_funcs = { .get_rom_index_offset = smuio_v14_0_2_get_rom_index_offset, .get_rom_data_offset = smuio_v14_0_2_get_rom_data_offset, + .get_gpu_clock_counter = smuio_v14_0_2_get_gpu_clock_counter, };
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 4/4 drm/amdgpu: Enable smuio v14_0_2 callbacks
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
Enable smuio v14_0_2_callbacks
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +4 -0
@@ -97,6 +97,7 @@#include "smuio_v13_0.h" #include "smuio_v13_0_3.h" #include "smuio_v13_0_6.h" +#include "smuio_v14_0_2.h" #include "vcn_v5_0_0.h" #include "jpeg_v5_0_0.h"
@@ -2684,6 +2685,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (14 ,0 ,1 ): adev->smuio.funcs = &smuio_v13_0_6_funcs;break ; +case IP_VERSION (14 ,0 ,2 ): + adev->smuio.funcs = &smuio_v14_0_2_funcs; +break ;default :break ; }
Signature · 1 line
2.44.0