Skip to content

Commit 0cae043

Browse files
Christoph Hellwigvinodkoul
authored andcommitted
dmaengine: remove DMA_MEMCPY_SG once again
This was removed before due to the complete lack of users, but 3218910 ("dmaengine: Add core function and capability check for DMA_MEMCPY_SG") and 29cf37f ("dmaengine: Add consumer for the new DMA_MEMCPY_SG API function.") added it back despite still not having any users whatsoever. Fixes: 3218910 ("dmaengine: Add core function and capability check for DMA_MEMCPY_SG") Fixes: 29cf37f ("dmaengine: Add consumer for the new DMA_MEMCPY_SG API function.") Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/20220606074733.622616-1-hch@lst.de Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent f7a0350 commit 0cae043

4 files changed

Lines changed: 0 additions & 159 deletions

File tree

Documentation/driver-api/dmaengine/provider.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,6 @@ Currently, the types available are:
162162

163163
- The device is able to do memory to memory copies
164164

165-
- - DMA_MEMCPY_SG
166-
167-
- The device supports memory to memory scatter-gather transfers.
168-
169-
- Even though a plain memcpy can look like a particular case of a
170-
scatter-gather transfer, with a single chunk to copy, it's a distinct
171-
transaction type in the mem2mem transfer case. This is because some very
172-
simple devices might be able to do contiguous single-chunk memory copies,
173-
but have no support for more complex SG transfers.
174-
175165
- No matter what the overall size of the combined chunks for source and
176166
destination is, only as many bytes as the smallest of the two will be
177167
transmitted. That means the number and size of the scatter-gather buffers in

drivers/dma/dmaengine.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,13 +1153,6 @@ int dma_async_device_register(struct dma_device *device)
11531153
return -EIO;
11541154
}
11551155

