Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull dmaengine fixes from Vinod Koul:
"Core:

- fix return value of is_slave_direction() for D2D dma

Driver fixes for:

- Documentaion fixes to resolve warnings for at_hdmac driver

- bunch of fsl driver fixes for memory leaks, and useless kfree

- TI edma and k3 fixes for packet error and null pointer checks"

* tag 'dmaengine-fix-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
dmaengine: at_hdmac: add missing kernel-doc style description
dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV
dmaengine: fsl-qdma: Remove a useless devm_kfree()
dmaengine: fsl-qdma: Fix a memory leak related to the queue command DMA
dmaengine: fsl-qdma: Fix a memory leak related to the status queue DMA
dmaengine: ti: k3-udma: Report short packet errors
dmaengine: ti: edma: Add some null pointer checks to the edma_probe
dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools
dmaengine: at_hdmac: fix some kernel-doc warnings

+59 -39
+21 -11
drivers/dma/at_hdmac.c
··· 222 222 * @vd: pointer to the virtual dma descriptor. 223 223 * @atchan: pointer to the atmel dma channel. 224 224 * @total_len: total transaction byte count 225 - * @sg_len: number of sg entries. 225 + * @sglen: number of sg entries. 226 226 * @sg: array of sgs. 227 + * @boundary: number of transfers to perform before the automatic address increment operation 228 + * @dst_hole: value to add to the destination address when the boundary has been reached 229 + * @src_hole: value to add to the source address when the boundary has been reached 230 + * @memset_buffer: buffer used for the memset operation 231 + * @memset_paddr: physical address of the buffer used for the memset operation 232 + * @memset_vaddr: virtual address of the buffer used for the memset operation 227 233 */ 228 234 struct at_desc { 229 235 struct virt_dma_desc vd; ··· 251 245 /*-- Channels --------------------------------------------------------*/ 252 246 253 247 /** 254 - * atc_status - information bits stored in channel status flag 248 + * enum atc_status - information bits stored in channel status flag 249 + * 250 + * @ATC_IS_PAUSED: If channel is pauses 251 + * @ATC_IS_CYCLIC: If channel is cyclic 255 252 * 256 253 * Manipulated with atomic operations. 257 254 */ ··· 291 282 u32 save_cfg; 292 283 u32 save_dscr; 293 284 struct dma_slave_config dma_sconfig; 294 - bool cyclic; 295 285 struct at_desc *desc; 296 286 }; 297 287 ··· 336 328 /** 337 329 * struct at_dma - internal representation of an Atmel HDMA Controller 338 330 * @dma_device: dmaengine dma_device object members 339 - * @atdma_devtype: identifier of DMA controller compatibility 340 - * @ch_regs: memory mapped register base 331 + * @regs: memory mapped register base 341 332 * @clk: dma controller clock 342 333 * @save_imr: interrupt mask register that is saved on suspend/resume cycle 343 334 * @all_chan_mask: all channels availlable in a mask 344 335 * @lli_pool: hw lli table 336 + * @memset_pool: hw memset pool 345 337 * @chan: channels table to store at_dma_chan structures 346 338 */ 347 339 struct at_dma { ··· 634 626 635 627 /** 636 628 * atc_get_llis_residue - Get residue for a hardware linked list transfer 629 + * @atchan: pointer to an atmel hdmac channel. 630 + * @desc: pointer to the descriptor for which the residue is calculated. 631 + * @residue: residue to be set to dma_tx_state. 637 632 * 638 633 * Calculate the residue by removing the length of the Linked List Item (LLI) 639 634 * already transferred from the total length. To get the current LLI we can use ··· 672 661 * two DSCR values are different, we read again the CTRLA then the DSCR till two 673 662 * consecutive read values from DSCR are equal or till the maximum trials is 674 663 * reach. This algorithm is very unlikely not to find a stable value for DSCR. 675 - * @atchan: pointer to an atmel hdmac channel. 676 - * @desc: pointer to the descriptor for which the residue is calculated. 677 - * @residue: residue to be set to dma_tx_state. 678 - * Returns 0 on success, -errno otherwise. 664 + * 665 + * Returns: %0 on success, -errno otherwise. 679 666 */ 680 667 static int atc_get_llis_residue(struct at_dma_chan *atchan, 681 668 struct at_desc *desc, u32 *residue) ··· 740 731 * @chan: DMA channel 741 732 * @cookie: transaction identifier to check status of 742 733 * @residue: residue to be updated. 743 - * Return 0 on success, -errono otherwise. 734 + * 735 + * Return: %0 on success, -errno otherwise. 744 736 */ 745 737 static int atc_get_residue(struct dma_chan *chan, dma_cookie_t cookie, 746 738 u32 *residue) ··· 1720 1710 * atc_alloc_chan_resources - allocate resources for DMA channel 1721 1711 * @chan: allocate descriptor resources for this channel 1722 1712 * 1723 - * return - the number of allocated descriptors 1713 + * Return: the number of allocated descriptors 1724 1714 */ 1725 1715 static int atc_alloc_chan_resources(struct dma_chan *chan) 1726 1716 {
+6 -4
drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
··· 38 38 if (!dpaa2_chan->fd_pool) 39 39 goto err; 40 40 41 - dpaa2_chan->fl_pool = dma_pool_create("fl_pool", dev, 42 - sizeof(struct dpaa2_fl_entry), 43 - sizeof(struct dpaa2_fl_entry), 0); 41 + dpaa2_chan->fl_pool = 42 + dma_pool_create("fl_pool", dev, 43 + sizeof(struct dpaa2_fl_entry) * 3, 44 + sizeof(struct dpaa2_fl_entry), 0); 45 + 44 46 if (!dpaa2_chan->fl_pool) 45 47 goto err_fd; 46 48 47 49 dpaa2_chan->sdd_pool = 48 50 dma_pool_create("sdd_pool", dev, 49 - sizeof(struct dpaa2_qdma_sd_d), 51 + sizeof(struct dpaa2_qdma_sd_d) * 2, 50 52 sizeof(struct dpaa2_qdma_sd_d), 0); 51 53 if (!dpaa2_chan->sdd_pool) 52 54 goto err_fl;
+12 -21
drivers/dma/fsl-qdma.c
··· 514 514 queue_temp = queue_head + i + (j * queue_num); 515 515 516 516 queue_temp->cq = 517 - dma_alloc_coherent(&pdev->dev, 518 - sizeof(struct fsl_qdma_format) * 519 - queue_size[i], 520 - &queue_temp->bus_addr, 521 - GFP_KERNEL); 517 + dmam_alloc_coherent(&pdev->dev, 518 + sizeof(struct fsl_qdma_format) * 519 + queue_size[i], 520 + &queue_temp->bus_addr, 521 + GFP_KERNEL); 522 522 if (!queue_temp->cq) 523 523 return NULL; 524 524 queue_temp->block_base = fsl_qdma->block_base + ··· 563 563 /* 564 564 * Buffer for queue command 565 565 */ 566 - status_head->cq = dma_alloc_coherent(&pdev->dev, 567 - sizeof(struct fsl_qdma_format) * 568 - status_size, 569 - &status_head->bus_addr, 570 - GFP_KERNEL); 571 - if (!status_head->cq) { 572 - devm_kfree(&pdev->dev, status_head); 566 + status_head->cq = dmam_alloc_coherent(&pdev->dev, 567 + sizeof(struct fsl_qdma_format) * 568 + status_size, 569 + &status_head->bus_addr, 570 + GFP_KERNEL); 571 + if (!status_head->cq) 573 572 return NULL; 574 - } 573 + 575 574 status_head->n_cq = status_size; 576 575 status_head->virt_head = status_head->cq; 577 576 status_head->virt_tail = status_head->cq; ··· 1267 1268 1268 1269 static void fsl_qdma_remove(struct platform_device *pdev) 1269 1270 { 1270 - int i; 1271 - struct fsl_qdma_queue *status; 1272 1271 struct device_node *np = pdev->dev.of_node; 1273 1272 struct fsl_qdma_engine *fsl_qdma = platform_get_drvdata(pdev); 1274 1273 ··· 1274 1277 fsl_qdma_cleanup_vchan(&fsl_qdma->dma_dev); 1275 1278 of_dma_controller_free(np); 1276 1279 dma_async_device_unregister(&fsl_qdma->dma_dev); 1277 - 1278 - for (i = 0; i < fsl_qdma->block_number; i++) { 1279 - status = fsl_qdma->status[i]; 1280 - dma_free_coherent(&pdev->dev, sizeof(struct fsl_qdma_format) * 1281 - status->n_cq, status->cq, status->bus_addr); 1282 - } 1283 1280 } 1284 1281 1285 1282 static const struct of_device_id fsl_qdma_dt_ids[] = {
+10
drivers/dma/ti/edma.c
··· 2404 2404 if (irq > 0) { 2405 2405 irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint", 2406 2406 dev_name(dev)); 2407 + if (!irq_name) { 2408 + ret = -ENOMEM; 2409 + goto err_disable_pm; 2410 + } 2411 + 2407 2412 ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name, 2408 2413 ecc); 2409 2414 if (ret) { ··· 2425 2420 if (irq > 0) { 2426 2421 irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint", 2427 2422 dev_name(dev)); 2423 + if (!irq_name) { 2424 + ret = -ENOMEM; 2425 + goto err_disable_pm; 2426 + } 2427 + 2428 2428 ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name, 2429 2429 ecc); 2430 2430 if (ret) {
+8 -2
drivers/dma/ti/k3-udma.c
··· 3968 3968 { 3969 3969 struct udma_chan *uc = to_udma_chan(&vc->chan); 3970 3970 struct udma_desc *d; 3971 + u8 status; 3971 3972 3972 3973 if (!vd) 3973 3974 return; ··· 3978 3977 if (d->metadata_size) 3979 3978 udma_fetch_epib(uc, d); 3980 3979 3981 - /* Provide residue information for the client */ 3982 3980 if (result) { 3983 3981 void *desc_vaddr = udma_curr_cppi5_desc_vaddr(d, d->desc_idx); 3984 3982 3985 3983 if (cppi5_desc_get_type(desc_vaddr) == 3986 3984 CPPI5_INFO0_DESC_TYPE_VAL_HOST) { 3985 + /* Provide residue information for the client */ 3987 3986 result->residue = d->residue - 3988 3987 cppi5_hdesc_get_pktlen(desc_vaddr); 3989 3988 if (result->residue) ··· 3992 3991 result->result = DMA_TRANS_NOERROR; 3993 3992 } else { 3994 3993 result->residue = 0; 3995 - result->result = DMA_TRANS_NOERROR; 3994 + /* Propagate TR Response errors to the client */ 3995 + status = d->hwdesc[0].tr_resp_base->status; 3996 + if (status) 3997 + result->result = DMA_TRANS_ABORTED; 3998 + else 3999 + result->result = DMA_TRANS_NOERROR; 3996 4000 } 3997 4001 } 3998 4002 }
+2 -1
include/linux/dmaengine.h
··· 953 953 954 954 static inline bool is_slave_direction(enum dma_transfer_direction direction) 955 955 { 956 - return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM); 956 + return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM) || 957 + (direction == DMA_DEV_TO_DEV); 957 958 } 958 959 959 960 static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(