On Tue, May 20, 2025 at 06:37:35PM +0530, Bharat Bhushan wrote:
@@ -1519,22 +1520,27 @@ int otx2_cpt_discover_eng_capabilities(struct otx2_cptpf_dev *cptpf) if (ret) goto delete_grps;
- compl_rlen = ALIGN(sizeof(union otx2_cpt_res_s), OTX2_CPT_DMA_MINALIGN);
- len = compl_rlen + LOADFVC_RLEN;
- len = LOADFVC_RLEN + sizeof(union otx2_cpt_res_s) +
OTX2_CPT_RES_ADDR_ALIGN;
- result = kzalloc(len, GFP_KERNEL);
- if (!result) {
- rptr = kzalloc(len, GFP_KERNEL);
- if (!rptr) { ret = -ENOMEM; goto lf_cleanup; }
- rptr_baddr = dma_map_single(&pdev->dev, (void *)result, len,
- rptr_baddr = dma_map_single(&pdev->dev, rptr, len, DMA_BIDIRECTIONAL);
After this change rptr is still unaligned. However, you appear to be doing bidirectional DMA to rptr, so it should be aligned to ARCH_DMA_MINALIGN or you risk corrupting the surrounding memory.
Only TO_DEVICE DMA addresses can be unaligned.
Cheers,