Skip to content

Commit 6f7e234

Browse files
committed
Merge tag 'drm-misc-fixes-2025-06-06' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
Short summary of fixes pull: ivpu: - gem: Use dma-resv lock - gem. Fix a warning - Trigger recovery on device engine reset/resume failure panel: - panel-simple: Fix settings for Evervision VGG644804 sysfb: - Fix screen_info type check video: - Update screen_info for relocated PCI framebuffers Signed-off-by: Simona Vetter <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 3c4c39c + f670b50 commit 6f7e234

File tree

7 files changed

+118
-74
lines changed

7 files changed

+118
-74
lines changed

drivers/accel/ivpu/ivpu_gem.c

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, con
3333
(bool)bo->base.base.import_attach);
3434
}
3535

36+
static inline int ivpu_bo_lock(struct ivpu_bo *bo)
37+
{
38+
return dma_resv_lock(bo->base.base.resv, NULL);
39+
}
40+
41+
static inline void ivpu_bo_unlock(struct ivpu_bo *bo)
42+
{
43+
dma_resv_unlock(bo->base.base.resv);
44+
}
45+
3646
/*
3747
* ivpu_bo_pin() - pin the backing physical pages and map them to VPU.
3848
*
@@ -43,22 +53,22 @@ static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, con
4353
int __must_check ivpu_bo_pin(struct ivpu_bo *bo)
4454
{
4555
struct ivpu_device *vdev = ivpu_bo_to_vdev(bo);
56+
struct sg_table *sgt;
4657
int ret = 0;
4758

48-
mutex_lock(&bo->lock);
49-
5059
ivpu_dbg_bo(vdev, bo, "pin");
51-
drm_WARN_ON(&vdev->drm, !bo->ctx);
5260

53-
if (!bo->mmu_mapped) {
54-
struct sg_table *sgt = drm_gem_shmem_get_pages_sgt(&bo->base);
61+
sgt = drm_gem_shmem_get_pages_sgt(&bo->base);
62+
if (IS_ERR(sgt)) {
63+
ret = PTR_ERR(sgt);
64+
ivpu_err(vdev, "Failed to map BO in IOMMU: %d\n", ret);
65+
return ret;
66+
}
5567

56-
if (IS_ERR(sgt)) {
57-
ret = PTR_ERR(sgt);
58-
ivpu_err(vdev, "Failed to map BO in IOMMU: %d\n", ret);
59-
goto unlock;
60-
}
68+
ivpu_bo_lock(bo);
6169

70+
if (!bo->mmu_mapped) {
71+
drm_WARN_ON(&vdev->drm, !bo->ctx);
6272
ret = ivpu_mmu_context_map_sgt(vdev, bo->ctx, bo->vpu_addr, sgt,
6373
ivpu_bo_is_snooped(bo));
6474
if (ret) {
@@ -69,7 +79,7 @@ int __must_check ivpu_bo_pin(struct ivpu_bo *bo)
6979
}
7080

7181
unlock:
72-
mutex_unlock(&bo->lock);
82+
ivpu_bo_unlock(bo);
7383

7484
return ret;
7585
}
@@ -84,7 +94,7 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bo, struct ivpu_mmu_context *ctx,
8494
if (!drm_dev_enter(&vdev->drm, &idx))
8595
return -ENODEV;
8696

87-
mutex_lock(&bo->lock);
97+
ivpu_bo_lock(bo);
8898

8999
ret = ivpu_mmu_context_insert_node(ctx, range, ivpu_bo_size(bo), &bo->mm_node);
90100
if (!ret) {
@@ -94,7 +104,7 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bo, struct ivpu_mmu_context *ctx,
94104
ivpu_err(vdev, "Failed to add BO to context %u: %d\n", ctx->id, ret);
95105
}
96106

97-
mutex_unlock(&bo->lock);
107+
ivpu_bo_unlock(bo);
98108

99109
drm_dev_exit(idx);
100110

@@ -105,7 +115,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
105115
{
106116
struct ivpu_device *vdev = ivpu_bo_to_vdev(bo);
107117

108-
lockdep_assert(lockdep_is_held(&bo->lock) || !kref_read(&bo->base.base.refcount));
118+
lockdep_assert(dma_resv_held(bo->base.base.resv) || !kref_read(&bo->base.base.refcount));
109119

110120
if (bo->mmu_mapped) {
111121
drm_WARN_ON(&vdev->drm, !bo->ctx);
@@ -123,14 +133,12 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
123133
if (bo->base.base.import_attach)
124134
return;
125135

126-
dma_resv_lock(bo->base.base.resv, NULL);
127136
if (bo->base.sgt) {
128137
dma_unmap_sgtable(vdev->drm.dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0);
129138
sg_free_table(bo->base.sgt);
130139
kfree(bo->base.sgt);
131140
bo->base.sgt = NULL;
132141
}
133-
dma_resv_unlock(bo->base.base.resv);
134142
}
135143

136144
void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx)
@@ -142,12 +150,12 @@ void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_m
142150

143151
mutex_lock(&vdev->bo_list_lock);
144152
list_for_each_entry(bo, &vdev->bo_list, bo_list_node) {
145-
mutex_lock(&bo->lock);
153+
ivpu_bo_lock(bo);
146154
if (bo->ctx == ctx) {
147155
ivpu_dbg_bo(vdev, bo, "unbind");
148156
ivpu_bo_unbind_locked(bo);
149157
}
150-
mutex_unlock(&bo->lock);
158+
ivpu_bo_unlock(bo);
151159
}
152160
mutex_unlock(&vdev->bo_list_lock);
153161
}
@@ -167,7 +175,6 @@ struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t siz
167175
bo->base.pages_mark_dirty_on_put = true; /* VPU can dirty a BO anytime */
168176

