157692c94SEric Anholt // SPDX-License-Identifier: GPL-2.0+
257692c94SEric Anholt /* Copyright (C) 2015-2018 Broadcom */
357692c94SEric Anholt
4220989e7SSam Ravnborg #include <linux/delay.h>
5220989e7SSam Ravnborg #include <linux/mutex.h>
6220989e7SSam Ravnborg #include <linux/spinlock_types.h>
7220989e7SSam Ravnborg #include <linux/workqueue.h>
8220989e7SSam Ravnborg
957692c94SEric Anholt #include <drm/drm_encoder.h>
1057692c94SEric Anholt #include <drm/drm_gem.h>
1140609d48SEric Anholt #include <drm/drm_gem_shmem_helper.h>
1257692c94SEric Anholt #include <drm/gpu_scheduler.h>
13220989e7SSam Ravnborg
141584f16cSEric Anholt #include "uapi/drm/v3d_drm.h"
1557692c94SEric Anholt
16220989e7SSam Ravnborg struct clk;
17220989e7SSam Ravnborg struct platform_device;
18220989e7SSam Ravnborg struct reset_control;
19220989e7SSam Ravnborg
2057692c94SEric Anholt #define GMP_GRANULARITY (128 * 1024)
2157692c94SEric Anholt
22d223f98fSEric Anholt #define V3D_MAX_QUEUES (V3D_CACHE_CLEAN + 1)
2357692c94SEric Anholt
2457692c94SEric Anholt struct v3d_queue_state {
2557692c94SEric Anholt struct drm_gpu_scheduler sched;
2657692c94SEric Anholt
2757692c94SEric Anholt u64 fence_context;
2857692c94SEric Anholt u64 emit_seqno;
2957692c94SEric Anholt };
3057692c94SEric Anholt
3126a4dc29SJuan A. Suarez Romero /* Performance monitor object. The perform lifetime is controlled by userspace
3226a4dc29SJuan A. Suarez Romero * using perfmon related ioctls. A perfmon can be attached to a submit_cl
3326a4dc29SJuan A. Suarez Romero * request, and when this is the case, HW perf counters will be activated just
3426a4dc29SJuan A. Suarez Romero * before the submit_cl is submitted to the GPU and disabled when the job is
3526a4dc29SJuan A. Suarez Romero * done. This way, only events related to a specific job will be counted.
3626a4dc29SJuan A. Suarez Romero */
3726a4dc29SJuan A. Suarez Romero struct v3d_perfmon {
3826a4dc29SJuan A. Suarez Romero /* Tracks the number of users of the perfmon, when this counter reaches
3926a4dc29SJuan A. Suarez Romero * zero the perfmon is destroyed.
4026a4dc29SJuan A. Suarez Romero */
4126a4dc29SJuan A. Suarez Romero refcount_t refcnt;
4226a4dc29SJuan A. Suarez Romero
4326a4dc29SJuan A. Suarez Romero /* Protects perfmon stop, as it can be invoked from multiple places. */
4426a4dc29SJuan A. Suarez Romero struct mutex lock;
4526a4dc29SJuan A. Suarez Romero
4626a4dc29SJuan A. Suarez Romero /* Number of counters activated in this perfmon instance
4726a4dc29SJuan A. Suarez Romero * (should be less than DRM_V3D_MAX_PERF_COUNTERS).
4826a4dc29SJuan A. Suarez Romero */
4926a4dc29SJuan A. Suarez Romero u8 ncounters;
5026a4dc29SJuan A. Suarez Romero
5126a4dc29SJuan A. Suarez Romero /* Events counted by the HW perf counters. */
5226a4dc29SJuan A. Suarez Romero u8 counters[DRM_V3D_MAX_PERF_COUNTERS];
5326a4dc29SJuan A. Suarez Romero
5426a4dc29SJuan A. Suarez Romero /* Storage for counter values. Counters are incremented by the
5526a4dc29SJuan A. Suarez Romero * HW perf counter values every time the perfmon is attached
5626a4dc29SJuan A. Suarez Romero * to a GPU job. This way, perfmon users don't have to
5726a4dc29SJuan A. Suarez Romero * retrieve the results after each job if they want to track
5826a4dc29SJuan A. Suarez Romero * events covering several submissions. Note that counter
5926a4dc29SJuan A. Suarez Romero * values can't be reset, but you can fake a reset by
6026a4dc29SJuan A. Suarez Romero * destroying the perfmon and creating a new one.
6126a4dc29SJuan A. Suarez Romero */
6226a4dc29SJuan A. Suarez Romero u64 values[];
6326a4dc29SJuan A. Suarez Romero };
6426a4dc29SJuan A. Suarez Romero
6557692c94SEric Anholt struct v3d_dev {
6657692c94SEric Anholt struct drm_device drm;
6757692c94SEric Anholt
6857692c94SEric Anholt /* Short representation (e.g. 33, 41) of the V3D tech version
6957692c94SEric Anholt * and revision.
7057692c94SEric Anholt */
7157692c94SEric Anholt int ver;
72eea9b97bSEric Anholt bool single_irq_line;
7357692c94SEric Anholt
7457692c94SEric Anholt void __iomem *hub_regs;
7557692c94SEric Anholt void __iomem *core_regs[3];
7657692c94SEric Anholt void __iomem *bridge_regs;
7757692c94SEric Anholt void __iomem *gca_regs;
7857692c94SEric Anholt struct clk *clk;
79eea9b97bSEric Anholt struct reset_control *reset;
8057692c94SEric Anholt
8157692c94SEric Anholt /* Virtual and DMA addresses of the single shared page table. */
8257692c94SEric Anholt volatile u32 *pt;
8357692c94SEric Anholt dma_addr_t pt_paddr;
8457692c94SEric Anholt
8557692c94SEric Anholt /* Virtual and DMA addresses of the MMU's scratch page. When
8657692c94SEric Anholt * a read or write is invalid in the MMU, it will be
8757692c94SEric Anholt * redirected here.
8857692c94SEric Anholt */
8957692c94SEric Anholt void *mmu_scratch;
9057692c94SEric Anholt dma_addr_t mmu_scratch_paddr;
9138c2c791SEric Anholt /* virtual address bits from V3D to the MMU. */
9238c2c791SEric Anholt int va_width;
9357692c94SEric Anholt
9457692c94SEric Anholt /* Number of V3D cores. */
9557692c94SEric Anholt u32 cores;
9657692c94SEric Anholt
9757692c94SEric Anholt /* Allocator managing the address space. All units are in
9857692c94SEric Anholt * number of pages.
9957692c94SEric Anholt */
10057692c94SEric Anholt struct drm_mm mm;
10157692c94SEric Anholt spinlock_t mm_lock;
10257692c94SEric Anholt
10357692c94SEric Anholt struct work_struct overflow_mem_work;
10457692c94SEric Anholt
105a783a09eSEric Anholt struct v3d_bin_job *bin_job;
106a783a09eSEric Anholt struct v3d_render_job *render_job;
1071584f16cSEric Anholt struct v3d_tfu_job *tfu_job;
108d223f98fSEric Anholt struct v3d_csd_job *csd_job;
10957692c94SEric Anholt
11057692c94SEric Anholt struct v3d_queue_state queue[V3D_MAX_QUEUES];
11157692c94SEric Anholt
11257692c94SEric Anholt /* Spinlock used to synchronize the overflow memory
11357692c94SEric Anholt * management against bin job submission.
11457692c94SEric Anholt */
11557692c94SEric Anholt spinlock_t job_lock;
11657692c94SEric Anholt
11726a4dc29SJuan A. Suarez Romero /* Used to track the active perfmon if any. */
11826a4dc29SJuan A. Suarez Romero struct v3d_perfmon *active_perfmon;
11926a4dc29SJuan A. Suarez Romero
12057692c94SEric Anholt /* Protects bo_stats */
12157692c94SEric Anholt struct mutex bo_lock;
12257692c94SEric Anholt
12357692c94SEric Anholt /* Lock taken when resetting the GPU, to keep multiple
12457692c94SEric Anholt * processes from trying to park the scheduler threads and
12557692c94SEric Anholt * reset at once.
12657692c94SEric Anholt */
12757692c94SEric Anholt struct mutex reset_lock;
12857692c94SEric Anholt
1297122b68bSEric Anholt /* Lock taken when creating and pushing the GPU scheduler
1307122b68bSEric Anholt * jobs, to keep the sched-fence seqnos in order.
1317122b68bSEric Anholt */
1327122b68bSEric Anholt struct mutex sched_lock;
1337122b68bSEric Anholt
134d223f98fSEric Anholt /* Lock taken during a cache clean and when initiating an L2
135d223f98fSEric Anholt * flush, to keep L2 flushes from interfering with the
136d223f98fSEric Anholt * synchronous L2 cleans.
137d223f98fSEric Anholt */
138d223f98fSEric Anholt struct mutex cache_clean_lock;
139d223f98fSEric Anholt
14057692c94SEric Anholt struct {
14157692c94SEric Anholt u32 num_allocated;
14257692c94SEric Anholt u32 pages_allocated;
14357692c94SEric Anholt } bo_stats;
14457692c94SEric Anholt };
14557692c94SEric Anholt
14657692c94SEric Anholt static inline struct v3d_dev *
to_v3d_dev(struct drm_device * dev)14757692c94SEric Anholt to_v3d_dev(struct drm_device *dev)
14857692c94SEric Anholt {
149af25c16bSDaniel Vetter return container_of(dev, struct v3d_dev, drm);
15057692c94SEric Anholt }
15157692c94SEric Anholt
152d223f98fSEric Anholt static inline bool
v3d_has_csd(struct v3d_dev * v3d)153d223f98fSEric Anholt v3d_has_csd(struct v3d_dev *v3d)
154d223f98fSEric Anholt {
155d223f98fSEric Anholt return v3d->ver >= 41;
156d223f98fSEric Anholt }
157d223f98fSEric Anholt
1580df3ac76SDaniel Vetter #define v3d_to_pdev(v3d) to_platform_device((v3d)->drm.dev)
1590df3ac76SDaniel Vetter
16057692c94SEric Anholt /* The per-fd struct, which tracks the MMU mappings. */
16157692c94SEric Anholt struct v3d_file_priv {
16257692c94SEric Anholt struct v3d_dev *v3d;
16357692c94SEric Anholt
16426a4dc29SJuan A. Suarez Romero struct {
16526a4dc29SJuan A. Suarez Romero struct idr idr;
16626a4dc29SJuan A. Suarez Romero struct mutex lock;
16726a4dc29SJuan A. Suarez Romero } perfmon;
16826a4dc29SJuan A. Suarez Romero
16957692c94SEric Anholt struct drm_sched_entity sched_entity[V3D_MAX_QUEUES];
17057692c94SEric Anholt };
17157692c94SEric Anholt
17257692c94SEric Anholt struct v3d_bo {
17340609d48SEric Anholt struct drm_gem_shmem_object base;
17457692c94SEric Anholt
17557692c94SEric Anholt struct drm_mm_node node;
17657692c94SEric Anholt
17757692c94SEric Anholt /* List entry for the BO's position in
178a783a09eSEric Anholt * v3d_render_job->unref_list
17957692c94SEric Anholt */
18057692c94SEric Anholt struct list_head unref_head;
18157692c94SEric Anholt };
18257692c94SEric Anholt
18357692c94SEric Anholt static inline struct v3d_bo *
to_v3d_bo(struct drm_gem_object * bo)18457692c94SEric Anholt to_v3d_bo(struct drm_gem_object *bo)
18557692c94SEric Anholt {
18657692c94SEric Anholt return (struct v3d_bo *)bo;
18757692c94SEric Anholt }
18857692c94SEric Anholt
18957692c94SEric Anholt struct v3d_fence {
19057692c94SEric Anholt struct dma_fence base;
19157692c94SEric Anholt struct drm_device *dev;
19257692c94SEric Anholt /* v3d seqno for signaled() test */
19357692c94SEric Anholt u64 seqno;
19457692c94SEric Anholt enum v3d_queue queue;
19557692c94SEric Anholt };
19657692c94SEric Anholt
19757692c94SEric Anholt static inline struct v3d_fence *
to_v3d_fence(struct dma_fence * fence)19857692c94SEric Anholt to_v3d_fence(struct dma_fence *fence)
19957692c94SEric Anholt {
20057692c94SEric Anholt return (struct v3d_fence *)fence;
20157692c94SEric Anholt }
20257692c94SEric Anholt
20357692c94SEric Anholt #define V3D_READ(offset) readl(v3d->hub_regs + offset)
20457692c94SEric Anholt #define V3D_WRITE(offset, val) writel(val, v3d->hub_regs + offset)
20557692c94SEric Anholt
20657692c94SEric Anholt #define V3D_BRIDGE_READ(offset) readl(v3d->bridge_regs + offset)
20757692c94SEric Anholt #define V3D_BRIDGE_WRITE(offset, val) writel(val, v3d->bridge_regs + offset)
20857692c94SEric Anholt
20957692c94SEric Anholt #define V3D_GCA_READ(offset) readl(v3d->gca_regs + offset)
21057692c94SEric Anholt #define V3D_GCA_WRITE(offset, val) writel(val, v3d->gca_regs + offset)
21157692c94SEric Anholt
21257692c94SEric Anholt #define V3D_CORE_READ(core, offset) readl(v3d->core_regs[core] + offset)
21357692c94SEric Anholt #define V3D_CORE_WRITE(core, offset, val) writel(val, v3d->core_regs[core] + offset)
21457692c94SEric Anholt
21557692c94SEric Anholt struct v3d_job {
21657692c94SEric Anholt struct drm_sched_job base;
21757692c94SEric Anholt
218a783a09eSEric Anholt struct kref refcount;
219a783a09eSEric Anholt
220a783a09eSEric Anholt struct v3d_dev *v3d;
221a783a09eSEric Anholt
222a783a09eSEric Anholt /* This is the array of BOs that were looked up at the start
223a783a09eSEric Anholt * of submission.
224a783a09eSEric Anholt */
225a783a09eSEric Anholt struct drm_gem_object **bo;
226a783a09eSEric Anholt u32 bo_count;
22757692c94SEric Anholt
22857692c94SEric Anholt /* v3d fence to be signaled by IRQ handler when the job is complete. */
2293f0b646eSEric Anholt struct dma_fence *irq_fence;
23057692c94SEric Anholt
231a783a09eSEric Anholt /* scheduler fence for when the job is considered complete and
232a783a09eSEric Anholt * the BO reservations can be released.
233a783a09eSEric Anholt */
234a783a09eSEric Anholt struct dma_fence *done_fence;
235a783a09eSEric Anholt
23626a4dc29SJuan A. Suarez Romero /* Pointer to a performance monitor object if the user requested it,
23726a4dc29SJuan A. Suarez Romero * NULL otherwise.
23826a4dc29SJuan A. Suarez Romero */
23926a4dc29SJuan A. Suarez Romero struct v3d_perfmon *perfmon;
24026a4dc29SJuan A. Suarez Romero
241a783a09eSEric Anholt /* Callback for the freeing of the job on refcount going to 0. */
242a783a09eSEric Anholt void (*free)(struct kref *ref);
243a783a09eSEric Anholt };
244a783a09eSEric Anholt
245a783a09eSEric Anholt struct v3d_bin_job {
246a783a09eSEric Anholt struct v3d_job base;
247a783a09eSEric Anholt
24857692c94SEric Anholt /* GPU virtual addresses of the start/end of the CL job. */
24957692c94SEric Anholt u32 start, end;
250624bb0c0SEric Anholt
251624bb0c0SEric Anholt u32 timedout_ctca, timedout_ctra;
25257692c94SEric Anholt
253a783a09eSEric Anholt /* Corresponding render job, for attaching our overflow memory. */
254a783a09eSEric Anholt struct v3d_render_job *render;
25557692c94SEric Anholt
25657692c94SEric Anholt /* Submitted tile memory allocation start/size, tile state. */
25757692c94SEric Anholt u32 qma, qms, qts;
25857692c94SEric Anholt };
25957692c94SEric Anholt
260a783a09eSEric Anholt struct v3d_render_job {
261a783a09eSEric Anholt struct v3d_job base;
262a783a09eSEric Anholt
263a783a09eSEric Anholt /* GPU virtual addresses of the start/end of the CL job. */
264a783a09eSEric Anholt u32 start, end;
265a783a09eSEric Anholt
266a783a09eSEric Anholt u32 timedout_ctca, timedout_ctra;
267a783a09eSEric Anholt
268a783a09eSEric Anholt /* List of overflow BOs used in the job that need to be
269a783a09eSEric Anholt * released once the job is complete.
270a783a09eSEric Anholt */
271a783a09eSEric Anholt struct list_head unref_list;
272a783a09eSEric Anholt };
273a783a09eSEric Anholt
2741584f16cSEric Anholt struct v3d_tfu_job {
275a783a09eSEric Anholt struct v3d_job base;
2761584f16cSEric Anholt
2771584f16cSEric Anholt struct drm_v3d_submit_tfu args;
2781584f16cSEric Anholt };
2791584f16cSEric Anholt
280d223f98fSEric Anholt struct v3d_csd_job {
281d223f98fSEric Anholt struct v3d_job base;
282d223f98fSEric Anholt
283d223f98fSEric Anholt u32 timedout_batches;
284d223f98fSEric Anholt
285d223f98fSEric Anholt struct drm_v3d_submit_csd args;
286d223f98fSEric Anholt };
287d223f98fSEric Anholt
288e4165ae8SMelissa Wen struct v3d_submit_outsync {
289e4165ae8SMelissa Wen struct drm_syncobj *syncobj;
290e4165ae8SMelissa Wen };
291e4165ae8SMelissa Wen
292e4165ae8SMelissa Wen struct v3d_submit_ext {
293e4165ae8SMelissa Wen u32 flags;
294e4165ae8SMelissa Wen u32 wait_stage;
295e4165ae8SMelissa Wen
296e4165ae8SMelissa Wen u32 in_sync_count;
297e4165ae8SMelissa Wen u64 in_syncs;
298e4165ae8SMelissa Wen
299e4165ae8SMelissa Wen u32 out_sync_count;
300e4165ae8SMelissa Wen struct v3d_submit_outsync *out_syncs;
301e4165ae8SMelissa Wen };
302e4165ae8SMelissa Wen
30357692c94SEric Anholt /**
3049daee614SJames Hughes * __wait_for - magic wait macro
30557692c94SEric Anholt *
3069daee614SJames Hughes * Macro to help avoid open coding check/wait/timeout patterns. Note that it's
3079daee614SJames Hughes * important that we check the condition again after having timed out, since the
3089daee614SJames Hughes * timeout could be due to preemption or similar and we've never had a chance to
3099daee614SJames Hughes * check the condition before the timeout.
31057692c94SEric Anholt */
3119daee614SJames Hughes #define __wait_for(OP, COND, US, Wmin, Wmax) ({ \
3129daee614SJames Hughes const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \
3139daee614SJames Hughes long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \
3149daee614SJames Hughes int ret__; \
3159daee614SJames Hughes might_sleep(); \
3169daee614SJames Hughes for (;;) { \
3179daee614SJames Hughes const bool expired__ = ktime_after(ktime_get_raw(), end__); \
3189daee614SJames Hughes OP; \
3199daee614SJames Hughes /* Guarantee COND check prior to timeout */ \
3209daee614SJames Hughes barrier(); \
3219daee614SJames Hughes if (COND) { \
3229daee614SJames Hughes ret__ = 0; \
3239daee614SJames Hughes break; \
3249daee614SJames Hughes } \
3259daee614SJames Hughes if (expired__) { \
32657692c94SEric Anholt ret__ = -ETIMEDOUT; \
32757692c94SEric Anholt break; \
32857692c94SEric Anholt } \
3299daee614SJames Hughes usleep_range(wait__, wait__ * 2); \
3309daee614SJames Hughes if (wait__ < (Wmax)) \
3319daee614SJames Hughes wait__ <<= 1; \
33257692c94SEric Anholt } \
33357692c94SEric Anholt ret__; \
33457692c94SEric Anholt })
33557692c94SEric Anholt
3369daee614SJames Hughes #define _wait_for(COND, US, Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \
3379daee614SJames Hughes (Wmax))
3389daee614SJames Hughes #define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000)
3399daee614SJames Hughes
nsecs_to_jiffies_timeout(const u64 n)34057692c94SEric Anholt static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
34157692c94SEric Anholt {
34257692c94SEric Anholt /* nsecs_to_jiffies64() does not guard against overflow */
343*b27211dbSNathan Chancellor if ((NSEC_PER_SEC % HZ) != 0 &&
34457692c94SEric Anholt div_u64(n, NSEC_PER_SEC) >= MAX_JIFFY_OFFSET / HZ)
34557692c94SEric Anholt return MAX_JIFFY_OFFSET;
34657692c94SEric Anholt
34757692c94SEric Anholt return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
34857692c94SEric Anholt }
34957692c94SEric Anholt
35057692c94SEric Anholt /* v3d_bo.c */
35140609d48SEric Anholt struct drm_gem_object *v3d_create_object(struct drm_device *dev, size_t size);
35257692c94SEric Anholt void v3d_free_object(struct drm_gem_object *gem_obj);
35357692c94SEric Anholt struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv,
35457692c94SEric Anholt size_t size);
35557692c94SEric Anholt int v3d_create_bo_ioctl(struct drm_device *dev, void *data,
35657692c94SEric Anholt struct drm_file *file_priv);
35757692c94SEric Anholt int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data,
35857692c94SEric Anholt struct drm_file *file_priv);
35957692c94SEric Anholt int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data,
36057692c94SEric Anholt struct drm_file *file_priv);
36157692c94SEric Anholt struct drm_gem_object *v3d_prime_import_sg_table(struct drm_device *dev,
36257692c94SEric Anholt struct dma_buf_attachment *attach,
36357692c94SEric Anholt struct sg_table *sgt);
36457692c94SEric Anholt
36557692c94SEric Anholt /* v3d_debugfs.c */
3667ce84471SWambui Karuga void v3d_debugfs_init(struct drm_minor *minor);
36757692c94SEric Anholt
36857692c94SEric Anholt /* v3d_fence.c */
36957692c94SEric Anholt extern const struct dma_fence_ops v3d_fence_ops;
37057692c94SEric Anholt struct dma_fence *v3d_fence_create(struct v3d_dev *v3d, enum v3d_queue queue);
37157692c94SEric Anholt
37257692c94SEric Anholt /* v3d_gem.c */
37357692c94SEric Anholt int v3d_gem_init(struct drm_device *dev);
37457692c94SEric Anholt void v3d_gem_destroy(struct drm_device *dev);
37557692c94SEric Anholt int v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
37657692c94SEric Anholt struct drm_file *file_priv);
3771584f16cSEric Anholt int v3d_submit_tfu_ioctl(struct drm_device *dev, void *data,
3781584f16cSEric Anholt struct drm_file *file_priv);
379d223f98fSEric Anholt int v3d_submit_csd_ioctl(struct drm_device *dev, void *data,
380d223f98fSEric Anholt struct drm_file *file_priv);
38157692c94SEric Anholt int v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
38257692c94SEric Anholt struct drm_file *file_priv);
383916044faSDaniel Vetter void v3d_job_cleanup(struct v3d_job *job);
384a783a09eSEric Anholt void v3d_job_put(struct v3d_job *job);
38557692c94SEric Anholt void v3d_reset(struct v3d_dev *v3d);
38657692c94SEric Anholt void v3d_invalidate_caches(struct v3d_dev *v3d);
387d223f98fSEric Anholt void v3d_clean_caches(struct v3d_dev *v3d);
38857692c94SEric Anholt
38957692c94SEric Anholt /* v3d_irq.c */
390fc227715SEric Anholt int v3d_irq_init(struct v3d_dev *v3d);
39157692c94SEric Anholt void v3d_irq_enable(struct v3d_dev *v3d);
39257692c94SEric Anholt void v3d_irq_disable(struct v3d_dev *v3d);
39357692c94SEric Anholt void v3d_irq_reset(struct v3d_dev *v3d);
39457692c94SEric Anholt
39557692c94SEric Anholt /* v3d_mmu.c */
39657692c94SEric Anholt int v3d_mmu_get_offset(struct drm_file *file_priv, struct v3d_bo *bo,
39757692c94SEric Anholt u32 *offset);
39857692c94SEric Anholt int v3d_mmu_set_page_table(struct v3d_dev *v3d);
39957692c94SEric Anholt void v3d_mmu_insert_ptes(struct v3d_bo *bo);
40057692c94SEric Anholt void v3d_mmu_remove_ptes(struct v3d_bo *bo);
40157692c94SEric Anholt
40257692c94SEric Anholt /* v3d_sched.c */
40357692c94SEric Anholt int v3d_sched_init(struct v3d_dev *v3d);
40457692c94SEric Anholt void v3d_sched_fini(struct v3d_dev *v3d);
40526a4dc29SJuan A. Suarez Romero
40626a4dc29SJuan A. Suarez Romero /* v3d_perfmon.c */
40726a4dc29SJuan A. Suarez Romero void v3d_perfmon_get(struct v3d_perfmon *perfmon);
40826a4dc29SJuan A. Suarez Romero void v3d_perfmon_put(struct v3d_perfmon *perfmon);
40926a4dc29SJuan A. Suarez Romero void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon);
41026a4dc29SJuan A. Suarez Romero void v3d_perfmon_stop(struct v3d_dev *v3d, struct v3d_perfmon *perfmon,
41126a4dc29SJuan A. Suarez Romero bool capture);
41226a4dc29SJuan A. Suarez Romero struct v3d_perfmon *v3d_perfmon_find(struct v3d_file_priv *v3d_priv, int id);
41326a4dc29SJuan A. Suarez Romero void v3d_perfmon_open_file(struct v3d_file_priv *v3d_priv);
41426a4dc29SJuan A. Suarez Romero void v3d_perfmon_close_file(struct v3d_file_priv *v3d_priv);
41526a4dc29SJuan A. Suarez Romero int v3d_perfmon_create_ioctl(struct drm_device *dev, void *data,
41626a4dc29SJuan A. Suarez Romero struct drm_file *file_priv);
41726a4dc29SJuan A. Suarez Romero int v3d_perfmon_destroy_ioctl(struct drm_device *dev, void *data,
41826a4dc29SJuan A. Suarez Romero struct drm_file *file_priv);
41926a4dc29SJuan A. Suarez Romero int v3d_perfmon_get_values_ioctl(struct drm_device *dev, void *data,
42026a4dc29SJuan A. Suarez Romero struct drm_file *file_priv);
421