Skip to content

Commit 9322af3

Browse files
committed
Merge tag 'dmaengine-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine
Pull dmaengine updates from Vinod Koul: "New support: - Qualcomm SDM670, SM6115 and SM6375 GPI controller support - Ingenic JZ4755 dmaengine support - Removal of iop-adma driver Updates: - Tegra support for dma-channel-mask - at_hdmac cleanup and virt-chan support for this driver" * tag 'dmaengine-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: (46 commits) dmaengine: Revert "dmaengine: remove s3c24xx driver" dmaengine: tegra: Add support for dma-channel-mask dt-bindings: dmaengine: Add dma-channel-mask to Tegra GPCDMA dmaengine: idxd: Remove linux/msi.h include dt-bindings: dmaengine: qcom: gpi: add compatible for SM6375 dmaengine: idxd: Fix crc_val field for completion record dmaengine: at_hdmac: Convert driver to use virt-dma dmaengine: at_hdmac: Remove unused member of at_dma_chan dmaengine: at_hdmac: Rename "chan_common" to "dma_chan" dmaengine: at_hdmac: Rename "dma_common" to "dma_device" dmaengine: at_hdmac: Use bitfield access macros dmaengine: at_hdmac: Keep register definitions and structures private to at_hdmac.c dmaengine: at_hdmac: Set include entries in alphabetic order dmaengine: at_hdmac: Use pm_ptr() dmaengine: at_hdmac: Use devm_clk_get() dmaengine: at_hdmac: Use devm_platform_ioremap_resource dmaengine: at_hdmac: Use devm_kzalloc() and struct_size() dmaengine: at_hdmac: Introduce atc_get_llis_residue() dmaengine: at_hdmac: s/atc_get_bytes_left/atc_get_residue dmaengine: at_hdmac: Pass residue by address to avoid unnecessary implicit casts ...
2 parents 1b6a349 + 25483de commit 9322af3

File tree

29 files changed

+1268
-3952
lines changed

29 files changed

+1268
-3952
lines changed

Documentation/ABI/stable/sysfs-driver-dma-idxd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Date: Oct 25, 2019
2222
KernelVersion: 5.6.0
2323
2424
Description: The largest number of work descriptors in a batch.
25+
It's not visible when the device does not support batch.
2526

2627
What: /sys/bus/dsa/devices/dsa<m>/max_work_queues_size
2728
Date: Oct 25, 2019
@@ -49,6 +50,8 @@ Description: The total number of read buffers supported by this device.
4950
The read buffers represent resources within the DSA
5051
implementation, and these resources are allocated by engines to
5152
support operations. See DSA spec v1.2 9.2.4 Total Read Buffers.
53+
It's not visible when the device does not support Read Buffer
54+
allocation control.
5255

5356
What: /sys/bus/dsa/devices/dsa<m>/max_transfer_size
5457
Date: Oct 25, 2019
@@ -122,6 +125,8 @@ Contact: [email protected]
122125
Description: The maximum number of read buffers that may be in use at
123126
one time by operations that access low bandwidth memory in the
124127
device. See DSA spec v1.2 9.2.8 GENCFG on Global Read Buffer Limit.
128+
It's not visible when the device does not support Read Buffer
129+
allocation control.
125130

126131
What: /sys/bus/dsa/devices/dsa<m>/cmd_status
127132
Date: Aug 28, 2020
@@ -205,6 +210,7 @@ KernelVersion: 5.10.0
205210
206211
Description: The max batch size for this workqueue. Cannot exceed device
207212
max batch size. Configurable parameter.
213+
It's not visible when the device does not support batch.
208214

209215
What: /sys/bus/dsa/devices/wq<m>.<n>/ats_disable
210216
Date: Nov 13, 2020
@@ -250,6 +256,8 @@ KernelVersion: 5.17.0
250256
251257
Description: Enable the use of global read buffer limit for the group. See DSA
252258
spec v1.2 9.2.18 GRPCFG Use Global Read Buffer Limit.
259+
It's not visible when the device does not support Read Buffer
260+
allocation control.
253261

254262
What: /sys/bus/dsa/devices/group<m>.<n>/read_buffers_allowed
255263
Date: Dec 10, 2021
@@ -258,6 +266,8 @@ Contact: [email protected]
258266
Description: Indicates max number of read buffers that may be in use at one time
259267
by all engines in the group. See DSA spec v1.2 9.2.18 GRPCFG Read
260268
Buffers Allowed.
269+
It's not visible when the device does not support Read Buffer
270+
allocation control.
261271

