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