From: Sasha Levin Date: Sun, 29 Mar 2020 20:22:30 +0000 (-0400) Subject: Fixes for 5.5 X-Git-Tag: v5.6.1~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8800f1d43ffbcde1354a03a27c30b82927b00bfe;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.5 Signed-off-by: Sasha Levin --- diff --git a/queue-5.5/cgroup-v1-cgroup_pidlist_next-should-update-position.patch b/queue-5.5/cgroup-v1-cgroup_pidlist_next-should-update-position.patch new file mode 100644 index 00000000000..5792fa392b3 --- /dev/null +++ b/queue-5.5/cgroup-v1-cgroup_pidlist_next-should-update-position.patch @@ -0,0 +1,60 @@ +From 19eb16aa67d90d5f3a245da9b8b19f5927733974 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 09f3a413f6f89..84bedb87ae137 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.5/cgroup1-don-t-call-release_agent-when-it-is.patch b/queue-5.5/cgroup1-don-t-call-release_agent-when-it-is.patch new file mode 100644 index 00000000000..158a0e183f3 --- /dev/null +++ b/queue-5.5/cgroup1-don-t-call-release_agent-when-it-is.patch @@ -0,0 +1,43 @@ +From b5e8cc98cfa7deac03062253005029222012a615 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 84bedb87ae137..a1fbf500d0af7 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -785,7 +785,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.5/cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch b/queue-5.5/cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch new file mode 100644 index 00000000000..9b2a03c1ef7 --- /dev/null +++ b/queue-5.5/cpupower-avoid-multiple-definition-with-gcc-fno-comm.patch @@ -0,0 +1,90 @@ +From 151c52c7b6eba7709c05d230e20072911c583ece 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 33dc34db4f3cc..20f46348271b1 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 3c4cee160b0e6..a65f7d011513a 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 6d44fec55ad5a..7c77045fef52f 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 5b5eb1da0cce3..c559d3115330a 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.5/dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch b/queue-5.5/dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch new file mode 100644 index 00000000000..3f791f71ea3 --- /dev/null +++ b/queue-5.5/dpaa_eth-remove-unnecessary-boolean-expression-in-dp.patch @@ -0,0 +1,57 @@ +From 181aced2046f7dd249ff2dffe84be8ddb73de8e7 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 36e2e28fa6e38..1e8dcae5f4b40 100644 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +@@ -2845,9 +2845,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.5/drivers-of-of_mdio.c-fix-of_mdiobus_register.patch b/queue-5.5/drivers-of-of_mdio.c-fix-of_mdiobus_register.patch new file mode 100644 index 00000000000..61ef3801a9b --- /dev/null +++ b/queue-5.5/drivers-of-of_mdio.c-fix-of_mdiobus_register.patch @@ -0,0 +1,36 @@ +From 371f6c2dd7caed006823c55d2709eb125856cf71 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 fc757ef6eadc5..a27234c58ec56 100644 +--- a/drivers/of/of_mdio.c ++++ b/drivers/of/of_mdio.c +@@ -269,6 +269,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.5/drm-amd-display-update-soc-bb-for-nv14.patch b/queue-5.5/drm-amd-display-update-soc-bb-for-nv14.patch new file mode 100644 index 00000000000..00c836e16f8 --- /dev/null +++ b/queue-5.5/drm-amd-display-update-soc-bb-for-nv14.patch @@ -0,0 +1,161 @@ +From d967146d7535d04c2a25ddfbe490a539ba70e9e0 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 23ff2f1c75b5c..41c4ee84f8bb5 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +@@ -337,6 +337,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 +@@ -3282,6 +3393,9 @@ void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st + 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.5/drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch b/queue-5.5/drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch new file mode 100644 index 00000000000..bc6f1e57805 --- /dev/null +++ b/queue-5.5/drm-amdgpu-correct-rom_index-data-offset-for-vega20.patch @@ -0,0 +1,77 @@ +From 8014bd0b5e4329eeca3317d281b75907cdb7efd2 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 624e223175c21..d6f4f825b439c 100644 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c +@@ -87,6 +87,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 + */ +@@ -307,6 +314,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; +@@ -319,11 +328,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.5/drm-exynos-fix-cleanup-of-iommu-related-objects.patch b/queue-5.5/drm-exynos-fix-cleanup-of-iommu-related-objects.patch new file mode 100644 index 00000000000..2c72377cb7a --- /dev/null +++ b/queue-5.5/drm-exynos-fix-cleanup-of-iommu-related-objects.patch @@ -0,0 +1,481 @@ +From 2cb1ae6ab3481a751cc291fb46741495e03d69b4 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 6cfdb95fef2fa..57e5e60577527 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.5/ibmvnic-do-not-process-device-remove-during-device-r.patch b/queue-5.5/ibmvnic-do-not-process-device-remove-during-device-r.patch new file mode 100644 index 00000000000..993d40a46d6 --- /dev/null +++ b/queue-5.5/ibmvnic-do-not-process-device-remove-during-device-r.patch @@ -0,0 +1,116 @@ +From beb077f68fc2a5609c746fd2bb8cd8472665f1c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Mar 2020 09:23:58 -0500 +Subject: ibmvnic: Do not process device remove during device reset + +From: Juliet Kim + +[ Upstream commit 7d7195a026bac47ac9943f11f84b7546276209dd ] + +The ibmvnic driver does not check the device state when the device +is removed. If the device is removed while a device reset is being +processed, the remove may free structures needed by the reset, +causing an oops. + +Fix this by checking the device state before processing device remove. + +Signed-off-by: Juliet Kim +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/ibm/ibmvnic.c | 24 ++++++++++++++++++++++-- + drivers/net/ethernet/ibm/ibmvnic.h | 6 +++++- + 2 files changed, 27 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index 830791ab4619c..3c7295056c85d 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -2142,6 +2142,8 @@ static void __ibmvnic_reset(struct work_struct *work) + { + struct ibmvnic_rwi *rwi; + struct ibmvnic_adapter *adapter; ++ bool saved_state = false; ++ unsigned long flags; + u32 reset_state; + int rc = 0; + +@@ -2153,17 +2155,25 @@ static void __ibmvnic_reset(struct work_struct *work) + return; + } + +- reset_state = adapter->state; +- + rwi = get_next_rwi(adapter); + while (rwi) { ++ spin_lock_irqsave(&adapter->state_lock, flags); ++ + if (adapter->state == VNIC_REMOVING || + adapter->state == VNIC_REMOVED) { ++ spin_unlock_irqrestore(&adapter->state_lock, flags); + kfree(rwi); + rc = EBUSY; + break; + } + ++ if (!saved_state) { ++ reset_state = adapter->state; ++ adapter->state = VNIC_RESETTING; ++ saved_state = true; ++ } ++ spin_unlock_irqrestore(&adapter->state_lock, flags); ++ + if (rwi->reset_reason == VNIC_RESET_CHANGE_PARAM) { + /* CHANGE_PARAM requestor holds rtnl_lock */ + rc = do_change_param_reset(adapter, rwi, reset_state); +@@ -5091,6 +5101,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) + __ibmvnic_delayed_reset); + INIT_LIST_HEAD(&adapter->rwi_list); + spin_lock_init(&adapter->rwi_lock); ++ spin_lock_init(&adapter->state_lock); + mutex_init(&adapter->fw_lock); + init_completion(&adapter->init_done); + init_completion(&adapter->fw_done); +@@ -5163,8 +5174,17 @@ static int ibmvnic_remove(struct vio_dev *dev) + { + struct net_device *netdev = dev_get_drvdata(&dev->dev); + struct ibmvnic_adapter *adapter = netdev_priv(netdev); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&adapter->state_lock, flags); ++ if (adapter->state == VNIC_RESETTING) { ++ spin_unlock_irqrestore(&adapter->state_lock, flags); ++ return -EBUSY; ++ } + + adapter->state = VNIC_REMOVING; ++ spin_unlock_irqrestore(&adapter->state_lock, flags); ++ + rtnl_lock(); + unregister_netdevice(netdev); + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h +index 60eccaf91b122..f8416e1d4cf09 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.h ++++ b/drivers/net/ethernet/ibm/ibmvnic.h +@@ -941,7 +941,8 @@ enum vnic_state {VNIC_PROBING = 1, + VNIC_CLOSING, + VNIC_CLOSED, + VNIC_REMOVING, +- VNIC_REMOVED}; ++ VNIC_REMOVED, ++ VNIC_RESETTING}; + + enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1, + VNIC_RESET_MOBILITY, +@@ -1090,4 +1091,7 @@ struct ibmvnic_adapter { + + struct ibmvnic_tunables desired; + struct ibmvnic_tunables fallback; ++ ++ /* Used for serializatin of state field */ ++ spinlock_t state_lock; + }; +-- +2.20.1 + diff --git a/queue-5.5/iommu-vt-d-fix-debugfs-register-reads.patch b/queue-5.5/iommu-vt-d-fix-debugfs-register-reads.patch new file mode 100644 index 00000000000..d49f7abc7dd --- /dev/null +++ b/queue-5.5/iommu-vt-d-fix-debugfs-register-reads.patch @@ -0,0 +1,123 @@ +From 64d4a5a506af09208f6104af16eb70649f9fb1d7 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.5/iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch b/queue-5.5/iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch new file mode 100644 index 00000000000..9e4558d81c2 --- /dev/null +++ b/queue-5.5/iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch @@ -0,0 +1,91 @@ +From e57aa1839456c835be59d618cc9d345eae3916b4 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 10176d8ea3e65..7f31775e9b554 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -5005,6 +5005,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 +@@ -5100,7 +5103,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.5/iommu-vt-d-silence-rcu-list-debugging-warnings.patch b/queue-5.5/iommu-vt-d-silence-rcu-list-debugging-warnings.patch new file mode 100644 index 00000000000..8e3649f9179 --- /dev/null +++ b/queue-5.5/iommu-vt-d-silence-rcu-list-debugging-warnings.patch @@ -0,0 +1,72 @@ +From 57b6868771385df8d992ea563ca04689ab0d3757 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 93f8e646cb0b0..f7a86652a9841 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 712be8bc6a7c8..d7bf029df737d 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.5/mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch b/queue-5.5/mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch new file mode 100644 index 00000000000..4cf5d8d1238 --- /dev/null +++ b/queue-5.5/mac80211-do-not-send-mesh-hwmp-preq-if-hwmp-is-disab.patch @@ -0,0 +1,38 @@ +From 109d4ebc75937fbff4c3054a79064d18012b426f 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.5/nfs-add-minor-version-to-nfs_server_key-for-fscache.patch b/queue-5.5/nfs-add-minor-version-to-nfs_server_key-for-fscache.patch new file mode 100644 index 00000000000..3e49850a4fb --- /dev/null +++ b/queue-5.5/nfs-add-minor-version-to-nfs_server_key-for-fscache.patch @@ -0,0 +1,76 @@ +From 1489ffa1526752fa0037763a27fcac5bb61a7343 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 02110a30a49ea..a851339defeb5 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 460d6251c405f..2c274fea80937 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.5/scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch b/queue-5.5/scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch new file mode 100644 index 00000000000..2e178708b9b --- /dev/null +++ b/queue-5.5/scsi-ipr-fix-softlockup-when-rescanning-devices-in-p.patch @@ -0,0 +1,107 @@ +From 3a6824c2c458c842462e1e2438a2c3aa113aeb2e 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.5/series b/queue-5.5/series index eab38a260f3..4536bc84f31 100644 --- a/queue-5.5/series +++ b/queue-5.5/series @@ -61,3 +61,20 @@ net-mlx5e-do-not-recover-from-a-non-fatal-syndrome.patch net-mlx5_core-set-ib-capability-mask1-to-fix-ib_srpt-connection-failure.patch net-mlx5e-ktls-fix-tcp-seq-off-by-1-issue-in-tx-resync-flow.patch net-mlx5e-fix-endianness-handling-in-pedit-mask.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 +veth-ignore-peer-tx_dropped-when-counting-local-rx_d.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 +ibmvnic-do-not-process-device-remove-during-device-r.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 +iommu-vt-d-fix-debugfs-register-reads.patch +iommu-vt-d-populate-debugfs-if-iommus-are-detected.patch diff --git a/queue-5.5/sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch b/queue-5.5/sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch new file mode 100644 index 00000000000..e00323ddb67 --- /dev/null +++ b/queue-5.5/sxgbe-fix-off-by-one-in-samsung-driver-strncpy-size-.patch @@ -0,0 +1,44 @@ +From 44fa0be6011c4950261c4573372082e3744cf841 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 52ed111d98f4d..15e3f668218b1 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 + diff --git a/queue-5.5/veth-ignore-peer-tx_dropped-when-counting-local-rx_d.patch b/queue-5.5/veth-ignore-peer-tx_dropped-when-counting-local-rx_d.patch new file mode 100644 index 00000000000..bd9a3511dfc --- /dev/null +++ b/queue-5.5/veth-ignore-peer-tx_dropped-when-counting-local-rx_d.patch @@ -0,0 +1,51 @@ +From 65d713aaeac5b90d1c19c81fef400e15e211b94a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Mar 2020 09:49:29 +0800 +Subject: veth: ignore peer tx_dropped when counting local rx_dropped + +From: Jiang Lidong + +[ Upstream commit e25d5dbcffae62c9a7fa03517dfa4b8e67670e3d ] + +When local NET_RX backlog is full due to traffic overrun, +peer veth tx_dropped counter increases. At that time, list +local veth stats, rx_dropped has double value of peer +tx_dropped, even bigger than transmit packets by peer. + +In NET_RX softirq process, if any packet drop case happens, +it increases dev's rx_dropped counter and returns NET_RX_DROP. + +At veth tx side, it records any error returned from peer netif_rx +into local dev tx_dropped counter. + +In veth get stats process, it puts local dev rx_dropped and +peer dev tx_dropped into together as local rx_drpped value. +So that it shows double value of real dropped packets number in +this case. + +This patch ignores peer tx_dropped when counting local rx_dropped, +since peer tx_dropped is duplicated to local rx_dropped at most cases. + +Signed-off-by: Jiang Lidong +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/veth.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/veth.c b/drivers/net/veth.c +index a552df37a347c..bad9e03cd32e7 100644 +--- a/drivers/net/veth.c ++++ b/drivers/net/veth.c +@@ -328,7 +328,7 @@ static void veth_get_stats64(struct net_device *dev, + rcu_read_lock(); + peer = rcu_dereference(priv->peer); + if (peer) { +- tot->rx_dropped += veth_stats_tx(peer, &packets, &bytes); ++ veth_stats_tx(peer, &packets, &bytes); + tot->rx_bytes += bytes; + tot->rx_packets += packets; + +-- +2.20.1 +