hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/gpu/drm/msm/msm_ringbuffer.c
....@@ -1,18 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013 Red Hat
34 * Author: Rob Clark <robdclark@gmail.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program. If not, see <http://www.gnu.org/licenses/>.
165 */
176
187 #include "msm_ringbuffer.h"
....@@ -36,15 +25,19 @@
3625
3726 ring->gpu = gpu;
3827 ring->id = id;
39
- /* Pass NULL for the iova pointer - we will map it later */
28
+
4029 ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ,
41
- MSM_BO_WC, gpu->aspace, &ring->bo, NULL);
30
+ check_apriv(gpu, MSM_BO_WC | MSM_BO_GPU_READONLY),
31
+ gpu->aspace, &ring->bo, &ring->iova);
4232
4333 if (IS_ERR(ring->start)) {
4434 ret = PTR_ERR(ring->start);
4535 ring->start = 0;
4636 goto fail;
4737 }
38
+
39
+ msm_gem_object_set_name(ring->bo, "ring%d", id);
40
+
4841 ring->end = ring->start + (MSM_GPU_RINGBUFFER_SZ >> 2);
4942 ring->next = ring->start;
5043 ring->cur = ring->start;
....@@ -53,7 +46,7 @@
5346 ring->memptrs_iova = memptrs_iova;
5447
5548 INIT_LIST_HEAD(&ring->submits);
56
- spin_lock_init(&ring->lock);
49
+ spin_lock_init(&ring->preempt_lock);
5750
5851 snprintf(name, sizeof(name), "gpu-ring-%d", ring->id);
5952
....@@ -73,10 +66,7 @@
7366
7467 msm_fence_context_free(ring->fctx);
7568
76
- if (ring->bo) {
77
- msm_gem_put_iova(ring->bo, ring->gpu->aspace);
78
- msm_gem_put_vaddr(ring->bo);
79
- drm_gem_object_put_unlocked(ring->bo);
80
- }
69
+ msm_gem_kernel_put(ring->bo, ring->gpu->aspace, false);
70
+
8171 kfree(ring);
8272 }