Skip to content

Commit b83ac44

Browse files
committed
Merge tag 'drm-fixes-2023-05-26' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "This week's collection is pretty spread out, accel/qaic has a bunch of fixes, amdgpu, then lots of single fixes across a bunch of places. core: - fix drmm_mutex_init lock class mgag200: - fix gamma lut initialisation pl111: - fix FB depth on IMPD-1 framebuffer amdgpu: - Fix missing BO unlocking in KIQ error path - Avoid spurious secure display error messages - SMU13 fix - Fix an OD regression - GPU reset display IRQ warning fix - MST fix radeon: - Fix a DP regression i915: - PIPEDMC disabling fix for bigjoiner config panel: - fix aya neo air plus quirk sched: - remove redundant NULL check qaic: - fix NNC message corruption - Grab ch_lock during QAIC_ATTACH_SLICE_BO - Flush the transfer list again - Validate if BO is sliced before slicing - Validate user data before grabbing any lock - initialize ret variable to 0 - silence some uninitialized variable warnings" * tag 'drm-fixes-2023-05-26' of git://anongit.freedesktop.org/drm/drm: drm/amd/display: Have Payload Properly Created After Resume drm/amd/display: Fix warning in disabling vblank irq drm/amd/pm: Fix output of pp_od_clk_voltage drm/amd/pm: add missing NotifyPowerSource message mapping for SMU13.0.7 drm/radeon: reintroduce radeon_dp_work_func content drm/amdgpu: don't enable secure display on incompatible platforms drm:amd:amdgpu: Fix missing buffer object unlock in failure path accel/qaic: Fix NNC message corruption accel/qaic: Grab ch_lock during QAIC_ATTACH_SLICE_BO accel/qaic: Flush the transfer list again accel/qaic: Validate if BO is sliced before slicing accel/qaic: Validate user data before grabbing any lock accel/qaic: initialize ret variable to 0 drm/i915: Fix PIPEDMC disabling for a bigjoiner configuration drm: fix drmm_mutex_init() drm/sched: Remove redundant check drm: panel-orientation-quirks: Change Air's quirk to support Air Plus accel/qaic: silence some uninitialized variable warnings drm/pl111: Fix FB depth on IMPD-1 framebuffer drm/mgag200: Fix gamma lut not initialized.
2 parents 47ee3f1 + 5502d1f commit b83ac44

File tree

21 files changed

+166
-136
lines changed

21 files changed

+166
-136
lines changed