1156-
if (dma_has_cap(DMA_MEMCPY_SG, device->cap_mask) && !device->device_prep_dma_memcpy_sg) {
1157-
dev_err(device->dev,
1158-
"Device claims capability %s, but op is not defined\n",
1159-
"DMA_MEMCPY_SG");
1160-
return -EIO;
1161-
}
1162-
11631156
if (dma_has_cap(DMA_XOR, device->cap_mask) && !device->device_prep_dma_xor) {
11641157
dev_err(device->dev,
11651158
"Device claims capability %s, but op is not defined\n",

drivers/dma/xilinx/xilinx_dma.c

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,126 +2127,6 @@ xilinx_cdma_prep_memcpy(struct dma_chan *dchan, dma_addr_t dma_dst,
21272127
return NULL;
21282128
}
21292129

2130-
/**
2131-
* xilinx_cdma_prep_memcpy_sg - prepare descriptors for a memcpy_sg transaction
2132-
* @dchan: DMA channel
2133-
* @dst_sg: Destination scatter list
2134-
* @dst_sg_len: Number of entries in destination scatter list
2135-
* @src_sg: Source scatter list
2136-
* @src_sg_len: Number of entries in source scatter list
2137-
* @flags: transfer ack flags
2138-
*
2139-
* Return: Async transaction descriptor on success and NULL on failure
2140-
*/
2141-
static struct dma_async_tx_descriptor *xilinx_cdma_prep_memcpy_sg(
2142-
struct dma_chan *dchan, struct scatterlist *dst_sg,
2143-
unsigned int dst_sg_len, struct scatterlist *src_sg,
2144-
unsigned int src_sg_len, unsigned long flags)
2145-
{
2146-
struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
2147-
struct xilinx_dma_tx_descriptor *desc;
2148-
struct xilinx_cdma_tx_segment *segment, *prev = NULL;
2149-
struct xilinx_cdma_desc_hw *hw;
2150-
size_t len, dst_avail, src_avail;
2151-
dma_addr_t dma_dst, dma_src;
2152-
2153-
if (unlikely(dst_sg_len == 0 || src_sg_len == 0))
2154-
return NULL;
2155-
2156-
if (unlikely(!dst_sg || !src_sg))
2157-
return NULL;
2158-
2159-
desc = xilinx_dma_alloc_tx_descriptor(chan);
2160-
if (!desc)
2161-
return NULL;
2162-
2163-
dma_async_tx_descriptor_init(&desc->async_tx, &chan->common);
2164-
desc->async_tx.tx_submit = xilinx_dma_tx_submit;
2165-
2166-
dst_avail = sg_dma_len(dst_sg);
2167-
src_avail = sg_dma_len(src_sg);
2168-
/*
2169-
* loop until there is either no more source or no more destination
2170-
* scatterlist entry
2171-
*/
2172-
while (true) {
2173-
len = min_t(size_t, src_avail, dst_avail);
2174-
len = min_t(size_t, len, chan->xdev->max_buffer_len);
2175-
if (len == 0)
2176-
goto fetch;
2177-
2178-
/* Allocate the link descriptor from DMA pool */
2179-
segment = xilinx_cdma_alloc_tx_segment(chan);
2180-
if (!segment)
2181-
goto error;
2182-
2183-
dma_dst = sg_dma_address(dst_sg) + sg_dma_len(dst_sg) -
2184-
dst_avail;
2185-
dma_src = sg_dma_address(src_sg) + sg_dma_len(src_sg) -
2186-
src_avail;
2187-
hw = &segment->hw;
2188-
hw->control = len;
2189-
hw->src_addr = dma_src;
2190-
hw->dest_addr = dma_dst;
2191-
if (chan->ext_addr) {
2192-
hw->src_addr_msb = upper_32_bits(dma_src);
2193-
hw->dest_addr_msb = upper_32_bits(dma_dst);
2194-
}
2195-
2196-
if (prev) {
2197-
prev->hw.next_desc = segment->phys;
2198-
if (chan->ext_addr)
2199-
prev->hw.next_desc_msb =
2200-
upper_32_bits(segment->phys);
2201-
}
2202-
2203-
prev = segment;
2204-
dst_avail -= len;
2205-
src_avail -= len;
2206-
list_add_tail(&segment->node, &desc->segments);
2207-
2208-
fetch:
2209-
/* Fetch the next dst scatterlist entry */
2210-
if (dst_avail == 0) {
2211-
if (dst_sg_len == 0)
2212-
break;
2213-
dst_sg = sg_next(dst_sg);
2214-
if (dst_sg == NULL)
2215-
break;
2216-
dst_sg_len--;
2217-
dst_avail = sg_dma_len(dst_sg);
2218-
}
2219-
/* Fetch the next src scatterlist entry */
2220-
if (src_avail == 0) {
2221-
if (src_sg_len == 0)
2222-
break;
2223-
src_sg = sg_next(src_sg);
2224-
if (src_sg == NULL)
2225-
break;
2226-
src_sg_len--;
2227-
src_avail = sg_dma_len(src_sg);
2228-
}
2229-
}
2230-
2231-
if (list_empty(&desc->segments)) {
2232-
dev_err(chan->xdev->dev,
2233-
"%s: Zero-size SG transfer requested\n", __func__);
2234-
goto error;
2235-
}
2236-
2237-
/* Link the last hardware descriptor with the first. */
2238-
segment = list_first_entry(&desc->segments,
2239-
struct xilinx_cdma_tx_segment, node);
2240-
desc->async_tx.phys = segment->phys;
2241-
prev->hw.next_desc = segment->phys;
2242-
2243-
return &desc->async_tx;
2244-
2245-
error:
2246-
xilinx_dma_free_tx_descriptor(chan, desc);
2247-
return NULL;
2248-
}
2249-
22502130
/**
22512131
* xilinx_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
22522132
* @dchan: DMA channel
@@ -3240,9 +3120,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
32403120
DMA_RESIDUE_GRANULARITY_SEGMENT;
32413121
} else if (xdev->dma_config->dmatype == XDMA_TYPE_CDMA) {
32423122
dma_cap_set(DMA_MEMCPY, xdev->common.cap_mask);
3243-
dma_cap_set(DMA_MEMCPY_SG, xdev->common.cap_mask);
32443123
xdev->common.device_prep_dma_memcpy = xilinx_cdma_prep_memcpy;
3245-
xdev->common.device_prep_dma_memcpy_sg = xilinx_cdma_prep_memcpy_sg;
32463124
/* Residue calculation is supported by only AXI DMA and CDMA */
32473125
xdev->common.residue_granularity =
32483126
DMA_RESIDUE_GRANULARITY_SEGMENT;

include/linux/dmaengine.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ enum dma_status {
5050
*/
5151
enum dma_transaction_type {
5252
DMA_MEMCPY,
53-
DMA_MEMCPY_SG,
5453
DMA_XOR,
5554
DMA_PQ,
5655
DMA_XOR_VAL,
@@ -887,11 +886,6 @@ struct dma_device {
887886
struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
888887
struct dma_chan *chan, dma_addr_t dst, dma_addr_t src,
889888
size_t len, unsigned long flags);
890-
struct dma_async_tx_descriptor *(*device_prep_dma_memcpy_sg)(
891-
struct dma_chan *chan,
892-
struct scatterlist *dst_sg, unsigned int dst_nents,
893-
struct scatterlist *src_sg, unsigned int src_nents,
894-
unsigned long flags);
895889
struct dma_async_tx_descriptor *(*device_prep_dma_xor)(
896890
struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
897891
unsigned int src_cnt, size_t len, unsigned long flags);
@@ -1060,20 +1054,6 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memcpy(
10601054
len, flags);
10611055
}
10621056

1063-
static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memcpy_sg(
1064-
struct dma_chan *chan,
1065-
struct scatterlist *dst_sg, unsigned int dst_nents,
1066-
struct scatterlist *src_sg, unsigned int src_nents,
1067-
unsigned long flags)
1068-
{
1069-
if (!chan || !chan->device || !chan->device->device_prep_dma_memcpy_sg)
1070-
return NULL;
1071-
1072-
return chan->device->device_prep_dma_memcpy_sg(chan, dst_sg, dst_nents,
1073-
src_sg, src_nents,
1074-
flags);
1075-
}
1076-
10771057
static inline bool dmaengine_is_metadata_mode_supported(struct dma_chan *chan,
10781058
enum dma_desc_metadata_mode mode)
10791059
{

0 commit comments

Comments
 (0)