From 62a74113c36127effea5467bc83dd9e35e0eac9f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 7 May 2020 18:06:56 +0200 Subject: [PATCH] 4.4-stable patches added patches: blk-mq-fix-undefined-behaviour-in-order_to_size.patch cxgb4-cxgb4vf-fixes-regression-in-perf-when-tx-vlan-offload-is-disabled.patch dm-fix-second-blk_delay_queue-parameter-to-be-in-msec-units-not-jiffies.patch dmaengine-edma-add-probe-callback-to-edma_tptc_driver.patch gfs2-fix-flock-panic-issue.patch net-dsa-mv88e6xxx-unlock-dsa-and-cpu-ports.patch openvswitch-update-checksum-in-push-pop-_mpls.patch revert-cpufreq-drop-rwsem-lock-around-cpufreq_gov_policy_exit.patch spi-rockchip-modify-dma-max-burst-to-1.patch --- ...undefined-behaviour-in-order_to_size.patch | 41 ++++++++++ ...erf-when-tx-vlan-offload-is-disabled.patch | 52 ++++++++++++ ...eter-to-be-in-msec-units-not-jiffies.patch | 35 ++++++++ ...d-probe-callback-to-edma_tptc_driver.patch | 43 ++++++++++ queue-4.4/gfs2-fix-flock-panic-issue.patch | 37 +++++++++ ...a-mv88e6xxx-unlock-dsa-and-cpu-ports.patch | 38 +++++++++ ...ch-update-checksum-in-push-pop-_mpls.patch | 72 +++++++++++++++++ ...-lock-around-cpufreq_gov_policy_exit.patch | 81 +++++++++++++++++++ queue-4.4/series | 9 +++ ...i-rockchip-modify-dma-max-burst-to-1.patch | 73 +++++++++++++++++ 10 files changed, 481 insertions(+) create mode 100644 queue-4.4/blk-mq-fix-undefined-behaviour-in-order_to_size.patch create mode 100644 queue-4.4/cxgb4-cxgb4vf-fixes-regression-in-perf-when-tx-vlan-offload-is-disabled.patch create mode 100644 queue-4.4/dm-fix-second-blk_delay_queue-parameter-to-be-in-msec-units-not-jiffies.patch create mode 100644 queue-4.4/dmaengine-edma-add-probe-callback-to-edma_tptc_driver.patch create mode 100644 queue-4.4/gfs2-fix-flock-panic-issue.patch create mode 100644 queue-4.4/net-dsa-mv88e6xxx-unlock-dsa-and-cpu-ports.patch create mode 100644 queue-4.4/openvswitch-update-checksum-in-push-pop-_mpls.patch create mode 100644 queue-4.4/revert-cpufreq-drop-rwsem-lock-around-cpufreq_gov_policy_exit.patch create mode 100644 queue-4.4/spi-rockchip-modify-dma-max-burst-to-1.patch diff --git a/queue-4.4/blk-mq-fix-undefined-behaviour-in-order_to_size.patch b/queue-4.4/blk-mq-fix-undefined-behaviour-in-order_to_size.patch new file mode 100644 index 00000000000..59cb2cfdbce --- /dev/null +++ b/queue-4.4/blk-mq-fix-undefined-behaviour-in-order_to_size.patch @@ -0,0 +1,41 @@ +From b3a834b1596ac668df206aa2bb1f191c31f5f5e4 Mon Sep 17 00:00:00 2001 +From: Bartlomiej Zolnierkiewicz +Date: Mon, 16 May 2016 09:54:47 -0600 +Subject: blk-mq: fix undefined behaviour in order_to_size() + +From: Bartlomiej Zolnierkiewicz + +commit b3a834b1596ac668df206aa2bb1f191c31f5f5e4 upstream. + +When this_order variable in blk_mq_init_rq_map() becomes zero +the code incorrectly decrements the variable and passes the result +to order_to_size() helper causing undefined behaviour: + + UBSAN: Undefined behaviour in block/blk-mq.c:1459:27 + shift exponent 4294967295 is too large for 32-bit type 'unsigned int' + CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc6-00072-g33656a1 #22 + +Fix the code by checking this_order variable for not having the zero +value first. + +Reported-by: Meelis Roos +Fixes: 320ae51feed5 ("blk-mq: new multi-queue block IO queueing mechanism") +Signed-off-by: Bartlomiej Zolnierkiewicz +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + +--- + block/blk-mq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -1491,7 +1491,7 @@ static struct blk_mq_tags *blk_mq_init_r + int to_do; + void *p; + +- while (left < order_to_size(this_order - 1) && this_order) ++ while (this_order && left < order_to_size(this_order - 1)) + this_order--; + + do { diff --git a/queue-4.4/cxgb4-cxgb4vf-fixes-regression-in-perf-when-tx-vlan-offload-is-disabled.patch b/queue-4.4/cxgb4-cxgb4vf-fixes-regression-in-perf-when-tx-vlan-offload-is-disabled.patch new file mode 100644 index 00000000000..49f13388bf1 --- /dev/null +++ b/queue-4.4/cxgb4-cxgb4vf-fixes-regression-in-perf-when-tx-vlan-offload-is-disabled.patch @@ -0,0 +1,52 @@ +From 8d09e6b8b9c9969ac59496dc21e10b67fe727e7e Mon Sep 17 00:00:00 2001 +From: Hariprasad Shenai +Date: Thu, 28 Jul 2016 13:28:57 +0530 +Subject: cxgb4/cxgb4vf: Fixes regression in perf when tx vlan offload is disabled + +From: Hariprasad Shenai + +commit 8d09e6b8b9c9969ac59496dc21e10b67fe727e7e upstream. + +The commit 637d3e997351 ("cxgb4: Discard the packet if the length is +greater than mtu") introduced a regression in the VLAN interface +performance when Tx VLAN offload is disabled. + +Check if skb is tagged, regardless of whether it is hardware accelerated +or not. Presently we were checking only for hardware acclereated one, +which caused performance to drop to ~0.17Mbps on a 10GbE adapter for +VLAN interface, when tx vlan offload is turned off using ethtool. +The ethernet head length calculation was going wrong in this case, and +driver ended up dropping packets. + +Fixes: 637d3e997351 ("cxgb4: Discard the packet if the length is greater than mtu") +Signed-off-by: Hariprasad Shenai +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/chelsio/cxgb4/sge.c | 2 +- + drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c +@@ -1165,7 +1165,7 @@ out_free: dev_kfree_skb_any(skb); + + /* Discard the packet if the length is greater than mtu */ + max_pkt_len = ETH_HLEN + dev->mtu; +- if (skb_vlan_tag_present(skb)) ++ if (skb_vlan_tagged(skb)) + max_pkt_len += VLAN_HLEN; + if (!skb_shinfo(skb)->gso_size && (unlikely(skb->len > max_pkt_len))) + goto out_free; +--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +@@ -1188,7 +1188,7 @@ int t4vf_eth_xmit(struct sk_buff *skb, s + + /* Discard the packet if the length is greater than mtu */ + max_pkt_len = ETH_HLEN + dev->mtu; +- if (skb_vlan_tag_present(skb)) ++ if (skb_vlan_tagged(skb)) + max_pkt_len += VLAN_HLEN; + if (!skb_shinfo(skb)->gso_size && (unlikely(skb->len > max_pkt_len))) + goto out_free; diff --git a/queue-4.4/dm-fix-second-blk_delay_queue-parameter-to-be-in-msec-units-not-jiffies.patch b/queue-4.4/dm-fix-second-blk_delay_queue-parameter-to-be-in-msec-units-not-jiffies.patch new file mode 100644 index 00000000000..cdee9deb6ba --- /dev/null +++ b/queue-4.4/dm-fix-second-blk_delay_queue-parameter-to-be-in-msec-units-not-jiffies.patch @@ -0,0 +1,35 @@ +From bd9f55ea1cf6e14eb054b06ea877d2d1fa339514 Mon Sep 17 00:00:00 2001 +From: Tahsin Erdogan +Date: Fri, 15 Jul 2016 06:27:08 -0700 +Subject: dm: fix second blk_delay_queue() parameter to be in msec units not jiffies + +From: Tahsin Erdogan + +commit bd9f55ea1cf6e14eb054b06ea877d2d1fa339514 upstream. + +Commit d548b34b062 ("dm: reduce the queue delay used in dm_request_fn +from 100ms to 10ms") always intended the value to be 10 msecs -- it +just expressed it in jiffies because earlier commit 7eaceaccab ("block: +remove per-queue plugging") did. + +Signed-off-by: Tahsin Erdogan +Signed-off-by: Mike Snitzer +Fixes: d548b34b062 ("dm: reduce the queue delay used in dm_request_fn from 100ms to 10ms") +Cc: stable@vger.kernel.org # 4.1+ -- stable@ backports must be applied to drivers/md/dm.c +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -2192,7 +2192,7 @@ static void dm_request_fn(struct request + goto out; + + delay_and_out: +- blk_delay_queue(q, HZ / 100); ++ blk_delay_queue(q, 10); + out: + dm_put_live_table(md, srcu_idx); + } diff --git a/queue-4.4/dmaengine-edma-add-probe-callback-to-edma_tptc_driver.patch b/queue-4.4/dmaengine-edma-add-probe-callback-to-edma_tptc_driver.patch new file mode 100644 index 00000000000..40ab5248f9b --- /dev/null +++ b/queue-4.4/dmaengine-edma-add-probe-callback-to-edma_tptc_driver.patch @@ -0,0 +1,43 @@ +From 4fa2d09c1ae879c2ee2760ab419a4f97026dd97b Mon Sep 17 00:00:00 2001 +From: Peter Ujfalusi +Date: Wed, 16 Dec 2015 15:19:05 +0200 +Subject: dmaengine: edma: Add probe callback to edma_tptc_driver + +From: Peter Ujfalusi + +commit 4fa2d09c1ae879c2ee2760ab419a4f97026dd97b upstream. + +Due to changes in device and platform code drivers w/o probe will fail to +load. This means that the devices for eDMA TPTCs are goign to be without +driver and omap hwmod code will turn them off after the kernel finished +loading: +[ 3.015900] platform 49800000.tptc: omap_device_late_idle: enabled but no driver. Idling +[ 3.024671] platform 49a00000.tptc: omap_device_late_idle: enabled but no driver. Idling + +This will prevent eDMA to work since the TPTCs are not enabled. + +Signed-off-by: Peter Ujfalusi +Fixes: 34635b1accb9 ("dmaengine: edma: Add dummy driver skeleton for edma3-tptc") +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/dma/edma.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/dma/edma.c ++++ b/drivers/dma/edma.c +@@ -2439,7 +2439,13 @@ static struct platform_driver edma_drive + }, + }; + ++static int edma_tptc_probe(struct platform_device *pdev) ++{ ++ return 0; ++} ++ + static struct platform_driver edma_tptc_driver = { ++ .probe = edma_tptc_probe, + .driver = { + .name = "edma3-tptc", + .of_match_table = edma_tptc_of_ids, diff --git a/queue-4.4/gfs2-fix-flock-panic-issue.patch b/queue-4.4/gfs2-fix-flock-panic-issue.patch new file mode 100644 index 00000000000..3e2e4155489 --- /dev/null +++ b/queue-4.4/gfs2-fix-flock-panic-issue.patch @@ -0,0 +1,37 @@ +From a93a99838248bdab49db2eaac00236847670bc7f Mon Sep 17 00:00:00 2001 +From: Junxiao Bi +Date: Tue, 22 Dec 2015 08:06:08 -0600 +Subject: gfs2: fix flock panic issue + +From: Junxiao Bi + +commit a93a99838248bdab49db2eaac00236847670bc7f upstream. + +Commit 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()") +moved flock/posix lock identify code to locks_lock_inode_wait(), but +missed to set fl_flags to FL_FLOCK which will cause kernel panic in +locks_lock_inode_wait(). + +Fixes: 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()") +Signed-off-by: Junxiao Bi +Signed-off-by: Bob Peterson +Signed-off-by: Greg Kroah-Hartman + +--- + fs/gfs2/file.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/fs/gfs2/file.c ++++ b/fs/gfs2/file.c +@@ -1035,7 +1035,10 @@ static int do_flock(struct file *file, i + if (fl_gh->gh_state == state) + goto out; + locks_lock_file_wait(file, +- &(struct file_lock){.fl_type = F_UNLCK}); ++ &(struct file_lock) { ++ .fl_type = F_UNLCK, ++ .fl_flags = FL_FLOCK ++ }); + gfs2_glock_dq(fl_gh); + gfs2_holder_reinit(state, flags, fl_gh); + } else { diff --git a/queue-4.4/net-dsa-mv88e6xxx-unlock-dsa-and-cpu-ports.patch b/queue-4.4/net-dsa-mv88e6xxx-unlock-dsa-and-cpu-ports.patch new file mode 100644 index 00000000000..9b53d857185 --- /dev/null +++ b/queue-4.4/net-dsa-mv88e6xxx-unlock-dsa-and-cpu-ports.patch @@ -0,0 +1,38 @@ +From 65fa40276ac1318e75264e5a204547b57c2cf397 Mon Sep 17 00:00:00 2001 +From: Vivien Didelot +Date: Thu, 14 Apr 2016 14:42:07 -0400 +Subject: net: dsa: mv88e6xxx: unlock DSA and CPU ports + +From: Vivien Didelot + +commit 65fa40276ac1318e75264e5a204547b57c2cf397 upstream. + +Locking a port generates an hardware interrupt when a new SA address is +received. This enables CPU directed learning, which is needed for 802.1X +MAC authentication. + +To disable automatic learning on a port, the only configuration needed +is to set its Port Association Vector to all zero. + +Clear PAV when SA learning should be disabled instead of locking a port. + +Fixes: 4c7ea3c0791e ("net: dsa: mv88e6xxx: disable SA learning for DSA and CPU ports") +Signed-off-by: Vivien Didelot +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/dsa/mv88e6xxx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/dsa/mv88e6xxx.c ++++ b/drivers/net/dsa/mv88e6xxx.c +@@ -2066,7 +2066,7 @@ static int mv88e6xxx_setup_port(struct d + reg = 1 << port; + /* Disable learning for DSA and CPU ports */ + if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) +- reg = PORT_ASSOC_VECTOR_LOCKED_PORT; ++ reg = 0; + + ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_ASSOC_VECTOR, reg); + if (ret) diff --git a/queue-4.4/openvswitch-update-checksum-in-push-pop-_mpls.patch b/queue-4.4/openvswitch-update-checksum-in-push-pop-_mpls.patch new file mode 100644 index 00000000000..44f63c6781e --- /dev/null +++ b/queue-4.4/openvswitch-update-checksum-in-push-pop-_mpls.patch @@ -0,0 +1,72 @@ +From bc7cc5999fd392cc799630d7e375b2f4e29cc398 Mon Sep 17 00:00:00 2001 +From: Simon Horman +Date: Mon, 30 May 2016 14:04:25 +0900 +Subject: openvswitch: update checksum in {push,pop}_mpls + +From: Simon Horman + +commit bc7cc5999fd392cc799630d7e375b2f4e29cc398 upstream. + +In the case of CHECKSUM_COMPLETE the skb checksum should be updated in +{push,pop}_mpls() as they the type in the ethernet header. + +As suggested by Pravin Shelar. + +Cc: Pravin Shelar +Fixes: 25cd9ba0abc0 ("openvswitch: Add basic MPLS support to kernel") +Signed-off-by: Simon Horman +Acked-by: Pravin B Shelar +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + net/openvswitch/actions.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +--- a/net/openvswitch/actions.c ++++ b/net/openvswitch/actions.c +@@ -137,11 +137,23 @@ static bool is_flow_key_valid(const stru + return !!key->eth.type; + } + ++static void update_ethertype(struct sk_buff *skb, struct ethhdr *hdr, ++ __be16 ethertype) ++{ ++ if (skb->ip_summed == CHECKSUM_COMPLETE) { ++ __be16 diff[] = { ~(hdr->h_proto), ethertype }; ++ ++ skb->csum = ~csum_partial((char *)diff, sizeof(diff), ++ ~skb->csum); ++ } ++ ++ hdr->h_proto = ethertype; ++} ++ + static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, + const struct ovs_action_push_mpls *mpls) + { + __be32 *new_mpls_lse; +- struct ethhdr *hdr; + + /* Networking stack do not allow simultaneous Tunnel and MPLS GSO. */ + if (skb->encapsulation) +@@ -160,9 +172,7 @@ static int push_mpls(struct sk_buff *skb + + skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN); + +- hdr = eth_hdr(skb); +- hdr->h_proto = mpls->mpls_ethertype; +- ++ update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype); + if (!skb->inner_protocol) + skb_set_inner_protocol(skb, skb->protocol); + skb->protocol = mpls->mpls_ethertype; +@@ -193,7 +203,7 @@ static int pop_mpls(struct sk_buff *skb, + * field correctly in the presence of VLAN tags. + */ + hdr = (struct ethhdr *)(skb_mpls_header(skb) - ETH_HLEN); +- hdr->h_proto = ethertype; ++ update_ethertype(skb, hdr, ethertype); + if (eth_p_mpls(skb->protocol)) + skb->protocol = ethertype; + diff --git a/queue-4.4/revert-cpufreq-drop-rwsem-lock-around-cpufreq_gov_policy_exit.patch b/queue-4.4/revert-cpufreq-drop-rwsem-lock-around-cpufreq_gov_policy_exit.patch new file mode 100644 index 00000000000..3ed30629e1e --- /dev/null +++ b/queue-4.4/revert-cpufreq-drop-rwsem-lock-around-cpufreq_gov_policy_exit.patch @@ -0,0 +1,81 @@ +From 68e80dae09033d778b98dc88e5bfe8fdade188e5 Mon Sep 17 00:00:00 2001 +From: Viresh Kumar +Date: Tue, 9 Feb 2016 09:01:35 +0530 +Subject: Revert "cpufreq: Drop rwsem lock around CPUFREQ_GOV_POLICY_EXIT" + +From: Viresh Kumar + +commit 68e80dae09033d778b98dc88e5bfe8fdade188e5 upstream. + +Earlier, when the struct freq-attr was used to represent governor +attributes, the standard cpufreq show/store sysfs attribute callbacks +were applied to the governor tunable attributes and they always acquire +the policy->rwsem lock before carrying out the operation. That could +have resulted in an ABBA deadlock if governor tunable attributes are +removed under policy->rwsem while one of them is being accessed +concurrently (if sysfs attributes removal wins the race, it will wait +for the access to complete with policy->rwsem held while the attribute +callback will block on policy->rwsem indefinitely). + +We attempted to address this issue by dropping policy->rwsem around +governor tunable attributes removal (that is, around invocations of the +->governor callback with the event arg equal to CPUFREQ_GOV_POLICY_EXIT) +in cpufreq_set_policy(), but that opened up race conditions that had not +been possible with policy->rwsem held all the time. + +The previous commit, "cpufreq: governor: New sysfs show/store callbacks +for governor tunables", fixed the original ABBA deadlock by adding new +governor specific show/store callbacks. + +We don't have to drop rwsem around invocations of governor event +CPUFREQ_GOV_POLICY_EXIT anymore, and original fix can be reverted now. + +Fixes: 955ef4833574 (cpufreq: Drop rwsem lock around CPUFREQ_GOV_POLICY_EXIT) +Signed-off-by: Viresh Kumar +Reported-by: Juri Lelli +Tested-by: Juri Lelli +Tested-by: Shilpasri G Bhat +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/cpufreq.c | 5 ----- + include/linux/cpufreq.h | 4 ---- + 2 files changed, 9 deletions(-) + +--- a/drivers/cpufreq/cpufreq.c ++++ b/drivers/cpufreq/cpufreq.c +@@ -2171,10 +2171,7 @@ static int cpufreq_set_policy(struct cpu + return ret; + } + +- up_write(&policy->rwsem); + ret = __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); +- down_write(&policy->rwsem); +- + if (ret) { + pr_err("%s: Failed to Exit Governor: %s (%d)\n", + __func__, old_gov->name, ret); +@@ -2190,9 +2187,7 @@ static int cpufreq_set_policy(struct cpu + if (!ret) + goto out; + +- up_write(&policy->rwsem); + __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); +- down_write(&policy->rwsem); + } + + /* new governor failed, so re-start old one */ +--- a/include/linux/cpufreq.h ++++ b/include/linux/cpufreq.h +@@ -100,10 +100,6 @@ struct cpufreq_policy { + * - Any routine that will write to the policy structure and/or may take away + * the policy altogether (eg. CPU hotplug), will hold this lock in write + * mode before doing so. +- * +- * Additional rules: +- * - Lock should not be held across +- * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); + */ + struct rw_semaphore rwsem; + diff --git a/queue-4.4/series b/queue-4.4/series index 5417028899b..a0a7215a825 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -250,3 +250,12 @@ xprtrdma-fix-backchannel-allocation-of-extra-rpcrdma_reps.patch alsa-fm801-initialize-chip-after-irq-handler-is-registered.patch bonding-fix-length-of-actor-system.patch mips-perf-remove-incorrect-odd-even-counter-handling-for-i6400.patch +revert-cpufreq-drop-rwsem-lock-around-cpufreq_gov_policy_exit.patch +net-dsa-mv88e6xxx-unlock-dsa-and-cpu-ports.patch +gfs2-fix-flock-panic-issue.patch +blk-mq-fix-undefined-behaviour-in-order_to_size.patch +dm-fix-second-blk_delay_queue-parameter-to-be-in-msec-units-not-jiffies.patch +dmaengine-edma-add-probe-callback-to-edma_tptc_driver.patch +spi-rockchip-modify-dma-max-burst-to-1.patch +openvswitch-update-checksum-in-push-pop-_mpls.patch +cxgb4-cxgb4vf-fixes-regression-in-perf-when-tx-vlan-offload-is-disabled.patch diff --git a/queue-4.4/spi-rockchip-modify-dma-max-burst-to-1.patch b/queue-4.4/spi-rockchip-modify-dma-max-burst-to-1.patch new file mode 100644 index 00000000000..ac10cdf2240 --- /dev/null +++ b/queue-4.4/spi-rockchip-modify-dma-max-burst-to-1.patch @@ -0,0 +1,73 @@ +From 80abf8880cc6e1594c11b7c417f22dde60e25312 Mon Sep 17 00:00:00 2001 +From: Addy Ke +Date: Fri, 22 Jan 2016 19:06:52 +0800 +Subject: spi: rockchip: modify DMA max burst to 1 + +From: Addy Ke + +commit 80abf8880cc6e1594c11b7c417f22dde60e25312 upstream. + +Generic dma controller on Rockchips' platform cannot support +DMAFLUSHP instruction which make dma to flush the req of non-aligned +or non-multiple of what we need. That will cause an unrecoverable +dma bus error. The saftest way is to set dma max burst to 1. + +Signed-off-by: Addy ke +Fixes: 64e36824b32b06 ("spi/rockchip: add driver for Rockchip...") +Signed-off-by: Shawn Lin +cc: Heiko Stuebner +cc: Olof Johansson +cc: Doug Anderson +cc: Sonny Rao +Signed-off-by: Greg Kroah-Hartman + +Acked-by: Mark Brown +Signed-off-by: Caesar Wang +Signed-off-by: Vinod Koul + +--- + drivers/spi/spi-rockchip.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/spi/spi-rockchip.c ++++ b/drivers/spi/spi-rockchip.c +@@ -199,6 +199,7 @@ struct rockchip_spi { + struct sg_table rx_sg; + struct rockchip_spi_dma_data dma_rx; + struct rockchip_spi_dma_data dma_tx; ++ struct dma_slave_caps dma_caps; + }; + + static inline void spi_enable_chip(struct rockchip_spi *rs, int enable) +@@ -457,7 +458,10 @@ static void rockchip_spi_prepare_dma(str + rxconf.direction = rs->dma_rx.direction; + rxconf.src_addr = rs->dma_rx.addr; + rxconf.src_addr_width = rs->n_bytes; +- rxconf.src_maxburst = rs->n_bytes; ++ if (rs->dma_caps.max_burst > 4) ++ rxconf.src_maxburst = 4; ++ else ++ rxconf.src_maxburst = 1; + dmaengine_slave_config(rs->dma_rx.ch, &rxconf); + + rxdesc = dmaengine_prep_slave_sg( +@@ -474,7 +478,10 @@ static void rockchip_spi_prepare_dma(str + txconf.direction = rs->dma_tx.direction; + txconf.dst_addr = rs->dma_tx.addr; + txconf.dst_addr_width = rs->n_bytes; +- txconf.dst_maxburst = rs->n_bytes; ++ if (rs->dma_caps.max_burst > 4) ++ txconf.dst_maxburst = 4; ++ else ++ txconf.dst_maxburst = 1; + dmaengine_slave_config(rs->dma_tx.ch, &txconf); + + txdesc = dmaengine_prep_slave_sg( +@@ -738,6 +745,7 @@ static int rockchip_spi_probe(struct pla + } + + if (rs->dma_tx.ch && rs->dma_rx.ch) { ++ dma_get_slave_caps(rs->dma_rx.ch, &(rs->dma_caps)); + rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); + rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); + rs->dma_tx.direction = DMA_MEM_TO_DEV; -- 2.47.3