| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. |
|---|
| 2 | | - * |
|---|
| 3 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 4 | | - * it under the terms of the GNU General Public License version 2 and |
|---|
| 5 | | - * only version 2 as published by the Free Software Foundation. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 8 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 9 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 10 | | - * GNU General Public License for more details. |
|---|
| 11 | | - * |
|---|
| 12 | 3 | */ |
|---|
| 13 | 4 | #ifndef __A5XX_GPU_H__ |
|---|
| 14 | 5 | #define __A5XX_GPU_H__ |
|---|
| .. | .. |
|---|
| 40 | 31 | struct msm_ringbuffer *next_ring; |
|---|
| 41 | 32 | |
|---|
| 42 | 33 | struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS]; |
|---|
| 34 | + struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS]; |
|---|
| 43 | 35 | struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS]; |
|---|
| 44 | 36 | uint64_t preempt_iova[MSM_GPU_MAX_RINGS]; |
|---|
| 45 | 37 | |
|---|
| 46 | 38 | atomic_t preempt_state; |
|---|
| 47 | 39 | struct timer_list preempt_timer; |
|---|
| 40 | + |
|---|
| 41 | + struct drm_gem_object *shadow_bo; |
|---|
| 42 | + uint64_t shadow_iova; |
|---|
| 43 | + uint32_t *shadow; |
|---|
| 44 | + |
|---|
| 45 | + /* True if the microcode supports the WHERE_AM_I opcode */ |
|---|
| 46 | + bool has_whereami; |
|---|
| 48 | 47 | }; |
|---|
| 49 | 48 | |
|---|
| 50 | 49 | #define to_a5xx_gpu(x) container_of(x, struct a5xx_gpu, base) |
|---|
| 51 | 50 | |
|---|
| 52 | 51 | #ifdef CONFIG_DEBUG_FS |
|---|
| 53 | | -int a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor); |
|---|
| 52 | +void a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor); |
|---|
| 54 | 53 | #endif |
|---|
| 55 | 54 | |
|---|
| 56 | 55 | /* |
|---|
| .. | .. |
|---|
| 149 | 148 | return -ETIMEDOUT; |
|---|
| 150 | 149 | } |
|---|
| 151 | 150 | |
|---|
| 151 | +#define shadowptr(a5xx_gpu, ring) ((a5xx_gpu)->shadow_iova + \ |
|---|
| 152 | + ((ring)->id * sizeof(uint32_t))) |
|---|
| 153 | + |
|---|
| 152 | 154 | bool a5xx_idle(struct msm_gpu *gpu, struct msm_ringbuffer *ring); |
|---|
| 153 | 155 | void a5xx_set_hwcg(struct msm_gpu *gpu, bool state); |
|---|
| 154 | 156 | |
|---|
| .. | .. |
|---|
| 158 | 160 | void a5xx_preempt_irq(struct msm_gpu *gpu); |
|---|
| 159 | 161 | void a5xx_preempt_fini(struct msm_gpu *gpu); |
|---|
| 160 | 162 | |
|---|
| 163 | +void a5xx_flush(struct msm_gpu *gpu, struct msm_ringbuffer *ring, bool sync); |
|---|
| 164 | + |
|---|
| 161 | 165 | /* Return true if we are in a preempt state */ |
|---|
| 162 | 166 | static inline bool a5xx_in_preempt(struct a5xx_gpu *a5xx_gpu) |
|---|
| 163 | 167 | { |
|---|