mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-03 13:04:01 +00:00
async_pq_val: convert to dmaengine_unmap_data
Use the generic unmap object to unmap dma buffers. Cc: Vinod Koul <vinod.koul@intel.com> Cc: Tomasz Figa <t.figa@samsung.com> Cc: Dave Jiang <dave.jiang@intel.com> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
7476bd79fc
commit
1786b943da
1 changed files with 35 additions and 23 deletions
|
@ -290,50 +290,60 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,
|
||||||
struct dma_async_tx_descriptor *tx;
|
struct dma_async_tx_descriptor *tx;
|
||||||
unsigned char coefs[disks-2];
|
unsigned char coefs[disks-2];
|
||||||
enum dma_ctrl_flags dma_flags = submit->cb_fn ? DMA_PREP_INTERRUPT : 0;
|
enum dma_ctrl_flags dma_flags = submit->cb_fn ? DMA_PREP_INTERRUPT : 0;
|
||||||
dma_addr_t *dma_src = NULL;
|
struct dmaengine_unmap_data *unmap = NULL;
|
||||||
int src_cnt = 0;
|
|
||||||
|
|
||||||
BUG_ON(disks < 4);
|
BUG_ON(disks < 4);
|
||||||
|
|
||||||
if (submit->scribble)
|
if (device)
|
||||||
dma_src = submit->scribble;
|
unmap = dmaengine_get_unmap_data(device->dev, disks, GFP_NOIO);
|
||||||
else if (sizeof(dma_addr_t) <= sizeof(struct page *))
|
|
||||||
dma_src = (dma_addr_t *) blocks;
|
|
||||||
|
|
||||||
if (dma_src && device && disks <= dma_maxpq(device, 0) &&
|
if (unmap && disks <= dma_maxpq(device, 0) &&
|
||||||
is_dma_pq_aligned(device, offset, 0, len)) {
|
is_dma_pq_aligned(device, offset, 0, len)) {
|
||||||
struct device *dev = device->dev;
|
struct device *dev = device->dev;
|
||||||
dma_addr_t *pq = &dma_src[disks-2];
|
dma_addr_t pq[2];
|
||||||
int i;
|
int i, j = 0, src_cnt = 0;
|
||||||
|
|
||||||
pr_debug("%s: (async) disks: %d len: %zu\n",
|
pr_debug("%s: (async) disks: %d len: %zu\n",
|
||||||
__func__, disks, len);
|
__func__, disks, len);
|
||||||
if (!P(blocks, disks))
|
|
||||||
|
unmap->len = len;
|
||||||
|
for (i = 0; i < disks-2; i++)
|
||||||
|
if (likely(blocks[i])) {
|
||||||
|
unmap->addr[j] = dma_map_page(dev, blocks[i],
|
||||||
|
offset, len,
|
||||||
|
DMA_TO_DEVICE);
|
||||||
|
coefs[j] = raid6_gfexp[i];
|
||||||
|
unmap->to_cnt++;
|
||||||
|
src_cnt++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!P(blocks, disks)) {
|
||||||
|
pq[0] = 0;
|
||||||
dma_flags |= DMA_PREP_PQ_DISABLE_P;
|
dma_flags |= DMA_PREP_PQ_DISABLE_P;
|
||||||
else
|
} else {
|
||||||
pq[0] = dma_map_page(dev, P(blocks, disks),
|
pq[0] = dma_map_page(dev, P(blocks, disks),
|
||||||
offset, len,
|
offset, len,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
if (!Q(blocks, disks))
|
unmap->addr[j++] = pq[0];
|
||||||
|
unmap->to_cnt++;
|
||||||
|
}
|
||||||
|
if (!Q(blocks, disks)) {
|
||||||
|
pq[1] = 0;
|
||||||
dma_flags |= DMA_PREP_PQ_DISABLE_Q;
|
dma_flags |= DMA_PREP_PQ_DISABLE_Q;
|
||||||
else
|
} else {
|
||||||
pq[1] = dma_map_page(dev, Q(blocks, disks),
|
pq[1] = dma_map_page(dev, Q(blocks, disks),
|
||||||
offset, len,
|
offset, len,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
|
unmap->addr[j++] = pq[1];
|
||||||
|
unmap->to_cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
if (submit->flags & ASYNC_TX_FENCE)
|
if (submit->flags & ASYNC_TX_FENCE)
|
||||||
dma_flags |= DMA_PREP_FENCE;
|
dma_flags |= DMA_PREP_FENCE;
|
||||||
for (i = 0; i < disks-2; i++)
|
|
||||||
if (likely(blocks[i])) {
|
|
||||||
dma_src[src_cnt] = dma_map_page(dev, blocks[i],
|
|
||||||
offset, len,
|
|
||||||
DMA_TO_DEVICE);
|
|
||||||
coefs[src_cnt] = raid6_gfexp[i];
|
|
||||||
src_cnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
tx = device->device_prep_dma_pq_val(chan, pq, dma_src,
|
tx = device->device_prep_dma_pq_val(chan, pq,
|
||||||
|
unmap->addr,
|
||||||
src_cnt,
|
src_cnt,
|
||||||
coefs,
|
coefs,
|
||||||
len, pqres,
|
len, pqres,
|
||||||
|
@ -343,6 +353,8 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,
|
||||||
async_tx_quiesce(&submit->depend_tx);
|
async_tx_quiesce(&submit->depend_tx);
|
||||||
dma_async_issue_pending(chan);
|
dma_async_issue_pending(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dma_set_unmap(tx, unmap);
|
||||||
async_tx_submit(chan, tx, submit);
|
async_tx_submit(chan, tx, submit);
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
|
|
Loading…
Add table
Reference in a new issue