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
Unified · Split
| @@ -828,6 +828,7 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) · 827 unmodified lines | |||
| 828 | dma_pool_destroy(fsl_chan->tcd_pool); | 828 | dma_pool_destroy(fsl_chan->tcd_pool); |
| 829 | fsl_chan->tcd_pool = NULL; | 829 | fsl_chan->tcd_pool = NULL; |
| 830 | fsl_chan->is_sw = false; | 830 | fsl_chan->is_sw = false; |
| 831 | fsl_chan->srcid = 0; | ||
| 831 | } | 832 | } |
| 832 | 833 | ||
| 833 | void fsl_edma_cleanup_vchan(struct dma_device *dmadev) | 834 | void fsl_edma_cleanup_vchan(struct dma_device *dmadev) |
| @@ -396,9 +396,8 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng · 395 unmodified lines | |||
| 396 | link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | | 396 | link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | |
| 397 | DL_FLAG_PM_RUNTIME | | 397 | DL_FLAG_PM_RUNTIME | |
| 398 | DL_FLAG_RPM_ACTIVE); | 398 | DL_FLAG_RPM_ACTIVE); |
| 399 | if (IS_ERR(link)) { | 399 | if (!link) { |
| 400 | dev_err(dev, "Failed to add device_link to %d: %ld\n", i, | 400 | dev_err(dev, "Failed to add device_link to %d\n", i); |
| 401 | PTR_ERR(link)); | ||
| 402 | return -EINVAL; | 401 | return -EINVAL; |
| 403 | } | 402 | } |
| 404 | 403 | ||
| @@ -631,6 +630,8 @@ static int fsl_edma_suspend_late(struct device *dev) · 226 unmodified lines | |||
| 631 | 630 | ||
| 632 | for (i = 0; i < fsl_edma->n_chans; i++) { | 631 | for (i = 0; i < fsl_edma->n_chans; i++) { |
| 633 | fsl_chan = &fsl_edma->chans[i]; | 632 | fsl_chan = &fsl_edma->chans[i]; |
| 633 | if (fsl_edma->chan_masked & BIT(i)) | ||
| 634 | continue; | ||
| 634 | spin_lock_irqsave(&fsl_chan->vchan.lock, flags); | 635 | spin_lock_irqsave(&fsl_chan->vchan.lock, flags); |
| 635 | /* Make sure chan is idle or will force disable. */ | 636 | /* Make sure chan is idle or will force disable. */ |
| 636 | if (unlikely(!fsl_chan->idle)) { | 637 | if (unlikely(!fsl_chan->idle)) { |
| @@ -655,13 +656,16 @@ static int fsl_edma_resume_early(struct device *dev) · 18 unmodified lines | |||
| 655 | 656 | ||
| 656 | for (i = 0; i < fsl_edma->n_chans; i++) { | 657 | for (i = 0; i < fsl_edma->n_chans; i++) { |
| 657 | fsl_chan = &fsl_edma->chans[i]; | 658 | fsl_chan = &fsl_edma->chans[i]; |
| 659 | if (fsl_edma->chan_masked & BIT(i)) | ||
| 660 | continue; | ||
| 658 | fsl_chan->pm_state = RUNNING; | 661 | fsl_chan->pm_state = RUNNING; |
| 659 | edma_write_tcdreg(fsl_chan, 0, csr); | 662 | edma_write_tcdreg(fsl_chan, 0, csr); |
| 660 | if (fsl_chan->slave_id != 0) | 663 | if (fsl_chan->slave_id != 0) |
| 661 | fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true); | 664 | fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true); |
| 662 | } | 665 | } |
| 663 | 666 | ||
| 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); | ||
| 665 | 669 | ||
| 666 | return 0; | 670 | return 0; |
| 667 | } | 671 | } |
| @@ -440,12 +440,14 @@ union wqcfg { · 439 unmodified lines | |||
| 440 | /* | 440 | /* |
| 441 | * This macro calculates the offset into the GRPCFG register | 441 | * This macro calculates the offset into the GRPCFG register |
| 442 | * idxd - struct idxd * | 442 | * idxd - struct idxd * |
| 443 | * n - wq id | 443 | * n - group id |
| 444 | * ofs - the index of the 32b dword for the config register | 444 | * ofs - the index of the 64b qword for the config register |
| 445 | * | 445 | * |
| 446 | * The WQCFG register block is divided into groups per each wq. The n index | 446 | * The GRPCFG register block is divided into three sub-registers, which |
| 447 | * allows us to move to the register group that's for that particular wq. | 447 | * are GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index allows us to move |
| 448 | * Each register is 32bits. The ofs gives us the number of register to access. | 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. | ||
| 449 | */ | 451 | */ |
| 450 | #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\ | 452 | #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\ |
| 451 | (n) * GRPCFG_SIZE + sizeof(u64) * (ofs)) | 453 | (n) * GRPCFG_SIZE + sizeof(u64) * (ofs)) |
| @@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) · 181 unmodified lines | |||
| 182 | 182 | ||
| 183 | portal = idxd_wq_portal_addr(wq); | 183 | portal = idxd_wq_portal_addr(wq); |
| 184 | 184 | ||
| 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 | |||
| 192 | /* | 185 | /* |
| 193 | * Pending the descriptor to the lockless list for the irq_entry | 186 | * Pending the descriptor to the lockless list for the irq_entry |
| 194 | * that we designated the descriptor to. | 187 | * 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 | |||
| 199 | llist_add(&desc->llnode, &ie->pending_llist); | 192 | llist_add(&desc->llnode, &ie->pending_llist); |
| 200 | } | 193 | } |
| 201 | 194 | ||
| 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 | |||
| 202 | if (wq_dedicated(wq)) { | 202 | if (wq_dedicated(wq)) { |
| 203 | iosubmit_cmds512(portal, desc->hw, 1); | 203 | iosubmit_cmds512(portal, desc->hw, 1); |
| 204 | } else { | 204 | } else { |
| @@ -1246,8 +1246,8 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy( · 1245 unmodified lines | |||
| 1246 | enum dma_slave_buswidth max_width; | 1246 | enum dma_slave_buswidth max_width; |
| 1247 | struct stm32_dma_desc *desc; | 1247 | struct stm32_dma_desc *desc; |
| 1248 | size_t xfer_count, offset; | 1248 | size_t xfer_count, offset; |
| 1249 | u32 num_sgs, best_burst, dma_burst, threshold; | 1249 | u32 num_sgs, best_burst, threshold; |
| 1250 | int i; | 1250 | int dma_burst, i; |
| 1251 | 1251 | ||
| 1252 | num_sgs = DIV_ROUND_UP(len, STM32_DMA_ALIGNED_MAX_DATA_ITEMS); | 1252 | num_sgs = DIV_ROUND_UP(len, STM32_DMA_ALIGNED_MAX_DATA_ITEMS); |
| 1253 | desc = kzalloc(struct_size(desc, sg_req, num_sgs), GFP_NOWAIT); | 1253 | 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 | |||
| 1266 | best_burst = stm32_dma_get_best_burst(len, STM32_DMA_MAX_BURST, | 1266 | best_burst = stm32_dma_get_best_burst(len, STM32_DMA_MAX_BURST, |
| 1267 | threshold, max_width); | 1267 | threshold, max_width); |
| 1268 | dma_burst = stm32_dma_get_burst(chan, best_burst); | 1268 | dma_burst = stm32_dma_get_burst(chan, best_burst); |
| 1269 | if (dma_burst < 0) { | ||
| 1270 | kfree(desc); | ||
| 1271 | return NULL; | ||
| 1272 | } | ||
| 1269 | 1273 | ||
| 1270 | stm32_dma_clear_reg(&desc->sg_req[i].chan_reg); | 1274 | stm32_dma_clear_reg(&desc->sg_req[i].chan_reg); |
| 1271 | desc->sg_req[i].chan_reg.dma_scr = | 1275 | desc->sg_req[i].chan_reg.dma_scr = |
| @@ -74,7 +74,9 @@ static struct psil_ep am62_src_ep_map[] = { · 73 unmodified lines | |||
| 74 | PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), | 74 | PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), |
| 75 | PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), | 75 | PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), |
| 76 | PSIL_SAUL(0x7507, 23, 43, 8, 44, 0), | 76 | 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), | ||
| 78 | PSIL_PDMA_XY_PKT(0x4302), | 80 | PSIL_PDMA_XY_PKT(0x4302), |
| 79 | PSIL_PDMA_XY_PKT(0x4303), | 81 | PSIL_PDMA_XY_PKT(0x4303), |
| 80 | PSIL_PDMA_XY_PKT(0x4304), | 82 | PSIL_PDMA_XY_PKT(0x4304), |
| @@ -85,8 +87,6 @@ static struct psil_ep am62_src_ep_map[] = { · 4 unmodified lines | |||
| 85 | PSIL_PDMA_XY_PKT(0x4309), | 87 | PSIL_PDMA_XY_PKT(0x4309), |
| 86 | PSIL_PDMA_XY_PKT(0x430a), | 88 | PSIL_PDMA_XY_PKT(0x430a), |
| 87 | PSIL_PDMA_XY_PKT(0x430b), | 89 | PSIL_PDMA_XY_PKT(0x430b), |
| 88 | PSIL_PDMA_XY_PKT(0x430c), | ||
| 89 | PSIL_PDMA_XY_PKT(0x430d), | ||
| 90 | /* PDMA_MAIN1 - UART0-6 */ | 90 | /* PDMA_MAIN1 - UART0-6 */ |
| 91 | PSIL_PDMA_XY_PKT(0x4400), | 91 | PSIL_PDMA_XY_PKT(0x4400), |
| 92 | PSIL_PDMA_XY_PKT(0x4401), | 92 | PSIL_PDMA_XY_PKT(0x4401), |
| @@ -141,7 +141,9 @@ static struct psil_ep am62_dst_ep_map[] = { · 48 unmodified lines | |||
| 141 | /* SAUL */ | 141 | /* SAUL */ |
| 142 | PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), | 142 | PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), |
| 143 | PSIL_SAUL(0xf501, 28, 91, 8, 91, 1), | 143 | 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), | ||
| 145 | PSIL_PDMA_XY_PKT(0xc302), | 147 | PSIL_PDMA_XY_PKT(0xc302), |
| 146 | PSIL_PDMA_XY_PKT(0xc303), | 148 | PSIL_PDMA_XY_PKT(0xc303), |
| 147 | PSIL_PDMA_XY_PKT(0xc304), | 149 | PSIL_PDMA_XY_PKT(0xc304), |
| @@ -152,8 +154,6 @@ static struct psil_ep am62_dst_ep_map[] = { · 4 unmodified lines | |||
| 152 | PSIL_PDMA_XY_PKT(0xc309), | 154 | PSIL_PDMA_XY_PKT(0xc309), |
| 153 | PSIL_PDMA_XY_PKT(0xc30a), | 155 | PSIL_PDMA_XY_PKT(0xc30a), |
| 154 | PSIL_PDMA_XY_PKT(0xc30b), | 156 | PSIL_PDMA_XY_PKT(0xc30b), |
| 155 | PSIL_PDMA_XY_PKT(0xc30c), | ||
| 156 | PSIL_PDMA_XY_PKT(0xc30d), | ||
| 157 | /* PDMA_MAIN1 - UART0-6 */ | 157 | /* PDMA_MAIN1 - UART0-6 */ |
| 158 | PSIL_PDMA_XY_PKT(0xc400), | 158 | PSIL_PDMA_XY_PKT(0xc400), |
| 159 | PSIL_PDMA_XY_PKT(0xc401), | 159 | PSIL_PDMA_XY_PKT(0xc401), |
| @@ -84,7 +84,9 @@ static struct psil_ep am62a_src_ep_map[] = { · 83 unmodified lines | |||
| 84 | PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), | 84 | PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), |
| 85 | PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), | 85 | PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), |
| 86 | PSIL_SAUL(0x7507, 23, 43, 8, 44, 0), | 86 | 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), | ||
| 88 | PSIL_PDMA_XY_PKT(0x4302), | 90 | PSIL_PDMA_XY_PKT(0x4302), |
| 89 | PSIL_PDMA_XY_PKT(0x4303), | 91 | PSIL_PDMA_XY_PKT(0x4303), |
| 90 | PSIL_PDMA_XY_PKT(0x4304), | 92 | PSIL_PDMA_XY_PKT(0x4304), |
| @@ -95,8 +97,6 @@ static struct psil_ep am62a_src_ep_map[] = { · 4 unmodified lines | |||
| 95 | PSIL_PDMA_XY_PKT(0x4309), | 97 | PSIL_PDMA_XY_PKT(0x4309), |
| 96 | PSIL_PDMA_XY_PKT(0x430a), | 98 | PSIL_PDMA_XY_PKT(0x430a), |
| 97 | PSIL_PDMA_XY_PKT(0x430b), | 99 | PSIL_PDMA_XY_PKT(0x430b), |
| 98 | PSIL_PDMA_XY_PKT(0x430c), | ||
| 99 | PSIL_PDMA_XY_PKT(0x430d), | ||
| 100 | /* PDMA_MAIN1 - UART0-6 */ | 100 | /* PDMA_MAIN1 - UART0-6 */ |
| 101 | PSIL_PDMA_XY_PKT(0x4400), | 101 | PSIL_PDMA_XY_PKT(0x4400), |
| 102 | PSIL_PDMA_XY_PKT(0x4401), | 102 | PSIL_PDMA_XY_PKT(0x4401), |
| @@ -151,7 +151,9 @@ static struct psil_ep am62a_dst_ep_map[] = { · 48 unmodified lines | |||
| 151 | /* SAUL */ | 151 | /* SAUL */ |
| 152 | PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), | 152 | PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), |
| 153 | PSIL_SAUL(0xf501, 28, 91, 8, 91, 1), | 153 | 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), | ||
| 155 | PSIL_PDMA_XY_PKT(0xc302), | 157 | PSIL_PDMA_XY_PKT(0xc302), |
| 156 | PSIL_PDMA_XY_PKT(0xc303), | 158 | PSIL_PDMA_XY_PKT(0xc303), |
| 157 | PSIL_PDMA_XY_PKT(0xc304), | 159 | PSIL_PDMA_XY_PKT(0xc304), |
| @@ -162,8 +164,6 @@ static struct psil_ep am62a_dst_ep_map[] = { · 4 unmodified lines | |||
| 162 | PSIL_PDMA_XY_PKT(0xc309), | 164 | PSIL_PDMA_XY_PKT(0xc309), |
| 163 | PSIL_PDMA_XY_PKT(0xc30a), | 165 | PSIL_PDMA_XY_PKT(0xc30a), |
| 164 | PSIL_PDMA_XY_PKT(0xc30b), | 166 | PSIL_PDMA_XY_PKT(0xc30b), |
| 165 | PSIL_PDMA_XY_PKT(0xc30c), | ||
| 166 | PSIL_PDMA_XY_PKT(0xc30d), | ||
| 167 | /* PDMA_MAIN1 - UART0-6 */ | 167 | /* PDMA_MAIN1 - UART0-6 */ |
| 168 | PSIL_PDMA_XY_PKT(0xc400), | 168 | PSIL_PDMA_XY_PKT(0xc400), |
| 169 | PSIL_PDMA_XY_PKT(0xc401), | 169 | PSIL_PDMA_XY_PKT(0xc401), |