Skip to content

Commit 69b79e8

Browse files
committed
drm/msm/a6xx: Cleanup indexed regs const'ness
These tables were made non-const in commit 3cba4a2 ("drm/msm/a6xx: Update ROQ size in coredump") in order to avoid powering up the GPU when reading back a devcoredump. Instead let's just stash the count that is potentially read from hw in struct a6xx_gpu_state_obj, and make the tables const again. Signed-off-by: Rob Clark <robdclark@chromium.org> Patchwork: https://patchwork.freedesktop.org/patch/592699/
1 parent f3f8207 commit 69b79e8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
struct a6xx_gpu_state_obj {
2525
const void *handle;
2626
u32 *data;
27+
u32 count; /* optional, used when count potentially read from hw */
2728
};
2829

2930
struct a6xx_gpu_state {
@@ -1437,24 +1438,26 @@ static u32 a7xx_get_cp_roq_size(struct msm_gpu *gpu)
14371438
/* Read a block of data from an indexed register pair */
14381439
static void a6xx_get_indexed_regs(struct msm_gpu *gpu,
14391440
struct a6xx_gpu_state *a6xx_state,
1440-
struct a6xx_indexed_registers *indexed,
1441+
const struct a6xx_indexed_registers *indexed,
14411442
struct a6xx_gpu_state_obj *obj)
14421443
{
1444+
u32 count = indexed->count;
14431445
int i;
14441446

14451447
obj->handle = (const void *) indexed;
14461448
if (indexed->count_fn)
1447-
indexed->count = indexed->count_fn(gpu);
1449+
count = indexed->count_fn(gpu);
14481450

1449-
obj->data = state_kcalloc(a6xx_state, indexed->count, sizeof(u32));
1451+
obj->data = state_kcalloc(a6xx_state, count, sizeof(u32));
1452+
obj->count = count;
14501453
if (!obj->data)
14511454
return;
14521455

14531456
/* All the indexed banks start at address 0 */
14541457
gpu_write(gpu, indexed->addr, 0);
14551458

14561459
/* Read the data - each read increments the internal address by 1 */
1457-
for (i = 0; i < indexed->count; i++)
1460+
for (i = 0; i < count; i++)
14581461
obj->data[i] = gpu_read(gpu, indexed->data);
14591462
}
14601463

@@ -1890,9 +1893,9 @@ static void a6xx_show_indexed_regs(struct a6xx_gpu_state_obj *obj,
18901893
return;
18911894

18921895
print_name(p, " - regs-name: ", indexed->name);
1893-
drm_printf(p, " dwords: %d\n", indexed->count);
1896+
drm_printf(p, " dwords: %d\n", obj->count);
18941897

1895-
print_ascii85(p, indexed->count << 2, obj->data);
1898+
print_ascii85(p, obj->count << 2, obj->data);
18961899
}
18971900

18981901
static void a6xx_show_debugbus_block(const struct a6xx_debugbus_block *block,

drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ struct a6xx_indexed_registers {
397397
u32 (*count_fn)(struct msm_gpu *gpu);
398398
};
399399

400-
static struct a6xx_indexed_registers a6xx_indexed_reglist[] = {
400+
static const struct a6xx_indexed_registers a6xx_indexed_reglist[] = {
401401
{ "CP_SQE_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
402402
REG_A6XX_CP_SQE_STAT_DATA, 0x33, NULL },
403403
{ "CP_DRAW_STATE", REG_A6XX_CP_DRAW_STATE_ADDR,
@@ -408,7 +408,7 @@ static struct a6xx_indexed_registers a6xx_indexed_reglist[] = {
408408
REG_A6XX_CP_ROQ_DBG_DATA, 0, a6xx_get_cp_roq_size},
409409
};
410410

411-
static struct a6xx_indexed_registers a7xx_indexed_reglist[] = {
411+
static const struct a6xx_indexed_registers a7xx_indexed_reglist[] = {
412412
{ "CP_SQE_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
413413
REG_A6XX_CP_SQE_STAT_DATA, 0x33, NULL },
414414
{ "CP_DRAW_STATE", REG_A6XX_CP_DRAW_STATE_ADDR,
@@ -433,12 +433,12 @@ static struct a6xx_indexed_registers a7xx_indexed_reglist[] = {
433433
REG_A6XX_CP_ROQ_DBG_DATA, 0, a7xx_get_cp_roq_size },
434434
};
435435

436-
static struct a6xx_indexed_registers a6xx_cp_mempool_indexed = {
436+
static const struct a6xx_indexed_registers a6xx_cp_mempool_indexed = {
437437
"CP_MEMPOOL", REG_A6XX_CP_MEM_POOL_DBG_ADDR,
438438
REG_A6XX_CP_MEM_POOL_DBG_DATA, 0x2060, NULL,
439439
};
440440

441-
static struct a6xx_indexed_registers a7xx_cp_bv_mempool_indexed[] = {
441+
static const struct a6xx_indexed_registers a7xx_cp_bv_mempool_indexed[] = {
442442
{ "CP_MEMPOOL", REG_A6XX_CP_MEM_POOL_DBG_ADDR,
443443
REG_A6XX_CP_MEM_POOL_DBG_DATA, 0x2100, NULL },
444444
{ "CP_BV_MEMPOOL", REG_A7XX_CP_BV_MEM_POOL_DBG_ADDR,

0 commit comments

Comments
 (0)