.. | .. |
---|
6 | 6 | #ifndef __ETNAVIV_DRV_H__ |
---|
7 | 7 | #define __ETNAVIV_DRV_H__ |
---|
8 | 8 | |
---|
9 | | -#include <linux/kernel.h> |
---|
10 | | -#include <linux/clk.h> |
---|
11 | | -#include <linux/cpufreq.h> |
---|
12 | | -#include <linux/module.h> |
---|
13 | | -#include <linux/platform_device.h> |
---|
14 | | -#include <linux/pm.h> |
---|
15 | | -#include <linux/pm_runtime.h> |
---|
16 | | -#include <linux/slab.h> |
---|
17 | 9 | #include <linux/list.h> |
---|
| 10 | +#include <linux/mm_types.h> |
---|
| 11 | +#include <linux/sizes.h> |
---|
18 | 12 | #include <linux/time64.h> |
---|
19 | 13 | #include <linux/types.h> |
---|
20 | | -#include <linux/sizes.h> |
---|
21 | | -#include <linux/mm_types.h> |
---|
22 | 14 | |
---|
23 | | -#include <drm/drmP.h> |
---|
24 | | -#include <drm/drm_crtc_helper.h> |
---|
25 | 15 | #include <drm/drm_fb_helper.h> |
---|
26 | 16 | #include <drm/drm_gem.h> |
---|
27 | 17 | #include <drm/etnaviv_drm.h> |
---|
.. | .. |
---|
32 | 22 | struct etnaviv_mmu; |
---|
33 | 23 | struct etnaviv_gem_object; |
---|
34 | 24 | struct etnaviv_gem_submit; |
---|
| 25 | +struct etnaviv_iommu_global; |
---|
| 26 | + |
---|
| 27 | +#define ETNAVIV_SOFTPIN_START_ADDRESS SZ_4M /* must be >= SUBALLOC_SIZE */ |
---|
35 | 28 | |
---|
36 | 29 | struct etnaviv_file_private { |
---|
37 | | - /* |
---|
38 | | - * When per-context address spaces are supported we'd keep track of |
---|
39 | | - * the context's page-tables here. |
---|
40 | | - */ |
---|
| 30 | + struct etnaviv_iommu_context *mmu; |
---|
41 | 31 | struct drm_sched_entity sched_entity[ETNA_MAX_PIPES]; |
---|
42 | 32 | }; |
---|
43 | 33 | |
---|
.. | .. |
---|
45 | 35 | int num_gpus; |
---|
46 | 36 | struct device_dma_parameters dma_parms; |
---|
47 | 37 | struct etnaviv_gpu *gpu[ETNA_MAX_PIPES]; |
---|
| 38 | + gfp_t shm_gfp_mask; |
---|
| 39 | + |
---|
| 40 | + struct etnaviv_cmdbuf_suballoc *cmdbuf_suballoc; |
---|
| 41 | + struct etnaviv_iommu_global *mmu_global; |
---|
48 | 42 | |
---|
49 | 43 | /* list of GEM objects: */ |
---|
50 | 44 | struct mutex gem_lock; |
---|
.. | .. |
---|
62 | 56 | void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); |
---|
63 | 57 | int etnaviv_gem_prime_mmap(struct drm_gem_object *obj, |
---|
64 | 58 | struct vm_area_struct *vma); |
---|
65 | | -struct reservation_object *etnaviv_gem_prime_res_obj(struct drm_gem_object *obj); |
---|
66 | 59 | struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, |
---|
67 | 60 | struct dma_buf_attachment *attach, struct sg_table *sg); |
---|
68 | 61 | int etnaviv_gem_prime_pin(struct drm_gem_object *obj); |
---|
69 | 62 | void etnaviv_gem_prime_unpin(struct drm_gem_object *obj); |
---|
70 | 63 | void *etnaviv_gem_vmap(struct drm_gem_object *obj); |
---|
71 | 64 | int etnaviv_gem_cpu_prep(struct drm_gem_object *obj, u32 op, |
---|
72 | | - struct timespec *timeout); |
---|
| 65 | + struct drm_etnaviv_timespec *timeout); |
---|
73 | 66 | int etnaviv_gem_cpu_fini(struct drm_gem_object *obj); |
---|
74 | 67 | void etnaviv_gem_free_object(struct drm_gem_object *obj); |
---|
75 | 68 | int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file, |
---|
.. | .. |
---|
78 | 71 | uintptr_t ptr, u32 size, u32 flags, u32 *handle); |
---|
79 | 72 | u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu); |
---|
80 | 73 | u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe_addr); |
---|
81 | | -u16 etnaviv_buffer_config_pta(struct etnaviv_gpu *gpu); |
---|
| 74 | +u16 etnaviv_buffer_config_pta(struct etnaviv_gpu *gpu, unsigned short id); |
---|
82 | 75 | void etnaviv_buffer_end(struct etnaviv_gpu *gpu); |
---|
83 | 76 | void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event); |
---|
84 | 77 | void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state, |
---|
| 78 | + struct etnaviv_iommu_context *mmu, |
---|
85 | 79 | unsigned int event, struct etnaviv_cmdbuf *cmdbuf); |
---|
86 | 80 | void etnaviv_validate_init(void); |
---|
87 | 81 | bool etnaviv_cmd_validate_one(struct etnaviv_gpu *gpu, |
---|
.. | .. |
---|
108 | 102 | return base + nelem * elem_size; |
---|
109 | 103 | } |
---|
110 | 104 | |
---|
111 | | -/* returns true if fence a comes after fence b */ |
---|
112 | | -static inline bool fence_after(u32 a, u32 b) |
---|
113 | | -{ |
---|
114 | | - return (s32)(a - b) > 0; |
---|
115 | | -} |
---|
116 | | - |
---|
117 | | -static inline bool fence_after_eq(u32 a, u32 b) |
---|
118 | | -{ |
---|
119 | | - return (s32)(a - b) >= 0; |
---|
120 | | -} |
---|
121 | | - |
---|
122 | 105 | /* |
---|
123 | 106 | * Etnaviv timeouts are specified wrt CLOCK_MONOTONIC, not jiffies. |
---|
124 | 107 | * We need to calculate the timeout in terms of number of jiffies |
---|
125 | 108 | * between the specified timeout and the current CLOCK_MONOTONIC time. |
---|
126 | 109 | */ |
---|
127 | 110 | static inline unsigned long etnaviv_timeout_to_jiffies( |
---|
128 | | - const struct timespec *timeout) |
---|
| 111 | + const struct drm_etnaviv_timespec *timeout) |
---|
129 | 112 | { |
---|
130 | | - struct timespec64 ts, to; |
---|
131 | | - |
---|
132 | | - to = timespec_to_timespec64(*timeout); |
---|
| 113 | + struct timespec64 ts, to = { |
---|
| 114 | + .tv_sec = timeout->tv_sec, |
---|
| 115 | + .tv_nsec = timeout->tv_nsec, |
---|
| 116 | + }; |
---|
133 | 117 | |
---|
134 | 118 | ktime_get_ts64(&ts); |
---|
135 | 119 | |
---|