diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-06-03 17:22:28 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-06-03 17:22:28 -0400 |
commit | 04ce9ab385dc97eb55299d533cd3af79b8fc7529 (patch) | |
tree | 9b8d0b9c1eba820a8a107d05abc2e2f8d4d20a59 /Documentation | |
parent | a08abd8ca890a377521d65d493d174bebcaf694b (diff) |
async_xor: permit callers to pass in a 'dma/page scribble' region
async_xor() needs space to perform dma and page address conversions. In
most cases the code can simply reuse the struct page * array because the
size of the native pointer matches the size of a dma/page address. In
order to support archs where sizeof(dma_addr_t) is larger than
sizeof(struct page *), or to preserve the input parameters, we utilize a
memory region passed in by the caller.
Since the code is now prepared to handle the case where it cannot
perform address conversions on the stack, we no longer need the
!HIGHMEM64G dependency in drivers/dma/Kconfig.
[ Impact: don't clobber input buffers for address conversions ]
Reviewed-by: Andre Noll <maan@systemlinux.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/crypto/async-tx-api.txt | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/Documentation/crypto/async-tx-api.txt b/Documentation/crypto/async-tx-api.txt index dfe0475f7919..6b15e488c0e7 100644 --- a/Documentation/crypto/async-tx-api.txt +++ b/Documentation/crypto/async-tx-api.txt | |||
@@ -115,29 +115,42 @@ of an operation. | |||
115 | Perform a xor->copy->xor operation where each operation depends on the | 115 | Perform a xor->copy->xor operation where each operation depends on the |
116 | result from the previous operation: | 116 | result from the previous operation: |
117 | 117 | ||
118 | void complete_xor_copy_xor(void *param) | 118 | void callback(void *param) |
119 | { | 119 | { |
120 | printk("complete\n"); | 120 | struct completion *cmp = param; |
121 | |||
122 | complete(cmp); | ||
121 | } | 123 | } |
122 | 124 | ||
123 | int run_xor_copy_xor(struct page **xor_srcs, | 125 | void run_xor_copy_xor(struct page **xor_srcs, |
124 | int xor_src_cnt, | 126 | int xor_src_cnt, |
125 | struct page *xor_dest, | 127 | struct page *xor_dest, |
126 | size_t xor_len, | 128 | size_t xor_len, |
127 | struct page *copy_src, | 129 | struct page *copy_src, |
128 | struct page *copy_dest, | 130 | struct page *copy_dest, |
129 | size_t copy_len) | 131 | size_t copy_len) |
130 | { | 132 | { |
131 | struct dma_async_tx_descriptor *tx; | 133 | struct dma_async_tx_descriptor *tx; |
134 | addr_conv_t addr_conv[xor_src_cnt]; | ||
135 | struct async_submit_ctl submit; | ||
136 | addr_conv_t addr_conv[NDISKS]; | ||
137 | struct completion cmp; | ||
138 | |||
139 | init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL, | ||
140 | addr_conv); | ||
141 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, &submit) | ||
132 | 142 | ||
133 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 143 | submit->depend_tx = tx; |
134 | ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL); | 144 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, &submit); |
135 | tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, tx, NULL, NULL); | 145 | |
136 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, | 146 | init_completion(&cmp); |
137 | ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, | 147 | init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, tx, |
138 | tx, complete_xor_copy_xor, NULL); | 148 | callback, &cmp, addr_conv); |
149 | tx = async_xor(xor_dest, xor_srcs, 0, xor_src_cnt, xor_len, &submit); | ||
139 | 150 | ||
140 | async_tx_issue_pending_all(); | 151 | async_tx_issue_pending_all(); |
152 | |||
153 | wait_for_completion(&cmp); | ||
141 | } | 154 | } |
142 | 155 | ||
143 | See include/linux/async_tx.h for more information on the flags. See the | 156 | See include/linux/async_tx.h for more information on the flags. See the |