169177
INIT_LIST_HEAD(&bo->bo_list_node);
170-
mutex_init(&bo->lock);
171178

172179
return &bo->base.base;
173180
}
@@ -278,16 +285,15 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)
278285
list_del(&bo->bo_list_node);
279286
mutex_unlock(&vdev->bo_list_lock);
280287

281-
drm_WARN_ON(&vdev->drm, !dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ));
288+
drm_WARN_ON(&vdev->drm, !drm_gem_is_imported(&bo->base.base) &&
289+
!dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ));
282290
drm_WARN_ON(&vdev->drm, ivpu_bo_size(bo) == 0);
283291
drm_WARN_ON(&vdev->drm, bo->base.vaddr);
284292

285293
ivpu_bo_unbind_locked(bo);
286294
drm_WARN_ON(&vdev->drm, bo->mmu_mapped);
287295
drm_WARN_ON(&vdev->drm, bo->ctx);
288296

289-
mutex_destroy(&bo->lock);
290-
291297
drm_WARN_ON(obj->dev, bo->base.pages_use_count > 1);
292298
drm_gem_shmem_free(&bo->base);
293299
}
@@ -370,9 +376,9 @@ ivpu_bo_create(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
370376
goto err_put;
371377

372378
if (flags & DRM_IVPU_BO_MAPPABLE) {
373-
dma_resv_lock(bo->base.base.resv, NULL);
379+
ivpu_bo_lock(bo);
374380
ret = drm_gem_shmem_vmap(&bo->base, &map);
375-
dma_resv_unlock(bo->base.base.resv);
381+
ivpu_bo_unlock(bo);
376382

377383
if (ret)
378384
goto err_put;
@@ -395,9 +401,9 @@ void ivpu_bo_free(struct ivpu_bo *bo)
395401
struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->base.vaddr);
396402

397403
if (bo->flags & DRM_IVPU_BO_MAPPABLE) {
398-
dma_resv_lock(bo->base.base.resv, NULL);
404+
ivpu_bo_lock(bo);
399405
drm_gem_shmem_vunmap(&bo->base, &map);
400-
dma_resv_unlock(bo->base.base.resv);
406+
ivpu_bo_unlock(bo);
401407
}
402408

403409
drm_gem_object_put(&bo->base.base);
@@ -416,12 +422,12 @@ int ivpu_bo_info_ioctl(struct drm_device *dev, void *data, struct drm_file *file
416422

417423
bo = to_ivpu_bo(obj);
418424

419-
mutex_lock(&bo->lock);
425+
ivpu_bo_lock(bo);
420426
args->flags = bo->flags;
421427
args->mmap_offset = drm_vma_node_offset_addr(&obj->vma_node);
422428
args->vpu_addr = bo->vpu_addr;
423429
args->size = obj->size;
424-
mutex_unlock(&bo->lock);
430+
ivpu_bo_unlock(bo);
425431

426432
drm_gem_object_put(obj);
427433
return ret;
@@ -458,7 +464,7 @@ int ivpu_bo_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file
458464

459465
static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
460466
{
461-
mutex_lock(&bo->lock);
467+
ivpu_bo_lock(bo);
462468

463469
drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u",
464470
bo, bo->ctx_id, bo->vpu_addr, bo->base.base.size,
@@ -475,7 +481,7 @@ static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
475481

476482
drm_printf(p, "\n");
477483

478-
mutex_unlock(&bo->lock);
484+
ivpu_bo_unlock(bo);
479485
}
480486

481487
void ivpu_bo_list(struct drm_device *dev, struct drm_printer *p)

drivers/accel/ivpu/ivpu_gem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ struct ivpu_bo {
1717
struct list_head bo_list_node;
1818
struct drm_mm_node mm_node;
1919

20-
struct mutex lock; /* Protects: ctx, mmu_mapped, vpu_addr */
2120
u64 vpu_addr;
2221
u32 flags;
2322
u32 job_status; /* Valid only for command buffer */

drivers/accel/ivpu/ivpu_job.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,8 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
986986
return;
987987

988988
if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
989-
ivpu_jsm_reset_engine(vdev, 0);
989+
if (ivpu_jsm_reset_engine(vdev, 0))
990+
return;
990991

991992
mutex_lock(&vdev->context_list_lock);
992993
xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
@@ -1009,7 +1010,8 @@ void ivpu_context_abort_work_fn(struct work_struct *work)
10091010
if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
10101011
goto runtime_put;
10111012

1012-
ivpu_jsm_hws_resume_engine(vdev, 0);
1013+
if (ivpu_jsm_hws_resume_engine(vdev, 0))
1014+
return;
10131015
/*
10141016
* In hardware scheduling mode NPU already has stopped processing jobs
10151017
* and won't send us any further notifications, thus we have to free job related resources

drivers/accel/ivpu/ivpu_jsm_msg.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "ivpu_hw.h"
88
#include "ivpu_ipc.h"
99
#include "ivpu_jsm_msg.h"
10+
#include "ivpu_pm.h"
1011
#include "vpu_jsm_api.h"
1112

1213
const char *ivpu_jsm_msg_type_to_str(enum vpu_ipc_msg_type type)
@@ -163,8 +164,10 @@ int ivpu_jsm_reset_engine(struct ivpu_device *vdev, u32 engine)
163164

164165
ret = ivpu_ipc_send_receive(vdev, &req, VPU_JSM_MSG_ENGINE_RESET_DONE, &resp,
165166
VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
166-
if (ret)
167+
if (ret) {
167168
ivpu_err_ratelimited(vdev, "Failed to reset engine %d: %d\n", engine, ret);
169+
ivpu_pm_trigger_recovery(vdev, "Engine reset failed");
170+
}
168171

169172
return ret;
170173
}
@@ -354,8 +357,10 @@ int ivpu_jsm_hws_resume_engine(struct ivpu_device *vdev, u32 engine)
354357

355358
ret = ivpu_ipc_send_receive(vdev, &req, VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE, &resp,
356359
VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
357-
if (ret)
360+
if (ret) {
358361
ivpu_err_ratelimited(vdev, "Failed to resume engine %d: %d\n", engine, ret);
362+
ivpu_pm_trigger_recovery(vdev, "Engine resume failed");
363+
}
359364

360365
return ret;
361366
}

drivers/firmware/sysfb.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static __init int sysfb_init(void)
143143
{
144144
struct screen_info *si = &screen_info;
145145
struct device *parent;
146+
unsigned int type;
146147
struct simplefb_platform_data mode;
147148
const char *name;
148149
bool compatible;
@@ -170,17 +171,26 @@ static __init int sysfb_init(void)
170171
goto put_device;
171172
}
172173

174+
type = screen_info_video_type(si);
175+
173176
/* if the FB is incompatible, create a legacy framebuffer device */
174-
if (si->orig_video_isVGA == VIDEO_TYPE_EFI)
175-
name = "efi-framebuffer";
176-
else if (si->orig_video_isVGA == VIDEO_TYPE_VLFB)
177-
name = "vesa-framebuffer";
178-
else if (si->orig_video_isVGA == VIDEO_TYPE_VGAC)
179-
name = "vga-framebuffer";
180-
else if (si->orig_video_isVGA == VIDEO_TYPE_EGAC)
177+
switch (type) {
178+
case VIDEO_TYPE_EGAC:
181179
name = "ega-framebuffer";
182-
else
180+
break;
181+
case VIDEO_TYPE_VGAC:
182+
name = "vga-framebuffer";
183+
break;
184+
case VIDEO_TYPE_VLFB:
185+
name = "vesa-framebuffer";
186+
break;
187+
case VIDEO_TYPE_EFI:
188+
name = "efi-framebuffer";
189+
break;
190+
default:
183191
name = "platform-framebuffer";
192+
break;
193+
}
184194

185195
pd = platform_device_alloc(name, 0);
186196
if (!pd) {

drivers/gpu/drm/panel/panel-simple.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,13 +2199,14 @@ static const struct display_timing evervision_vgg644804_timing = {
21992199
static const struct panel_desc evervision_vgg644804 = {
22002200
.timings = &evervision_vgg644804_timing,
22012201
.num_timings = 1,
2202-
.bpc = 8,
2202+
.bpc = 6,
22032203
.size = {
22042204
.width = 115,
22052205
.height = 86,
22062206
},
22072207
.bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
2208-
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
2208+
.bus_flags = DRM_BUS_FLAG_DE_HIGH,
2209+
.connector_type = DRM_MODE_CONNECTOR_LVDS,
22092210
};
22102211

22112212
static const struct display_timing evervision_vgg804821_timing = {

0 commit comments

Comments
 (0)