board:imx8qxp-mek
code:imx-4.14.98-2.3.1
USB is used as a 2.0 composite device (2 CDC-ACM, 1 CDC-ECM).
when the usb is connect to pc, after multiple suspend/wake-up , there must be a DMA-map allocation failure error, after which any DMA-mapp assignment is failure (looks like an map and umap mismatch)
--------------------------
i also test as the following script for USB separately(usb configfs file as: usb-gadget.sh)
for (( ; ; ))
do
echo "" > /sys/kernel/config/usb_gadget/g1/UDC
msleep 500
echo "ci_hdrc.0" > /sys/kernel/config/usb_gadget/g1/UDC
msleep 1000
test_cnt=$[test_cnt + 1]
echo "test_cnt="$test_cnt
done
After reaching a number of times(about 2500), it can be reproduced.
---------------------------------------------------------------------------------------------------
some log as follow:
[11:06:11][ 7057.450529] configfs-gadget gadget: high-speed config #1: c
[11:06:11][ 7057.473679] br0: port 1(unetd0) entered blocking state
[11:06:11][ 7057.474343] br0: port 1(unetd0) entered forwarding state
[11:06:11][ 7057.873054] sdhci-esdhc-imx 5b010000.usdhc: swiotlb buffer is full (sz: 4096 bytes)
[11:06:11][ 7057.874040] sdhci-esdhc-imx 5b010000.usdhc: DMA: Out of SW-IOMMU space for 4096 bytes
[11:06:11][ 7057.875086] cqhci_dma_map: sg-len: 4
[11:06:11][ 7057.875545] mmc0: cqhci_prep_tran_desc: unable to map sg lists, -12
[11:06:11][ 7057.876338] mmc0: cqhci: failed to setup tx desc: -12
[11:06:11][ 7057.876997] print_req_error: I/O error, dev mmcblk0, sector 4091280
[11:06:11][ 7057.877851] Aborting journal on device mmcblk0p2-8.
[11:06:11][ 7057.879411] EXT4-fs error (device mmcblk0p2): ext4_journal_check_start:61: Detected aborted journal
[11:06:11][ 7057.880562] EXT4-fs (mmcblk0p2): Remounting filesystem read-only
[11:06:11]test_cnt=40
[11:06:12][ 7058.478710] br0: port 1(unetd0) entered disabled state
You may try to increase the IO_TLB_SEGSIZE in the include/linux/swiotlb.h.