Skip to content

Commit 059fe82

Browse files
committed
Merge tag 'drm-fixes-2020-12-11' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Last week of fixes, just amdgpu and i915 collections. We had a i915 regression reported by HJ Lu reported this morning, and this contains a fix for that he has tested. There are a fair few other fixes, but they are spread across the two drivers, and all fairly self contained. amdgpu: - Fan fix for CI asics - Fix a warning in possible_crtcs - Build fix for when debugfs is disabled - Display overflow fix - Display watermark fixes for Renoir - SDMA 5.2 fix - Stolen vga memory regression fix - Power profile fixes - Fix a regression from removal of GEM and PRIME callbacks amdkfd: - Fix a memory leak in dmabuf import i915: - rc7 regression fix for modesetting - vdsc/dp slice fixes - gen9 mocs entries fix - preemption timeout fix - unsigned compare against 0 fix - selftest fix - submission error propogatig fix - request flow suspend fix" * tag 'drm-fixes-2020-12-11' of git://anongit.freedesktop.org/drm/drm: drm/i915/display: Go softly softly on initial modeset failure drm/amd/pm: typo fix (CUSTOM -> COMPUTE) drm/amdgpu: Initialise drm_gem_object_funcs for imported BOs drm/amdgpu: fix size calculation with stolen vga memory drm/amd/pm: update smu10.h WORKLOAD_PPLIB setting for raven drm/amdkfd: Fix leak in dmabuf import drm/amdgpu: fix sdma instance fw version and feature version init drm/amd/display: Add wm table for Renoir drm/amd/display: Prevent bandwidth overflow drm/amdgpu: fix debugfs creation/removal, again drm/amdgpu/disply: set num_crtc earlier drm/amdgpu/powerplay: parse fan table for CI asics drm/i915/gt: Declare gen9 has 64 mocs entries! drm/i915/display/dp: Compute the correct slice count for VDSC on DP drm/i915: fix size_t greater or equal to zero comparison drm/i915/gt: Cancel the preemption timeout on responding to it drm/i915/gt: Ignore repeated attempts to suspend request flow across reset drm/i915/gem: Propagate error from cancelled submit due to context closure drm/i915/gem: Check the correct variable in selftest
2 parents 33dc961 + b1f195f commit 059fe82

21 files changed

Lines changed: 269 additions & 74 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf)
459459
struct amdgpu_device *adev = drm_to_adev(dev);
460460
struct amdgpu_bo *bo;
461461
struct amdgpu_bo_param bp;
462+
struct drm_gem_object *gobj;
462463
int ret;
463464

464465
memset(&bp, 0, sizeof(bp));
@@ -469,17 +470,20 @@ amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf)
469470
bp.type = ttm_bo_type_sg;
470471
bp.resv = resv;
471472
dma_resv_lock(resv, NULL);
472-
ret = amdgpu_bo_create(adev, &bp, &bo);
473+
ret = amdgpu_gem_object_create(adev, dma_buf->size, PAGE_SIZE,
474+
AMDGPU_GEM_DOMAIN_CPU,
475+
0, ttm_bo_type_sg, resv, &gobj);
473476
if (ret)
474477
goto error;
475478

479+
bo = gem_to_amdgpu_bo(gobj);
476480
bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT;
477481
bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT;
478482
if (dma_buf->ops != &amdgpu_dmabuf_ops)
479483
bo->prime_shared_count = 1;
480484

481485
dma_resv_unlock(resv);
482-
return &bo->tbo.base;
486+
return gobj;
483487

484488
error:
485489
dma_resv_unlock(resv);

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

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,12 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
6666
bp.type = type;
6767
bp.resv = resv;
6868
bp.preferred_domain = initial_domain;
69-
retry:
7069
bp.flags = flags;
7170
bp.domain = initial_domain;
7271
r = amdgpu_bo_create(adev, &bp, &bo);
73-
if (r) {
74-
if (r != -ERESTARTSYS) {
75-
if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
76-
flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
77-
goto retry;
78-
}
79-
80-
if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
81-
initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
82-
goto retry;
83-
}
84-
DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
85-
size, initial_domain, alignment, r);
86-
}
72+
if (r)
8773
return r;
88-
}
74+
8975
*obj = &bo->tbo.base;
9076

