Skip to content

Commit 4872850

Browse files
committed
Merge branch 'drm-next-4.8' of git://people.freedesktop.org/~agd5f/linux into drm-next
A few fixes for amdgpu and ttm for 4.8 - fix a ttm regression caused by the new pipelining code - fixes for mullins on amdgpu - updated golden settings for amdgpu * 'drm-next-4.8' of git://people.freedesktop.org/~agd5f/linux: drm/ttm: Wait for a BO to become idle before unbinding it from GTT drm/amdgpu: update golden setting of polaris10 drm/amdgpu: update golden setting of stoney drm/amdgpu: update golden setting of polaris11 drm/amdgpu: update golden setting of carrizo drm/amdgpu: update golden setting of iceland drm/amd/amdgpu: change pptable output format from ASCII to binary drm/amdgpu/ci: add mullins to default case for smc ucode drm/amdgpu/gmc7: add missing mullins case
2 parents e8285ce + 34b5835 commit 4872850

File tree

11 files changed

+39
-18
lines changed

11 files changed

+39
-18
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static ssize_t amdgpu_get_pp_table(struct device *dev,
305305
struct drm_device *ddev = dev_get_drvdata(dev);
306306
struct amdgpu_device *adev = ddev->dev_private;
307307
char *table = NULL;
308-
int size, i;
308+
int size;
309309

310310
if (adev->pp_enabled)
311311
size = amdgpu_dpm_get_pp_table(adev, &table);
@@ -315,10 +315,7 @@ static ssize_t amdgpu_get_pp_table(struct device *dev,
315315
if (size >= PAGE_SIZE)
316316
size = PAGE_SIZE - 1;
317317

318-
for (i = 0; i < size; i++) {
319-
sprintf(buf + i, "%02x", table[i]);
320-
}
321-
sprintf(buf + i, "\n");
318+
memcpy(buf, table, size);
322319

323320
return size;
324321
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo,
335335
if (unlikely(r)) {
336336
goto out_cleanup;
337337
}
338-
r = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);
338+
r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, new_mem);
339339
out_cleanup:
340340
ttm_bo_mem_put(bo, &tmp_mem);
341341
return r;
@@ -368,7 +368,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo,
368368
if (unlikely(r)) {
369369
return r;
370370
}
371-
r = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);
371+
r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, &tmp_mem);
372372
if (unlikely(r)) {
373373
goto out_cleanup;
374374
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5779,6 +5779,7 @@ static int ci_dpm_init_microcode(struct amdgpu_device *adev)
57795779
break;
57805780
case CHIP_KAVERI:
57815781
case CHIP_KABINI:
5782+
case CHIP_MULLINS:
57825783
default: BUG();
57835784
}
57845785

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ static const u32 tonga_mgcg_cgcg_init[] =
270270

