History

Merge tag 'dmaengine-fix-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine

Pull dmaengine fixes from Vinod Koul: - SPI PDMA data fix for TI k3-psil drivers - suspend fix, pointer check, logic for arbitration fix and channel leak fix in fsl-edma driver - couple of fixes in idxd driver for GRPCFG descriptions and int_handle field handling - single fix for stm32 driver for bitfield overflow * tag 'dmaengine-fix-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: dmaengine: fsl-edma: fix DMA channel leak in eDMAv4 dmaengine: fsl-edma: fix wrong pointer check in fsl_edma3_attach_pd() dmaengine: idxd: Fix incorrect descriptions for GRPCFG register dmaengine: idxd: Protect int_handle field in hw descriptor dmaengine: stm32-dma: avoid bitfield overflow assertion dmaengine: fsl-edma: Add judgment on enabling round robin arbitration dmaengine: fsl-edma: Do not suspend and resume the masked dma channel when the system is sleeping dmaengine: ti: k3-psil-am62a: Fix SPI PDMA data dmaengine: ti: k3-psil-am62: Fix SPI PDMA data

Linus Torvalds committed 2 years ago

Commit 6d04b702 parents 134fdb8 4ee632c7 files · +41 −30Browse files

Unified · Split

7 files
  1. drivers/dma/fsl-edma-common.c +1 −0
  2. drivers/dma/fsl-edma-main.c +8 −4
  3. drivers/dma/idxd/registers.h +7 −5
  4. drivers/dma/idxd/submit.c +7 −7
  5. drivers/dma/stm32-dma.c +6 −2
  6. drivers/dma/ti/k3-psil-am62.c +6 −6
  7. drivers/dma/ti/k3-psil-am62a.c +6 −6
