Skip to content

Commit 9038e25

Browse files
michchen-amdalexdeucher
authored andcommitted
drm/amdgpu: increase mes log buffer size for gfx12
MES firmware requires larger log buffer for gfx12. Allocate proper buffer respectively for gfx11 and gfx12. Signed-off-by: Michael Chen <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 739d0f3)
1 parent f3572db commit 9038e25

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
103103
if (!amdgpu_mes_log_enable)
104104
return 0;
105105

106-
r = amdgpu_bo_create_kernel(adev, AMDGPU_MES_LOG_BUFFER_SIZE, PAGE_SIZE,
106+
r = amdgpu_bo_create_kernel(adev, adev->mes.event_log_size, PAGE_SIZE,
107107
AMDGPU_GEM_DOMAIN_GTT,
108108
&adev->mes.event_log_gpu_obj,
109109
&adev->mes.event_log_gpu_addr,
@@ -113,7 +113,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
113113
return r;
114114
}
115115

116-
memset(adev->mes.event_log_cpu_addr, 0, PAGE_SIZE);
116+
memset(adev->mes.event_log_cpu_addr, 0, adev->mes.event_log_size);
117117

118118
return 0;
119119

@@ -1573,7 +1573,7 @@ static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
15731573
uint32_t *mem = (uint32_t *)(adev->mes.event_log_cpu_addr);
15741574

15751575
seq_hex_dump(m, "", DUMP_PREFIX_OFFSET, 32, 4,
1576-
mem, AMDGPU_MES_LOG_BUFFER_SIZE, false);
1576+
mem, adev->mes.event_log_size, false);
15771577

15781578
return 0;
15791579
}

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ enum amdgpu_mes_priority_level {
5252

5353
#define AMDGPU_MES_PROC_CTX_SIZE 0x1000 /* one page area */
5454
#define AMDGPU_MES_GANG_CTX_SIZE 0x1000 /* one page area */
55-
#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000 /* Maximu log buffer size for MES */
5655

5756
struct amdgpu_mes_funcs;
5857

@@ -135,8 +134,9 @@ struct amdgpu_mes {
135134
unsigned long *doorbell_bitmap;
136135

137136
/* MES event log buffer */
138-
struct amdgpu_bo *event_log_gpu_obj;
139-
uint64_t event_log_gpu_addr;
137+
uint32_t event_log_size;
138+
struct amdgpu_bo *event_log_gpu_obj;
139+
uint64_t event_log_gpu_addr;
140140
void *event_log_cpu_addr;
141141

142142
/* ip specific functions */

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,8 @@ static int mes_v11_0_sw_init(void *handle)
11631163
adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init;
11641164
adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini;
11651165

1166+
adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE;
1167+
11661168
r = amdgpu_mes_init(adev);
11671169
if (r)
11681170
return r;

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,10 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes)
551551
mes_set_hw_res_pkt.oversubscription_timer = 50;
552552
mes_set_hw_res_pkt.unmapped_doorbell_handling = 1;
553553

554-
mes_set_hw_res_pkt.enable_mes_event_int_logging = 0;
555-
mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr;
554+
if (amdgpu_mes_log_enable) {
555+
mes_set_hw_res_pkt.enable_mes_event_int_logging = 1;
556+
mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr;
557+
}
556558

557559
return mes_v12_0_submit_pkt_and_poll_completion(mes,
558560
&mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt),
@@ -1237,6 +1239,8 @@ static int mes_v12_0_sw_init(void *handle)
12371239
adev->mes.kiq_hw_init = &mes_v12_0_kiq_hw_init;
12381240
adev->mes.kiq_hw_fini = &mes_v12_0_kiq_hw_fini;
12391241

1242+
adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE;
1243+
12401244
r = amdgpu_mes_init(adev);
12411245
if (r)
12421246
return r;

drivers/gpu/drm/amd/include/mes_v11_api_def.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
#define MES_API_VERSION 1
3030

31+
/* Maximum log buffer size for MES. Needs to be updated if MES expands MES_EVT_INTR_HIST_LOG */
32+
#define AMDGPU_MES_LOG_BUFFER_SIZE 0x4000
33+
3134
/* Driver submits one API(cmd) as a single Frame and this command size is same
3235
* for all API to ease the debugging and parsing of ring buffer.
3336
*/

drivers/gpu/drm/amd/include/mes_v12_api_def.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
#define MES_API_VERSION 0x14
3030

31+
/* Maximum log buffer size for MES. Needs to be updated if MES expands MES_EVT_INTR_HIST_LOG_12 */
32+
#define AMDGPU_MES_LOG_BUFFER_SIZE 0xC000
33+
3134
/* Driver submits one API(cmd) as a single Frame and this command size is same for all API
3235
* to ease the debugging and parsing of ring buffer.
3336
*/

0 commit comments

Comments
 (0)