262272
What: /sys/bus/dsa/devices/group<m>.<n>/read_buffers_reserved
263273
Date: Dec 10, 2021
@@ -266,6 +276,8 @@ Contact: [email protected]
266276
Description: Indicates the number of Read Buffers reserved for the use of
267277
engines in the group. See DSA spec v1.2 9.2.18 GRPCFG Read Buffers
268278
Reserved.
279+
It's not visible when the device does not support Read Buffer
280+
allocation control.
269281

270282
What: /sys/bus/dsa/devices/group<m>.<n>/desc_progress_limit
271283
Date: Sept 14, 2022

Documentation/devicetree/bindings/dma/ingenic,dma.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ properties:
1818
- enum:
1919
- ingenic,jz4740-dma
2020
- ingenic,jz4725b-dma
21+
- ingenic,jz4755-dma
2122
- ingenic,jz4760-dma
2223
- ingenic,jz4760-bdma
2324
- ingenic,jz4760-mdma

Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ properties:
3939
Should contain all of the per-channel DMA interrupts in
4040
ascending order with respect to the DMA channel index.
4141
minItems: 1
42-
maxItems: 31
42+
maxItems: 32
4343

4444
resets:
4545
maxItems: 1
@@ -52,6 +52,9 @@ properties:
5252

5353
dma-coherent: true
5454

55+
dma-channel-mask:
56+
maxItems: 1
57+
5558
required:
5659
- compatible
5760
- reg
@@ -60,6 +63,7 @@ required:
6063
- reset-names
6164
- "#dma-cells"
6265
- iommus
66+
- dma-channel-mask
6367

6468
additionalProperties: false
6569

@@ -108,5 +112,6 @@ examples:
108112
#dma-cells = <1>;
109113
iommus = <&smmu TEGRA186_SID_GPCDMA_0>;
110114
dma-coherent;
115+
dma-channel-mask = <0xfffffffe>;
111116
};
112117
...

Documentation/devicetree/bindings/dma/qcom,gpi.yaml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,24 @@ allOf:
1818

1919
properties:
2020
compatible:
21-
enum:
22-
- qcom,sc7280-gpi-dma
23-
- qcom,sdm845-gpi-dma
24-
- qcom,sm6350-gpi-dma
25-
- qcom,sm8150-gpi-dma
26-
- qcom,sm8250-gpi-dma
27-
- qcom,sm8350-gpi-dma
28-
- qcom,sm8450-gpi-dma
21+
oneOf:
22+
- enum:
23+
- qcom,sdm845-gpi-dma
24+
- qcom,sm6350-gpi-dma
25+
- items:
26+
- enum:
27+
- qcom,sc7280-gpi-dma
28+
- qcom,sm6115-gpi-dma
29+
- qcom,sm6375-gpi-dma
30+
- qcom,sm8350-gpi-dma
31+
- qcom,sm8450-gpi-dma
32+
- const: qcom,sm6350-gpi-dma
33+
- items:
34+
- enum:
35+
- qcom,sdm670-gpi-dma
36+
- qcom,sm8150-gpi-dma
37+
- qcom,sm8250-gpi-dma
38+
- const: qcom,sdm845-gpi-dma
2939

3040
reg:
3141
maxItems: 1

Documentation/driver-api/driver-model/devres.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ SERDEV
450450

451451
SLAVE DMA ENGINE
452452
devm_acpi_dma_controller_register()
453+
devm_acpi_dma_controller_free()
453454

454455
SPI
455456
devm_spi_alloc_master()

MAINTAINERS

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10460,11 +10460,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
1046010460
F: drivers/iommu/intel/
1046110461
F: include/linux/intel-svm.h
1046210462

10463-
INTEL IOP-ADMA DMA DRIVER
10464-
R: Dan Williams <[email protected]>
10465-
S: Odd fixes
10466-
F: drivers/dma/iop-adma.c
10467-
1046810463
INTEL IPU3 CSI-2 CIO2 DRIVER
1046910464
M: Yong Zhi <[email protected]>
1047010465
M: Sakari Ailus <[email protected]>
@@ -13629,7 +13624,6 @@ L: [email protected]
1362913624
S: Supported
1363013625
F: Documentation/devicetree/bindings/dma/atmel-dma.txt
1363113626
F: drivers/dma/at_hdmac.c
13632-
F: drivers/dma/at_hdmac_regs.h
1363313627
F: drivers/dma/at_xdmac.c
1363413628
F: include/dt-bindings/dma/at91.h
1363513629