9177
return 0;
@@ -225,7 +211,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
225211
uint64_t size = args->in.bo_size;
226212
struct dma_resv *resv = NULL;
227213
struct drm_gem_object *gobj;
228-
uint32_t handle;
214+
uint32_t handle, initial_domain;
229215
int r;
230216

231217
/* reject invalid gem flags */
@@ -269,9 +255,28 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
269255
resv = vm->root.base.bo->tbo.base.resv;
270256
}
271257

258+
retry:
259+
initial_domain = (u32)(0xffffffff & args->in.domains);
272260
r = amdgpu_gem_object_create(adev, size, args->in.alignment,
273-
(u32)(0xffffffff & args->in.domains),
261+
initial_domain,
274262
flags, ttm_bo_type_device, resv, &gobj);
263+
if (r) {
264+
if (r != -ERESTARTSYS) {
265+
if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
266+
flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
267+
goto retry;
268+
}
269+
270+
if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
271+
initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
272+
goto retry;
273+
}
274+
DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n",
275+
size, initial_domain, args->in.alignment, r);
276+
}
277+
return r;
278+
}
279+
275280
if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {
276281
if (!r) {
277282
struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,9 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
499499
else
500500
size = amdgpu_gmc_get_vbios_fb_size(adev);
501501

502+
if (adev->mman.keep_stolen_vga_memory)
503+
size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION);
504+
502505
/* set to 0 if the pre-OS buffer uses up most of vram */
503506
if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
504507
size = 0;

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
11721172
con->dir, &con->disable_ras_err_cnt_harvest);
11731173
}
11741174

1175-
void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
1175+
static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
11761176
struct ras_fs_if *head)
11771177
{
11781178
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
@@ -1194,7 +1194,6 @@ void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
11941194

11951195
void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
11961196
{
1197-
#if defined(CONFIG_DEBUG_FS)
11981197
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
11991198
struct ras_manager *obj;
12001199
struct ras_fs_if fs_info;
@@ -1203,7 +1202,7 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
12031202
* it won't be called in resume path, no need to check
12041203
* suspend and gpu reset status
12051204
*/
1206-
if (!con)
1205+
if (!IS_ENABLED(CONFIG_DEBUG_FS) || !con)
12071206
return;
12081207

12091208
amdgpu_ras_debugfs_create_ctrl_node(adev);
@@ -1217,10 +1216,9 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev)
12171216
amdgpu_ras_debugfs_create(adev, &fs_info);
12181217
}
12191218
}
1220-
#endif
12211219
}
12221220

1223-
void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
1221+
static void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
12241222
struct ras_common_if *head)
12251223
{
12261224
struct ras_manager *obj = amdgpu_ras_find_obj(adev, head);
@@ -1234,7 +1232,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
12341232

12351233
static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
12361234
{
1237-
#if defined(CONFIG_DEBUG_FS)
12381235
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
12391236
struct ras_manager *obj, *tmp;
12401237

@@ -1243,7 +1240,6 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
12431240
}
12441241

12451242
con->dir = NULL;
1246-
#endif
12471243
}
12481244
/* debugfs end */
12491245

@@ -1291,7 +1287,8 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
12911287

12921288
static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)
12931289
{
1294-
amdgpu_ras_debugfs_remove_all(adev);
1290+
if (IS_ENABLED(CONFIG_DEBUG_FS))
1291+
amdgpu_ras_debugfs_remove_all(adev);
12951292
amdgpu_ras_sysfs_remove_all(adev);
12961293
return 0;
12971294
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,8 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
607607
int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev,
608608
struct ras_common_if *head);
609609

610-
void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
611-
struct ras_fs_if *head);
612-
613610
void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev);
614611

615-
void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
616-
struct ras_common_if *head);
617-
618612
int amdgpu_ras_error_query(struct amdgpu_device *adev,
619613
struct ras_query_if *info);
620614

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static int sdma_v5_2_init_microcode(struct amdgpu_device *adev)
186186
if (err)
187187
goto out;
188188

189-
err = sdma_v5_2_init_inst_ctx(&adev->sdma.instance[0]);
189+
err = sdma_v5_2_init_inst_ctx(&adev->sdma.instance[i]);
190190
if (err)
191191
goto out;
192192
}

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,7 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
17361736
}
17371737

