Skip to content

Commit 7a637e5

Browse files
wermanrobclark
authored andcommitted
drm/msm: Expose uche trap base via uapi
This adds MSM_PARAM_UCHE_TRAP_BASE that will be used by Mesa implementation for VK_KHR_shader_clock and GL_ARB_shader_clock. Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Patchwork: https://patchwork.freedesktop.org/patch/627036/ Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent 855e9d0 commit 7a637e5

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ static int a4xx_hw_init(struct msm_gpu *gpu)
251251
gpu_write(gpu, REG_A4XX_UCHE_CACHE_WAYS_VFD, 0x07);
252252

253253
/* Disable L2 bypass to avoid UCHE out of bounds errors */
254-
gpu_write(gpu, REG_A4XX_UCHE_TRAP_BASE_LO, 0xffff0000);
255-
gpu_write(gpu, REG_A4XX_UCHE_TRAP_BASE_HI, 0xffff0000);
254+
gpu_write(gpu, REG_A4XX_UCHE_TRAP_BASE_LO, lower_32_bits(adreno_gpu->uche_trap_base));
255+
gpu_write(gpu, REG_A4XX_UCHE_TRAP_BASE_HI, upper_32_bits(adreno_gpu->uche_trap_base));
256256

257257
gpu_write(gpu, REG_A4XX_CP_DEBUG, (1 << 25) |
258258
(adreno_is_a420(adreno_gpu) ? (1 << 29) : 0));
@@ -693,6 +693,8 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
693693
if (ret)
694694
goto fail;
695695

696+
adreno_gpu->uche_trap_base = 0xffff0000ffff0000ull;
697+
696698
if (!gpu->aspace) {
697699
/* TODO we think it is possible to configure the GPU to
698700
* restrict access to VRAM carveout. But the required

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,10 +750,10 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
750750
gpu_write(gpu, REG_A5XX_UCHE_CACHE_WAYS, 0x02);
751751

752752
/* Disable L2 bypass in the UCHE */
753-
gpu_write(gpu, REG_A5XX_UCHE_TRAP_BASE_LO, 0xFFFF0000);
754-
gpu_write(gpu, REG_A5XX_UCHE_TRAP_BASE_HI, 0x0001FFFF);
755-
gpu_write(gpu, REG_A5XX_UCHE_WRITE_THRU_BASE_LO, 0xFFFF0000);
756-
gpu_write(gpu, REG_A5XX_UCHE_WRITE_THRU_BASE_HI, 0x0001FFFF);
753+
gpu_write(gpu, REG_A5XX_UCHE_TRAP_BASE_LO, lower_32_bits(adreno_gpu->uche_trap_base));
754+
gpu_write(gpu, REG_A5XX_UCHE_TRAP_BASE_HI, upper_32_bits(adreno_gpu->uche_trap_base));
755+
gpu_write(gpu, REG_A5XX_UCHE_WRITE_THRU_BASE_LO, lower_32_bits(adreno_gpu->uche_trap_base));
756+
gpu_write(gpu, REG_A5XX_UCHE_WRITE_THRU_BASE_HI, upper_32_bits(adreno_gpu->uche_trap_base));
757757

758758
/* Set the GMEM VA range (0 to gpu->gmem) */
759759
gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MIN_LO, 0x00100000);
@@ -1805,5 +1805,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
18051805
adreno_gpu->ubwc_config.macrotile_mode = 0;
18061806
adreno_gpu->ubwc_config.ubwc_swizzle = 0x7;
18071807

1808+
adreno_gpu->uche_trap_base = 0x0001ffffffff0000ull;
1809+
18081810
return gpu;
18091811
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,12 +1123,12 @@ static int hw_init(struct msm_gpu *gpu)
11231123

11241124
/* Disable L2 bypass in the UCHE */
11251125
if (adreno_is_a7xx(adreno_gpu)) {
1126-
gpu_write64(gpu, REG_A6XX_UCHE_TRAP_BASE, 0x0001fffffffff000llu);
1127-
gpu_write64(gpu, REG_A6XX_UCHE_WRITE_THRU_BASE, 0x0001fffffffff000llu);
1126+
gpu_write64(gpu, REG_A6XX_UCHE_TRAP_BASE, adreno_gpu->uche_trap_base);
1127+
gpu_write64(gpu, REG_A6XX_UCHE_WRITE_THRU_BASE, adreno_gpu->uche_trap_base);
11281128
} else {
1129-
gpu_write64(gpu, REG_A6XX_UCHE_WRITE_RANGE_MAX, 0x0001ffffffffffc0llu);
1130-
gpu_write64(gpu, REG_A6XX_UCHE_TRAP_BASE, 0x0001fffffffff000llu);
1131-
gpu_write64(gpu, REG_A6XX_UCHE_WRITE_THRU_BASE, 0x0001fffffffff000llu);
1129+
gpu_write64(gpu, REG_A6XX_UCHE_WRITE_RANGE_MAX, adreno_gpu->uche_trap_base + 0xfc0);
1130+
gpu_write64(gpu, REG_A6XX_UCHE_TRAP_BASE, adreno_gpu->uche_trap_base);
1131+
gpu_write64(gpu, REG_A6XX_UCHE_WRITE_THRU_BASE, adreno_gpu->uche_trap_base);
11321132
}
11331133

11341134
if (!(adreno_is_a650_family(adreno_gpu) ||
@@ -2533,6 +2533,8 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
25332533
}
25342534
}
25352535

2536+
adreno_gpu->uche_trap_base = 0x1fffffffff000ull;
2537+
25362538
if (gpu->aspace)
25372539
msm_mmu_set_fault_handler(gpu->aspace->mmu, gpu,
25382540
a6xx_fault_handler);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
385385
case MSM_PARAM_MACROTILE_MODE:
386386
*value = adreno_gpu->ubwc_config.macrotile_mode;
387387
return 0;
388+
case MSM_PARAM_UCHE_TRAP_BASE:
389+
*value = adreno_gpu->uche_trap_base;
390+
return 0;
388391
default:
389392
DBG("%s: invalid param: %u", gpu->name, param);
390393
return -EINVAL;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ struct adreno_gpu {
253253
bool gmu_is_wrapper;
254254

255255
bool has_ray_tracing;
256+
257+
u64 uche_trap_base;
256258
};
257259
#define to_adreno_gpu(x) container_of(x, struct adreno_gpu, base)
258260

include/uapi/drm/msm_drm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct drm_msm_timespec {
9090
#define MSM_PARAM_RAYTRACING 0x11 /* RO */
9191
#define MSM_PARAM_UBWC_SWIZZLE 0x12 /* RO */
9292
#define MSM_PARAM_MACROTILE_MODE 0x13 /* RO */
93+
#define MSM_PARAM_UCHE_TRAP_BASE 0x14 /* RO */
9394

9495
/* For backwards compat. The original support for preemption was based on
9596
* a single ring per priority level so # of priority levels equals the #

0 commit comments

Comments
 (0)