drivers/dma/Kconfig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ config AT_HDMAC
9797
tristate "Atmel AHB DMA support"
9898
depends on ARCH_AT91
9999
select DMA_ENGINE
100+
select DMA_VIRTUAL_CHANNELS
100101
help
101102
Support the Atmel AHB DMA controller.
102103

@@ -357,14 +358,6 @@ config INTEL_IOATDMA
357358

358359
If unsure, say N.
359360

360-
config INTEL_IOP_ADMA
361-
tristate "Intel IOP32x ADMA support"
362-
depends on ARCH_IOP32X || COMPILE_TEST
363-
select DMA_ENGINE
364-
select ASYNC_TX_ENABLE_CHANNEL_SWITCH
365-
help
366-
Enable support for the Intel(R) IOP Series RAID engines.
367-
368361
config K3_DMA
369362
tristate "Hisilicon K3 DMA support"
370363
depends on ARCH_HI3xxx || ARCH_HISI || COMPILE_TEST

drivers/dma/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ obj-$(CONFIG_IMX_SDMA) += imx-sdma.o
4444
obj-$(CONFIG_INTEL_IDMA64) += idma64.o
4545
obj-$(CONFIG_INTEL_IOATDMA) += ioat/
4646
obj-y += idxd/
47-
obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o
4847
obj-$(CONFIG_K3_DMA) += k3dma.o
4948
obj-$(CONFIG_LPC18XX_DMAMUX) += lpc18xx-dmamux.o
5049
obj-$(CONFIG_MILBEAUT_HDMAC) += milbeaut-hdmac.o

drivers/dma/apple-admac.c

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
#define NCHANNELS_MAX 64
2222
#define IRQ_NOUTPUTS 4
2323

24+
/*
25+
* For allocation purposes we split the cache
26+
* memory into blocks of fixed size (given in bytes).
27+
*/
28+
#define SRAM_BLOCK 2048
29+
2430
#define RING_WRITE_SLOT GENMASK(1, 0)
2531
#define RING_READ_SLOT GENMASK(5, 4)
2632
#define RING_FULL BIT(9)
@@ -36,6 +42,9 @@
3642
#define REG_TX_STOP 0x0004
3743
#define REG_RX_START 0x0008
3844
#define REG_RX_STOP 0x000c
45+
#define REG_IMPRINT 0x0090
46+
#define REG_TX_SRAM_SIZE 0x0094
47+
#define REG_RX_SRAM_SIZE 0x0098
3948

4049
#define REG_CHAN_CTL(ch) (0x8000 + (ch) * 0x200)
4150
#define REG_CHAN_CTL_RST_RINGS BIT(0)
@@ -53,7 +62,9 @@
5362
#define BUS_WIDTH_FRAME_2_WORDS 0x10
5463
#define BUS_WIDTH_FRAME_4_WORDS 0x20
5564

56-
#define CHAN_BUFSIZE 0x8000
65+
#define REG_CHAN_SRAM_CARVEOUT(ch) (0x8050 + (ch) * 0x200)
66+
#define CHAN_SRAM_CARVEOUT_SIZE GENMASK(31, 16)
67+
#define CHAN_SRAM_CARVEOUT_BASE GENMASK(15, 0)
5768