17381738
mutex_unlock(&p->mutex);
1739+
dma_buf_put(dmabuf);
17391740

17401741
args->handle = MAKE_HANDLE(args->gpu_id, idr_handle);
17411742

@@ -1745,6 +1746,7 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
17451746
amdgpu_amdkfd_gpuvm_free_memory_of_gpu(dev->kgd, (struct kgd_mem *)mem, NULL);
17461747
err_unlock:
17471748
mutex_unlock(&p->mutex);
1749+
dma_buf_put(dmabuf);
17481750
return r;
17491751
}
17501752

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,9 +1058,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
10581058
goto error;
10591059
}
10601060

1061-
/* Update the actual used number of crtc */
1062-
adev->mode_info.num_crtc = adev->dm.display_indexes_num;
1063-
10641061
/* create fake encoders for MST */
10651062
dm_dp_create_fake_mst_encoders(adev);
10661063

@@ -3251,6 +3248,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
32513248
enum dc_connection_type new_connection_type = dc_connection_none;
32523249
const struct dc_plane_cap *plane;
32533250

3251+
dm->display_indexes_num = dm->dc->caps.max_streams;
3252+
/* Update the actual used number of crtc */
3253+
adev->mode_info.num_crtc = adev->dm.display_indexes_num;
3254+
32543255
link_cnt = dm->dc->caps.max_links;
32553256
if (amdgpu_dm_mode_config_init(dm->adev)) {
32563257
DRM_ERROR("DM: Failed to initialize mode config\n");
@@ -3312,8 +3313,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
33123313
goto fail;
33133314
}
33143315