271271
static const u32 golden_settings_polaris11_a11[] =
272272
{
273-
mmCB_HW_CONTROL, 0xfffdf3cf, 0x00006208,
273+
mmCB_HW_CONTROL, 0x0000f3cf, 0x00007208,
274+
mmCB_HW_CONTROL_2, 0x0f000000, 0x0f000000,
274275
mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040,
275276
mmDB_DEBUG2, 0xf00fffff, 0x00000400,
276277
mmPA_SC_ENHANCE, 0xffffffff, 0x20000001,
@@ -279,7 +280,7 @@ static const u32 golden_settings_polaris11_a11[] =
279280
mmPA_SC_RASTER_CONFIG_1, 0x0000003f, 0x00000000,
280281
mmRLC_CGCG_CGLS_CTRL, 0x00000003, 0x0001003c,
281282
mmRLC_CGCG_CGLS_CTRL_3D, 0xffffffff, 0x0001003c,
282-
mmSQ_CONFIG, 0x07f80000, 0x07180000,
283+
mmSQ_CONFIG, 0x07f80000, 0x01180000,
283284
mmTA_CNTL_AUX, 0x000f000f, 0x000b0000,
284285
mmTCC_CTRL, 0x00100000, 0xf31fff7f,
285286
mmTCP_ADDR_CONFIG, 0x000003ff, 0x000000f3,
@@ -301,8 +302,8 @@ static const u32 polaris11_golden_common_all[] =
301302
static const u32 golden_settings_polaris10_a11[] =
302303
{
303304
mmATC_MISC_CG, 0x000c0fc0, 0x000c0200,
304-
mmCB_HW_CONTROL, 0xfffdf3cf, 0x00007208,
305-
mmCB_HW_CONTROL_2, 0, 0x0f000000,
305+
mmCB_HW_CONTROL, 0x0001f3cf, 0x00007208,
306+
mmCB_HW_CONTROL_2, 0x0f000000, 0x0f000000,
306307
mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040,
307308
mmDB_DEBUG2, 0xf00fffff, 0x00000400,
308309
mmPA_SC_ENHANCE, 0xffffffff, 0x20000001,
@@ -409,6 +410,7 @@ static const u32 golden_settings_iceland_a11[] =
409410
mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000,
410411
mmPA_SC_RASTER_CONFIG, 0x3f3fffff, 0x00000002,
411412
mmPA_SC_RASTER_CONFIG_1, 0x0000003f, 0x00000000,
413+
mmRLC_CGCG_CGLS_CTRL, 0x00000003, 0x0000003c,
412414
mmSQ_RANDOM_WAVE_PRI, 0x001fffff, 0x000006fd,
413415
mmTA_CNTL_AUX, 0x000f000f, 0x000b0000,
414416
mmTCC_CTRL, 0x00100000, 0xf31fff7f,
@@ -505,8 +507,10 @@ static const u32 cz_golden_settings_a11[] =
505507
mmGB_GPU_ID, 0x0000000f, 0x00000000,
506508
mmPA_SC_ENHANCE, 0xffffffff, 0x00000001,
507509
mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000,
510+
mmRLC_CGCG_CGLS_CTRL, 0x00000003, 0x0000003c,
508511
mmSQ_RANDOM_WAVE_PRI, 0x001fffff, 0x000006fd,
509512
mmTA_CNTL_AUX, 0x000f000f, 0x00010000,
513+
mmTCC_CTRL, 0x00100000, 0xf31fff7f,
510514
mmTCC_EXE_DISABLE, 0x00000002, 0x00000002,
511515
mmTCP_ADDR_CONFIG, 0x0000000f, 0x000000f3,
512516
mmTCP_CHAN_STEER_LO, 0xffffffff, 0x00001302

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
144144
break;
145145
case CHIP_KAVERI:
146146
case CHIP_KABINI:
147+
case CHIP_MULLINS:
147148
return 0;
148149
default: BUG();
149150
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ static const u32 stoney_mgcg_cgcg_init[] =
103103
mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
104104
};
105105

106+
static const u32 golden_settings_stoney_common[] =
107+
{
108+
mmMC_HUB_RDREQ_UVD, MC_HUB_RDREQ_UVD__PRESCALE_MASK, 0x00000004,
109+
mmMC_RD_GRP_OTH, MC_RD_GRP_OTH__UVD_MASK, 0x00600000
110+
};
106111

107112
static void gmc_v8_0_init_golden_registers(struct amdgpu_device *adev)
108113
{
@@ -142,6 +147,9 @@ static void gmc_v8_0_init_golden_registers(struct amdgpu_device *adev)
142147
amdgpu_program_register_sequence(adev,
143148
stoney_mgcg_cgcg_init,
144149
(const u32)ARRAY_SIZE(stoney_mgcg_cgcg_init));
150+
amdgpu_program_register_sequence(adev,
151+
golden_settings_stoney_common,
152+
(const u32)ARRAY_SIZE(golden_settings_stoney_common));
145153
break;
146154
default:
147155
break;

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
11511151
if (ret)
11521152
goto out;
11531153

1154-
ret = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);
1154+
ret = ttm_bo_move_ttm(bo, true, intr, no_wait_gpu, new_mem);
11551155
out:
11561156
ttm_bo_mem_put(bo, &tmp_mem);
11571157
return ret;
@@ -1179,7 +1179,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
11791179
if (ret)
11801180
return ret;
11811181

1182-
ret = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);
1182+
ret = ttm_bo_move_ttm(bo, true, intr, no_wait_gpu, &tmp_mem);
11831183
if (ret)
11841184
goto out;
11851185

drivers/gpu/drm/radeon/radeon_ttm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
346346
if (unlikely(r)) {
347347
goto out_cleanup;
348348
}
349-
r = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);
349+
r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, new_mem);
350350
out_cleanup:
351351
ttm_bo_mem_put(bo, &tmp_mem);
352352
return r;
@@ -379,7 +379,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
379379
if (unlikely(r)) {
380380
return r;
381381
}
382-
r = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);
382+
r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, &tmp_mem);
383383
if (unlikely(r)) {
384384
goto out_cleanup;
385385
}

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
354354

355355
if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
356356
!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED))
357-
ret = ttm_bo_move_ttm(bo, evict, no_wait_gpu, mem);
357+
ret = ttm_bo_move_ttm(bo, evict, interruptible, no_wait_gpu,
358+
mem);
358359
else if (bdev->driver->move)
359360
ret = bdev->driver->move(bo, evict, interruptible,
360361
no_wait_gpu, mem);

drivers/gpu/drm/ttm/ttm_bo_util.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,22 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
4545
}
4646

4747
int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
48-
bool evict,
48+
bool evict, bool interruptible,
4949
bool no_wait_gpu, struct ttm_mem_reg *new_mem)
5050
{
5151
struct ttm_tt *ttm = bo->ttm;
5252
struct ttm_mem_reg *old_mem = &bo->mem;
5353
int ret;
5454

5555
if (old_mem->mem_type != TTM_PL_SYSTEM) {
56+
ret = ttm_bo_wait(bo, interruptible, no_wait_gpu);
57+
58+
if (unlikely(ret != 0)) {
59+
if (ret != -ERESTARTSYS)
60+
pr_err("Failed to expire sync object before unbinding TTM\n");
61+
return ret;
62+
}
63+
5664
ttm_tt_unbind(ttm);
5765
ttm_bo_free_old_node(bo);
5866
ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,

include/drm/ttm/ttm_bo_driver.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev,
962962
*
963963
* @bo: A pointer to a struct ttm_buffer_object.
964964
* @evict: 1: This is an eviction. Don't try to pipeline.
965+
* @interruptible: Sleep interruptible if waiting.
965966
* @no_wait_gpu: Return immediately if the GPU is busy.
966967
* @new_mem: struct ttm_mem_reg indicating where to move.
967968
*
@@ -976,7 +977,7 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev,
976977
*/
977978

978979
extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
979-
bool evict, bool no_wait_gpu,
980+
bool evict, bool interruptible, bool no_wait_gpu,
980981
struct ttm_mem_reg *new_mem);
981982

982983
/**

0 commit comments

Comments
 (0)