5869
#define REG_CHAN_FIFOCTL(ch) (0x8054 + (ch) * 0x200)
5970
#define CHAN_FIFOCTL_LIMIT GENMASK(31, 16)
@@ -76,6 +87,8 @@ struct admac_chan {
7687
struct dma_chan chan;
7788
struct tasklet_struct tasklet;
7889

90+
u32 carveout;
91+
7992
spinlock_t lock;
8093
struct admac_tx *current_tx;
8194
int nperiod_acks;
@@ -92,12 +105,24 @@ struct admac_chan {
92105
struct list_head to_free;
93106
};
94107

108+
struct admac_sram {
109+
u32 size;
110+
/*
111+
* SRAM_CARVEOUT has 16-bit fields, so the SRAM cannot be larger than
112+
* 64K and a 32-bit bitfield over 2K blocks covers it.
113+
*/
114+
u32 allocated;
115+
};
116+
95117
struct admac_data {
96118
struct dma_device dma;
97119
struct device *dev;
98120
__iomem void *base;
99121
struct reset_control *rstc;
100122

123+
struct mutex cache_alloc_lock;
124+
struct admac_sram txcache, rxcache;
125+
101126
int irq;
102127
int irq_index;
103128
int nchannels;
@@ -118,6 +143,60 @@ struct admac_tx {
118143
struct list_head node;
119144
};
120145

146+
static int admac_alloc_sram_carveout(struct admac_data *ad,
147+
enum dma_transfer_direction dir,
148+
u32 *out)
149+
{
150+
struct admac_sram *sram;
151+
int i, ret = 0, nblocks;
152+
153+
if (dir == DMA_MEM_TO_DEV)
154+
sram = &ad->txcache;
155+
else
156+
sram = &ad->rxcache;
157+
158+
mutex_lock(&ad->cache_alloc_lock);
159+
160+
nblocks = sram->size / SRAM_BLOCK;
161+
for (i = 0; i < nblocks; i++)
162+
if (!(sram->allocated & BIT(i)))
163+
break;
164+
165+
if (i < nblocks) {
166+
*out = FIELD_PREP(CHAN_SRAM_CARVEOUT_BASE, i * SRAM_BLOCK) |
167+
FIELD_PREP(CHAN_SRAM_CARVEOUT_SIZE, SRAM_BLOCK);
168+
sram->allocated |= BIT(i);
169+
} else {
170+
ret = -EBUSY;
171+
}
172+
173+
mutex_unlock(&ad->cache_alloc_lock);
174+
175+
return ret;
176+
}
177+
178+
static void admac_free_sram_carveout(struct admac_data *ad,
179+
enum dma_transfer_direction dir,
180+
u32 carveout)
181+
{
182+
struct admac_sram *sram;
183+
u32 base = FIELD_GET(CHAN_SRAM_CARVEOUT_BASE, carveout);
184+
int i;
185+
186+
if (dir == DMA_MEM_TO_DEV)
187+
sram = &ad->txcache;
188+
else
189+
sram = &ad->rxcache;
190+
191+
if (WARN_ON(base >= sram->size))
192+
return;
193+
194+
mutex_lock(&ad->cache_alloc_lock);
195+
i = base / SRAM_BLOCK;
196+
sram->allocated &= ~BIT(i);
197+
mutex_unlock(&ad->cache_alloc_lock);
198+
}
199+
121200
static void admac_modify(struct admac_data *ad, int reg, u32 mask, u32 val)
122201
{
123202
void __iomem *addr = ad->base + reg;
@@ -466,15 +545,28 @@ static void admac_synchronize(struct dma_chan *chan)
466545
static int admac_alloc_chan_resources(struct dma_chan *chan)
467546
{
468547
struct admac_chan *adchan = to_admac_chan(chan);
548+
struct admac_data *ad = adchan->host;
549+
int ret;
469550

470551
dma_cookie_init(&adchan->chan);
552+
ret = admac_alloc_sram_carveout(ad, admac_chan_direction(adchan->no),
553+
&adchan->carveout);
554+
if (ret < 0)
555+
return ret;
556+
557+
writel_relaxed(adchan->carveout,
558+
ad->base + REG_CHAN_SRAM_CARVEOUT(adchan->no));
471559
return 0;
472560
}
473561

474562
static void admac_free_chan_resources(struct dma_chan *chan)
475563
{
564+
struct admac_chan *adchan = to_admac_chan(chan);
565+
476566
admac_terminate_all(chan);
477567
admac_synchronize(chan);
568+
admac_free_sram_carveout(adchan->host, admac_chan_direction(adchan->no),
569+
adchan->carveout);
478570
}
479571

480572
static struct dma_chan *admac_dma_of_xlate(struct of_phandle_args *dma_spec,
@@ -712,6 +804,7 @@ static int admac_probe(struct platform_device *pdev)
712804
platform_set_drvdata(pdev, ad);
713805
ad->dev = &pdev->dev;
714806
ad->nchannels = nchannels;
807+
mutex_init(&ad->cache_alloc_lock);
715808

716809
/*
717810
* The controller has 4 IRQ outputs. Try them all until
@@ -801,6 +894,13 @@ static int admac_probe(struct platform_device *pdev)
801894
goto free_irq;
802895
}
803896

897+
ad->txcache.size = readl_relaxed(ad->base + REG_TX_SRAM_SIZE);
898+
ad->rxcache.size = readl_relaxed(ad->base + REG_RX_SRAM_SIZE);
899+
900+
dev_info(&pdev->dev, "Audio DMA Controller\n");
901+
dev_info(&pdev->dev, "imprint %x TX cache %u RX cache %u\n",
902+
readl_relaxed(ad->base + REG_IMPRINT), ad->txcache.size, ad->rxcache.size);
903+
804904
return 0;
805905

806906
free_irq:

0 commit comments

Comments
 (0)