summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/linux/dmabuf.c35
-rw-r--r--drivers/gpu/nvgpu/common/linux/dmabuf.h5
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c12
-rw-r--r--include/uapi/linux/nvgpu.h4
4 files changed, 3 insertions, 53 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dmabuf.c b/drivers/gpu/nvgpu/common/linux/dmabuf.c
index 08cf5f2b..580dfcae 100644
--- a/drivers/gpu/nvgpu/common/linux/dmabuf.c
+++ b/drivers/gpu/nvgpu/common/linux/dmabuf.c
@@ -1,5 +1,5 @@
1/* 1/*
2* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -140,7 +140,6 @@ int gk20a_dmabuf_alloc_drvdata(struct dma_buf *dmabuf, struct device *dev)
140{ 140{
141 struct gk20a *g = gk20a_get_platform(dev)->g; 141 struct gk20a *g = gk20a_get_platform(dev)->g;
142 struct gk20a_dmabuf_priv *priv; 142 struct gk20a_dmabuf_priv *priv;
143 static u64 priv_count = 0;
144 143
145 priv = dma_buf_get_drvdata(dmabuf, dev); 144 priv = dma_buf_get_drvdata(dmabuf, dev);
146 if (likely(priv)) 145 if (likely(priv))
@@ -159,7 +158,6 @@ int gk20a_dmabuf_alloc_drvdata(struct dma_buf *dmabuf, struct device *dev)
159 158
160 nvgpu_mutex_init(&priv->lock); 159 nvgpu_mutex_init(&priv->lock);
161 nvgpu_init_list_node(&priv->states); 160 nvgpu_init_list_node(&priv->states);
162 priv->buffer_id = ++priv_count;
163 priv->g = g; 161 priv->g = g;
164 dma_buf_set_drvdata(dmabuf, dev, priv, gk20a_mm_delete_priv); 162 dma_buf_set_drvdata(dmabuf, dev, priv, gk20a_mm_delete_priv);
165 163
@@ -214,34 +212,3 @@ out:
214 *state = s; 212 *state = s;
215 return err; 213 return err;
216} 214}
217
218int gk20a_mm_get_buffer_info(struct device *dev, int dmabuf_fd,
219 u64 *buffer_id, u64 *buffer_len)
220{
221 struct dma_buf *dmabuf;
222 struct gk20a_dmabuf_priv *priv;
223 int err = 0;
224
225 dmabuf = dma_buf_get(dmabuf_fd);
226 if (IS_ERR(dmabuf)) {
227 dev_warn(dev, "%s: fd %d is not a dmabuf", __func__, dmabuf_fd);
228 return PTR_ERR(dmabuf);
229 }
230
231 err = gk20a_dmabuf_alloc_drvdata(dmabuf, dev);
232 if (err) {
233 dev_warn(dev, "Failed to allocate dmabuf drvdata (err = %d)",
234 err);
235 goto clean_up;
236 }
237
238 priv = dma_buf_get_drvdata(dmabuf, dev);
239 if (likely(priv)) {
240 *buffer_id = priv->buffer_id;
241 *buffer_len = dmabuf->size;
242 }
243
244clean_up:
245 dma_buf_put(dmabuf);
246 return err;
247}
diff --git a/drivers/gpu/nvgpu/common/linux/dmabuf.h b/drivers/gpu/nvgpu/common/linux/dmabuf.h
index 8e6c139b..d30ff5a5 100644
--- a/drivers/gpu/nvgpu/common/linux/dmabuf.h
+++ b/drivers/gpu/nvgpu/common/linux/dmabuf.h
@@ -1,5 +1,5 @@
1/* 1/*
2* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -57,7 +57,4 @@ int gk20a_dmabuf_alloc_drvdata(struct dma_buf *dmabuf, struct device *dev);
57int gk20a_dmabuf_get_state(struct dma_buf *dmabuf, struct gk20a *g, 57int gk20a_dmabuf_get_state(struct dma_buf *dmabuf, struct gk20a *g,
58 u64 offset, struct gk20a_buffer_state **state); 58 u64 offset, struct gk20a_buffer_state **state);
59 59
60int gk20a_mm_get_buffer_info(struct device *dev, int dmabuf_fd,
61 u64 *buffer_id, u64 *buffer_len);
62
63#endif 60#endif
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index ebbe7dda..b751a337 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -753,13 +753,6 @@ static int gk20a_ctrl_vsm_mapping(struct gk20a *g,
753 return err; 753 return err;
754} 754}
755 755
756static int gk20a_ctrl_get_buffer_info(
757 struct gk20a *g, struct nvgpu_gpu_get_buffer_info_args *args)
758{
759 return gk20a_mm_get_buffer_info(dev_from_gk20a(g), args->in.dmabuf_fd,
760 &args->out.id, &args->out.length);
761}
762
763static int nvgpu_gpu_get_cpu_time_correlation_info( 756static int nvgpu_gpu_get_cpu_time_correlation_info(
764 struct gk20a *g, 757 struct gk20a *g,
765 struct nvgpu_gpu_get_cpu_time_correlation_info_args *args) 758 struct nvgpu_gpu_get_cpu_time_correlation_info_args *args)
@@ -1757,11 +1750,6 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
1757 (struct nvgpu_gpu_vsms_mapping *)buf); 1750 (struct nvgpu_gpu_vsms_mapping *)buf);
1758 break; 1751 break;
1759 1752
1760 case NVGPU_GPU_IOCTL_GET_BUFFER_INFO:
1761 err = gk20a_ctrl_get_buffer_info(g,
1762 (struct nvgpu_gpu_get_buffer_info_args *)buf);
1763 break;
1764
1765 case NVGPU_GPU_IOCTL_GET_CPU_TIME_CORRELATION_INFO: 1753 case NVGPU_GPU_IOCTL_GET_CPU_TIME_CORRELATION_INFO:
1766 err = nvgpu_gpu_get_cpu_time_correlation_info(g, 1754 err = nvgpu_gpu_get_cpu_time_correlation_info(g,
1767 (struct nvgpu_gpu_get_cpu_time_correlation_info_args *)buf); 1755 (struct nvgpu_gpu_get_cpu_time_correlation_info_args *)buf);
diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h
index 391d482d..4ee6a459 100644
--- a/include/uapi/linux/nvgpu.h
+++ b/include/uapi/linux/nvgpu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * NVGPU Public Interface Header 2 * NVGPU Public Interface Header
3 * 3 *
4 * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -892,8 +892,6 @@ struct nvgpu_gpu_set_deterministic_opts_args {
892 _IOWR(NVGPU_GPU_IOCTL_MAGIC, 18, struct nvgpu_gpu_num_vsms) 892 _IOWR(NVGPU_GPU_IOCTL_MAGIC, 18, struct nvgpu_gpu_num_vsms)
893#define NVGPU_GPU_IOCTL_VSMS_MAPPING \ 893#define NVGPU_GPU_IOCTL_VSMS_MAPPING \
894 _IOWR(NVGPU_GPU_IOCTL_MAGIC, 19, struct nvgpu_gpu_vsms_mapping) 894 _IOWR(NVGPU_GPU_IOCTL_MAGIC, 19, struct nvgpu_gpu_vsms_mapping)
895#define NVGPU_GPU_IOCTL_GET_BUFFER_INFO \
896 _IOWR(NVGPU_GPU_IOCTL_MAGIC, 20, struct nvgpu_gpu_get_buffer_info_args)
897#define NVGPU_GPU_IOCTL_RESUME_FROM_PAUSE \ 895#define NVGPU_GPU_IOCTL_RESUME_FROM_PAUSE \
898 _IO(NVGPU_GPU_IOCTL_MAGIC, 21) 896 _IO(NVGPU_GPU_IOCTL_MAGIC, 21)
899#define NVGPU_GPU_IOCTL_TRIGGER_SUSPEND \ 897#define NVGPU_GPU_IOCTL_TRIGGER_SUSPEND \