Skip to content

Commit 52cd9bc

Browse files
amd-pvishwakalexdeucher
authored andcommitted
drm/amd: Enable SMUIO 15_0_0 support
Add SMUIO 15_0_0. Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 6565321 commit 52cd9bc

4 files changed

Lines changed: 85 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ amdgpu-y += \
253253
smuio_v13_0_3.o \
254254
smuio_v13_0_6.o \
255255
smuio_v14_0_2.o \
256+
smuio_v15_0_0.o \
256257
smuio_v15_0_8.o
257258

258259
# add reset block

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
#include "smuio_v13_0_3.h"
108108
#include "smuio_v13_0_6.h"
109109
#include "smuio_v14_0_2.h"
110+
#include "smuio_v15_0_0.h"
110111
#include "smuio_v15_0_8.h"
111112
#include "vcn_v5_0_0.h"
112113
#include "vcn_v5_0_1.h"
@@ -3192,6 +3193,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
31923193
case IP_VERSION(14, 0, 2):
31933194
adev->smuio.funcs = &smuio_v14_0_2_funcs;
31943195
break;
3196+
case IP_VERSION(15, 0, 0):
3197+
adev->smuio.funcs = &smuio_v15_0_0_funcs;
3198+
break;
31953199
case IP_VERSION(15, 0, 8):
31963200
adev->smuio.funcs = &smuio_v15_0_8_funcs;
31973201
break;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2025 Advanced Micro Devices, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
#include "amdgpu.h"
24+
#include "smuio_v15_0_0.h"
25+
#include "smuio/smuio_15_0_0_offset.h"
26+
#include "smuio/smuio_15_0_0_sh_mask.h"
27+
#include <linux/preempt.h>
28+
29+
static u64 smuio_v15_0_0_get_gpu_clock_counter(struct amdgpu_device *adev)
30+
{
31+
u64 clock;
32+
u64 clock_counter_lo, clock_counter_hi_pre, clock_counter_hi_after;
33+
34+
preempt_disable();
35+
clock_counter_hi_pre = (u64)RREG32_SOC15(SMUIO, 0, regGOLDEN_TSC_COUNT_UPPER);
36+
clock_counter_lo = (u64)RREG32_SOC15(SMUIO, 0, regGOLDEN_TSC_COUNT_LOWER);
37+
/* the clock counter may be udpated during polling the counters */
38+
clock_counter_hi_after = (u64)RREG32_SOC15(SMUIO, 0, regGOLDEN_TSC_COUNT_UPPER);
39+
if (clock_counter_hi_pre != clock_counter_hi_after)
40+
clock_counter_lo = (u64)RREG32_SOC15(SMUIO, 0, regGOLDEN_TSC_COUNT_LOWER);
41+
preempt_enable();
42+
43+
clock = clock_counter_lo | (clock_counter_hi_after << 32ULL);
44+
45+
return clock;
46+
}
47+
48+
const struct amdgpu_smuio_funcs smuio_v15_0_0_funcs = {
49+
.get_gpu_clock_counter = smuio_v15_0_0_get_gpu_clock_counter,
50+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2025 Advanced Micro Devices, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
#ifndef __SMUIO_V15_0_0_H__
24+
#define __SMUIO_V15_0_0_H__
25+
26+
#include "soc15_common.h"
27+
28+
extern const struct amdgpu_smuio_funcs smuio_v15_0_0_funcs;
29+
30+
#endif /* __SMUIO_V15_0_0_H__ */

0 commit comments

Comments
 (0)