From: Sasha Levin Date: Sun, 29 Mar 2020 20:22:30 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v5.6.1~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6278e41d531f073189b816f1403b0538d1eadd92;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/arm64-dts-ls1043a-fman-erratum-a050385.patch b/queue-5.4/arm64-dts-ls1043a-fman-erratum-a050385.patch new file mode 100644 index 00000000000..04207118692 --- /dev/null +++ b/queue-5.4/arm64-dts-ls1043a-fman-erratum-a050385.patch @@ -0,0 +1,36 @@ +From 70dfc6272b48cb89582c15f0eb6014f195bd33a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Mar 2020 18:04:26 +0200 +Subject: arm64: dts: ls1043a: FMan erratum A050385 + +From: Madalin Bucur + +[ Upstream commit b54d3900862374e1bb2846e6b39d79c896c0b200 ] + +The LS1043A SoC is affected by the A050385 erratum stating that +FMAN DMA read or writes under heavy traffic load may cause FMAN +internal resource leak thus stopping further packet processing. + +Signed-off-by: Madalin Bucur +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +index 6082ae0221364..d237162a87446 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +@@ -20,6 +20,8 @@ + }; + + &fman0 { ++ fsl,erratum-a050385; ++ + /* these aliases provide the FMan ports mapping */ + enet0: ethernet@e0000 { + }; +-- +2.20.1 + diff --git a/queue-5.4/cgroup-v1-cgroup_pidlist_next-should-update-position.patch b/queue-5.4/cgroup-v1-cgroup_pidlist_next-should-update-position.patch new file mode 100644 index 00000000000..f624495e9a8 --- /dev/null +++ b/queue-5.4/cgroup-v1-cgroup_pidlist_next-should-update-position.patch @@ -0,0 +1,60 @@ +From 9f916cf4e8a76616557c282e0b76efe5045c1a9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Jan 2020 13:34:49 +0300 +Subject: cgroup-v1: cgroup_pidlist_next should update position index + +From: Vasily Averin + +[ Upstream commit db8dd9697238be70a6b4f9d0284cd89f59c0e070 ] + +if seq_file .next fuction does not change position index, +read after some lseek can generate unexpected output. + + # mount | grep cgroup + # dd if=/mnt/cgroup.procs bs=1 # normal output +... +1294 +1295 +1296 +1304 +1382 +584+0 records in +584+0 records out +584 bytes copied + +dd: /mnt/cgroup.procs: cannot skip to specified offset +83 <<< generates end of last line +1383 <<< ... and whole last line once again +0+1 records in +0+1 records out +8 bytes copied + +dd: /mnt/cgroup.procs: cannot skip to specified offset +1386 <<< generates last line anyway +0+1 records in +0+1 records out +5 bytes copied + +https://bugzilla.kernel.org/show_bug.cgi?id=206283 +Signed-off-by: Vasily Averin +Signed-off-by: Tejun Heo +Signed-off-by: Sasha Levin +--- + kernel/cgroup/cgroup-v1.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index 7f83f4121d8d0..2db582706ec5c 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -473,6 +473,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) + */ + p++; + if (p >= end) { ++ (*pos)++; + return NULL; + } else { + *pos = *p; +-- +2.20.1 + diff --git a/queue-5.4/cgroup1-don-t-call-release_agent-when-it-is.patch b/queue-5.4/cgroup1-don-t-call-release_agent-when-it-is.patch new file mode 100644 index 00000000000..5f244c31ce9 --- /dev/null +++ b/queue-5.4/cgroup1-don-t-call-release_agent-when-it-is.patch @@ -0,0 +1,43 @@ +From 577abda8949c22c75857badedaa69d28ecc9580c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Feb 2020 12:01:29 -0700 +Subject: cgroup1: don't call release_agent when it is "" + +From: Tycho Andersen + +[ Upstream commit 2e5383d7904e60529136727e49629a82058a5607 ] + +Older (and maybe current) versions of systemd set release_agent to "" when +shutting down, but do not set notify_on_release to 0. + +Since 64e90a8acb85 ("Introduce STATIC_USERMODEHELPER to mediate +call_usermodehelper()"), we filter out such calls when the user mode helper +path is "". However, when used in conjunction with an actual (i.e. non "") +STATIC_USERMODEHELPER, the path is never "", so the real usermode helper +will be called with argv[0] == "". + +Let's avoid this by not invoking the release_agent when it is "". + +Signed-off-by: Tycho Andersen +Signed-off-by: Tejun Heo +Signed-off-by: Sasha Levin +--- + kernel/cgroup/cgroup-v1.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index 2db582706ec5c..f684c82efc2ea 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -784,7 +784,7 @@ void cgroup1_release_agent(struct work_struct *work) + + pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); + agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL); +- if (!pathbuf || !agentbuf) ++ if (!pathbuf || !agentbuf || !strlen(agentbuf)) + goto out; + + spin_lock_irq(&css_set_lock); +-- +2.20.1 + diff --git a/queue-5.4/cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch b/queue-5.4/cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch new file mode 100644 index 00000000000..d512149e900 --- /dev/null +++ b/queue-5.4/cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch @@ -0,0 +1,90 @@ +From 3d3f252894b4ff900faa04b72241379f64254fee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Feb 2020 14:33:59 -0500 +Subject: cpupower: avoid multiple definition with gcc -fno-common + +From: Mike Gilbert + +[ Upstream commit 2de7fb60a4740135e03cf55c1982e393ccb87b6b ] + +Building cpupower with -fno-common in CFLAGS results in errors due to +multiple definitions of the 'cpu_count' and 'start_time' variables. + +./utils/idle_monitor/snb_idle.o:./utils/idle_monitor/cpupower-monitor.h:28: +multiple definition of `cpu_count'; +./utils/idle_monitor/nhm_idle.o:./utils/idle_monitor/cpupower-monitor.h:28: +first defined here +... +./utils/idle_monitor/cpuidle_sysfs.o:./utils/idle_monitor/cpuidle_sysfs.c:22: +multiple definition of `start_time'; +./utils/idle_monitor/amd_fam14h_idle.o:./utils/idle_monitor/amd_fam14h_idle.c:85: +first defined here + +The -fno-common option will be enabled by default in GCC 10. + +Bug: https://bugs.gentoo.org/707462 +Signed-off-by: Mike Gilbert +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +- + tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +- + tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++ + tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +- + 4 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +index 3f893b99b337c..555cb338a71a4 100644 +--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c ++++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +@@ -82,7 +82,7 @@ static struct pci_access *pci_acc; + static struct pci_dev *amd_fam14h_pci_dev; + static int nbp1_entered; + +-struct timespec start_time; ++static struct timespec start_time; + static unsigned long long timediff; + + #ifdef DEBUG +diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +index f634aeb65c5f6..7fb4f7a291ad5 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c ++++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor; + + static unsigned long long **previous_count; + static unsigned long long **current_count; +-struct timespec start_time; ++static struct timespec start_time; + static unsigned long long timediff; + + static int cpuidle_get_count_percent(unsigned int id, double *percent, +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +index d3c3e6e7aa26c..3d54fd4336261 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = { + 0 + }; + ++int cpu_count; ++ + static struct cpuidle_monitor *monitors[MONITORS_MAX]; + static unsigned int avail_monitors; + +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +index a2d901d3bfaf9..eafef38f1982e 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +@@ -25,7 +25,7 @@ + #endif + #define CSTATE_DESC_LEN 60 + +-int cpu_count; ++extern int cpu_count; + + /* Hard to define the right names ...: */ + enum power_range_e { +-- +2.20.1 + diff --git a/queue-5.4/dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch b/queue-5.4/dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch new file mode 100644 index 00000000000..555b6e92ead --- /dev/null +++ b/queue-5.4/dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch @@ -0,0 +1,57 @@ +From 794ba2e51c79279a4a53a6988d4acac5a7e94276 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Mar 2020 15:06:54 -0700 +Subject: dpaa_eth: Remove unnecessary boolean expression in dpaa_get_headroom + +From: Nathan Chancellor + +[ Upstream commit 7395f62d95aafacdb9bd4996ec2f95b4a655d7e6 ] + +Clang warns: + +drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2860:9: warning: +converting the result of '?:' with integer constants to a boolean always +evaluates to 'true' [-Wtautological-constant-compare] + return DPAA_FD_DATA_ALIGNMENT ? ALIGN(headroom, + ^ +drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:131:34: note: expanded +from macro 'DPAA_FD_DATA_ALIGNMENT' +\#define DPAA_FD_DATA_ALIGNMENT (fman_has_errata_a050385() ? 64 : 16) + ^ +1 warning generated. + +This was exposed by commit 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 +workaround") even though it appears to have been an issue since the +introductory commit 9ad1a3749333 ("dpaa_eth: add support for DPAA +Ethernet") since DPAA_FD_DATA_ALIGNMENT has never been able to be zero. + +Just replace the whole boolean expression with the true branch, as it is +always been true. + +Link: https://github.com/ClangBuiltLinux/linux/issues/928 +Signed-off-by: Nathan Chancellor +Reviewed-by: Madalin Bucur +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +index e130233b50853..00c4beb760c35 100644 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +@@ -2770,9 +2770,7 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) + headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE + + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE); + +- return DPAA_FD_DATA_ALIGNMENT ? ALIGN(headroom, +- DPAA_FD_DATA_ALIGNMENT) : +- headroom; ++ return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT); + } + + static int dpaa_eth_probe(struct platform_device *pdev) +-- +2.20.1 + diff --git a/queue-5.4/drivers-of-of_mdio.c-fix-of_mdiobus_register.patch b/queue-5.4/drivers-of-of_mdio.c-fix-of_mdiobus_register.patch new file mode 100644 index 00000000000..299668df4d4 --- /dev/null +++ b/queue-5.4/drivers-of-of_mdio.c-fix-of_mdiobus_register.patch @@ -0,0 +1,36 @@ +From e377e41d6a0e70d12a9912b5b643a6154a445d05 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Mar 2020 20:24:21 -0800 +Subject: drivers/of/of_mdio.c:fix of_mdiobus_register() + +From: Dajun Jin + +[ Upstream commit 209c65b61d94344522c41a83cd6ce51aac5fd0a4 ] + +When registers a phy_device successful, should terminate the loop +or the phy_device would be registered in other addr. If there are +multiple PHYs without reg properties, it will go wrong. + +Signed-off-by: Dajun Jin +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/of/of_mdio.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c +index bd6129db64178..c34a6df712adb 100644 +--- a/drivers/of/of_mdio.c ++++ b/drivers/of/of_mdio.c +@@ -268,6 +268,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) + rc = of_mdiobus_register_phy(mdio, child, addr); + if (rc && rc != -ENODEV) + goto unregister; ++ break; + } + } + } +-- +2.20.1 + diff --git a/queue-5.4/drm-amd-display-update-soc-bb-for-nv14.patch b/queue-5.4/drm-amd-display-update-soc-bb-for-nv14.patch new file mode 100644 index 00000000000..dee46fe7550 --- /dev/null +++ b/queue-5.4/drm-amd-display-update-soc-bb-for-nv14.patch @@ -0,0 +1,161 @@ +From 0b848284c6e2f81f89b0df2b395e345a430629cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Feb 2020 14:07:23 -0500 +Subject: drm/amd/display: update soc bb for nv14 + +From: Martin Leung + +[ Upstream commit d5349775c1726ce997b8eb4982cd85a01f1c8b42 ] + +[why] +nv14 previously inherited soc bb from generic dcn 2, did not match +watermark values according to memory team + +[how] +add nv14 specific soc bb: copy nv2 generic that it was +using from before, but changed num channels to 8 + +Signed-off-by: Martin Leung +Reviewed-by: Jun Lei +Acked-by: Rodrigo Siqueira +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../drm/amd/display/dc/dcn20/dcn20_resource.c | 114 ++++++++++++++++++ + 1 file changed, 114 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +index 3b7769a3e67e3..c13dce760098c 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +@@ -269,6 +269,117 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = { + .use_urgent_burst_bw = 0 + }; + ++struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = { ++ .clock_limits = { ++ { ++ .state = 0, ++ .dcfclk_mhz = 560.0, ++ .fabricclk_mhz = 560.0, ++ .dispclk_mhz = 513.0, ++ .dppclk_mhz = 513.0, ++ .phyclk_mhz = 540.0, ++ .socclk_mhz = 560.0, ++ .dscclk_mhz = 171.0, ++ .dram_speed_mts = 8960.0, ++ }, ++ { ++ .state = 1, ++ .dcfclk_mhz = 694.0, ++ .fabricclk_mhz = 694.0, ++ .dispclk_mhz = 642.0, ++ .dppclk_mhz = 642.0, ++ .phyclk_mhz = 600.0, ++ .socclk_mhz = 694.0, ++ .dscclk_mhz = 214.0, ++ .dram_speed_mts = 11104.0, ++ }, ++ { ++ .state = 2, ++ .dcfclk_mhz = 875.0, ++ .fabricclk_mhz = 875.0, ++ .dispclk_mhz = 734.0, ++ .dppclk_mhz = 734.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 875.0, ++ .dscclk_mhz = 245.0, ++ .dram_speed_mts = 14000.0, ++ }, ++ { ++ .state = 3, ++ .dcfclk_mhz = 1000.0, ++ .fabricclk_mhz = 1000.0, ++ .dispclk_mhz = 1100.0, ++ .dppclk_mhz = 1100.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 1000.0, ++ .dscclk_mhz = 367.0, ++ .dram_speed_mts = 16000.0, ++ }, ++ { ++ .state = 4, ++ .dcfclk_mhz = 1200.0, ++ .fabricclk_mhz = 1200.0, ++ .dispclk_mhz = 1284.0, ++ .dppclk_mhz = 1284.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 1200.0, ++ .dscclk_mhz = 428.0, ++ .dram_speed_mts = 16000.0, ++ }, ++ /*Extra state, no dispclk ramping*/ ++ { ++ .state = 5, ++ .dcfclk_mhz = 1200.0, ++ .fabricclk_mhz = 1200.0, ++ .dispclk_mhz = 1284.0, ++ .dppclk_mhz = 1284.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 1200.0, ++ .dscclk_mhz = 428.0, ++ .dram_speed_mts = 16000.0, ++ }, ++ }, ++ .num_states = 5, ++ .sr_exit_time_us = 8.6, ++ .sr_enter_plus_exit_time_us = 10.9, ++ .urgent_latency_us = 4.0, ++ .urgent_latency_pixel_data_only_us = 4.0, ++ .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, ++ .urgent_latency_vm_data_only_us = 4.0, ++ .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096, ++ .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096, ++ .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096, ++ .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0, ++ .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0, ++ .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0, ++ .max_avg_sdp_bw_use_normal_percent = 40.0, ++ .max_avg_dram_bw_use_normal_percent = 40.0, ++ .writeback_latency_us = 12.0, ++ .ideal_dram_bw_after_urgent_percent = 40.0, ++ .max_request_size_bytes = 256, ++ .dram_channel_width_bytes = 2, ++ .fabric_datapath_to_dcn_data_return_bytes = 64, ++ .dcn_downspread_percent = 0.5, ++ .downspread_percent = 0.38, ++ .dram_page_open_time_ns = 50.0, ++ .dram_rw_turnaround_time_ns = 17.5, ++ .dram_return_buffer_per_channel_bytes = 8192, ++ .round_trip_ping_latency_dcfclk_cycles = 131, ++ .urgent_out_of_order_return_per_channel_bytes = 256, ++ .channel_interleave_bytes = 256, ++ .num_banks = 8, ++ .num_chans = 8, ++ .vmm_page_size_bytes = 4096, ++ .dram_clock_change_latency_us = 404.0, ++ .dummy_pstate_latency_us = 5.0, ++ .writeback_dram_clock_change_latency_us = 23.0, ++ .return_bus_width_bytes = 64, ++ .dispclk_dppclk_vco_speed_mhz = 3850, ++ .xfc_bus_transport_time_us = 20, ++ .xfc_xbuf_latency_tolerance_us = 4, ++ .use_urgent_burst_bw = 0 ++}; ++ + struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = { 0 }; + + #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL +@@ -3135,6 +3246,9 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s + static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb( + uint32_t hw_internal_rev) + { ++ if (ASICREV_IS_NAVI14_M(hw_internal_rev)) ++ return &dcn2_0_nv14_soc; ++ + if (ASICREV_IS_NAVI12_P(hw_internal_rev)) + return &dcn2_0_nv12_soc; + +-- +2.20.1 + diff --git a/queue-5.4/drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch b/queue-5.4/drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch new file mode 100644 index 00000000000..530d0726b0c --- /dev/null +++ b/queue-5.4/drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch @@ -0,0 +1,77 @@ +From caf1e4a784ab83a6411dd93cd7cfe267eacc01b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Mar 2020 17:03:48 +0800 +Subject: drm/amdgpu: correct ROM_INDEX/DATA offset for VEGA20 + +From: Hawking Zhang + +[ Upstream commit f1c2cd3f8fb959123a9beba18c0e8112dcb2e137 ] + +The ROMC_INDEX/DATA offset was changed to e4/e5 since +from smuio_v11 (vega20/arcturus). + +Signed-off-by: Hawking Zhang +Tested-by: Candice Li +Reviewed-by: Candice Li +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/soc15.c | 25 +++++++++++++++++++++++-- + 1 file changed, 23 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c +index 80934ca172607..c086262cc181d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c +@@ -84,6 +84,13 @@ + #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L + #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L + #define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 ++ ++/* for Vega20/arcturus regiter offset change */ ++#define mmROM_INDEX_VG20 0x00e4 ++#define mmROM_INDEX_VG20_BASE_IDX 0 ++#define mmROM_DATA_VG20 0x00e5 ++#define mmROM_DATA_VG20_BASE_IDX 0 ++ + /* + * Indirect registers accessor + */ +@@ -304,6 +311,8 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev, + { + u32 *dw_ptr; + u32 i, length_dw; ++ uint32_t rom_index_offset; ++ uint32_t rom_data_offset; + + if (bios == NULL) + return false; +@@ -316,11 +325,23 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev, + dw_ptr = (u32 *)bios; + length_dw = ALIGN(length_bytes, 4) / 4; + ++ switch (adev->asic_type) { ++ case CHIP_VEGA20: ++ case CHIP_ARCTURUS: ++ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX_VG20); ++ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA_VG20); ++ break; ++ default: ++ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX); ++ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA); ++ break; ++ } ++ + /* set rom index to 0 */ +- WREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX), 0); ++ WREG32(rom_index_offset, 0); + /* read out the rom data */ + for (i = 0; i < length_dw; i++) +- dw_ptr[i] = RREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA)); ++ dw_ptr[i] = RREG32(rom_data_offset); + + return true; + } +-- +2.20.1 + diff --git a/queue-5.4/drm-exynos-fix-cleanup-of-iommu-related-objects.patch b/queue-5.4/drm-exynos-fix-cleanup-of-iommu-related-objects.patch new file mode 100644 index 00000000000..4853bc5bc44 --- /dev/null +++ b/queue-5.4/drm-exynos-fix-cleanup-of-iommu-related-objects.patch @@ -0,0 +1,481 @@ +From 0996c11bfb5dcc82f2471ed0f049d0c414886d15 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Mar 2020 12:02:14 +0100 +Subject: drm/exynos: Fix cleanup of IOMMU related objects + +From: Marek Szyprowski + +[ Upstream commit 07dc3678bacc2a75b1900febea7d996a31f178a2 ] + +Store the IOMMU mapping created by the device core of each Exynos DRM +sub-device and restore it when the Exynos DRM driver is unbound. This +fixes IOMMU initialization failure for the second time when a deferred +probe is triggered from the bind() callback of master's compound DRM +driver. This also fixes the following issue found using kmemleak +detector: + +unreferenced object 0xc2137640 (size 64): + comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s) + hex dump (first 32 bytes): + 50 a3 14 c2 80 a2 14 c2 01 00 00 00 20 00 00 00 P........... ... + 00 10 00 00 00 80 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [<3acd268d>] arch_setup_dma_ops+0x4c/0x104 + [<9f7d2cce>] of_dma_configure+0x19c/0x3a4 + [] really_probe+0xb0/0x47c + [<4f510e4f>] driver_probe_device+0x78/0x1c4 + [<7481a0cf>] device_driver_attach+0x58/0x60 + [<0ff8f5c1>] __driver_attach+0xb8/0x158 + [<86006144>] bus_for_each_dev+0x74/0xb4 + [<10159dca>] bus_add_driver+0x1c0/0x200 + [<8a265265>] driver_register+0x74/0x108 + [] exynos_drm_init+0xb0/0x134 + [] do_one_initcall+0x90/0x458 + [<6da35917>] kernel_init_freeable+0x188/0x200 + [] kernel_init+0x8/0x110 + [<1f3cddf9>] ret_from_fork+0x14/0x20 + [<8cd12507>] 0x0 +unreferenced object 0xc214a280 (size 128): + comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s) + hex dump (first 32 bytes): + 00 a0 ec ed 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [<3acd268d>] arch_setup_dma_ops+0x4c/0x104 + [<9f7d2cce>] of_dma_configure+0x19c/0x3a4 + [] really_probe+0xb0/0x47c + [<4f510e4f>] driver_probe_device+0x78/0x1c4 + [<7481a0cf>] device_driver_attach+0x58/0x60 + [<0ff8f5c1>] __driver_attach+0xb8/0x158 + [<86006144>] bus_for_each_dev+0x74/0xb4 + [<10159dca>] bus_add_driver+0x1c0/0x200 + [<8a265265>] driver_register+0x74/0x108 + [] exynos_drm_init+0xb0/0x134 + [] do_one_initcall+0x90/0x458 + [<6da35917>] kernel_init_freeable+0x188/0x200 + [] kernel_init+0x8/0x110 + [<1f3cddf9>] ret_from_fork+0x14/0x20 + [<8cd12507>] 0x0 +unreferenced object 0xedeca000 (size 4096): + comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [<3acd268d>] arch_setup_dma_ops+0x4c/0x104 + [<9f7d2cce>] of_dma_configure+0x19c/0x3a4 + [] really_probe+0xb0/0x47c + [<4f510e4f>] driver_probe_device+0x78/0x1c4 + [<7481a0cf>] device_driver_attach+0x58/0x60 + [<0ff8f5c1>] __driver_attach+0xb8/0x158 + [<86006144>] bus_for_each_dev+0x74/0xb4 + [<10159dca>] bus_add_driver+0x1c0/0x200 + [<8a265265>] driver_register+0x74/0x108 + [] exynos_drm_init+0xb0/0x134 + [] do_one_initcall+0x90/0x458 + [<6da35917>] kernel_init_freeable+0x188/0x200 + [] kernel_init+0x8/0x110 + [<1f3cddf9>] ret_from_fork+0x14/0x20 + [<8cd12507>] 0x0 +unreferenced object 0xc214a300 (size 128): + comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s) + hex dump (first 32 bytes): + 00 a3 14 c2 00 a3 14 c2 00 40 18 c2 00 80 18 c2 .........@...... + 02 00 02 00 ad 4e ad de ff ff ff ff ff ff ff ff .....N.......... + backtrace: + [<08cbd8bc>] iommu_domain_alloc+0x24/0x50 + [] arm_iommu_create_mapping+0xe4/0x134 + [<3acd268d>] arch_setup_dma_ops+0x4c/0x104 + [<9f7d2cce>] of_dma_configure+0x19c/0x3a4 + [] really_probe+0xb0/0x47c + [<4f510e4f>] driver_probe_device+0x78/0x1c4 + [<7481a0cf>] device_driver_attach+0x58/0x60 + [<0ff8f5c1>] __driver_attach+0xb8/0x158 + [<86006144>] bus_for_each_dev+0x74/0xb4 + [<10159dca>] bus_add_driver+0x1c0/0x200 + [<8a265265>] driver_register+0x74/0x108 + [] exynos_drm_init+0xb0/0x134 + [] do_one_initcall+0x90/0x458 + [<6da35917>] kernel_init_freeable+0x188/0x200 + [] kernel_init+0x8/0x110 + [<1f3cddf9>] ret_from_fork+0x14/0x20 + +Signed-off-by: Marek Szyprowski +Reviewed-by: Lukasz Luba +Signed-off-by: Inki Dae +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 5 ++-- + drivers/gpu/drm/exynos/exynos7_drm_decon.c | 5 ++-- + drivers/gpu/drm/exynos/exynos_drm_dma.c | 28 +++++++++++++------ + drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 ++-- + drivers/gpu/drm/exynos/exynos_drm_fimc.c | 5 ++-- + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 ++-- + drivers/gpu/drm/exynos/exynos_drm_g2d.c | 5 ++-- + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 5 ++-- + drivers/gpu/drm/exynos/exynos_drm_rotator.c | 5 ++-- + drivers/gpu/drm/exynos/exynos_drm_scaler.c | 6 ++-- + drivers/gpu/drm/exynos/exynos_mixer.c | 7 +++-- + 11 files changed, 53 insertions(+), 29 deletions(-) + +diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +index 2d5cbfda3ca79..9c262daf5816e 100644 +--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c ++++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +@@ -55,6 +55,7 @@ static const char * const decon_clks_name[] = { + struct decon_context { + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; + struct exynos_drm_plane_config configs[WINDOWS_NR]; +@@ -644,7 +645,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) + + decon_clear_channels(ctx->crtc); + +- return exynos_drm_register_dma(drm_dev, dev); ++ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + } + + static void decon_unbind(struct device *dev, struct device *master, void *data) +@@ -654,7 +655,7 @@ static void decon_unbind(struct device *dev, struct device *master, void *data) + decon_disable(ctx->crtc); + + /* detach this sub driver from iommu mapping if supported. */ +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev); ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); + } + + static const struct component_ops decon_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c +index f0640950bd465..6fd40410dfd2e 100644 +--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c ++++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c +@@ -40,6 +40,7 @@ + struct decon_context { + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; + struct exynos_drm_plane_config configs[WINDOWS_NR]; +@@ -127,13 +128,13 @@ static int decon_ctx_initialize(struct decon_context *ctx, + + decon_clear_channels(ctx->crtc); + +- return exynos_drm_register_dma(drm_dev, ctx->dev); ++ return exynos_drm_register_dma(drm_dev, ctx->dev, &ctx->dma_priv); + } + + static void decon_ctx_remove(struct decon_context *ctx) + { + /* detach this sub driver from iommu mapping if supported. */ +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev); ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); + } + + static u32 decon_calc_clkdiv(struct decon_context *ctx, +diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c +index 9ebc02768847e..619f81435c1b2 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_dma.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c +@@ -58,7 +58,7 @@ static inline void clear_dma_max_seg_size(struct device *dev) + * mapping. + */ + static int drm_iommu_attach_device(struct drm_device *drm_dev, +- struct device *subdrv_dev) ++ struct device *subdrv_dev, void **dma_priv) + { + struct exynos_drm_private *priv = drm_dev->dev_private; + int ret; +@@ -74,7 +74,14 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, + return ret; + + if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { +- if (to_dma_iommu_mapping(subdrv_dev)) ++ /* ++ * Keep the original DMA mapping of the sub-device and ++ * restore it on Exynos DRM detach, otherwise the DMA ++ * framework considers it as IOMMU-less during the next ++ * probe (in case of deferred probe or modular build) ++ */ ++ *dma_priv = to_dma_iommu_mapping(subdrv_dev); ++ if (*dma_priv) + arm_iommu_detach_device(subdrv_dev); + + ret = arm_iommu_attach_device(subdrv_dev, priv->mapping); +@@ -98,19 +105,21 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, + * mapping + */ + static void drm_iommu_detach_device(struct drm_device *drm_dev, +- struct device *subdrv_dev) ++ struct device *subdrv_dev, void **dma_priv) + { + struct exynos_drm_private *priv = drm_dev->dev_private; + +- if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) ++ if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { + arm_iommu_detach_device(subdrv_dev); +- else if (IS_ENABLED(CONFIG_IOMMU_DMA)) ++ arm_iommu_attach_device(subdrv_dev, *dma_priv); ++ } else if (IS_ENABLED(CONFIG_IOMMU_DMA)) + iommu_detach_device(priv->mapping, subdrv_dev); + + clear_dma_max_seg_size(subdrv_dev); + } + +-int exynos_drm_register_dma(struct drm_device *drm, struct device *dev) ++int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv) + { + struct exynos_drm_private *priv = drm->dev_private; + +@@ -137,13 +146,14 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev) + priv->mapping = mapping; + } + +- return drm_iommu_attach_device(drm, dev); ++ return drm_iommu_attach_device(drm, dev, dma_priv); + } + +-void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev) ++void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv) + { + if (IS_ENABLED(CONFIG_EXYNOS_IOMMU)) +- drm_iommu_detach_device(drm, dev); ++ drm_iommu_detach_device(drm, dev, dma_priv); + } + + void exynos_drm_cleanup_dma(struct drm_device *drm) +diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h +index d4014ba592fdc..735f436c857cc 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h ++++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h +@@ -223,8 +223,10 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) + return priv->mapping ? true : false; + } + +-int exynos_drm_register_dma(struct drm_device *drm, struct device *dev); +-void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev); ++int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv); ++void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv); + void exynos_drm_cleanup_dma(struct drm_device *drm); + + #ifdef CONFIG_DRM_EXYNOS_DPI +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c +index 8ea2e1d77802a..29ab8be8604c9 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c +@@ -97,6 +97,7 @@ struct fimc_scaler { + struct fimc_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + struct exynos_drm_ipp_task *task; + struct exynos_drm_ipp_formats *formats; +@@ -1133,7 +1134,7 @@ static int fimc_bind(struct device *dev, struct device *master, void *data) + + ctx->drm_dev = drm_dev; + ipp->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | +@@ -1153,7 +1154,7 @@ static void fimc_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &ctx->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(drm_dev, dev); ++ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv); + } + + static const struct component_ops fimc_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c +index 8d0a929104e53..34e6b22173fae 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c +@@ -167,6 +167,7 @@ static struct fimd_driver_data exynos5420_fimd_driver_data = { + struct fimd_context { + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; + struct exynos_drm_plane_config configs[WINDOWS_NR]; +@@ -1090,7 +1091,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) + if (is_drm_iommu_supported(drm_dev)) + fimd_clear_channels(ctx->crtc); + +- return exynos_drm_register_dma(drm_dev, dev); ++ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + } + + static void fimd_unbind(struct device *dev, struct device *master, +@@ -1100,7 +1101,7 @@ static void fimd_unbind(struct device *dev, struct device *master, + + fimd_disable(ctx->crtc); + +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev); ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); + + if (ctx->encoder) + exynos_dpi_remove(ctx->encoder); +diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c +index 2a3382d43bc90..fcee33a43aca3 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c +@@ -232,6 +232,7 @@ struct g2d_runqueue_node { + + struct g2d_data { + struct device *dev; ++ void *dma_priv; + struct clk *gate_clk; + void __iomem *regs; + int irq; +@@ -1409,7 +1410,7 @@ static int g2d_bind(struct device *dev, struct device *master, void *data) + return ret; + } + +- ret = exynos_drm_register_dma(drm_dev, dev); ++ ret = exynos_drm_register_dma(drm_dev, dev, &g2d->dma_priv); + if (ret < 0) { + dev_err(dev, "failed to enable iommu.\n"); + g2d_fini_cmdlist(g2d); +@@ -1434,7 +1435,7 @@ static void g2d_unbind(struct device *dev, struct device *master, void *data) + priv->g2d_dev = NULL; + + cancel_work_sync(&g2d->runqueue_work); +- exynos_drm_unregister_dma(g2d->drm_dev, dev); ++ exynos_drm_unregister_dma(g2d->drm_dev, dev, &g2d->dma_priv); + } + + static const struct component_ops g2d_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c +index 88b6fcaa20be0..45e9aee8366a8 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c +@@ -97,6 +97,7 @@ struct gsc_scaler { + struct gsc_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + struct exynos_drm_ipp_task *task; + struct exynos_drm_ipp_formats *formats; +@@ -1169,7 +1170,7 @@ static int gsc_bind(struct device *dev, struct device *master, void *data) + + ctx->drm_dev = drm_dev; + ctx->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | +@@ -1189,7 +1190,7 @@ static void gsc_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &ctx->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(drm_dev, dev); ++ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv); + } + + static const struct component_ops gsc_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c +index b98482990d1ad..dafa87b820529 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c +@@ -56,6 +56,7 @@ struct rot_variant { + struct rot_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + void __iomem *regs; + struct clk *clock; +@@ -243,7 +244,7 @@ static int rotator_bind(struct device *dev, struct device *master, void *data) + + rot->drm_dev = drm_dev; + ipp->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &rot->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE, +@@ -261,7 +262,7 @@ static void rotator_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &rot->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(rot->drm_dev, rot->dev); ++ exynos_drm_unregister_dma(rot->drm_dev, rot->dev, &rot->dma_priv); + } + + static const struct component_ops rotator_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c +index 497973e9b2c55..93c43c8d914ee 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c +@@ -39,6 +39,7 @@ struct scaler_data { + struct scaler_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + void __iomem *regs; + struct clk *clock[SCALER_MAX_CLK]; +@@ -450,7 +451,7 @@ static int scaler_bind(struct device *dev, struct device *master, void *data) + + scaler->drm_dev = drm_dev; + ipp->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &scaler->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | +@@ -470,7 +471,8 @@ static void scaler_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &scaler->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev); ++ exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev, ++ &scaler->dma_priv); + } + + static const struct component_ops scaler_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c +index 7b24338fad3c8..22f494145411a 100644 +--- a/drivers/gpu/drm/exynos/exynos_mixer.c ++++ b/drivers/gpu/drm/exynos/exynos_mixer.c +@@ -94,6 +94,7 @@ struct mixer_context { + struct platform_device *pdev; + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[MIXER_WIN_NR]; + unsigned long flags; +@@ -894,12 +895,14 @@ static int mixer_initialize(struct mixer_context *mixer_ctx, + } + } + +- return exynos_drm_register_dma(drm_dev, mixer_ctx->dev); ++ return exynos_drm_register_dma(drm_dev, mixer_ctx->dev, ++ &mixer_ctx->dma_priv); + } + + static void mixer_ctx_remove(struct mixer_context *mixer_ctx) + { +- exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev); ++ exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev, ++ &mixer_ctx->dma_priv); + } + + static int mixer_enable_vblank(struct exynos_drm_crtc *crtc) +-- +2.20.1 + diff --git a/queue-5.4/dt-bindings-net-fman-erratum-a050385.patch b/queue-5.4/dt-bindings-net-fman-erratum-a050385.patch new file mode 100644 index 00000000000..9e30758012a --- /dev/null +++ b/queue-5.4/dt-bindings-net-fman-erratum-a050385.patch @@ -0,0 +1,89 @@ +From 1820910a32d75ba52a0a4140db5a0aec782bbdfd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Mar 2020 18:04:25 +0200 +Subject: dt-bindings: net: FMan erratum A050385 + +From: Madalin Bucur + +[ Upstream commit 26d5bb9e4c4b541c475751e015072eb2cbf70d15 ] + +FMAN DMA read or writes under heavy traffic load may cause FMAN +internal resource leak; thus stopping further packet processing. + +The FMAN internal queue can overflow when FMAN splits single +read or write transactions into multiple smaller transactions +such that more than 17 AXI transactions are in flight from FMAN +to interconnect. When the FMAN internal queue overflows, it can +stall further packet processing. The issue can occur with any one +of the following three conditions: + + 1. FMAN AXI transaction crosses 4K address boundary (Errata + A010022) + 2. FMAN DMA address for an AXI transaction is not 16 byte + aligned, i.e. the last 4 bits of an address are non-zero + 3. Scatter Gather (SG) frames have more than one SG buffer in + the SG list and any one of the buffers, except the last + buffer in the SG list has data size that is not a multiple + of 16 bytes, i.e., other than 16, 32, 48, 64, etc. + +With any one of the above three conditions present, there is +likelihood of stalled FMAN packet processing, especially under +stress with multiple ports injecting line-rate traffic. + +To avoid situations that stall FMAN packet processing, all of the +above three conditions must be avoided; therefore, configure the +system with the following rules: + + 1. Frame buffers must not span a 4KB address boundary, unless + the frame start address is 256 byte aligned + 2. All FMAN DMA start addresses (for example, BMAN buffer + address, FD[address] + FD[offset]) are 16B aligned + 3. SG table and buffer addresses are 16B aligned and the size + of SG buffers are multiple of 16 bytes, except for the last + SG buffer that can be of any size. + +Additional workaround notes: +- Address alignment of 64 bytes is recommended for maximally +efficient system bus transactions (although 16 byte alignment is +sufficient to avoid the stall condition) +- To support frame sizes that are larger than 4K bytes, there are +two options: + 1. Large single buffer frames that span a 4KB page boundary can + be converted into SG frames to avoid transaction splits at + the 4KB boundary, + 2. Align the large single buffer to 256B address boundaries, + ensure that the frame address plus offset is 256B aligned. +- If software generated SG frames have buffers that are unaligned +and with random non-multiple of 16 byte lengths, before +transmitting such frames via FMAN, frames will need to be copied +into a new single buffer or multiple buffer SG frame that is +compliant with the three rules listed above. + +Signed-off-by: Madalin Bucur +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + Documentation/devicetree/bindings/net/fsl-fman.txt | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt +index 299c0dcd67db4..1316f0aec0cf3 100644 +--- a/Documentation/devicetree/bindings/net/fsl-fman.txt ++++ b/Documentation/devicetree/bindings/net/fsl-fman.txt +@@ -110,6 +110,13 @@ PROPERTIES + Usage: required + Definition: See soc/fsl/qman.txt and soc/fsl/bman.txt + ++- fsl,erratum-a050385 ++ Usage: optional ++ Value type: boolean ++ Definition: A boolean property. Indicates the presence of the ++ erratum A050385 which indicates that DMA transactions that are ++ split can result in a FMan lock. ++ + ============================================================================= + FMan MURAM Node + +-- +2.20.1 + diff --git a/queue-5.4/fsl-fman-detect-fman-erratum-a050385.patch b/queue-5.4/fsl-fman-detect-fman-erratum-a050385.patch new file mode 100644 index 00000000000..3d44a8c4c3e --- /dev/null +++ b/queue-5.4/fsl-fman-detect-fman-erratum-a050385.patch @@ -0,0 +1,130 @@ +From c575659ceff4869e66828963393e9d1b7e53628f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Mar 2020 18:04:27 +0200 +Subject: fsl/fman: detect FMan erratum A050385 + +From: Madalin Bucur + +[ Upstream commit b281f7b93b258ce1419043bbd898a29254d5c9c7 ] + +Detect the presence of the A050385 erratum. + +Signed-off-by: Madalin Bucur +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/fman/Kconfig | 28 +++++++++++++++++++++ + drivers/net/ethernet/freescale/fman/fman.c | 18 +++++++++++++ + drivers/net/ethernet/freescale/fman/fman.h | 5 ++++ + 3 files changed, 51 insertions(+) + +diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig +index 0139cb9042ec7..34150182cc35c 100644 +--- a/drivers/net/ethernet/freescale/fman/Kconfig ++++ b/drivers/net/ethernet/freescale/fman/Kconfig +@@ -8,3 +8,31 @@ config FSL_FMAN + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support ++ ++config DPAA_ERRATUM_A050385 ++ bool ++ depends on ARM64 && FSL_DPAA ++ default y ++ help ++ DPAA FMan erratum A050385 software workaround implementation: ++ align buffers, data start, SG fragment length to avoid FMan DMA ++ splits. ++ FMAN DMA read or writes under heavy traffic load may cause FMAN ++ internal resource leak thus stopping further packet processing. ++ The FMAN internal queue can overflow when FMAN splits single ++ read or write transactions into multiple smaller transactions ++ such that more than 17 AXI transactions are in flight from FMAN ++ to interconnect. When the FMAN internal queue overflows, it can ++ stall further packet processing. The issue can occur with any ++ one of the following three conditions: ++ 1. FMAN AXI transaction crosses 4K address boundary (Errata ++ A010022) ++ 2. FMAN DMA address for an AXI transaction is not 16 byte ++ aligned, i.e. the last 4 bits of an address are non-zero ++ 3. Scatter Gather (SG) frames have more than one SG buffer in ++ the SG list and any one of the buffers, except the last ++ buffer in the SG list has data size that is not a multiple ++ of 16 bytes, i.e., other than 16, 32, 48, 64, etc. ++ With any one of the above three conditions present, there is ++ likelihood of stalled FMAN packet processing, especially under ++ stress with multiple ports injecting line-rate traffic. +diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c +index 210749bf1eac1..4c2fa13a7dd7b 100644 +--- a/drivers/net/ethernet/freescale/fman/fman.c ++++ b/drivers/net/ethernet/freescale/fman/fman.c +@@ -1,5 +1,6 @@ + /* + * Copyright 2008-2015 Freescale Semiconductor Inc. ++ * Copyright 2020 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +@@ -566,6 +567,10 @@ struct fman_cfg { + u32 qmi_def_tnums_thresh; + }; + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++static bool fman_has_err_a050385; ++#endif ++ + static irqreturn_t fman_exceptions(struct fman *fman, + enum fman_exceptions exception) + { +@@ -2514,6 +2519,14 @@ struct fman *fman_bind(struct device *fm_dev) + } + EXPORT_SYMBOL(fman_bind); + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++bool fman_has_errata_a050385(void) ++{ ++ return fman_has_err_a050385; ++} ++EXPORT_SYMBOL(fman_has_errata_a050385); ++#endif ++ + static irqreturn_t fman_err_irq(int irq, void *handle) + { + struct fman *fman = (struct fman *)handle; +@@ -2841,6 +2854,11 @@ static struct fman *read_dts_node(struct platform_device *of_dev) + goto fman_free; + } + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++ fman_has_err_a050385 = ++ of_property_read_bool(fm_node, "fsl,erratum-a050385"); ++#endif ++ + return fman; + + fman_node_put: +diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h +index 935c317fa6964..f2ede1360f03a 100644 +--- a/drivers/net/ethernet/freescale/fman/fman.h ++++ b/drivers/net/ethernet/freescale/fman/fman.h +@@ -1,5 +1,6 @@ + /* + * Copyright 2008-2015 Freescale Semiconductor Inc. ++ * Copyright 2020 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +@@ -398,6 +399,10 @@ u16 fman_get_max_frm(void); + + int fman_get_rx_extra_headroom(void); + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++bool fman_has_errata_a050385(void); ++#endif ++ + struct fman *fman_bind(struct device *dev); + + #endif /* __FM_H */ +-- +2.20.1 + diff --git a/queue-5.4/iommu-vt-d-fix-debugfs-register-reads.patch b/queue-5.4/iommu-vt-d-fix-debugfs-register-reads.patch new file mode 100644 index 00000000000..cc657b88ba1 --- /dev/null +++ b/queue-5.4/iommu-vt-d-fix-debugfs-register-reads.patch @@ -0,0 +1,123 @@ +From 019266d99d97202c2f08195202373996196458df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Mar 2020 13:09:46 -0700 +Subject: iommu/vt-d: Fix debugfs register reads + +From: Megha Dey + +[ Upstream commit ba3b01d7a6f4ab9f8a0557044c9a7678f64ae070 ] + +Commit 6825d3ea6cde ("iommu/vt-d: Add debugfs support to show register +contents") dumps the register contents for all IOMMU devices. + +Currently, a 64 bit read(dmar_readq) is done for all the IOMMU registers, +even though some of the registers are 32 bits, which is incorrect. + +Use the correct read function variant (dmar_readl/dmar_readq) while +reading the contents of 32/64 bit registers respectively. + +Signed-off-by: Megha Dey +Link: https://lore.kernel.org/r/1583784587-26126-2-git-send-email-megha.dey@linux.intel.com +Acked-by: Lu Baolu +Signed-off-by: Joerg Roedel +Signed-off-by: Sasha Levin +--- + drivers/iommu/intel-iommu-debugfs.c | 40 ++++++++++++++++++----------- + include/linux/intel-iommu.h | 2 ++ + 2 files changed, 27 insertions(+), 15 deletions(-) + +diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c +index 471f05d452e01..80378c10dd77a 100644 +--- a/drivers/iommu/intel-iommu-debugfs.c ++++ b/drivers/iommu/intel-iommu-debugfs.c +@@ -32,38 +32,42 @@ struct iommu_regset { + + #define IOMMU_REGSET_ENTRY(_reg_) \ + { DMAR_##_reg_##_REG, __stringify(_reg_) } +-static const struct iommu_regset iommu_regs[] = { ++ ++static const struct iommu_regset iommu_regs_32[] = { + IOMMU_REGSET_ENTRY(VER), +- IOMMU_REGSET_ENTRY(CAP), +- IOMMU_REGSET_ENTRY(ECAP), + IOMMU_REGSET_ENTRY(GCMD), + IOMMU_REGSET_ENTRY(GSTS), +- IOMMU_REGSET_ENTRY(RTADDR), +- IOMMU_REGSET_ENTRY(CCMD), + IOMMU_REGSET_ENTRY(FSTS), + IOMMU_REGSET_ENTRY(FECTL), + IOMMU_REGSET_ENTRY(FEDATA), + IOMMU_REGSET_ENTRY(FEADDR), + IOMMU_REGSET_ENTRY(FEUADDR), +- IOMMU_REGSET_ENTRY(AFLOG), + IOMMU_REGSET_ENTRY(PMEN), + IOMMU_REGSET_ENTRY(PLMBASE), + IOMMU_REGSET_ENTRY(PLMLIMIT), ++ IOMMU_REGSET_ENTRY(ICS), ++ IOMMU_REGSET_ENTRY(PRS), ++ IOMMU_REGSET_ENTRY(PECTL), ++ IOMMU_REGSET_ENTRY(PEDATA), ++ IOMMU_REGSET_ENTRY(PEADDR), ++ IOMMU_REGSET_ENTRY(PEUADDR), ++}; ++ ++static const struct iommu_regset iommu_regs_64[] = { ++ IOMMU_REGSET_ENTRY(CAP), ++ IOMMU_REGSET_ENTRY(ECAP), ++ IOMMU_REGSET_ENTRY(RTADDR), ++ IOMMU_REGSET_ENTRY(CCMD), ++ IOMMU_REGSET_ENTRY(AFLOG), + IOMMU_REGSET_ENTRY(PHMBASE), + IOMMU_REGSET_ENTRY(PHMLIMIT), + IOMMU_REGSET_ENTRY(IQH), + IOMMU_REGSET_ENTRY(IQT), + IOMMU_REGSET_ENTRY(IQA), +- IOMMU_REGSET_ENTRY(ICS), + IOMMU_REGSET_ENTRY(IRTA), + IOMMU_REGSET_ENTRY(PQH), + IOMMU_REGSET_ENTRY(PQT), + IOMMU_REGSET_ENTRY(PQA), +- IOMMU_REGSET_ENTRY(PRS), +- IOMMU_REGSET_ENTRY(PECTL), +- IOMMU_REGSET_ENTRY(PEDATA), +- IOMMU_REGSET_ENTRY(PEADDR), +- IOMMU_REGSET_ENTRY(PEUADDR), + IOMMU_REGSET_ENTRY(MTRRCAP), + IOMMU_REGSET_ENTRY(MTRRDEF), + IOMMU_REGSET_ENTRY(MTRR_FIX64K_00000), +@@ -126,10 +130,16 @@ static int iommu_regset_show(struct seq_file *m, void *unused) + * by adding the offset to the pointer (virtual address). + */ + raw_spin_lock_irqsave(&iommu->register_lock, flag); +- for (i = 0 ; i < ARRAY_SIZE(iommu_regs); i++) { +- value = dmar_readq(iommu->reg + iommu_regs[i].offset); ++ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_32); i++) { ++ value = dmar_readl(iommu->reg + iommu_regs_32[i].offset); ++ seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n", ++ iommu_regs_32[i].regs, iommu_regs_32[i].offset, ++ value); ++ } ++ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_64); i++) { ++ value = dmar_readq(iommu->reg + iommu_regs_64[i].offset); + seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n", +- iommu_regs[i].regs, iommu_regs[i].offset, ++ iommu_regs_64[i].regs, iommu_regs_64[i].offset, + value); + } + raw_spin_unlock_irqrestore(&iommu->register_lock, flag); +diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h +index 6d8bf4bdf240d..1e5dad8b8e59b 100644 +--- a/include/linux/intel-iommu.h ++++ b/include/linux/intel-iommu.h +@@ -120,6 +120,8 @@ + + #define dmar_readq(a) readq(a) + #define dmar_writeq(a,v) writeq(v,a) ++#define dmar_readl(a) readl(a) ++#define dmar_writel(a, v) writel(v, a) + + #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4) + #define DMAR_VER_MINOR(v) ((v) & 0x0f) +-- +2.20.1 + diff --git a/queue-5.4/iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch b/queue-5.4/iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch new file mode 100644 index 00000000000..e525fb71cd3 --- /dev/null +++ b/queue-5.4/iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch @@ -0,0 +1,91 @@ +From 1bc417631af079db3ec8affa89a37ee125e299c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Mar 2020 11:39:59 +0800 +Subject: iommu/vt-d: Populate debugfs if IOMMUs are detected + +From: Megha Dey + +[ Upstream commit 1da8347d8505c137fb07ff06bbcd3f2bf37409bc ] + +Currently, the intel iommu debugfs directory(/sys/kernel/debug/iommu/intel) +gets populated only when DMA remapping is enabled (dmar_disabled = 0) +irrespective of whether interrupt remapping is enabled or not. + +Instead, populate the intel iommu debugfs directory if any IOMMUs are +detected. + +Cc: Dan Carpenter +Fixes: ee2636b8670b1 ("iommu/vt-d: Enable base Intel IOMMU debugfs support") +Signed-off-by: Megha Dey +Signed-off-by: Lu Baolu +Signed-off-by: Joerg Roedel +Signed-off-by: Sasha Levin +--- + drivers/iommu/intel-iommu-debugfs.c | 11 ++++++++++- + drivers/iommu/intel-iommu.c | 4 +++- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c +index 80378c10dd77a..bdf095e9dbe03 100644 +--- a/drivers/iommu/intel-iommu-debugfs.c ++++ b/drivers/iommu/intel-iommu-debugfs.c +@@ -281,9 +281,16 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused) + { + struct dmar_drhd_unit *drhd; + struct intel_iommu *iommu; ++ u32 sts; + + rcu_read_lock(); + for_each_active_iommu(iommu, drhd) { ++ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); ++ if (!(sts & DMA_GSTS_TES)) { ++ seq_printf(m, "DMA Remapping is not enabled on %s\n", ++ iommu->name); ++ continue; ++ } + root_tbl_walk(m, iommu); + seq_putc(m, '\n'); + } +@@ -353,6 +360,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) + struct dmar_drhd_unit *drhd; + struct intel_iommu *iommu; + u64 irta; ++ u32 sts; + + rcu_read_lock(); + for_each_active_iommu(iommu, drhd) { +@@ -362,7 +370,8 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) + seq_printf(m, "Remapped Interrupt supported on IOMMU: %s\n", + iommu->name); + +- if (iommu->ir_table) { ++ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); ++ if (iommu->ir_table && (sts & DMA_GSTS_IRES)) { + irta = virt_to_phys(iommu->ir_table->base); + seq_printf(m, " IR table address:%llx\n", irta); + ir_tbl_remap_entry_show(m, iommu); +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 1c2b3e78056f4..9d47b227e5578 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -4961,6 +4961,9 @@ int __init intel_iommu_init(void) + + down_write(&dmar_global_lock); + ++ if (!no_iommu) ++ intel_iommu_debugfs_init(); ++ + if (no_iommu || dmar_disabled) { + /* + * We exit the function here to ensure IOMMU's remapping and +@@ -5056,7 +5059,6 @@ int __init intel_iommu_init(void) + pr_info("Intel(R) Virtualization Technology for Directed I/O\n"); + + intel_iommu_enabled = 1; +- intel_iommu_debugfs_init(); + + return 0; + +-- +2.20.1 + diff --git a/queue-5.4/iommu-vt-d-silence-rcu-list-debugging-warnings.patch b/queue-5.4/iommu-vt-d-silence-rcu-list-debugging-warnings.patch new file mode 100644 index 00000000000..a11add7a9aa --- /dev/null +++ b/queue-5.4/iommu-vt-d-silence-rcu-list-debugging-warnings.patch @@ -0,0 +1,72 @@ +From f0f687dfde7b107e412f6a9f276e2ac4a7b72f11 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Mar 2020 15:15:02 -0500 +Subject: iommu/vt-d: Silence RCU-list debugging warnings + +From: Qian Cai + +[ Upstream commit f5152416528c2295f35dd9c9bd4fb27c4032413d ] + +Similar to the commit 02d715b4a818 ("iommu/vt-d: Fix RCU list debugging +warnings"), there are several other places that call +list_for_each_entry_rcu() outside of an RCU read side critical section +but with dmar_global_lock held. Silence those false positives as well. + + drivers/iommu/intel-iommu.c:4288 RCU-list traversed in non-reader section!! + 1 lock held by swapper/0/1: + #0: ffffffff935892c8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1ad/0xb97 + + drivers/iommu/dmar.c:366 RCU-list traversed in non-reader section!! + 1 lock held by swapper/0/1: + #0: ffffffff935892c8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x125/0xb97 + + drivers/iommu/intel-iommu.c:5057 RCU-list traversed in non-reader section!! + 1 lock held by swapper/0/1: + #0: ffffffffa71892c8 (dmar_global_lock){++++}, at: intel_iommu_init+0x61a/0xb13 + +Signed-off-by: Qian Cai +Acked-by: Lu Baolu +Signed-off-by: Joerg Roedel +Signed-off-by: Sasha Levin +--- + drivers/iommu/dmar.c | 3 ++- + include/linux/dmar.h | 6 ++++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c +index 6a9a1b987520f..9e393b9c50911 100644 +--- a/drivers/iommu/dmar.c ++++ b/drivers/iommu/dmar.c +@@ -371,7 +371,8 @@ dmar_find_dmaru(struct acpi_dmar_hardware_unit *drhd) + { + struct dmar_drhd_unit *dmaru; + +- list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list) ++ list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list, ++ dmar_rcu_check()) + if (dmaru->segment == drhd->segment && + dmaru->reg_base_addr == drhd->address) + return dmaru; +diff --git a/include/linux/dmar.h b/include/linux/dmar.h +index d3ea390336f39..f397e52c2d9de 100644 +--- a/include/linux/dmar.h ++++ b/include/linux/dmar.h +@@ -74,11 +74,13 @@ extern struct list_head dmar_drhd_units; + dmar_rcu_check()) + + #define for_each_active_drhd_unit(drhd) \ +- list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ ++ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ ++ dmar_rcu_check()) \ + if (drhd->ignored) {} else + + #define for_each_active_iommu(i, drhd) \ +- list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ ++ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ ++ dmar_rcu_check()) \ + if (i=drhd->iommu, drhd->ignored) {} else + + #define for_each_iommu(i, drhd) \ +-- +2.20.1 + diff --git a/queue-5.4/mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch b/queue-5.4/mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch new file mode 100644 index 00000000000..0bbfa652afd --- /dev/null +++ b/queue-5.4/mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch @@ -0,0 +1,38 @@ +From 75a2041f4ebe3320fe11d419e28f3d85fa2680c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Mar 2020 15:04:09 +0100 +Subject: mac80211: Do not send mesh HWMP PREQ if HWMP is disabled + +From: Nicolas Cavallari + +[ Upstream commit ba32679cac50c38fdf488296f96b1f3175532b8e ] + +When trying to transmit to an unknown destination, the mesh code would +unconditionally transmit a HWMP PREQ even if HWMP is not the current +path selection algorithm. + +Signed-off-by: Nicolas Cavallari +Link: https://lore.kernel.org/r/20200305140409.12204-1-cavallar@lri.fr +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/mesh_hwmp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c +index d699833703819..38a0383dfbcfa 100644 +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -1152,7 +1152,8 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, + } + } + +- if (!(mpath->flags & MESH_PATH_RESOLVING)) ++ if (!(mpath->flags & MESH_PATH_RESOLVING) && ++ mesh_path_sel_is_hwmp(sdata)) + mesh_queue_preq(mpath, PREQ_Q_F_START); + + if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) +-- +2.20.1 + diff --git a/queue-5.4/net-hns3-fix-tc-qdisc-del-failed-issue.patch b/queue-5.4/net-hns3-fix-tc-qdisc-del-failed-issue.patch new file mode 100644 index 00000000000..0c41f36d515 --- /dev/null +++ b/queue-5.4/net-hns3-fix-tc-qdisc-del-failed-issue.patch @@ -0,0 +1,41 @@ +From e569010933084791f43eb437b967f741ecee0273 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Mar 2020 15:11:03 +0800 +Subject: net: hns3: fix "tc qdisc del" failed issue + +From: Yonglong Liu + +[ Upstream commit 5eb01ddfcfb25e6ebc404a41deae946bde776731 ] + +The HNS3 driver supports to configure TC numbers and TC to priority +map via "tc" tool. But when delete the rule, will fail, because +the HNS3 driver needs at least one TC, but the "tc" tool sets TC +number to zero when delete. + +This patch makes sure that the TC number is at least one. + +Fixes: 30d240dfa2e8 ("net: hns3: Add mqprio hardware offload support in hns3 driver") +Signed-off-by: Yonglong Liu +Signed-off-by: Huazhong Tan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +index 0c8d2269bc46e..403e0f089f2af 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +@@ -1596,7 +1596,7 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) + netif_dbg(h, drv, netdev, "setup tc: num_tc=%u\n", tc); + + return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ? +- kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP; ++ kinfo->dcb_ops->setup_tc(h, tc ? tc : 1, prio_tc) : -EOPNOTSUPP; + } + + static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type, +-- +2.20.1 + diff --git a/queue-5.4/nfs-add-minor-version-to-nfs_server_key-for-fscache.patch b/queue-5.4/nfs-add-minor-version-to-nfs_server_key-for-fscache.patch new file mode 100644 index 00000000000..7ec77091a5a --- /dev/null +++ b/queue-5.4/nfs-add-minor-version-to-nfs_server_key-for-fscache.patch @@ -0,0 +1,76 @@ +From bf132222f1cbca0cca6c54518a96910638005a25 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Feb 2020 16:29:32 -0500 +Subject: nfs: add minor version to nfs_server_key for fscache + +From: Scott Mayhew + +[ Upstream commit 55dee1bc0d72877b99805e42e0205087e98b9edd ] + +An NFS client that mounts multiple exports from the same NFS +server with higher NFSv4 versions disabled (i.e. 4.2) and without +forcing a specific NFS version results in fscache index cookie +collisions and the following messages: +[ 570.004348] FS-Cache: Duplicate cookie detected + +Each nfs_client structure should have its own fscache index cookie, +so add the minorversion to nfs_server_key. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=200145 +Signed-off-by: Scott Mayhew +Signed-off-by: Dave Wysochanski +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/client.c | 1 + + fs/nfs/fscache.c | 2 ++ + fs/nfs/nfs4client.c | 1 - + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fs/nfs/client.c b/fs/nfs/client.c +index 30838304a0bf2..a05f77f9c21ed 100644 +--- a/fs/nfs/client.c ++++ b/fs/nfs/client.c +@@ -153,6 +153,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) + if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) + goto error_0; + ++ clp->cl_minorversion = cl_init->minorversion; + clp->cl_nfs_mod = cl_init->nfs_mod; + if (!try_module_get(clp->cl_nfs_mod->owner)) + goto error_dealloc; +diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c +index 3800ab6f08fa8..a6dcc2151e779 100644 +--- a/fs/nfs/fscache.c ++++ b/fs/nfs/fscache.c +@@ -31,6 +31,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock); + struct nfs_server_key { + struct { + uint16_t nfsversion; /* NFS protocol version */ ++ uint32_t minorversion; /* NFSv4 minor version */ + uint16_t family; /* address family */ + __be16 port; /* IP port */ + } hdr; +@@ -55,6 +56,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp) + + memset(&key, 0, sizeof(key)); + key.hdr.nfsversion = clp->rpc_ops->version; ++ key.hdr.minorversion = clp->cl_minorversion; + key.hdr.family = clp->cl_addr.ss_family; + + switch (clp->cl_addr.ss_family) { +diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c +index da6204025a2db..914feab64702c 100644 +--- a/fs/nfs/nfs4client.c ++++ b/fs/nfs/nfs4client.c +@@ -216,7 +216,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) + INIT_LIST_HEAD(&clp->cl_ds_clients); + rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); + clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; +- clp->cl_minorversion = cl_init->minorversion; + clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; + clp->cl_mig_gen = 1; + #if IS_ENABLED(CONFIG_NFS_V4_1) +-- +2.20.1 + diff --git a/queue-5.4/s390-qeth-don-t-reset-default_out_queue.patch b/queue-5.4/s390-qeth-don-t-reset-default_out_queue.patch new file mode 100644 index 00000000000..95cc8513f22 --- /dev/null +++ b/queue-5.4/s390-qeth-don-t-reset-default_out_queue.patch @@ -0,0 +1,43 @@ +From 57d42f76b4123961eb6abc5feedff105a794296c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Mar 2020 18:38:01 +0100 +Subject: s390/qeth: don't reset default_out_queue + +From: Julian Wiedmann + +[ Upstream commit 240c1948491b81cfe40f84ea040a8f2a4966f101 ] + +When an OSA device in prio-queue setup is reduced to 1 TX queue due to +HW restrictions, we reset its the default_out_queue to 0. + +In the old code this was needed so that qeth_get_priority_queue() gets +the queue selection right. But with proper multiqueue support we already +reduced dev->real_num_tx_queues to 1, and so the stack puts all traffic +on txq 0 without even calling .ndo_select_queue. + +Thus we can preserve the user's configuration, and apply it if the OSA +device later re-gains support for multiple TX queues. + +Fixes: 73dc2daf110f ("s390/qeth: add TX multiqueue support for OSA devices") +Signed-off-by: Julian Wiedmann +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/s390/net/qeth_core_main.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index b727d1e34523e..ac8ad951a4203 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -1244,7 +1244,6 @@ static int qeth_osa_set_output_queues(struct qeth_card *card, bool single) + if (count == 1) + dev_info(&card->gdev->dev, "Priority Queueing not supported\n"); + +- card->qdio.default_out_queue = single ? 0 : QETH_DEFAULT_QUEUE; + card->qdio.no_out_queues = count; + return 0; + } +-- +2.20.1 + diff --git a/queue-5.4/s390-qeth-handle-error-when-backing-rx-buffer.patch b/queue-5.4/s390-qeth-handle-error-when-backing-rx-buffer.patch new file mode 100644 index 00000000000..2b368881aaf --- /dev/null +++ b/queue-5.4/s390-qeth-handle-error-when-backing-rx-buffer.patch @@ -0,0 +1,61 @@ +From e5975652f9f76d5295285196b05a75a374aed1ef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Mar 2020 18:38:02 +0100 +Subject: s390/qeth: handle error when backing RX buffer + +From: Julian Wiedmann + +[ Upstream commit 17413852804d7e86e6f0576cca32c1541817800e ] + +qeth_init_qdio_queues() fills the RX ring with an initial set of +RX buffers. If qeth_init_input_buffer() fails to back one of the RX +buffers with memory, we need to bail out and report the error. + +Fixes: 4a71df50047f ("qeth: new qeth device driver") +Signed-off-by: Julian Wiedmann +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/s390/net/qeth_core_main.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index ac8ad951a4203..fe70e9875bde0 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -2633,12 +2633,12 @@ static int qeth_init_input_buffer(struct qeth_card *card, + buf->rx_skb = netdev_alloc_skb(card->dev, + QETH_RX_PULL_LEN + ETH_HLEN); + if (!buf->rx_skb) +- return 1; ++ return -ENOMEM; + } + + pool_entry = qeth_find_free_buffer_pool_entry(card); + if (!pool_entry) +- return 1; ++ return -ENOBUFS; + + /* + * since the buffer is accessed only from the input_tasklet +@@ -2670,10 +2670,15 @@ int qeth_init_qdio_queues(struct qeth_card *card) + /* inbound queue */ + qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); + memset(&card->rx, 0, sizeof(struct qeth_rx)); ++ + qeth_initialize_working_pool_list(card); + /*give only as many buffers to hardware as we have buffer pool entries*/ +- for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; ++i) +- qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); ++ for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; i++) { ++ rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); ++ if (rc) ++ return rc; ++ } ++ + card->qdio.in_q->next_buf_to_init = + card->qdio.in_buf_pool.buf_count - 1; + rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0, +-- +2.20.1 + diff --git a/queue-5.4/scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch b/queue-5.4/scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch new file mode 100644 index 00000000000..b83728c3a96 --- /dev/null +++ b/queue-5.4/scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch @@ -0,0 +1,107 @@ +From d56d11be802f99ff3bf74464afb3f5ce172b3d5c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Mar 2020 09:57:28 -0600 +Subject: scsi: ipr: Fix softlockup when rescanning devices in petitboot + +From: Wen Xiong + +[ Upstream commit 394b61711f3ce33f75bf70a3e22938464a13b3ee ] + +When trying to rescan disks in petitboot shell, we hit the following +softlockup stacktrace: + +Kernel panic - not syncing: System is deadlocked on memory +[ 241.223394] CPU: 32 PID: 693 Comm: sh Not tainted 5.4.16-openpower1 #1 +[ 241.223406] Call Trace: +[ 241.223415] [c0000003f07c3180] [c000000000493fc4] dump_stack+0xa4/0xd8 (unreliable) +[ 241.223432] [c0000003f07c31c0] [c00000000007d4ac] panic+0x148/0x3cc +[ 241.223446] [c0000003f07c3260] [c000000000114b10] out_of_memory+0x468/0x4c4 +[ 241.223461] [c0000003f07c3300] [c0000000001472b0] __alloc_pages_slowpath+0x594/0x6d8 +[ 241.223476] [c0000003f07c3420] [c00000000014757c] __alloc_pages_nodemask+0x188/0x1a4 +[ 241.223492] [c0000003f07c34a0] [c000000000153e10] alloc_pages_current+0xcc/0xd8 +[ 241.223508] [c0000003f07c34e0] [c0000000001577ac] alloc_slab_page+0x30/0x98 +[ 241.223524] [c0000003f07c3520] [c0000000001597fc] new_slab+0x138/0x40c +[ 241.223538] [c0000003f07c35f0] [c00000000015b204] ___slab_alloc+0x1e4/0x404 +[ 241.223552] [c0000003f07c36c0] [c00000000015b450] __slab_alloc+0x2c/0x48 +[ 241.223566] [c0000003f07c36f0] [c00000000015b754] kmem_cache_alloc_node+0x9c/0x1b4 +[ 241.223582] [c0000003f07c3760] [c000000000218c48] blk_alloc_queue_node+0x34/0x270 +[ 241.223599] [c0000003f07c37b0] [c000000000226574] blk_mq_init_queue+0x2c/0x78 +[ 241.223615] [c0000003f07c37e0] [c0000000002ff710] scsi_mq_alloc_queue+0x28/0x70 +[ 241.223631] [c0000003f07c3810] [c0000000003005b8] scsi_alloc_sdev+0x184/0x264 +[ 241.223647] [c0000003f07c38a0] [c000000000300ba0] scsi_probe_and_add_lun+0x288/0xa3c +[ 241.223663] [c0000003f07c3a00] [c000000000301768] __scsi_scan_target+0xcc/0x478 +[ 241.223679] [c0000003f07c3b20] [c000000000301c64] scsi_scan_channel.part.9+0x74/0x7c +[ 241.223696] [c0000003f07c3b70] [c000000000301df4] scsi_scan_host_selected+0xe0/0x158 +[ 241.223712] [c0000003f07c3bd0] [c000000000303f04] store_scan+0x104/0x114 +[ 241.223727] [c0000003f07c3cb0] [c0000000002d5ac4] dev_attr_store+0x30/0x4c +[ 241.223741] [c0000003f07c3cd0] [c0000000001dbc34] sysfs_kf_write+0x64/0x78 +[ 241.223756] [c0000003f07c3cf0] [c0000000001da858] kernfs_fop_write+0x170/0x1b8 +[ 241.223773] [c0000003f07c3d40] [c0000000001621fc] __vfs_write+0x34/0x60 +[ 241.223787] [c0000003f07c3d60] [c000000000163c2c] vfs_write+0xa8/0xcc +[ 241.223802] [c0000003f07c3db0] [c000000000163df4] ksys_write+0x70/0xbc +[ 241.223816] [c0000003f07c3e20] [c00000000000b40c] system_call+0x5c/0x68 + +As a part of the scan process Linux will allocate and configure a +scsi_device for each target to be scanned. If the device is not present, +then the scsi_device is torn down. As a part of scsi_device teardown a +workqueue item will be scheduled and the lockups we see are because there +are 250k workqueue items to be processed. Accoding to the specification of +SIS-64 sas controller, max_channel should be decreased on SIS-64 adapters +to 4. + +The patch fixes softlockup issue. + +Thanks for Oliver Halloran's help with debugging and explanation! + +Link: https://lore.kernel.org/r/1583510248-23672-1-git-send-email-wenxiong@linux.vnet.ibm.com +Signed-off-by: Wen Xiong +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/ipr.c | 3 ++- + drivers/scsi/ipr.h | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c +index 079c04bc448af..7a57b61f0340e 100644 +--- a/drivers/scsi/ipr.c ++++ b/drivers/scsi/ipr.c +@@ -9947,6 +9947,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + ioa_cfg->max_devs_supported = ipr_max_devs; + + if (ioa_cfg->sis64) { ++ host->max_channel = IPR_MAX_SIS64_BUSES; + host->max_id = IPR_MAX_SIS64_TARGETS_PER_BUS; + host->max_lun = IPR_MAX_SIS64_LUNS_PER_TARGET; + if (ipr_max_devs > IPR_MAX_SIS64_DEVS) +@@ -9955,6 +9956,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + + ((sizeof(struct ipr_config_table_entry64) + * ioa_cfg->max_devs_supported))); + } else { ++ host->max_channel = IPR_VSET_BUS; + host->max_id = IPR_MAX_NUM_TARGETS_PER_BUS; + host->max_lun = IPR_MAX_NUM_LUNS_PER_TARGET; + if (ipr_max_devs > IPR_MAX_PHYSICAL_DEVS) +@@ -9964,7 +9966,6 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + * ioa_cfg->max_devs_supported))); + } + +- host->max_channel = IPR_VSET_BUS; + host->unique_id = host->host_no; + host->max_cmd_len = IPR_MAX_CDB_LEN; + host->can_queue = ioa_cfg->max_cmds; +diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h +index a67baeb36d1f7..b97aa9ac2ffe5 100644 +--- a/drivers/scsi/ipr.h ++++ b/drivers/scsi/ipr.h +@@ -1300,6 +1300,7 @@ struct ipr_resource_entry { + #define IPR_ARRAY_VIRTUAL_BUS 0x1 + #define IPR_VSET_VIRTUAL_BUS 0x2 + #define IPR_IOAFP_VIRTUAL_BUS 0x3 ++#define IPR_MAX_SIS64_BUSES 0x4 + + #define IPR_GET_RES_PHYS_LOC(res) \ + (((res)->bus << 24) | ((res)->target << 8) | (res)->lun) +-- +2.20.1 + diff --git a/queue-5.4/series b/queue-5.4/series index a2ec075d189..b35fb139024 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -51,3 +51,24 @@ net-mlx5e-enhance-icosq-wqe-info-fields.patch net-mlx5e-fix-missing-reset-of-sw-metadata-in-striding-rq-reset.patch net-mlx5e-fix-icosq-recovery-flow-with-striding-rq.patch net-mlx5e-do-not-recover-from-a-non-fatal-syndrome.patch +cgroup-v1-cgroup_pidlist_next-should-update-position.patch +nfs-add-minor-version-to-nfs_server_key-for-fscache.patch +cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch +drivers-of-of_mdio.c-fix-of_mdiobus_register.patch +cgroup1-don-t-call-release_agent-when-it-is.patch +dt-bindings-net-fman-erratum-a050385.patch +arm64-dts-ls1043a-fman-erratum-a050385.patch +fsl-fman-detect-fman-erratum-a050385.patch +drm-amd-display-update-soc-bb-for-nv14.patch +drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch +drm-exynos-fix-cleanup-of-iommu-related-objects.patch +iommu-vt-d-silence-rcu-list-debugging-warnings.patch +s390-qeth-don-t-reset-default_out_queue.patch +s390-qeth-handle-error-when-backing-rx-buffer.patch +scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch +mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch +dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch +sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch +net-hns3-fix-tc-qdisc-del-failed-issue.patch +iommu-vt-d-fix-debugfs-register-reads.patch +iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch diff --git a/queue-5.4/sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch b/queue-5.4/sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch new file mode 100644 index 00000000000..ae302b73848 --- /dev/null +++ b/queue-5.4/sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch @@ -0,0 +1,44 @@ +From 55b2042814e856bcbda4fd212ad9211b2e701174 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Mar 2020 16:22:50 +0100 +Subject: sxgbe: Fix off by one in samsung driver strncpy size arg + +From: Dominik Czarnota + +[ Upstream commit f3cc008bf6d59b8d93b4190e01d3e557b0040e15 ] + +This patch fixes an off-by-one error in strncpy size argument in +drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c. The issue is that in: + + strncmp(opt, "eee_timer:", 6) + +the passed string literal: "eee_timer:" has 10 bytes (without the NULL +byte) and the passed size argument is 6. As a result, the logic will +also accept other, malformed strings, e.g. "eee_tiXXX:". + +This bug doesn't seem to have any security impact since its present in +module's cmdline parsing code. + +Signed-off-by: Dominik Czarnota +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +index c56fcbb370665..38767d7979147 100644 +--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c ++++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +@@ -2279,7 +2279,7 @@ static int __init sxgbe_cmdline_opt(char *str) + if (!str || !*str) + return -EINVAL; + while ((opt = strsep(&str, ",")) != NULL) { +- if (!strncmp(opt, "eee_timer:", 6)) { ++ if (!strncmp(opt, "eee_timer:", 10)) { + if (kstrtoint(opt + 10, 0, &eee_timer)) + goto err; + } +-- +2.20.1 +