diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:42:29 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:42:29 -0400 |
commit | f9dd2134374c8de6b911e2b8652c6c9622eaa658 (patch) | |
tree | c1b8f8d622941606b9e7247ab31d811ba4295011 /include/linux/async_tx.h | |
parent | 4b652f0db3be891c7b76b109c3b55003b920fc96 (diff) | |
parent | 07a3b417dc3d00802bd7b4874c3e811f0b015a7d (diff) |
Merge branch 'md-raid6-accel' into ioat3.2
Conflicts:
include/linux/dmaengine.h
Diffstat (limited to 'include/linux/async_tx.h')
-rw-r--r-- | include/linux/async_tx.h | 126 |
1 files changed, 94 insertions, 32 deletions
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h index 5fc2ef8d97fa..866e61c4e2e0 100644 --- a/include/linux/async_tx.h +++ b/include/linux/async_tx.h | |||
@@ -58,25 +58,57 @@ struct dma_chan_ref { | |||
58 | * array. | 58 | * array. |
59 | * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a | 59 | * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a |
60 | * dependency chain | 60 | * dependency chain |
61 | * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. | ||
62 | */ | 61 | */ |
63 | enum async_tx_flags { | 62 | enum async_tx_flags { |
64 | ASYNC_TX_XOR_ZERO_DST = (1 << 0), | 63 | ASYNC_TX_XOR_ZERO_DST = (1 << 0), |
65 | ASYNC_TX_XOR_DROP_DST = (1 << 1), | 64 | ASYNC_TX_XOR_DROP_DST = (1 << 1), |
66 | ASYNC_TX_ACK = (1 << 3), | 65 | ASYNC_TX_ACK = (1 << 2), |
67 | ASYNC_TX_DEP_ACK = (1 << 4), | 66 | }; |
67 | |||
68 | /** | ||
69 | * struct async_submit_ctl - async_tx submission/completion modifiers | ||
70 | * @flags: submission modifiers | ||
71 | * @depend_tx: parent dependency of the current operation being submitted | ||
72 | * @cb_fn: callback routine to run at operation completion | ||
73 | * @cb_param: parameter for the callback routine | ||
74 | * @scribble: caller provided space for dma/page address conversions | ||
75 | */ | ||
76 | struct async_submit_ctl { | ||
77 | enum async_tx_flags flags; | ||
78 | struct dma_async_tx_descriptor *depend_tx; | ||
79 | dma_async_tx_callback cb_fn; | ||
80 | void *cb_param; | ||
81 | void *scribble; | ||
68 | }; | 82 | }; |
69 | 83 | ||
70 | #ifdef CONFIG_DMA_ENGINE | 84 | #ifdef CONFIG_DMA_ENGINE |
71 | #define async_tx_issue_pending_all dma_issue_pending_all | 85 | #define async_tx_issue_pending_all dma_issue_pending_all |
86 | |||
87 | /** | ||
88 | * async_tx_issue_pending - send pending descriptor to the hardware channel | ||
89 | * @tx: descriptor handle to retrieve hardware context | ||
90 | * | ||
91 | * Note: any dependent operations will have already been issued by | ||
92 | * async_tx_channel_switch, or (in the case of no channel switch) will | ||
93 | * be already pending on this channel. | ||
94 | */ | ||
95 | static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx) | ||
96 | { | ||
97 | if (likely(tx)) { | ||
98 | struct dma_chan *chan = tx->chan; | ||
99 | struct dma_device *dma = chan->device; | ||
100 | |||
101 | dma->device_issue_pending(chan); | ||
102 | } | ||
103 | } | ||
72 | #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL | 104 | #ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL |
73 | #include <asm/async_tx.h> | 105 | #include <asm/async_tx.h> |
74 | #else | 106 | #else |
75 | #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ | 107 | #define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ |
76 | __async_tx_find_channel(dep, type) | 108 | __async_tx_find_channel(dep, type) |
77 | struct dma_chan * | 109 | struct dma_chan * |
78 | __async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | 110 | __async_tx_find_channel(struct async_submit_ctl *submit, |
79 | enum dma_transaction_type tx_type); | 111 | enum dma_transaction_type tx_type); |
80 | #endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ | 112 | #endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ |
81 | #else | 113 | #else |
82 | static inline void async_tx_issue_pending_all(void) | 114 | static inline void async_tx_issue_pending_all(void) |
@@ -84,10 +116,16 @@ static inline void async_tx_issue_pending_all(void) | |||
84 | do { } while (0); | 116 | do { } while (0); |
85 | } | 117 | } |
86 | 118 | ||
119 | static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx) | ||
120 | { | ||
121 | do { } while (0); | ||
122 | } | ||
123 | |||
87 | static inline struct dma_chan * | 124 | static inline struct dma_chan * |
88 | async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | 125 | async_tx_find_channel(struct async_submit_ctl *submit, |
89 | enum dma_transaction_type tx_type, struct page **dst, int dst_count, | 126 | enum dma_transaction_type tx_type, struct page **dst, |
90 | struct page **src, int src_count, size_t len) | 127 | int dst_count, struct page **src, int src_count, |
128 | size_t len) | ||
91 | { | 129 | { |
92 | return NULL; | 130 | return NULL; |
93 | } | 131 | } |
@@ -99,46 +137,70 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, | |||
99 | * @cb_fn_param: parameter to pass to the callback routine | 137 | * @cb_fn_param: parameter to pass to the callback routine |
100 | */ | 138 | */ |
101 | static inline void | 139 | static inline void |
102 | async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) | 140 | async_tx_sync_epilog(struct async_submit_ctl *submit) |
103 | { | 141 | { |
104 | if (cb_fn) | 142 | if (submit->cb_fn) |
105 | cb_fn(cb_fn_param); | 143 | submit->cb_fn(submit->cb_param); |
106 | } | 144 | } |
107 | 145 | ||
108 | void | 146 | typedef union { |
109 | async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, | 147 | unsigned long addr; |
110 | enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, | 148 | struct page *page; |
111 | dma_async_tx_callback cb_fn, void *cb_fn_param); | 149 | dma_addr_t dma; |
150 | } addr_conv_t; | ||
151 | |||
152 | static inline void | ||
153 | init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags, | ||
154 | struct dma_async_tx_descriptor *tx, | ||
155 | dma_async_tx_callback cb_fn, void *cb_param, | ||
156 | addr_conv_t *scribble) | ||
157 | { | ||
158 | args->flags = flags; | ||
159 | args->depend_tx = tx; | ||
160 | args->cb_fn = cb_fn; | ||
161 | args->cb_param = cb_param; | ||
162 | args->scribble = scribble; | ||
163 | } | ||
164 | |||
165 | void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, | ||
166 | struct async_submit_ctl *submit); | ||
112 | 167 | ||
113 | struct dma_async_tx_descriptor * | 168 | struct dma_async_tx_descriptor * |
114 | async_xor(struct page *dest, struct page **src_list, unsigned int offset, | 169 | async_xor(struct page *dest, struct page **src_list, unsigned int offset, |
115 | int src_cnt, size_t len, enum async_tx_flags flags, | 170 | int src_cnt, size_t len, struct async_submit_ctl *submit); |
116 | struct dma_async_tx_descriptor *depend_tx, | ||
117 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
118 | 171 | ||
119 | struct dma_async_tx_descriptor * | 172 | struct dma_async_tx_descriptor * |
120 | async_xor_zero_sum(struct page *dest, struct page **src_list, | 173 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, |
121 | unsigned int offset, int src_cnt, size_t len, | 174 | int src_cnt, size_t len, enum sum_check_flags *result, |
122 | u32 *result, enum async_tx_flags flags, | 175 | struct async_submit_ctl *submit); |
123 | struct dma_async_tx_descriptor *depend_tx, | ||
124 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
125 | 176 | ||
126 | struct dma_async_tx_descriptor * | 177 | struct dma_async_tx_descriptor * |
127 | async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, | 178 | async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, |
128 | unsigned int src_offset, size_t len, enum async_tx_flags flags, | 179 | unsigned int src_offset, size_t len, |
129 | struct dma_async_tx_descriptor *depend_tx, | 180 | struct async_submit_ctl *submit); |
130 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
131 | 181 | ||
132 | struct dma_async_tx_descriptor * | 182 | struct dma_async_tx_descriptor * |
133 | async_memset(struct page *dest, int val, unsigned int offset, | 183 | async_memset(struct page *dest, int val, unsigned int offset, |
134 | size_t len, enum async_tx_flags flags, | 184 | size_t len, struct async_submit_ctl *submit); |
135 | struct dma_async_tx_descriptor *depend_tx, | 185 | |
136 | dma_async_tx_callback cb_fn, void *cb_fn_param); | 186 | struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit); |
187 | |||
188 | struct dma_async_tx_descriptor * | ||
189 | async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt, | ||
190 | size_t len, struct async_submit_ctl *submit); | ||
191 | |||
192 | struct dma_async_tx_descriptor * | ||
193 | async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt, | ||
194 | size_t len, enum sum_check_flags *pqres, struct page *spare, | ||
195 | struct async_submit_ctl *submit); | ||
196 | |||
197 | struct dma_async_tx_descriptor * | ||
198 | async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb, | ||
199 | struct page **ptrs, struct async_submit_ctl *submit); | ||
137 | 200 | ||
138 | struct dma_async_tx_descriptor * | 201 | struct dma_async_tx_descriptor * |
139 | async_trigger_callback(enum async_tx_flags flags, | 202 | async_raid6_datap_recov(int src_num, size_t bytes, int faila, |
140 | struct dma_async_tx_descriptor *depend_tx, | 203 | struct page **ptrs, struct async_submit_ctl *submit); |
141 | dma_async_tx_callback cb_fn, void *cb_fn_param); | ||
142 | 204 | ||
143 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); | 205 | void async_tx_quiesce(struct dma_async_tx_descriptor **tx); |
144 | #endif /* _ASYNC_TX_H_ */ | 206 | #endif /* _ASYNC_TX_H_ */ |