History

Merge tag 'dma-buf-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sumits/dma-buf

Pull dma-buf updates from Sumit Semwal: - use of vma_pages instead of explicit computation - DocBook and headerdoc updates for dma-buf * tag 'dma-buf-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sumits/dma-buf: dma-buf: use vma_pages() fence: add missing descriptions for fence doc: update/fixup dma-buf related DocBook reservation: add headerdoc comments dma-buf: headerdoc fixes

Linus Torvalds committed 10 years ago

Commit ebb8cb22 parents 6b15d66 b02da6f6 files · +169 −14Browse files

Showing the changes to include (3 of 6 files). Show all

Unified · Split

3 files
  1. include/linux/dma-buf.h +10 −3
  2. include/linux/fence.h +2 −0
  3. include/linux/reservation.h +53 −0
include/linux/dma-buf.h+10−3
@@ -112,19 +112,24 @@ struct dma_buf_ops { · 111 unmodified lines
112112 * @file: file pointer used for sharing buffers across, and for refcounting.
113113 * @attachments: list of dma_buf_attachment that denotes all devices attached.
114114 * @ops: dma_buf_ops associated with this buffer object.
115+ * @lock: used internally to serialize list manipulation, attach/detach and vmap/unmap
116+ * @vmapping_counter: used internally to refcnt the vmaps
117+ * @vmap_ptr: the current vmap ptr if vmapping_counter > 0
115118 * @exp_name: name of the exporter; useful for debugging.
116119 * @owner: pointer to exporter module; used for refcounting when exporter is a
117120 * kernel module.
118121 * @list_node: node for dma_buf accounting and debugging.
119122 * @priv: exporter specific private data for this buffer object.
120123 * @resv: reservation object linked to this dma-buf
124+ * @poll: for userspace poll support
125+ * @cb_excl: for userspace poll support
126+ * @cb_shared: for userspace poll support
121127 */
122128 struct dma_buf {
123129 size_t size;
124130 struct file *file;
125131 struct list_head attachments;
126132 const struct dma_buf_ops *ops;
127− /* mutex to serialize list manipulation, attach/detach and vmap/unmap */
128133 struct mutex lock;
129134 unsigned vmapping_counter;
130135 void *vmap_ptr;
@@ -188,9 +193,11 @@ struct dma_buf_export_info { · 57 unmodified lines
188193
189194 /**
190195 * helper macro for exporters; zeros and fills in most common values
196+ *
197+ * @name: export-info name
191198 */
192−#define DEFINE_DMA_BUF_EXPORT_INFO(a) \
193− struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME, \
199+#define DEFINE_DMA_BUF_EXPORT_INFO(name) \
200+ struct dma_buf_export_info name = { .exp_name = KBUILD_MODNAME, \
194201 .owner = THIS_MODULE }
195202
196203 /**
include/linux/fence.h+2−0
@@ -49,6 +49,8 @@ struct fence_cb; · 48 unmodified lines
4949 * @timestamp: Timestamp when the fence was signaled.
5050 * @status: Optional, only valid if < 0, must be set before calling
5151 * fence_signal, indicates that the fence has completed with an error.
52+ * @child_list: list of children fences
53+ * @active_list: list of active fences
5254 *
5355 * the flags member must be manipulated and read using the appropriate
5456 * atomic ops (bit_*), so taking the spinlock will not be needed most
include/linux/reservation.h+53−0
@@ -49,12 +49,27 @@ extern struct ww_class reservation_ww_class; · 48 unmodified lines
4949 extern struct lock_class_key reservation_seqcount_class;
5050 extern const char reservation_seqcount_string[];
5151
52+/**
53+ * struct reservation_object_list - a list of shared fences
54+ * @rcu: for internal use
55+ * @shared_count: table of shared fences
56+ * @shared_max: for growing shared fence table
57+ * @shared: shared fence table
58+ */
5259 struct reservation_object_list {
5360 struct rcu_head rcu;
5461 u32 shared_count, shared_max;
5562 struct fence __rcu *shared[];
5663 };
5764
65+/**
66+ * struct reservation_object - a reservation object manages fences for a buffer
67+ * @lock: update side lock
68+ * @seq: sequence count for managing RCU read-side synchronization
69+ * @fence_excl: the exclusive fence, if there is one currently
70+ * @fence: list of current shared fences
71+ * @staged: staged copy of shared fences for RCU updates
72+ */
5873 struct reservation_object {
5974 struct ww_mutex lock;
6075 seqcount_t seq;
@@ -68,6 +83,10 @@ struct reservation_object { · 7 unmodified lines
6883 #define reservation_object_assert_held(obj) \
6984 lockdep_assert_held(&(obj)->lock.base)
7085
86+/**
87+ * reservation_object_init - initialize a reservation object
88+ * @obj: the reservation object
89+ */
7190 static inline void
7291 reservation_object_init(struct reservation_object *obj)
7392 {
@@ -79,6 +98,10 @@ reservation_object_init(struct reservation_object *obj) · 5 unmodified lines
7998 obj->staged = NULL;
8099 }
81100
101+/**
102+ * reservation_object_fini - destroys a reservation object
103+ * @obj: the reservation object
104+ */
82105 static inline void
83106 reservation_object_fini(struct reservation_object *obj)
84107 {
@@ -106,6 +129,14 @@ reservation_object_fini(struct reservation_object *obj) · 21 unmodified lines
106129 ww_mutex_destroy(&obj->lock);
107130 }
108131
132+/**
133+ * reservation_object_get_list - get the reservation object's
134+ * shared fence list, with update-side lock held
135+ * @obj: the reservation object
136+ *
137+ * Returns the shared fence list. Does NOT take references to
138+ * the fence. The obj->lock must be held.
139+ */
109140 static inline struct reservation_object_list *
110141 reservation_object_get_list(struct reservation_object *obj)
111142 {
@@ -113,6 +144,17 @@ reservation_object_get_list(struct reservation_object *obj) · 1 unmodified line
113144 reservation_object_held(obj));
114145 }
115146
147+/**
148+ * reservation_object_get_excl - get the reservation object's
149+ * exclusive fence, with update-side lock held
150+ * @obj: the reservation object
151+ *
152+ * Returns the exclusive fence (if any). Does NOT take a
153+ * reference. The obj->lock must be held.
154+ *
155+ * RETURNS
156+ * The exclusive fence or NULL
157+ */
116158 static inline struct fence *
117159 reservation_object_get_excl(struct reservation_object *obj)
118160 {
@@ -120,6 +162,17 @@ reservation_object_get_excl(struct reservation_object *obj) · 1 unmodified line
120162 reservation_object_held(obj));
121163 }
122164
165+/**
166+ * reservation_object_get_excl_rcu - get the reservation object's
167+ * exclusive fence, without lock held.
168+ * @obj: the reservation object
169+ *
170+ * If there is an exclusive fence, this atomically increments it's
171+ * reference count and returns it.
172+ *
173+ * RETURNS
174+ * The exclusive fence or NULL if none
175+ */
123176 static inline struct fence *
124177 reservation_object_get_excl_rcu(struct reservation_object *obj)
125178 {

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