Skip to content

Commit ac3a75b

Browse files
committed
Merge tag 'drm-misc-fixes-2025-03-06' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
A Kconfig fix for nouveau, locking and timestamp fixes for imagination, a header guard fix for sched and a DPMS regression fix for bochs. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <mripard@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250306-antelope-of-imminent-anger-bca19e@houat
2 parents 7eb1721 + 80da96d commit ac3a75b

File tree

9 files changed

+141
-38
lines changed

9 files changed

+141
-38
lines changed

drivers/gpu/drm/imagination/pvr_fw_meta.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,10 @@ pvr_meta_vm_map(struct pvr_device *pvr_dev, struct pvr_fw_object *fw_obj)
527527
static void
528528
pvr_meta_vm_unmap(struct pvr_device *pvr_dev, struct pvr_fw_object *fw_obj)
529529
{
530-
pvr_vm_unmap(pvr_dev->kernel_vm_ctx, fw_obj->fw_mm_node.start,
531-
fw_obj->fw_mm_node.size);
530+
struct pvr_gem_object *pvr_obj = fw_obj->gem;
531+
532+
pvr_vm_unmap_obj(pvr_dev->kernel_vm_ctx, pvr_obj,
533+
fw_obj->fw_mm_node.start, fw_obj->fw_mm_node.size);
532534
}
533535

534536
static bool

drivers/gpu/drm/imagination/pvr_fw_trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ static int fw_trace_seq_show(struct seq_file *s, void *v)
333333
if (sf_id == ROGUE_FW_SF_LAST)
334334
return -EINVAL;
335335

336-
timestamp = read_fw_trace(trace_seq_data, 1) |
337-
((u64)read_fw_trace(trace_seq_data, 2) << 32);
336+
timestamp = ((u64)read_fw_trace(trace_seq_data, 1) << 32) |
337+
read_fw_trace(trace_seq_data, 2);
338338
timestamp = (timestamp & ~ROGUE_FWT_TIMESTAMP_TIME_CLRMSK) >>
339339
ROGUE_FWT_TIMESTAMP_TIME_SHIFT;
340340

drivers/gpu/drm/imagination/pvr_queue.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,20 @@ pvr_queue_fence_get_driver_name(struct dma_fence *f)
109109
return PVR_DRIVER_NAME;
110110
}
111111

112+
static void pvr_queue_fence_release_work(struct work_struct *w)
113+
{
114+
struct pvr_queue_fence *fence = container_of(w, struct pvr_queue_fence, release_work);
115+
116+
pvr_context_put(fence->queue->ctx);
117+
dma_fence_free(&fence->base);
118+
}
119+
112120
static void pvr_queue_fence_release(struct dma_fence *f)
113121
{
114122
struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base);
123+
struct pvr_device *pvr_dev = fence->queue->ctx->pvr_dev;
115124

116-
pvr_context_put(fence->queue->ctx);
117-
dma_fence_free(f);
125+
queue_work(pvr_dev->sched_wq, &fence->release_work);
118126
}
119127

120128
static const char *
@@ -268,6 +276,7 @@ pvr_queue_fence_init(struct dma_fence *f,
268276

269277
pvr_context_get(queue->ctx);
270278
fence->queue = queue;
279+
INIT_WORK(&fence->release_work, pvr_queue_fence_release_work);
271280
dma_fence_init(&fence->base, fence_ops,
272281
&fence_ctx->lock, fence_ctx->id,
273282
atomic_inc_return(&fence_ctx->seqno));
@@ -304,8 +313,9 @@ pvr_queue_cccb_fence_init(struct dma_fence *fence, struct pvr_queue *queue)
304313
static void
305314
pvr_queue_job_fence_init(struct dma_fence *fence, struct pvr_queue *queue)
306315
{
307-
pvr_queue_fence_init(fence, queue, &pvr_queue_job_fence_ops,
308-
&queue->job_fence_ctx);
316+
if (!fence->ops)
317+
pvr_queue_fence_init(fence, queue, &pvr_queue_job_fence_ops,
318+
&queue->job_fence_ctx);
309319
}
310320

311321
/**

drivers/gpu/drm/imagination/pvr_queue.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define PVR_QUEUE_H
66

77
#include <drm/gpu_scheduler.h>
8+
#include <linux/workqueue.h>
89

910
#include "pvr_cccb.h"
1011
#include "pvr_device.h"
@@ -63,6 +64,9 @@ struct pvr_queue_fence {
6364

6465
/** @queue: Queue that created this fence. */
6566
struct pvr_queue *queue;
67+
68+
/** @release_work: Fence release work structure. */
69+
struct work_struct release_work;
6670
};
6771

