Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/gpu/drm/drm_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
{
struct drm_device *dev = buffer->client->dev;

drm_gem_vunmap(buffer->gem, &buffer->map);
drm_gem_vunmap_locked(buffer->gem, &buffer->map);

if (buffer->gem)
drm_gem_object_put(buffer->gem);
Expand Down Expand Up @@ -344,7 +344,7 @@ drm_client_buffer_vmap(struct drm_client_buffer *buffer,
* fd_install step out of the driver backend hooks, to make that
* final step optional for internal users.
*/
ret = drm_gem_vmap_unlocked(buffer->gem, map);
ret = drm_gem_vmap(buffer->gem, map);
if (ret)
return ret;

Expand All @@ -366,7 +366,7 @@ void drm_client_buffer_vunmap(struct drm_client_buffer *buffer)
{
struct iosys_map *map = &buffer->map;

drm_gem_vunmap_unlocked(buffer->gem, map);
drm_gem_vunmap(buffer->gem, map);
}
EXPORT_SYMBOL(drm_client_buffer_vunmap);

Expand Down
20 changes: 10 additions & 10 deletions drivers/gpu/drm/drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ void drm_gem_unpin(struct drm_gem_object *obj)
obj->funcs->unpin(obj);
}

int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
int drm_gem_vmap_locked(struct drm_gem_object *obj, struct iosys_map *map)
{
int ret;

Expand All @@ -1187,9 +1187,9 @@ int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)

return 0;
}
EXPORT_SYMBOL(drm_gem_vmap);
EXPORT_SYMBOL(drm_gem_vmap_locked);

void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
void drm_gem_vunmap_locked(struct drm_gem_object *obj, struct iosys_map *map)
{
dma_resv_assert_held(obj->resv);

Expand All @@ -1202,27 +1202,27 @@ void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
/* Always set the mapping to NULL. Callers may rely on this. */
iosys_map_clear(map);
}
EXPORT_SYMBOL(drm_gem_vunmap);
EXPORT_SYMBOL(drm_gem_vunmap_locked);

int drm_gem_vmap_unlocked(struct drm_gem_object *obj, struct iosys_map *map)
int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
{
int ret;

dma_resv_lock(obj->resv, NULL);
ret = drm_gem_vmap(obj, map);
ret = drm_gem_vmap_locked(obj, map);
dma_resv_unlock(obj->resv);

return ret;
}
EXPORT_SYMBOL(drm_gem_vmap_unlocked);
EXPORT_SYMBOL(drm_gem_vmap);

void drm_gem_vunmap_unlocked(struct drm_gem_object *obj, struct iosys_map *map)
void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
{
dma_resv_lock(obj->resv, NULL);
drm_gem_vunmap(obj, map);
drm_gem_vunmap_locked(obj, map);
dma_resv_unlock(obj->resv);
}
EXPORT_SYMBOL(drm_gem_vunmap_unlocked);
EXPORT_SYMBOL(drm_gem_vunmap);