3315-
dm->display_indexes_num = dm->dc->caps.max_streams;
3316-
33173316
/* loops over all connectors on the board */
33183317
for (i = 0; i < link_cnt; i++) {
33193318
struct dc_link *link = NULL;

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static struct clk_bw_params rn_bw_params = {
579579

580580
};
581581

582-
static struct wm_table ddr4_wm_table = {
582+
static struct wm_table ddr4_wm_table_gs = {
583583
.entries = {
584584
{
585585
.wm_inst = WM_A,
@@ -616,7 +616,7 @@ static struct wm_table ddr4_wm_table = {
616616
}
617617
};
618618

619-
static struct wm_table lpddr4_wm_table = {
619+
static struct wm_table lpddr4_wm_table_gs = {
620620
.entries = {
621621
{
622622
.wm_inst = WM_A,
@@ -690,6 +690,80 @@ static struct wm_table lpddr4_wm_table_with_disabled_ppt = {
690690
}
691691
};
692692

693+
static struct wm_table ddr4_wm_table_rn = {
694+
.entries = {
695+
{
696+
.wm_inst = WM_A,
697+
.wm_type = WM_TYPE_PSTATE_CHG,
698+
.pstate_latency_us = 11.72,
699+
.sr_exit_time_us = 9.09,
700+
.sr_enter_plus_exit_time_us = 10.14,
701+
.valid = true,
702+
},
703+
{
704+
.wm_inst = WM_B,
705+
.wm_type = WM_TYPE_PSTATE_CHG,
706+
.pstate_latency_us = 11.72,
707+
.sr_exit_time_us = 10.12,
708+
.sr_enter_plus_exit_time_us = 11.48,
709+
.valid = true,
710+
},
711+
{
712+
.wm_inst = WM_C,
713+
.wm_type = WM_TYPE_PSTATE_CHG,
714+
.pstate_latency_us = 11.72,
715+
.sr_exit_time_us = 10.12,
716+
.sr_enter_plus_exit_time_us = 11.48,
717+
.valid = true,
718+
},
719+
{
720+
.wm_inst = WM_D,
721+
.wm_type = WM_TYPE_PSTATE_CHG,
722+
.pstate_latency_us = 11.72,
723+
.sr_exit_time_us = 10.12,
724+
.sr_enter_plus_exit_time_us = 11.48,
725+
.valid = true,
726+
},
727+
}
728+
};
729+
730+
static struct wm_table lpddr4_wm_table_rn = {
731+
.entries = {
732+
{
733+
.wm_inst = WM_A,
734+
.wm_type = WM_TYPE_PSTATE_CHG,
735+
.pstate_latency_us = 11.65333,
736+
.sr_exit_time_us = 7.32,
737+
.sr_enter_plus_exit_time_us = 8.38,
738+
.valid = true,
739+
},
740+
{
741+
.wm_inst = WM_B,
742+
.wm_type = WM_TYPE_PSTATE_CHG,
743+
.pstate_latency_us = 11.65333,
744+
.sr_exit_time_us = 9.82,
745+
.sr_enter_plus_exit_time_us = 11.196,
746+
.valid = true,
747+
},
748+
{
749+
.wm_inst = WM_C,
750+
.wm_type = WM_TYPE_PSTATE_CHG,
751+
.pstate_latency_us = 11.65333,
752+
.sr_exit_time_us = 9.89,
753+
.sr_enter_plus_exit_time_us = 11.24,
754+
.valid = true,
755+
},
756+
{
757+
.wm_inst = WM_D,
758+
.wm_type = WM_TYPE_PSTATE_CHG,
759+
.pstate_latency_us = 11.65333,
760+
.sr_exit_time_us = 9.748,
761+
.sr_enter_plus_exit_time_us = 11.102,
762+
.valid = true,
763+
},
764+
}
765+
};
766+
693767
static unsigned int find_dcfclk_for_voltage(struct dpm_clocks *clock_table, unsigned int voltage)
694768
{
695769
int i;
@@ -771,6 +845,11 @@ void rn_clk_mgr_construct(
771845
struct dc_debug_options *debug = &ctx->dc->debug;
772846
struct dpm_clocks clock_table = { 0 };
773847
enum pp_smu_status status = 0;
848+
int is_green_sardine = 0;
849+
850+
#if defined(CONFIG_DRM_AMD_DC_DCN)
851+
is_green_sardine = ASICREV_IS_GREEN_SARDINE(ctx->asic_id.hw_internal_rev);
852+
#endif
774853

775854
clk_mgr->base.ctx = ctx;
776855
clk_mgr->base.funcs = &dcn21_funcs;
@@ -811,10 +890,16 @@ void rn_clk_mgr_construct(
811890
if (clk_mgr->periodic_retraining_disabled) {
812891
rn_bw_params.wm_table = lpddr4_wm_table_with_disabled_ppt;
813892
} else {
814-
rn_bw_params.wm_table = lpddr4_wm_table;
893+
if (is_green_sardine)
894+
rn_bw_params.wm_table = lpddr4_wm_table_gs;
895+
else
896+
rn_bw_params.wm_table = lpddr4_wm_table_rn;
815897
}
816898
} else {
817-
rn_bw_params.wm_table = ddr4_wm_table;
899+
if (is_green_sardine)
900+
rn_bw_params.wm_table = ddr4_wm_table_gs;
901+
else
902+
rn_bw_params.wm_table = ddr4_wm_table_rn;
818903
}
819904
/* Saved clocks configured at boot for debug purposes */
820905
rn_dump_clk_registers(&clk_mgr->base.boot_snapshot, &clk_mgr->base, &log_info);

drivers/gpu/drm/amd/display/dc/core/dc_link.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,10 +3394,13 @@ uint32_t dc_bandwidth_in_kbps_from_timing(
33943394
{
33953395
uint32_t bits_per_channel = 0;
33963396
uint32_t kbps;
3397+
struct fixed31_32 link_bw_kbps;
33973398

33983399
if (timing->flags.DSC) {
3399-
kbps = (timing->pix_clk_100hz * timing->dsc_cfg.bits_per_pixel);
3400-
kbps = kbps / 160 + ((kbps % 160) ? 1 : 0);
3400+
link_bw_kbps = dc_fixpt_from_int(timing->pix_clk_100hz);
3401+
link_bw_kbps = dc_fixpt_div_int(link_bw_kbps, 160);
3402+
link_bw_kbps = dc_fixpt_mul_int(link_bw_kbps, timing->dsc_cfg.bits_per_pixel);
3403+
kbps = dc_fixpt_ceil(link_bw_kbps);
34013404
return kbps;
34023405
}
34033406

0 commit comments

Comments
 (0)