6872
/**

drivers/gpu/drm/imagination/pvr_vm.c

Lines changed: 108 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,9 @@ pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op,
293293

294294
static int
295295
pvr_vm_bind_op_unmap_init(struct pvr_vm_bind_op *bind_op,
296-
struct pvr_vm_context *vm_ctx, u64 device_addr,
297-
u64 size)
296+
struct pvr_vm_context *vm_ctx,
297+
struct pvr_gem_object *pvr_obj,
298+
u64 device_addr, u64 size)
298299
{
299300
int err;
300301

@@ -318,6 +319,7 @@ pvr_vm_bind_op_unmap_init(struct pvr_vm_bind_op *bind_op,
318319
goto err_bind_op_fini;
319320
}
320321

322+
bind_op->pvr_obj = pvr_obj;
321323
bind_op->vm_ctx = vm_ctx;
322324
bind_op->device_addr = device_addr;
323325
bind_op->size = size;
@@ -597,20 +599,6 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, bool is_userspace_context)
597599
return ERR_PTR(err);
598600
}
599601

600-
/**
601-
* pvr_vm_unmap_all() - Unmap all mappings associated with a VM context.
602-
* @vm_ctx: Target VM context.
603-
*
604-
* This function ensures that no mappings are left dangling by unmapping them
605-
* all in order of ascending device-virtual address.
606-
*/
607-
void
608-
pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx)
609-
{
610-
WARN_ON(pvr_vm_unmap(vm_ctx, vm_ctx->gpuvm_mgr.mm_start,
611-
vm_ctx->gpuvm_mgr.mm_range));
612-
}
613-
614602
/**
615603
* pvr_vm_context_release() - Teardown a VM context.
616604
* @ref_count: Pointer to reference counter of the VM context.
@@ -703,11 +691,7 @@ pvr_vm_lock_extra(struct drm_gpuvm_exec *vm_exec)
703691
struct pvr_vm_bind_op *bind_op = vm_exec->extra.priv;
704692
struct pvr_gem_object *pvr_obj = bind_op->pvr_obj;
705693

706-
/* Unmap operations don't have an object to lock. */
707-
if (!pvr_obj)
708-
return 0;
709-
710-
/* Acquire lock on the GEM being mapped. */
694+
/* Acquire lock on the GEM object being mapped/unmapped. */
711695
return drm_exec_lock_obj(&vm_exec->exec, gem_from_pvr_gem(pvr_obj));
712696
}
713697

@@ -772,8 +756,10 @@ pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj,
772756
}
773757

774758
/**
775-
* pvr_vm_unmap() - Unmap an already mapped section of device-virtual memory.
759+
* pvr_vm_unmap_obj_locked() - Unmap an already mapped section of device-virtual
760+
* memory.
776761
* @vm_ctx: Target VM context.
762+
* @pvr_obj: Target PowerVR memory object.
777763
* @device_addr: Virtual device address at the start of the target mapping.
778764
* @size: Size of the target mapping.
779765
*
@@ -784,9 +770,13 @@ pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj,
784770
* * Any error encountered while performing internal operations required to
785771
* destroy the mapping (returned from pvr_vm_gpuva_unmap or
786772
* pvr_vm_gpuva_remap).
773+
*
774+
* The vm_ctx->lock must be held when calling this function.
787775
*/
788-
int
789-
pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size)
776+
static int
777+
pvr_vm_unmap_obj_locked(struct pvr_vm_context *vm_ctx,
778+
struct pvr_gem_object *pvr_obj,
779+
u64 device_addr, u64 size)
790780
{
791781
struct pvr_vm_bind_op bind_op = {0};
792782
struct drm_gpuvm_exec vm_exec = {
@@ -799,11 +789,13 @@ pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size)
799789
},
800790
};
801791

802-
int err = pvr_vm_bind_op_unmap_init(&bind_op, vm_ctx, device_addr,
803-
size);
792+
int err = pvr_vm_bind_op_unmap_init(&bind_op, vm_ctx, pvr_obj,
793+
device_addr, size);
804794
if (err)
805795
return err;
806796

797+
pvr_gem_object_get(pvr_obj);
798+
807799
err = drm_gpuvm_exec_lock(&vm_exec);
808800
if (err)
809801
goto err_cleanup;
@@ -818,6 +810,96 @@ pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size)
818810
return err;
819811
}
820812