drivers/dma/fsl-edma-common.c+1−0
@@ -828,6 +828,7 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) · 827 unmodified lines
828828 dma_pool_destroy(fsl_chan->tcd_pool);
829829 fsl_chan->tcd_pool = NULL;
830830 fsl_chan->is_sw = false;
831+ fsl_chan->srcid = 0;
831832 }
832833
833834 void fsl_edma_cleanup_vchan(struct dma_device *dmadev)
drivers/dma/fsl-edma-main.c+8−4
@@ -396,9 +396,8 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng · 395 unmodified lines
396396 link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS |
397397 DL_FLAG_PM_RUNTIME |
398398 DL_FLAG_RPM_ACTIVE);
399− if (IS_ERR(link)) {
400− dev_err(dev, "Failed to add device_link to %d: %ld\n", i,
401− PTR_ERR(link));
399+ if (!link) {
400+ dev_err(dev, "Failed to add device_link to %d\n", i);
402401 return -EINVAL;
403402 }
404403
@@ -631,6 +630,8 @@ static int fsl_edma_suspend_late(struct device *dev) · 226 unmodified lines
631630
632631 for (i = 0; i < fsl_edma->n_chans; i++) {
633632 fsl_chan = &fsl_edma->chans[i];
633+ if (fsl_edma->chan_masked & BIT(i))
634+ continue;
634635 spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
635636 /* Make sure chan is idle or will force disable. */
636637 if (unlikely(!fsl_chan->idle)) {
@@ -655,13 +656,16 @@ static int fsl_edma_resume_early(struct device *dev) · 18 unmodified lines
655656
656657 for (i = 0; i < fsl_edma->n_chans; i++) {
657658 fsl_chan = &fsl_edma->chans[i];
659+ if (fsl_edma->chan_masked & BIT(i))
660+ continue;
658661 fsl_chan->pm_state = RUNNING;
659662 edma_write_tcdreg(fsl_chan, 0, csr);
660663 if (fsl_chan->slave_id != 0)
661664 fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true);
662665 }
663666
664− edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
667+ if (!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_SPLIT_REG))
668+ edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
665669
666670 return 0;
667671 }
drivers/dma/idxd/registers.h+7−5
@@ -440,12 +440,14 @@ union wqcfg { · 439 unmodified lines
440440 /*
441441 * This macro calculates the offset into the GRPCFG register
442442 * idxd - struct idxd *
443− * n - wq id
444− * ofs - the index of the 32b dword for the config register
443+ * n - group id
444+ * ofs - the index of the 64b qword for the config register
445445 *
446− * The WQCFG register block is divided into groups per each wq. The n index
447− * allows us to move to the register group that's for that particular wq.
448− * Each register is 32bits. The ofs gives us the number of register to access.
446+ * The GRPCFG register block is divided into three sub-registers, which
447+ * are GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index allows us to move
448+ * to the register block that contains the three sub-registers.
449+ * Each register block is 64bits. And the ofs gives us the offset
450+ * within the GRPWQCFG register to access.
449451 */
450452 #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\
451453 (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))
drivers/dma/idxd/submit.c+7−7
@@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) · 181 unmodified lines
182182
183183 portal = idxd_wq_portal_addr(wq);
184184
185− /*
186− * The wmb() flushes writes to coherent DMA data before
187− * possibly triggering a DMA read. The wmb() is necessary
188− * even on UP because the recipient is a device.
189− */
190− wmb();
191−
192185 /*
193186 * Pending the descriptor to the lockless list for the irq_entry
194187 * that we designated the descriptor to.
@@ -199,6 +192,13 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) · 4 unmodified lines
199192 llist_add(&desc->llnode, &ie->pending_llist);
200193 }
201194
195+ /*
196+ * The wmb() flushes writes to coherent DMA data before
197+ * possibly triggering a DMA read. The wmb() is necessary
198+ * even on UP because the recipient is a device.
199+ */
200+ wmb();
201+
202202 if (wq_dedicated(wq)) {
203203 iosubmit_cmds512(portal, desc->hw, 1);
204204 } else {
drivers/dma/stm32-dma.c+6−2
@@ -1246,8 +1246,8 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy( · 1245 unmodified lines
12461246 enum dma_slave_buswidth max_width;
12471247 struct stm32_dma_desc *desc;
12481248 size_t xfer_count, offset;
1249− u32 num_sgs, best_burst, dma_burst, threshold;
1250− int i;
1249+ u32 num_sgs, best_burst, threshold;
1250+ int dma_burst, i;
12511251
12521252 num_sgs = DIV_ROUND_UP(len, STM32_DMA_ALIGNED_MAX_DATA_ITEMS);
12531253 desc = kzalloc(struct_size(desc, sg_req, num_sgs), GFP_NOWAIT);
@@ -1266,6 +1266,10 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy( · 12 unmodified lines
12661266 best_burst = stm32_dma_get_best_burst(len, STM32_DMA_MAX_BURST,
12671267 threshold, max_width);
12681268 dma_burst = stm32_dma_get_burst(chan, best_burst);
1269+ if (dma_burst < 0) {
1270+ kfree(desc);
1271+ return NULL;
1272+ }
12691273
12701274 stm32_dma_clear_reg(&desc->sg_req[i].chan_reg);
12711275 desc->sg_req[i].chan_reg.dma_scr =
drivers/dma/ti/k3-psil-am62.c+6−6
@@ -74,7 +74,9 @@ static struct psil_ep am62_src_ep_map[] = { · 73 unmodified lines
7474 PSIL_SAUL(0x7505, 21, 35, 8, 36, 0),
7575 PSIL_SAUL(0x7506, 22, 43, 8, 43, 0),
7676 PSIL_SAUL(0x7507, 23, 43, 8, 44, 0),
77− /* PDMA_MAIN0 - SPI0-3 */
77+ /* PDMA_MAIN0 - SPI0-2 */
78+ PSIL_PDMA_XY_PKT(0x4300),
79+ PSIL_PDMA_XY_PKT(0x4301),
7880 PSIL_PDMA_XY_PKT(0x4302),
7981 PSIL_PDMA_XY_PKT(0x4303),
8082 PSIL_PDMA_XY_PKT(0x4304),
@@ -85,8 +87,6 @@ static struct psil_ep am62_src_ep_map[] = { · 4 unmodified lines
8587 PSIL_PDMA_XY_PKT(0x4309),
8688 PSIL_PDMA_XY_PKT(0x430a),
8789 PSIL_PDMA_XY_PKT(0x430b),
88− PSIL_PDMA_XY_PKT(0x430c),
89− PSIL_PDMA_XY_PKT(0x430d),
9090 /* PDMA_MAIN1 - UART0-6 */
9191 PSIL_PDMA_XY_PKT(0x4400),
9292 PSIL_PDMA_XY_PKT(0x4401),
@@ -141,7 +141,9 @@ static struct psil_ep am62_dst_ep_map[] = { · 48 unmodified lines
141141 /* SAUL */
142142 PSIL_SAUL(0xf500, 27, 83, 8, 83, 1),
143143 PSIL_SAUL(0xf501, 28, 91, 8, 91, 1),
144− /* PDMA_MAIN0 - SPI0-3 */
144+ /* PDMA_MAIN0 - SPI0-2 */
145+ PSIL_PDMA_XY_PKT(0xc300),
146+ PSIL_PDMA_XY_PKT(0xc301),
145147 PSIL_PDMA_XY_PKT(0xc302),
146148 PSIL_PDMA_XY_PKT(0xc303),
147149 PSIL_PDMA_XY_PKT(0xc304),
@@ -152,8 +154,6 @@ static struct psil_ep am62_dst_ep_map[] = { · 4 unmodified lines
152154 PSIL_PDMA_XY_PKT(0xc309),
153155 PSIL_PDMA_XY_PKT(0xc30a),
154156 PSIL_PDMA_XY_PKT(0xc30b),
155− PSIL_PDMA_XY_PKT(0xc30c),
156− PSIL_PDMA_XY_PKT(0xc30d),
157157 /* PDMA_MAIN1 - UART0-6 */
158158 PSIL_PDMA_XY_PKT(0xc400),
159159 PSIL_PDMA_XY_PKT(0xc401),
drivers/dma/ti/k3-psil-am62a.c+6−6
@@ -84,7 +84,9 @@ static struct psil_ep am62a_src_ep_map[] = { · 83 unmodified lines
8484 PSIL_SAUL(0x7505, 21, 35, 8, 36, 0),
8585 PSIL_SAUL(0x7506, 22, 43, 8, 43, 0),
8686 PSIL_SAUL(0x7507, 23, 43, 8, 44, 0),
87− /* PDMA_MAIN0 - SPI0-3 */
87+ /* PDMA_MAIN0 - SPI0-2 */
88+ PSIL_PDMA_XY_PKT(0x4300),
89+ PSIL_PDMA_XY_PKT(0x4301),
8890 PSIL_PDMA_XY_PKT(0x4302),
8991 PSIL_PDMA_XY_PKT(0x4303),
9092 PSIL_PDMA_XY_PKT(0x4304),
@@ -95,8 +97,6 @@ static struct psil_ep am62a_src_ep_map[] = { · 4 unmodified lines
9597 PSIL_PDMA_XY_PKT(0x4309),
9698 PSIL_PDMA_XY_PKT(0x430a),
9799 PSIL_PDMA_XY_PKT(0x430b),
98− PSIL_PDMA_XY_PKT(0x430c),
99− PSIL_PDMA_XY_PKT(0x430d),
100100 /* PDMA_MAIN1 - UART0-6 */
101101 PSIL_PDMA_XY_PKT(0x4400),
102102 PSIL_PDMA_XY_PKT(0x4401),
@@ -151,7 +151,9 @@ static struct psil_ep am62a_dst_ep_map[] = { · 48 unmodified lines
151151 /* SAUL */
152152 PSIL_SAUL(0xf500, 27, 83, 8, 83, 1),
153153 PSIL_SAUL(0xf501, 28, 91, 8, 91, 1),
154− /* PDMA_MAIN0 - SPI0-3 */
154+ /* PDMA_MAIN0 - SPI0-2 */
155+ PSIL_PDMA_XY_PKT(0xc300),
156+ PSIL_PDMA_XY_PKT(0xc301),
155157 PSIL_PDMA_XY_PKT(0xc302),
156158 PSIL_PDMA_XY_PKT(0xc303),
157159 PSIL_PDMA_XY_PKT(0xc304),
@@ -162,8 +164,6 @@ static struct psil_ep am62a_dst_ep_map[] = { · 4 unmodified lines
162164 PSIL_PDMA_XY_PKT(0xc309),
163165 PSIL_PDMA_XY_PKT(0xc30a),
164166 PSIL_PDMA_XY_PKT(0xc30b),
165− PSIL_PDMA_XY_PKT(0xc30c),
166− PSIL_PDMA_XY_PKT(0xc30d),
167167 /* PDMA_MAIN1 - UART0-6 */
168168 PSIL_PDMA_XY_PKT(0xc400),
169169 PSIL_PDMA_XY_PKT(0xc401),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t