History

dma-buf: remove kmap_atomic interface

Neither used nor correctly implemented anywhere. Just completely remove the interface.

Christian König committed 8 years ago

Commit f664a521 parent a19741e17 files · +2 −165Browse files

Unified · Split

17 files
  1. drivers/dma-buf/dma-buf.c +2 −52
  2. drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +0 −2
  3. drivers/gpu/drm/armada/armada_gem.c +0 −2
  4. drivers/gpu/drm/drm_prime.c +0 −31
  5. drivers/gpu/drm/i915/i915_gem_dmabuf.c +0 −11
  6. drivers/gpu/drm/i915/selftests/mock_dmabuf.c +0 −2
  7. drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c +0 −2
  8. drivers/gpu/drm/tegra/gem.c +0 −14
  9. drivers/gpu/drm/udl/udl_dmabuf.c +0 −17
  10. drivers/gpu/drm/vmwgfx/vmwgfx_prime.c +0 −13
  11. drivers/media/common/videobuf2/videobuf2-dma-contig.c +0 −1
  12. drivers/media/common/videobuf2/videobuf2-dma-sg.c +0 −1
  13. drivers/media/common/videobuf2/videobuf2-vmalloc.c +0 −1
  14. drivers/staging/android/ion/ion.c +0 −2
  15. drivers/tee/tee_shm.c +0 −6
  16. include/drm/drm_prime.h +0 −4
  17. include/linux/dma-buf.h +0 −4