813+
/**
814+
* pvr_vm_unmap_obj() - Unmap an already mapped section of device-virtual
815+
* memory.
816+
* @vm_ctx: Target VM context.
817+
* @pvr_obj: Target PowerVR memory object.
818+
* @device_addr: Virtual device address at the start of the target mapping.
819+
* @size: Size of the target mapping.
820+
*
821+
* Return:
822+
* * 0 on success,
823+
* * Any error encountered by pvr_vm_unmap_obj_locked.
824+
*/
825+
int
826+
pvr_vm_unmap_obj(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj,
827+
u64 device_addr, u64 size)
828+
{
829+
int err;
830+
831+
mutex_lock(&vm_ctx->lock);
832+
err = pvr_vm_unmap_obj_locked(vm_ctx, pvr_obj, device_addr, size);
833+
mutex_unlock(&vm_ctx->lock);
834+
835+
return err;
836+
}
837+
838+
/**
839+
* pvr_vm_unmap() - Unmap an already mapped section of device-virtual memory.
840+
* @vm_ctx: Target VM context.
841+
* @device_addr: Virtual device address at the start of the target mapping.
842+
* @size: Size of the target mapping.
843+
*
844+
* Return:
845+
* * 0 on success,
846+
* * Any error encountered by drm_gpuva_find,
847+
* * Any error encountered by pvr_vm_unmap_obj_locked.
848+
*/
849+
int
850+
pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size)
851+
{
852+
struct pvr_gem_object *pvr_obj;
853+
struct drm_gpuva *va;
854+
int err;
855+
856+
mutex_lock(&vm_ctx->lock);
857+
858+
va = drm_gpuva_find(&vm_ctx->gpuvm_mgr, device_addr, size);
859+
if (va) {
860+
pvr_obj = gem_to_pvr_gem(va->gem.obj);
861+
err = pvr_vm_unmap_obj_locked(vm_ctx, pvr_obj,
862+
va->va.addr, va->va.range);
863+
} else {
864+
err = -ENOENT;
865+
}
866+
867+
mutex_unlock(&vm_ctx->lock);
868+
869+
return err;
870+
}
871+
872+
/**
873+
* pvr_vm_unmap_all() - Unmap all mappings associated with a VM context.
874+
* @vm_ctx: Target VM context.
875+
*
876+
* This function ensures that no mappings are left dangling by unmapping them
877+
* all in order of ascending device-virtual address.
878+
*/
879+
void
880+
pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx)
881+
{
882+
mutex_lock(&vm_ctx->lock);
883+
884+
for (;;) {
885+
struct pvr_gem_object *pvr_obj;
886+
struct drm_gpuva *va;
887+
888+
va = drm_gpuva_find_first(&vm_ctx->gpuvm_mgr,
889+
vm_ctx->gpuvm_mgr.mm_start,
890+
vm_ctx->gpuvm_mgr.mm_range);
891+
if (!va)
892+
break;
893+
894+
pvr_obj = gem_to_pvr_gem(va->gem.obj);
895+
896+
WARN_ON(pvr_vm_unmap_obj_locked(vm_ctx, pvr_obj,
897+
va->va.addr, va->va.range));
898+
}
899+
900+
mutex_unlock(&vm_ctx->lock);
901+
}
902+
821903
/* Static data areas are determined by firmware. */
822904
static const struct drm_pvr_static_data_area static_data_areas[] = {
823905
{

drivers/gpu/drm/imagination/pvr_vm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct pvr_vm_context *pvr_vm_create_context(struct pvr_device *pvr_dev,
3838
int pvr_vm_map(struct pvr_vm_context *vm_ctx,
3939
struct pvr_gem_object *pvr_obj, u64 pvr_obj_offset,
4040
u64 device_addr, u64 size);
41+
int pvr_vm_unmap_obj(struct pvr_vm_context *vm_ctx,
42+
struct pvr_gem_object *pvr_obj,
43+
u64 device_addr, u64 size);
4144
int pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size);
4245
void pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx);
4346

drivers/gpu/drm/nouveau/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config DRM_NOUVEAU
44
depends on DRM && PCI && MMU
55
select IOMMU_API
66
select FW_LOADER
7+
select FW_CACHE if PM_SLEEP
78
select DRM_CLIENT_SELECTION
89
select DRM_DISPLAY_DP_HELPER
910
select DRM_DISPLAY_HDMI_HELPER

drivers/gpu/drm/scheduler/gpu_scheduler_trace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*/
2323

24-
#if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
24+
#if !defined(_GPU_SCHED_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
2525
#define _GPU_SCHED_TRACE_H_
2626

2727
#include <linux/stringify.h>
@@ -106,7 +106,7 @@ TRACE_EVENT(drm_sched_job_wait_dep,
106106
__entry->seqno)
107107
);
108108

109-
#endif
109+
#endif /* _GPU_SCHED_TRACE_H_ */
110110

111111
/* This part must be outside protection */
112112
#undef TRACE_INCLUDE_PATH

drivers/gpu/drm/tiny/bochs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,6 @@ static void bochs_hw_setmode(struct bochs_device *bochs, struct drm_display_mode
335335
bochs->xres, bochs->yres, bochs->bpp,
336336
bochs->yres_virtual);
337337

338-
bochs_hw_blank(bochs, false);
339-
340338
bochs_dispi_write(bochs, VBE_DISPI_INDEX_ENABLE, 0);
341339
bochs_dispi_write(bochs, VBE_DISPI_INDEX_BPP, bochs->bpp);
342340
bochs_dispi_write(bochs, VBE_DISPI_INDEX_XRES, bochs->xres);
@@ -506,6 +504,9 @@ static int bochs_crtc_helper_atomic_check(struct drm_crtc *crtc,
506504
static void bochs_crtc_helper_atomic_enable(struct drm_crtc *crtc,
507505
struct drm_atomic_state *state)
508506
{
507+
struct bochs_device *bochs = to_bochs_device(crtc->dev);
508+
509+
bochs_hw_blank(bochs, false);
509510
}
510511

511512
static void bochs_crtc_helper_atomic_disable(struct drm_crtc *crtc,

0 commit comments

Comments
 (0)