History

dma-buf: drop dynamic_mapping flag

Instead use the pin() callback to detect dynamic DMA-buf handling. Since amdgpu is now migrated it doesn't make much sense to keep the extra flag.

Christian König committed 6 years ago

Commit bd2275e1 parent a448cb03 files · +7 −20Browse files

Unified · Split

3 files
  1. drivers/dma-buf/dma-buf.c +2 −3
  2. drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0 −1
  3. include/linux/dma-buf.h +5 −16
drivers/dma-buf/dma-buf.c+2−3
@@ -524,11 +524,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) · 523 unmodified lines
524 }524 }
525 525
526 if (WARN_ON(exp_info->ops->cache_sgt_mapping &&526 if (WARN_ON(exp_info->ops->cache_sgt_mapping &&
527 exp_info->ops->dynamic_mapping))527 (exp_info->ops->pin || exp_info->ops->unpin)))
528 return ERR_PTR(-EINVAL);528 return ERR_PTR(-EINVAL);
529 529
530 if (WARN_ON(!exp_info->ops->dynamic_mapping &&530 if (WARN_ON(!exp_info->ops->pin != !exp_info->ops->unpin))
531 (exp_info->ops->pin || exp_info->ops->unpin)))
532 return ERR_PTR(-EINVAL);531 return ERR_PTR(-EINVAL);
533 532
534 if (!try_module_get(exp_info->owner))533 if (!try_module_get(exp_info->owner))
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c+0−1
@@ -364,7 +364,6 @@ static int amdgpu_dma_buf_begin_cpu_access(struct dma_buf *dma_buf, · 363 unmodified lines
364}364}
365 365
366const struct dma_buf_ops amdgpu_dmabuf_ops = {366const struct dma_buf_ops amdgpu_dmabuf_ops = {
367 .dynamic_mapping = true,
368 .attach = amdgpu_dma_buf_attach,367 .attach = amdgpu_dma_buf_attach,
369 .detach = amdgpu_dma_buf_detach,368 .detach = amdgpu_dma_buf_detach,
370 .pin = amdgpu_dma_buf_pin,369 .pin = amdgpu_dma_buf_pin,
include/linux/dma-buf.h+5−16
@@ -42,18 +42,6 @@ struct dma_buf_ops { · 41 unmodified lines
42 */42 */
43 bool cache_sgt_mapping;43 bool cache_sgt_mapping;
44 44
45 /**
46 * @dynamic_mapping:
47 *
48 * If true the framework makes sure that the map/unmap_dma_buf
49 * callbacks are always called with the dma_resv object locked.
50 *
51 * If false the framework makes sure that the map/unmap_dma_buf
52 * callbacks are always called without the dma_resv object locked.
53 * Mutual exclusive with @cache_sgt_mapping.
54 */
55 bool dynamic_mapping;
56
57 /**45 /**
58 * @attach:46 * @attach:
59 *47 *
@@ -99,7 +87,8 @@ struct dma_buf_ops { · 39 unmodified lines
99 * This is called by dma_buf_pin and lets the exporter know that the87 * This is called by dma_buf_pin and lets the exporter know that the
100 * DMA-buf can't be moved any more.88 * DMA-buf can't be moved any more.
101 *89 *
102 * This is called with the dmabuf->resv object locked.90 * This is called with the dmabuf->resv object locked and is mutual
91 * exclusive with @cache_sgt_mapping.
103 *92 *
104 * This callback is optional and should only be used in limited use93 * This callback is optional and should only be used in limited use
105 * cases like scanout and not for temporary pin operations.94 * cases like scanout and not for temporary pin operations.
@@ -116,7 +105,8 @@ struct dma_buf_ops { · 10 unmodified lines
116 * This is called by dma_buf_unpin and lets the exporter know that the105 * This is called by dma_buf_unpin and lets the exporter know that the
117 * DMA-buf can be moved again.106 * DMA-buf can be moved again.
118 *107 *
119 * This is called with the dmabuf->resv object locked.108 * This is called with the dmabuf->resv object locked and is mutual
109 * exclusive with @cache_sgt_mapping.
120 *110 *
121 * This callback is optional.111 * This callback is optional.
122 */112 */
@@ -455,8 +445,7 @@ static inline void get_dma_buf(struct dma_buf *dmabuf) · 332 unmodified lines
455 */445 */
456static inline bool dma_buf_is_dynamic(struct dma_buf *dmabuf)446static inline bool dma_buf_is_dynamic(struct dma_buf *dmabuf)
457{447{
458 /* TODO: switch to using pin/unpin functions as indicator. */448 return !!dmabuf->ops->pin;
459 return dmabuf->ops->dynamic_mapping;
460}449}
461 450
462/**451/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t