drivers/dma-buf/dma-buf.c+2−52
@@ -405,7 +405,6 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) · 404 unmodified lines
405405 || !exp_info->ops->map_dma_buf
406406 || !exp_info->ops->unmap_dma_buf
407407 || !exp_info->ops->release
408− || !exp_info->ops->map_atomic
409408 || !exp_info->ops->map
410409 || !exp_info->ops->mmap)) {
411410 return ERR_PTR(-EINVAL);
@@ -687,26 +686,14 @@ EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment); · 275 unmodified lines
687686 * void \*dma_buf_kmap(struct dma_buf \*, unsigned long);
688687 * void dma_buf_kunmap(struct dma_buf \*, unsigned long, void \*);
689688 *
690− * There are also atomic variants of these interfaces. Like for kmap they
691− * facilitate non-blocking fast-paths. Neither the importer nor the exporter
692− * (in the callback) is allowed to block when using these.
693− *
694− * Interfaces::
695− * void \*dma_buf_kmap_atomic(struct dma_buf \*, unsigned long);
696− * void dma_buf_kunmap_atomic(struct dma_buf \*, unsigned long, void \*);
697− *
698− * For importers all the restrictions of using kmap apply, like the limited
699− * supply of kmap_atomic slots. Hence an importer shall only hold onto at
700− * max 2 atomic dma_buf kmaps at the same time (in any given process context).
689+ * Implementing the functions is optional for exporters and for importers all
690+ * the restrictions of using kmap apply.
701691 *
702692 * dma_buf kmap calls outside of the range specified in begin_cpu_access are
703693 * undefined. If the range is not PAGE_SIZE aligned, kmap needs to succeed on
704694 * the partial chunks at the beginning and end but may return stale or bogus
705695 * data outside of the range (in these partial chunks).
706696 *
707− * Note that these calls need to always succeed. The exporter needs to
708− * complete any preparations that might fail in begin_cpu_access.
709− *
710697 * For some cases the overhead of kmap can be too high, a vmap interface
711698 * is introduced. This interface should be used very carefully, as vmalloc
712699 * space is a limited resources on many architectures.
@@ -859,43 +846,6 @@ int dma_buf_end_cpu_access(struct dma_buf *dmabuf, · 146 unmodified lines
859846 }
860847 EXPORT_SYMBOL_GPL(dma_buf_end_cpu_access);
861848
862−/**
863− * dma_buf_kmap_atomic - Map a page of the buffer object into kernel address
864− * space. The same restrictions as for kmap_atomic and friends apply.
865− * @dmabuf: [in] buffer to map page from.
866− * @page_num: [in] page in PAGE_SIZE units to map.
867− *
868− * This call must always succeed, any necessary preparations that might fail
869− * need to be done in begin_cpu_access.
870− */
871−void *dma_buf_kmap_atomic(struct dma_buf *dmabuf, unsigned long page_num)
872−{
873− WARN_ON(!dmabuf);
874−
875− if (!dmabuf->ops->map_atomic)
876− return NULL;
877− return dmabuf->ops->map_atomic(dmabuf, page_num);
878−}
879−EXPORT_SYMBOL_GPL(dma_buf_kmap_atomic);
880−
881−/**
882− * dma_buf_kunmap_atomic - Unmap a page obtained by dma_buf_kmap_atomic.
883− * @dmabuf: [in] buffer to unmap page from.
884− * @page_num: [in] page in PAGE_SIZE units to unmap.
885− * @vaddr: [in] kernel space pointer obtained from dma_buf_kmap_atomic.
886− *
887− * This call must always succeed.
888− */
889−void dma_buf_kunmap_atomic(struct dma_buf *dmabuf, unsigned long page_num,
890− void *vaddr)
891−{
892− WARN_ON(!dmabuf);
893−
894− if (dmabuf->ops->unmap_atomic)
895− dmabuf->ops->unmap_atomic(dmabuf, page_num, vaddr);
896−}
897−EXPORT_SYMBOL_GPL(dma_buf_kunmap_atomic);
898−
899849 /**
900850 * dma_buf_kmap - Map a page of the buffer object into kernel address space. The
901851 * same restrictions as for kmap and friends apply.
drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c+0−2
@@ -238,9 +238,7 @@ static const struct dma_buf_ops amdgpu_dmabuf_ops = { · 237 unmodified lines
238238 .release = drm_gem_dmabuf_release,
239239 .begin_cpu_access = amdgpu_gem_begin_cpu_access,
240240 .map = drm_gem_dmabuf_kmap,
241− .map_atomic = drm_gem_dmabuf_kmap_atomic,
242241 .unmap = drm_gem_dmabuf_kunmap,
243− .unmap_atomic = drm_gem_dmabuf_kunmap_atomic,
244242 .mmap = drm_gem_dmabuf_mmap,
245243 .vmap = drm_gem_dmabuf_vmap,
246244 .vunmap = drm_gem_dmabuf_vunmap,
drivers/gpu/drm/armada/armada_gem.c+0−2
@@ -490,8 +490,6 @@ static const struct dma_buf_ops armada_gem_prime_dmabuf_ops = { · 489 unmodified lines
490490 .map_dma_buf = armada_gem_prime_map_dma_buf,
491491 .unmap_dma_buf = armada_gem_prime_unmap_dma_buf,
492492 .release = drm_gem_dmabuf_release,
493− .map_atomic = armada_gem_dmabuf_no_kmap,
494− .unmap_atomic = armada_gem_dmabuf_no_kunmap,
495493 .map = armada_gem_dmabuf_no_kmap,
496494 .unmap = armada_gem_dmabuf_no_kunmap,
497495 .mmap = armada_gem_dmabuf_mmap,
drivers/gpu/drm/drm_prime.c+0−31
@@ -433,35 +433,6 @@ void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr) · 432 unmodified lines
433433 }
434434 EXPORT_SYMBOL(drm_gem_dmabuf_vunmap);
435435
436−/**
437− * drm_gem_dmabuf_kmap_atomic - map_atomic implementation for GEM
438− * @dma_buf: buffer to be mapped
439− * @page_num: page number within the buffer
440− *
441− * Not implemented. This can be used as the &dma_buf_ops.map_atomic callback.
442− */
443−void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
444− unsigned long page_num)
445−{
446− return NULL;
447−}
448−EXPORT_SYMBOL(drm_gem_dmabuf_kmap_atomic);
449−
450−/**
451− * drm_gem_dmabuf_kunmap_atomic - unmap_atomic implementation for GEM
452− * @dma_buf: buffer to be unmapped
453− * @page_num: page number within the buffer
454− * @addr: virtual address of the buffer
455− *
456− * Not implemented. This can be used as the &dma_buf_ops.unmap_atomic callback.
457− */
458−void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
459− unsigned long page_num, void *addr)
460−{
461−
462−}
463−EXPORT_SYMBOL(drm_gem_dmabuf_kunmap_atomic);
464−
465436 /**
466437 * drm_gem_dmabuf_kmap - map implementation for GEM
467438 * @dma_buf: buffer to be mapped
@@ -519,9 +490,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { · 51 unmodified lines
519490 .unmap_dma_buf = drm_gem_unmap_dma_buf,
520491 .release = drm_gem_dmabuf_release,
521492 .map = drm_gem_dmabuf_kmap,
522− .map_atomic = drm_gem_dmabuf_kmap_atomic,
523493 .unmap = drm_gem_dmabuf_kunmap,
524− .unmap_atomic = drm_gem_dmabuf_kunmap_atomic,
525494 .mmap = drm_gem_dmabuf_mmap,
526495 .vmap = drm_gem_dmabuf_vmap,
527496 .vunmap = drm_gem_dmabuf_vunmap,
drivers/gpu/drm/i915/i915_gem_dmabuf.c+0−11
@@ -111,15 +111,6 @@ static void i915_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr) · 110 unmodified lines
111111 i915_gem_object_unpin_map(obj);
112112 }
113113
114−static void *i915_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf, unsigned long page_num)
115−{
116− return NULL;
117−}
118−
119−static void i915_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
120−{
121−
122−}
123114 static void *i915_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num)
124115 {
125116 struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
@@ -225,9 +216,7 @@ static const struct dma_buf_ops i915_dmabuf_ops = { · 99 unmodified lines
225216 .unmap_dma_buf = i915_gem_unmap_dma_buf,
226217 .release = drm_gem_dmabuf_release,
227218 .map = i915_gem_dmabuf_kmap,
228− .map_atomic = i915_gem_dmabuf_kmap_atomic,
229219 .unmap = i915_gem_dmabuf_kunmap,
230− .unmap_atomic = i915_gem_dmabuf_kunmap_atomic,
231220 .mmap = i915_gem_dmabuf_mmap,
232221 .vmap = i915_gem_dmabuf_vmap,
233222 .vunmap = i915_gem_dmabuf_vunmap,
drivers/gpu/drm/i915/selftests/mock_dmabuf.c+0−2
@@ -130,9 +130,7 @@ static const struct dma_buf_ops mock_dmabuf_ops = { · 129 unmodified lines
130130 .unmap_dma_buf = mock_unmap_dma_buf,
131131 .release = mock_dmabuf_release,
132132 .map = mock_dmabuf_kmap,
133− .map_atomic = mock_dmabuf_kmap_atomic,
134133 .unmap = mock_dmabuf_kunmap,
135− .unmap_atomic = mock_dmabuf_kunmap_atomic,
136134 .mmap = mock_dmabuf_mmap,
137135 .vmap = mock_dmabuf_vmap,
138136 .vunmap = mock_dmabuf_vunmap,
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c+0−2
@@ -148,8 +148,6 @@ static const struct dma_buf_ops omap_dmabuf_ops = { · 147 unmodified lines
148148 .release = drm_gem_dmabuf_release,
149149 .begin_cpu_access = omap_gem_dmabuf_begin_cpu_access,
150150 .end_cpu_access = omap_gem_dmabuf_end_cpu_access,
151− .map_atomic = omap_gem_dmabuf_kmap_atomic,
152− .unmap_atomic = omap_gem_dmabuf_kunmap_atomic,
153151 .map = omap_gem_dmabuf_kmap,
154152 .unmap = omap_gem_dmabuf_kunmap,
155153 .mmap = omap_gem_dmabuf_mmap,
drivers/gpu/drm/tegra/gem.c+0−14
@@ -596,18 +596,6 @@ static int tegra_gem_prime_end_cpu_access(struct dma_buf *buf, · 595 unmodified lines
596596 return 0;
597597 }
598598
599−static void *tegra_gem_prime_kmap_atomic(struct dma_buf *buf,
600− unsigned long page)
601−{
602− return NULL;
603−}
604−
605−static void tegra_gem_prime_kunmap_atomic(struct dma_buf *buf,
606− unsigned long page,
607− void *addr)
608−{
609−}
610−
611599 static void *tegra_gem_prime_kmap(struct dma_buf *buf, unsigned long page)
612600 {
613601 return NULL;
@@ -648,8 +636,6 @@ static const struct dma_buf_ops tegra_gem_prime_dmabuf_ops = { · 34 unmodified lines
648636 .release = tegra_gem_prime_release,
649637 .begin_cpu_access = tegra_gem_prime_begin_cpu_access,
650638 .end_cpu_access = tegra_gem_prime_end_cpu_access,
651− .map_atomic = tegra_gem_prime_kmap_atomic,
652− .unmap_atomic = tegra_gem_prime_kunmap_atomic,
653639 .map = tegra_gem_prime_kmap,
654640 .unmap = tegra_gem_prime_kunmap,
655641 .mmap = tegra_gem_prime_mmap,
drivers/gpu/drm/udl/udl_dmabuf.c+0−17
@@ -157,27 +157,12 @@ static void *udl_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num) · 156 unmodified lines
157157 return NULL;
158158 }
159159
160−static void *udl_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
161− unsigned long page_num)
162−{
163− /* TODO */
164−
165− return NULL;
166−}
167−
168160 static void udl_dmabuf_kunmap(struct dma_buf *dma_buf,
169161 unsigned long page_num, void *addr)
170162 {
171163 /* TODO */
172164 }
173165
174−static void udl_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
175− unsigned long page_num,
176− void *addr)
177−{
178− /* TODO */
179−}
180−
181166 static int udl_dmabuf_mmap(struct dma_buf *dma_buf,
182167 struct vm_area_struct *vma)
183168 {
@@ -192,9 +177,7 @@ static const struct dma_buf_ops udl_dmabuf_ops = { · 8 unmodified lines
192177 .map_dma_buf = udl_map_dma_buf,
193178 .unmap_dma_buf = udl_unmap_dma_buf,
194179 .map = udl_dmabuf_kmap,
195− .map_atomic = udl_dmabuf_kmap_atomic,
196180 .unmap = udl_dmabuf_kunmap,
197− .unmap_atomic = udl_dmabuf_kunmap_atomic,
198181 .mmap = udl_dmabuf_mmap,
199182 .release = drm_gem_dmabuf_release,
200183 };
drivers/gpu/drm/vmwgfx/vmwgfx_prime.c+0−13
@@ -71,17 +71,6 @@ static void vmw_prime_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr) · 70 unmodified lines
7171 {
7272 }
7373
74−static void *vmw_prime_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
75− unsigned long page_num)
76−{
77− return NULL;
78−}
79−
80−static void vmw_prime_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
81− unsigned long page_num, void *addr)
82−{
83−
84−}
8574 static void *vmw_prime_dmabuf_kmap(struct dma_buf *dma_buf,
8675 unsigned long page_num)
8776 {
@@ -108,9 +97,7 @@ const struct dma_buf_ops vmw_prime_dmabuf_ops = { · 20 unmodified lines
10897 .unmap_dma_buf = vmw_prime_unmap_dma_buf,
10998 .release = NULL,
11099 .map = vmw_prime_dmabuf_kmap,
111− .map_atomic = vmw_prime_dmabuf_kmap_atomic,
112100 .unmap = vmw_prime_dmabuf_kunmap,
113− .unmap_atomic = vmw_prime_dmabuf_kunmap_atomic,
114101 .mmap = vmw_prime_dmabuf_mmap,
115102 .vmap = vmw_prime_dmabuf_vmap,
116103 .vunmap = vmw_prime_dmabuf_vunmap,
drivers/media/common/videobuf2/videobuf2-dma-contig.c+0−1
@@ -358,7 +358,6 @@ static const struct dma_buf_ops vb2_dc_dmabuf_ops = { · 357 unmodified lines
358358 .map_dma_buf = vb2_dc_dmabuf_ops_map,
359359 .unmap_dma_buf = vb2_dc_dmabuf_ops_unmap,
360360 .map = vb2_dc_dmabuf_ops_kmap,
361− .map_atomic = vb2_dc_dmabuf_ops_kmap,
362361 .vmap = vb2_dc_dmabuf_ops_vmap,
363362 .mmap = vb2_dc_dmabuf_ops_mmap,
364363 .release = vb2_dc_dmabuf_ops_release,
drivers/media/common/videobuf2/videobuf2-dma-sg.c+0−1
@@ -507,7 +507,6 @@ static const struct dma_buf_ops vb2_dma_sg_dmabuf_ops = { · 506 unmodified lines
507507 .map_dma_buf = vb2_dma_sg_dmabuf_ops_map,
508508 .unmap_dma_buf = vb2_dma_sg_dmabuf_ops_unmap,
509509 .map = vb2_dma_sg_dmabuf_ops_kmap,
510− .map_atomic = vb2_dma_sg_dmabuf_ops_kmap,
511510 .vmap = vb2_dma_sg_dmabuf_ops_vmap,
512511 .mmap = vb2_dma_sg_dmabuf_ops_mmap,
513512 .release = vb2_dma_sg_dmabuf_ops_release,
drivers/media/common/videobuf2/videobuf2-vmalloc.c+0−1
@@ -346,7 +346,6 @@ static const struct dma_buf_ops vb2_vmalloc_dmabuf_ops = { · 345 unmodified lines
346346 .map_dma_buf = vb2_vmalloc_dmabuf_ops_map,
347347 .unmap_dma_buf = vb2_vmalloc_dmabuf_ops_unmap,
348348 .map = vb2_vmalloc_dmabuf_ops_kmap,
349− .map_atomic = vb2_vmalloc_dmabuf_ops_kmap,
350349 .vmap = vb2_vmalloc_dmabuf_ops_vmap,
351350 .mmap = vb2_vmalloc_dmabuf_ops_mmap,
352351 .release = vb2_vmalloc_dmabuf_ops_release,
drivers/staging/android/ion/ion.c+0−2
@@ -369,8 +369,6 @@ static const struct dma_buf_ops dma_buf_ops = { · 368 unmodified lines
369369 .detach = ion_dma_buf_detatch,
370370 .begin_cpu_access = ion_dma_buf_begin_cpu_access,
371371 .end_cpu_access = ion_dma_buf_end_cpu_access,
372− .map_atomic = ion_dma_buf_kmap,
373− .unmap_atomic = ion_dma_buf_kunmap,
374372 .map = ion_dma_buf_kmap,
375373 .unmap = ion_dma_buf_kunmap,
376374 };
drivers/tee/tee_shm.c+0−6
@@ -80,11 +80,6 @@ static void tee_shm_op_release(struct dma_buf *dmabuf) · 79 unmodified lines
8080 tee_shm_release(shm);
8181 }
8282
83−static void *tee_shm_op_map_atomic(struct dma_buf *dmabuf, unsigned long pgnum)
84−{
85− return NULL;
86−}
87−
8883 static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum)
8984 {
9085 return NULL;
@@ -107,7 +102,6 @@ static const struct dma_buf_ops tee_shm_dma_buf_ops = { · 16 unmodified lines
107102 .map_dma_buf = tee_shm_op_map_dma_buf,
108103 .unmap_dma_buf = tee_shm_op_unmap_dma_buf,
109104 .release = tee_shm_op_release,
110− .map_atomic = tee_shm_op_map_atomic,
111105 .map = tee_shm_op_map,
112106 .mmap = tee_shm_op_mmap,
113107 };
include/drm/drm_prime.h+0−4
@@ -93,10 +93,6 @@ void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach, · 92 unmodified lines
9393 enum dma_data_direction dir);
9494 void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf);
9595 void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr);
96−void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
97− unsigned long page_num);
98−void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
99− unsigned long page_num, void *addr);
10096 void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf, unsigned long page_num);
10197 void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf, unsigned long page_num,
10298 void *addr);
include/linux/dma-buf.h+0−4
@@ -205,8 +205,6 @@ struct dma_buf_ops { · 204 unmodified lines
205205 * to be restarted.
206206 */
207207 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction);
208− void *(*map_atomic)(struct dma_buf *, unsigned long);
209− void (*unmap_atomic)(struct dma_buf *, unsigned long, void *);
210208 void *(*map)(struct dma_buf *, unsigned long);
211209 void (*unmap)(struct dma_buf *, unsigned long, void *);
212210
@@ -394,8 +392,6 @@ int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, · 181 unmodified lines
394392 enum dma_data_direction dir);
395393 int dma_buf_end_cpu_access(struct dma_buf *dma_buf,
396394 enum dma_data_direction dir);
397−void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long);
398−void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
399395 void *dma_buf_kmap(struct dma_buf *, unsigned long);
400396 void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
401397