drivers/accel/qaic/qaic_control.c

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -997,14 +997,34 @@ static void *msg_xfer(struct qaic_device *qdev, struct wrapper_list *wrappers, u
997997
struct xfer_queue_elem elem;
998998
struct wire_msg *out_buf;
999999
struct wrapper_msg *w;
1000+
long ret = -EAGAIN;
1001+
int xfer_count = 0;
10001002
int retry_count;
1001-
long ret;
10021003

10031004
if (qdev->in_reset) {
10041005
mutex_unlock(&qdev->cntl_mutex);
10051006
return ERR_PTR(-ENODEV);
10061007
}
10071008

1009+
/* Attempt to avoid a partial commit of a message */
1010+
list_for_each_entry(w, &wrappers->list, list)
1011+
xfer_count++;
1012+
1013+
for (retry_count = 0; retry_count < QAIC_MHI_RETRY_MAX; retry_count++) {
1014+
if (xfer_count <= mhi_get_free_desc_count(qdev->cntl_ch, DMA_TO_DEVICE)) {
1015+
ret = 0;
1016+
break;
1017+
}
1018+
msleep_interruptible(QAIC_MHI_RETRY_WAIT_MS);
1019+
if (signal_pending(current))
1020+
break;
1021+
}
1022+
1023+
if (ret) {
1024+
mutex_unlock(&qdev->cntl_mutex);
1025+
return ERR_PTR(ret);
1026+
}
1027+
10081028
elem.seq_num = seq_num;
10091029
elem.buf = NULL;
10101030
init_completion(&elem.xfer_done);
@@ -1038,16 +1058,9 @@ static void *msg_xfer(struct qaic_device *qdev, struct wrapper_list *wrappers, u
10381058
list_for_each_entry(w, &wrappers->list, list) {
10391059
kref_get(&w->ref_count);
10401060
retry_count = 0;
1041-
retry:
10421061
ret = mhi_queue_buf(qdev->cntl_ch, DMA_TO_DEVICE, &w->msg, w->len,
10431062
list_is_last(&w->list, &wrappers->list) ? MHI_EOT : MHI_CHAIN);
10441063
if (ret) {
1045-
if (ret == -EAGAIN && retry_count++ < QAIC_MHI_RETRY_MAX) {
1046-
msleep_interruptible(QAIC_MHI_RETRY_WAIT_MS);
1047-
if (!signal_pending(current))
1048-
goto retry;
1049-
}
1050-
10511064
qdev->cntl_lost_buf = true;
10521065
kref_put(&w->ref_count, free_wrapper);
10531066
mutex_unlock(&qdev->cntl_mutex);
@@ -1249,7 +1262,7 @@ static int qaic_manage(struct qaic_device *qdev, struct qaic_user *usr, struct m
12491262

12501263
int qaic_manage_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
12511264
{
1252-
struct qaic_manage_msg *user_msg;
1265+
struct qaic_manage_msg *user_msg = data;
12531266
struct qaic_device *qdev;
12541267
struct manage_msg *msg;
12551268
struct qaic_user *usr;
@@ -1258,6 +1271,9 @@ int qaic_manage_ioctl(struct drm_device *dev, void *data, struct drm_file *file_
12581271
int usr_rcu_id;
12591272
int ret;
12601273

1274+
if (user_msg->len > QAIC_MANAGE_MAX_MSG_LENGTH)
1275+
return -EINVAL;
1276+
12611277
usr = file_priv->driver_priv;
12621278

12631279
usr_rcu_id = srcu_read_lock(&usr->qddev_lock);
@@ -1275,13 +1291,6 @@ int qaic_manage_ioctl(struct drm_device *dev, void *data, struct drm_file *file_
12751291
return -ENODEV;
12761292
}
12771293

1278-
user_msg = data;
1279-
1280-
if (user_msg->len > QAIC_MANAGE_MAX_MSG_LENGTH) {
1281-
ret = -EINVAL;
1282-
goto out;
1283-
}
1284-
12851294
msg = kzalloc(QAIC_MANAGE_MAX_MSG_LENGTH + sizeof(*msg), GFP_KERNEL);
12861295
if (!msg) {
12871296
ret = -ENOMEM;

drivers/accel/qaic/qaic_data.c

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static int qaic_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struc
591591
struct qaic_bo *bo = to_qaic_bo(obj);
592592
unsigned long offset = 0;
593593
struct scatterlist *sg;
594-
int ret;
594+
int ret = 0;
595595

596596
if (obj->import_attach)
597597
return -EINVAL;
@@ -663,6 +663,10 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
663663
if (args->pad)
664664
return -EINVAL;
665665

666+
size = PAGE_ALIGN(args->size);
667+
if (size == 0)
668+
return -EINVAL;
669+
666670
usr = file_priv->driver_priv;
667671
usr_rcu_id = srcu_read_lock(&usr->qddev_lock);
668672
if (!usr->qddev) {
@@ -677,12 +681,6 @@ int qaic_create_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
677681
goto unlock_dev_srcu;
678682
}
679683

680-
size = PAGE_ALIGN(args->size);
681-
if (size == 0) {
682-
ret = -EINVAL;
683-
goto unlock_dev_srcu;
684-
}
685-
686684
bo = qaic_alloc_init_bo();
687685
if (IS_ERR(bo)) {
688686
ret = PTR_ERR(bo);
@@ -926,8 +924,8 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
926924
{
927925
struct qaic_attach_slice_entry *slice_ent;
928926
struct qaic_attach_slice *args = data;
927+
int rcu_id, usr_rcu_id, qdev_rcu_id;
929928
struct dma_bridge_chan *dbc;
930-
int usr_rcu_id, qdev_rcu_id;
931929
struct drm_gem_object *obj;
932930
struct qaic_device *qdev;
933931
unsigned long arg_size;
@@ -936,6 +934,22 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
936934
struct qaic_bo *bo;
937935
int ret;
938936

937+
if (args->hdr.count == 0)
938+
return -EINVAL;
939+
940+
arg_size = args->hdr.count * sizeof(*slice_ent);
941+
if (arg_size / args->hdr.count != sizeof(*slice_ent))
942+
return -EINVAL;
943+
944+
if (args->hdr.size == 0)
945+
return -EINVAL;
946+
947+
if (!(args->hdr.dir == DMA_TO_DEVICE || args->hdr.dir == DMA_FROM_DEVICE))
948+
return -EINVAL;
949+
950+
if (args->data == 0)
951+
return -EINVAL;
952+
939953
usr = file_priv->driver_priv;
940954
usr_rcu_id = srcu_read_lock(&usr->qddev_lock);
941955
if (!usr->qddev) {
@@ -950,43 +964,11 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
950964
goto unlock_dev_srcu;
951965
}
952966

953-
if (args->hdr.count == 0) {
954-
ret = -EINVAL;
955-
goto unlock_dev_srcu;
956-
}
957-
958-
arg_size = args->hdr.count * sizeof(*slice_ent);
959-
if (arg_size / args->hdr.count != sizeof(*slice_ent)) {
960-
ret = -EINVAL;
961-
goto unlock_dev_srcu;
962-
}
963-
964967
if (args->hdr.dbc_id >= qdev->num_dbc) {
965968
ret = -EINVAL;
966969
goto unlock_dev_srcu;
967970
}
968971

969-
if (args->hdr.size == 0) {
970-
ret = -EINVAL;
971-
goto unlock_dev_srcu;
972-
}
973-
974-
if (!(args->hdr.dir == DMA_TO_DEVICE || args->hdr.dir == DMA_FROM_DEVICE)) {
975-
ret = -EINVAL;
976-
goto unlock_dev_srcu;
977-
}
978-
979-
dbc = &qdev->dbc[args->hdr.dbc_id];
980-
if (dbc->usr != usr) {
981-
ret = -EINVAL;
982-
goto unlock_dev_srcu;
983-
}
984-
985-
if (args->data == 0) {
986-
ret = -EINVAL;
987-
goto unlock_dev_srcu;
988-
}
989-
990972
user_data = u64_to_user_ptr(args->data);
991973

992974
slice_ent = kzalloc(arg_size, GFP_KERNEL);
@@ -1013,9 +995,21 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
1013995

1014996
bo = to_qaic_bo(obj);
1015997

998+
if (bo->sliced) {
999+
ret = -EINVAL;
1000+
goto put_bo;
1001+
}
1002+
1003+
dbc = &qdev->dbc[args->hdr.dbc_id];
1004+
rcu_id = srcu_read_lock(&dbc->ch_lock);
1005+
if (dbc->usr != usr) {
1006+
ret = -EINVAL;
1007+
goto unlock_ch_srcu;
1008+
}
1009+
10161010
ret = qaic_prepare_bo(qdev, bo, &args->hdr);
10171011
if (ret)
1018-
goto put_bo;
1012+
goto unlock_ch_srcu;
10191013

10201014
ret = qaic_attach_slicing_bo(qdev, bo, &args->hdr, slice_ent);
10211015
if (ret)
@@ -1025,6 +1019,7 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
10251019
dma_sync_sgtable_for_cpu(&qdev->pdev->dev, bo->sgt, args->hdr.dir);
10261020

10271021
bo->dbc = dbc;
1022+
srcu_read_unlock(&dbc->ch_lock, rcu_id);
10281023
drm_gem_object_put(obj);
10291024
srcu_read_unlock(&qdev->dev_lock, qdev_rcu_id);
10301025
srcu_read_unlock(&usr->qddev_lock, usr_rcu_id);
@@ -1033,6 +1028,8 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
10331028

10341029
unprepare_bo:
10351030
qaic_unprepare_bo(qdev, bo);
1031+
unlock_ch_srcu:
1032+
srcu_read_unlock(&dbc->ch_lock, rcu_id);
10361033
put_bo:
10371034
drm_gem_object_put(obj);
10381035
free_slice_ent:
@@ -1316,7 +1313,6 @@ static int __qaic_execute_bo_ioctl(struct drm_device *dev, void *data, struct dr
13161313
received_ts = ktime_get_ns();
13171314

13181315
size = is_partial ? sizeof(*pexec) : sizeof(*exec);
1319-
13201316
n = (unsigned long)size * args->hdr.count;
13211317
if (args->hdr.count == 0 || n / args->hdr.count != size)
13221318
return -EINVAL;
@@ -1665,6 +1661,9 @@ int qaic_wait_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *file
16651661
int rcu_id;
16661662
int ret;
16671663

1664+
if (args->pad != 0)
1665+
return -EINVAL;
1666+
16681667
usr = file_priv->driver_priv;
16691668
usr_rcu_id = srcu_read_lock(&usr->qddev_lock);
16701669
if (!usr->qddev) {
@@ -1679,11 +1678,6 @@ int qaic_wait_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *file
16791678
goto unlock_dev_srcu;
16801679
}
16811680

1682-
if (args->pad != 0) {
1683-
ret = -EINVAL;
1684-
goto unlock_dev_srcu;
1685-
}
1686-
16871681
if (args->dbc_id >= qdev->num_dbc) {
16881682
ret = -EINVAL;
16891683
goto unlock_dev_srcu;
@@ -1855,6 +1849,11 @@ void wakeup_dbc(struct qaic_device *qdev, u32 dbc_id)
18551849
dbc->usr = NULL;
18561850
empty_xfer_list(qdev, dbc);
18571851
synchronize_srcu(&dbc->ch_lock);
1852+
/*
1853+
* Threads holding channel lock, may add more elements in the xfer_list.
1854+
* Flush out these elements from xfer_list.
1855+
*/
1856+
empty_xfer_list(qdev, dbc);
18581857
}
18591858

18601859
void release_dbc(struct qaic_device *qdev, u32 dbc_id)

drivers/accel/qaic/qaic_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ static void qaic_destroy_drm_device(struct qaic_device *qdev, s32 partition_id)
262262

263263
static int qaic_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_device_id *id)
264264
{
265+
u16 major = -1, minor = -1;
265266
struct qaic_device *qdev;
266-
u16 major, minor;
267267
int ret;
268268

269269
/*

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6892,8 +6892,10 @@ static int gfx_v10_0_kiq_resume(struct amdgpu_device *adev)
68926892
return r;
68936893

68946894
r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
6895-
if (unlikely(r != 0))
6895+
if (unlikely(r != 0)) {
6896+
amdgpu_bo_unreserve(ring->mqd_obj);
68966897
return r;
6898+
}
68976899

68986900
gfx_v10_0_kiq_init_queue(ring);
68996901
amdgpu_bo_kunmap(ring->mqd_obj);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3617,8 +3617,10 @@ static int gfx_v9_0_kiq_resume(struct amdgpu_device *adev)
36173617
return r;
36183618

36193619
r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
3620-
if (unlikely(r != 0))
3620+
if (unlikely(r != 0)) {
3621+
amdgpu_bo_unreserve(ring->mqd_obj);
36213622
return r;
3623+
}
36223624

36233625
gfx_v9_0_kiq_init_queue(ring);
36243626
amdgpu_bo_kunmap(ring->mqd_obj);

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ static int psp_v10_0_init_microcode(struct psp_context *psp)
5757
if (err)
5858
return err;
5959

60-
return psp_init_ta_microcode(psp, ucode_prefix);
60+
err = psp_init_ta_microcode(psp, ucode_prefix);
61+
if ((adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 1, 0)) &&
62+
(adev->pdev->revision == 0xa1) &&
63+
(psp->securedisplay_context.context.bin_desc.fw_version >= 0x27000008)) {
64+
adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0;
65+
}
66+
return err;
6167
}
6268

6369
static int psp_v10_0_ring_create(struct psp_context *psp,

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,20 +2479,25 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,
24792479
if (acrtc && state->stream_status[i].plane_count != 0) {
24802480
irq_source = IRQ_TYPE_PFLIP + acrtc->otg_inst;
24812481
rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;
2482-
DRM_DEBUG_VBL("crtc %d - vupdate irq %sabling: r=%d\n",
2483-
acrtc->crtc_id, enable ? "en" : "dis", rc);
24842482
if (rc)
24852483
DRM_WARN("Failed to %s pflip interrupts\n",
24862484
enable ? "enable" : "disable");
24872485

24882486
if (enable) {
2489-
rc = amdgpu_dm_crtc_enable_vblank(&acrtc->base);
2490-
if (rc)
2491-
DRM_WARN("Failed to enable vblank interrupts\n");
2492-
} else {
2493-
amdgpu_dm_crtc_disable_vblank(&acrtc->base);
2494-
}
2487+
if (amdgpu_dm_crtc_vrr_active(to_dm_crtc_state(acrtc->base.state)))
2488+
rc = amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, true);
2489+
} else
2490+
rc = amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, false);
24952491

2492+
if (rc)
2493+
DRM_WARN("Failed to %sable vupdate interrupt\n", enable ? "en" : "dis");
2494+
2495+
irq_source = IRQ_TYPE_VBLANK + acrtc->otg_inst;
2496+
/* During gpu-reset we disable and then enable vblank irq, so
2497+
* don't use amdgpu_irq_get/put() to avoid refcount change.
2498+
*/
2499+
if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
2500+
DRM_WARN("Failed to %sable vblank interrupt\n", enable ? "en" : "dis");
24962501
}
24972502
}
24982503

@@ -2852,7 +2857,7 @@ static int dm_resume(void *handle)
28522857
* this is the case when traversing through already created
28532858
* MST connectors, should be skipped
28542859
*/
2855-
if (aconnector->dc_link->type == dc_connection_mst_branch)
2860+
if (aconnector && aconnector->mst_root)
28562861
continue;
28572862

28582863
mutex_lock(&aconnector->hpd_lock);
@@ -6737,7 +6742,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder,
67376742
int clock, bpp = 0;
67386743
bool is_y420 = false;
67396744

6740-
if (!aconnector->mst_output_port || !aconnector->dc_sink)
6745+
if (!aconnector->mst_output_port)
67416746
return 0;
67426747

67436748
mst_port = aconnector->mst_output_port;

0 commit comments

Comments
 (0)