/**
* drm_gem_lock_reservations - Sets up the ww context and acquires
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/drm_gem_framebuffer_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb, struct iosys_map *map,
ret = -EINVAL;
goto err_drm_gem_vunmap;
}
ret = drm_gem_vmap_unlocked(obj, &map[i]);
ret = drm_gem_vmap(obj, &map[i]);
if (ret)
goto err_drm_gem_vunmap;
}
Expand All @@ -376,7 +376,7 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb, struct iosys_map *map,
obj = drm_gem_fb_get_obj(fb, i);
if (!obj)
continue;
drm_gem_vunmap_unlocked(obj, &map[i]);
drm_gem_vunmap(obj, &map[i]);
}
return ret;
}
Expand All @@ -403,7 +403,7 @@ void drm_gem_fb_vunmap(struct drm_framebuffer *fb, struct iosys_map *map)
continue;
if (iosys_map_is_null(&map[i]))
continue;
drm_gem_vunmap_unlocked(obj, &map[i]);
drm_gem_vunmap(obj, &map[i]);
}
}
EXPORT_SYMBOL(drm_gem_fb_vunmap);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/drm_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,

int drm_gem_pin(struct drm_gem_object *obj);
void drm_gem_unpin(struct drm_gem_object *obj);
int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map);
void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);
int drm_gem_vmap_locked(struct drm_gem_object *obj, struct iosys_map *map);
void drm_gem_vunmap_locked(struct drm_gem_object *obj, struct iosys_map *map);

int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev,
u32 handle);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/drm_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ int drm_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct iosys_map *map)
{
struct drm_gem_object *obj = dma_buf->priv;

return drm_gem_vmap(obj, map);
return drm_gem_vmap_locked(obj, map);
}
EXPORT_SYMBOL(drm_gem_dmabuf_vmap);

Expand All @@ -696,7 +696,7 @@ void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map)
{
struct drm_gem_object *obj = dma_buf->priv;

drm_gem_vunmap(obj, map);
drm_gem_vunmap_locked(obj, map);
}
EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/lima/lima_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@ static void lima_sched_build_error_task_list(struct lima_sched_task *task)
} else {
buffer_chunk->size = lima_bo_size(bo);

ret = drm_gem_vmap_unlocked(&bo->base.base, &map);
ret = drm_gem_vmap(&bo->base.base, &map);
if (ret) {
kvfree(et);
goto out;
}

memcpy(buffer_chunk + 1, map.vaddr, buffer_chunk->size);

drm_gem_vunmap_unlocked(&bo->base.base, &map);
drm_gem_vunmap(&bo->base.base, &map);
}

buffer_chunk = (void *)(buffer_chunk + 1) + buffer_chunk->size;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panfrost/panfrost_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void panfrost_core_dump(struct panfrost_job *job)
goto dump_header;
}

ret = drm_gem_vmap_unlocked(&bo->base.base, &map);
ret = drm_gem_vmap(&bo->base.base, &map);
if (ret) {
dev_err(pfdev->dev, "Panfrost Dump: couldn't map Buffer Object\n");
iter.hdr->bomap.valid = 0;
Expand All @@ -236,7 +236,7 @@ void panfrost_core_dump(struct panfrost_job *job)
vaddr = map.vaddr;
memcpy(iter.data, vaddr, bo->base.base.size);

drm_gem_vunmap_unlocked(&bo->base.base, &map);
drm_gem_vunmap(&bo->base.base, &map);

iter.hdr->bomap.valid = 1;

Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/panfrost/panfrost_perfcnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
goto err_close_bo;
}

ret = drm_gem_vmap_unlocked(&bo->base, &map);
ret = drm_gem_vmap(&bo->base, &map);
if (ret)
goto err_put_mapping;
perfcnt->buf = map.vaddr;
Expand Down Expand Up @@ -165,7 +165,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
return 0;

err_vunmap:
drm_gem_vunmap_unlocked(&bo->base, &map);
drm_gem_vunmap(&bo->base, &map);
err_put_mapping:
panfrost_gem_mapping_put(perfcnt->mapping);
err_close_bo:
Expand Down Expand Up @@ -195,7 +195,7 @@ static int panfrost_perfcnt_disable_locked(struct panfrost_device *pfdev,
GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF));

perfcnt->user = NULL;
drm_gem_vunmap_unlocked(&perfcnt->mapping->obj->base.base, &map);
drm_gem_vunmap(&perfcnt->mapping->obj->base.base, &map);
perfcnt->buf = NULL;
panfrost_gem_close(&perfcnt->mapping->obj->base.base, file_priv);
panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu);
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/panthor/panthor_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ int panthor_device_init(struct panthor_device *ptdev)
struct page *p;
int ret;

ret = panthor_gpu_coherency_init(ptdev);
if (ret)
return ret;

init_completion(&ptdev->unplug.done);
ret = drmm_mutex_init(&ptdev->base, &ptdev->unplug.lock);
if (ret)
Expand Down Expand Up @@ -245,7 +241,7 @@ int panthor_device_init(struct panthor_device *ptdev)

ret = pm_runtime_resume_and_get(ptdev->base.dev);
if (ret)
goto err_unplug_gpu;
return ret;

/* If PM is disabled, we need to call panthor_device_resume() manually. */
if (!IS_ENABLED(CONFIG_PM)) {
Expand All @@ -258,6 +254,10 @@ int panthor_device_init(struct panthor_device *ptdev)
if (ret)
goto err_rpm_put;

ret = panthor_gpu_coherency_init(ptdev);
if (ret)
goto err_unplug_gpu;

ret = panthor_mmu_init(ptdev);
if (ret)
goto err_unplug_gpu;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/panthor/panthor_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,6 @@ static irqreturn_t panthor_ ## __name ## _irq_threaded_handler(int irq, void *da
if (!status) \
break; \
\
gpu_write(ptdev, __reg_prefix ## _INT_CLEAR, status); \
\
__handler(ptdev, status); \
ret = IRQ_HANDLED; \
} \
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/panthor/panthor_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,8 @@ static void panthor_fw_init_global_iface(struct panthor_device *ptdev)

static void panthor_job_irq_handler(struct panthor_device *ptdev, u32 status)
{
gpu_write(ptdev, JOB_INT_CLEAR, status);

if (!ptdev->fw->booted && (status & JOB_INT_GLOBAL_IF))
ptdev->fw->booted = true;

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panthor/panthor_gem.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ panthor_kernel_bo_vmap(struct panthor_kernel_bo *bo)
if (bo->kmap)
return 0;

ret = drm_gem_vmap_unlocked(bo->obj, &map);
ret = drm_gem_vmap(bo->obj, &map);
if (ret)
return ret;

Expand All @@ -194,7 +194,7 @@ panthor_kernel_bo_vunmap(struct panthor_kernel_bo *bo)
if (bo->kmap) {
struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->kmap);

drm_gem_vunmap_unlocked(bo->obj, &map);
drm_gem_vunmap(bo->obj, &map);
bo->kmap = NULL;
}
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/panthor/panthor_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ static void panthor_gpu_init_info(struct panthor_device *ptdev)

static void panthor_gpu_irq_handler(struct panthor_device *ptdev, u32 status)
{
gpu_write(ptdev, GPU_INT_CLEAR, status);

if (status & GPU_IRQ_FAULT) {
u32 fault_status = gpu_read(ptdev, GPU_FAULT_STATUS);
u64 address = gpu_read64(ptdev, GPU_FAULT_ADDR);
Expand Down
9 changes: 8 additions & 1 deletion drivers/gpu/drm/panthor/panthor_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ int panthor_vm_active(struct panthor_vm *vm)
if (ptdev->mmu->as.faulty_mask & panthor_mmu_as_fault_mask(ptdev, as)) {
gpu_write(ptdev, MMU_INT_CLEAR, panthor_mmu_as_fault_mask(ptdev, as));
ptdev->mmu->as.faulty_mask &= ~panthor_mmu_as_fault_mask(ptdev, as);
ptdev->mmu->irq.mask |= panthor_mmu_as_fault_mask(ptdev, as);
gpu_write(ptdev, MMU_INT_MASK, ~ptdev->mmu->as.faulty_mask);
}

Expand Down Expand Up @@ -1685,11 +1686,17 @@ static void panthor_mmu_irq_handler(struct panthor_device *ptdev, u32 status)
access_type, access_type_name(ptdev, fault_status),
source_id);

/* We don't handle VM faults at the moment, so let's just clear the
* interrupt and let the writer/reader crash.
* Note that COMPLETED irqs are never cleared, but this is fine
* because they are always masked.
*/
gpu_write(ptdev, MMU_INT_CLEAR, mask);

/* Ignore MMU interrupts on this AS until it's been
* re-enabled.
*/
ptdev->mmu->irq.mask = new_int_mask;
gpu_write(ptdev, MMU_INT_MASK, new_int_mask);

if (ptdev->mmu->as.slots[as].vm)
ptdev->mmu->as.slots[as].vm->unhandled_fault = true;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panthor/panthor_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
#define GPU_COHERENCY_PROT_BIT(name) BIT(GPU_COHERENCY_ ## name)

#define GPU_COHERENCY_PROTOCOL 0x304
#define GPU_COHERENCY_ACE 0
#define GPU_COHERENCY_ACE_LITE 1
#define GPU_COHERENCY_ACE_LITE 0
#define GPU_COHERENCY_ACE 1
#define GPU_COHERENCY_NONE 31

#define MCU_CONTROL 0x700
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panthor/panthor_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ panthor_queue_put_syncwait_obj(struct panthor_queue *queue)
if (queue->syncwait.kmap) {
struct iosys_map map = IOSYS_MAP_INIT_VADDR(queue->syncwait.kmap);

drm_gem_vunmap_unlocked(queue->syncwait.obj, &map);
drm_gem_vunmap(queue->syncwait.obj, &map);
queue->syncwait.kmap = NULL;
}

Expand All @@ -866,7 +866,7 @@ panthor_queue_get_syncwait_obj(struct panthor_group *group, struct panthor_queue
goto err_put_syncwait_obj;

queue->syncwait.obj = &bo->base.base;
ret = drm_gem_vmap_unlocked(queue->syncwait.obj, &map);
ret = drm_gem_vmap(queue->syncwait.obj, &map);
if (drm_WARN_ON(&ptdev->base, ret))
goto err_put_syncwait_obj;

Expand Down
4 changes: 2 additions & 2 deletions include/drm/drm_gem.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj);
void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
bool dirty, bool accessed);

int drm_gem_vmap_unlocked(struct drm_gem_object *obj, struct iosys_map *map);
void drm_gem_vunmap_unlocked(struct drm_gem_object *obj, struct iosys_map *map);
int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map);
void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);

int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
int count, struct drm_gem_object ***objs_out);
Expand Down
Loading