From cddd4591404fb4c53dc0b3c0b15b942cdbed4356 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Fri, 10 Apr 2020 10:47:05 +0800 Subject: layerscape: add patches-5.4 Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu --- ...man-Avoid-variable-length-array-in-USDPAA.patch | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 target/linux/layerscape/patches-5.4/701-net-0111-sdk_qbman-Avoid-variable-length-array-in-USDPAA.patch (limited to 'target/linux/layerscape/patches-5.4/701-net-0111-sdk_qbman-Avoid-variable-length-array-in-USDPAA.patch') diff --git a/target/linux/layerscape/patches-5.4/701-net-0111-sdk_qbman-Avoid-variable-length-array-in-USDPAA.patch b/target/linux/layerscape/patches-5.4/701-net-0111-sdk_qbman-Avoid-variable-length-array-in-USDPAA.patch new file mode 100644 index 0000000000..39cfc2d0be --- /dev/null +++ b/target/linux/layerscape/patches-5.4/701-net-0111-sdk_qbman-Avoid-variable-length-array-in-USDPAA.patch @@ -0,0 +1,100 @@ +From 0ad840e46732e95df274a84b042dcb210be9f946 Mon Sep 17 00:00:00 2001 +From: Roy Pledge +Date: Thu, 28 Mar 2019 09:56:35 -0400 +Subject: [PATCH] sdk_qbman: Avoid variable length array in USDPAA + +As of Linux 5.0 variable length arrays on the stack are no +longer allowed. Change to a dynamic array and create a common +exit point in the function for cleanup. + +Signed-off-by: Roy Pledge +--- + drivers/staging/fsl_qbman/fsl_usdpaa.c | 36 +++++++++++++++++----------------- + 1 file changed, 18 insertions(+), 18 deletions(-) + +--- a/drivers/staging/fsl_qbman/fsl_usdpaa.c ++++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c +@@ -559,6 +559,7 @@ static bool check_portal_channel(void *c + + static int usdpaa_release(struct inode *inode, struct file *filp) + { ++ int err = 0; + struct ctx *ctx = filp->private_data; + struct mem_mapping *map, *tmpmap; + struct portal_mapping *portal, *tmpportal; +@@ -569,9 +570,14 @@ static int usdpaa_release(struct inode * + struct qm_portal_config *qm_alloced_portal = NULL; + struct bm_portal_config *bm_alloced_portal = NULL; + +- struct qm_portal *portal_array[qman_portal_max]; ++ struct qm_portal **portal_array; + int portal_count = 0; + ++ portal_array = kmalloc_array(qman_portal_max, ++ sizeof(struct qm_portal *), GFP_KERNEL); ++ if (!portal_array) ++ return -ENOMEM; ++ + /* Ensure the release operation cannot be migrated to another + CPU as CPU specific variables may be needed during cleanup */ + #ifdef CONFIG_PREEMPT_RT_FULL +@@ -612,18 +618,14 @@ static int usdpaa_release(struct inode * + qm_alloced_portal = qm_get_unused_portal(); + if (!qm_alloced_portal) { + pr_crit("No QMan portal avalaible for cleanup\n"); +-#ifdef CONFIG_PREEMPT_RT_FULL +- migrate_enable(); +-#endif +- return -1; ++ err = -1; ++ goto done; + } + qm_cleanup_portal = kmalloc(sizeof(struct qm_portal), + GFP_KERNEL); + if (!qm_cleanup_portal) { +-#ifdef CONFIG_PREEMPT_RT_FULL +- migrate_enable(); +-#endif +- return -ENOMEM; ++ err = -ENOMEM; ++ goto done; + } + init_qm_portal(qm_alloced_portal, qm_cleanup_portal); + portal_array[portal_count] = qm_cleanup_portal; +@@ -633,18 +635,14 @@ static int usdpaa_release(struct inode * + bm_alloced_portal = bm_get_unused_portal(); + if (!bm_alloced_portal) { + pr_crit("No BMan portal avalaible for cleanup\n"); +-#ifdef CONFIG_PREEMPT_RT_FULL +- migrate_enable(); +-#endif +- return -1; ++ err = -1; ++ goto done; + } + bm_cleanup_portal = kmalloc(sizeof(struct bm_portal), + GFP_KERNEL); + if (!bm_cleanup_portal) { +-#ifdef CONFIG_PREEMPT_RT_FULL +- migrate_enable(); +-#endif +- return -ENOMEM; ++ err = -ENOMEM; ++ goto done; + } + init_bm_portal(bm_alloced_portal, bm_cleanup_portal); + } +@@ -721,10 +719,12 @@ static int usdpaa_release(struct inode * + } + + kfree(ctx); ++done: + #ifdef CONFIG_PREEMPT_RT_FULL + migrate_enable(); + #endif +- return 0; ++ kfree(portal_array); ++ return err; + } + + static int check_mmap_dma(struct ctx *ctx, struct vm_area_struct *vma, -- cgit v1.2.3