summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c69
1 files changed, 36 insertions, 33 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 58175141..61211239 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -74,7 +74,9 @@ static void gk20a_channel_clean_up_jobs(struct work_struct *work);
74static struct channel_gk20a *allocate_channel(struct fifo_gk20a *f) 74static struct channel_gk20a *allocate_channel(struct fifo_gk20a *f)
75{ 75{
76 struct channel_gk20a *ch = NULL; 76 struct channel_gk20a *ch = NULL;
77 struct gk20a_platform *platform = gk20a_get_platform(f->g->dev); 77 struct gk20a_platform *platform;
78
79 platform = gk20a_get_platform(f->g->dev);
78 80
79 mutex_lock(&f->free_chs_mutex); 81 mutex_lock(&f->free_chs_mutex);
80 if (!list_empty(&f->free_chs)) { 82 if (!list_empty(&f->free_chs)) {
@@ -156,7 +158,7 @@ int gk20a_channel_get_timescale_from_timeslice(struct gk20a *g,
156 int timeslice_period, 158 int timeslice_period,
157 int *__timeslice_timeout, int *__timeslice_scale) 159 int *__timeslice_timeout, int *__timeslice_scale)
158{ 160{
159 struct gk20a_platform *platform = platform_get_drvdata(g->dev); 161 struct gk20a_platform *platform = dev_get_drvdata(g->dev);
160 int value = scale_ptimer(timeslice_period, 162 int value = scale_ptimer(timeslice_period,
161 ptimer_scalingfactor10x(platform->ptimer_src_freq)); 163 ptimer_scalingfactor10x(platform->ptimer_src_freq));
162 int shift = 0; 164 int shift = 0;
@@ -1068,7 +1070,7 @@ int gk20a_channel_release(struct inode *inode, struct file *filp)
1068 if (!ch) 1070 if (!ch)
1069 return 0; 1071 return 0;
1070 1072
1071 trace_gk20a_channel_release(dev_name(&g->dev->dev)); 1073 trace_gk20a_channel_release(dev_name(g->dev));
1072 1074
1073 err = gk20a_busy(g->dev); 1075 err = gk20a_busy(g->dev);
1074 if (err) { 1076 if (err) {
@@ -1189,7 +1191,9 @@ static int __gk20a_channel_open(struct gk20a *g, struct file *filp)
1189 int err; 1191 int err;
1190 struct channel_gk20a *ch; 1192 struct channel_gk20a *ch;
1191 1193
1192 trace_gk20a_channel_open(dev_name(&g->dev->dev)); 1194 gk20a_dbg_fn("");
1195
1196 trace_gk20a_channel_open(dev_name(g->dev));
1193 1197
1194 err = gk20a_busy(g->dev); 1198 err = gk20a_busy(g->dev);
1195 if (err) { 1199 if (err) {
@@ -1235,7 +1239,7 @@ int gk20a_channel_open_ioctl(struct gk20a *g,
1235 fd = err; 1239 fd = err;
1236 1240
1237 name = kasprintf(GFP_KERNEL, "nvhost-%s-fd%d", 1241 name = kasprintf(GFP_KERNEL, "nvhost-%s-fd%d",
1238 dev_name(&g->dev->dev), fd); 1242 dev_name(g->dev), fd);
1239 if (!name) { 1243 if (!name) {
1240 err = -ENOMEM; 1244 err = -ENOMEM;
1241 goto clean_up; 1245 goto clean_up;
@@ -1562,7 +1566,7 @@ static void trace_write_pushbuffer(struct channel_gk20a *c,
1562 */ 1566 */
1563 for (i = 0; i < words; i += 128U) { 1567 for (i = 0; i < words; i += 128U) {
1564 trace_gk20a_push_cmdbuf( 1568 trace_gk20a_push_cmdbuf(
1565 c->g->dev->name, 1569 dev_name(c->g->dev),
1566 0, 1570 0,
1567 min(words - i, 128U), 1571 min(words - i, 128U),
1568 offset + i * sizeof(u32), 1572 offset + i * sizeof(u32),
@@ -2051,7 +2055,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
2051 return err; 2055 return err;
2052 } 2056 }
2053 2057
2054 trace_gk20a_channel_submit_gpfifo(c->g->dev->name, 2058 trace_gk20a_channel_submit_gpfifo(dev_name(c->g->dev),
2055 c->hw_chid, 2059 c->hw_chid,
2056 num_entries, 2060 num_entries,
2057 flags, 2061 flags,
@@ -2069,11 +2073,11 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
2069 if (locked_path) 2073 if (locked_path)
2070 mutex_unlock(&c->ioctl_lock); 2074 mutex_unlock(&c->ioctl_lock);
2071 2075
2072 trace_gk20a_gpfifo_submit_wait_for_space(c->g->dev->name); 2076 trace_gk20a_gpfifo_submit_wait_for_space(dev_name(c->g->dev));
2073 err = wait_event_interruptible(c->submit_wq, 2077 err = wait_event_interruptible(c->submit_wq,
2074 get_gp_free_count(c) >= num_entries + extra_entries || 2078 get_gp_free_count(c) >= num_entries + extra_entries ||
2075 c->has_timedout); 2079 c->has_timedout);
2076 trace_gk20a_gpfifo_submit_wait_for_space_done(c->g->dev->name); 2080 trace_gk20a_gpfifo_submit_wait_for_space_done(dev_name(c->g->dev));
2077 2081
2078 if (locked_path) 2082 if (locked_path)
2079 mutex_lock(&c->ioctl_lock); 2083 mutex_lock(&c->ioctl_lock);
@@ -2156,7 +2160,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
2156 gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(wait_cmd->gva); 2160 gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(wait_cmd->gva);
2157 gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(wait_cmd->gva) | 2161 gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(wait_cmd->gva) |
2158 pbdma_gp_entry1_length_f(wait_cmd->size); 2162 pbdma_gp_entry1_length_f(wait_cmd->size);
2159 trace_gk20a_push_cmdbuf(c->g->dev->name, 2163 trace_gk20a_push_cmdbuf(dev_name(c->g->dev),
2160 0, wait_cmd->size, 0, wait_cmd->ptr); 2164 0, wait_cmd->size, 0, wait_cmd->ptr);
2161 2165
2162 c->gpfifo.put = (c->gpfifo.put + 1) & 2166 c->gpfifo.put = (c->gpfifo.put + 1) &
@@ -2244,7 +2248,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
2244 gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(incr_cmd->gva); 2248 gpfifo_mem[c->gpfifo.put].entry0 = u64_lo32(incr_cmd->gva);
2245 gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(incr_cmd->gva) | 2249 gpfifo_mem[c->gpfifo.put].entry1 = u64_hi32(incr_cmd->gva) |
2246 pbdma_gp_entry1_length_f(incr_cmd->size); 2250 pbdma_gp_entry1_length_f(incr_cmd->size);
2247 trace_gk20a_push_cmdbuf(c->g->dev->name, 2251 trace_gk20a_push_cmdbuf(dev_name(c->g->dev),
2248 0, incr_cmd->size, 0, incr_cmd->ptr); 2252 0, incr_cmd->size, 0, incr_cmd->ptr);
2249 2253
2250 c->gpfifo.put = (c->gpfifo.put + 1) & 2254 c->gpfifo.put = (c->gpfifo.put + 1) &
@@ -2273,7 +2277,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
2273 2277
2274 mutex_unlock(&c->submit_lock); 2278 mutex_unlock(&c->submit_lock);
2275 2279
2276 trace_gk20a_channel_submitted_gpfifo(c->g->dev->name, 2280 trace_gk20a_channel_submitted_gpfifo(dev_name(c->g->dev),
2277 c->hw_chid, 2281 c->hw_chid,
2278 num_entries, 2282 num_entries,
2279 flags, 2283 flags,
@@ -2357,7 +2361,7 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
2357 ulong id, u32 offset, 2361 ulong id, u32 offset,
2358 u32 payload, long timeout) 2362 u32 payload, long timeout)
2359{ 2363{
2360 struct platform_device *pdev = ch->g->dev; 2364 struct device *dev = ch->g->dev;
2361 struct dma_buf *dmabuf; 2365 struct dma_buf *dmabuf;
2362 void *data; 2366 void *data;
2363 u32 *semaphore; 2367 u32 *semaphore;
@@ -2370,14 +2374,13 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
2370 2374
2371 dmabuf = dma_buf_get(id); 2375 dmabuf = dma_buf_get(id);
2372 if (IS_ERR(dmabuf)) { 2376 if (IS_ERR(dmabuf)) {
2373 gk20a_err(&pdev->dev, "invalid notifier nvmap handle 0x%lx", 2377 gk20a_err(dev, "invalid notifier nvmap handle 0x%lx", id);
2374 id);
2375 return -EINVAL; 2378 return -EINVAL;
2376 } 2379 }
2377 2380
2378 data = dma_buf_kmap(dmabuf, offset >> PAGE_SHIFT); 2381 data = dma_buf_kmap(dmabuf, offset >> PAGE_SHIFT);
2379 if (!data) { 2382 if (!data) {
2380 gk20a_err(&pdev->dev, "failed to map notifier memory"); 2383 gk20a_err(dev, "failed to map notifier memory");
2381 ret = -EINVAL; 2384 ret = -EINVAL;
2382 goto cleanup_put; 2385 goto cleanup_put;
2383 } 2386 }
@@ -2917,7 +2920,7 @@ long gk20a_channel_ioctl(struct file *filp,
2917 unsigned int cmd, unsigned long arg) 2920 unsigned int cmd, unsigned long arg)
2918{ 2921{
2919 struct channel_gk20a *ch = filp->private_data; 2922 struct channel_gk20a *ch = filp->private_data;
2920 struct platform_device *dev = ch->g->dev; 2923 struct device *dev = ch->g->dev;
2921 u8 buf[NVGPU_IOCTL_CHANNEL_MAX_ARG_SIZE]; 2924 u8 buf[NVGPU_IOCTL_CHANNEL_MAX_ARG_SIZE];
2922 int err = 0; 2925 int err = 0;
2923 2926
@@ -2956,7 +2959,7 @@ long gk20a_channel_ioctl(struct file *filp,
2956 case NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX: 2959 case NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX:
2957 err = gk20a_busy(dev); 2960 err = gk20a_busy(dev);
2958 if (err) { 2961 if (err) {
2959 dev_err(&dev->dev, 2962 dev_err(dev,
2960 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2963 "%s: failed to host gk20a for ioctl cmd: 0x%x",
2961 __func__, cmd); 2964 __func__, cmd);
2962 break; 2965 break;
@@ -2968,7 +2971,7 @@ long gk20a_channel_ioctl(struct file *filp,
2968 case NVGPU_IOCTL_CHANNEL_FREE_OBJ_CTX: 2971 case NVGPU_IOCTL_CHANNEL_FREE_OBJ_CTX:
2969 err = gk20a_busy(dev); 2972 err = gk20a_busy(dev);
2970 if (err) { 2973 if (err) {
2971 dev_err(&dev->dev, 2974 dev_err(dev,
2972 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2975 "%s: failed to host gk20a for ioctl cmd: 0x%x",
2973 __func__, cmd); 2976 __func__, cmd);
2974 break; 2977 break;
@@ -2980,7 +2983,7 @@ long gk20a_channel_ioctl(struct file *filp,
2980 case NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO: 2983 case NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO:
2981 err = gk20a_busy(dev); 2984 err = gk20a_busy(dev);
2982 if (err) { 2985 if (err) {
2983 dev_err(&dev->dev, 2986 dev_err(dev,
2984 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2987 "%s: failed to host gk20a for ioctl cmd: 0x%x",
2985 __func__, cmd); 2988 __func__, cmd);
2986 break; 2989 break;
@@ -2996,7 +2999,7 @@ long gk20a_channel_ioctl(struct file *filp,
2996 case NVGPU_IOCTL_CHANNEL_WAIT: 2999 case NVGPU_IOCTL_CHANNEL_WAIT:
2997 err = gk20a_busy(dev); 3000 err = gk20a_busy(dev);
2998 if (err) { 3001 if (err) {
2999 dev_err(&dev->dev, 3002 dev_err(dev,
3000 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3003 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3001 __func__, cmd); 3004 __func__, cmd);
3002 break; 3005 break;
@@ -3016,7 +3019,7 @@ long gk20a_channel_ioctl(struct file *filp,
3016 case NVGPU_IOCTL_CHANNEL_ZCULL_BIND: 3019 case NVGPU_IOCTL_CHANNEL_ZCULL_BIND:
3017 err = gk20a_busy(dev); 3020 err = gk20a_busy(dev);
3018 if (err) { 3021 if (err) {
3019 dev_err(&dev->dev, 3022 dev_err(dev,
3020 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3023 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3021 __func__, cmd); 3024 __func__, cmd);
3022 break; 3025 break;
@@ -3028,7 +3031,7 @@ long gk20a_channel_ioctl(struct file *filp,
3028 case NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER: 3031 case NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER:
3029 err = gk20a_busy(dev); 3032 err = gk20a_busy(dev);
3030 if (err) { 3033 if (err) {
3031 dev_err(&dev->dev, 3034 dev_err(dev,
3032 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3035 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3033 __func__, cmd); 3036 __func__, cmd);
3034 break; 3037 break;
@@ -3041,7 +3044,7 @@ long gk20a_channel_ioctl(struct file *filp,
3041 case NVGPU_IOCTL_CHANNEL_CYCLE_STATS: 3044 case NVGPU_IOCTL_CHANNEL_CYCLE_STATS:
3042 err = gk20a_busy(dev); 3045 err = gk20a_busy(dev);
3043 if (err) { 3046 if (err) {
3044 dev_err(&dev->dev, 3047 dev_err(dev,
3045 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3048 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3046 __func__, cmd); 3049 __func__, cmd);
3047 break; 3050 break;
@@ -3080,7 +3083,7 @@ long gk20a_channel_ioctl(struct file *filp,
3080 case NVGPU_IOCTL_CHANNEL_SET_PRIORITY: 3083 case NVGPU_IOCTL_CHANNEL_SET_PRIORITY:
3081 err = gk20a_busy(dev); 3084 err = gk20a_busy(dev);
3082 if (err) { 3085 if (err) {
3083 dev_err(&dev->dev, 3086 dev_err(dev,
3084 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3087 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3085 __func__, cmd); 3088 __func__, cmd);
3086 break; 3089 break;
@@ -3092,7 +3095,7 @@ long gk20a_channel_ioctl(struct file *filp,
3092 case NVGPU_IOCTL_CHANNEL_ENABLE: 3095 case NVGPU_IOCTL_CHANNEL_ENABLE:
3093 err = gk20a_busy(dev); 3096 err = gk20a_busy(dev);
3094 if (err) { 3097 if (err) {
3095 dev_err(&dev->dev, 3098 dev_err(dev,
3096 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3099 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3097 __func__, cmd); 3100 __func__, cmd);
3098 break; 3101 break;
@@ -3106,7 +3109,7 @@ long gk20a_channel_ioctl(struct file *filp,
3106 case NVGPU_IOCTL_CHANNEL_DISABLE: 3109 case NVGPU_IOCTL_CHANNEL_DISABLE:
3107 err = gk20a_busy(dev); 3110 err = gk20a_busy(dev);
3108 if (err) { 3111 if (err) {
3109 dev_err(&dev->dev, 3112 dev_err(dev,
3110 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3113 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3111 __func__, cmd); 3114 __func__, cmd);
3112 break; 3115 break;
@@ -3120,7 +3123,7 @@ long gk20a_channel_ioctl(struct file *filp,
3120 case NVGPU_IOCTL_CHANNEL_PREEMPT: 3123 case NVGPU_IOCTL_CHANNEL_PREEMPT:
3121 err = gk20a_busy(dev); 3124 err = gk20a_busy(dev);
3122 if (err) { 3125 if (err) {
3123 dev_err(&dev->dev, 3126 dev_err(dev,
3124 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3127 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3125 __func__, cmd); 3128 __func__, cmd);
3126 break; 3129 break;
@@ -3131,7 +3134,7 @@ long gk20a_channel_ioctl(struct file *filp,
3131 case NVGPU_IOCTL_CHANNEL_FORCE_RESET: 3134 case NVGPU_IOCTL_CHANNEL_FORCE_RESET:
3132 err = gk20a_busy(dev); 3135 err = gk20a_busy(dev);
3133 if (err) { 3136 if (err) {
3134 dev_err(&dev->dev, 3137 dev_err(dev,
3135 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3138 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3136 __func__, cmd); 3139 __func__, cmd);
3137 break; 3140 break;
@@ -3147,7 +3150,7 @@ long gk20a_channel_ioctl(struct file *filp,
3147 case NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT: 3150 case NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT:
3148 err = gk20a_busy(dev); 3151 err = gk20a_busy(dev);
3149 if (err) { 3152 if (err) {
3150 dev_err(&dev->dev, 3153 dev_err(dev,
3151 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3154 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3152 __func__, cmd); 3155 __func__, cmd);
3153 break; 3156 break;
@@ -3164,7 +3167,7 @@ long gk20a_channel_ioctl(struct file *filp,
3164 case NVGPU_IOCTL_CHANNEL_SET_RUNLIST_INTERLEAVE: 3167 case NVGPU_IOCTL_CHANNEL_SET_RUNLIST_INTERLEAVE:
3165 err = gk20a_busy(dev); 3168 err = gk20a_busy(dev);
3166 if (err) { 3169 if (err) {
3167 dev_err(&dev->dev, 3170 dev_err(dev,
3168 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3171 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3169 __func__, cmd); 3172 __func__, cmd);
3170 break; 3173 break;
@@ -3176,7 +3179,7 @@ long gk20a_channel_ioctl(struct file *filp,
3176 case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE: 3179 case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE:
3177 err = gk20a_busy(dev); 3180 err = gk20a_busy(dev);
3178 if (err) { 3181 if (err) {
3179 dev_err(&dev->dev, 3182 dev_err(dev,
3180 "%s: failed to host gk20a for ioctl cmd: 0x%x", 3183 "%s: failed to host gk20a for ioctl cmd: 0x%x",
3181 __func__, cmd); 3184 __func__, cmd);
3182 break; 3185 break;
@@ -3186,7 +3189,7 @@ long gk20a_channel_ioctl(struct file *filp,
3186 gk20a_idle(dev); 3189 gk20a_idle(dev);
3187 break; 3190 break;
3188 default: 3191 default:
3189 dev_dbg(&dev->dev, "unrecognized ioctl cmd: 0x%x", cmd); 3192 dev_dbg(dev, "unrecognized ioctl cmd: 0x%x", cmd);
3190 err = -ENOTTY; 3193 err = -ENOTTY;
3191 break; 3194 break;
3192 } 3195 }