Skip to content

Commit b5bf1d8

Browse files
committed
Merge tag 'drm-fixes-2022-11-19' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "I guess the main question is are things settling down, and I'd say kinda, these are all pretty small fixes, nothing big stands out really, just seems to be quite a few of them. Mostly amdgpu and core fixes, with some i915, tegra, vc4, panel bits. core: - Fix potential memory leak in drm_dev_init() - Fix potential null-ptr-deref in drm_vblank_destroy_worker() - Revert hiding unregistered connectors from userspace, as it breaks on DP-MST - Add workaround for DP++ dual mode adaptors that don't support i2c subaddressing i915: - Fix uaf with lmem_userfault_list handling amdgpu: - gang submit fixes - Fix a possible memory leak in ganng submit error path - DP tunneling fixes - DCN 3.1 page flip fix - DCN 3.2.x fixes - DCN 3.1.4 fixes - Don't expose degamma on hardware that doesn't support it - BACO fixes for SMU 11.x - BACO fixes for SMU 13.x - Virtual display fix for devices with no display hardware amdkfd: - Memory limit regression fix tegra: - tegra20 GART fix vc4: - Fix error handling in vc4_atomic_commit_tail() lima: - Set lima's clkname corrrectly when regulator is missing panel: - Set bpc for logictechno panels" * tag 'drm-fixes-2022-11-19' of git://anongit.freedesktop.org/drm/drm: (28 commits) gpu: host1x: Avoid trying to use GART on Tegra20 drm/display: Don't assume dual mode adaptors support i2c sub-addressing drm/amd/pm: fix SMU13 runpm hang due to unintentional workaround drm/amd/pm: enable runpm support over BACO for SMU13.0.7 drm/amd/pm: enable runpm support over BACO for SMU13.0.0 drm/amdgpu: there is no vbios fb on devices with no display hw (v2) drm/amdkfd: Fix a memory limit issue drm/amdgpu: disable BACO support on more cards drm/amd/display: don't enable DRM CRTC degamma property for DCE drm/amd/display: Set max for prefetch lines on dcn32 drm/amd/display: use uclk pstate latency for fw assisted mclk validation dcn32 drm/amd/display: Fix prefetch calculations for dcn32 drm/amd/display: Fix optc2_configure warning on dcn314 drm/amd/display: Fix calculation for cursor CAB allocation Revert "drm: hide unregistered connectors from GETCONNECTOR IOCTL" drm/amd/display: Support parsing VRAM info v3.0 from VBIOS drm/amd/display: Fix invalid DPIA AUX reply causing system hang drm/amdgpu: Add psp_13_0_10_ta firmware to modinfo drm/amd/display: Add HUBP surface flip interrupt handler drm/amd/display: Fix access timeout to DPIA AUX at boot time ...
2 parents ab290ea + b1010b9 commit b5bf1d8

37 files changed

+310
-116
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ void amdgpu_device_pcie_port_wreg(struct amdgpu_device *adev,
12931293
u32 reg, u32 v);
12941294
struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
12951295
struct dma_fence *gang);
1296+
bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev);
12961297

12971298
/* atpx handler */
12981299
#if defined(CONFIG_VGA_SWITCHEROO)

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
171171
(kfd_mem_limit.ttm_mem_used + ttm_mem_needed >
172172
kfd_mem_limit.max_ttm_mem_limit) ||
173173
(adev && adev->kfd.vram_used + vram_needed >
174-
adev->gmc.real_vram_size -
175-
atomic64_read(&adev->vram_pin_size) -
176-
reserved_for_pt)) {
174+
adev->gmc.real_vram_size - reserved_for_pt)) {
177175
ret = -ENOMEM;
178176
goto release;
179177
}

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static int amdgpu_cs_p1_ib(struct amdgpu_cs_parser *p,
109109
return r;
110110

111111
++(num_ibs[r]);
112+
p->gang_leader_idx = r;
112113
return 0;
113114
}
114115

@@ -287,8 +288,10 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
287288
}
288289
}
289290

290-
if (!p->gang_size)
291-
return -EINVAL;
291+
if (!p->gang_size) {
292+
ret = -EINVAL;
293+
goto free_partial_kdata;
294+
}
292295

293296
for (i = 0; i < p->gang_size; ++i) {
294297
ret = amdgpu_job_alloc(p->adev, num_ibs[i], &p->jobs[i], vm);
@@ -300,7 +303,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
300303
if (ret)
301304
goto free_all_kdata;
302305
}
303-
p->gang_leader = p->jobs[p->gang_size - 1];
306+
p->gang_leader = p->jobs[p->gang_leader_idx];
304307

305308
if (p->ctx->vram_lost_counter != p->gang_leader->vram_lost_counter) {
306309
ret = -ECANCELED;
@@ -1195,16 +1198,18 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
11951198
return r;
11961199
}
11971200

