diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 18 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c | 5 |
6 files changed, 54 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index 30bb6efe..025b000e 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/gk20a.h> | 18 | #include <linux/gk20a.h> |
19 | #include <linux/version.h> | ||
19 | 20 | ||
20 | #include "channel_sync_gk20a.h" | 21 | #include "channel_sync_gk20a.h" |
21 | #include "gk20a.h" | 22 | #include "gk20a.h" |
@@ -93,10 +94,12 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, | |||
93 | int i; | 94 | int i; |
94 | int num_wait_cmds; | 95 | int num_wait_cmds; |
95 | struct sync_fence *sync_fence; | 96 | struct sync_fence *sync_fence; |
97 | struct sync_pt *pt; | ||
96 | struct priv_cmd_entry *wait_cmd = NULL; | 98 | struct priv_cmd_entry *wait_cmd = NULL; |
97 | struct gk20a_channel_syncpt *sp = | 99 | struct gk20a_channel_syncpt *sp = |
98 | container_of(s, struct gk20a_channel_syncpt, ops); | 100 | container_of(s, struct gk20a_channel_syncpt, ops); |
99 | struct channel_gk20a *c = sp->c; | 101 | struct channel_gk20a *c = sp->c; |
102 | u32 wait_id; | ||
100 | int err = 0; | 103 | int err = 0; |
101 | 104 | ||
102 | sync_fence = nvhost_sync_fdget(fd); | 105 | sync_fence = nvhost_sync_fdget(fd); |
@@ -104,9 +107,13 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, | |||
104 | return -EINVAL; | 107 | return -EINVAL; |
105 | 108 | ||
106 | /* validate syncpt ids */ | 109 | /* validate syncpt ids */ |
110 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
111 | list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) { | ||
112 | #else | ||
107 | for (i = 0; i < sync_fence->num_fences; i++) { | 113 | for (i = 0; i < sync_fence->num_fences; i++) { |
108 | struct sync_pt *pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); | 114 | pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); |
109 | u32 wait_id = nvhost_sync_pt_id(pt); | 115 | #endif |
116 | wait_id = nvhost_sync_pt_id(pt); | ||
110 | if (!wait_id || !nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, | 117 | if (!wait_id || !nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, |
111 | wait_id)) { | 118 | wait_id)) { |
112 | sync_fence_put(sync_fence); | 119 | sync_fence_put(sync_fence); |
@@ -129,9 +136,13 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, | |||
129 | } | 136 | } |
130 | 137 | ||
131 | i = 0; | 138 | i = 0; |
139 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
140 | list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) { | ||
141 | #else | ||
132 | for (i = 0; i < sync_fence->num_fences; i++) { | 142 | for (i = 0; i < sync_fence->num_fences; i++) { |
133 | struct fence *f = sync_fence->cbs[i].sync_pt; | 143 | struct fence *f = sync_fence->cbs[i].sync_pt; |
134 | struct sync_pt *pt = sync_pt_from_fence(f); | 144 | struct sync_pt *pt = sync_pt_from_fence(f); |
145 | #endif | ||
135 | u32 wait_id = nvhost_sync_pt_id(pt); | 146 | u32 wait_id = nvhost_sync_pt_id(pt); |
136 | u32 wait_value = nvhost_sync_pt_thresh(pt); | 147 | u32 wait_value = nvhost_sync_pt_thresh(pt); |
137 | 148 | ||
@@ -144,6 +155,9 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, | |||
144 | } else | 155 | } else |
145 | add_wait_cmd(&wait_cmd->ptr[i * 4], wait_id, | 156 | add_wait_cmd(&wait_cmd->ptr[i * 4], wait_id, |
146 | wait_value); | 157 | wait_value); |
158 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
159 | i++; | ||
160 | #endif | ||
147 | } | 161 | } |
148 | WARN_ON(i != num_wait_cmds); | 162 | WARN_ON(i != num_wait_cmds); |
149 | sync_fence_put(sync_fence); | 163 | sync_fence_put(sync_fence); |
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index f41ca767..1bda5902 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/gk20a.h> | 16 | #include <linux/gk20a.h> |
17 | #include <linux/file.h> | 17 | #include <linux/file.h> |
18 | #include <linux/version.h> | ||
18 | 19 | ||
19 | #include "gk20a.h" | 20 | #include "gk20a.h" |
20 | #include "semaphore_gk20a.h" | 21 | #include "semaphore_gk20a.h" |
@@ -153,10 +154,17 @@ struct gk20a_fence *gk20a_fence_from_semaphore( | |||
153 | struct sync_fence *sync_fence = NULL; | 154 | struct sync_fence *sync_fence = NULL; |
154 | 155 | ||
155 | #ifdef CONFIG_SYNC | 156 | #ifdef CONFIG_SYNC |
157 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
158 | sync_fence = gk20a_sync_fence_create(timeline, semaphore, | ||
159 | dependency, "f-gk20a-0x%04llx", | ||
160 | ((uintptr_t)(void *)semaphore->value) & | ||
161 | 0xffff); | ||
162 | #else | ||
156 | sync_fence = gk20a_sync_fence_create(timeline, semaphore, | 163 | sync_fence = gk20a_sync_fence_create(timeline, semaphore, |
157 | dependency, "f-gk20a-0x%04llx", | 164 | dependency, "f-gk20a-0x%04llx", |
158 | ((u64)(void *)semaphore->value) & | 165 | ((u64)(void *)semaphore->value) & |
159 | 0xffff); | 166 | 0xffff); |
167 | #endif | ||
160 | if (!sync_fence) | 168 | if (!sync_fence) |
161 | return NULL; | 169 | return NULL; |
162 | #endif | 170 | #endif |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 7fa17988..c27b6865 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/reset.h> | 43 | #include <linux/reset.h> |
44 | 44 | ||
45 | #include <linux/sched.h> | 45 | #include <linux/sched.h> |
46 | #include <linux/version.h> | ||
46 | 47 | ||
47 | #include "gk20a.h" | 48 | #include "gk20a.h" |
48 | #include "debug_gk20a.h" | 49 | #include "debug_gk20a.h" |
@@ -1667,7 +1668,9 @@ static struct platform_driver gk20a_driver = { | |||
1667 | .driver = { | 1668 | .driver = { |
1668 | .owner = THIS_MODULE, | 1669 | .owner = THIS_MODULE, |
1669 | .name = "gk20a", | 1670 | .name = "gk20a", |
1671 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) | ||
1670 | .probe_type = PROBE_PREFER_ASYNCHRONOUS, | 1672 | .probe_type = PROBE_PREFER_ASYNCHRONOUS, |
1673 | #endif | ||
1671 | #ifdef CONFIG_OF | 1674 | #ifdef CONFIG_OF |
1672 | .of_match_table = tegra_gk20a_of_match, | 1675 | .of_match_table = tegra_gk20a_of_match, |
1673 | #endif | 1676 | #endif |
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index f69e12df..c7c34417 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | |||
@@ -770,6 +770,9 @@ static int gk20a_tegra_probe(struct device *dev) | |||
770 | } | 770 | } |
771 | } | 771 | } |
772 | 772 | ||
773 | if (tegra_get_chipid() == TEGRA_CHIPID_TEGRA13) | ||
774 | platform->soc_name = "tegra13x"; | ||
775 | |||
773 | gk20a_tegra_get_clocks(dev); | 776 | gk20a_tegra_get_clocks(dev); |
774 | 777 | ||
775 | return 0; | 778 | return 0; |
diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c index 87d905dd..21622d3d 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include "sync_gk20a.h" | 16 | #include "sync_gk20a.h" |
17 | 17 | ||
18 | #include <linux/version.h> | ||
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/file.h> | 20 | #include <linux/file.h> |
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
@@ -149,7 +150,11 @@ static struct gk20a_sync_pt *gk20a_sync_pt_create_shared( | |||
149 | 150 | ||
150 | /* Store the dependency fence for this pt. */ | 151 | /* Store the dependency fence for this pt. */ |
151 | if (dependency) { | 152 | if (dependency) { |
153 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
154 | if (dependency->status == 0) { | ||
155 | #else | ||
152 | if (!atomic_read(&dependency->status)) { | 156 | if (!atomic_read(&dependency->status)) { |
157 | #endif | ||
153 | shared->dep = dependency; | 158 | shared->dep = dependency; |
154 | } else { | 159 | } else { |
155 | shared->dep_timestamp = ktime_get(); | 160 | shared->dep_timestamp = ktime_get(); |
@@ -214,6 +219,9 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
214 | { | 219 | { |
215 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); | 220 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); |
216 | struct gk20a_sync_timeline *obj = pt->obj; | 221 | struct gk20a_sync_timeline *obj = pt->obj; |
222 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
223 | struct sync_pt *pos; | ||
224 | #endif | ||
217 | bool signaled = true; | 225 | bool signaled = true; |
218 | 226 | ||
219 | spin_lock(&pt->lock); | 227 | spin_lock(&pt->lock); |
@@ -233,6 +241,12 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
233 | * first.*/ | 241 | * first.*/ |
234 | if (pt->dep) { | 242 | if (pt->dep) { |
235 | s64 ns = 0; | 243 | s64 ns = 0; |
244 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
245 | struct list_head *dep_pts = &pt->dep->pt_list_head; | ||
246 | list_for_each_entry(pos, dep_pts, pt_list) { | ||
247 | ns = max(ns, ktime_to_ns(pos->timestamp)); | ||
248 | } | ||
249 | #else | ||
236 | struct fence *fence; | 250 | struct fence *fence; |
237 | int i; | 251 | int i; |
238 | 252 | ||
@@ -240,6 +254,7 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
240 | fence = pt->dep->cbs[i].sync_pt; | 254 | fence = pt->dep->cbs[i].sync_pt; |
241 | ns = max(ns, ktime_to_ns(fence->timestamp)); | 255 | ns = max(ns, ktime_to_ns(fence->timestamp)); |
242 | } | 256 | } |
257 | #endif | ||
243 | pt->dep_timestamp = ns_to_ktime(ns); | 258 | pt->dep_timestamp = ns_to_ktime(ns); |
244 | sync_fence_put(pt->dep); | 259 | sync_fence_put(pt->dep); |
245 | pt->dep = NULL; | 260 | pt->dep = NULL; |
@@ -260,7 +275,11 @@ static inline ktime_t gk20a_sync_pt_duration(struct sync_pt *sync_pt) | |||
260 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); | 275 | struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt); |
261 | if (!gk20a_sync_pt_has_signaled(sync_pt) || !pt->dep_timestamp.tv64) | 276 | if (!gk20a_sync_pt_has_signaled(sync_pt) || !pt->dep_timestamp.tv64) |
262 | return ns_to_ktime(0); | 277 | return ns_to_ktime(0); |
278 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
279 | return ktime_sub(sync_pt->timestamp, pt->dep_timestamp); | ||
280 | #else | ||
263 | return ktime_sub(sync_pt->base.timestamp, pt->dep_timestamp); | 281 | return ktime_sub(sync_pt->base.timestamp, pt->dep_timestamp); |
282 | #endif | ||
264 | } | 283 | } |
265 | 284 | ||
266 | static int gk20a_sync_pt_compare(struct sync_pt *a, struct sync_pt *b) | 285 | static int gk20a_sync_pt_compare(struct sync_pt *a, struct sync_pt *b) |
diff --git a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c index d19e5712..02e0baad 100644 --- a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/tegra-ivc.h> | 15 | #include <linux/tegra-ivc.h> |
16 | #include <linux/tegra_vgpu.h> | 16 | #include <linux/tegra_vgpu.h> |
17 | #include <linux/version.h> | ||
17 | 18 | ||
18 | #include "gk20a/gk20a.h" | 19 | #include "gk20a/gk20a.h" |
19 | #include "gk20a/ctxsw_trace_gk20a.h" | 20 | #include "gk20a/ctxsw_trace_gk20a.h" |
@@ -61,7 +62,11 @@ static int vgpu_fecs_trace_init(struct gk20a *g) | |||
61 | goto fail; | 62 | goto fail; |
62 | } | 63 | } |
63 | 64 | ||
65 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) | ||
66 | vcst->buf = ioremap_cached(vcst->cookie->ipa, vcst->cookie->size); | ||
67 | #else | ||
64 | vcst->buf = ioremap_cache(vcst->cookie->ipa, vcst->cookie->size); | 68 | vcst->buf = ioremap_cache(vcst->cookie->ipa, vcst->cookie->size); |
69 | #endif | ||
65 | if (!vcst->buf) { | 70 | if (!vcst->buf) { |
66 | dev_info(dev_from_gk20a(g), "ioremap_cache failed\n"); | 71 | dev_info(dev_from_gk20a(g), "ioremap_cache failed\n"); |
67 | err = -EINVAL; | 72 | err = -EINVAL; |