1198-
for (i = 0; i < p->gang_size - 1; ++i) {
1201+
for (i = 0; i < p->gang_size; ++i) {
1202+
if (p->jobs[i] == leader)
1203+
continue;
1204+
11991205
r = amdgpu_sync_clone(&leader->sync, &p->jobs[i]->sync);
12001206
if (r)
12011207
return r;
12021208
}
12031209

1204-
r = amdgpu_ctx_wait_prev_fence(p->ctx, p->entities[p->gang_size - 1]);
1210+
r = amdgpu_ctx_wait_prev_fence(p->ctx, p->entities[p->gang_leader_idx]);
12051211
if (r && r != -ERESTARTSYS)
12061212
DRM_ERROR("amdgpu_ctx_wait_prev_fence failed.\n");
1207-
12081213
return r;
12091214
}
12101215

@@ -1238,9 +1243,12 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
12381243
for (i = 0; i < p->gang_size; ++i)
12391244
drm_sched_job_arm(&p->jobs[i]->base);
12401245

1241-
for (i = 0; i < (p->gang_size - 1); ++i) {
1246+
for (i = 0; i < p->gang_size; ++i) {
12421247
struct dma_fence *fence;
12431248

1249+
if (p->jobs[i] == leader)
1250+
continue;
1251+
12441252
fence = &p->jobs[i]->base.s_fence->scheduled;
12451253
r = amdgpu_sync_fence(&leader->sync, fence);
12461254
if (r)
@@ -1276,7 +1284,10 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
12761284
list_for_each_entry(e, &p->validated, tv.head) {
12771285

12781286
/* Everybody except for the gang leader uses READ */
1279-
for (i = 0; i < (p->gang_size - 1); ++i) {
1287+
for (i = 0; i < p->gang_size; ++i) {
1288+
if (p->jobs[i] == leader)
1289+
continue;
1290+
12801291
dma_resv_add_fence(e->tv.bo->base.resv,
12811292
&p->jobs[i]->base.s_fence->finished,
12821293
DMA_RESV_USAGE_READ);
@@ -1286,7 +1297,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
12861297
e->tv.num_shared = 0;
12871298
}
12881299

1289-
seq = amdgpu_ctx_add_fence(p->ctx, p->entities[p->gang_size - 1],
1300+
seq = amdgpu_ctx_add_fence(p->ctx, p->entities[p->gang_leader_idx],
12901301
p->fence);
12911302
amdgpu_cs_post_dependencies(p);
12921303

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct amdgpu_cs_parser {
5454

5555
/* scheduler job objects */
5656
unsigned int gang_size;
57+
unsigned int gang_leader_idx;
5758
struct drm_sched_entity *entities[AMDGPU_CS_GANG_SIZE];
5859
struct amdgpu_job *jobs[AMDGPU_CS_GANG_SIZE];
5960
struct amdgpu_job *gang_leader;

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6044,3 +6044,44 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
60446044
dma_fence_put(old);
60456045
return NULL;
60466046
}
6047+
6048+
bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev)
6049+
{
6050+
switch (adev->asic_type) {
6051+
#ifdef CONFIG_DRM_AMDGPU_SI
6052+
case CHIP_HAINAN:
6053+
#endif
6054+
case CHIP_TOPAZ:
6055+
/* chips with no display hardware */
6056+
return false;
6057+
#ifdef CONFIG_DRM_AMDGPU_SI
6058+
case CHIP_TAHITI:
6059+
case CHIP_PITCAIRN:
6060+
case CHIP_VERDE:
6061+
case CHIP_OLAND:
6062+
#endif
6063+
#ifdef CONFIG_DRM_AMDGPU_CIK
6064+
case CHIP_BONAIRE:
6065+
case CHIP_HAWAII:
6066+
case CHIP_KAVERI:
6067+
case CHIP_KABINI:
6068+
case CHIP_MULLINS:
6069+
#endif
6070+
case CHIP_TONGA:
6071+
case CHIP_FIJI:
6072+
case CHIP_POLARIS10:
6073+
case CHIP_POLARIS11:
6074+
case CHIP_POLARIS12:
6075+
case CHIP_VEGAM:
6076+
case CHIP_CARRIZO:
6077+
case CHIP_STONEY:
6078+
/* chips with display hardware */
6079+
return true;
6080+
default:
6081+
/* IP discovery */
6082+
if (!adev->ip_versions[DCE_HWIP][0] ||
6083+
(adev->harvest_ip_mask & AMD_HARVEST_IP_DMU_MASK))
6084+
return false;
6085+
return true;
6086+
}
6087+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
656656
}
657657

658658
if (amdgpu_sriov_vf(adev) ||
659-
!amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE)) {
659+
!amdgpu_device_has_display_hardware(adev)) {
660660
size = 0;
661661
} else {
662662
size = amdgpu_gmc_get_vbios_fb_size(adev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ MODULE_FIRMWARE("amdgpu/psp_13_0_0_ta.bin");
4545
MODULE_FIRMWARE("amdgpu/psp_13_0_7_sos.bin");
4646
MODULE_FIRMWARE("amdgpu/psp_13_0_7_ta.bin");
4747
MODULE_FIRMWARE("amdgpu/psp_13_0_10_sos.bin");
48+
MODULE_FIRMWARE("amdgpu/psp_13_0_10_ta.bin");
4849

4950
/* For large FW files the time to complete can be very long */
5051
#define USBC_PD_POLLING_LIMIT_S 240

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ MODULE_FIRMWARE(FIRMWARE_NAVI12_DMCU);
147147
/* Number of bytes in PSP footer for firmware. */
148148
#define PSP_FOOTER_BYTES 0x100
149149

150+
/*
151+
* DMUB Async to Sync Mechanism Status
152+
*/
153+
#define DMUB_ASYNC_TO_SYNC_ACCESS_FAIL 1
154+
#define DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT 2
155+
#define DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS 3
156+
#define DMUB_ASYNC_TO_SYNC_ACCESS_INVALID 4
157+
150158
/**
151159
* DOC: overview
152160
*
@@ -1637,19 +1645,19 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
16371645
}
16381646
}
16391647

1640-
if (amdgpu_dm_initialize_drm_device(adev)) {
1641-
DRM_ERROR(
1642-
"amdgpu: failed to initialize sw for display support.\n");
1643-
goto error;
1644-
}
1645-
16461648
/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive.
16471649
* It is expected that DMUB will resend any pending notifications at this point, for
16481650
* example HPD from DPIA.
16491651
*/
16501652
if (dc_is_dmub_outbox_supported(adev->dm.dc))
16511653
dc_enable_dmub_outbox(adev->dm.dc);
16521654

1655+
if (amdgpu_dm_initialize_drm_device(adev)) {
1656+
DRM_ERROR(
1657+
"amdgpu: failed to initialize sw for display support.\n");
1658+
goto error;
1659+
}
1660+
16531661
/* create fake encoders for MST */
16541662
dm_dp_create_fake_mst_encoders(adev);
16551663

@@ -10109,6 +10117,8 @@ static int amdgpu_dm_set_dmub_async_sync_status(bool is_cmd_aux,
1010910117
*operation_result = AUX_RET_ERROR_TIMEOUT;
1011010118
} else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_FAIL) {
1011110119
*operation_result = AUX_RET_ERROR_ENGINE_ACQUIRE;
10120+
} else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_INVALID) {
10121+
*operation_result = AUX_RET_ERROR_INVALID_REPLY;
1011210122
} else {
1011310123
*operation_result = AUX_RET_ERROR_UNKNOWN;
1011410124
}
@@ -10156,6 +10166,16 @@ int amdgpu_dm_process_dmub_aux_transfer_sync(bool is_cmd_aux, struct dc_context
1015610166
payload->reply[0] = adev->dm.dmub_notify->aux_reply.command;
1015710167
if (!payload->write && adev->dm.dmub_notify->aux_reply.length &&
1015810168
payload->reply[0] == AUX_TRANSACTION_REPLY_AUX_ACK) {
10169+
10170+
if (payload->length != adev->dm.dmub_notify->aux_reply.length) {
10171+
DRM_WARN("invalid read from DPIA AUX %x(%d) got length %d!\n",
10172+
payload->address, payload->length,
10173+
adev->dm.dmub_notify->aux_reply.length);
10174+
return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux, ctx,
10175+
DMUB_ASYNC_TO_SYNC_ACCESS_INVALID,
10176+
(uint32_t *)operation_result);
10177+
}
10178+
1015910179
memcpy(payload->data, adev->dm.dmub_notify->aux_reply.data,
1016010180
adev->dm.dmub_notify->aux_reply.length);
1016110181
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@
5050

5151
#define AMDGPU_DMUB_NOTIFICATION_MAX 5
5252

53-
/*
54-
* DMUB Async to Sync Mechanism Status
55-
*/
56-
#define DMUB_ASYNC_TO_SYNC_ACCESS_FAIL 1
57-
#define DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT 2
58-
#define DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS 3
5953
/*
6054
#include "include/amdgpu_dal_power_if.h"
6155
#include "amdgpu_dm_irq.h"

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
412412
{
413413
struct amdgpu_crtc *acrtc = NULL;
414414
struct drm_plane *cursor_plane;
415-
415+
bool is_dcn;
416416
int res = -ENOMEM;
417417

418418
cursor_plane = kzalloc(sizeof(*cursor_plane), GFP_KERNEL);
@@ -450,8 +450,14 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
450450
acrtc->otg_inst = -1;
451451

452452
dm->adev->mode_info.crtcs[crtc_index] = acrtc;
453-
drm_crtc_enable_color_mgmt(&acrtc->base, MAX_COLOR_LUT_ENTRIES,
453+
454+
/* Don't enable DRM CRTC degamma property for DCE since it doesn't
455+
* support programmable degamma anywhere.
456+
*/
457+
is_dcn = dm->adev->dm.dc->caps.color.dpp.dcn_arch;
458+
drm_crtc_enable_color_mgmt(&acrtc->base, is_dcn ? MAX_COLOR_LUT_ENTRIES : 0,
454459
true, MAX_COLOR_LUT_ENTRIES);
460+
455461
drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);
456462

457463
return 0;

0 commit comments

Comments
 (0)