5.10.4-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 313/717 ASoC: atmel: mchp-spdifrx needs COMMON_CLK
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 29275309b0e32bb838d67158c6b6e687275f43e9 ]
Compile-testing this driver on an older platform without CONFIG_COMMON_CLK fails with
ERROR: modpost: "clk_set_min_rate" [sound/soc/atmel/snd-soc-mchp-spdifrx.ko] undefined!
Make this is a strict dependency.
--- sound/soc/atmel/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/atmel/Kconfig +1 -0
@@ -148,6 +148,7 @@ config SND_MCHP_SOC_SPDIFTX config SND_MCHP_SOC_SPDIFRX tristate "Microchip ASoC driver for boards using S/PDIF RX" depends on OF && (ARCH_AT91 || COMPILE_TEST) + depends on COMMON_CLK select SND_SOC_GENERIC_DMAENGINE_PCM select REGMAP_MMIO help
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 314/717 ASoC: qcom: fix QDSP6 dependencies, attempt #3
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit b1b8eb1283c90a953089d988930d7b6156418958 ]
The previous fix left another warning in randconfig builds:
WARNING: unmet direct dependencies detected for SND_SOC_QDSP6
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_QCOM [=y] && QCOM_APR [=y] && COMMON_CLK [=n] Selected by [y]:
- SND_SOC_MSM8996 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_QCOM [=y] && QCOM_APR [=y]
Add one more dependency for this one.
--- sound/soc/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/qcom/Kconfig +1 -0
@@ -106,6 +106,7 @@ config SND_SOC_QDSP6 config SND_SOC_MSM8996 tristate "SoC Machine driver for MSM8996 and APQ8096 boards" depends on QCOM_APR + depends on COMMON_CLK select SND_SOC_QDSP6 select SND_SOC_QCOM_COMMON help
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 315/717 phy: mediatek: allow compile-testing the hdmi phy
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit f5f6e01f9164040ba120f30522efdb4deceb529a ]
Compile-testing the DRM_MEDIATEK_HDMI driver shows two missing dependencies, one results in a link failure:
arm-linux-gnueabi-ld: drivers/phy/mediatek/phy-mtk-hdmi.o: in function `mtk_hdmi_phy_probe':
phy-mtk-hdmi.c:(.text+0xd8): undefined reference to `__clk_get_name'
arm-linux-gnueabi-ld: phy-mtk-hdmi.c:(.text+0x12c): undefined reference to `devm_clk_register'
arm-linux-gnueabi-ld: phy-mtk-hdmi.c:(.text+0x250): undefined reference to `of_clk_add_provider'
arm-linux-gnueabi-ld: phy-mtk-hdmi.c:(.text+0x298): undefined reference to `of_clk_src_simple_get'
The other one is a harmless warning:
WARNING: unmet direct dependencies detected for PHY_MTK_HDMI
Depends on [n]: ARCH_MEDIATEK [=n] && OF [=y] Selected by [y]:
- DRM_MEDIATEK_HDMI [=y] && HAS_IOMEM [=y] && DRM_MEDIATEK [=y]
Fix these by adding dependencies on CONFIG_OF and CONFIG_COMMON_CLK. With that done, there is also no reason against adding CONFIG_COMPILE_TEST.
--- drivers/phy/mediatek/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/mediatek/Kconfig +3 -1
@@ -38,7 +38,9 @@ config PHY_MTK_XSPHY config PHY_MTK_HDMI tristate "MediaTek HDMI-PHY Driver" - depends on ARCH_MEDIATEK && OF + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on COMMON_CLK + depends on OF select GENERIC_PHY help Support HDMI PHY for Mediatek SoCs.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 316/717 phy: renesas: rcar-gen3-usb2: disable runtime pm in case of failure
In reply to Greg Kroah-HartmanFrom: Wang Li <[email protected]>
[ Upstream commit 51e339deab1e51443f6ac3b1bd5cd6cc8e8fe1d9 ]
pm_runtime_enable() will decrease power disable depth. Thus a pairing increment is needed on the error handling path to keep it balanced.
--- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/renesas/phy-rcar-gen3-usb2.c +4 -2
@@ -656,8 +656,10 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)*/ pm_runtime_enable (dev); phy_usb2_ops =of_device_get_match_data (dev); -if (!phy_usb2_ops) -return -EINVAL ; +if (!phy_usb2_ops) { + ret = -EINVAL ; + goto error; + }mutex_init (&channel->lock);for (i =0 ; i <NUM_OF_PHYS ; i++) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 317/717 memory: ti-emif-sram: only build for ARMv7
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d77d22d701b0471584abe1871570bb43deb6e3c4 ]
The driver can be compile-tested on all ARM machines, but causes a failure when built for ARMv7-M:
arm-linux-gnueabi-ld: error: drivers/memory/ti-emif-sram-pm.o: conflicting architecture profiles A/M
Limit the target machines to configurations that have ARMv7 enabled.
--- drivers/memory/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/Kconfig +1 -1
@@ -128,7 +128,7 @@ config OMAP_GPMC_DEBUG config TI_EMIF_SRAM tristate "Texas Instruments EMIF SRAM driver" - depends on SOC_AM33XX || SOC_AM43XX || (ARM && COMPILE_TEST) + depends on SOC_AM33XX || SOC_AM43XX || (ARM && CPU_V7 && COMPILE_TEST) depends on SRAM help This driver is for the EMIF module available on Texas Instruments
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 318/717 memory: jz4780_nemc: Fix potential NULL dereference in jz4780_nemc_probe()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 4bfa07300b9334b487ed4f3d4901c35ebb31b7ca ]
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference a bit later in the code.
This is detected by Coccinelle semantic patch.
--- drivers/memory/jz4780-nemc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/memory/jz4780-nemc.c +2 -0
@@ -291,6 +291,8 @@ static int jz4780_nemc_probe(struct platform_device *pdev) nemc->dev = dev; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -EINVAL ;/* * The driver currently only uses the registers up to offset
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 319/717 drm/msm: a5xx: Make preemption reset case reentrant
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 7cc29fcdfcc8784e97c5151c848e193800ec79ac ]
nr_rings is reset to 1, but when this function is called for a second (and third!) time nr_rings > 1 is false, thus the else case is entered to set up a buffer for the RPTR shadow and consequently written to RB_RPTR_ADDR, hanging platforms without WHERE_AM_I firmware support.
Restructure the condition in such a way that shadow buffer setup only ever happens when has_whereami is true; otherwise preemption is only finalized when the number of ring buffers has not been reset to 1 yet.
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +6 -6
@@ -755,12 +755,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)gpu_write (gpu,REG_A5XX_CP_RB_CNTL ,MSM_GPU_RB_CNTL_DEFAULT |AXXX_CP_RB_CNTL_NO_UPDATE ); -/* Disable preemption if WHERE_AM_I isn't available */ -if (!a5xx_gpu->has_whereami && gpu->nr_rings >1 ) { -a5xx_preempt_fini (gpu); - gpu->nr_rings =1 ; - }else { -/* Create a privileged buffer for the RPTR shadow */ +/* Create a privileged buffer for the RPTR shadow */ +if (a5xx_gpu->has_whereami) {if (!a5xx_gpu->shadow_bo) { a5xx_gpu->shadow = msm_gem_kernel_new(gpu->dev, sizeof(u32) * gpu->nr_rings,
@@ -774,6 +770,10 @@ static int a5xx_hw_init(struct msm_gpu *gpu)gpu_write64 (gpu,REG_A5XX_CP_RB_RPTR_ADDR ,REG_A5XX_CP_RB_RPTR_ADDR_HI ,shadowptr (a5xx_gpu, gpu->rb[0 ])); + }else if (gpu->nr_rings >1 ) { +/* Disable preemption if WHERE_AM_I isn't available */ +a5xx_preempt_fini (gpu); + gpu->nr_rings =1 ; }a5xx_preempt_hw_init (gpu);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 320/717 drm/msm: add IOMMU_SUPPORT dependency
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit e319a1b956f785f618611857cd946dca2bb68542 ]
The iommu pgtable support is only available when IOMMU support is built into the kernel:
WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE
Depends on [n]: IOMMU_SUPPORT [=n]
Selected by [y]:
- DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM [=y] || SOC_IMX5 || ARM && COMPILE_TEST [=y]) && OF [=y] && COMMON_CLK [=y] && MMU [=y] && (QCOM_OCMEM [=y] || QCOM_OCMEM [=y]=n)
Fix the dependency accordingly. There is no need for depending on CONFIG_MMU any more, as that is implied by the iommu support.
--- drivers/gpu/drm/msm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/Kconfig +1 -1
@@ -4,8 +4,8 @@ config DRM_MSM tristate "MSM DRM" depends on DRM depends on ARCH_QCOM || SOC_IMX5 || (ARM && COMPILE_TEST) + depends on IOMMU_SUPPORT depends on OF && COMMON_CLK - depends on MMU depends on QCOM_OCMEM || QCOM_OCMEM=n select IOMMU_IO_PGTABLE select QCOM_MDT_LOADER if ARCH_QCOM
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 321/717 clocksource/drivers/arm_arch_timer: Use stable count reader in erratum sne
In reply to Greg Kroah-HartmanFrom: Keqian Zhu <[email protected]>
[ Upstream commit d8cc3905b8073c7cfbff94af889fa8dc71f21dd5 ]
In commit 0ea415390cd3 ("clocksource/arm_arch_timer: Use arch_timer_read_counter to access stable counters"), we separate stable and normal count reader to omit unnecessary overhead on systems that have no timer erratum.
However, in erratum_set_next_event_tval_generic(), count reader becomes normal reader. This converts it to stable reader.
--- drivers/clocksource/arm_arch_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/arm_arch_timer.c +2 -2
@@ -396,10 +396,10 @@ static void erratum_set_next_event_tval_generic(const int access, unsigned long ctrl &= ~ARCH_TIMER_CTRL_IT_MASK ;if (access ==ARCH_TIMER_PHYS_ACCESS ) { - cval = evt +arch_counter_get_cntpct (); + cval = evt +arch_counter_get_cntpct_stable ();write_sysreg (cval, cntp_cval_el0); }else { - cval = evt +arch_counter_get_cntvct (); + cval = evt +arch_counter_get_cntvct_stable ();write_sysreg (cval, cntv_cval_el0); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 322/717 clocksource/drivers/arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI
In reply to Greg Kroah-HartmanFrom: Keqian Zhu <[email protected]>
[ Upstream commit 8b7770b877d187bfdae1eaf587bd2b792479a31c ]
ARM virtual counter supports event stream, it can only trigger an event when the trigger bit (the value of CNTKCTL_EL1.EVNTI) of CNTVCT_EL0 changes, so the actual period of event stream is 2^(cntkctl_evnti + 1). For example, when the trigger bit is 0, then virtual counter trigger an event for every two cycles.
While we're at it, rework the way we compute the trigger bit position by making it more obvious that when bits [n:n-1] are both set (with n being the most significant bit), we pick bit (n + 1).
--- drivers/clocksource/arm_arch_timer.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/clocksource/arm_arch_timer.c +16 -7
@@ -822,15 +822,24 @@ static void arch_timer_evtstrm_enable(int divider)static void arch_timer_configure_evtstream (void ) { -int evt_stream_div, pos; +int evt_stream_div, lsb; + +/* +* As the event stream can at most be generated at half the frequency +* of the counter, use half the frequency when computing the divider. +*/ + evt_stream_div = arch_timer_rate /ARCH_TIMER_EVT_STREAM_FREQ /2 ; + +/* +* Find the closest power of two to the divisor. If the adjacent bit +* of lsb (last set bit, starts from 0) is set, then we use (lsb + 1). +*/ + lsb =fls (evt_stream_div) -1 ; +if (lsb >0 && (evt_stream_div &BIT (lsb -1 ))) + lsb++; -/* Find the closest power of two to the divisor */ - evt_stream_div = arch_timer_rate /ARCH_TIMER_EVT_STREAM_FREQ ; - pos =fls (evt_stream_div); -if (pos >1 && !(evt_stream_div & (1 << (pos -2 )))) - pos--;/* enable event stream */ -arch_timer_evtstrm_enable (min (pos,15 )); +arch_timer_evtstrm_enable (max (0 ,min (lsb,15 ))); }static void arch_counter_set_user_access (void )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 323/717 cpufreq: ap806: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 925a5bcefe105f2790ecbdc252eb2315573f309d ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/armada-8k-cpufreq.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/cpufreq/armada-8k-cpufreq.c +6 -0
@@ -204,6 +204,12 @@ static void __exit armada_8k_cpufreq_exit(void) }module_exit (armada_8k_cpufreq_exit); +static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = { + { .compatible ="marvell,ap806-cpu-clock" }, + { }, +}; +MODULE_DEVICE_TABLE (of, armada_8k_cpufreq_of_match); +MODULE_AUTHOR ("Gregory Clement <[email protected]>" );MODULE_DESCRIPTION ("Armada 8K cpufreq driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 324/717 cpufreq: highbank: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 9433777a6e0aae27468d3434b75cd51bb88ff711 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/highbank-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/highbank-cpufreq.c +7 -0
@@ -101,6 +101,13 @@ out_put_node: }module_init (hb_cpufreq_driver_init); +static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = { + { .compatible ="calxeda,highbank" }, + { .compatible ="calxeda,ecx-2000" }, + { }, +}; +MODULE_DEVICE_TABLE (of, hb_cpufreq_of_match); +MODULE_AUTHOR ("Mark Langsdorf <[email protected]>" );MODULE_DESCRIPTION ("Calxeda Highbank cpufreq driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 325/717 cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit af6eca06501118af3e2ad46eee8edab20624b74e ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/mediatek-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/mediatek-cpufreq.c +1 -0
@@ -540,6 +540,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = { { } }; +MODULE_DEVICE_TABLE (of, mtk_cpufreq_machines);static int __init mtk_cpufreq_driver_init (void ) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 326/717 cpufreq: qcom: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit a5a6031663bc1dd0a10babd49d1bcb3153a8327f ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/qcom-cpufreq-nvmem.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/qcom-cpufreq-nvmem.c +1 -0
@@ -464,6 +464,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = { { .compatible = "qcom,msm8960", .data = &match_data_krait }, {}, }; +MODULE_DEVICE_TABLE (of, qcom_cpufreq_match_list);/* * Since the driver depends on smem and nvmem drivers, which may
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 327/717 cpufreq: st: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 183747ab52654eb406fc6b5bfb40806b75d31811 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/sti-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/sti-cpufreq.c +7 -0
@@ -292,6 +292,13 @@ register_cpufreq_dt: }module_init (sti_cpufreq_init); +static const struct of_device_id __maybe_unused sti_cpufreq_of_match[] = { + { .compatible ="st,stih407" }, + { .compatible ="st,stih410" }, + { }, +}; +MODULE_DEVICE_TABLE (of, sti_cpufreq_of_match); +MODULE_DESCRIPTION ("STMicroelectronics CPUFreq/OPP driver" );MODULE_AUTHOR ("Ajitpal Singh <[email protected]>" );MODULE_AUTHOR ("Lee Jones <[email protected]>" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 328/717 cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit af2096f285077e3339eb835ad06c50bdd59f01b5 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/sun50i-cpufreq-nvmem.c +1 -0
@@ -167,6 +167,7 @@ static const struct of_device_id sun50i_cpufreq_match_list[] = { { .compatible = "allwinner,sun50i-h6" }, {} }; +MODULE_DEVICE_TABLE (of, sun50i_cpufreq_match_list);static const struct of_device_id *sun50i_cpufreq_match_node (void ) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 329/717 cpufreq: loongson1: Add missing MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit b9acab091842ca8b288882798bb809f7abf5408a ]
This patch adds missing MODULE_ALIAS for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/loongson1-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/loongson1-cpufreq.c +1 -0
@@ -216,6 +216,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = {module_platform_driver (ls1x_cpufreq_platdrv); +MODULE_ALIAS ("platform:ls1x-cpufreq" );MODULE_AUTHOR ("Kelvin Cheung <[email protected]>" );MODULE_DESCRIPTION ("Loongson1 CPUFreq driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 330/717 cpufreq: scpi: Add missing MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit c0382d049d2def37b81e907a8b22661a4a4a6eb5 ]
This patch adds missing MODULE_ALIAS for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/scpi-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/scpi-cpufreq.c +1 -0
@@ -233,6 +233,7 @@ static struct platform_driver scpi_cpufreq_platdrv = { };module_platform_driver (scpi_cpufreq_platdrv); +MODULE_ALIAS ("platform:scpi-cpufreq" );MODULE_AUTHOR ("Sudeep Holla <[email protected]>" );MODULE_DESCRIPTION ("ARM SCPI CPUFreq interface driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 331/717 cpufreq: vexpress-spc: Add missing MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit d15183991c2d53d7cecf27a1555c91b702cef1ea ]
This patch adds missing MODULE_ALIAS for automatic loading of this cpufreq driver when it is compiled as an external module.
--- drivers/cpufreq/vexpress-spc-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/vexpress-spc-cpufreq.c +1 -0
@@ -591,6 +591,7 @@ static struct platform_driver ve_spc_cpufreq_platdrv = { };module_platform_driver (ve_spc_cpufreq_platdrv); +MODULE_ALIAS ("platform:vexpress-spc-cpufreq" );MODULE_AUTHOR ("Viresh Kumar <[email protected]>" );MODULE_AUTHOR ("Sudeep Holla <[email protected]>" );MODULE_DESCRIPTION ("Vexpress SPC ARM big LITTLE cpufreq driver" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 332/717 cpufreq: imx: fix NVMEM_IMX_OCOTP dependency
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit fc928b901dc68481ba3e524860a641fe13e25dfe ]
A driver should not 'select' drivers from another subsystem. If NVMEM is disabled, this one results in a warning:
WARNING: unmet direct dependencies detected for NVMEM_IMX_OCOTP
Depends on [n]: NVMEM [=n] && (ARCH_MXC [=y] || COMPILE_TEST [=y]) && HAS_IOMEM [=y] Selected by [y]:
- ARM_IMX6Q_CPUFREQ [=y] && CPU_FREQ [=y] && (ARM || ARM64 [=y]) && ARCH_MXC [=y] && REGULATOR_ANATOP [=y]
Change the 'select' to 'depends on' to prevent it from going wrong, and allow compile-testing without that driver, since it is only a runtime dependency.
--- drivers/cpufreq/Kconfig.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/Kconfig.arm +1 -1
@@ -94,7 +94,7 @@ config ARM_IMX6Q_CPUFREQ tristate "Freescale i.MX6 cpufreq support" depends on ARCH_MXC depends on REGULATOR_ANATOP - select NVMEM_IMX_OCOTP + depends on NVMEM_IMX_OCOTP || COMPILE_TEST select PM_OPP help This adds cpufreq driver support for Freescale i.MX6 series SoCs.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 333/717 macintosh/adb-iop: Always wait for reply message from IOP
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit 2c9cfbadfa234b03473f1ef54e6f4772cc07a371 ]
A recent patch incorrectly altered the adb-iop state machine behaviour and introduced a regression that can appear intermittently as a malfunctioning ADB input device. This seems to be caused when reply packets from different ADB commands become mixed up, especially during the adb bus scan. Fix this by unconditionally entering the awaiting_reply state after sending an explicit command, even when the ADB command won't generate a reply from the ADB device.
It turns out that the IOP always generates reply messages, even when the ADB command does not produce a reply packet (e.g. ADB Listen command). So it's not really the ADB reply packets that are being mixed up, it's the IOP messages that enclose them. The bug goes like this:
1. CPU sends a message to the IOP, expecting no response because this message contains an ADB Listen command. The ADB command is now considered complete.
2. CPU sends a second message to the IOP, this time expecting a response because this message contains an ADB Talk command. This ADB command needs a reply before it can be completed.
3. adb-iop driver receives an IOP message and assumes that it relates to the Talk command. It's actually an empty one (with flags == ADB_IOP_EXPLICIT|ADB_IOP_TIMEOUT) for the previous command. The Talk command is now considered complete but it gets the wrong reply data.
4. adb-iop driver gets another IOP response message, which contains the actual reply data for the Talk command, but this is dropped (the driver is no longer in awaiting_reply state).
--- drivers/macintosh/adb-iop.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/macintosh/adb-iop.c +8 -8
@@ -78,10 +78,7 @@ static void adb_iop_complete(struct iop_msg *msg)local_irq_save (flags); -if (current_req->reply_expected) - adb_iop_state = awaiting_reply; -else -adb_iop_done (); + adb_iop_state = awaiting_reply;local_irq_restore (flags); }
@@ -89,8 +86,9 @@ static void adb_iop_complete(struct iop_msg *msg)/* * Listen for ADB messages from the IOP. * -* This will be called when unsolicited messages (usually replies to TALK -* commands or autopoll packets) are received. +* This will be called when unsolicited IOP messages are received. +* These IOP messages can carry ADB autopoll responses and also occur +* after explicit ADB commands. */ static void adb_iop_listen (struct iop_msg *msg)
@@ -110,8 +108,10 @@ static void adb_iop_listen(struct iop_msg *msg)if (adb_iop_state == awaiting_reply) {struct adb_request *req = current_req; - req->reply_len = amsg->count +1 ; -memcpy (req->reply, &amsg->cmd, req->reply_len); +if (req->reply_expected) { + req->reply_len = amsg->count +1 ; +memcpy (req->reply, &amsg->cmd, req->reply_len); + } req_done = true; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 334/717 macintosh/adb-iop: Send correct poll command
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit 10199e90ee20e68859f8128331ec8d85b036d349 ]
The behaviour of the IOP firmware is not well documented but we do know that IOP message reply data can be used to issue new ADB commands. Use the message reply to better control autopoll behaviour by sending a Talk Register 0 command after every ADB response, not unlike the algorithm in the via-macii driver. This poll command is addressed to that device which last received a Talk command (explicit or otherwise).
--- drivers/macintosh/adb-iop.c | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/macintosh/adb-iop.c +30 -10
@@ -25,6 +25,7 @@static struct adb_request *current_req;static struct adb_request *last_req;static unsigned int autopoll_devs; +static u8 autopoll_addr; static enum adb_iop_state { idle,
@@ -41,6 +42,11 @@ static int adb_iop_autopoll(int);static void adb_iop_poll (void );static int adb_iop_reset_bus (void ); +/* ADB command byte structure */ +#define ADDR_MASK 0xF0 +#define OP_MASK 0x0C +#define TALK 0x0C +struct adb_driver adb_iop_driver = { .name ="ISM IOP" , .probe = adb_iop_probe,
@@ -94,17 +100,24 @@ static void adb_iop_complete(struct iop_msg *msg)static void adb_iop_listen (struct iop_msg *msg) {struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message; +u8 addr = (amsg->cmd &ADDR_MASK ) >>4 ; +u8 op = amsg->cmd &OP_MASK ;unsigned long flags;bool req_done = false;local_irq_save (flags); -/* Handle a timeout. Timeout packets seem to occur even after -* we've gotten a valid reply to a TALK, presumably because of -* autopolling. +/* Responses to Talk commands may be unsolicited as they are +* produced when the IOP polls devices. They are mostly timeouts. */ - -if (amsg->flags &ADB_IOP_EXPLICIT ) { +if (op ==TALK && ((1 << addr) & autopoll_devs)) + autopoll_addr = addr; + +switch (amsg->flags & (ADB_IOP_EXPLICIT | +ADB_IOP_AUTOPOLL | +ADB_IOP_TIMEOUT )) { +case ADB_IOP_EXPLICIT : +case ADB_IOP_EXPLICIT |ADB_IOP_TIMEOUT :if (adb_iop_state == awaiting_reply) {struct adb_request *req = current_req;
@@ -115,12 +128,16 @@ static void adb_iop_listen(struct iop_msg *msg) req_done = true; } - }else if (!(amsg->flags &ADB_IOP_TIMEOUT )) { -adb_input (&amsg->cmd, amsg->count +1 , - amsg->flags &ADB_IOP_AUTOPOLL ); +break ; +case ADB_IOP_AUTOPOLL : +if (((1 << addr) & autopoll_devs) && + amsg->cmd ==ADB_READREG (addr,0 )) +adb_input (&amsg->cmd, amsg->count +1 ,1 ); +break ; } - - msg->reply[0 ] = autopoll_devs ?ADB_IOP_AUTOPOLL :0 ; + msg->reply[0 ] = autopoll_addr ?ADB_IOP_AUTOPOLL :0 ; + msg->reply[1 ] =0 ; + msg->reply[2 ] = autopoll_addr ?ADB_READREG (autopoll_addr,0 ) :0 ;iop_complete_message (msg);if (req_done)
@@ -233,6 +250,9 @@ static void adb_iop_set_ap_complete(struct iop_msg *msg)struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message; autopoll_devs = (amsg->data[1 ] <<8 ) | amsg->data[0 ]; +if (autopoll_devs & (1 << autopoll_addr)) +return ; + autopoll_addr = autopoll_devs ? (ffs (autopoll_devs) -1 ) :0 ; }static int adb_iop_autopoll (int devs)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 335/717 staging: bcm2835: fix vchiq_mmal dependencies
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 6c91799f59ed491a2b5bf5ef7c6d60306cda4e09 ]
When the MMAL code is built-in but the vchiq core config is set to =m, the mmal code never gets built, which in turn can lead to link errors:
ERROR: modpost: "vchiq_mmal_port_set_format" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_port_disable" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_port_parameter_set" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_component_finalise" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_port_connect_tunnel" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_component_enable" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_finalise" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_component_init" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_component_disable" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "mmal_vchi_buffer_init" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_port_enable" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_version" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_submit_buffer" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_init" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "mmal_vchi_buffer_cleanup" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
ERROR: modpost: "vchiq_mmal_port_parameter_get" [drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko] undefined!
Change the Kconfig to depend on BCM2835_VCHIQ like the other drivers, and remove the now redundant dependencies.
--- drivers/staging/vc04_services/vchiq-mmal/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/vchiq-mmal/Kconfig +1 -1
@@ -1,6 +1,6 @@ config BCM2835_VCHIQ_MMAL tristate "BCM2835 MMAL VCHIQ service" - depends on (ARCH_BCM2835 || COMPILE_TEST) + depends on BCM2835_VCHIQ help Enables the MMAL API over VCHIQ interface as used for the majority of the multimedia services on VideoCore.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 336/717 staging: greybus: audio: Fix possible leak free widgets in gbaudio_dapm_free_controls
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit e77b259f67ab99f1e22ce895b9b1c637fd5f2d4c ]
In gbaudio_dapm_free_controls(), if one of the widgets is not found, an error will be returned directly, which will cause the rest to be unable to be freed, resulting in leak.
This patch fixes the bug. If if one of them is not found, just skip and free the others.
--- drivers/staging/greybus/audio_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/greybus/audio_helper.c +2 -1
@@ -135,7 +135,8 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm,if (!w) {dev_err (dapm->dev,"%s: widget not found\n" , widget->name); -return -EINVAL ; + widget++; +continue ; } widget++;#ifdef CONFIG_DEBUG_FS
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 337/717 spi: dw: Fix error return code in dw_spi_bt1_probe()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit e748edd9841306908b4e02dddd0afd1aa1f8b973 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/spi/spi-dw-bt1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-dw-bt1.c +3 -1
@@ -280,8 +280,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) dws->bus_num = pdev->id; dws->reg_io_width =4 ; dws->max_freq =clk_get_rate (dwsbt1->clk); -if (!dws->max_freq) +if (!dws->max_freq) { + ret = -EINVAL ; goto err_disable_clk; + } init_func =device_get_match_data (&pdev->dev); ret =init_func (pdev, dwsbt1);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 338/717 Bluetooth: btusb: Add the missed release_firmware() in btusb_mtk_setup_firmware()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit d1e9d232e1e60fa63df1b836ec3ecba5abd3fa9d ]
btusb_mtk_setup_firmware() misses to call release_firmware() in an error path. Jump to err_release_fw to fix it.
--- drivers/bluetooth/btusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btusb.c +1 -1
@@ -3067,7 +3067,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) err =btusb_mtk_hci_wmt_sync (hdev, &wmt_params);if (err <0 ) {bt_dev_err (hdev,"Failed to power on data RAM (%d)" , err); -return err; + goto err_release_fw; } fw_ptr = fw->data;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 339/717 Bluetooth: btmtksdio: Add the missed release_firmware() in mtk_setup_firmware()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit b73b5781a85c03113476f62346c390f0277baa4b ]
mtk_setup_firmware() misses to call release_firmware() in an error path. Jump to free_fw to fix it.
--- drivers/bluetooth/btmtksdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btmtksdio.c +1 -1
@@ -704,7 +704,7 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) err =mtk_hci_wmt_sync (hdev, &wmt_params);if (err <0 ) {bt_dev_err (hdev,"Failed to power on data RAM (%d)" , err); -return err; + goto free_fw; } fw_ptr = fw->data;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 340/717 Bluetooth: sco: Fix crash when using BT_SNDMTU/BT_RCVMTU option
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit f6b8c6b5543983e9de29dc14716bfa4eb3f157c4 ]
This commit add the invalid check for connected socket, without it will causes the following crash due to sco_pi(sk)->conn being NULL:
KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057]
CPU: 3 PID: 4284 Comm: test_sco Not tainted 5.10.0-rc3+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
RIP: 0010:sco_sock_getsockopt+0x45d/0x8e0
Code: 48 c1 ea 03 80 3c 02 00 0f 85 ca 03 00 00 49 8b 9d f8 04 00 00 48 b8 00
00 00 00 00 fc ff df 48 8d 7b 50 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84
c0 74 08 3c 03 0f 8e b5 03 00 00 8b 43 50 48 8b 0c
RSP: 0018:ffff88801bb17d88 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83a4ecdf
RDX: 000000000000000a RSI: ffffc90002fce000 RDI: 0000000000000050
RBP: 1ffff11003762fb4 R08: 0000000000000001 R09: ffff88810e1008c0
R10: ffffffffbd695dcf R11: fffffbfff7ad2bb9 R12: 0000000000000000
R13: ffff888018ff1000 R14: dffffc0000000000 R15: 000000000000000d
FS: 00007fb4f76c1700(0000) GS:ffff88811af80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005555e3b7a938 CR3: 00000001117be001 CR4: 0000000000770ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
? sco_skb_put_cmsg+0x80/0x80
? sco_skb_put_cmsg+0x80/0x80
__sys_getsockopt+0x12a/0x220
? __ia32_sys_setsockopt+0x150/0x150
? syscall_enter_from_user_mode+0x18/0x50
? rcu_read_lock_bh_held+0xb0/0xb0
__x64_sys_getsockopt+0xba/0x150
? syscall_enter_from_user_mode+0x1d/0x50
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xa9--- net/bluetooth/sco.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/sco.c +5 -0
@@ -1003,6 +1003,11 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname,case BT_SNDMTU :case BT_RCVMTU : +if (sk->sk_state !=BT_CONNECTED ) { + err = -ENOTCONN ; +break ; + } +if (put_user (sco_pi (sk)->conn->mtu, (u32 __user *)optval)) err = -EFAULT ;break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 341/717 block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name
In reply to Greg Kroah-HartmanFrom: Md Haris Iqbal <[email protected]>
[ Upstream commit 64e8a6ece1a5b1fa21316918053d068baeac84af ]
For every rnbd_clt_dev, we alloc the pathname and blk_symlink_name statically to NAME_MAX which is 255 bytes. In most of the cases we only need less than 10 bytes, so 500 bytes per block device are wasted.
This commit dynamically allocates memory buffer for pathname and blk_symlink_name.
--- drivers/block/rnbd/rnbd-clt-sysfs.c | 12 ++++++++++-- drivers/block/rnbd/rnbd-clt.c | 14 +++++++++++--- drivers/block/rnbd/rnbd-clt.h | 4 ++-- 3 files changed, 23 insertions(+), 7 deletions(-)
drivers/block/rnbd/rnbd-clt-sysfs.c +10 -2
@@ -435,6 +435,7 @@ void rnbd_clt_remove_dev_symlink(struct rnbd_clt_dev *dev)*/ if (strlen (dev->blk_symlink_name) &&try_module_get (THIS_MODULE )) {sysfs_remove_link (rnbd_devs_kobj, dev->blk_symlink_name); +kfree (dev->blk_symlink_name);module_put (THIS_MODULE ); } }
@@ -487,10 +488,17 @@ static int rnbd_clt_get_path_name(struct rnbd_clt_dev *dev, char *buf,static int rnbd_clt_add_dev_symlink (struct rnbd_clt_dev *dev) {struct kobject *gd_kobj = &disk_to_dev (dev->gd)->kobj; -int ret; +int ret, len; + + len =strlen (dev->pathname) +strlen (dev->sess->sessname) +2 ; + dev->blk_symlink_name =kzalloc (len,GFP_KERNEL ); +if (!dev->blk_symlink_name) { +rnbd_clt_err (dev,"Failed to allocate memory for blk_symlink_name\n" ); + goto out_err; + } ret =rnbd_clt_get_path_name (dev, dev->blk_symlink_name, -sizeof (dev->blk_symlink_name)); + len);if (ret) {rnbd_clt_err (dev,"Failed to get /sys/block symlink path, err: %d\n" , ret);
drivers/block/rnbd/rnbd-clt.c +11 -3
@@ -59,6 +59,7 @@ static void rnbd_clt_put_dev(struct rnbd_clt_dev *dev)ida_simple_remove (&index_ida, dev->clt_device_id);mutex_unlock (&ida_lock);kfree (dev->hw_queues); +kfree (dev->pathname);rnbd_clt_put_sess (dev->sess);mutex_destroy (&dev->lock);kfree (dev);
@@ -1381,10 +1382,17 @@ static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess, pathname, sess->sessname, ret); goto out_queues; } + + dev->pathname =kzalloc (strlen (pathname) +1 ,GFP_KERNEL ); +if (!dev->pathname) { + ret = -ENOMEM ; + goto out_queues; + } +strlcpy (dev->pathname, pathname,strlen (pathname) +1 ); + dev->clt_device_id = ret; dev->sess = sess; dev->access_mode = access_mode; -strlcpy (dev->pathname, pathname,sizeof (dev->pathname));mutex_init (&dev->lock);refcount_set (&dev->refcount,1 ); dev->dev_state =DEV_STATE_INIT ;
@@ -1413,8 +1421,8 @@ static bool __exists_dev(const char *pathname)list_for_each_entry (sess, &sess_list, list) {mutex_lock (&sess->lock);list_for_each_entry (dev, &sess->devs_list, list) { -if (!strncmp (dev->pathname, pathname, -sizeof (dev->pathname))) { +if (strlen (dev->pathname) ==strlen (pathname) && + !strcmp (dev->pathname, pathname)) { found = true;break ; }
drivers/block/rnbd/rnbd-clt.h +2 -2
@@ -108,7 +108,7 @@ struct rnbd_clt_dev {u32 clt_device_id;struct mutex lock;enum rnbd_clt_dev_state dev_state; -char pathname[NAME_MAX ]; +char *pathname;enum rnbd_access_mode access_mode;bool read_only;bool rotational;
@@ -126,7 +126,7 @@ struct rnbd_clt_dev {struct list_head list;struct gendisk *gd;struct kobject kobj; -char blk_symlink_name[NAME_MAX ]; +char *blk_symlink_name;refcount_t refcount;struct work_struct unmap_on_rmmod_work; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 342/717 block/rnbd: fix a null pointer dereference on dev->blk_symlink_name
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 733c15bd3a944b8eeaacdddf061759b6a83dd3f4 ]
Currently in the case where dev->blk_symlink_name fails to be allocates the error return path attempts to set an end-of-string character to the unallocated dev->blk_symlink_name causing a null pointer dereference error. Fix this by returning with an explicity ENOMEM error (which also is missing in the original code as was not initialized).
Addresses-Coverity: ("Dereference after null check")
--- drivers/block/rnbd/rnbd-clt-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rnbd/rnbd-clt-sysfs.c +1 -1
@@ -494,7 +494,7 @@ static int rnbd_clt_add_dev_symlink(struct rnbd_clt_dev *dev) dev->blk_symlink_name =kzalloc (len,GFP_KERNEL );if (!dev->blk_symlink_name) {rnbd_clt_err (dev,"Failed to allocate memory for blk_symlink_name\n" ); - goto out_err; +return -ENOMEM ; } ret = rnbd_clt_get_path_name(dev, dev->blk_symlink_name,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 343/717 Bluetooth: btusb: Fix detection of some fake CSR controllers with a bcdDevice val of 0x0134
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit d74e0ae7e03032b47b8631cc1e52a7ae1ce988c0 ]
Commit cde1a8a99287 ("Bluetooth: btusb: Fix and detect most of the Chinese Bluetooth controllers") made the detection of fake controllers more generic fixing it for much of the newer fakes / clones.
But this does not work for a fake CSR controller with a bcdDevice value of 0x0134, which was correctly identified as fake before this change.
Add an extra check for this special case, checking for a combination of a bcdDevice value of 0x0134, together with a lmp_subver of 0x0c5c and a hci_ver of BLUETOOTH_VER_2_0.
The chip inside this fake dongle is marked as with "clockwise cw6629d".
--- drivers/bluetooth/btusb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/bluetooth/btusb.c +8 -0
@@ -1763,6 +1763,8 @@ static int btusb_setup_bcm92035(struct hci_dev *hdev)static int btusb_setup_csr (struct hci_dev *hdev) { +struct btusb_data *data =hci_get_drvdata (hdev); +u16 bcdDevice =le16_to_cpu (data->udev->descriptor.bcdDevice);struct hci_rp_read_local_version *rp;struct sk_buff *skb;bool is_fake = false;
@@ -1832,6 +1834,12 @@ static int btusb_setup_csr(struct hci_dev *hdev) le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_4_0) is_fake = true; +/* Other clones which beat all the above checks */ + else if (bcdDevice == 0x0134 && + le16_to_cpu(rp->lmp_subver) == 0x0c5c && + le16_to_cpu(rp->hci_ver) == BLUETOOTH_VER_2_0) + is_fake = true; +if (is_fake) {bt_dev_warn (hdev,"CSR: Unbranded CSR clone detected; adding workarounds..." );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 344/717 platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on some HP x360 models
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a4327979a19e8734ddefbd8bcbb73bd9905b69cd ]
Some HP x360 models have an ACPI VGBS method which sets bit 4 instead of bit 6 when NOT in tablet mode at boot. Inspecting all the DSDTs in my DSDT collection shows only one other model, the Medion E1239T ever setting bit 4 and it always sets this together with bit 6.
So lets treat bit 4 as a second bit which when set indicates the device not being in tablet-mode, as we already do for bit 6.
While at it also prefix all VGBS constant defines with "VGBS_".
Note this wrokaround was first added to the kernel as
commit d823346876a9 ("platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360").
After commit 8169bd3e6e19 ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting") got added to the kernel this was reverted, because with the new allow-list approach the workaround was no longer necessary for the model on which the issue was first reported.
But it turns out that the workaround is still necessary because some affected models report a chassis-type of 31 which is on the allow-list.
--- drivers/platform/x86/intel-vbtn.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/platform/x86/intel-vbtn.c +8 -4
@@ -15,9 +15,13 @@#include <linux/platform_device.h> #include <linux/suspend.h> +/* Returned when NOT in tablet mode on some HP Stream x360 11 models */ +#define VGBS_TABLET_MODE_FLAG_ALT 0x10/* When NOT in tablet mode, VGBS returns with the flag 0x40 */ -#define TABLET_MODE_FLAG 0x40 -#define DOCK_MODE_FLAG 0x80 +#define VGBS_TABLET_MODE_FLAG 0x40 +#define VGBS_DOCK_MODE_FLAG 0x80 + +#define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT)MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("AceLan Kao" );
@@ -72,9 +76,9 @@ static void detect_tablet_mode(struct platform_device *device)if (ACPI_FAILURE (status))return ; - m = !(vgbs &TABLET_MODE_FLAG ); + m = !(vgbs &VGBS_TABLET_MODE_FLAGS );input_report_switch (priv->input_dev,SW_TABLET_MODE , m); - m = (vgbs &DOCK_MODE_FLAG ) ?1 :0 ; + m = (vgbs &VGBS_DOCK_MODE_FLAG ) ?1 :0 ;input_report_switch (priv->input_dev,SW_DOCK , m); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 345/717 adm8211: fix error return code in adm8211_probe()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 05c2a61d69ea306e891884a86486e1ef37c4b78d ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/net/wireless/admtek/adm8211.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/admtek/adm8211.c +4 -2
@@ -1796,6 +1796,7 @@ static int adm8211_probe(struct pci_dev *pdev,if (io_len <256 || mem_len <1024 ) {printk (KERN_ERR "%s (adm8211): Too short PCI resources\n" ,pci_name (pdev)); + err = -ENOMEM ; goto err_disable_pdev; }
@@ -1805,6 +1806,7 @@ static int adm8211_probe(struct pci_dev *pdev,if (reg !=ADM8211_SIG1 && reg !=ADM8211_SIG2 ) {printk (KERN_ERR "%s (adm8211): Invalid signature (0x%x)\n" ,pci_name (pdev), reg); + err = -EINVAL ; goto err_disable_pdev; }
@@ -1815,8 +1817,8 @@ static int adm8211_probe(struct pci_dev *pdev,return err;/* someone else grabbed it? don't disable it */ } -if (dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )) || -dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 ))) { + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (err) {printk (KERN_ERR "%s (adm8211): No suitable DMA available\n" ,pci_name (pdev)); goto err_free_reg;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 346/717 mtd: spi-nor: sst: fix BPn bits for the SST25VF064C
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 989d4b72bae3b05c1564d38e71e18f65b12734fb ]
This flash part actually has 4 block protection bits.
Please note, that this patch is just based on information of the datasheet of the datasheet and wasn't tested.
--- drivers/mtd/spi-nor/sst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/sst.c +2 -1
@@ -18,7 +18,8 @@ static const struct flash_info sst_parts[] = { SECT_4K | SST_WRITE) }, {"sst25vf032b" ,INFO (0xbf254a ,0 ,64 *1024 ,64 , SECT_4K | SST_WRITE) }, - { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, SECT_4K) }, + { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, + SECT_4K | SPI_NOR_4BIT_BP) }, { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE) }, { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 347/717 mtd: spi-nor: ignore errors in spi_nor_unlock_all()
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit bdb1a75e4b9df6861ec6a6e3e3997820d3cebabe ]
Just try to unlock the whole SPI-NOR flash array. Don't abort the probing in case of an error. Justifications:
(1) For some boards, this just works because spi_nor_write_16bit_sr_and_check() is broken and just checks the second half of the 16bit. Once that will be fixed, SPI probe will fail for boards which has hardware-write protected SPI-NOR flashes.
(2) Until now, hardware write-protection was the only viable solution to use the block protection bits. This is because this very function spi_nor_unlock_all() will be called unconditionally on every linux boot. Therefore, this bits only makes sense in combination with the hardware write-protection. If we would fail the SPI probe on an error in spi_nor_unlock_all() we'd break virtually all users of the block protection bits.
(3) We should try hard to keep the MTD working even if the flash might not be writable/erasable.
--- drivers/mtd/spi-nor/core.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/mtd/spi-nor/core.c +13 -10
@@ -2915,20 +2915,27 @@ static int spi_nor_quad_enable(struct spi_nor *nor) }/** -* spi_nor_unlock_all() - Unlocks the entire flash memory array. +* spi_nor_try_unlock_all() - Tries to unlock the entire flash memory array. * @nor: pointer to a 'struct spi_nor'. * * Some SPI NOR flashes are write protected by default after a power-on reset * cycle, in order to avoid inadvertent writes during power-up. Backward * compatibility imposes to unlock the entire flash memory array at power-up * by default. +* +* Unprotecting the entire flash array will fail for boards which are hardware +* write-protected. Thus any errors are ignored. */ -static int spi_nor_unlock_all (struct spi_nor *nor) +static void spi_nor_try_unlock_all (struct spi_nor *nor) { -if (nor->flags &SNOR_F_HAS_LOCK ) -return spi_nor_unlock (&nor->mtd,0 , nor->params->size); +int ret; -return 0 ; +if (!(nor->flags &SNOR_F_HAS_LOCK )) +return ; + + ret =spi_nor_unlock (&nor->mtd,0 , nor->params->size); +if (ret) +dev_dbg (nor->dev,"Failed to unlock the entire flash memory array\n" ); }static int spi_nor_init (struct spi_nor *nor)
@@ -2941,11 +2948,7 @@ static int spi_nor_init(struct spi_nor *nor)return err; } - err =spi_nor_unlock_all (nor); -if (err) { -dev_dbg (nor->dev,"Failed to unlock the entire flash memory array\n" ); -return err; - } +spi_nor_try_unlock_all (nor);if (nor->addr_width ==4 && !(nor->flags &SNOR_F_4B_OPCODES )) {/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 348/717 mtd: spi-nor: atmel: remove global protection flag
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit e6204d4620276398ed7317d64c369813a1f96615 ]
This is considered bad for the following reasons:
(1) We only support the block protection with BPn bits for write protection. Not all Atmel parts support this.
(2) Newly added flash chip will automatically inherit the "has locking" support and thus needs to explicitly tested. Better be opt-in instead of opt-out.
(3) There are already supported flashes which doesn't support the locking scheme. So I assume this wasn't properly tested before adding that chip; which enforces my previous argument that locking support should be an opt-in.
Remove the global flag and add individual flags to all flashes which supports BP locking. In particular the following flashes don't support the BP scheme:
- AT26F004
- AT25SL321
- AT45DB081D
Please note, that some flashes which are marked as SPI_NOR_HAS_LOCK just support Global Protection, i.e. not our supported block protection locking scheme. This is to keep backwards compatibility with the current "unlock all at boot" mechanism. In particular the following flashes doesn't have BP bits:
- AT25DF041A
- AT25DF321
- AT25DF321A
- AT25DF641
- AT26DF081A
- AT26DF161A
- AT26DF321
--- drivers/mtd/spi-nor/atmel.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
drivers/mtd/spi-nor/atmel.c +9 -19
@@ -10,37 +10,27 @@static const struct flash_info atmel_parts[] = {/* Atmel -- some are (confusingly) marketed as "DataFlash" */ - {"at25fs010" ,INFO (0x1f6601 ,0 ,32 *1024 ,4 ,SECT_4K ) }, - {"at25fs040" ,INFO (0x1f6604 ,0 ,64 *1024 ,8 ,SECT_4K ) }, + {"at25fs010" ,INFO (0x1f6601 ,0 ,32 *1024 ,4 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at25fs040" ,INFO (0x1f6604 ,0 ,64 *1024 ,8 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, - {"at25df041a" ,INFO (0x1f4401 ,0 ,64 *1024 ,8 ,SECT_4K ) }, - {"at25df321" ,INFO (0x1f4700 ,0 ,64 *1024 ,64 ,SECT_4K ) }, - {"at25df321a" ,INFO (0x1f4701 ,0 ,64 *1024 ,64 ,SECT_4K ) }, - {"at25df641" ,INFO (0x1f4800 ,0 ,64 *1024 ,128 ,SECT_4K ) }, + {"at25df041a" ,INFO (0x1f4401 ,0 ,64 *1024 ,8 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at25df321" ,INFO (0x1f4700 ,0 ,64 *1024 ,64 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at25df321a" ,INFO (0x1f4701 ,0 ,64 *1024 ,64 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at25df641" ,INFO (0x1f4800 ,0 ,64 *1024 ,128 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, {"at25sl321" ,INFO (0x1f4216 ,0 ,64 *1024 ,64 ,SECT_4K |SPI_NOR_DUAL_READ |SPI_NOR_QUAD_READ ) }, {"at26f004" ,INFO (0x1f0400 ,0 ,64 *1024 ,8 ,SECT_4K ) }, - {"at26df081a" ,INFO (0x1f4501 ,0 ,64 *1024 ,16 ,SECT_4K ) }, - {"at26df161a" ,INFO (0x1f4601 ,0 ,64 *1024 ,32 ,SECT_4K ) }, - {"at26df321" ,INFO (0x1f4700 ,0 ,64 *1024 ,64 ,SECT_4K ) }, + {"at26df081a" ,INFO (0x1f4501 ,0 ,64 *1024 ,16 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at26df161a" ,INFO (0x1f4601 ,0 ,64 *1024 ,32 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at26df321" ,INFO (0x1f4700 ,0 ,64 *1024 ,64 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, {"at45db081d" ,INFO (0x1f2500 ,0 ,64 *1024 ,16 ,SECT_4K ) }, }; -static void atmel_default_init (struct spi_nor *nor) -{ - nor->flags |=SNOR_F_HAS_LOCK ; -} - -static const struct spi_nor_fixups atmel_fixups = { - .default_init = atmel_default_init, -}; -const struct spi_nor_manufacturer spi_nor_atmel = { .name ="atmel" , .parts = atmel_parts, .nparts =ARRAY_SIZE (atmel_parts), - .fixups = &atmel_fixups, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 349/717 mtd: spi-nor: atmel: fix unlock_all() for AT25FS010/040
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 8c174d1511d235ed6c049dcb2b704777ad0df7a5 ]
These flashes have some weird BP bits mapping which aren't supported in the current locking code. Just add a simple unlock op to unprotect the entire flash array which is needed for legacy behavior.
--- drivers/mtd/spi-nor/atmel.c | 53 +++++++++++++++++++++++++++++++++++-- drivers/mtd/spi-nor/core.c | 2 +- drivers/mtd/spi-nor/core.h | 1 + 3 files changed, 53 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/atmel.c +51 -2
@@ -8,10 +8,59 @@#include "core.h" +/* +* The Atmel AT25FS010/AT25FS040 parts have some weird configuration for the +* block protection bits. We don't support them. But legacy behavior in linux +* is to unlock the whole flash array on startup. Therefore, we have to support +* exactly this operation. +*/ +static int atmel_at25fs_lock (struct spi_nor *nor,loff_t ofs,uint64_t len) +{ +return -EOPNOTSUPP ; +} + +static int atmel_at25fs_unlock (struct spi_nor *nor,loff_t ofs,uint64_t len) +{ +int ret; + +/* We only support unlocking the whole flash array */ +if (ofs || len != nor->params->size) +return -EINVAL ; + +/* Write 0x00 to the status register to disable write protection */ + ret =spi_nor_write_sr_and_check (nor,0 ); +if (ret) +dev_dbg (nor->dev,"unable to clear BP bits, WP# asserted?\n" ); + +return ret; +} + +static int atmel_at25fs_is_locked (struct spi_nor *nor,loff_t ofs,uint64_t len) +{ +return -EOPNOTSUPP ; +} + +static const struct spi_nor_locking_ops atmel_at25fs_locking_ops = { + .lock = atmel_at25fs_lock, + .unlock = atmel_at25fs_unlock, + .is_locked = atmel_at25fs_is_locked, +}; + +static void atmel_at25fs_default_init (struct spi_nor *nor) +{ + nor->params->locking_ops = &atmel_at25fs_locking_ops; +} + +static const struct spi_nor_fixups atmel_at25fs_fixups = { + .default_init = atmel_at25fs_default_init, +}; +static const struct flash_info atmel_parts[] = {/* Atmel -- some are (confusingly) marketed as "DataFlash" */ - {"at25fs010" ,INFO (0x1f6601 ,0 ,32 *1024 ,4 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, - {"at25fs040" ,INFO (0x1f6604 ,0 ,64 *1024 ,8 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, + {"at25fs010" ,INFO (0x1f6601 ,0 ,32 *1024 ,4 ,SECT_4K |SPI_NOR_HAS_LOCK ) + .fixups = &atmel_at25fs_fixups }, + {"at25fs040" ,INFO (0x1f6604 ,0 ,64 *1024 ,8 ,SECT_4K |SPI_NOR_HAS_LOCK ) + .fixups = &atmel_at25fs_fixups }, {"at25df041a" ,INFO (0x1f4401 ,0 ,64 *1024 ,8 ,SECT_4K |SPI_NOR_HAS_LOCK ) }, {"at25df321" ,INFO (0x1f4700 ,0 ,64 *1024 ,64 ,SECT_4K |SPI_NOR_HAS_LOCK ) },
drivers/mtd/spi-nor/core.c +1 -1
@@ -906,7 +906,7 @@ static int spi_nor_write_16bit_cr_and_check(struct spi_nor *nor, u8 cr)* * Return: 0 on success, -errno otherwise. */ -static int spi_nor_write_sr_and_check (struct spi_nor *nor,u8 sr1) +int spi_nor_write_sr_and_check (struct spi_nor *nor,u8 sr1) {if (nor->flags &SNOR_F_HAS_16BIT_SR )return spi_nor_write_16bit_sr_and_check (nor, sr1);
drivers/mtd/spi-nor/core.h +1 -0
@@ -409,6 +409,7 @@ void spi_nor_unlock_and_unprep(struct spi_nor *nor);int spi_nor_sr1_bit6_quad_enable (struct spi_nor *nor);int spi_nor_sr2_bit1_quad_enable (struct spi_nor *nor);int spi_nor_sr2_bit7_quad_enable (struct spi_nor *nor); +int spi_nor_write_sr_and_check (struct spi_nor *nor,u8 sr1);int spi_nor_xread_sr (struct spi_nor *nor,u8 *sr); ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 350/717 arm64: dts: meson: g12b: odroid-n2: fix PHY deassert timing requirements
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 1c7412530d5d0e0a0b27f1642f5c13c8b9f36f05 ]
According to the datasheet (Rev. 1.9) the RTL8211F requires at least 72ms "for internal circuits settling time" before accessing the PHY registers. This fixes an issue where the Ethernet link doesn't come up when using ip link set down/up:
[ 29.360965] meson8b-dwmac ff3f0000.ethernet eth0: Link is Down [ 34.569012] meson8b-dwmac ff3f0000.ethernet eth0: PHY [0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=31) [ 34.676732] meson8b-dwmac ff3f0000.ethernet: Failed to reset the dma [ 34.678874] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed [ 34.687850] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_open: Hw setup failed
--- arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +1 -1
@@ -413,7 +413,7 @@ max-speed = <1000>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; interrupt-parent = <&gpio_intc>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 351/717 arm64: dts: meson: fix PHY deassert timing requirements
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit c183c406c4321002fe85b345b51bc1a3a04b6d33 ]
According to the datasheet (Rev. 1.9) the RTL8211F requires at least 72ms "for internal circuits settling time" before accessing the PHY registers. This fixes an issue seen on ODROID-C2 where the Ethernet link doesn't come up when using ip link set down/up:
[ 6630.714855] meson8b-dwmac c9410000.ethernet eth0: Link is Down [ 6630.785775] meson8b-dwmac c9410000.ethernet eth0: PHY [stmmac-0:00] driver [RTL8211F Gigabit Ethernet] (irq=36) [ 6630.893071] meson8b-dwmac c9410000.ethernet: Failed to reset the dma [ 6630.893800] meson8b-dwmac c9410000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed [ 6630.902835] meson8b-dwmac c9410000.ethernet eth0: stmmac_open: Hw setup failed
--- arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 2 +- arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +1 -1
@@ -165,7 +165,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +1 -1
@@ -200,7 +200,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +1 -1
@@ -126,7 +126,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +1 -1
@@ -147,7 +147,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts +1 -1
@@ -82,7 +82,7 @@ /* External PHY reset is shared with internal PHY Led signal */ reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +1 -1
@@ -194,7 +194,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +1 -1
@@ -112,7 +112,7 @@ max-speed = <1000>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; }; };
arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts +1 -1
@@ -64,7 +64,7 @@ /* External PHY reset is shared with internal PHY Led signal */ reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +1 -1
@@ -114,7 +114,7 @@ max-speed = <1000>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; }; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 352/717 ARM: dts: meson: fix PHY deassert timing requirements
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 656ab1bdcd2b755dc161a9774201100d5bf74b8d ]
According to the datasheet (Rev. 1.9) the RTL8211F requires at least 72ms "for internal circuits settling time" before accessing the PHY registers. On similar boards with the same PHY this fixes an issue where Ethernet link would not come up when using ip link set down/up.
--- arch/arm/boot/dts/meson8b-odroidc1.dts | 2 +- arch/arm/boot/dts/meson8m2-mxiii-plus.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/meson8b-odroidc1.dts +1 -1
@@ -224,7 +224,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; interrupt-parent = <&gpio_intc>;
arch/arm/boot/dts/meson8m2-mxiii-plus.dts +1 -1
@@ -81,7 +81,7 @@ reg = <0>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; }; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 353/717 arm64: dts: meson: g12a: x96-max: fix PHY deassert timing requirements
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 3d07c3b3a886fefd583c1b485b5e4e3c4e2da493 ]
According to the datasheet (Rev. 1.9) the RTL8211F requires at least 72ms "for internal circuits settling time" before accessing the PHY registers. On similar boards with the same PHY this fixes an issue where Ethernet link would not come up when using ip link set down/up.
--- arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts +1 -1
@@ -340,7 +340,7 @@ eee-broken-1000t; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; interrupt-parent = <&gpio_intc>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 354/717 arm64: dts: meson: g12b: w400: fix PHY deassert timing requirements
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 9e454e37dc7c0ee9e108d70b983e7a71332aedff ]
According to the datasheet (Rev. 1.9) the RTL8211F requires at least 72ms "for internal circuits settling time" before accessing the PHY egisters. On similar boards with the same PHY this fixes an issue where Ethernet link would not come up when using ip link set down/up.
--- arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +1 -1
@@ -264,7 +264,7 @@ max-speed = <1000>; reset-assert-us = <10000>; - reset-deassert-us = <30000>; + reset-deassert-us = <80000>; reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; interrupt-parent = <&gpio_intc>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 355/717 clk: fsl-sai: fix memory leak
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit e81bed419f032824e7ddf8b5630153be6637e480 ]
If the device is removed we don't unregister the composite clock. Fix that.
--- drivers/clk/clk-fsl-sai.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/clk/clk-fsl-sai.c +12 -0
@@ -68,9 +68,20 @@ static int fsl_sai_clk_probe(struct platform_device *pdev)if (IS_ERR (hw))return PTR_ERR (hw); +platform_set_drvdata (pdev, hw); +return devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, hw); } +static int fsl_sai_clk_remove (struct platform_device *pdev) +{ +struct clk_hw *hw =platform_get_drvdata (pdev); + +clk_hw_unregister_composite (hw); + +return 0 ; +} +static const struct of_device_id of_fsl_sai_clk_ids[] = { { .compatible ="fsl,vf610-sai-clock" }, { }
@@ -79,6 +90,7 @@ MODULE_DEVICE_TABLE(of, of_fsl_sai_clk_ids);static struct platform_driver fsl_sai_clk_driver = { .probe = fsl_sai_clk_probe, + .remove = fsl_sai_clk_remove, .driver = { .name ="fsl-sai-clk" , .of_match_table = of_fsl_sai_clk_ids,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 356/717 scsi: qedi: Fix missing destroy_workqueue() on error in __qedi_probe
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 62eebd5247c4e4ce08826ad5995cf4dd7ce919dd ]
Add the missing destroy_workqueue() before return from __qedi_probe in the error handling case when fails to create workqueue qedi->offload_thread.
--- drivers/scsi/qedi/qedi_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/qedi/qedi_main.c +3 -1
@@ -2766,7 +2766,7 @@ retry_probe:QEDI_ERR (&qedi->dbg_ctx,"Unable to start offload thread!\n" ); rc = -ENODEV ; - goto free_cid_que; + goto free_tmf_thread; }INIT_DELAYED_WORK (&qedi->recovery_work, qedi_recovery_handler);
@@ -2790,6 +2790,8 @@ retry_probe:return 0 ; +free_tmf_thread: +destroy_workqueue (qedi->tmf_thread); free_cid_que:qedi_release_cid_que (qedi); free_uio:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 357/717 scsi: pm80xx: Fix error return in pm8001_pci_probe()
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 97031ccffa4f62728602bfea8439dd045cd3aeb2 ]
The driver did not return an error in the case where pm8001_configure_phy_settings() failed.
Use rc to store the return value of pm8001_configure_phy_settings().
--- drivers/scsi/pm8001/pm8001_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_init.c +2 -1
@@ -1131,7 +1131,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev,pm8001_init_sas_add (pm8001_ha);/* phy setting support for motherboard controller */ -if (pm8001_configure_phy_settings (pm8001_ha)) + rc =pm8001_configure_phy_settings (pm8001_ha); +if (rc) goto err_out_shost;pm8001_post_sas_ha_init (shost, chip);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 358/717 scsi: iscsi: Fix inappropriate use of put_device()
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 6dc1c7ab6f047f45b62986ffebc5324e86ed5f5a ]
kfree(conn) is called inside put_device(&conn->dev) which could lead to use-after-free. In addition, device_unregister() should be used here rather than put_deviceO().
--- drivers/scsi/scsi_transport_iscsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_transport_iscsi.c +3 -1
@@ -2313,7 +2313,9 @@ iscsi_create_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid)return conn; release_conn_ref: -put_device (&conn->dev); +device_unregister (&conn->dev); +put_device (&session->dev); +return NULL ; release_parent_ref:put_device (&session->dev); free_conn:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 359/717 seq_buf: Avoid type mismatch for seq_buf_init
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d9a9280a0d0ae51dc1d4142138b99242b7ec8ac6 ]
Building with W=2 prints a number of warnings for one function that has a pointer type mismatch:
linux/seq_buf.h: In function 'seq_buf_init':linux/seq_buf.h:35:12: warning: pointer targets in assignment from 'unsigned char *' to 'char *' differ in signedness [-Wpointer-sign]
Change the type in the function prototype according to the type in the structure.
--- include/linux/seq_buf.h | 2 +- include/linux/trace_seq.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/seq_buf.h +1 -1
@@ -30,7 +30,7 @@ static inline void seq_buf_clear(struct seq_buf *s) }static inline void -seq_buf_init (struct seq_buf *s,unsigned char *buf,unsigned int size) +seq_buf_init (struct seq_buf *s,char *buf,unsigned int size) { s->buffer = buf; s->size = size;
include/linux/trace_seq.h +2 -2
@@ -12,7 +12,7 @@*/ struct trace_seq { -unsigned char buffer[PAGE_SIZE ]; +char buffer[PAGE_SIZE ];struct seq_buf seq;int full; };
@@ -51,7 +51,7 @@ static inline int trace_seq_used(struct trace_seq *s)* that is about to be written to and then return the result * of that write. */ -static inline unsigned char * +static inline char *trace_seq_buffer_ptr (struct trace_seq *s) {return s->buffer +seq_buf_used (&s->seq);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 360/717 scsi: fnic: Fix error return code in fnic_probe()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit d4fc94fe65578738ded138e9fce043db6bfc3241 ]
Return a negative error code from the error handling case instead of 0 as done elsewhere in this function.
--- drivers/scsi/fnic/fnic_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/fnic/fnic_main.c +1 -0
@@ -740,6 +740,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)for (i =0 ; i <FNIC_IO_LOCKS ; i++)spin_lock_init (&fnic->io_req_lock[i]); + err = -ENOMEM ; fnic->io_req_pool =mempool_create_slab_pool (2 , fnic_io_req_cache);if (!fnic->io_req_pool) goto err_out_free_resources;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 361/717 platform/x86: mlx-platform: Fix item counter assignment for MSN2700, MSN24xx systems
In reply to Greg Kroah-HartmanFrom: Vadim Pasternak <[email protected]>
[ Upstream commit ba4939f1dd46dde08c2f9b9d7ac86ed3ea7ead86 ]
Fix array names to match assignments for data items and data items counter in 'mlxplat_mlxcpld_default_items' structure for:
.data = mlxplat_mlxcpld_default_pwr_items_data, .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
and
.data = mlxplat_mlxcpld_default_fan_items_data, .count = ARRAY_SIZE(mlxplat_mlxcpld_fan),
Replace:
- 'mlxplat_mlxcpld_pwr' by 'mlxplat_mlxcpld_default_pwr_items_data' for ARRAY_SIZE() calculation.
- 'mlxplat_mlxcpld_fan' by 'mlxplat_mlxcpld_default_fan_items_data' for ARRAY_SIZE() calculation.
--- drivers/platform/x86/mlx-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/mlx-platform.c +2 -2
@@ -465,7 +465,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, .mask = MLXPLAT_CPLD_PWR_MASK, - .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr), + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), .inversed = 0, .health = false, },
@@ -474,7 +474,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { .aggr_mask = MLXPLAT_CPLD_AGGR_FAN_MASK_DEF, .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, .mask = MLXPLAT_CPLD_FAN_MASK, - .count = ARRAY_SIZE(mlxplat_mlxcpld_fan), + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), .inversed = 1, .health = false, },
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 362/717 platform/x86: mlx-platform: Fix item counter assignment for MSN2700/ComEx system
In reply to Greg Kroah-HartmanFrom: Vadim Pasternak <[email protected]>
[ Upstream commit cf791774a16caf87b0e4c0c55b82979bad0b6c01 ]
Fix array names to match assignments for data items and data items counter in 'mlxplat_mlxcpld_comex_items' structure for:
.data = mlxplat_mlxcpld_default_pwr_items_data, .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
and
.data = mlxplat_mlxcpld_default_fan_items_data, .count = ARRAY_SIZE(mlxplat_mlxcpld_fan),
Replace:
- 'mlxplat_mlxcpld_pwr' by 'mlxplat_mlxcpld_default_pwr_items_data' for ARRAY_SIZE() calculation.
- 'mlxplat_mlxcpld_fan' by 'mlxplat_mlxcpld_default_fan_items_data' for ARRAY_SIZE() calculation.
--- drivers/platform/x86/mlx-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/mlx-platform.c +2 -2
@@ -504,7 +504,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, .mask = MLXPLAT_CPLD_PWR_MASK, - .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr), + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), .inversed = 0, .health = false, },
@@ -513,7 +513,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, .mask = MLXPLAT_CPLD_FAN_MASK, - .count = ARRAY_SIZE(mlxplat_mlxcpld_fan), + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), .inversed = 1, .health = false, },
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 363/717 ARM: 9030/1: entry: omit FP emulation for UND exceptions taken in kernel mode
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit f77ac2e378be9dd61eb88728f0840642f045d9d1 ]
There are a couple of problems with the exception entry code that deals with FP exceptions (which are reported as UND exceptions) when building the kernel in Thumb2 mode:
- the conditional branch to vfp_kmode_exception in vfp_support_entry() may be out of range for its target, depending on how the linker decides to arrange the sections;
- when the UND exception is taken in kernel mode, the emulation handling logic is entered via the 'call_fpe' label, which means we end up using the wrong value/mask pairs to match and detect the NEON opcodes.
Since UND exceptions in kernel mode are unlikely to occur on a hot path (as opposed to the user mode version which is invoked for VFP support code and lazy restore), we can use the existing undef hook machinery for any kernel mode instruction emulation that is needed, including calling the existing vfp_kmode_exception() routine for unexpected cases. So drop the call to call_fpe, and instead, install an undef hook that will get called for NEON and VFP instructions that trigger an UND exception in kernel mode.
While at it, make sure that the PC correction is accurate for the execution mode where the exception was taken, by checking the PSR Thumb bit.
--- arch/arm/kernel/entry-armv.S | 25 ++---------------- arch/arm/vfp/vfphw.S | 5 ---- arch/arm/vfp/vfpmodule.c | 49 ++++++++++++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 30 deletions(-)
arch/arm/kernel/entry-armv.S +2 -23
@@ -252,31 +252,10 @@ __und_svc: #else svc_entry #endif - @ - @ call emulation code, which returns using r9 if it has emulated - @ the instruction, or the more conventional lr if we are to treat - @ this as a real undefined instruction - @ - @ r0 - instruction - @ -#ifndef CONFIG_THUMB2_KERNEL - ldr r0, [r4, #-4] -#else - mov r1, #2 - ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2 - cmp r0, #0xe800 @ 32-bit instruction if xx >= 0 - blo __und_svc_fault - ldrh r9, [r4] @ bottom 16 bits - add r4, r4, #2 - str r4, [sp, #S_PC] - orr r0, r9, r0, lsl #16 -#endif - badr r9, __und_svc_finish - mov r2, r4 - bl call_fpe mov r1, #4 @ PC correction to apply -__und_svc_fault: + THUMB( tst r5, #PSR_T_BIT ) @ exception taken in Thumb mode? + THUMB( movne r1, #2 ) @ if so, fix up PC correction mov r0, sp @ struct pt_regs *regs bl __und_fault
arch/arm/vfp/vfphw.S +0 -5
@@ -79,11 +79,6 @@ ENTRY(vfp_support_entry) DBGSTR3 "instr %08x pc %08x state %p", r0, r2, r10 .fpu vfpv2 - ldr r3, [sp, #S_PSR] @ Neither lazy restore nor FP exceptions - and r3, r3, #MODE_MASK @ are supported in kernel mode - teq r3, #USR_MODE - bne vfp_kmode_exception @ Returns through lr - VFPFMRX r1, FPEXC @ Is the VFP enabled? DBGSTR1 "fpexc %08x", r1 tst r1, #FPEXC_EN
arch/arm/vfp/vfpmodule.c +47 -2
69 lines not on this page · raw message
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 364/717 powerpc/pseries/hibernation: drop pseries_suspend_begin() from suspend ops
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit 52719fce3f4c7a8ac9eaa191e8d75a697f9fbcbc ]
There are three ways pseries_suspend_begin() can be reached:
1. When "mem" is written to /sys/power/state:
kobj_attr_store()
-> state_store()
-> pm_suspend()
-> suspend_devices_and_enter()
-> pseries_suspend_begin()This never works because there is no way to supply a valid stream id using this interface, and H_VASI_STATE is called with a stream id of zero. So this call path is useless at best.
2. When a stream id is written to /sys/devices/system/power/hibernate. pseries_suspend_begin() is polled directly from store_hibernate() until the stream is in the "Suspending" state (i.e. the platform is ready for the OS to suspend execution):
dev_attr_store()
-> store_hibernate()
-> pseries_suspend_begin()
3. When a stream id is written to /sys/devices/system/power/hibernate (continued). After #2, pseries_suspend_begin() is called once again from the pm core:
dev_attr_store()
-> store_hibernate()
-> pm_suspend()
-> suspend_devices_and_enter()
-> pseries_suspend_begin()This is redundant because the VASI suspend state is already known to be Suspending.
The begin() callback of platform_suspend_ops is optional, so we can simply remove that assignment with no loss of function.
--- arch/powerpc/platforms/pseries/suspend.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/platforms/pseries/suspend.c +0 -1
@@ -187,7 +187,6 @@ static struct bus_type suspend_subsys = {static const struct platform_suspend_ops pseries_suspend_ops = { .valid = suspend_valid_only_mem, - .begin = pseries_suspend_begin, .prepare_late = pseries_prepare_late, .enter = pseries_suspend_enter, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 365/717 powerpc/pseries/hibernation: remove redundant cacheinfo update
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit b866459489fe8ef0e92cde3cbd6bbb1af6c4e99b ]
Partitions with cache nodes in the device tree can encounter the following warning on resume:
CPU 0 already accounted in PowerPC,POWER9@0(Data)
WARNING: CPU: 0 PID: 3177 at arch/powerpc/kernel/cacheinfo.c:197 cacheinfo_cpu_online+0x640/0x820
These calls to cacheinfo_cpu_offline/online have been redundant since commit e610a466d16a ("powerpc/pseries/mobility: rebuild cacheinfo hierarchy post-migration").
--- arch/powerpc/platforms/pseries/suspend.c | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/platforms/pseries/suspend.c +0 -3
@@ -13,7 +13,6 @@#include <asm/mmu.h> #include <asm/rtas.h> #include <asm/topology.h> -#include "../../kernel/cacheinfo.h" static u64 stream_id;static struct device suspend_dev;
@@ -78,9 +77,7 @@ static void pseries_suspend_enable_irqs(void)* Update configuration which can be modified based on device tree * changes during resume. */ -cacheinfo_cpu_offline (smp_processor_id ());post_mobility_fixup (); -cacheinfo_cpu_online (smp_processor_id ()); }/**
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 366/717 powerpc/powermac: Fix low_sleep_handler with CONFIG_VMAP_STACK
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit db972a3787d12b1ce9ba7a31ec376d8a79e04c47 ]
low_sleep_handler() can't restore the context from standard stack because the stack can hardly be accessed with MMU OFF.
Store everything in a global storage area instead of storing a pointer to the stack in that global storage area.
To avoid a complete churn of the function, still use r1 as the pointer to the storage area during restore.
--- arch/powerpc/platforms/Kconfig.cputype | 2 +- arch/powerpc/platforms/powermac/sleep.S | 132 +++++++++++------------- 2 files changed, 60 insertions(+), 74 deletions(-)
arch/powerpc/platforms/Kconfig.cputype +1 -1
@@ -36,7 +36,7 @@ config PPC_BOOK3S_6xx select PPC_HAVE_PMU_SUPPORT select PPC_HAVE_KUEP select PPC_HAVE_KUAP - select HAVE_ARCH_VMAP_STACK if !ADB_PMU + select HAVE_ARCH_VMAP_STACK config PPC_85xx bool "Freescale 85xx"
arch/powerpc/platforms/powermac/sleep.S +59 -73
240 lines not on this page · raw message
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 367/717 drm/mediatek: avoid dereferencing a null hdmi_phy on an error message
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit b097efba9580d1f7cbc80cda84e768983e3de541 ]
Currently there is a null pointer check for hdmi_phy that implies it may be null, however a dev_err messages dereferences this potential null pointer. Avoid a null pointer dereference by only emitting the dev_err message if hdmi_phy is non-null. It is a moot point if the error message needs to be printed at all, but since this is a relatively new piece of code it may be useful to keep the message in for the moment in case there are unforseen errors that need to be reported.
Addresses-Coverity: ("Dereference after null check")
--- drivers/phy/mediatek/phy-mtk-hdmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/phy/mediatek/phy-mtk-hdmi.c +3 -2
@@ -84,8 +84,9 @@ mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy) hdmi_phy->conf->hdmi_phy_disable_tmds)return &mtk_hdmi_phy_dev_ops; -dev_err (hdmi_phy->dev,"Failed to get dev ops of phy\n" ); -return NULL ; +if (hdmi_phy) +dev_err (hdmi_phy->dev,"Failed to get dev ops of phy\n" ); +return NULL ; } static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 368/717 ASoC: amd: change clk_get() to devm_clk_get() and add missed checks
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 95d3befbc5e1ee39fc8a78713924cf7ed2b3cabe ]
cz_da7219_init() does not check the return values of clk_get(), while da7219_clk_enable() calls clk_set_rate() to dereference the pointers.
Add checks to fix the problems.
Also, change clk_get() to devm_clk_get() to avoid data leak after failures.
--- sound/soc/amd/acp-da7219-max98357a.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
sound/soc/amd/acp-da7219-max98357a.c +7 -2
@@ -73,8 +73,13 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)return ret; } - da7219_dai_wclk =clk_get (component->dev,"da7219-dai-wclk" ); - da7219_dai_bclk =clk_get (component->dev,"da7219-dai-bclk" ); + da7219_dai_wclk =devm_clk_get (component->dev,"da7219-dai-wclk" ); +if (IS_ERR (da7219_dai_wclk)) +return PTR_ERR (da7219_dai_wclk); + + da7219_dai_bclk =devm_clk_get (component->dev,"da7219-dai-bclk" ); +if (IS_ERR (da7219_dai_bclk)) +return PTR_ERR (da7219_dai_bclk); ret = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_LINEOUT |
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 369/717 coresight: remove broken __exit annotations
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 45fe7befe0db5e61cd3c846315f0ac48541e8445 ]
Functions that are annotated __exit are discarded for built-in drivers, but the .remove callback in a device driver must still be kept around to allow bind/unbind operations.
There is now a linker warning for the discarded symbol references:
tmc_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-tmc-core.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-tmc-core.o tpiu_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-tpiu.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-tpiu.o etb_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-etb10.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-etb10.o static_funnel_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-funnel.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-funnel.o dynamic_funnel_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-funnel.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-funnel.o static_replicator_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-replicator.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-replicator.o dynamic_replicator_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-replicator.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-replicator.o catu_remove' referenced in section .data' of drivers/hwtracing/coresight/coresight-catu.o: defined in discarded section .exit.text' of drivers/hwtracing/coresight/coresight-catu.o
Remove all those annotations.
--- drivers/hwtracing/coresight/coresight-catu.c | 2 +- drivers/hwtracing/coresight/coresight-cti-core.c | 2 +- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- drivers/hwtracing/coresight/coresight-etm3x-core.c | 4 ++-- drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 ++-- drivers/hwtracing/coresight/coresight-funnel.c | 6 +++--- drivers/hwtracing/coresight/coresight-replicator.c | 6 +++--- drivers/hwtracing/coresight/coresight-stm.c | 2 +- drivers/hwtracing/coresight/coresight-tmc-core.c | 2 +- drivers/hwtracing/coresight/coresight-tpiu.c | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-)
drivers/hwtracing/coresight/coresight-catu.c +1 -1
@@ -567,7 +567,7 @@ out:return ret; } -static int __exit catu_remove(struct amba_device *adev) +static int catu_remove (struct amba_device *adev) {struct catu_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-cti-core.c +1 -1
@@ -836,7 +836,7 @@ static void cti_device_release(struct device *dev)if (drvdata->csdev_release) drvdata->csdev_release (dev); } -static int __exit cti_remove(struct amba_device *adev) +static int cti_remove (struct amba_device *adev) {struct cti_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-etb10.c +1 -1
@@ -803,7 +803,7 @@ err_misc_register:return ret; } -static int __exit etb_remove(struct amba_device *adev) +static int etb_remove (struct amba_device *adev) {struct etb_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-etm3x-core.c +2 -2
@@ -902,14 +902,14 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; } -static void __exit clear_etmdrvdata(void *info) +static void clear_etmdrvdata (void *info) {int cpu = *(int *)info; etmdrvdata[cpu] =NULL ; } -static int __exit etm_remove(struct amba_device *adev) +static int etm_remove (struct amba_device *adev) {struct etm_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-etm4x-core.c +2 -2
@@ -1570,14 +1570,14 @@ static struct amba_cs_uci_id uci_id_etm4[] = { } }; -static void __exit clear_etmdrvdata(void *info) +static void clear_etmdrvdata (void *info) {int cpu = *(int *)info; etmdrvdata[cpu] =NULL ; } -static int __exit etm4_remove(struct amba_device *adev) +static int etm4_remove (struct amba_device *adev) {struct etmv4_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-funnel.c +3 -3
@@ -274,7 +274,7 @@ out_disable_clk:return ret; } -static int __exit funnel_remove(struct device *dev) +static int funnel_remove (struct device *dev) {struct funnel_drvdata *drvdata =dev_get_drvdata (dev);
@@ -328,7 +328,7 @@ static int static_funnel_probe(struct platform_device *pdev)return ret; } -static int __exit static_funnel_remove(struct platform_device *pdev) +static int static_funnel_remove (struct platform_device *pdev) {funnel_remove (&pdev->dev);pm_runtime_disable (&pdev->dev);
@@ -370,7 +370,7 @@ static int dynamic_funnel_probe(struct amba_device *adev,return funnel_probe (&adev->dev, &adev->res); } -static int __exit dynamic_funnel_remove(struct amba_device *adev) +static int dynamic_funnel_remove (struct amba_device *adev) {return funnel_remove (&adev->dev); }
drivers/hwtracing/coresight/coresight-replicator.c +3 -3
@@ -291,7 +291,7 @@ out_disable_clk:return ret; } -static int __exit replicator_remove(struct device *dev) +static int replicator_remove (struct device *dev) {struct replicator_drvdata *drvdata =dev_get_drvdata (dev);
@@ -318,7 +318,7 @@ static int static_replicator_probe(struct platform_device *pdev)return ret; } -static int __exit static_replicator_remove(struct platform_device *pdev) +static int static_replicator_remove (struct platform_device *pdev) {replicator_remove (&pdev->dev);pm_runtime_disable (&pdev->dev);
@@ -388,7 +388,7 @@ static int dynamic_replicator_probe(struct amba_device *adev,return replicator_probe (&adev->dev, &adev->res); } -static int __exit dynamic_replicator_remove(struct amba_device *adev) +static int dynamic_replicator_remove (struct amba_device *adev) {return replicator_remove (&adev->dev); }
drivers/hwtracing/coresight/coresight-stm.c +1 -1
@@ -951,7 +951,7 @@ stm_unregister:return ret; } -static int __exit stm_remove(struct amba_device *adev) +static int stm_remove (struct amba_device *adev) {struct stm_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-tmc-core.c +1 -1
@@ -559,7 +559,7 @@ out:spin_unlock_irqrestore (&drvdata->spinlock, flags); } -static int __exit tmc_remove(struct amba_device *adev) +static int tmc_remove (struct amba_device *adev) {struct tmc_drvdata *drvdata =dev_get_drvdata (&adev->dev);
drivers/hwtracing/coresight/coresight-tpiu.c +1 -1
@@ -173,7 +173,7 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)return PTR_ERR (drvdata->csdev); } -static int __exit tpiu_remove(struct amba_device *adev) +static int tpiu_remove (struct amba_device *adev) {struct tpiu_drvdata *drvdata =dev_get_drvdata (&adev->dev);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 370/717 ASoC: max98390: Fix error codes in max98390_dsm_init()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3cea33b6f2d7782d1be17c71509986f33ee93541 ]
These error paths return success but they should return -EINVAL.
--- sound/soc/codecs/max98390.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/max98390.c +2 -0
@@ -784,6 +784,7 @@ static int max98390_dsm_init(struct snd_soc_component *component)if (fw->size <MAX98390_DSM_PARAM_MIN_SIZE ) {dev_err (component->dev,"param fw is invalid.\n" ); + ret = -EINVAL ; goto err_alloc; } dsm_param = (char *)fw->data;
@@ -794,6 +795,7 @@ static int max98390_dsm_init(struct snd_soc_component *component) fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) {dev_err (component->dev,"param fw is invalid.\n" ); + ret = -EINVAL ; goto err_alloc; }regmap_write (max98390->regmap,MAX98390_R203A_AMP_EN ,0x80 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 371/717 powerpc/mm: sanity_check_fault() should work for all, not only BOOK3S
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 7ceb40027e19567a0a066e3b380cc034cdd9a124 ]
The verification and message introduced by commit 374f3f5979f9 ("powerpc/mm/hash: Handle user access of kernel address gracefully") applies to all platforms, it should not be limited to BOOK3S.
Make the BOOK3S version of sanity_check_fault() the one for all, and bail out earlier if not BOOK3S.
--- arch/powerpc/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/mm/fault.c +3 -5
@@ -303,7 +303,6 @@ static inline void cmo_account_page_fault(void)static inline void cmo_account_page_fault (void ) { }#endif /* CONFIG_PPC_SMLPAR */ -#ifdef CONFIG_PPC_BOOK3S static void sanity_check_fault (bool is_write,bool is_user,unsigned long error_code,unsigned long address) {
@@ -320,6 +319,9 @@ static void sanity_check_fault(bool is_write, bool is_user,return ; } +if (!IS_ENABLED (CONFIG_PPC_BOOK3S )) +return ; +/* * For hash translation mode, we should never get a * PROTFAULT. Any update to pte to reduce access will result in us
@@ -354,10 +356,6 @@ static void sanity_check_fault(bool is_write, bool is_user,WARN_ON_ONCE (error_code &DSISR_PROTFAULT ); } -#else -static void sanity_check_fault (bool is_write,bool is_user, -unsigned long error_code,unsigned long address) { } -#endif /* CONFIG_PPC_BOOK3S */ /* * Define the correct "is_write" bit in error_code based
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 372/717 usb: ehci-omap: Fix PM disable depth umbalance in ehci_hcd_omap_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit d6ff32478d7e95d6ca199b5c852710d6964d5811 ]
The pm_runtime_enable will decrement the power disable depth. Imbalance depth will resulted in enabling runtime PM of device fails later. Thus a pairing decrement must be needed on the error handling path to keep it balanced.
--- drivers/usb/host/ehci-omap.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-omap.c +1 -0
@@ -220,6 +220,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) err_pm_runtime:pm_runtime_put_sync (dev); +pm_runtime_disable (dev); err_phy:for (i =0 ; i < omap->nports; i++) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 373/717 usb: oxu210hp-hcd: Fix memory leak in oxu_create
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit e5548b05631ec3e6bfdaef1cad28c799545b791b ]
usb_create_hcd will alloc memory for hcd, and we should call usb_put_hcd to free it when adding fails to prevent memory leak.
--- drivers/usb/host/oxu210hp-hcd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/oxu210hp-hcd.c +3 -1
@@ -4151,8 +4151,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev, oxu->is_otg = otg; ret =usb_add_hcd (hcd, irq,IRQF_SHARED ); -if (ret <0 ) +if (ret <0 ) { +usb_put_hcd (hcd);return ERR_PTR (ret); + }device_wakeup_enable (hcd->self.controller);return hcd;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 374/717 speakup: fix uninitialized flush_lock
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit d1b928ee1cfa965a3327bbaa59bfa005d97fa0fe ]
The flush_lock is uninitialized, use DEFINE_SPINLOCK to define and initialize flush_lock.
--- drivers/accessibility/speakup/speakup_dectlk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accessibility/speakup/speakup_dectlk.c +1 -1
@@ -37,7 +37,7 @@ static unsigned char get_index(struct spk_synth *synth);static int in_escape;static int is_flushing; -static spinlock_t flush_lock; +static DEFINE_SPINLOCK (flush_lock);static DECLARE_WAIT_QUEUE_HEAD (flush);static struct var_t vars[] = {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 375/717 nfsd: Fix message level for normal termination
In reply to Greg Kroah-HartmanFrom: kazuo ito <[email protected]>
[ Upstream commit 4420440c57892779f265108f46f83832a88ca795 ]
The warning message from nfsd terminating normally can confuse system adminstrators or monitoring software.
Though it's not exactly fair to pin-point a commit where it originated, the current form in the current place started to appear in:
--- fs/nfsd/nfssvc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfssvc.c +1 -2
@@ -527,8 +527,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)return ;nfsd_shutdown_net (net); -printk (KERN_WARNING "nfsd: last server has exited, flushing export " -"cache\n" ); +pr_info ("nfsd: last server has exited, flushing export cache\n" );nfsd_export_flush (net); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 376/717 NFSD: Fix 5 seconds delay when doing inter server copy
In reply to Greg Kroah-HartmanFrom: Dai Ngo <[email protected]>
[ Upstream commit ca9364dde50daba93eff711b4b945fd08beafcc2 ]
Since commit b4868b44c5628 ("NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE"), every inter server copy operation suffers 5 seconds delay regardless of the size of the copy. The delay is from nfs_set_open_stateid_locked when the check by nfs_stateid_is_sequential fails because the seqid in both nfs4_state and nfs4_stateid are 0.
Fix by modifying nfs4_init_cp_state to return the stateid with seqid 1 instead of 0. This is also to conform with section 4.8 of RFC 7862.
Here is the relevant paragraph from section 4.8 of RFC 7862:
A copy offload stateid's seqid MUST NOT be zero. In the context of a copy offload operation, it is inappropriate to indicate "the most recent copy offload operation" using a stateid with a seqid of zero (see Section 8.2.2 of [RFC5661]). It is inappropriate because the stateid refers to internal state in the server and there may be several asynchronous COPY operations being performed in parallel on the same file by the server. Therefore, a copy offload stateid with a seqid of zero MUST be considered invalid.
--- fs/nfsd/nfs4state.c | 1 + 1 file changed, 1 insertion(+)
fs/nfsd/nfs4state.c +1 -0
@@ -769,6 +769,7 @@ static int nfs4_init_cp_state(struct nfsd_net *nn, copy_stateid_t *stid,spin_lock (&nn->s2s_cp_lock); new_id =idr_alloc_cyclic (&nn->s2s_cp_stateids, stid,0 ,0 ,GFP_NOWAIT ); stid->stid.si_opaque.so_id = new_id; + stid->stid.si_generation =1 ;spin_unlock (&nn->s2s_cp_lock);idr_preload_end ();if (new_id <0 )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 377/717 nfs_common: need lock during iterate through the list
In reply to Greg Kroah-HartmanFrom: Cheng Lin <[email protected]>
[ Upstream commit 4a9d81caf841cd2c0ae36abec9c2963bf21d0284 ]
If the elem is deleted during be iterated on it, the iteration process will fall into an endless loop.
kernel: NMI watchdog: BUG: soft lockup - CPU#4 stuck for 22s! [nfsd:17137]
PID: 17137 TASK: ffff8818d93c0000 CPU: 4 COMMAND: "nfsd" [exception RIP: __state_in_grace+76]
RIP: ffffffffc00e817c RSP: ffff8818d3aefc98 RFLAGS: 00000246 RAX: ffff881dc0c38298 RBX: ffffffff81b03580 RCX: ffff881dc02c9f50 RDX: ffff881e3fce8500 RSI: 0000000000000001 RDI: ffffffff81b03580 RBP: ffff8818d3aefca0 R8: 0000000000000020 R9: ffff8818d3aefd40 R10: ffff88017fc03800 R11: ffff8818e83933c0 R12: ffff8818d3aefd40 R13: 0000000000000000 R14: ffff8818e8391068 R15: ffff8818fa6e4000 CS: 0010 SS: 0018
#0 [ffff8818d3aefc98] opens_in_grace at ffffffffc00e81e3 [grace] #1 [ffff8818d3aefca8] nfs4_preprocess_stateid_op at ffffffffc02a3e6c [nfsd] #2 [ffff8818d3aefd18] nfsd4_write at ffffffffc028ed5b [nfsd]
#3 [ffff8818d3aefd80] nfsd4_proc_compound at ffffffffc0290a0d [nfsd] #4 [ffff8818d3aefdd0] nfsd_dispatch at ffffffffc027b800 [nfsd] #5 [ffff8818d3aefe08] svc_process_common at ffffffffc02017f3 [sunrpc] #6 [ffff8818d3aefe70] svc_process at ffffffffc0201ce3 [sunrpc] #7 [ffff8818d3aefe98] nfsd at ffffffffc027b117 [nfsd]
#8 [ffff8818d3aefec8] kthread at ffffffff810b88c1
#9 [ffff8818d3aeff50] ret_from_fork at ffffffff816d1607
The troublemake elem:
crash> lock_manager ffff881dc0c38298
struct lock_manager {
list = {
next = 0xffff881dc0c38298,
prev = 0xffff881dc0c38298
},
block_opens = false
}
--- fs/nfs_common/grace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/nfs_common/grace.c +5 -1
@@ -69,10 +69,14 @@ __state_in_grace(struct net *net, bool open)if (!open)return !list_empty (grace_list); +spin_lock (&grace_lock);list_for_each_entry (lm, grace_list, list) { -if (lm->block_opens) +if (lm->block_opens) { +spin_unlock (&grace_lock);return true; + } } +spin_unlock (&grace_lock);return false; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 378/717 x86/kprobes: Restore BTF if the single-stepping is cancelled
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 78ff2733ff352175eb7f4418a34654346e1b6cd2 ]
Fix to restore BTF if single-stepping causes a page fault and it is cancelled.
Usually the BTF flag was restored when the single stepping is done (in resume_execution()). However, if a page fault happens on the single stepping instruction, the fault handler is invoked and the single stepping is cancelled. Thus, the BTF flag is not restored.
--- arch/x86/kernel/kprobes/core.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/kprobes/core.c +5 -0
@@ -937,6 +937,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)* So clear it by resetting the current kprobe: */ regs->flags &= ~X86_EFLAGS_TF ; +/* +* Since the single step (trap) has been cancelled, +* we need to restore BTF here. +*/ +restore_btf ();/* * If the TF flag was set before the kprobe hit,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 379/717 scsi: qla2xxx: Fix FW initialization error on big endian machines
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
[ Upstream commit 8a78dd6ed1af06bfa7b4ade81328ff7ea11b6947 ]
Some fields are not correctly byte swapped causing failure during initialization. As probe() returns failure, HBAs will not be claimed when this happens.
qla2xxx [0007:01:00.0]-ffff:3: Secure Flash Update in FW: Supported qla2xxx [0007:01:00.0]-ffff:3: SCM in FW: Supported
qla2xxx [0007:01:00.0]-00d2:3: Init Firmware **** FAILED ****. qla2xxx [0007:01:00.0]-00d6:3: Failed to initialize adapter - Adapter flags 2. qla2xxx 0007:01:00.1: enabling device (0140 -> 0142)
qla2xxx [0007:01:00.1]-011c: : MSI-X vector count: 128.
qla2xxx [0007:01:00.1]-001d: : Found an ISP2289 irq 18 iobase 0xd000080080004000. qla2xxx 0007:01:00.1: Using 64-bit direct DMA at offset 800000000000000
BUG: Bad page state in process insmod pfn:67118 page:f00000000168bd40 count:-1 mapcount:0 mapping: (null) index:0x0 page flags: 0x3ffff800000000() page dumped because: nonzero _count Modules linked in: qla2xxx(OE+) nvme_fc nvme_fabrics nvme_core scsi_transport_fc scsi_tgt nls_utf8 isofs ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter nx_crypto ses enclosure scsi_transport_sas pseries_rng sg ip_tables xfs libcrc32c sr_mod cdrom sd_mod crc_t10dif crct10dif_generic crct10dif_common usb_storage ipr libata tg3 ptp pps_core dm_mirror dm_region_hash dm_log dm_mod CPU: 32 PID: 8560 Comm: insmod Kdump: loaded Tainted: G OE ------------ 3.10.0-957.el7.ppc64 #1 Call Trace: [c0000006dd7caa70] [c00000000001cca8] .show_stack+0x88/0x330 (unreliable) [c0000006dd7cab30] [c000000000ac3d88] .dump_stack+0x28/0x3c [c0000006dd7caba0] [c00000000029e48c] .bad_page+0x15c/0x1c0 [c0000006dd7cac40] [c00000000029f938] .get_page_from_freelist+0x11e8/0x1ea0 [c0000006dd7caf40] [c0000000002a1d30] .__alloc_pages_nodemask+0x1c0/0xc70 [c0000006dd7cb140] [c00000000002ba0c] .__dma_direct_alloc_coherent+0x8c/0x170 [c0000006dd7cb1e0] [d000000010a94688] .qla2x00_mem_alloc+0x10f8/0x1370 [qla2xxx] [c0000006dd7cb2d0] [d000000010a9c790] .qla2x00_probe_one+0xb60/0x22e0 [qla2xxx] [c0000006dd7cb540] [c0000000005de764] .pci_device_probe+0x204/0x300 [c0000006dd7cb600] [c0000000006ca61c] .driver_probe_device+0x2cc/0x6f0 [c0000006dd7cb6b0] [c0000000006cabec] .__driver_attach+0x10c/0x110 [c0000006dd7cb740] [c0000000006c5f04] .bus_for_each_dev+0x94/0x100 [c0000006dd7cb7e0] [c0000000006c94f4] .driver_attach+0x34/0x50 [c0000006dd7cb860] [c0000000006c8f58] .bus_add_driver+0x298/0x3b0 [c0000006dd7cb900] [c0000000006cb6e0] .driver_register+0xb0/0x1a0 [c0000006dd7cb980] [c0000000005dc474] .__pci_register_driver+0xc4/0xf0 [c0000006dd7cba10] [d000000010b94e20] .qla2x00_module_init+0x2a8/0x328 [qla2xxx] [c0000006dd7cbaa0] [c00000000000c130] .do_one_initcall+0x130/0x2e0 [c0000006dd7cbb50] [c0000000001b2e8c] .load_module+0x1afc/0x2340 [c0000006dd7cbd40] [c0000000001b3920] .SyS_finit_module+0xd0/0x130 [c0000006dd7cbe30] [c00000000000a284] system_call+0x38/0xfc
--- drivers/scsi/qla2xxx/qla_mbx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +3 -3
@@ -1129,7 +1129,7 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha)if (ha->flags.scm_supported_a && (ha->fw_attributes_ext[0 ] &FW_ATTR_EXT0_SCM_SUPPORTED )) { ha->flags.scm_supported_f =1 ; - ha->sf_init_cb->flags |=BIT_13 ; + ha->sf_init_cb->flags |=cpu_to_le16 (BIT_13 ); } ql_log(ql_log_info, vha, 0x11a3, "SCM in FW: %s\n", (ha->flags.scm_supported_f) ? "Supported" :
@@ -1137,9 +1137,9 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha)if (vha->flags.nvme2_enabled) {/* set BIT_15 of special feature control block for SLER */ - ha->sf_init_cb->flags |=BIT_15 ; + ha->sf_init_cb->flags |=cpu_to_le16 (BIT_15 );/* set BIT_14 of special feature control block for PI CTRL*/ - ha->sf_init_cb->flags |=BIT_14 ; + ha->sf_init_cb->flags |=cpu_to_le16 (BIT_14 ); } }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 380/717 scsi: qla2xxx: Fix N2N and NVMe connect retry failure
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 07a5f69248e3486e387c40af64793466371c7d91 ]
FC-NVMe target discovery failed when initiator wwpn < target wwpn in an N2N (Direct Attach) config, where the driver was stuck on FCP PRLI mode and failed to retry with NVMe PRLI.
--- drivers/scsi/qla2xxx/qla_init.c | 71 ++++++++++++++++++++++++--------- drivers/scsi/qla2xxx/qla_mbx.c | 3 -- 2 files changed, 52 insertions(+), 22 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +52 -19
@@ -1268,9 +1268,10 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport) lio->u.logio.flags |=SRB_LOGIN_NVME_PRLI ;ql_dbg (ql_dbg_disc, vha,0x211b , -"Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d %s.\n" , +"Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d fc4type %x priority %x %s.\n" , fcport->port_name, sp->handle, fcport->loop_id, fcport->d_id.b24, - fcport->login_retry,NVME_TARGET (vha->hw, fcport) ?"nvme" :"fc" ); + fcport->login_retry, fcport->fc4_type, vha->hw->fc4_type_priority, +NVME_TARGET (vha->hw, fcport) ?"nvme" :"fcp" ); rval =qla2x00_start_sp (sp);if (rval !=QLA_SUCCESS ) {
@@ -1932,26 +1933,58 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)break ; } -/* -* Retry PRLI with other FC-4 type if failure occurred on dual -* FCP/NVMe port -*/ -if (NVME_FCP_TARGET (ea->fcport)) { -ql_dbg (ql_dbg_disc, vha,0x2118 , -"%s %d %8phC post %s prli\n" , - __func__, __LINE__, ea->fcport->port_name, - (ea->fcport->fc4_type &FS_FC4TYPE_NVME ) ? -"NVMe" :"FCP" ); -if (vha->hw->fc4_type_priority ==FC4_PRIORITY_NVME ) +ql_dbg (ql_dbg_disc, vha,0x2118 , +"%s %d %8phC priority %s, fc4type %x\n" , + __func__, __LINE__, ea->fcport->port_name, + vha->hw->fc4_type_priority ==FC4_PRIORITY_FCP ? +"FCP" :"NVMe" , ea->fcport->fc4_type); + +if (N2N_TOPO (vha->hw)) { +if (vha->hw->fc4_type_priority ==FC4_PRIORITY_NVME ) { ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME ; -else + ea->fcport->fc4_type |=FS_FC4TYPE_FCP ; + }else { ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP ; - } + ea->fcport->fc4_type |=FS_FC4TYPE_NVME ; + } - ea->fcport->flags &= ~FCF_ASYNC_SENT ; - ea->fcport->keep_nport_handle =0 ; - ea->fcport->logout_on_delete =1 ; -qlt_schedule_sess_for_deletion (ea->fcport); +if (ea->fcport->n2n_link_reset_cnt <3 ) { + ea->fcport->n2n_link_reset_cnt++; + vha->relogin_jif = jiffies +2 *HZ ; +/* +* PRLI failed. Reset link to kick start +* state machine +*/ +set_bit (N2N_LINK_RESET , &vha->dpc_flags); + }else { +ql_log (ql_log_warn, vha,0x2119 , +"%s %d %8phC Unable to reconnect\n" , + __func__, __LINE__, + ea->fcport->port_name); + } + }else { +/* +* switch connect. login failed. Take connection down +* and allow relogin to retrigger +*/ +if (NVME_FCP_TARGET (ea->fcport)) { +ql_dbg (ql_dbg_disc, vha,0x2118 , +"%s %d %8phC post %s prli\n" , + __func__, __LINE__, + ea->fcport->port_name, + (ea->fcport->fc4_type &FS_FC4TYPE_NVME ) + ?"NVMe" :"FCP" ); +if (vha->hw->fc4_type_priority ==FC4_PRIORITY_NVME ) + ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME ; +else + ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP ; + } + + ea->fcport->flags &= ~FCF_ASYNC_SENT ; + ea->fcport->keep_nport_handle =0 ; + ea->fcport->logout_on_delete =1 ; +qlt_schedule_sess_for_deletion (ea->fcport); + }break ; } }
drivers/scsi/qla2xxx/qla_mbx.c +0 -3
@@ -3998,9 +3998,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, fcport->scan_state =QLA_FCPORT_FOUND ; fcport->n2n_flag =1 ; fcport->keep_nport_handle =1 ; - fcport->fc4_type =FS_FC4TYPE_FCP ; -if (vha->flags.nvme_enabled) - fcport->fc4_type |=FS_FC4TYPE_NVME ;if (wwn_to_u64 (vha->port_name) >wwn_to_u64 (fcport->port_name)) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 381/717 platform/chrome: cros_ec_spi: Dont overwrite spi::mode
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 74639cbf51d7c0304342544a83dfda354a6bd208 ]
There isn't any need to overwrite the mode here in the driver with what has been detected by the firmware, such as DT or ACPI. In fact, if we use the SPI CS gpio descriptor feature we will overwrite the mode with SPI_MODE_0 where it already contains SPI_MODE_0 and more importantly SPI_CS_HIGH. Clearing the SPI_CS_HIGH bit causes the CS line to toggle when the device is probed when it shouldn't change, confusing the driver and making it fail to probe. Drop the assignment and let the spi core take care of it.
--- drivers/platform/chrome/cros_ec_spi.c | 1 - 1 file changed, 1 deletion(-)
drivers/platform/chrome/cros_ec_spi.c +0 -1
@@ -742,7 +742,6 @@ static int cros_ec_spi_probe(struct spi_device *spi)int err; spi->bits_per_word =8 ; - spi->mode =SPI_MODE_0 ; spi->rt = true; err =spi_setup (spi);if (err <0 )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 382/717 misc: pci_endpoint_test: fix return value of error branch
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 1749c90489f2afa6b59dbf3ab59d58a9014c84a1 ]
We return 'err' in the error branch, but this variable may be set as zero before. Fix it by setting 'err' as a negative value before we goto the error label.
--- drivers/misc/pci_endpoint_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/misc/pci_endpoint_test.c +6 -2
@@ -811,8 +811,10 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,pci_set_master (pdev); -if (!pci_endpoint_test_alloc_irq_vectors (test, irq_type)) +if (!pci_endpoint_test_alloc_irq_vectors (test, irq_type)) { + err = -EINVAL ; goto err_disable_irq; + }for (bar =0 ; bar <PCI_STD_NUM_BARS ; bar++) {if (pci_resource_flags (pdev, bar) &IORESOURCE_MEM ) {
@@ -849,8 +851,10 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, goto err_ida_remove; } -if (!pci_endpoint_test_request_irq (test)) +if (!pci_endpoint_test_request_irq (test)) { + err = -EINVAL ; goto err_kfree_test_name; + } misc_device = &test->miscdev; misc_device->minor =MISC_DYNAMIC_MINOR ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 383/717 bus: fsl-mc: add back accidentally dropped error check
In reply to Greg Kroah-HartmanFrom: Laurentiu Tudor <[email protected]>
[ Upstream commit 61243c03dde238170001093a29716c2369e8358f ]
A previous patch accidentally dropped an error check, so add it back.
--- drivers/bus/fsl-mc/fsl-mc-bus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +4 -1
@@ -967,8 +967,11 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mc); plat_res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); -if (plat_res) +if (plat_res) { mc->fsl_mc_regs =devm_ioremap_resource (&pdev->dev, plat_res); +if (IS_ERR (mc->fsl_mc_regs)) +return PTR_ERR (mc->fsl_mc_regs); + }if (mc->fsl_mc_regs &&IS_ENABLED (CONFIG_ACPI ) && !dev_of_node (&pdev->dev)) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 384/717 bus: fsl-mc: fix error return code in fsl_mc_object_allocate()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 3d70fb03711c37bc64e8e9aea5830f498835f6bf ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/bus/fsl-mc/fsl-mc-allocator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/fsl-mc/fsl-mc-allocator.c +3 -1
@@ -292,8 +292,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, goto error; mc_adev = resource->data; -if (!mc_adev) +if (!mc_adev) { + error = -EINVAL ; goto error; + } mc_adev->consumer_link = device_link_add(&mc_dev->dev, &mc_adev->dev,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 385/717 fsi: Aspeed: Add mutex to protect HW access
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit dfd7f2c1c532efaeff6084970bb60ec2f2e44191 ]
There is nothing to prevent multiple commands being executed simultaneously. Add a mutex to prevent this.
--- drivers/fsi/fsi-master-aspeed.c | 45 +++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 16 deletions(-)
drivers/fsi/fsi-master-aspeed.c +29 -16
@@ -8,6 +8,7 @@#include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/regmap.h>
@@ -19,6 +20,7 @@struct fsi_master_aspeed {struct fsi_master master; +struct mutex lock;/* protect HW access */ struct device *dev;void __iomem *base;struct clk *clk;
@@ -254,6 +256,8 @@ static int aspeed_master_read(struct fsi_master *master, int link, addr |= id <<21 ; addr += link *FSI_HUB_LINK_SIZE ; +mutex_lock (&aspeed->lock); +switch (size) {case 1 : ret =opb_readb (aspeed, fsi_base + addr, val);
@@ -265,14 +269,14 @@ static int aspeed_master_read(struct fsi_master *master, int link, ret =opb_readl (aspeed, fsi_base + addr, val);break ;default : -return -EINVAL ; + ret = -EINVAL ; + goto done; } ret =check_errors (aspeed, ret); -if (ret) -return ret; - -return 0 ; +done: +mutex_unlock (&aspeed->lock); +return ret; } static int aspeed_master_write(struct fsi_master *master, int link,
@@ -287,6 +291,8 @@ static int aspeed_master_write(struct fsi_master *master, int link, addr |= id <<21 ; addr += link *FSI_HUB_LINK_SIZE ; +mutex_lock (&aspeed->lock); +switch (size) {case 1 : ret =opb_writeb (aspeed, fsi_base + addr, *(u8 *)val);
@@ -298,14 +304,14 @@ static int aspeed_master_write(struct fsi_master *master, int link, ret =opb_writel (aspeed, fsi_base + addr, *(__be32 *)val);break ;default : -return -EINVAL ; + ret = -EINVAL ; + goto done; } ret =check_errors (aspeed, ret); -if (ret) -return ret; - -return 0 ; +done: +mutex_unlock (&aspeed->lock); +return ret; } static int aspeed_master_link_enable(struct fsi_master *master, int link,
@@ -320,17 +326,21 @@ static int aspeed_master_link_enable(struct fsi_master *master, int link, reg =cpu_to_be32 (0x80000000 >> bit); -if (!enable) -return opb_writel (aspeed, ctrl_base +FSI_MCENP0 + (4 * idx), - reg); +mutex_lock (&aspeed->lock); + +if (!enable) { + ret =opb_writel (aspeed, ctrl_base +FSI_MCENP0 + (4 * idx), reg); + goto done; + } ret =opb_writel (aspeed, ctrl_base +FSI_MSENP0 + (4 * idx), reg);if (ret) -return ret; + goto done;mdelay (FSI_LINK_ENABLE_SETUP_TIME ); - -return 0 ; +done: +mutex_unlock (&aspeed->lock); +return ret; }static int aspeed_master_term (struct fsi_master *master,int link,uint8_t id)
@@ -431,9 +441,11 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att {struct fsi_master_aspeed *aspeed =dev_get_drvdata (dev); +mutex_lock (&aspeed->lock);gpiod_set_value (aspeed->cfam_reset_gpio,1 );usleep_range (900 ,1000 );gpiod_set_value (aspeed->cfam_reset_gpio,0 ); +mutex_unlock (&aspeed->lock);return count; }
@@ -597,6 +609,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, aspeed); +mutex_init (&aspeed->lock);aspeed_master_init (aspeed); rc =fsi_master_register (&aspeed->master);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 386/717 s390/cio: fix use-after-free in ccw_device_destroy_console
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 14d4c4fa46eeaa3922e8e1c4aa727eb0a1412804 ]
Use of sch->dev reference after the put_device() call could trigger the use-after-free bugs.
Fix this by simply adjusting the position of put_device.
--- drivers/s390/cio/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/device.c +2 -2
@@ -1664,10 +1664,10 @@ void __init ccw_device_destroy_console(struct ccw_device *cdev)struct io_subchannel_private *io_priv =to_io_private (sch);set_io_private (sch,NULL ); -put_device (&sch->dev); -put_device (&cdev->dev);dma_free_coherent (&sch->dev,sizeof (*io_priv->dma_area), io_priv->dma_area, io_priv->dma_area_dma); +put_device (&sch->dev); +put_device (&cdev->dev);kfree (io_priv); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 387/717 iwlwifi: dbg-tlv: fix old length in is_trig_data_contained()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 58a1c9f9a9b6b9092ae10b84f6b571a06596e296 ]
There's a bug in the lengths - the 'old length' needs to be calculated using the 'old' pointer, of course, likely a copy/paste mistake. Fix this.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +1 -1
@@ -808,7 +808,7 @@ static bool is_trig_data_contained(struct iwl_ucode_tlv *new,struct iwl_fw_ini_trigger_tlv *old_trig = (void *)old->data;__le32 *new_data = new_trig->data, *old_data = old_trig->data;u32 new_dwords_num =iwl_tlv_array_len (new, new_trig, data); -u32 old_dwords_num =iwl_tlv_array_len (new, new_trig, data); +u32 old_dwords_num =iwl_tlv_array_len (old, old_trig, data);int i, j;for (i =0 ; i < new_dwords_num; i++) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 388/717 iwlwifi: mvm: hook up missing RX handlers
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 8a59d39033c35bb484f6bd91891db86ebe07fdc2 ]
The RX handlers for probe response data and channel switch weren't hooked up properly, fix that.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +6 -0
@@ -315,6 +315,12 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { iwl_mvm_mu_mimo_grp_notif, RX_HANDLER_SYNC),RX_HANDLER_GRP (DATA_PATH_GROUP ,STA_PM_NOTIF , iwl_mvm_sta_pm_notif,RX_HANDLER_SYNC ), +RX_HANDLER_GRP (MAC_CONF_GROUP ,PROBE_RESPONSE_DATA_NOTIF , + iwl_mvm_probe_resp_data_notif, +RX_HANDLER_ASYNC_LOCKED ), +RX_HANDLER_GRP (MAC_CONF_GROUP ,CHANNEL_SWITCH_NOA_NOTIF , + iwl_mvm_channel_switch_noa_notif, + RX_HANDLER_SYNC), };#undef RX_HANDLER#undef RX_HANDLER_GRP
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 389/717 erofs: avoid using generic_block_bmap
In reply to Greg Kroah-HartmanFrom: Huang Jianan <[email protected]>
[ Upstream commit d8b3df8b1048405e73558b88cba2adf29490d468 ]
Surprisingly, `block' in sector_t indicates the number of i_blkbits-sized blocks rather than sectors for bmap.
In addition, considering buffer_head limits mapped size to 32-bits, should avoid using generic_block_bmap.
--- fs/erofs/data.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-)
fs/erofs/data.c +7 -19
@@ -312,27 +312,12 @@ static void erofs_raw_access_readahead(struct readahead_control *rac)submit_bio (bio); } -static int erofs_get_block (struct inode *inode,sector_t iblock, -struct buffer_head *bh,int create) -{ -struct erofs_map_blocks map = { - .m_la = iblock <<9 , - }; -int err; - - err =erofs_map_blocks (inode, &map,EROFS_GET_BLOCKS_RAW ); -if (err) -return err; - -if (map.m_flags &EROFS_MAP_MAPPED ) - bh->b_blocknr =erofs_blknr (map.m_pa); - -return err; -} -static sector_t erofs_bmap (struct address_space *mapping,sector_t block) {struct inode *inode = mapping->host; +struct erofs_map_blocks map = { + .m_la =blknr_to_addr (block), + };if (EROFS_I (inode)->datalayout ==EROFS_INODE_FLAT_INLINE ) {erofs_blk_t blks =i_size_read (inode) >>LOG_BLOCK_SIZE ;
@@ -341,7 +326,10 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block)return 0 ; } -return generic_block_bmap (mapping, block, erofs_get_block); +if (!erofs_map_blocks (inode, &map,EROFS_GET_BLOCKS_RAW )) +return erofs_blknr (map.m_pa); + +return 0 ; }/* for uncompressed (aligned) files and raw access for other files */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 390/717 clk: renesas: r8a779a0: Fix R and OSC clocks
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 14653942de7f63e21ece32e3901f09a248598a43 ]
The R-Car V3U clock driver defines the R and OSC clocks using R-Car Gen3 clock types. However, The R-Car V3U clock driver does not use the R-Car Gen3 clock driver core, hence registering the R and OSC clocks fails:
renesas-cpg-mssr e6150000.clock-controller: Failed to register core clock osc: -22 renesas-cpg-mssr e6150000.clock-controller: Failed to register core clock r: -22
Fix this by introducing clock definition macros specific to R-Car V3U. Note that rcar_r8a779a0_cpg_clk_register() already handled the related clock types. Drop the now unneeded include of rcar-gen3-cpg.h.
--- drivers/clk/renesas/r8a779a0-cpg-mssr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/clk/renesas/r8a779a0-cpg-mssr.c +10 -3
@@ -26,7 +26,6 @@#include <dt-bindings/clock/r8a779a0-cpg-mssr.h> #include "renesas-cpg-mssr.h" -#include "rcar-gen3-cpg.h" enum rcar_r8a779a0_clk_types {CLK_TYPE_R8A779A0_MAIN =CLK_TYPE_CUSTOM ,
@@ -84,6 +83,14 @@ enum clk_ids {DEF_BASE (_name, _id,CLK_TYPE_R8A779A0_PLL2X_3X ,CLK_MAIN , \ .offset = _offset) +#define DEF_MDSEL (_name, _id, _md, _parent0, _div0, _parent1, _div1) \ + DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_MDSEL, \ + (_parent0) << 16 | (_parent1), \ + .div = (_div0) << 16 | (_div1), .offset = _md) + +#define DEF_OSC (_name, _id, _parent, _div) \ + DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_OSC, _parent, .div = _div) +static const struct cpg_core_clk r8a779a0_core_clks[]__initconst = {/* External Clock Inputs */ DEF_INPUT ("extal" ,CLK_EXTAL ),
@@ -136,8 +143,8 @@ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = {DEF_DIV6P1 ("canfd" ,R8A779A0_CLK_CANFD ,CLK_PLL5_DIV4 ,0x878 ),DEF_DIV6P1 ("csi0" ,R8A779A0_CLK_CSI0 ,CLK_PLL5_DIV4 ,0x880 ), -DEF_GEN3_OSC ("osc" ,R8A779A0_CLK_OSC ,CLK_EXTAL ,8 ), - DEF_GEN3_MDSEL("r", R8A779A0_CLK_R, 29, CLK_EXTALR, 1, CLK_OCO, 1), +DEF_OSC ("osc" ,R8A779A0_CLK_OSC ,CLK_EXTAL ,8 ), + DEF_MDSEL("r", R8A779A0_CLK_R, 29, CLK_EXTALR, 1, CLK_OCO, 1), }; static const struct mssr_mod_clk r8a779a0_mod_clks[] __initconst = {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 391/717 can: m_can: m_can_config_endisable(): remove double clearing of clock stop request bit
In reply to Greg Kroah-HartmanFrom: Sean Nyekjaer <[email protected]>
[ Upstream commit c9f4cad6cdfe350ce2637e57f7f2aa7ff326bcc6 ]
The CSR bit is already cleared when arriving here so remove this section of duplicate code.
The registers set in m_can_config_endisable() is set to same exact values as before this patch.
--- drivers/net/can/m_can/m_can.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/can/m_can/m_can.c +0 -4
@@ -380,10 +380,6 @@ void m_can_config_endisable(struct m_can_classdev *cdev, bool enable) cccr &= ~CCCR_CSR ;if (enable) { -/* Clear the Clock stop request if it was set */ -if (cccr &CCCR_CSR ) - cccr &= ~CCCR_CSR ; -/* enable m_can configuration */ m_can_write (cdev,M_CAN_CCCR , cccr |CCCR_INIT );udelay (5 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 392/717 powerpc/sstep: Emulate prefixed instructions only when CPU_FTR_ARCH_31 is set
In reply to Greg Kroah-HartmanFrom: Balamuruhan S <[email protected]>
[ Upstream commit ef6879f8c8053cc3b493f400a06d452d7fb13650 ]
Unconditional emulation of prefixed instructions will allow emulation of them on Power10 predecessors which might cause issues. Restrict that.
--- arch/powerpc/lib/sstep.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/lib/sstep.c +6 -0
@@ -1346,6 +1346,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,switch (opcode) {#ifdef __powerpc64__case 1 : +if (!cpu_has_feature (CPU_FTR_ARCH_31 )) +return -1 ; + prefix_r =GET_PREFIX_R (word); ra =GET_PREFIX_RA (suffix); rd = (suffix >>21 ) &0x1f ;
@@ -2733,6 +2736,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, }break ;case 1 :/* Prefixed instructions */ +if (!cpu_has_feature (CPU_FTR_ARCH_31 )) +return -1 ; + prefix_r =GET_PREFIX_R (word); ra =GET_PREFIX_RA (suffix); op->update_reg = ra;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 393/717 powerpc/sstep: Cover new VSX instructions under CONFIG_VSX
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 1817de2f141c718f1a0ae59927ec003e9b144349 ]
Recently added Power10 prefixed VSX instruction are included unconditionally in the kernel. If they are executed on a machine without VSX support, it might create issues. Fix that. Also fix one mnemonics spelling mistake in comment.
--- arch/powerpc/lib/sstep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +3 -1
@@ -2757,6 +2757,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 41 :/* plwa */ op->type =MKOP (LOAD ,PREFIXED |SIGNEXT ,4 );break ; +#ifdef CONFIG_VSX case 42 :/* plxsd */ op->reg = rd +32 ; op->type =MKOP (LOAD_VSX ,PREFIXED ,8 );
@@ -2797,13 +2798,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, op->element_size =16 ; op->vsx_flags =VSX_CHECK_VEC ;break ; +#endif /* CONFIG_VSX */ case 56 :/* plq */ op->type =MKOP (LOAD ,PREFIXED ,16 );break ;case 57 :/* pld */ op->type =MKOP (LOAD ,PREFIXED ,8 );break ; -case 60 :/* stq */ +case 60 :/* pstq */ op->type =MKOP (STORE ,PREFIXED ,16 );break ;case 61 :/* pstd */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 394/717 slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit 428bb001143cf5bfb65aa4ae90d4ebc95f82d007 ]
platform_get_resource_byname() may fail and in this case a NULL dereference will occur.
Fix it to use devm_platform_ioremap_resource_byname() instead of calling platform_get_resource_byname() and devm_ioremap().
This is detected by Coccinelle semantic patch.
@@
expression pdev, res, n, t, e, e1, e2;
@@
res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n);
+ if (!res)
+ return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);
--- drivers/slimbus/qcom-ctrl.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/slimbus/qcom-ctrl.c +2 -7
@@ -472,15 +472,10 @@ static void qcom_slim_rxwq(struct work_struct *work)static void qcom_slim_prg_slew (struct platform_device *pdev,struct qcom_slim_ctrl *ctrl) { -struct resource *slew_mem; -if (!ctrl->slew_reg) {/* SLEW RATE register for this SLIMbus */ - slew_mem =platform_get_resource_byname (pdev,IORESOURCE_MEM , -"slew" ); - ctrl->slew_reg =devm_ioremap (&pdev->dev, slew_mem->start, -resource_size (slew_mem)); -if (!ctrl->slew_reg) + ctrl->slew_reg =devm_platform_ioremap_resource_byname (pdev,"slew" ); +if (IS_ERR (ctrl->slew_reg))return ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 395/717 ALSA: hda/hdmi: fix silent stream for first playback to DP
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit b1a5039759cb7bfcb2157f28604dbda0bca58598 ]
A problem exists in enabling silent stream when connection type is DisplayPort. Silent stream programming is completed when a new DP receiver is connected, but infoframe transmission does not actually start until PCM is opened for the first time. This can result in audible gap of multiple seconds. This only affects the first PCM open.
Fix the issue by properly assigning a converter to the silent stream, and modifying the required stream ID programming sequence.
This change only affects Intel display audio codecs.
--- sound/pci/hda/patch_hdmi.c | 98 +++++++++++++++++++++++++++++++++----- 1 file changed, 86 insertions(+), 12 deletions(-)
sound/pci/hda/patch_hdmi.c +86 -12
@@ -78,6 +78,7 @@ struct hdmi_spec_per_pin {int pcm_idx;/* which pcm is attached. -1 means no pcm is attached */ int repoll_count;bool setup;/* the stream has been set up by prepare callback */ +bool silent_stream;int channels;/* current number of channels */ bool non_pcm;bool chmap_set;/* channel-map override by ALSA API? */
@@ -979,6 +980,13 @@ static int hdmi_choose_cvt(struct hda_codec *codec,else per_pin =get_pin (spec, pin_idx); +if (per_pin && per_pin->silent_stream) { + cvt_idx =cvt_nid_to_cvt_index (codec, per_pin->cvt_nid); +if (cvt_id) + *cvt_id = cvt_idx; +return 0 ; + } +/* Dynamically assign converter to stream */ for (cvt_idx =0 ; cvt_idx < spec->num_cvts; cvt_idx++) { per_cvt =get_cvt (spec, cvt_idx);
@@ -1642,30 +1650,95 @@ static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,snd_hda_power_down_pm (codec); } +#define I915_SILENT_RATE 48000 +#define I915_SILENT_CHANNELS 2 +#define I915_SILENT_FORMAT SNDRV_PCM_FORMAT_S16_LE +#define I915_SILENT_FORMAT_BITS 16 +#define I915_SILENT_FMT_MASK 0xf +static void silent_stream_enable (struct hda_codec *codec, -struct hdmi_spec_per_pin *per_pin) +struct hdmi_spec_per_pin *per_pin) { -unsigned int newval, oldval; - -codec_dbg (codec,"hdmi: enabling silent stream for NID %d\n" , - per_pin->pin_nid); +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_cvt *per_cvt; +int cvt_idx, pin_idx, err; +unsigned int format;mutex_lock (&per_pin->lock); -if (!per_pin->channels) - per_pin->channels =2 ; +if (per_pin->setup) { +codec_dbg (codec,"hdmi: PCM already open, no silent stream\n" ); + goto unlock_out; + } - oldval =snd_hda_codec_read (codec, per_pin->pin_nid,0 , -AC_VERB_GET_CONV ,0 ); - newval = (oldval &0xF0 ) |0xF ; -snd_hda_codec_write (codec, per_pin->pin_nid,0 , -AC_VERB_SET_CHANNEL_STREAMID , newval); + pin_idx =pin_id_to_pin_index (codec, per_pin->pin_nid, per_pin->dev_id); + err =hdmi_choose_cvt (codec, pin_idx, &cvt_idx); +if (err) { +codec_err (codec,"hdmi: no free converter to enable silent mode\n" ); + goto unlock_out; + } + + per_cvt =get_cvt (spec, cvt_idx); + per_cvt->assigned =1 ; + per_pin->cvt_nid = per_cvt->cvt_nid; + per_pin->silent_stream = true; +codec_dbg (codec,"hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n" , + per_pin->pin_nid, per_cvt->cvt_nid); + +snd_hda_set_dev_select (codec, per_pin->pin_nid, per_pin->dev_id); +snd_hda_codec_write_cache (codec, per_pin->pin_nid,0 , +AC_VERB_SET_CONNECT_SEL , + per_pin->mux_idx); + +/* configure unused pins to choose other converters */ +pin_cvt_fixup (codec, per_pin,0 ); + +snd_hdac_sync_audio_rate (&codec->core, per_pin->pin_nid, + per_pin->dev_id,I915_SILENT_RATE ); + +/* trigger silent stream generation in hw */ + format =snd_hdac_calc_stream_format (I915_SILENT_RATE ,I915_SILENT_CHANNELS , +I915_SILENT_FORMAT ,I915_SILENT_FORMAT_BITS ,0 ); +snd_hda_codec_setup_stream (codec, per_pin->cvt_nid, +I915_SILENT_FMT_MASK ,I915_SILENT_FMT_MASK , format); +usleep_range (100 ,200 ); +snd_hda_codec_setup_stream (codec, per_pin->cvt_nid,I915_SILENT_FMT_MASK ,0 , format); + + per_pin->channels =I915_SILENT_CHANNELS ;hdmi_setup_audio_infoframe (codec, per_pin, per_pin->non_pcm); + unlock_out:mutex_unlock (&per_pin->lock); } +static void silent_stream_disable (struct hda_codec *codec, +struct hdmi_spec_per_pin *per_pin) +{ +struct hdmi_spec *spec = codec->spec; +struct hdmi_spec_per_cvt *per_cvt; +int cvt_idx; + +mutex_lock (&per_pin->lock); +if (!per_pin->silent_stream) + goto unlock_out; + +codec_dbg (codec,"HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n" , + per_pin->pin_nid, per_pin->cvt_nid); + + cvt_idx =cvt_nid_to_cvt_index (codec, per_pin->cvt_nid); +if (cvt_idx >=0 && cvt_idx < spec->num_cvts) { + per_cvt =get_cvt (spec, cvt_idx); + per_cvt->assigned =0 ; + } + + per_pin->cvt_nid =0 ; + per_pin->silent_stream = false; + + unlock_out: +mutex_unlock (&spec->pcm_lock); +} +/* update ELD and jack state via audio component */ static void sync_eld_via_acomp (struct hda_codec *codec,struct hdmi_spec_per_pin *per_pin)
@@ -1701,6 +1774,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec, pm_ret);silent_stream_enable (codec, per_pin); }else if (monitor_prev && !monitor_next) { +silent_stream_disable (codec, per_pin); pm_ret =snd_hda_power_down_pm (codec);if (pm_ret <0 ) codec_err(codec,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 396/717 RDMA/core: Do not indicate device ready when device enablement fails
In reply to Greg Kroah-HartmanFrom: Jack Morgenstein <[email protected]>
[ Upstream commit 779e0bf47632c609c59f527f9711ecd3214dccb0 ]
In procedure ib_register_device, procedure kobject_uevent is called (advertising that the device is ready for userspace usage) even when device_enable_and_get() returned an error.
As a result, various RDMA modules attempted to register for the device even while the device driver was preparing to unregister the device.
Fix this by advertising the device availability only after enabling the device succeeds.
--- drivers/infiniband/core/device.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/core/device.c +4 -3
@@ -1374,9 +1374,6 @@ int ib_register_device(struct ib_device *device, const char *name, } ret =enable_device_and_get (device); -dev_set_uevent_suppress (&device->dev, false); -/* Mark for userspace that device is ready */ -kobject_uevent (&device->dev.kobj,KOBJ_ADD );if (ret) {void (*dealloc_fn)(struct ib_device *);
@@ -1396,8 +1393,12 @@ int ib_register_device(struct ib_device *device, const char *name,ib_device_put (device);__ib_unregister_device (device); device->ops.dealloc_driver = dealloc_fn; +dev_set_uevent_suppress (&device->dev, false);return ret; } +dev_set_uevent_suppress (&device->dev, false); +/* Mark for userspace that device is ready */ +kobject_uevent (&device->dev.kobj,KOBJ_ADD );ib_device_put (device);return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 397/717 RDMA/uverbs: Fix incorrect variable type
In reply to Greg Kroah-HartmanFrom: Avihai Horon <[email protected]>
[ Upstream commit e0da68994d16b46384cce7b86eb645f1ef7c51ef ]
Fix incorrect type of max_entries in UVERBS_METHOD_QUERY_GID_TABLE - max_entries is of type size_t although it can take negative values.
The following static check revealed it:
drivers/infiniband/core/uverbs_std_types_device.c:338 ib_uverbs_handler_UVERBS_METHOD_QUERY_GID_TABLE() warn: 'max_entries' unsigned <= 0
--- drivers/infiniband/core/uverbs_std_types_device.c | 14 +++++--------- include/rdma/uverbs_ioctl.h | 10 ++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-)
drivers/infiniband/core/uverbs_std_types_device.c +5 -9
@@ -317,8 +317,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_TABLE)(struct ib_device *ib_dev;size_t user_entry_size;ssize_t num_entries; -size_t max_entries; -size_t num_bytes; +int max_entries;u32 flags;int ret;
@@ -336,19 +335,16 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_TABLE)( attrs,UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES , user_entry_size);if (max_entries <=0 ) -return -EINVAL ; +return max_entries ?: -EINVAL ; ucontext =ib_uverbs_get_ucontext (attrs);if (IS_ERR (ucontext))return PTR_ERR (ucontext); ib_dev = ucontext->device; -if (check_mul_overflow (max_entries,sizeof (*entries), &num_bytes)) -return -EINVAL ; - - entries =uverbs_zalloc (attrs, num_bytes); -if (!entries) -return -ENOMEM ; + entries =uverbs_kcalloc (attrs, max_entries,sizeof (*entries)); +if (IS_ERR (entries)) +return PTR_ERR (entries); num_entries =rdma_query_gid_table (ib_dev, entries, max_entries);if (num_entries <0 )
include/rdma/uverbs_ioctl.h +10 -0
@@ -862,6 +862,16 @@ static inline __malloc void *uverbs_zalloc(struct uverbs_attr_bundle *bundle, {return _uverbs_alloc (bundle, size,GFP_KERNEL | __GFP_ZERO); } + +static inline __malloc void *uverbs_kcalloc(struct uverbs_attr_bundle *bundle, +size_t n,size_t size) +{ +size_t bytes; + +if (unlikely (check_mul_overflow (n, size, &bytes))) +return ERR_PTR (-EOVERFLOW ); +return uverbs_zalloc (bundle, bytes); +}int _uverbs_get_const (s64 *to,const struct uverbs_attr_bundle *attrs_bundle,size_t idx,s64 lower_bound,u64 upper_bound,s64 *def_val);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 398/717 remoteproc/mediatek: change MT8192 CFG register base
In reply to Greg Kroah-HartmanFrom: Tzung-Bi Shih <[email protected]>
[ Upstream commit 0a441514bc2b8a48ebe23c2dcb9feee6351d45b6 ]
The correct MT8192 CFG register base is 0x20000 off. Changes the registers accordingly.
--- drivers/remoteproc/mtk_common.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/remoteproc/mtk_common.h +13 -13
@@ -32,22 +32,22 @@#define MT8183_SCP_CACHESIZE_8KB BIT(8)#define MT8183_SCP_CACHE_CON_WAYEN BIT(10) -#define MT8192_L2TCM_SRAM_PD_0 0x210C0 -#define MT8192_L2TCM_SRAM_PD_1 0x210C4 -#define MT8192_L2TCM_SRAM_PD_2 0x210C8 -#define MT8192_L1TCM_SRAM_PDN 0x2102C -#define MT8192_CPU0_SRAM_PD 0x21080 - -#define MT8192_SCP2APMCU_IPC_SET 0x24080 -#define MT8192_SCP2APMCU_IPC_CLR 0x24084 +#define MT8192_L2TCM_SRAM_PD_0 0x10C0 +#define MT8192_L2TCM_SRAM_PD_1 0x10C4 +#define MT8192_L2TCM_SRAM_PD_2 0x10C8 +#define MT8192_L1TCM_SRAM_PDN 0x102C +#define MT8192_CPU0_SRAM_PD 0x1080 + +#define MT8192_SCP2APMCU_IPC_SET 0x4080 +#define MT8192_SCP2APMCU_IPC_CLR 0x4084#define MT8192_SCP_IPC_INT_BIT BIT(0) -#define MT8192_SCP2SPM_IPC_CLR 0x24094 -#define MT8192_GIPC_IN_SET 0x24098 +#define MT8192_SCP2SPM_IPC_CLR 0x4094 +#define MT8192_GIPC_IN_SET 0x4098#define MT8192_HOST_IPC_INT_BIT BIT(0) -#define MT8192_CORE0_SW_RSTN_CLR 0x30000 -#define MT8192_CORE0_SW_RSTN_SET 0x30004 -#define MT8192_CORE0_WDT_CFG 0x30034 +#define MT8192_CORE0_SW_RSTN_CLR 0x10000 +#define MT8192_CORE0_SW_RSTN_SET 0x10004 +#define MT8192_CORE0_WDT_CFG 0x10034#define SCP_FW_VER_LEN 32#define SCP_SHARE_BUFFER_SIZE 288
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 399/717 remoteproc/mtk_scp: surround DT device IDs with CONFIG_OF
In reply to Greg Kroah-HartmanFrom: Alexandre Courbot <[email protected]>
[ Upstream commit e59aef4edc45133ccb10b8e962cb74dcf1e3240b ]
Now that this driver can be compiled with COMPILE_TEST, we have no guarantee that CONFIG_OF will also be defined. When that happens, a warning about mtk_scp_of_match being defined but unused will be reported so make sure this variable is only defined if of_match_ptr() actually uses it.
--- drivers/remoteproc/mtk_scp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/remoteproc/mtk_scp.c +2 -0
@@ -772,12 +772,14 @@ static const struct mtk_scp_of_data mt8192_of_data = { .host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT, }; +#if defined(CONFIG_OF )static const struct of_device_id mtk_scp_of_match[] = { { .compatible ="mediatek,mt8183-scp" , .data = &mt8183_of_data }, { .compatible ="mediatek,mt8192-scp" , .data = &mt8192_of_data }, {}, };MODULE_DEVICE_TABLE (of, mtk_scp_of_match); +#endif static struct platform_driver mtk_scp_driver = { .probe = scp_probe,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 400/717 remoteproc: q6v5-mss: fix error handling in q6v5_pds_enable
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit a24723050037303e4008b37f1f8dcc99c58901aa ]
If the pm_runtime_get_sync failed in q6v5_pds_enable when loop (i), The unroll_pd_votes will start from (i - 1), and it will resulted in following problems:
1) pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak.
2) Have not reset pds[i] performance state.
Then we fix it.
--- drivers/remoteproc/qcom_q6v5_mss.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/remoteproc/qcom_q6v5_mss.c +4 -1
@@ -349,8 +349,11 @@ static int q6v5_pds_enable(struct q6v5 *qproc, struct device **pds,for (i =0 ; i < pd_count; i++) {dev_pm_genpd_set_performance_state (pds[i],INT_MAX ); ret =pm_runtime_get_sync (pds[i]); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (pds[i]); +dev_pm_genpd_set_performance_state (pds[i],0 ); goto unroll_pd_votes; + } }return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 401/717 remoteproc: qcom: fix reference leak in adsp_start
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit aa37448f597c09844942da87d042fc6793f989c2 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in adsp_start, so we should fix it.
--- drivers/remoteproc/qcom_q6v5_adsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/remoteproc/qcom_q6v5_adsp.c +3 -1
@@ -193,8 +193,10 @@ static int adsp_start(struct rproc *rproc)dev_pm_genpd_set_performance_state (adsp->dev,INT_MAX ); ret =pm_runtime_get_sync (adsp->dev); -if (ret) +if (ret) { +pm_runtime_put_noidle (adsp->dev); goto disable_xo_clk; + } ret =clk_bulk_prepare_enable (adsp->num_clks, adsp->clks);if (ret) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 402/717 remoteproc: qcom: pas: fix error handling in adsp_pds_enable
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit c0a6e5ee1ecfe4c3a5799cfd30820748eff5dfab ]
If the pm_runtime_get_sync failed in adsp_pds_enable when loop (i), The unroll_pd_votes will start from (i - 1), and it will resulted in following problems:
1) pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak.
2) Have not reset pds[i] performance state.
Then we fix it.
--- drivers/remoteproc/qcom_q6v5_pas.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/remoteproc/qcom_q6v5_pas.c +4 -1
@@ -90,8 +90,11 @@ static int adsp_pds_enable(struct qcom_adsp *adsp, struct device **pds,for (i =0 ; i < pd_count; i++) {dev_pm_genpd_set_performance_state (pds[i],INT_MAX ); ret =pm_runtime_get_sync (pds[i]); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (pds[i]); +dev_pm_genpd_set_performance_state (pds[i],0 ); goto unroll_pd_votes; + } }return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 403/717 remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 6dfdf6e4e7096fead7755d47d91d72e896bb4804 ]
In case of error, the function devm_ioremap_wc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.
--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2 -2
@@ -445,10 +445,10 @@ static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev, kproc->mem[i].cpu_addr =devm_ioremap_wc (dev, res->start,resource_size (res)); -if (IS_ERR (kproc->mem[i].cpu_addr)) { +if (!kproc->mem[i].cpu_addr) {dev_err (dev,"failed to map %s memory\n" , data->mems[i].name); -return PTR_ERR (kproc->mem[i].cpu_addr); +return -ENOMEM ; } kproc->mem[i].bus_addr = res->start; kproc->mem[i].dev_addr = data->mems[i].dev_addr;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 404/717 remoteproc: qcom: Fix potential NULL dereference in adsp_init_mmio()
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
[ Upstream commit c3d4e5b12672bbdf63f4cc933e3169bc6bbec8da ]
platform_get_resource() may fail and in this case a NULL dereference will occur.
Fix it to use devm_platform_ioremap_resource() instead of calling platform_get_resource() and devm_ioremap().
This is detected by Coccinelle semantic patch.
@@
expression pdev, res, n, t, e, e1, e2;
@@
res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n);
+ if (!res)
+ return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);
--- drivers/remoteproc/qcom_q6v5_adsp.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/remoteproc/qcom_q6v5_adsp.c +3 -6
@@ -364,15 +364,12 @@ static int adsp_init_mmio(struct qcom_adsp *adsp, struct platform_device *pdev) {struct device_node *syscon; -struct resource *res;int ret; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - adsp->qdsp6ss_base =devm_ioremap (&pdev->dev, res->start, -resource_size (res)); -if (!adsp->qdsp6ss_base) { + adsp->qdsp6ss_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (adsp->qdsp6ss_base)) {dev_err (adsp->dev,"failed to map QDSP6SS registers\n" ); -return -ENOMEM ; +return PTR_ERR (adsp->qdsp6ss_base); } syscon =of_parse_phandle (pdev->dev.of_node,"qcom,halt-regs" ,0 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 405/717 remoteproc/mediatek: unprepare clk if scp_before_load fails
In reply to Greg Kroah-HartmanFrom: Tzung-Bi Shih <[email protected]>
[ Upstream commit 22c3df6f5574c8d401ea431c7ce24e7c5c5e7ef3 ]
Fixes the error handling to unprepare clk if scp_before_load fails.
--- drivers/remoteproc/mtk_scp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/remoteproc/mtk_scp.c +2 -1
@@ -350,9 +350,10 @@ static int scp_load(struct rproc *rproc, const struct firmware *fw) ret = scp->data->scp_before_load (scp);if (ret <0 ) -return ret; + goto leave; ret =scp_elf_load_segments (rproc, fw); +leave:clk_disable_unprepare (scp->clk);return ret;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 406/717 clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit 6d37a8d192830267e6b10a6d57ae28d2e89097e7 ]
I would repeat the same commit message that was in commit 5e4b7e82d497 ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems silly to do so when you could just go read that commit.
NOTE: this is actually extra terrible because we're missing the 50 MHz rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2")). That means then when you run an older SD card it'll try to clock it at 100 MHz when it's only specced to run at 50 MHz max. As you can probably guess that doesn't work super well.
--- drivers/clk/qcom/gcc-sc7180.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-sc7180.c +2 -2
@@ -642,7 +642,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { .name = "gcc_sdcc1_ice_core_clk_src", .parent_data = gcc_parent_data_0, .num_parents = 4, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, };
@@ -666,7 +666,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { .name = "gcc_sdcc2_apps_clk_src", .parent_data = gcc_parent_data_5, .num_parents = 5, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 407/717 clk: tegra: Fix duplicated SE clock entry
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 5bf5861d6ea6c3f4b38fc8fda2062b2dc44ac63d ]
The periph_clks[] array contains duplicated entry for Security Engine clock which was meant to be defined for T210, but it wasn't added properly. This patch corrects the T210 SE entry and fixes the following error message on T114/T124: "Tegra clk 127: register failed with -17".
Tested-by Nicolas Chauvet <[email protected]>
Reported-by Nicolas Chauvet <[email protected]>
--- drivers/clk/tegra/clk-id.h | 1 + drivers/clk/tegra/clk-tegra-periph.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-id.h +1 -0
@@ -227,6 +227,7 @@ enum clk_id { tegra_clk_sdmmc4, tegra_clk_sdmmc4_8, tegra_clk_se, + tegra_clk_se_10, tegra_clk_soc_therm, tegra_clk_soc_therm_8, tegra_clk_sor0,
drivers/clk/tegra/clk-tegra-periph.c +1 -1
@@ -630,7 +630,7 @@ static struct tegra_periph_init_data periph_clks[] = {INT8 ("host1x" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_HOST1X ,28 ,0 , tegra_clk_host1x_8),INT8 ("host1x" , mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0,CLK_SOURCE_HOST1X ,28 ,0 , tegra_clk_host1x_9),INT8 ("se" , mux_pllp_pllc2_c_c3_pllm_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se), -INT8 ("se" , mux_pllp_pllc2_c_c3_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se), +INT8 ("se" , mux_pllp_pllc2_c_c3_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se_10),INT8 ("2d" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_2D ,21 ,0 , tegra_clk_gr2d_8),INT8 ("3d" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_3D ,24 ,0 , tegra_clk_gr3d_8), INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 408/717 mtd: rawnand: gpmi: fix reference count leak in gpmi ops
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 1b391c7f2e863985668d705f525af3ceb55bc800 ]
pm_runtime_get_sync() will increment pm usage at first and it will resume the device later. If runtime of the device has error or device is in inaccessible state(or other error state), resume operation will fail. If we do not call put operation to decrease the reference, it will result in reference leak in the two functions(gpmi_init and gpmi_nfc_exec_op). Moreover, this device cannot enter the idle state and always stay busy or other non-idle state later. So we fixed it through adding pm_runtime_put_noidle.
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +6 -2
@@ -149,8 +149,10 @@ static int gpmi_init(struct gpmi_nand_data *this)int ret; ret =pm_runtime_get_sync (this->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (this->dev);return ret; + } ret =gpmi_reset_block (r->gpmi_regs, false);if (ret)
@@ -2263,8 +2265,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, this->transfers[i].direction =DMA_NONE ; ret =pm_runtime_get_sync (this->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (this->dev);return ret; + }/* * This driver currently supports only one NAND chip. Plus, dies share
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 409/717 mtd: rawnand: meson: Fix a resource leak in init
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ad8566d3555c4731e6b48823b92d3929b0394c14 ]
Call clk_disable_unprepare(nfc->phase_rx) if the clk_set_rate() function fails to avoid a resource leak.
--- drivers/mtd/nand/raw/meson_nand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/meson_nand.c +4 -1
@@ -1044,9 +1044,12 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc) ret =clk_set_rate (nfc->device_clk,24000000 );if (ret) - goto err_phase_rx; + goto err_disable_rx;return 0 ; + +err_disable_rx: +clk_disable_unprepare (nfc->phase_rx); err_phase_rx:clk_disable_unprepare (nfc->phase_tx); err_phase_tx:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 410/717 mtd: rawnand: gpmi: Fix the random DMA timeout issue
In reply to Greg Kroah-HartmanFrom: Han Xu <[email protected]>
[ Upstream commit 7671edeb193910482a9b0c22cd32176e7de7b2ed ]
To get better performance, current gpmi driver collected and chained all small DMA transfers in gpmi_nfc_exec_op, the whole chain triggered and wait for complete at the end.
But some random DMA timeout found in this new driver, with the help of ftrace, we found the root cause is as follows:
Take gpmi_ecc_read_page() as an example, gpmi_nfc_exec_op collected 6 DMA transfers and the DMA chain triggered at the end. It waits for bch completion and check jiffies if it's timeout. The typical function graph shown below,
63.216351 | 1) | gpmi_ecc_read_page() {
63.216352 | 1) 0.750 us | gpmi_bch_layout_std();
63.216354 | 1) | gpmi_nfc_exec_op() {
63.216355 | 1) | gpmi_chain_command() {
63.216356 | 1) | mxs_dma_prep_slave_sg() {
63.216357 | 1) | /* mxs chan ccw idx: 0 */
63.216358 | 1) 1.750 us | }
63.216359 | 1) | mxs_dma_prep_slave_sg() {
63.216360 | 1) | /* mxs chan ccw idx: 1 */
63.216361 | 1) 2.000 us | }
63.216361 | 1) 6.500 us | }
63.216362 | 1) | gpmi_chain_command() {
63.216363 | 1) | mxs_dma_prep_slave_sg() {
63.216364 | 1) | /* mxs chan ccw idx: 2 */
63.216365 | 1) 1.750 us | }
63.216366 | 1) | mxs_dma_prep_slave_sg() {
63.216367 | 1) | /* mxs chan ccw idx: 3 */
63.216367 | 1) 1.750 us | }
63.216368 | 1) 5.875 us | }
63.216369 | 1) | /* gpmi_chain_wait_ready */
63.216370 | 1) | mxs_dma_prep_slave_sg() {
63.216372 | 1) | /* mxs chan ccw idx: 4 */
63.216373 | 1) 3.000 us | }
63.216374 | 1) | /* gpmi_chain_data_read */
63.216376 | 1) | mxs_dma_prep_slave_sg() {
63.216377 | 1) | /* mxs chan ccw idx: 5 */
63.216378 | 1) 2.000 us | }
63.216379 | 1) 1.125 us | mxs_dma_tx_submit();
63.216381 | 1) 1.000 us | mxs_dma_enable_chan();
63.216712 | 0) 2.625 us | mxs_dma_int_handler();
63.216717 | 0) 4.250 us | bch_irq();
63.216723 | 0) 1.250 us | mxs_dma_tasklet();
63.216723 | 1) | /* jiffies left 250 */
63.216725 | 1) ! 372.000 us | }
63.216726 | 1) 2.625 us | gpmi_count_bitflips();
63.216730 | 1) ! 379.125 us | }but it's not gurantee that bch irq handled always after dma irq handled, sometimes bch_irq comes first and gpmi_nfc_exec_op won't wait anymore, another gpmi_nfc_exec_op may get invoked before last DMA chain IRQ handled, this messed up the next DMA chain and causes DMA timeout. Check the trace log when issue happened.
63.218923 | 1) | gpmi_ecc_read_page() {
63.218924 | 1) 0.625 us | gpmi_bch_layout_std();
63.218926 | 1) | gpmi_nfc_exec_op() {
63.218927 | 1) | gpmi_chain_command() {
63.218928 | 1) | mxs_dma_prep_slave_sg() {
63.218929 | 1) | /* mxs chan ccw idx: 0 */
63.218929 | 1) 1.625 us | }
63.218931 | 1) | mxs_dma_prep_slave_sg() {
63.218931 | 1) | /* mxs chan ccw idx: 1 */
63.218932 | 1) 1.750 us | }
63.218933 | 1) 5.875 us | }
63.218934 | 1) | gpmi_chain_command() {
63.218934 | 1) | mxs_dma_prep_slave_sg() {
63.218935 | 1) | /* mxs chan ccw idx: 2 */
63.218936 | 1) 1.875 us | }
63.218937 | 1) | mxs_dma_prep_slave_sg() {
63.218938 | 1) | /* mxs chan ccw idx: 3 */
63.218939 | 1) 1.625 us | }
63.218939 | 1) 5.875 us | }
63.218940 | 1) | /* gpmi_chain_wait_ready */
63.218941 | 1) | mxs_dma_prep_slave_sg() {
63.218942 | 1) | /* mxs chan ccw idx: 4 */
63.218942 | 1) 1.625 us | }
63.218943 | 1) | /* gpmi_chain_data_read */
63.218944 | 1) | mxs_dma_prep_slave_sg() {
63.218945 | 1) | /* mxs chan ccw idx: 5 */
63.218947 | 1) 2.375 us | }
63.218948 | 1) 0.625 us | mxs_dma_tx_submit();
63.218949 | 1) 1.000 us | mxs_dma_enable_chan();
63.219276 | 0) 5.125 us | bch_irq(); <----
63.219283 | 1) | /* jiffies left 250 */
63.219285 | 1) ! 358.625 us | }
63.219286 | 1) 2.750 us | gpmi_count_bitflips();
63.219289 | 1) ! 366.000 us | }
63.219290 | 1) | gpmi_ecc_read_page() {
63.219291 | 1) 0.750 us | gpmi_bch_layout_std();
63.219293 | 1) | gpmi_nfc_exec_op() {
63.219294 | 1) | gpmi_chain_command() {
63.219295 | 1) | mxs_dma_prep_slave_sg() {
63.219295 | 0) 1.875 us | mxs_dma_int_handler(); <----
63.219296 | 1) | /* mxs chan ccw idx: 6 */
63.219297 | 1) 2.250 us | }
63.219298 | 1) | mxs_dma_prep_slave_sg() {
63.219298 | 0) 1.000 us | mxs_dma_tasklet();
63.219299 | 1) | /* mxs chan ccw idx: 0 */
63.219300 | 1) 1.625 us | }
63.219300 | 1) 6.375 us | }
63.219301 | 1) | gpmi_chain_command() {
63.219302 | 1) | mxs_dma_prep_slave_sg() {
63.219303 | 1) | /* mxs chan ccw idx: 1 */
63.219304 | 1) 1.625 us | }
63.219305 | 1) | mxs_dma_prep_slave_sg() {
63.219306 | 1) | /* mxs chan ccw idx: 2 */
63.219306 | 1) 1.875 us | }
63.219307 | 1) 6.000 us | }
63.219308 | 1) | /* gpmi_chain_wait_ready */
63.219308 | 1) | mxs_dma_prep_slave_sg() {
63.219309 | 1) | /* mxs chan ccw idx: 3 */
63.219310 | 1) 2.000 us | }
63.219311 | 1) | /* gpmi_chain_data_read */
63.219312 | 1) | mxs_dma_prep_slave_sg() {
63.219313 | 1) | /* mxs chan ccw idx: 4 */
63.219314 | 1) 1.750 us | }
63.219315 | 1) 0.625 us | mxs_dma_tx_submit();
63.219316 | 1) 0.875 us | mxs_dma_enable_chan();
64.224227 | 1) | /* jiffies left 0 */In the first gpmi_nfc_exec_op, bch_irq comes first and gpmi_nfc_exec_op exits, but DMA IRQ still not happened yet until the middle of following gpmi_nfc_exec_op, the first DMA transfer index get messed and DMA get timeout.
To fix the issue, when there is bch ops in DMA chain, the gpmi_nfc_exec_op should wait for both completions rather than bch completion only.
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 30 +++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +21 -9
@@ -2254,7 +2254,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,void *buf_read =NULL ;const void *buf_write =NULL ;bool direct = false; -struct completion *completion; +struct completion *dma_completion, *bch_completion;unsigned long to;if (check_only)
@@ -2351,22 +2351,24 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, this->resources.bch_regs + HW_BCH_FLASH0LAYOUT1); } + desc->callback = dma_irq_callback; + desc->callback_param = this; + dma_completion = &this->dma_done; + bch_completion =NULL ; + +init_completion (dma_completion); +if (this->bch && buf_read) {writel (BM_BCH_CTRL_COMPLETE_IRQ_EN , this->resources.bch_regs +HW_BCH_CTRL_SET ); - completion = &this->bch_done; - }else { - desc->callback = dma_irq_callback; - desc->callback_param = this; - completion = &this->dma_done; + bch_completion = &this->bch_done; +init_completion (bch_completion); } -init_completion (completion); -dmaengine_submit (desc);dma_async_issue_pending (get_dma_chan (this)); - to =wait_for_completion_timeout (completion,msecs_to_jiffies (1000 )); + to =wait_for_completion_timeout (dma_completion,msecs_to_jiffies (1000 ));if (!to) {dev_err (this->dev,"DMA timeout, last DMA\n" );gpmi_dump_info (this);
@@ -2374,6 +2376,16 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, goto unmap; } +if (this->bch && buf_read) { + to =wait_for_completion_timeout (bch_completion,msecs_to_jiffies (1000 )); +if (!to) { +dev_err (this->dev,"BCH timeout, last DMA\n" ); +gpmi_dump_info (this); + ret = -ETIMEDOUT ; + goto unmap; + } + } +writel (BM_BCH_CTRL_COMPLETE_IRQ_EN , this->resources.bch_regs +HW_BCH_CTRL_CLR );gpmi_clear_bch (this);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 411/717 samples/bpf: Fix possible hang in xdpsock with multiple threads
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 092fde0f863b72b67c4d6dc03844f5658fc00a35 ]
Fix a possible hang in xdpsock that can occur when using multiple threads. In this case, one or more of the threads might get stuck in the while-loop in tx_only after the user has signaled the main thread to stop execution. In this case, no more Tx packets will be sent, so a thread might get stuck in the aforementioned while-loop. Fix this by introducing a test inside the while-loop to check if the benchmark has been terminated. If so, return from the function.
--- samples/bpf/xdpsock_user.c | 2 ++ 1 file changed, 2 insertions(+)
samples/bpf/xdpsock_user.c +2 -0
@@ -1250,6 +1250,8 @@ static void tx_only(struct xsk_socket_info *xsk, u32 *frame_nb, int batch_size)while (xsk_ring_prod__reserve (&xsk->tx, batch_size, &idx) < batch_size) {complete_tx_only (xsk, batch_size); +if (benchmark_done) +return ; }for (i =0 ; i < batch_size; i++) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 412/717 fs: Handle I_DONTCACHE in iput_final() instead of generic_drop_inode()
In reply to Greg Kroah-HartmanFrom: Hao Li <[email protected]>
[ Upstream commit 88149082bb8ef31b289673669e080ec6a00c2e59 ]
If generic_drop_inode() returns true, it means iput_final() can evict this inode regardless of whether it is dirty or not. If we check I_DONTCACHE in generic_drop_inode(), any inode with this bit set will be evicted unconditionally. This is not the desired behavior because I_DONTCACHE only means the inode shouldn't be cached on the LRU list. As for whether we need to evict this inode, this is what generic_drop_inode() should do. This patch corrects the usage of I_DONTCACHE.
This patch was proposed in [1].
[1]: https://lore.kernel.org/linux-fsdevel/[email protected]/
--- fs/inode.c | 4 +++- include/linux/fs.h | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-)
fs/inode.c +3 -1
@@ -1627,7 +1627,9 @@ static void iput_final(struct inode *inode)else drop =generic_drop_inode (inode); -if (!drop && (sb->s_flags &SB_ACTIVE )) { +if (!drop && + !(inode->i_state &I_DONTCACHE ) && + (sb->s_flags &SB_ACTIVE )) {inode_add_lru (inode);spin_unlock (&inode->i_lock);return ;
include/linux/fs.h +1 -2
@@ -2878,8 +2878,7 @@ extern int inode_needs_sync(struct inode *inode);extern int generic_delete_inode (struct inode *inode);static inline int generic_drop_inode (struct inode *inode) { -return !inode->i_nlink ||inode_unhashed (inode) || - (inode->i_state &I_DONTCACHE ); +return !inode->i_nlink ||inode_unhashed (inode); }extern void d_mark_dontcache (struct inode *inode);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 413/717 extcon: max77693: Fix modalias string
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit e1efdb604f5c9903a5d92ef42244009d3c04880f ]
The platform device driver name is "max77693-muic", so advertise it properly in the modalias string. This fixes automated module loading when this driver is compiled as a module.
--- drivers/extcon/extcon-max77693.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon-max77693.c +1 -1
@@ -1277,4 +1277,4 @@ module_platform_driver(max77693_muic_driver);MODULE_DESCRIPTION ("Maxim MAX77693 Extcon driver" );MODULE_AUTHOR ("Chanwoo Choi <[email protected]>" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:extcon-max77693" ); +MODULE_ALIAS ("platform:max77693-muic" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 414/717 crypto: atmel-i2c - select CONFIG_BITREVERSE
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d33a23b0532d5d1b5b700e8641661261e7dbef61 ]
The bitreverse helper is almost always built into the kernel, but in a rare randconfig build it is possible to hit a case in which it is a loadable module while the atmel-i2c driver is built-in:
arm-linux-gnueabi-ld: drivers/crypto/atmel-i2c.o: in function `atmel_i2c_checksum':
atmel-i2c.c:(.text+0xa0): undefined reference to `byte_rev_table'
Add one more 'select' statement to prevent this.
--- drivers/crypto/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/Kconfig +1 -0
@@ -548,6 +548,7 @@ config CRYPTO_DEV_ATMEL_SHA config CRYPTO_DEV_ATMEL_I2C tristate + select BITREVERSE config CRYPTO_DEV_ATMEL_ECC tristate "Support for Microchip / Atmel ECC hw accelerator"
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 415/717 mac80211: dont set set TDLS STA bandwidth wider than possible
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit f65607cdbc6b0da356ef5a22552ddd9313cf87a0 ]
When we set up a TDLS station, we set sta->sta.bandwidth solely based on the capabilities, because the "what's the current bandwidth" check is bypassed and only applied for other types of stations.
This leads to the unfortunate scenario that the sta->sta.bandwidth is 160 MHz if both stations support it, but we never actually configure this bandwidth unless the AP is already using 160 MHz; even for wider bandwidth support we only go up to 80 MHz (at least right now.)
For iwlwifi, this can also lead to firmware asserts, telling us that we've configured the TX rates for a higher bandwidth than is actually available due to the PHY configuration.
For non-TDLS, we check against the interface's requested bandwidth, but we explicitly skip this check for TDLS to cope with the wider BW case. Change this to
(a) still limit to the TDLS peer's own chandef, which gets factored into the overall PHY configuration we request from the driver, and
(b) limit it to when the TDLS peer is authorized, because it's only factored into the channel context in this case.
--- net/mac80211/vht.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/mac80211/vht.c +10 -4
@@ -465,12 +465,18 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)* IEEE80211-2016 specification makes higher bandwidth operation * possible on the TDLS link if the peers have wider bandwidth * capability. +* +* However, in this case, and only if the TDLS peer is authorized, +* limit to the tdls_chandef so that the configuration here isn't +* wider than what's actually requested on the channel context. */ if (test_sta_flag (sta,WLAN_STA_TDLS_PEER ) && -test_sta_flag (sta,WLAN_STA_TDLS_WIDER_BW )) -return bw; - - bw =min (bw,ieee80211_chan_width_to_rx_bw (bss_width)); +test_sta_flag (sta,WLAN_STA_TDLS_WIDER_BW ) && +test_sta_flag (sta,WLAN_STA_AUTHORIZED ) && + sta->tdls_chandef.chan) + bw =min (bw,ieee80211_chan_width_to_rx_bw (sta->tdls_chandef.width)); +else + bw =min (bw,ieee80211_chan_width_to_rx_bw (bss_width));return bw; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 416/717 mac80211: fix a mistake check for rx_stats update
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit f879ac8ed6c83ce05fcb53815a8ea83c5b6099a1 ]
It should be !is_multicast_ether_addr() in ieee80211_rx_h_sta_process() for the rx_stats update, below commit remove the !, this patch is to change it back.
It lead the rx rate "iw wlan0 station dump" become invalid for some scenario when IEEE80211_HW_USES_RSS is set.
--- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rx.c +1 -1
@@ -1758,7 +1758,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) }else if (rx->sdata->vif.type ==NL80211_IFTYPE_OCB ) { sta->rx_stats.last_rx = jiffies; }else if (!ieee80211_is_s1g_beacon (hdr->frame_control) && -is_multicast_ether_addr (hdr->addr1)) { + !is_multicast_ether_addr (hdr->addr1)) {/* * Mesh beacons will update last_rx when if they are found to * match the current local configuration when processed.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 417/717 ASoC: wm_adsp: remove "ctl" from list on error in wm_adsp_create_control()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 85a7555575a0e48f9b73db310d0d762a08a46d63 ]
The error handling frees "ctl" but it's still on the "dsp->ctl_list" list so that could result in a use after free. Remove it from the list before returning.
--- sound/soc/codecs/wm_adsp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/wm_adsp.c +3 -2
@@ -1519,7 +1519,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, ctl_work =kzalloc (sizeof (*ctl_work),GFP_KERNEL );if (!ctl_work) { ret = -ENOMEM ; - goto err_ctl_cache; + goto err_list_del; } ctl_work->dsp = dsp;
@@ -1529,7 +1529,8 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,return 0 ; -err_ctl_cache: +err_list_del: +list_del (&ctl->list);kfree (ctl->cache); err_ctl_subname:kfree (ctl->subname);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 418/717 irqchip/alpine-msi: Fix freeing of interrupts on allocation error path
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 3841245e8498a789c65dedd7ffa8fb2fee2c0684 ]
The alpine-msi driver has an interesting allocation error handling, where it frees the same interrupts repeatedly. Hilarity follows.
This code is probably never executed, but let's fix it nonetheless.
--- drivers/irqchip/irq-alpine-msi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-alpine-msi.c +1 -2
@@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain,return 0 ; err_sgi: -while (--i >=0 ) -irq_domain_free_irqs_parent (domain, virq, i); +irq_domain_free_irqs_parent (domain, virq, i -1 );alpine_msix_free_sgi (priv, sgi, nr_irqs);return err; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 419/717 irqchip/ti-sci-inta: Fix printing of inta id on probe success
In reply to Greg Kroah-HartmanFrom: Lokesh Vutla <[email protected]>
[ Upstream commit b10d5fd489b0c67f59cbdd28d95f4bd9f76a62f2 ]
On a successful probe, the driver tries to print a success message with INTA device id. It uses pdev->id for printing the id but id is stored in inta->ti_sci_id. Fix it by correcting the dev_info parameter.
--- drivers/irqchip/irq-ti-sci-inta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-ti-sci-inta.c +1 -1
@@ -726,7 +726,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)INIT_LIST_HEAD (&inta->vint_list);mutex_init (&inta->vint_mutex); -dev_info (dev,"Interrupt Aggregator domain %d created\n" , pdev->id); +dev_info (dev,"Interrupt Aggregator domain %d created\n" , inta->ti_sci_id);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 420/717 irqchip/ti-sci-intr: Fix freeing of irqs
In reply to Greg Kroah-HartmanFrom: Lokesh Vutla <[email protected]>
[ Upstream commit fc6c7cd3878641fd43189f15697e7ad0871f5c1a ]
ti_sci_intr_irq_domain_free() assumes that out_irq of intr is stored in data->chip_data and uses it for calling ti_sci irq_free() and then mark the out_irq as available resource. But ti_sci_intr_irq_domain_alloc() is storing p_hwirq(parent's hardware irq) which is translated from out_irq. This is causing resource leakage and eventually out_irq resources might be exhausted. Fix ti_sci_intr_irq_domain_alloc() by storing the out_irq in data->chip_data.
--- drivers/irqchip/irq-ti-sci-intr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/irqchip/irq-ti-sci-intr.c +7 -7
@@ -129,7 +129,7 @@ static void ti_sci_intr_irq_domain_free(struct irq_domain *domain,* @virq: Corresponding Linux virtual IRQ number * @hwirq: Corresponding hwirq for the IRQ within this IRQ domain * -* Returns parent irq if all went well else appropriate error pointer. +* Returns intr output irq if all went well else appropriate error pointer. */ static int ti_sci_intr_alloc_parent_irq (struct irq_domain *domain,unsigned int virq,u32 hwirq)
@@ -173,7 +173,7 @@ static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,if (err) goto err_msg; -return p_hwirq; +return out_irq; err_msg:irq_domain_free_irqs_parent (domain, virq,1 );
@@ -198,19 +198,19 @@ static int ti_sci_intr_irq_domain_alloc(struct irq_domain *domain,struct irq_fwspec *fwspec = data;unsigned long hwirq;unsigned int flags; -int err, p_hwirq; +int err, out_irq; err =ti_sci_intr_irq_domain_translate (domain, fwspec, &hwirq, &flags);if (err)return err; - p_hwirq =ti_sci_intr_alloc_parent_irq (domain, virq, hwirq); -if (p_hwirq <0 ) -return p_hwirq; + out_irq =ti_sci_intr_alloc_parent_irq (domain, virq, hwirq); +if (out_irq <0 ) +return out_irq;irq_domain_set_hwirq_and_chip (domain, virq, hwirq, &ti_sci_intr_irq_chip, - (void *)(uintptr_t )p_hwirq); + (void *)(uintptr_t )out_irq);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 421/717 dmaengine: ti: k3-udma: Correct normal channel offset when uchan_cnt is not 0
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit e2de925bbfe321ba0588c99f577c59386ab1f428 ]
According to different sections of the TRM, the hchan_cnt of CAP3 includes the number of uchan in UDMA, thus the start offset of the normal channels are hchan_cnt.
--- drivers/dma/ti/k3-udma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +1 -2
@@ -3201,8 +3201,7 @@ static int udma_setup_resources(struct udma_dev *ud) }else if (UDMA_CAP3_UCHAN_CNT (cap3)) { ud->tpl_levels =3 ; ud->tpl_start_idx[1 ] =UDMA_CAP3_UCHAN_CNT (cap3); - ud->tpl_start_idx[0 ] = ud->tpl_start_idx[1 ] + -UDMA_CAP3_HCHAN_CNT (cap3); + ud->tpl_start_idx[0 ] =UDMA_CAP3_HCHAN_CNT (cap3); }else if (UDMA_CAP3_HCHAN_CNT (cap3)) { ud->tpl_levels =2 ; ud->tpl_start_idx[0 ] =UDMA_CAP3_HCHAN_CNT (cap3);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 422/717 RDMA/hns: Limit the length of data copied between kernel and userspace
In reply to Greg Kroah-HartmanFrom: Wenpeng Liang <[email protected]>
[ Upstream commit 1c0ca9cd1741687f529498ddb899805fc2c51caa ]
For ib_copy_from_user(), the length of udata may not be the same as that of cmd. For ib_copy_to_user(), the length of udata may not be the same as that of resp. So limit the length to prevent out-of-bounds read and write operations from ib_copy_from_user() and ib_copy_to_user().
--- drivers/infiniband/hw/hns/hns_roce_cq.c | 5 +++-- drivers/infiniband/hw/hns/hns_roce_main.c | 3 ++- drivers/infiniband/hw/hns/hns_roce_pd.c | 11 ++++++----- drivers/infiniband/hw/hns/hns_roce_qp.c | 9 ++++++--- drivers/infiniband/hw/hns/hns_roce_srq.c | 10 +++++----- 5 files changed, 22 insertions(+), 16 deletions(-)
drivers/infiniband/hw/hns/hns_roce_cq.c +3 -2
@@ -274,7 +274,7 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr,if (udata) { ret =ib_copy_from_udata (&ucmd, udata, -min (sizeof (ucmd), udata->inlen)); +min (udata->inlen,sizeof (ucmd)));if (ret) {ibdev_err (ibdev,"Failed to copy CQ udata, err %d\n" , ret);
@@ -313,7 +313,8 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr,if (udata) { resp.cqn = hr_cq->cqn; - ret =ib_copy_to_udata (udata, &resp,sizeof (resp)); + ret =ib_copy_to_udata (udata, &resp, +min (udata->outlen,sizeof (resp)));if (ret) goto err_cqc; }
drivers/infiniband/hw/hns/hns_roce_main.c +2 -1
@@ -325,7 +325,8 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, resp.cqe_size = hr_dev->caps.cqe_sz; - ret =ib_copy_to_udata (udata, &resp,sizeof (resp)); + ret =ib_copy_to_udata (udata, &resp, +min (udata->outlen,sizeof (resp)));if (ret) goto error_fail_copy_to_udata;
drivers/infiniband/hw/hns/hns_roce_pd.c +6 -5
@@ -70,16 +70,17 @@ int hns_roce_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) }if (udata) { -struct hns_roce_ib_alloc_pd_resp uresp = {.pdn = pd->pdn}; +struct hns_roce_ib_alloc_pd_resp resp = {.pdn = pd->pdn}; -if (ib_copy_to_udata (udata, &uresp,sizeof (uresp))) { + ret =ib_copy_to_udata (udata, &resp, +min (udata->outlen,sizeof (resp))); +if (ret) {hns_roce_pd_free (to_hr_dev (ib_dev), pd->pdn); -ibdev_err (ib_dev,"failed to copy to udata\n" ); -return -EFAULT ; +ibdev_err (ib_dev,"failed to copy to udata, ret = %d\n" , ret); } } -return 0 ; +return ret; }int hns_roce_dealloc_pd (struct ib_pd *pd,struct ib_udata *udata)
drivers/infiniband/hw/hns/hns_roce_qp.c +6 -3
@@ -865,9 +865,12 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, }if (udata) { -if (ib_copy_from_udata (ucmd, udata,sizeof (*ucmd))) { -ibdev_err (ibdev,"Failed to copy QP ucmd\n" ); -return -EFAULT ; + ret =ib_copy_from_udata (ucmd, udata, +min (udata->inlen,sizeof (*ucmd))); +if (ret) { +ibdev_err (ibdev, +"failed to copy QP ucmd, ret = %d\n" , ret); +return ret; } ret =set_user_sq_size (hr_dev, &init_attr->cap, hr_qp, ucmd);
drivers/infiniband/hw/hns/hns_roce_srq.c +5 -5
@@ -300,7 +300,8 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, srq->max_gs = init_attr->attr.max_sge;if (udata) { - ret =ib_copy_from_udata (&ucmd, udata,sizeof (ucmd)); + ret =ib_copy_from_udata (&ucmd, udata, +min (udata->inlen,sizeof (ucmd)));if (ret) {ibdev_err (ibdev,"Failed to copy SRQ udata, err %d\n" , ret);
@@ -343,11 +344,10 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, resp.srqn = srq->srqn;if (udata) { -if (ib_copy_to_udata (udata, &resp, -min (udata->outlen,sizeof (resp)))) { - ret = -EFAULT ; + ret =ib_copy_to_udata (udata, &resp, +min (udata->outlen,sizeof (resp))); +if (ret) goto err_srqc_alloc; - } }return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 423/717 RDMA/hns: Normalization the judgment of some features
In reply to Greg Kroah-HartmanFrom: Wenpeng Liang <[email protected]>
[ Upstream commit 4ddeacf68a3dd05f346b63f4507e1032a15cc3cc ]
Whether to enable the these features should better depend on the enable flags, not the value of related fields.
--- drivers/infiniband/hw/hns/hns_roce_hem.c | 4 ++-- drivers/infiniband/hw/hns/hns_roce_main.c | 8 ++++---- drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.c +2 -2
@@ -1017,7 +1017,7 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,void hns_roce_cleanup_hem (struct hns_roce_dev *hr_dev) { -if (hr_dev->caps.srqc_entry_sz) +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_SRQ )hns_roce_cleanup_hem_table (hr_dev, &hr_dev->srq_table.table);hns_roce_cleanup_hem_table (hr_dev, &hr_dev->cq_table.table);
@@ -1027,7 +1027,7 @@ void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev)if (hr_dev->caps.cqc_timer_entry_sz)hns_roce_cleanup_hem_table (hr_dev, &hr_dev->cqc_timer_table); -if (hr_dev->caps.sccc_sz) +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL )hns_roce_cleanup_hem_table (hr_dev, &hr_dev->qp_table.sccc_table);if (hr_dev->caps.trrl_entry_sz)
drivers/infiniband/hw/hns/hns_roce_main.c +4 -4
@@ -632,7 +632,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev) goto err_unmap_trrl; } -if (hr_dev->caps.srqc_entry_sz) { +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_SRQ ) { ret = hns_roce_init_hem_table(hr_dev, &hr_dev->srq_table.table, HEM_TYPE_SRQC, hr_dev->caps.srqc_entry_sz,
@@ -644,7 +644,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev) } } -if (hr_dev->caps.sccc_sz) { +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL ) { ret = hns_roce_init_hem_table(hr_dev, &hr_dev->qp_table.sccc_table, HEM_TYPE_SCCC,
@@ -688,11 +688,11 @@ err_unmap_qpc_timer:hns_roce_cleanup_hem_table (hr_dev, &hr_dev->qpc_timer_table); err_unmap_ctx: -if (hr_dev->caps.sccc_sz) +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL )hns_roce_cleanup_hem_table (hr_dev, &hr_dev->qp_table.sccc_table); err_unmap_srq: -if (hr_dev->caps.srqc_entry_sz) +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_SRQ )hns_roce_cleanup_hem_table (hr_dev, &hr_dev->srq_table.table); err_unmap_cq:
drivers/infiniband/hw/hns/hns_roce_qp.c +1 -1
@@ -286,7 +286,7 @@ static int alloc_qpc(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) } } -if (hr_dev->caps.sccc_sz) { +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL ) {/* Alloc memory for SCC CTX */ ret =hns_roce_table_get (hr_dev, &qp_table->sccc_table, hr_qp->qpn);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 424/717 RDMA/hns: Do shift on traffic class when using RoCEv2
In reply to Greg Kroah-HartmanFrom: Weihang Li <[email protected]>
[ Upstream commit 603bee935f38080a3674c763c50787751e387779 ]
The high 6 bits of traffic class in GRH is DSCP (Differentiated Services Codepoint), the driver should shift it before the hardware gets it when using RoCEv2.
--- drivers/infiniband/hw/hns/hns_roce_ah.c | 2 +- drivers/infiniband/hw/hns/hns_roce_device.h | 8 ++++++++ drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 10 +++------- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/infiniband/hw/hns/hns_roce_ah.c +1 -1
@@ -74,7 +74,7 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, ah->av.flowlabel = grh->flow_label; ah->av.udp_sport =get_ah_udp_sport (ah_attr); ah->av.sl =rdma_ah_get_sl (ah_attr); - ah->av.tclass = grh->traffic_class; + ah->av.tclass =get_tclass (grh);memcpy (ah->av.dgid, grh->dgid.raw,HNS_ROCE_GID_SIZE );memcpy (ah->av.mac, ah_attr->roce.dmac,ETH_ALEN );
drivers/infiniband/hw/hns/hns_roce_device.h +8 -0
@@ -1132,6 +1132,14 @@ static inline u32 to_hr_hem_entries_shift(u32 count, u32 buf_shift)return ilog2 (to_hr_hem_entries_count (count, buf_shift)); } +#define DSCP_SHIFT 2 + +static inline u8 get_tclass (const struct ib_global_route *grh) +{ +return grh->sgid_attr->gid_type ==IB_GID_TYPE_ROCE_UDP_ENCAP ? + grh->traffic_class >>DSCP_SHIFT : grh->traffic_class; +} +int hns_roce_init_uar_table (struct hns_roce_dev *dev);int hns_roce_uar_alloc (struct hns_roce_dev *dev,struct hns_roce_uar *uar);void hns_roce_uar_free (struct hns_roce_dev *dev,struct hns_roce_uar *uar);
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -7
@@ -4460,15 +4460,11 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp,roce_set_field (qpc_mask->byte_24_mtu_tc,V2_QPC_BYTE_24_HOP_LIMIT_M ,V2_QPC_BYTE_24_HOP_LIMIT_S ,0 ); -if (is_udp) -roce_set_field (context->byte_24_mtu_tc,V2_QPC_BYTE_24_TC_M , -V2_QPC_BYTE_24_TC_S , grh->traffic_class >>2 ); -else -roce_set_field (context->byte_24_mtu_tc,V2_QPC_BYTE_24_TC_M , -V2_QPC_BYTE_24_TC_S , grh->traffic_class); - +roce_set_field (context->byte_24_mtu_tc,V2_QPC_BYTE_24_TC_M , +V2_QPC_BYTE_24_TC_S ,get_tclass (&attr->ah_attr.grh));roce_set_field (qpc_mask->byte_24_mtu_tc,V2_QPC_BYTE_24_TC_M ,V2_QPC_BYTE_24_TC_S ,0 ); +roce_set_field (context->byte_28_at_fl,V2_QPC_BYTE_28_FL_M ,V2_QPC_BYTE_28_FL_S , grh->flow_label); roce_set_field(qpc_mask->byte_28_at_fl, V2_QPC_BYTE_28_FL_M,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 425/717 gpiolib: irq hooks: fix recursion in gpiochip_irq_unmask
In reply to Greg Kroah-HartmanFrom: Nikita Shubin <[email protected]>
[ Upstream commit 9d5522199505c761575c8ea31dcfd9a2a8d73614 ]
irqchip shared with multiple gpiochips, leads to recursive call of gpiochip_irq_mask/gpiochip_irq_unmask which was assigned to rqchip->irq_mask/irqchip->irq_unmask, these happens becouse of only irqchip->irq_enable == gpiochip_irq_enable is checked.
Let's add an additional check to make sure shared irqchip is detected even if irqchip->irq_enable wasn't defined.
--- drivers/gpio/gpiolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib.c +2 -1
@@ -1477,7 +1477,8 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc)if (WARN_ON (gc->irq.irq_enable))return ;/* Check if the irqchip already has this hook... */ -if (irqchip->irq_enable == gpiochip_irq_enable) { +if (irqchip->irq_enable == gpiochip_irq_enable || + irqchip->irq_mask == gpiochip_irq_mask) {/* * ...and if so, give a gentle warning that this is bad * practice.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 426/717 ath11k: Fix incorrect tlvs in scan start command
In reply to Greg Kroah-HartmanFrom: Pradeep Kumar Chitrapu <[email protected]>
[ Upstream commit f57ad6a9885e8399897daee3249cabccf9c972f8 ]
Currently 6G specific tlvs have duplicate entries which is causing scan failures. Fix this by removing the duplicate entries of the same tlv. This also fixes out-of-bound memory writes caused due to adding tlvs when num_hint_bssid and num_hint_s_ssid are ZEROs.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01386-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 31 --------------------------- 1 file changed, 31 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +0 -31
@@ -2198,37 +2198,6 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, } } - len = params->num_hint_s_ssid *sizeof (struct hint_short_ssid ); - tlv = ptr; - tlv->header =FIELD_PREP (WMI_TLV_TAG ,WMI_TAG_ARRAY_FIXED_STRUCT ) | -FIELD_PREP (WMI_TLV_LEN , len); - ptr +=TLV_HDR_SIZE ; -if (params->num_hint_s_ssid) { - s_ssid = ptr; -for (i =0 ; i < params->num_hint_s_ssid; ++i) { - s_ssid->freq_flags = params->hint_s_ssid[i].freq_flags; - s_ssid->short_ssid = params->hint_s_ssid[i].short_ssid; - s_ssid++; - } - } - ptr += len; - - len = params->num_hint_bssid *sizeof (struct hint_bssid ); - tlv = ptr; - tlv->header =FIELD_PREP (WMI_TLV_TAG ,WMI_TAG_ARRAY_FIXED_STRUCT ) | -FIELD_PREP (WMI_TLV_LEN , len); - ptr +=TLV_HDR_SIZE ; -if (params->num_hint_bssid) { - hint_bssid = ptr; -for (i =0 ; i < params->num_hint_bssid; ++i) { - hint_bssid->freq_flags = - params->hint_bssid[i].freq_flags; -ether_addr_copy (¶ms->hint_bssid[i].bssid.addr[0 ], - &hint_bssid->bssid.addr[0 ]); - hint_bssid++; - } - } - ret =ath11k_wmi_cmd_send (wmi, skb,WMI_START_SCAN_CMDID );if (ret) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 427/717 irqchip/qcom-pdc: Fix phantom irq when changing between rising/falling
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit 2f5fbc4305d07725bfebaedb09e57271315691ef ]
We have a problem if we use gpio-keys and configure wakeups such that we only want one edge to wake us up. AKA:
wakeup-event-action = <EV_ACT_DEASSERTED>; wakeup-source;
Specifically we end up with a phantom interrupt that blocks suspend if the line was already high and we want wakeups on rising edges (AKA we want the GPIO to go low and then high again before we wake up). The opposite is also problematic.
Specifically, here's what's happening today:
1. Normally, gpio-keys configures to look for both edges. Due to the current workaround introduced in commit c3c0c2e18d94 ("pinctrl:
qcom: Handle broken/missing PDC dual edge IRQs on sc7180"), if the line was high we'd configure for falling edges.
2. At suspend time, we change to look for rising edges.
3. After qcom_pdc_gic_set_type() runs, we get a phantom interrupt.
We can solve this by just clearing the phantom interrupt.
NOTE: it is possible that this could cause problems for a client with very specific needs, but there's not much we can do with this hardware. As an example, let's say the interrupt signal is currently high and the client is looking for falling edges. The client now changes to look for rising edges. The client could possibly expect that if the line has a short pulse low (and back high) that it would always be detected. Specifically no matter when the pulse happened, it should either have tripped the (old) falling edge trigger or the (new) rising edge trigger. We will simply not trip it. We could narrow down the race a bit by polling our parent before changing types, but no matter what we do there will still be a period of time where we can't tell the difference between a real transition (or more than one transition) and the phantom.
--- drivers/irqchip/qcom-pdc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/irqchip/qcom-pdc.c +20 -1
@@ -159,6 +159,8 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) {int pin_out = d->hwirq;enum pdc_irq_config_bits pdc_type; +enum pdc_irq_config_bits old_pdc_type; +int ret;if (pin_out ==GPIO_NO_WAKE_IRQ )return 0 ;
@@ -187,9 +189,26 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type)return -EINVAL ; } + old_pdc_type =pdc_reg_read (IRQ_i_CFG, pin_out);pdc_reg_write (IRQ_i_CFG, pin_out, pdc_type); -return irq_chip_set_type_parent (d, type); + ret =irq_chip_set_type_parent (d, type); +if (ret) +return ret; + +/* +* When we change types the PDC can give a phantom interrupt. +* Clear it. Specifically the phantom shows up when reconfiguring +* polarity of interrupt without changing the state of the signal +* but let's be consistent and clear it always. +* +* Doing this works because we have IRQCHIP_SET_TYPE_MASKED so the +* interrupt will be cleared before the rest of the system sees it. +*/ +if (old_pdc_type != pdc_type) +irq_chip_set_parent_state (d,IRQCHIP_STATE_PENDING , false); + +return 0 ; }static struct irq_chip qcom_pdc_gic_chip = {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 428/717 watchdog: armada_37xx: Add missing dependency on HAS_IOMEM
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 7f6f1dfb2dcbe5d2bfa213f2df5d74c147cd5954 ]
The following kbuild warning is seen on a system without HAS_IOMEM.
WARNING: unmet direct dependencies detected for MFD_SYSCON
Depends on [n]: HAS_IOMEM [=n]
Selected by [y]:
- ARMADA_37XX_WATCHDOG [=y] && WATCHDOG [=y] && (ARCH_MVEBU || COMPILE_TEST
This results in a subsequent compile error.
drivers/watchdog/armada_37xx_wdt.o: in function `armada_37xx_wdt_probe':
armada_37xx_wdt.c:(.text+0xdc): undefined reference to `devm_ioremap'
Add the missing dependency.
--- drivers/watchdog/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/Kconfig +1 -0
@@ -386,6 +386,7 @@ config ARM_SBSA_WATCHDOG config ARMADA_37XX_WATCHDOG tristate "Armada 37xx watchdog" depends on ARCH_MVEBU || COMPILE_TEST + depends on HAS_IOMEM select MFD_SYSCON select WATCHDOG_CORE help
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 429/717 watchdog: sirfsoc: Add missing dependency on HAS_IOMEM
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 8ae2511112d2e18bc7d324b77f965d34083a25a2 ]
If HAS_IOMEM is not defined and SIRFSOC_WATCHDOG is enabled, the build fails with the following error.
drivers/watchdog/sirfsoc_wdt.o: in function `sirfsoc_wdt_probe':
sirfsoc_wdt.c:(.text+0x112):
undefined reference to `devm_platform_ioremap_resource'
--- drivers/watchdog/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/Kconfig +1 -0
@@ -790,6 +790,7 @@ config MOXART_WDT config SIRFSOC_WATCHDOG tristate "SiRFSOC watchdog" + depends on HAS_IOMEM depends on ARCH_SIRF || COMPILE_TEST select WATCHDOG_CORE default y
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 430/717 watchdog: sprd: remove watchdog disable from resume fail path
In reply to Greg Kroah-HartmanFrom: Lingling Xu <[email protected]>
[ Upstream commit f61a59acb462840bebcc192f754fe71b6a16ff99 ]
sprd_wdt_start() would return fail if the loading operation is not completed in a certain time, disabling watchdog for that case would probably cause the kernel crash when kick watchdog later, that's too bad, so remove the watchdog disable operation for the fail case to make sure other parts in the kernel can run normally.
[ chunyan: Massaged changelog ]
--- drivers/watchdog/sprd_wdt.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/watchdog/sprd_wdt.c +2 -7
@@ -345,15 +345,10 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev)if (ret)return ret; -if (watchdog_active (&wdt->wdd)) { +if (watchdog_active (&wdt->wdd)) ret =sprd_wdt_start (&wdt->wdd); -if (ret) { -sprd_wdt_disable (wdt); -return ret; - } - } -return 0 ; +return ret; }static const struct dev_pm_ops sprd_wdt_pm_ops = {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 431/717 watchdog: sprd: check busy bit before new loading rather than after that
In reply to Greg Kroah-HartmanFrom: Lingling Xu <[email protected]>
[ Upstream commit 3e07d240939803bed9feb2a353d94686a411a7ca ]
As the specification described, users must check busy bit before start a new loading operation to make sure that the previous loading is done and the device is ready to accept a new one.
[ chunyan: Massaged changelog ]
--- drivers/watchdog/sprd_wdt.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/watchdog/sprd_wdt.c +13 -12
@@ -108,18 +108,6 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout,u32 tmr_step = timeout *SPRD_WDT_CNT_STEP ;u32 prtmr_step = pretimeout *SPRD_WDT_CNT_STEP ; -sprd_wdt_unlock (wdt->base); -writel_relaxed ((tmr_step >>SPRD_WDT_CNT_HIGH_SHIFT ) & -SPRD_WDT_LOW_VALUE_MASK , wdt->base +SPRD_WDT_LOAD_HIGH ); -writel_relaxed ((tmr_step &SPRD_WDT_LOW_VALUE_MASK ), - wdt->base +SPRD_WDT_LOAD_LOW ); -writel_relaxed ((prtmr_step >>SPRD_WDT_CNT_HIGH_SHIFT ) & -SPRD_WDT_LOW_VALUE_MASK , - wdt->base +SPRD_WDT_IRQ_LOAD_HIGH ); -writel_relaxed (prtmr_step &SPRD_WDT_LOW_VALUE_MASK , - wdt->base +SPRD_WDT_IRQ_LOAD_LOW ); -sprd_wdt_lock (wdt->base); -/* * Waiting the load value operation done, * it needs two or three RTC clock cycles.
@@ -134,6 +122,19 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout,if (delay_cnt >=SPRD_WDT_LOAD_TIMEOUT )return -EBUSY ; + +sprd_wdt_unlock (wdt->base); +writel_relaxed ((tmr_step >>SPRD_WDT_CNT_HIGH_SHIFT ) & +SPRD_WDT_LOW_VALUE_MASK , wdt->base +SPRD_WDT_LOAD_HIGH ); +writel_relaxed ((tmr_step &SPRD_WDT_LOW_VALUE_MASK ), + wdt->base +SPRD_WDT_LOAD_LOW ); +writel_relaxed ((prtmr_step >>SPRD_WDT_CNT_HIGH_SHIFT ) & +SPRD_WDT_LOW_VALUE_MASK , + wdt->base +SPRD_WDT_IRQ_LOAD_HIGH ); +writel_relaxed (prtmr_step &SPRD_WDT_LOW_VALUE_MASK , + wdt->base +SPRD_WDT_IRQ_LOAD_LOW ); +sprd_wdt_lock (wdt->base); +return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 432/717 watchdog: Fix potential dereferencing of null pointer
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 6f733cb2e7db38f8141b14740bcde577844a03b7 ]
A reboot notifier, which stops the WDT by calling the stop hook without any check, would be registered when we set WDOG_STOP_ON_REBOOT flag.
Howerer we allow the WDT driver to omit the stop hook since commit "d0684c8a93549" ("watchdog: Make stop function optional") and provide a module parameter for user that controls the WDOG_STOP_ON_REBOOT flag in commit 9232c80659e94 ("watchdog: Add stop_on_reboot parameter to control reboot policy"). Together that commits make user potential to insert a watchdog driver that don't provide a stop hook but with the stop_on_reboot parameter set, then dereferencing of null pointer occurs on system reboot.
Check the stop hook before registering the reboot notifier to fix the issue.
--- drivers/watchdog/watchdog_core.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/watchdog/watchdog_core.c +13 -9
@@ -267,15 +267,19 @@ static int __watchdog_register_device(struct watchdog_device *wdd) }if (test_bit (WDOG_STOP_ON_REBOOT , &wdd->status)) { - wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; - - ret =register_reboot_notifier (&wdd->reboot_nb); -if (ret) { -pr_err ("watchdog%d: Cannot register reboot notifier (%d)\n" , - wdd->id, ret); -watchdog_dev_unregister (wdd); -ida_simple_remove (&watchdog_ida, id); -return ret; +if (!wdd->ops->stop) +pr_warn ("watchdog%d: stop_on_reboot not supported\n" , wdd->id); +else { + wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; + + ret =register_reboot_notifier (&wdd->reboot_nb); +if (ret) { +pr_err ("watchdog%d: Cannot register reboot notifier (%d)\n" , + wdd->id, ret); +watchdog_dev_unregister (wdd); +ida_simple_remove (&watchdog_ida, id); +return ret; + } } }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 433/717 ubifs: Fix error return code in ubifs_init_authentication()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 3cded66330591cfd2554a3fd5edca8859ea365a2 ]
Fix to return PTR_ERR() error code from the error handling case where ubifs_hash_get_desc() failed instead of 0 in ubifs_init_authentication(), as done elsewhere in this function.
--- fs/ubifs/auth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ubifs/auth.c +3 -1
@@ -338,8 +338,10 @@ int ubifs_init_authentication(struct ubifs_info *c) c->authenticated = true; c->log_hash =ubifs_hash_get_desc (c); -if (IS_ERR (c->log_hash)) +if (IS_ERR (c->log_hash)) { + err =PTR_ERR (c->log_hash); goto out_free_hmac; + } err =0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 434/717 um: Monitor error events in IRQ controller
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
[ Upstream commit e3a01cbee9c5f2c6fc813dd6af007716e60257e7 ]
Ensure that file closes, connection closes, etc are propagated as interrupts in the interrupt controller.
--- arch/um/os-Linux/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/os-Linux/irq.c +1 -1
@@ -48,7 +48,7 @@ int os_epoll_triggered(int index, int events)int os_event_mask (int irq_type) {if (irq_type ==IRQ_READ ) -return EPOLLIN |EPOLLPRI ; +return EPOLLIN |EPOLLPRI |EPOLLERR |EPOLLHUP |EPOLLRDHUP ;if (irq_type ==IRQ_WRITE )return EPOLLOUT ;return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 435/717 um: tty: Fix handling of close in tty lines
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
[ Upstream commit 9b1c0c0e25dcccafd30e7d4c150c249cc65550eb ]
Fix a logical error in tty reading. We get 0 and errno == EAGAIN on the first attempt to read from a closed file descriptor.
Compared to that a true EAGAIN is EAGAIN and -1.
If we check errno for EAGAIN first, before checking the return value we miss the fact that the descriptor is closed.
This bug is as old as the driver. It was not showing up with the original POLL based IRQ controller, because it was producing multiple events. Switching to EPOLL unmasked it.
--- arch/um/drivers/chan_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/chan_user.c +2 -2
@@ -26,10 +26,10 @@ int generic_read(int fd, char *c_out, void *unused) n =read (fd, c_out,sizeof (*c_out));if (n >0 )return n; -else if (errno ==EAGAIN ) -return 0 ;else if (n ==0 )return -EIO ; +else if (errno ==EAGAIN ) +return 0 ;return -errno; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 436/717 um: chan_xterm: Fix fd leak
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
[ Upstream commit 9431f7c199ab0d02da1482d62255e0b4621cb1b5 ]
xterm serial channel was leaking a fd used in setting up the port helper
This bug is prehistoric - it predates switching to git. The "fixes" header here is really just to mark all the versions we would like this to apply to which is "Anything from the Cretaceous period onwards".
No dinosaurs were harmed in fixing this bug.
--- arch/um/drivers/xterm.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/um/drivers/xterm.c +5 -0
@@ -18,6 +18,7 @@struct xterm_chan {int pid;int helper_pid; +int chan_fd;char *title;int device;int raw;
@@ -33,6 +34,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)return NULL ; *data = ((struct xterm_chan ) { .pid =-1 , .helper_pid =-1 , + .chan_fd =-1 , .device = device, .title = opts->xterm_title, .raw = opts->raw } );
@@ -149,6 +151,7 @@ static int xterm_open(int input, int output, int primary, void *d, goto out_kill; } + data->chan_fd = fd; new =xterm_fd (fd, &data->helper_pid);if (new <0 ) { err = new;
@@ -206,6 +209,8 @@ static void xterm_close(int fd, void *d)os_kill_process (data->helper_pid,0 ); data->helper_pid =-1 ; +if (data->chan_fd !=-1 ) +os_close_file (data->chan_fd);os_close_file (fd); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 437/717 sunrpc: fix xs_read_xdr_buf for partial pages receive
In reply to Greg Kroah-HartmanFrom: Dan Aloni <[email protected]>
[ Upstream commit ac9645c87380e39a8fa87a1b51721efcdea89dbf ]
When receiving pages data, return value 'ret' when positive includes buf->page_base, so we should subtract that before it is used for changing offset and comparing against want.
This was discovered on the very rare cases where the server returned a chunk of bytes that when added to the already received amount of bytes for the pages happened to match the current recv.len, for example on this case:
buf->page_base : 258356
actually received from socket: 1740
ret : 260096
want : 260096In this case neither of the two 'if ... goto out' trigger, and we continue to tail parsing.
Worth to mention that the ensuing EMSGSIZE from the continued execution of xs_read_xdr_buf may be observed by an application due to 4 superfluous bytes being added to the pages data.
--- net/sunrpc/xprtsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/xprtsock.c +2 -1
@@ -433,7 +433,8 @@ xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,if (ret <=0 ) goto sock_err;xs_flush_bvec (buf->bvec, ret, seek + buf->page_base); - offset += ret - buf->page_base; + ret -= buf->page_base; + offset += ret;if (offset == count || msg->msg_flags & (MSG_EOR |MSG_TRUNC )) goto out;if (ret != want)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 438/717 RDMA/mlx5: Fix MR cache memory leak
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit e89938902927a54abebccc9537991aca5237dfaf ]
If the MR cache entry invalidation failed, then we detach this entry from the cache, therefore we must to free the memory as well.
Allcation backtrace for the leaker:
[<00000000d8e423b0>] alloc_cache_mr+0x23/0xc0 [mlx5_ib]
[<000000001f21304c>] create_cache_mr+0x3f/0xf0 [mlx5_ib]
[<000000009d6b45dc>] mlx5_ib_alloc_implicit_mr+0x41/0×210 [mlx5_ib]
[<00000000879d0d68>] mlx5_ib_reg_user_mr+0x9e/0×6e0 [mlx5_ib]
[<00000000be74bf89>] create_qp+0x2fc/0xf00 [ib_uverbs]
[<000000001a532d22>] ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ+0x1d9/0×230 [ib_uverbs]
[<0000000070f46001>] rdma_alloc_commit_uobject+0xb5/0×120 [ib_uverbs]
[<000000006d8a0b38>] uverbs_alloc+0x2b/0xf0 [ib_uverbs]
[<00000000075217c9>] ksysioctl+0x234/0×7d0
[<00000000eb5c120b>] __x64_sys_ioctl+0x16/0×20
[<00000000db135b48>] do_syscall_64+0x59/0×2e0--- drivers/infiniband/hw/mlx5/mr.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/mr.c +1 -0
@@ -642,6 +642,7 @@ void mlx5_mr_cache_free(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)if (mlx5_mr_cache_invalidate (mr)) {detach_mr_from_cache (mr);destroy_mkey (dev, mr); +kfree (mr);return ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 439/717 RDMA/cma: Dont overwrite sgid_attr after device is released
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e246b7c035d74abfb3507fa10082d0c42cc016c3 ]
As part of the cma_dev release, that pointer will be set to NULL. In case it happens in rdma_bind_addr() (part of an error flow), the next call to addr_handler() will have a call to cma_acquire_dev_by_src_ip() which will overwrite sgid_attr without releasing it.
WARNING: CPU: 2 PID: 108 at drivers/infiniband/core/cma.c:606 cma_bind_sgid_attr drivers/infiniband/core/cma.c:606 [inline] WARNING: CPU: 2 PID: 108 at drivers/infiniband/core/cma.c:606 cma_acquire_dev_by_src_ip+0x470/0x4b0 drivers/infiniband/core/cma.c:649 CPU: 2 PID: 108 Comm: kworker/u8:1 Not tainted 5.10.0-rc6+ #257 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Workqueue: ib_addr process_one_req RIP: 0010:cma_bind_sgid_attr drivers/infiniband/core/cma.c:606 [inline] RIP: 0010:cma_acquire_dev_by_src_ip+0x470/0x4b0 drivers/infiniband/core/cma.c:649 Code: 66 d9 4a ff 4d 8b 6e 10 49 8d bd 1c 08 00 00 e8 b6 d6 4a ff 45 0f b6 bd 1c 08 00 00 41 83 e7 01 e9 49 fd ff ff e8 90 c5 29 ff <0f> 0b e9 80 fe ff ff e8 84 c5 29 ff 4c 89 f7 e8 2c d9 4a ff 4d 8b RSP: 0018:ffff8881047c7b40 EFLAGS: 00010293 RAX: ffff888104789c80 RBX: 0000000000000001 RCX: ffffffff820b8ef8 RDX: 0000000000000000 RSI: ffffffff820b9080 RDI: ffff88810cd4c998 RBP: ffff8881047c7c08 R08: ffff888104789c80 R09: ffffed10209f4036 R10: ffff888104fa01ab R11: ffffed10209f4035 R12: ffff88810cd4c800 R13: ffff888105750e28 R14: ffff888108f0a100 R15: ffff88810cd4c998 FS: 0000000000000000(0000) GS:ffff888119c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000104e60005 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: addr_handler+0x266/0x350 drivers/infiniband/core/cma.c:3190 process_one_req+0xa3/0x300 drivers/infiniband/core/addr.c:645 process_one_work+0x54c/0x930 kernel/workqueue.c:2272 worker_thread+0x82/0x830 kernel/workqueue.c:2418 kthread+0x1ca/0x220 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
--- drivers/infiniband/core/cma.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/core/cma.c +4 -3
@@ -477,6 +477,10 @@ static void cma_release_dev(struct rdma_id_private *id_priv)list_del (&id_priv->list);cma_dev_put (id_priv->cma_dev); id_priv->cma_dev =NULL ; +if (id_priv->id.route.addr.dev_addr.sgid_attr) { +rdma_put_gid_attr (id_priv->id.route.addr.dev_addr.sgid_attr); + id_priv->id.route.addr.dev_addr.sgid_attr =NULL ; + }mutex_unlock (&lock); }
@@ -1861,9 +1865,6 @@ static void _destroy_id(struct rdma_id_private *id_priv,kfree (id_priv->id.route.path_rec); -if (id_priv->id.route.addr.dev_addr.sgid_attr) -rdma_put_gid_attr (id_priv->id.route.addr.dev_addr.sgid_attr); -put_net (id_priv->id.route.addr.dev_addr.net);rdma_restrack_del (&id_priv->res);kfree (id_priv);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 440/717 nfc: s3fwrn5: Release the nfc firmware
In reply to Greg Kroah-HartmanFrom: Bongsu Jeon <[email protected]>
[ Upstream commit a4485baefa1efa596702ebffd5a9c760d42b14b5 ]
add the code to release the nfc firmware when the firmware image size is wrong.
--- drivers/nfc/s3fwrn5/firmware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/s3fwrn5/firmware.c +3 -1
@@ -293,8 +293,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info)if (ret <0 )return ret; -if (fw->fw->size <S3FWRN5_FW_IMAGE_HEADER_SIZE ) +if (fw->fw->size <S3FWRN5_FW_IMAGE_HEADER_SIZE ) { +release_firmware (fw->fw);return -EINVAL ; + }memcpy (fw->date, fw->fw->data +0x00 ,12 ); fw->date[12 ] ='\0' ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 441/717 drm: mxsfb: Silence -EPROBE_DEFER while waiting for bridge
In reply to Greg Kroah-HartmanFrom: Guido Günther <[email protected]>
[ Upstream commit ee46d16d2e40bebc2aa790fd7b6a056466ff895c ]
It can take multiple iterations until all components for an attached DSI bridge are up leading to several:
[ 3.796425] mxsfb 30320000.lcd-controller: Cannot connect bridge: -517 [ 3.816952] mxsfb 30320000.lcd-controller: [drm:mxsfb_probe [mxsfb]] *ERROR* failed to attach bridge: -517
Silence this by checking for -EPROBE_DEFER and using dev_err_probe() so we set a deferred reason in case a dependency fails to probe (which quickly happens on small config/DT changes due to the rather long probe chain which can include bridges, phys, panels, backights, leds, etc.).
This also removes the only DRM_DEV_ERROR() usage, the rest of the driver uses dev_err().
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +4 -6
@@ -134,11 +134,8 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)return -ENODEV ; ret =drm_bridge_attach (&mxsfb->encoder, bridge,NULL ,0 ); -if (ret) { -DRM_DEV_ERROR (drm->dev, -"failed to attach bridge: %d\n" , ret); -return ret; - } +if (ret) +return dev_err_probe (drm->dev, ret,"Failed to attach bridge\n" ); mxsfb->bridge = bridge;
@@ -212,7 +209,8 @@ static int mxsfb_load(struct drm_device *drm, ret =mxsfb_attach_bridge (mxsfb);if (ret) { -dev_err (drm->dev,"Cannot connect bridge: %d\n" , ret); +if (ret != -EPROBE_DEFER ) +dev_err (drm->dev,"Cannot connect bridge: %d\n" , ret); goto err_vblank; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 442/717 powerpc/perf: Fix Threshold Event Counter Multiplier width for P10
In reply to Greg Kroah-HartmanFrom: Madhavan Srinivasan <[email protected]>
[ Upstream commit ef0e3b650f8ddc54bb70868852f50642ee3ae765 ]
Threshold Event Counter Multiplier (TECM) is part of Monitor Mode Control Register A (MMCRA). This field along with Threshold Event Counter Exponent (TECE) is used to get threshould counter value. In Power10, this is a 8bit field, so patch fixes the current code to modify the MMCRA[TECM] extraction macro to handle this change. ISA v3.1 says this is a 7 bit field but POWER10 it's actually 8 bits which will hopefully be fixed in ISA v3.1 update.
--- arch/powerpc/perf/isa207-common.c | 3 +++ arch/powerpc/perf/isa207-common.h | 4 ++++ 2 files changed, 7 insertions(+)
arch/powerpc/perf/isa207-common.c +3 -0
@@ -247,6 +247,9 @@ void isa207_get_mem_weight(u64 *weight)u64 sier =mfspr (SPRN_SIER );u64 val = (sier &ISA207_SIER_TYPE_MASK ) >>ISA207_SIER_TYPE_SHIFT ; +if (cpu_has_feature (CPU_FTR_ARCH_31 )) + mantissa =P10_MMCRA_THR_CTR_MANT (mmcra); +if (val ==0 || val ==7 ) *weight =0 ;else
arch/powerpc/perf/isa207-common.h +4 -0
@@ -231,6 +231,10 @@#define MMCRA_THR_CTR_EXP (v) (((v) >> MMCRA_THR_CTR_EXP_SHIFT) &\ MMCRA_THR_CTR_EXP_MASK) +#define P10_MMCRA_THR_CTR_MANT_MASK 0xFFul +#define P10_MMCRA_THR_CTR_MANT (v) (((v) >> MMCRA_THR_CTR_MANT_SHIFT) &\ + P10_MMCRA_THR_CTR_MANT_MASK) +/* MMCRA Threshold Compare bit constant for power9 */ #define p9_MMCRA_THR_CMP_SHIFT 45
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 443/717 powerpc/ps3: use dma_mapping_error()
In reply to Greg Kroah-HartmanFrom: Vincent Stehlé <[email protected]>
[ Upstream commit d0edaa28a1f7830997131cbce87b6c52472825d1 ]
The DMA address returned by dma_map_single() should be checked with dma_mapping_error(). Fix the ps3stor_setup() function accordingly.
--- drivers/ps3/ps3stor_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ps3/ps3stor_lib.c +1 -1
@@ -189,7 +189,7 @@ int ps3stor_setup(struct ps3_storage_device *dev, irq_handler_t handler) dev->bounce_lpar =ps3_mm_phys_to_lpar (__pa (dev->bounce_buf)); dev->bounce_dma =dma_map_single (&dev->sbd.core, dev->bounce_buf, dev->bounce_size,DMA_BIDIRECTIONAL ); -if (!dev->bounce_dma) { +if (dma_mapping_error (&dev->sbd.core, dev->bounce_dma)) {dev_err (&dev->sbd.core,"%s:%u: map DMA region failed\n" , __func__, __LINE__); error = -ENODEV ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 444/717 perf test: Fix metric parsing test
In reply to Greg Kroah-HartmanFrom: Kajol Jain <[email protected]>
[ Upstream commit b2ce5dbc15819ea4bef47dbd368239cb1e965158 ]
Commit e1c92a7fbbc5 ("perf tests: Add another metric parsing test") add another test for metric parsing. The test goes through all metrics compiled for arch within pmu events and try to parse them.
Right now this test is failing in powerpc machine.
Result in power9 platform:
[command]# ./perf test 10
10: PMU events : 10.1: PMU event table sanity : Ok 10.2: PMU event map aliases : Ok 10.3: Parsing of PMU event table metrics : Skip (some metrics failed) 10.4: Parsing of PMU event table metrics with fake PMUs : FAILED!
Issue is we are passing different runtime parameter value in "expr__find_other" and "expr__parse" function which is called from function metric_parse_fake. And because of this parsing of hv-24x7 metrics is failing.
[command]# ./perf test 10 -vv
.....
hv_24x7/pm_mcs01_128b_rd_disp_port01,chip=1/ not found expr__parse failed
test child finished with -1
---- end ----
PMU events subtest 4: FAILED!
This patch fix this issue and change runtime parameter value to '0' in expr__parse function.
Result in power9 platform after this patch:
[command]# ./perf test 10
10: PMU events : 10.1: PMU event table sanity : Ok 10.2: PMU event map aliases : Ok 10.3: Parsing of PMU event table metrics : Skip (some metrics failed) 10.4: Parsing of PMU event table metrics with fake PMUs : Ok
--- tools/perf/tests/pmu-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/pmu-events.c +1 -1
@@ -561,7 +561,7 @@ static int metric_parse_fake(const char *str) } } -if (expr__parse (&result, &ctx, str,1 )) +if (expr__parse (&result, &ctx, str,0 ))pr_err ("expr__parse failed\n" );else ret =0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 445/717 drm/amdgpu: fix regression in vbios reservation handling on headless
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 7eded018bfeccb365963bb51be731a9f99aeea59 ]
We need to move the check under the non-headless case, otherwise we always reserve the VGA save size.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +5 -4
@@ -494,13 +494,14 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)break ; } -if (!amdgpu_device_ip_get_ip_block (adev,AMD_IP_BLOCK_TYPE_DCE )) +if (!amdgpu_device_ip_get_ip_block (adev,AMD_IP_BLOCK_TYPE_DCE )) { size =0 ; -else + }else { size =amdgpu_gmc_get_vbios_fb_size (adev); -if (adev->mman.keep_stolen_vga_memory) - size =max (size, (unsigned )AMDGPU_VBIOS_VGA_ALLOCATION ); +if (adev->mman.keep_stolen_vga_memory) + size =max (size, (unsigned )AMDGPU_VBIOS_VGA_ALLOCATION ); + }/* set to 0 if the pre-OS buffer uses up most of vram */ if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 ))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 446/717 mm/gup: reorganize internal_get_user_pages_fast()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit c28b1fc70390df32e29991eedd52bd86e7aba080 ]
Patch series "Add a seqcount between gup_fast and copy_page_range()", v4.
As discussed and suggested by Linus use a seqcount to close the small race between gup_fast and copy_page_range().
Ahmed confirms that raw_write_seqcount_begin() is the correct API to use in this case and it doesn't trigger any lockdeps.
I was able to test it using two threads, one forking and the other using ibv_reg_mr() to trigger GUP fast. Modifying copy_page_range() to sleep made the window large enough to reliably hit to test the logic.
This patch (of 2):
The next patch in this series makes the lockless flow a little more complex, so move the entire block into a new function and remove a level of indention. Tidy a bit of cruft:
- addr is always the same as start, so use start
- Use the modern check_add_overflow() for computing end = start + len
- nr_pinned/pages << PAGE_SHIFT needs the LHS to be unsigned long to avoid shift overflow, make the variables unsigned long to avoid coding casts in both places. nr_pinned was missing its cast
- The handling of ret and nr_pinned can be streamlined a bit
No functional change.
--- mm/gup.c | 99 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 45 deletions(-)
mm/gup.c +54 -45
@@ -2677,13 +2677,43 @@ static int __gup_longterm_unlocked(unsigned long start, int nr_pages,return ret; } -static int internal_get_user_pages_fast (unsigned long start,int nr_pages, +static unsigned long lockless_pages_from_mm (unsigned long start, +unsigned long end, +unsigned int gup_flags, +struct page **pages) +{ +unsigned long flags; +int nr_pinned =0 ; + +if (!IS_ENABLED (CONFIG_HAVE_FAST_GUP ) || + !gup_fast_permitted (start, end)) +return 0 ; + +/* +* Disable interrupts. The nested form is used, in order to allow full, +* general purpose use of this routine. +* +* With interrupts disabled, we block page table pages from being freed +* from under us. See struct mmu_table_batch comments in +* include/asm-generic/tlb.h for more details. +* +* We do not adopt an rcu_read_lock() here as we also want to block IPIs +* that come from THPs splitting. +*/ +local_irq_save (flags); +gup_pgd_range (start, end, gup_flags, pages, &nr_pinned); +local_irq_restore (flags); +return nr_pinned; +} + +static int internal_get_user_pages_fast (unsigned long start, +unsigned long nr_pages,unsigned int gup_flags,struct page **pages) { -unsigned long addr, len, end; -unsigned long flags; -int nr_pinned =0 , ret =0 ; +unsigned long len, end; +unsigned long nr_pinned; +int ret; if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM | FOLL_FORCE | FOLL_PIN | FOLL_GET |
@@ -2697,54 +2727,33 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,might_lock_read (¤t->mm->mmap_lock); start =untagged_addr (start) &PAGE_MASK ; - addr = start; - len = (unsigned long ) nr_pages <<PAGE_SHIFT ; - end = start + len; - -if (end <= start) + len = nr_pages <<PAGE_SHIFT ; +if (check_add_overflow (start, len, &end))return 0 ;if (unlikely (!access_ok ((void __user *)start, len)))return -EFAULT ; -/* -* Disable interrupts. The nested form is used, in order to allow -* full, general purpose use of this routine. -* -* With interrupts disabled, we block page table pages from being -* freed from under us. See struct mmu_table_batch comments in -* include/asm-generic/tlb.h for more details. -* -* We do not adopt an rcu_read_lock(.) here as we also want to -* block IPIs that come from THPs splitting. -*/ -if (IS_ENABLED (CONFIG_HAVE_FAST_GUP ) &&gup_fast_permitted (start, end)) { -unsigned long fast_flags = gup_flags; - -local_irq_save (flags); -gup_pgd_range (addr, end, fast_flags, pages, &nr_pinned); -local_irq_restore (flags); - ret = nr_pinned; - } - -if (nr_pinned < nr_pages && !(gup_flags &FOLL_FAST_ONLY )) { -/* Try to get the remaining pages with get_user_pages */ - start += nr_pinned <<PAGE_SHIFT ; - pages += nr_pinned; + nr_pinned =lockless_pages_from_mm (start, end, gup_flags, pages); +if (nr_pinned == nr_pages || gup_flags &FOLL_FAST_ONLY ) +return nr_pinned; - ret =__gup_longterm_unlocked (start, nr_pages - nr_pinned, - gup_flags, pages); - -/* Have to be a bit careful with return values */ -if (nr_pinned >0 ) { -if (ret <0 ) - ret = nr_pinned; -else - ret += nr_pinned; - } +/* Slow path: try to get the remaining pages with get_user_pages */ + start += nr_pinned <<PAGE_SHIFT ; + pages += nr_pinned; + ret =__gup_longterm_unlocked (start, nr_pages - nr_pinned, gup_flags, + pages); +if (ret <0 ) { +/* +* The caller has to unpin the pages we already pinned so +* returning -errno is not an option +*/ +if (nr_pinned) +return nr_pinned; +return ret; } - -return ret; +return ret + nr_pinned; } +/** * get_user_pages_fast_only() - pin user pages in memory * @start: starting user address
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 447/717 mm/gup: prevent gup_fast from racing with COW during fork
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 57efa1fe5957694fa541c9062de0a127f0b9acb0 ]
Since commit 70e806e4e645 ("mm: Do early cow for pinned pages during fork() for ptes") pages under a FOLL_PIN will not be write protected during COW for fork. This means that pages returned from pin_user_pages(FOLL_WRITE) should not become write protected while the pin is active.
However, there is a small race where get_user_pages_fast(FOLL_PIN) can establish a FOLL_PIN at the same time copy_present_page() is write protecting it:
CPU 0 CPU 1
get_user_pages_fast()
internal_get_user_pages_fast()
copy_page_range()
pte_alloc_map_lock()
copy_present_page()
atomic_read(has_pinned) == 0
page_maybe_dma_pinned() == false
atomic_set(has_pinned, 1);
gup_pgd_range()
gup_pte_range()
pte_t pte = gup_get_pte(ptep)
pte_access_permitted(pte)
try_grab_compound_head()
pte = pte_wrprotect(pte)
set_pte_at();
pte_unmap_unlock()
// GUP now returns with a write protected pageThe first attempt to resolve this by using the write protect caused problems (and was missing a barrrier), see commit f3c64eda3e50 ("mm: avoid early COW write protect games during fork()")
Instead wrap copy_p4d_range() with the write side of a seqcount and check the read side around gup_pgd_range(). If there is a collision then get_user_pages_fast() fails and falls back to slow GUP.
Slow GUP is safe against this race because copy_page_range() is only called while holding the exclusive side of the mmap_lock on the src mm_struct.
--- arch/x86/kernel/tboot.c | 1 + drivers/firmware/efi/efi.c | 1 + include/linux/mm_types.h | 8 ++++++++ kernel/fork.c | 1 + mm/gup.c | 18 ++++++++++++++++++ mm/init-mm.c | 1 + mm/memory.c | 13 ++++++++++++- 7 files changed, 42 insertions(+), 1 deletion(-)
arch/x86/kernel/tboot.c +1 -0
@@ -93,6 +93,7 @@ static struct mm_struct tboot_mm = { .pgd = swapper_pg_dir, .mm_users = ATOMIC_INIT(2), .mm_count = ATOMIC_INIT(1), + .write_protect_seq =SEQCNT_ZERO (tboot_mm.write_protect_seq),MMAP_LOCK_INITIALIZER (init_mm) .page_table_lock =__SPIN_LOCK_UNLOCKED (init_mm.page_table_lock), .mmlist = LIST_HEAD_INIT(init_mm.mmlist),
drivers/firmware/efi/efi.c +1 -0
@@ -57,6 +57,7 @@ struct mm_struct efi_mm = { .mm_rb = RB_ROOT, .mm_users = ATOMIC_INIT(2), .mm_count = ATOMIC_INIT(1), + .write_protect_seq =SEQCNT_ZERO (efi_mm.write_protect_seq),MMAP_LOCK_INITIALIZER (efi_mm) .page_table_lock =__SPIN_LOCK_UNLOCKED (efi_mm.page_table_lock), .mmlist = LIST_HEAD_INIT(efi_mm.mmlist),
include/linux/mm_types.h +8 -0
@@ -14,6 +14,7 @@#include <linux/uprobes.h> #include <linux/page-flags-layout.h> #include <linux/workqueue.h> +#include <linux/seqlock.h> #include <asm/mmu.h>
@@ -446,6 +447,13 @@ struct mm_struct {*/ atomic_t has_pinned; +/** +* @write_protect_seq: Locked when any thread is write +* protecting pages mapped by this mm to enforce a later COW, +* for instance during page table copying for fork(). +*/ +seqcount_t write_protect_seq; +#ifdef CONFIG_MMU atomic_long_t pgtables_bytes;/* PTE page table pages */ #endif
kernel/fork.c +1 -0
@@ -1007,6 +1007,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, mm->vmacache_seqnum =0 ;atomic_set (&mm->mm_users,1 );atomic_set (&mm->mm_count,1 ); +seqcount_init (&mm->write_protect_seq);mmap_init_lock (mm);INIT_LIST_HEAD (&mm->mmlist); mm->core_state =NULL ;
mm/gup.c +18 -0
@@ -2684,11 +2684,18 @@ static unsigned long lockless_pages_from_mm(unsigned long start, {unsigned long flags;int nr_pinned =0 ; +unsigned seq;if (!IS_ENABLED (CONFIG_HAVE_FAST_GUP ) || !gup_fast_permitted (start, end))return 0 ; +if (gup_flags &FOLL_PIN ) { + seq =raw_read_seqcount (¤t->mm->write_protect_seq); +if (seq &1 ) +return 0 ; + } +/* * Disable interrupts. The nested form is used, in order to allow full, * general purpose use of this routine.
@@ -2703,6 +2710,17 @@ static unsigned long lockless_pages_from_mm(unsigned long start,local_irq_save (flags);gup_pgd_range (start, end, gup_flags, pages, &nr_pinned);local_irq_restore (flags); + +/* +* When pinning pages for DMA there could be a concurrent write protect +* from fork() via copy_page_range(), in this case always fail fast GUP. +*/ +if (gup_flags &FOLL_PIN ) { +if (read_seqcount_retry (¤t->mm->write_protect_seq, seq)) { +unpin_user_pages (pages, nr_pinned); +return 0 ; + } + }return nr_pinned; }
mm/init-mm.c +1 -0
@@ -31,6 +31,7 @@ struct mm_struct init_mm = { .pgd = swapper_pg_dir, .mm_users = ATOMIC_INIT(2), .mm_count = ATOMIC_INIT(1), + .write_protect_seq =SEQCNT_ZERO (init_mm.write_protect_seq),MMAP_LOCK_INITIALIZER (init_mm) .page_table_lock =__SPIN_LOCK_UNLOCKED (init_mm.page_table_lock), .arg_lock = __SPIN_LOCK_UNLOCKED(init_mm.arg_lock),
mm/memory.c +12 -1
@@ -1171,6 +1171,15 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma)mmu_notifier_range_init (&range,MMU_NOTIFY_PROTECTION_PAGE ,0 , src_vma, src_mm, addr, end);mmu_notifier_invalidate_range_start (&range); +/* +* Disabling preemption is not needed for the write side, as +* the read side doesn't spin, but goes to the mmap_lock. +* +* Use the raw variant of the seqcount_t write API to avoid +* lockdep complaining about preemptibility. +*/ +mmap_assert_write_locked (src_mm); +raw_write_seqcount_begin (&src_mm->write_protect_seq); } ret =0 ;
@@ -1187,8 +1196,10 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma) } }while (dst_pgd++, src_pgd++, addr = next, addr != end); -if (is_cow) +if (is_cow) { +raw_write_seqcount_end (&src_mm->write_protect_seq);mmu_notifier_invalidate_range_end (&range); + }return ret; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 448/717 mm/gup: combine put_compound_head() and unpin_user_page()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 4509b42c38963f495b49aa50209c34337286ecbe ]
These functions accomplish the same thing but have different implementations.
unpin_user_page() has a bug where it calls mod_node_page_state() after calling put_page() which creates a risk that the page could have been hot-uplugged from the system.
Fix this by using put_compound_head() as the only implementation.
__unpin_devmap_managed_user_page() and related can be deleted as well in favour of the simpler, but slower, version in put_compound_head() that has an extra atomic page_ref_sub, but always calls put_page() which internally contains the special devmap code.
Move put_compound_head() to be directly after try_grab_compound_head() so people can find it in future.
--- mm/gup.c | 103 +++++++++++++------------------------------------------ 1 file changed, 23 insertions(+), 80 deletions(-)
mm/gup.c +23 -80
@@ -123,6 +123,28 @@ static __maybe_unused struct page *try_grab_compound_head(struct page *page,return NULL ; } +static void put_compound_head (struct page *page,int refs,unsigned int flags) +{ +if (flags &FOLL_PIN ) { +mod_node_page_state (page_pgdat (page),NR_FOLL_PIN_RELEASED , + refs); + +if (hpage_pincount_available (page)) +hpage_pincount_sub (page, refs); +else + refs *=GUP_PIN_COUNTING_BIAS ; + } + +VM_BUG_ON_PAGE (page_ref_count (page) < refs, page); +/* +* Calling put_page() for each ref is unnecessarily slow. Only the last +* ref needs a put_page(). +*/ +if (refs >1 ) +page_ref_sub (page, refs -1 ); +put_page (page); +} +/** * try_grab_page() - elevate a page's refcount by a flag-dependent amount *
@@ -177,41 +199,6 @@ bool __must_check try_grab_page(struct page *page, unsigned int flags)return true; } -#ifdef CONFIG_DEV_PAGEMAP_OPS -static bool __unpin_devmap_managed_user_page (struct page *page) -{ -int count, refs =1 ; - -if (!page_is_devmap_managed (page)) -return false; - -if (hpage_pincount_available (page)) -hpage_pincount_sub (page,1 ); -else - refs =GUP_PIN_COUNTING_BIAS ; - - count =page_ref_sub_return (page, refs); - -mod_node_page_state (page_pgdat (page),NR_FOLL_PIN_RELEASED ,1 ); -/* -* devmap page refcounts are 1-based, rather than 0-based: if -* refcount is 1, then the page is free and the refcount is -* stable because nobody holds a reference on the page. -*/ -if (count ==1 ) -free_devmap_managed_page (page); -else if (!count) -__put_page (page); - -return true; -} -#else -static bool __unpin_devmap_managed_user_page (struct page *page) -{ -return false; -} -#endif /* CONFIG_DEV_PAGEMAP_OPS */ -/** * unpin_user_page() - release a dma-pinned page * @page: pointer to page to be released
@@ -223,28 +210,7 @@ static bool __unpin_devmap_managed_user_page(struct page *page)*/ void unpin_user_page (struct page *page) { -int refs =1 ; - - page =compound_head (page); - -/* -* For devmap managed pages we need to catch refcount transition from -* GUP_PIN_COUNTING_BIAS to 1, when refcount reach one it means the -* page is free and we need to inform the device driver through -* callback. See include/linux/memremap.h and HMM for details. -*/ -if (__unpin_devmap_managed_user_page (page)) -return ; - -if (hpage_pincount_available (page)) -hpage_pincount_sub (page,1 ); -else - refs =GUP_PIN_COUNTING_BIAS ; - -if (page_ref_sub_and_test (page, refs)) -__put_page (page); - -mod_node_page_state (page_pgdat (page),NR_FOLL_PIN_RELEASED ,1 ); +put_compound_head (compound_head (page),1 ,FOLL_PIN ); }EXPORT_SYMBOL (unpin_user_page);
@@ -2062,29 +2028,6 @@ EXPORT_SYMBOL(get_user_pages_unlocked);* This code is based heavily on the PowerPC implementation by Nick Piggin. */ #ifdef CONFIG_HAVE_FAST_GUP - -static void put_compound_head (struct page *page,int refs,unsigned int flags) -{ -if (flags &FOLL_PIN ) { -mod_node_page_state (page_pgdat (page),NR_FOLL_PIN_RELEASED , - refs); - -if (hpage_pincount_available (page)) -hpage_pincount_sub (page, refs); -else - refs *=GUP_PIN_COUNTING_BIAS ; - } - -VM_BUG_ON_PAGE (page_ref_count (page) < refs, page); -/* -* Calling put_page() for each ref is unnecessarily slow. Only the last -* ref needs a put_page(). -*/ -if (refs >1 ) -page_ref_sub (page, refs -1 ); -put_page (page); -} -#ifdef CONFIG_GUP_GET_PTE_LOW_HIGH /*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 449/717 mm: memcg/slab: fix return of child memcg objcg for root memcg
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
[ Upstream commit 2f7659a314736b32b66273dbf91c19874a052fde ]
Consider the following memcg hierarchy.
root
/ \
A BIf we failed to get the reference on objcg of memcg A, the get_obj_cgroup_from_current can return the wrong objcg for the root memcg.
--- mm/memcontrol.c | 1 + 1 file changed, 1 insertion(+)
mm/memcontrol.c +1 -0
@@ -2987,6 +2987,7 @@ __always_inline struct obj_cgroup *get_obj_cgroup_from_current(void) objcg =rcu_dereference (memcg->objcg);if (objcg &&obj_cgroup_tryget (objcg))break ; + objcg =NULL ; }rcu_read_unlock ();
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 450/717 mm: memcg/slab: fix use after free in obj_cgroup_charge
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
[ Upstream commit eefbfa7fd678805b38a46293e78543f98f353d3e ]
The rcu_read_lock/unlock only can guarantee that the memcg will not be freed, but it cannot guarantee the success of css_get to memcg.
If the whole process of a cgroup offlining is completed between reading a objcg->memcg pointer and bumping the css reference on another CPU, and there are exactly 0 external references to this memory cgroup (how we get to the obj_cgroup_charge() then?), css_get() can change the ref counter from 0 back to 1.
--- mm/memcontrol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/memcontrol.c +3 -1
@@ -3247,8 +3247,10 @@ int obj_cgroup_charge(struct obj_cgroup *objcg, gfp_t gfp, size_t size)* independently later. */ rcu_read_lock (); +retry: memcg =obj_cgroup_memcg (objcg); -css_get (&memcg->css); +if (unlikely (!css_tryget (&memcg->css))) + goto retry;rcu_read_unlock (); nr_pages = size >>PAGE_SHIFT ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 451/717 mm/rmap: always do TTU_IGNORE_ACCESS
In reply to Greg Kroah-HartmanFrom: Shakeel Butt <[email protected]>
[ Upstream commit 013339df116c2ee0d796dd8bfb8f293a2030c063 ]
Since commit 369ea8242c0f ("mm/rmap: update to new mmu_notifier semantic v2"), the code to check the secondary MMU's page table access bit is broken for !(TTU_IGNORE_ACCESS) because the page is unmapped from the secondary MMU's page table before the check. More specifically for those secondary MMUs which unmap the memory in mmu_notifier_invalidate_range_start() like kvm.
However memory reclaim is the only user of !(TTU_IGNORE_ACCESS) or the absence of TTU_IGNORE_ACCESS and it explicitly performs the page table access check before trying to unmap the page. So, at worst the reclaim will miss accesses in a very short window if we remove page table access check in unmapping code.
There is an unintented consequence of !(TTU_IGNORE_ACCESS) for the memcg reclaim. From memcg reclaim the page_referenced() only account the accesses from the processes which are in the same memcg of the target page but the unmapping code is considering accesses from all the processes, so, decreasing the effectiveness of memcg reclaim.
The simplest solution is to always assume TTU_IGNORE_ACCESS in unmapping code.
--- include/linux/rmap.h | 1 - mm/huge_memory.c | 2 +- mm/memory-failure.c | 2 +- mm/memory_hotplug.c | 2 +- mm/migrate.c | 8 +++----- mm/rmap.c | 9 --------- mm/vmscan.c | 14 +++++--------- 7 files changed, 11 insertions(+), 27 deletions(-)
include/linux/rmap.h +0 -1
@@ -91,7 +91,6 @@ enum ttu_flags {TTU_SPLIT_HUGE_PMD =0x4 ,/* split huge PMD if any */ TTU_IGNORE_MLOCK =0x8 ,/* ignore mlock */ -TTU_IGNORE_ACCESS =0x10 ,/* don't age */ TTU_IGNORE_HWPOISON =0x20 ,/* corrupted page is recoverable */ TTU_BATCH_FLUSH = 0x40, /* Batch TLB flushes where possible* and caller guarantees they will
mm/huge_memory.c +1 -1
@@ -2321,7 +2321,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma,static void unmap_page (struct page *page) { -enum ttu_flags ttu_flags =TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS | +enum ttu_flags ttu_flags =TTU_IGNORE_MLOCK |TTU_RMAP_LOCKED |TTU_SPLIT_HUGE_PMD ;bool unmap_success;
mm/memory-failure.c +1 -1
@@ -989,7 +989,7 @@ static int get_hwpoison_page(struct page *page)static bool hwpoison_user_mappings (struct page *p,unsigned long pfn,int flags,struct page **hpagep) { -enum ttu_flags ttu =TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS ; +enum ttu_flags ttu =TTU_IGNORE_MLOCK ;struct address_space *mapping;LIST_HEAD (tokill);bool unmap_success = true;
mm/memory_hotplug.c +1 -1
@@ -1304,7 +1304,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)if (WARN_ON (PageLRU (page)))isolate_lru_page (page);if (page_mapped (page)) -try_to_unmap (page,TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS ); +try_to_unmap (page,TTU_IGNORE_MLOCK );continue ; }
mm/migrate.c +3 -5
@@ -1122,8 +1122,7 @@ static int __unmap_and_move(struct page *page, struct page *newpage,/* Establish migration ptes */ VM_BUG_ON_PAGE (PageAnon (page) && !PageKsm (page) && !anon_vma, page); -try_to_unmap (page, -TTU_MIGRATION |TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS ); +try_to_unmap (page,TTU_MIGRATION |TTU_IGNORE_MLOCK ); page_was_mapped =1 ; }
@@ -1329,8 +1328,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,if (page_mapped (hpage)) {bool mapping_locked = false; -enum ttu_flags ttu =TTU_MIGRATION |TTU_IGNORE_MLOCK | -TTU_IGNORE_ACCESS ; +enum ttu_flags ttu =TTU_MIGRATION |TTU_IGNORE_MLOCK ;if (!PageAnon (hpage)) {/*
@@ -2688,7 +2686,7 @@ static void migrate_vma_prepare(struct migrate_vma *migrate)*/ static void migrate_vma_unmap (struct migrate_vma *migrate) { -int flags =TTU_MIGRATION |TTU_IGNORE_MLOCK |TTU_IGNORE_ACCESS ; +int flags =TTU_MIGRATION |TTU_IGNORE_MLOCK ;const unsigned long npages = migrate->npages;const unsigned long start = migrate->start;unsigned long addr, i, restore =0 ;
mm/rmap.c +0 -9
@@ -1533,15 +1533,6 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, goto discard; } -if (!(flags &TTU_IGNORE_ACCESS )) { -if (ptep_clear_flush_young_notify (vma, address, - pvmw.pte)) { - ret = false; -page_vma_mapped_walk_done (&pvmw); -break ; - } - } -/* Nuke the page table entry. */ flush_cache_page (vma, address,pte_pfn (*pvmw.pte));if (should_defer_flush (mm, flags)) {
mm/vmscan.c +5 -9
@@ -1072,7 +1072,6 @@ static void page_check_dirty_writeback(struct page *page,static unsigned int shrink_page_list (struct list_head *page_list,struct pglist_data *pgdat,struct scan_control *sc, -enum ttu_flags ttu_flags,struct reclaim_stat *stat,bool ignore_references) {
@@ -1297,7 +1296,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,* processes. Try to unmap it here. */ if (page_mapped (page)) { -enum ttu_flags flags = ttu_flags |TTU_BATCH_FLUSH ; +enum ttu_flags flags =TTU_BATCH_FLUSH ;bool was_swapbacked =PageSwapBacked (page);if (unlikely (PageTransHuge (page)))
@@ -1514,7 +1513,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone, } nr_reclaimed =shrink_page_list (&clean_pages, zone->zone_pgdat, &sc, -TTU_IGNORE_ACCESS , &stat, true); + &stat, true);list_splice (&clean_pages, page_list);mod_node_page_state (zone->zone_pgdat,NR_ISOLATED_FILE , -(long )nr_reclaimed);
@@ -1958,8 +1957,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,if (nr_taken ==0 )return 0 ; - nr_reclaimed =shrink_page_list (&page_list, pgdat, sc,0 , - &stat, false); + nr_reclaimed =shrink_page_list (&page_list, pgdat, sc, &stat, false);spin_lock_irq (&pgdat->lru_lock);
@@ -2131,8 +2129,7 @@ unsigned long reclaim_pages(struct list_head *page_list) nr_reclaimed +=shrink_page_list (&node_page_list,NODE_DATA (nid), - &sc,0 , - &dummy_stat, false); + &sc, &dummy_stat, false);while (!list_empty (&node_page_list)) { page =lru_to_page (&node_page_list);list_del (&page->lru);
@@ -2145,8 +2142,7 @@ unsigned long reclaim_pages(struct list_head *page_list)if (!list_empty (&node_page_list)) { nr_reclaimed +=shrink_page_list (&node_page_list,NODE_DATA (nid), - &sc,0 , - &dummy_stat, false); + &sc, &dummy_stat, false);while (!list_empty (&node_page_list)) { page =lru_to_page (&node_page_list);list_del (&page->lru);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 452/717 sparc: fix handling of page table constructor failure
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 06517c9a336f4c20f2064611bf4b1e7881a95fe1 ]
The page has just been allocated, so its refcount is 1. free_unref_page() is for use on pages which have a zero refcount. Use __free_page() like the other implementations of pte_alloc_one().
--- arch/sparc/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/mm/init_64.c +1 -1
@@ -2894,7 +2894,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)if (!page)return NULL ;if (!pgtable_pte_page_ctor (page)) { -free_unref_page (page); +__free_page (page);return NULL ; }return (pte_t *)page_address (page);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 453/717 mm/vmalloc: Fix unlock order in s_stop()
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit 0a7dd4e901b8a4ee040ba953900d1d7120b34ee5 ]
When multiple locks are acquired, they should be released in reverse order. For s_start() and s_stop() in mm/vmalloc.c, that is not the case.
s_start: mutex_lock(&vmap_purge_lock); spin_lock(&vmap_area_lock); s_stop : mutex_unlock(&vmap_purge_lock); spin_unlock(&vmap_area_lock);
This unlock sequence, though allowed, is not optimal. If a waiter is present, mutex_unlock() will need to go through the slowpath of waking up the waiter with preemption disabled. Fix that by releasing the spinlock first before the mutex.
--- mm/vmalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/vmalloc.c +2 -2
@@ -3448,11 +3448,11 @@ static void *s_next(struct seq_file *m, void *p, loff_t *pos) }static void s_stop (struct seq_file *m,void *p) - __releases(&vmap_purge_lock) __releases(&vmap_area_lock) + __releases(&vmap_purge_lock) { -mutex_unlock (&vmap_purge_lock);spin_unlock (&vmap_area_lock); +mutex_unlock (&vmap_purge_lock); }static void show_numa_info (struct seq_file *m,struct vm_struct *v)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 454/717 mm/vmalloc.c: fix kasan shadow poisoning size
In reply to Greg Kroah-HartmanFrom: Vincenzo Frascino <[email protected]>
[ Upstream commit c041098c690fe53cea5d20c62f128a4f7a5c19fe ]
The size of vm area can be affected by the presence or not of the guard page. In particular when VM_NO_GUARD is present, the actual accessible size has to be considered like the real size minus the guard page.
Currently kasan does not keep into account this information during the poison operation and in particular tries to poison the guard page as well.
This approach, even if incorrect, does not cause an issue because the tags for the guard page are written in the shadow memory. With the future introduction of the Tag-Based KASAN, being the guard page inaccessible by nature, the write tag operation on this page triggers a fault.
Fix kasan shadow poisoning size invoking get_vm_area_size() instead of accessing directly the field in the data structure to detect the correct value.
--- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmalloc.c +1 -1
@@ -2256,7 +2256,7 @@ static void __vunmap(const void *addr, int deallocate_pages)debug_check_no_locks_freed (area->addr,get_vm_area_size (area));debug_check_no_obj_freed (area->addr,get_vm_area_size (area)); -kasan_poison_vmalloc (area->addr, area->size); +kasan_poison_vmalloc (area->addr,get_vm_area_size (area));vm_remove_mappings (area, deallocate_pages);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 455/717 mm,memory_failure: always pin the page in madvise_inject_error
In reply to Greg Kroah-HartmanFrom: Oscar Salvador <[email protected]>
[ Upstream commit 1e8aaedb182d6ddffc894b832e4962629907b3e0 ]
madvise_inject_error() uses get_user_pages_fast to translate the address we specified to a page. After [1], we drop the extra reference count for memory_failure() path. That commit says that memory_failure wanted to keep the pin in order to take the page out of circulation.
The truth is that we need to keep the page pinned, otherwise the page might be re-used after the put_page() and we can end up messing with someone else's memory.
E.g:
CPU0
process X CPU1
madvise_inject_error
get_user_pages
put_page
page gets reclaimed process Y allocates the page
memory_failure
// We mess with process Y memory
madvise() is meant to operate on a self address space, so messing with pages that do not belong to us seems the wrong thing to do. To avoid that, let us keep the page pinned for memory_failure as well.
Pages for DAX mappings will release this extra refcount in memory_failure_dev_pagemap.
[1] ("23e7b5c2e271: mm, madvise_inject_error:
Let memory_failure() optionally take a page reference")
--- mm/madvise.c | 9 +-------- mm/memory-failure.c | 6 ++++++ 2 files changed, 7 insertions(+), 8 deletions(-)
mm/madvise.c +1 -8
@@ -908,14 +908,7 @@ static int madvise_inject_error(int behavior, }else {pr_info ("Injecting memory failure for pfn %#lx at process virtual address %#lx\n" , pfn, start); -/* -* Drop the page reference taken by get_user_pages_fast(). In -* the absence of MF_COUNT_INCREASED the memory_failure() -* routine is responsible for pinning the page to prevent it -* from being released back to the page allocator. -*/ -put_page (page); - ret =memory_failure (pfn,0 ); + ret =memory_failure (pfn,MF_COUNT_INCREASED ); }if (ret)
mm/memory-failure.c +6 -0
@@ -1231,6 +1231,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags,loff_t start;dax_entry_t cookie; +if (flags &MF_COUNT_INCREASED ) +/* +* Drop the extra refcount in case we come from madvise(). +*/ +put_page (page); +/* * Prevent the inode from being freed while we are interrogating * the address_space, typically this would be handled by
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 456/717 hugetlb: fix an error code in hugetlb_reserve_pages()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7fc2513aa237e2ce239ab54d7b04d1d79b317110 ]
Preserve the error code from region_add() instead of returning success.
--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)
mm/hugetlb.c +1 -0
@@ -5115,6 +5115,7 @@ int hugetlb_reserve_pages(struct inode *inode,if (unlikely (add <0 )) {hugetlb_acct_memory (h, -gbl_reserve); + ret = add; goto out_put_pages; }else if (unlikely (chg > add)) {/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 457/717 mm: dont wake kswapd prematurely when watermark boosting is disabled
In reply to Greg Kroah-HartmanFrom: Johannes Weiner <[email protected]>
[ Upstream commit 597c892038e08098b17ccfe65afd9677e6979800 ]
On 2-node NUMA hosts we see bursts of kswapd reclaim and subsequent pressure spikes and stalls from cache refaults while there is plenty of free memory in the system.
Usually, kswapd is woken up when all eligible nodes in an allocation are full. But the code related to watermark boosting can wake kswapd on one full node while the other one is mostly empty. This may be justified to fight fragmentation, but is currently unconditionally done whether watermark boosting is occurring or not.
In our case, many of our workloads' throughput scales with available memory, and pure utilization is a more tangible concern than trends around longer-term fragmentation. As a result we generally disable watermark boosting.
Wake kswapd only woken when watermark boosting is requested.
--- mm/page_alloc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
mm/page_alloc.c +7 -6
@@ -2470,12 +2470,12 @@ static bool can_steal_fallback(unsigned int order, int start_mt)return false; } -static inline void boost_watermark (struct zone *zone) +static inline bool boost_watermark (struct zone *zone) {unsigned long max_boost;if (!watermark_boost_factor) -return ; +return false;/* * Don't bother in zones that are unlikely to produce results. * On small machines, including kdump capture kernels running
@@ -2483,7 +2483,7 @@ static inline void boost_watermark(struct zone *zone)* memory situation immediately. */ if ((pageblock_nr_pages *4 ) >zone_managed_pages (zone)) -return ; +return false; max_boost =mult_frac (zone->_watermark[WMARK_HIGH ], watermark_boost_factor,10000 );
@@ -2497,12 +2497,14 @@ static inline void boost_watermark(struct zone *zone)* boosted watermark resulting in a hang. */ if (!max_boost) -return ; +return false; max_boost =max (pageblock_nr_pages, max_boost); zone->watermark_boost =min (zone->watermark_boost + pageblock_nr_pages, max_boost); + +return true; }/*
@@ -2540,8 +2542,7 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page,* likelihood of future fallbacks. Wake kswapd now as the node * may be balanced overall and kswapd will not wake naturally. */ -boost_watermark (zone); -if (alloc_flags &ALLOC_KSWAPD ) +if (boost_watermark (zone) && (alloc_flags &ALLOC_KSWAPD ))set_bit (ZONE_BOOSTED_WATERMARK , &zone->flags);/* We are not allowed to try stealing from the whole block */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 458/717 proc: fix lookup in /proc/net subdirectories after setns(2)
In reply to Greg Kroah-HartmanFrom: Alexey Dobriyan <[email protected]>
[ Upstream commit c6c75deda81344c3a95d1d1f606d5cee109e5d54 ]
Commit 1fde6f21d90f ("proc: fix /proc/net/* after setns(2)") only forced revalidation of regular files under /proc/net/
However, /proc/net/ is unusual in the sense of /proc/net/foo handlers take netns pointer from parent directory which is old netns.
Steps to reproduce:
(void)open("/proc/net/sctp/snmp", O_RDONLY);
unshare(CLONE_NEWNET);
int fd = open("/proc/net/sctp/snmp", O_RDONLY);
read(fd, &c, 1);Read will read wrong data from original netns.
Patch forces lookup on every directory under /proc/net .
--- fs/proc/generic.c | 24 ++++++++++++++++++++++-- fs/proc/internal.h | 7 +++++++ fs/proc/proc_net.c | 16 ---------------- include/linux/proc_fs.h | 8 +++++++- 4 files changed, 36 insertions(+), 19 deletions(-)
fs/proc/generic.c +22 -2
@@ -349,6 +349,16 @@ static const struct file_operations proc_dir_operations = { .iterate_shared = proc_readdir, }; +static int proc_net_d_revalidate (struct dentry *dentry,unsigned int flags) +{ +return 0 ; +} + +const struct dentry_operations proc_net_dentry_ops = { + .d_revalidate = proc_net_d_revalidate, + .d_delete = always_delete_dentry, +}; +/* * proc directories can do almost nothing.. */
@@ -471,8 +481,8 @@ struct proc_dir_entry *proc_symlink(const char *name, }EXPORT_SYMBOL (proc_symlink); -struct proc_dir_entry *proc_mkdir_data (const char *name,umode_t mode, -struct proc_dir_entry *parent,void *data) +struct proc_dir_entry *_proc_mkdir (const char *name,umode_t mode, +struct proc_dir_entry *parent,void *data,bool force_lookup) {struct proc_dir_entry *ent;
@@ -484,10 +494,20 @@ struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, ent->data = data; ent->proc_dir_ops = &proc_dir_operations; ent->proc_iops = &proc_dir_inode_operations; +if (force_lookup) { +pde_force_lookup (ent); + } ent =proc_register (parent, ent); }return ent; } +EXPORT_SYMBOL_GPL (_proc_mkdir); + +struct proc_dir_entry *proc_mkdir_data (const char *name,umode_t mode, +struct proc_dir_entry *parent,void *data) +{ +return _proc_mkdir (name, mode, parent, data, false); +}EXPORT_SYMBOL_GPL (proc_mkdir_data); struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
fs/proc/internal.h +7 -0
@@ -310,3 +310,10 @@ extern unsigned long task_statm(struct mm_struct *, unsigned long *, unsigned long *, unsigned long *, unsigned long *);extern void task_mem (struct seq_file *,struct mm_struct *); + +extern const struct dentry_operations proc_net_dentry_ops; +static inline void pde_force_lookup (struct proc_dir_entry *pde) +{ +/* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */ + pde->proc_dops = &proc_net_dentry_ops; +}
fs/proc/proc_net.c +0 -16
@@ -39,22 +39,6 @@ static struct net *get_proc_net(const struct inode *inode)return maybe_get_net (PDE_NET (PDE (inode))); } -static int proc_net_d_revalidate (struct dentry *dentry,unsigned int flags) -{ -return 0 ; -} - -static const struct dentry_operations proc_net_dentry_ops = { - .d_revalidate = proc_net_d_revalidate, - .d_delete = always_delete_dentry, -}; - -static void pde_force_lookup (struct proc_dir_entry *pde) -{ -/* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */ - pde->proc_dops = &proc_net_dentry_ops; -} -static int seq_open_net (struct inode *inode,struct file *file) {unsigned int state_size =PDE (inode)->state_size;
include/linux/proc_fs.h +7 -1
@@ -80,6 +80,7 @@ extern void proc_flush_pid(struct pid *);extern struct proc_dir_entry *proc_symlink (const char *,struct proc_dir_entry *,const char *); +struct proc_dir_entry *_proc_mkdir (const char *,umode_t ,struct proc_dir_entry *,void *,bool );extern struct proc_dir_entry *proc_mkdir (const char *,struct proc_dir_entry *);extern struct proc_dir_entry *proc_mkdir_data (const char *,umode_t ,struct proc_dir_entry *,void *);
@@ -162,6 +163,11 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,static inline struct proc_dir_entry *proc_mkdir (const char *name,struct proc_dir_entry *parent) {return NULL ;}static inline struct proc_dir_entry *proc_create_mount_point (const char *name) {return NULL ; } +static inline struct proc_dir_entry *_proc_mkdir (const char *name,umode_t mode, +struct proc_dir_entry *parent,void *data,bool force_lookup) +{ +return NULL ; +}static inline struct proc_dir_entry *proc_mkdir_data (const char *name,umode_t mode,struct proc_dir_entry *parent,void *data) {return NULL ; } static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
@@ -199,7 +205,7 @@ struct net;static inline struct proc_dir_entry *proc_net_mkdir (struct net *net,const char *name,struct proc_dir_entry *parent) { -return proc_mkdir_data (name,0 , parent, net); +return _proc_mkdir (name,0 , parent, net, true); }struct ns_common ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 459/717 checkpatch: fix unescaped left brace
In reply to Greg Kroah-HartmanFrom: Dwaipayan Ray <[email protected]>
[ Upstream commit 03f4935135b9efeb780b970ba023c201f81cf4e6 ]
There is an unescaped left brace in a regex in OPEN_BRACE check. This throws a runtime error when checkpatch is run with --fix flag and the OPEN_BRACE check is executed.
Fix it by escaping the left brace.
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -4384,7 +4384,7 @@ sub process { $fix) { fix_delete_line($fixlinenr, $rawline); my $fixed_line = $rawline; - $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/; + $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/; my $line1 = $1; my $line2 = $2; fix_insert_line($fixlinenr, ltrim($line1));
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 460/717 s390/test_unwind: fix CALL_ON_STACK tests
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit f22b9c219a798e1bf11110a3d2733d883e6da059 ]
The CALL_ON_STACK tests use the no_dat stack to switch to a different stack for unwinding tests. If an interrupt or machine check happens while using that stack, and previously being on the async stack, the interrupt / machine check entry code (SWITCH_ASYNC) will assume that the previous context did not use the async stack and happily use the async stack again.
This will lead to stack corruption of the previous context.
To solve this disable both interrupts and machine checks before switching to the no_dat stack.
--- arch/s390/lib/test_unwind.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/s390/lib/test_unwind.c +5 -2
@@ -205,12 +205,15 @@ static noinline int unwindme_func3(struct unwindme *u)/* This function must appear in the backtrace. */ static noinline int unwindme_func2(struct unwindme *u) { +unsigned long flags;int rc;if (u->flags &UWM_SWITCH_STACK ) { -preempt_disable (); +local_irq_save (flags); +local_mcck_disable (); rc =CALL_ON_STACK (unwindme_func3, S390_lowcore.nodat_stack,1 , u); -preempt_enable (); +local_mcck_enable (); +local_irq_restore (flags);return rc; }else {return unwindme_func3 (u);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 461/717 lan743x: fix rx_napi_poll/interrupt ping-pong
In reply to Greg Kroah-HartmanFrom: Sven Van Asbroeck <[email protected]>
[ Upstream commit 57030a0b620f735bf557696e5ceb9f32c2b3bb8f ]
Even if there is more rx data waiting on the chip, the rx napi poll fn will never run more than once - it will always read a few buffers, then bail out and re-arm interrupts. Which results in ping-pong between napi and interrupt.
This defeats the purpose of napi, and is bad for performance.
Fix by making the rx napi poll behave identically to other ethernet drivers:
1. initialize rx napi polling with an arbitrary budget (64).
2. in the polling fn, return full weight if rx queue is not depleted, this tells the napi core to "keep polling".
3. update the rx tail ("ring the doorbell") once for every 8 processed rx ring buffers.
Thanks to Jakub Kicinski, Eric Dumazet and Andrew Lunn for their expert opinions and suggestions.
Tested with 20 seconds of full bandwidth receive (iperf3):
rx irqs softirqs(NET_RX)
-----------------------------
before 23827 33620 after 129 4081
--- drivers/net/ethernet/microchip/lan743x_main.c | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-)
drivers/net/ethernet/microchip/lan743x_main.c +23 -20
@@ -1962,6 +1962,14 @@ static struct sk_buff *lan743x_rx_allocate_skb(struct lan743x_rx *rx) length, GFP_ATOMIC | GFP_DMA); } +static void lan743x_rx_update_tail (struct lan743x_rx *rx,int index) +{ +/* update the tail once per 8 descriptors */ +if ((index &7 ) ==7 ) +lan743x_csr_write (rx->adapter,RX_TAIL (rx->channel_number), + index); +} +static int lan743x_rx_init_ring_element (struct lan743x_rx *rx,int index,struct sk_buff *skb) {
@@ -1992,6 +2000,7 @@ static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index, descriptor->data0 = (RX_DESC_DATA0_OWN_ | (length &RX_DESC_DATA0_BUF_LENGTH_MASK_ ));skb_reserve (buffer_info->skb,RX_HEAD_PADDING ); +lan743x_rx_update_tail (rx, index);return 0 ; }
@@ -2010,6 +2019,7 @@ static void lan743x_rx_reuse_ring_element(struct lan743x_rx *rx, int index) descriptor->data0 = (RX_DESC_DATA0_OWN_ | ((buffer_info->buffer_length) &RX_DESC_DATA0_BUF_LENGTH_MASK_ )); +lan743x_rx_update_tail (rx, index); }static void lan743x_rx_release_ring_element (struct lan743x_rx *rx,int index)
@@ -2220,6 +2230,7 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) { struct lan743x_rx *rx = container_of(napi, struct lan743x_rx, napi);struct lan743x_adapter *adapter = rx->adapter; +int result =RX_PROCESS_RESULT_NOTHING_TO_DO ;u32 rx_tail_flags =0 ;int count;
@@ -2228,27 +2239,19 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight)lan743x_csr_write (adapter,DMAC_INT_STS ,DMAC_INT_BIT_RXFRM_ (rx->channel_number)); } - count =0 ; -while (count < weight) { -int rx_process_result =lan743x_rx_process_packet (rx); - -if (rx_process_result ==RX_PROCESS_RESULT_PACKET_RECEIVED ) { - count++; - }else if (rx_process_result == -RX_PROCESS_RESULT_NOTHING_TO_DO ) { +for (count =0 ; count < weight; count++) { + result =lan743x_rx_process_packet (rx); +if (result ==RX_PROCESS_RESULT_NOTHING_TO_DO )break ; - }else if (rx_process_result == -RX_PROCESS_RESULT_PACKET_DROPPED ) { -continue ; - } } rx->frame_count += count; -if (count == weight) - goto done; +if (count == weight || result ==RX_PROCESS_RESULT_PACKET_RECEIVED ) +return weight;if (!napi_complete_done (napi, count)) - goto done; +return count; +/* re-arm interrupts, must write to rx tail on some chip variants */ if (rx->vector_flags &LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_SET ) rx_tail_flags |=RX_TAIL_SET_TOP_INT_VEC_EN_ ;if (rx->vector_flags &LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_SET ) {
@@ -2258,10 +2261,10 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) INT_BIT_DMA_RX_(rx->channel_number)); } -/* update RX_TAIL */ -lan743x_csr_write (adapter,RX_TAIL (rx->channel_number), - rx_tail_flags | rx->last_tail); -done: +if (rx_tail_flags) +lan743x_csr_write (adapter,RX_TAIL (rx->channel_number), + rx_tail_flags | rx->last_tail); +return count; }
@@ -2405,7 +2408,7 @@ static int lan743x_rx_open(struct lan743x_rx *rx)netif_napi_add (adapter->netdev, &rx->napi, lan743x_rx_napi_poll, - rx->ring_size -1 ); +NAPI_POLL_WEIGHT );lan743x_csr_write (adapter,DMAC_CMD ,DMAC_CMD_RX_SWR_ (rx->channel_number));
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 462/717 ice, xsk: clear the status bits for the next_to_use descriptor
In reply to Greg Kroah-HartmanFrom: Björn Töpel <[email protected]>
[ Upstream commit 8d14768a7972b92c73259f0c9c45b969d85e3a60 ]
On the Rx side, the next_to_use index points to the next item in the HW ring to be refilled/allocated, and next_to_clean points to the next item to potentially be processed.
When the HW Rx ring is fully refilled, i.e. no packets has been processed, the next_to_use will be next_to_clean - 1. When the ring is fully processed next_to_clean will be equal to next_to_use. The latter case is where a bug is triggered.
If the next_to_use bits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.
The skb-path correctly clear the status bit for the next_to_use descriptor, but the AF_XDP zero-copy path did not do that.
This change adds the status bits clearing of the next_to_use descriptor.
--- drivers/net/ethernet/intel/ice/ice_xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_xsk.c +4 -1
@@ -446,8 +446,11 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) } }while (--count); -if (rx_ring->next_to_use != ntu) +if (rx_ring->next_to_use != ntu) { +/* clear the status bits for the next_to_use descriptor */ + rx_desc->wb.status_error0 =0 ;ice_release_rx_desc (rx_ring, ntu); + }return ret; }
Signature · 1 line
2.27.0
Re: [PATCH 5.10 462/717] ice, xsk: clear the status bits for the next_to_use descriptor
Quoted 19 lines · On Mon, 28 Dec 2020 13:47:40 +0100 Greg Kroah-Hartman wrote:
From: Björn Töpel <[email protected]>
[ Upstream commit
8d14768a7972b92c73259f0c9c45b969d85e3a60]On the Rx side, the
next_to_useindex points to the next item in the HW ring to be refilled/allocated, andnext_to_cleanpoints to the next item to potentially be processed.When the HW Rx ring is fully refilled, i.e. no packets has been processed, the
next_to_usewill benext_to_clean- 1. When the ring is fully processednext_to_cleanwill be equal tonext_to_use. The latter case is where a bug is triggered.If the
next_to_usebits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.The skb-path correctly clear the status bit for the
next_to_usedescriptor, but theAF_XDPzero-copy path did not do that.
Quoted 7 lines
This change adds the status bits clearing of the
next_to_usedescriptor.Fixes 2d4238f55697 ("ice: Add support for AF_XDP")Signed-off-by Björn Töpel <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Oh wow, so much for Sasha waiting longer for code to get tested before auto-pulling things into stable :/
I have this change and other changes here queued, but haven't sent the submission yet.
How long is the auto-backporting delay in terms of calendar days?
Sasha Levin
maintainerRe: [PATCH 5.10 462/717] ice, xsk: clear the status bits for the next_to_use descriptor
Quoted 23 lines · Jakub Kicinski
Quoted 22 lines · On Mon, 28 Dec 2020 13:47:40 +0100 Greg Kroah-Hartman wrote:
From: Björn Töpel <[email protected]>
[ Upstream commit
8d14768a7972b92c73259f0c9c45b969d85e3a60]On the Rx side, the
next_to_useindex points to the next item in the HW ring to be refilled/allocated, andnext_to_cleanpoints to the next item to potentially be processed.When the HW Rx ring is fully refilled, i.e. no packets has been processed, the
next_to_usewill benext_to_clean- 1. When the ring is fully processednext_to_cleanwill be equal tonext_to_use. The latter case is where a bug is triggered.If the
next_to_usebits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.The skb-path correctly clear the status bit for the
next_to_usedescriptor, but theAF_XDPzero-copy path did not do that.This change adds the status bits clearing of the
next_to_usedescriptor.
Quoted 7 lines
Quoted 4 lines
Fixes 2d4238f55697 ("ice: Add support for AF_XDP")Signed-off-by Björn Töpel <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>Oh wow, so much for Sasha waiting longer for code to get tested before auto-pulling things into stable :/
The timeline is usually for a commit to appear in a release, and it did. Was it too early?
Quoted 2 lines
I have this change and other changes here queued, but haven't sent the submission yet.
What do you mean with "queued"? Its in Linus's tree for about two weeks now.
Quoted 1 line
How long is the auto-backporting delay in terms of calendar days?
The autosel stuff is about 2-3(-4) weeks at this point, stuff with a fixes tag gets picked up in about 2 weeks.
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 5.10 462/717] ice, xsk: clear the status bits for the next_to_use descriptor
Quoted 29 lines · On Mon, 28 Dec 2020 17:29:07 -0500 Sasha Levin wrote:
Quoted 28 lines · Jakub Kicinski
Quoted 26 lines · On Mon, 28 Dec 2020 13:47:40 +0100 Greg Kroah-Hartman wrote:
From: Björn Töpel <[email protected]>
[ Upstream commit
8d14768a7972b92c73259f0c9c45b969d85e3a60]On the Rx side, the
next_to_useindex points to the next item in the HW ring to be refilled/allocated, andnext_to_cleanpoints to the next item to potentially be processed.When the HW Rx ring is fully refilled, i.e. no packets has been processed, the
next_to_usewill benext_to_clean- 1. When the ring is fully processednext_to_cleanwill be equal tonext_to_use. The latter case is where a bug is triggered.If the
next_to_usebits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.The skb-path correctly clear the status bit for the
next_to_usedescriptor, but theAF_XDPzero-copy path did not do that.This change adds the status bits clearing of the
next_to_usedescriptor.Fixes 2d4238f55697 ("ice: Add support for AF_XDP")Signed-off-by Björn Töpel <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 5 lines
Quoted 2 lines
Oh wow, so much for Sasha waiting longer for code to get tested before auto-pulling things into stable :/
The timeline is usually for a commit to appear in a release, and it did. Was it too early?
Hm, I'm not sure of exact semantics but I meant a final release, not an -rc.
Plus I thought the point of things being part of a release is that people actually get a chance to test that release. -rc1 was cut 24 hours ago. I guess a "release" is used as a yardstick here, to measure time, not for practical reasons?
Quoted 5 lines
Quoted 2 lines
I have this change and other changes here queued, but haven't sent the submission yet.
What do you mean with "queued"? Its in Linus's tree for about two weeks now.
Networking maintainers have their own queue for patches that will go to stable:
https://patchwork.kernel.org/bundle/netdev/stable/?state=*
Quoted 4 lines
Quoted 1 line
How long is the auto-backporting delay in terms of calendar days?
The autosel stuff is about 2-3(-4) weeks at this point, stuff with a fixes tag gets picked up in about 2 weeks.
$ git show 8d14768a7972b92c73259f0c9c45b969d85e3a60 --format='%cD' --no-patch Wed, 16 Dec 2020 10:51:07 -0800 $ git show 8d14768a7972b92c73259f0c9c45b969d85e3a60 --format='%aD' --no-patch Fri, 11 Dec 2020 15:57:11 +0100
Two weeks from author date. That's a little short because.. I also delay things by up to two weeks :) so you'll grab patches which are sitting in networking stable queue.
And all networking fixes should have a Fixes tag, so that's no discriminator to be honest.
Sasha Levin
maintainerRe: [PATCH 5.10 462/717] ice, xsk: clear the status bits for the next_to_use descriptor
Quoted 36 lines · Jakub Kicinski
Quoted 29 lines · On Mon, 28 Dec 2020 17:29:07 -0500 Sasha Levin wrote:
Quoted 28 lines · Jakub Kicinski
Quoted 26 lines · On Mon, 28 Dec 2020 13:47:40 +0100 Greg Kroah-Hartman wrote:
From: Björn Töpel <[email protected]>
[ Upstream commit
8d14768a7972b92c73259f0c9c45b969d85e3a60]On the Rx side, the
next_to_useindex points to the next item in the HW ring to be refilled/allocated, andnext_to_cleanpoints to the next item to potentially be processed.When the HW Rx ring is fully refilled, i.e. no packets has been processed, the
next_to_usewill benext_to_clean- 1. When the ring is fully processednext_to_cleanwill be equal tonext_to_use. The latter case is where a bug is triggered.If the
next_to_usebits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.The skb-path correctly clear the status bit for the
next_to_usedescriptor, but theAF_XDPzero-copy path did not do that.This change adds the status bits clearing of the
next_to_usedescriptor.Fixes 2d4238f55697 ("ice: Add support for AF_XDP")Signed-off-by Björn Töpel <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 5 lines
Quoted 2 lines
Oh wow, so much for Sasha waiting longer for code to get tested before auto-pulling things into stable :/
The timeline is usually for a commit to appear in a release, and it did. Was it too early?
Quoted 7 lines
Hm, I'm not sure of exact semantics but I meant a final release, not an -rc.
Plus I thought the point of things being part of a release is that people actually get a chance to test that release. -rc1 was cut 24 hours ago. I guess a "release" is used as a yardstick here, to measure time, not for practical reasons?
Note that it wasn't actually released yet, at this point folks are supposed to be testing 5.10.4-rc1 to make sure that those patches are okay.
I still think that there are no significant users of Linus's tree, so the idea of having a patch "in a release" doesn't mean as much as folks think it does. Sure, we have a lot of folks who test -rc releases, but are you aware of anyone who runs -rc on real world workloads to test it?
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
I have this change and other changes here queued, but haven't sent the submission yet.
What do you mean with "queued"? Its in Linus's tree for about two weeks now.
Networking maintainers have their own queue for patches that will go to stable:
This part has always been tricky to me: some parts of net/ and drivers/net/ don't go through netdev, and some do. I have a filter to ignore net/ completely, but I found that quite a lot of drivers/net/ wasn't covered by this process.
How could I blacklist/ignore the parts of the tree you're looking at?
Also, is drivers/net/ stuff covered as well as net/? I found in the past that it's not the case when I was looking at missing patches for the hyper-v driver.
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 5.10 462/717] ice, xsk: clear the status bits for the next_to_use descriptor
Quoted 45 lines · On Mon, 28 Dec 2020 18:43:36 -0500 Sasha Levin wrote:
Quoted 36 lines · Jakub Kicinski
Quoted 29 lines · On Mon, 28 Dec 2020 17:29:07 -0500 Sasha Levin wrote:
Quoted 28 lines · Jakub Kicinski
Quoted 26 lines · On Mon, 28 Dec 2020 13:47:40 +0100 Greg Kroah-Hartman wrote:
From: Björn Töpel <[email protected]>
[ Upstream commit
8d14768a7972b92c73259f0c9c45b969d85e3a60]On the Rx side, the
next_to_useindex points to the next item in the HW ring to be refilled/allocated, andnext_to_cleanpoints to the next item to potentially be processed.When the HW Rx ring is fully refilled, i.e. no packets has been processed, the
next_to_usewill benext_to_clean- 1. When the ring is fully processednext_to_cleanwill be equal tonext_to_use. The latter case is where a bug is triggered.If the
next_to_usebits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.The skb-path correctly clear the status bit for the
next_to_usedescriptor, but theAF_XDPzero-copy path did not do that.This change adds the status bits clearing of the
next_to_usedescriptor.Fixes 2d4238f55697 ("ice: Add support for AF_XDP")Signed-off-by Björn Töpel <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 5 lines
Quoted 2 lines
Oh wow, so much for Sasha waiting longer for code to get tested before auto-pulling things into stable :/
The timeline is usually for a commit to appear in a release, and it did. Was it too early?
Quoted 7 lines
Hm, I'm not sure of exact semantics but I meant a final release, not an -rc.
Plus I thought the point of things being part of a release is that people actually get a chance to test that release. -rc1 was cut 24 hours ago. I guess a "release" is used as a yardstick here, to measure time, not for practical reasons?
Quoted 8 lines
Note that it wasn't actually released yet, at this point folks are supposed to be testing 5.10.4-rc1 to make sure that those patches are okay.
I still think that there are no significant users of Linus's tree, so the idea of having a patch "in a release" doesn't mean as much as folks think it does. Sure, we have a lot of folks who test -rc releases, but are you aware of anyone who runs -rc on real world workloads to test it?
Ack, I'm not disagreeing. From my limited information/experience testing seems to happen mostly in the -next trees (be it linux-next or more likely net-next for networking) and in production releases (either final produced by Linus or when patch hits some stable tree).
I'd actually be on board of removing this "must be in Linus's tag" requirement. I don't see why anyone would test rcX instead of just pulling latest linux/master.
Quoted 16 lines
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
I have this change and other changes here queued, but haven't sent the submission yet.
What do you mean with "queued"? Its in Linus's tree for about two weeks now.
Networking maintainers have their own queue for patches that will go to stable:
This part has always been tricky to me: some parts of
net/anddrivers/net/don't go through netdev, and some do. I have a filter to ignorenet/completely, but I found that quite a lot ofdrivers/net/wasn't covered by this process.
Quoted 5 lines
How could I blacklist/ignore the parts of the tree you're looking at?
Also, is
drivers/net/stuff covered as well asnet/? I found in the past that it's not the case when I was looking at missing patches for the hyper-v driver.
Yeah, it's tricky, I've produced some criteria for build testing things which hit the mailing list:
https://github.com/kuba-moo/nipa/blob/master/netdev/tree_match.py#L47
But it's far from 100% accurate. I think your best shot would be to filter by committer? :S The special rules only apply to patches which went directly into net or net-next so committed by DaveM (or myself).
Greg Kroah-Hartman
maintainerPATCH 463/717 i40e, xsk: clear the status bits for the next_to_use descriptor
In reply to Greg Kroah-HartmanFrom: Björn Töpel <[email protected]>
[ Upstream commit 64050b5b8706d304ba647591b06e1eddc55e8bd9 ]
On the Rx side, the next_to_use index points to the next item in the HW ring to be refilled/allocated, and next_to_clean points to the next item to potentially be processed.
When the HW Rx ring is fully refilled, i.e. no packets has been processed, the next_to_use will be next_to_clean - 1. When the ring is fully processed next_to_clean will be equal to next_to_use. The latter case is where a bug is triggered.
If the next_to_use bits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed.
The skb-path correctly clear the status bit for the next_to_use descriptor, but the AF_XDP zero-copy path did not do that.
This change adds the status bits clearing of the next_to_use descriptor.
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +4 -1
@@ -219,8 +219,11 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count) }while (count); no_buffers: -if (rx_ring->next_to_use != ntu) +if (rx_ring->next_to_use != ntu) { +/* clear the status bits for the next_to_use descriptor */ + rx_desc->wb.qword1.status_error_len =0 ;i40e_release_rx_desc (rx_ring, ntu); + }return ok; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 464/717 net: dsa: qca: ar9331: fix sleeping function called from invalid context bug
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
[ Upstream commit 3e47495fc4de4122598dd51ae8527b09b8209646 ]
With lockdep enabled, we will get following warning:
ar9331_switch ethernet.1:10 lan0 (uninitialized): PHY [!ahb!ethernet@1a000000!mdio!switch@10:00] driver [Qualcomm Atheros AR9331 built-in PHY] (irq=13)
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 18, name: kworker/0:1
INFO: lockdep is turned off.
irq event stamp: 602
hardirqs last enabled at (601): [<8073fde0>] _raw_spin_unlock_irq+0x3c/0x80
hardirqs last disabled at (602): [<8073a4f4>] __schedule+0x184/0x800
softirqs last enabled at (0): [<80080f60>] copy_process+0x578/0x14c8
softirqs last disabled at (0): [<00000000>] 0x0
CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 5.10.0-rc3-ar9331-00734-g7d644991df0c #31
Workqueue: events deferred_probe_work_func
Stack : 80980000 80980000 8089ef70 80890000 804b5414 80980000 00000002 80b53728
00000000 800d1268 804b5414 ffffffde 00000017 800afe08 81943860 0f5bfc32
00000000 00000000 8089ef70 819436c0 ffffffea 00000000 00000000 00000000
8194390c 808e353c 0000000f 66657272 80980000 00000000 00000000 80890000
804b5414 80980000 00000002 80b53728 00000000 00000000 00000000 80d40000
...
Call Trace:
[<80069ce0>] show_stack+0x9c/0x140
[<800afe08>] ___might_sleep+0x220/0x244
[<8073bfb0>] __mutex_lock+0x70/0x374
[<8073c2e0>] mutex_lock_nested+0x2c/0x38
[<804b5414>] regmap_update_bits_base+0x38/0x8c
[<804ee584>] regmap_update_bits+0x1c/0x28
[<804ee714>] ar9331_sw_unmask_irq+0x34/0x60
[<800d91f0>] unmask_irq+0x48/0x70
[<800d93d4>] irq_startup+0x114/0x11c
[<800d65b4>] __setup_irq+0x4f4/0x6d0
[<800d68a0>] request_threaded_irq+0x110/0x190
[<804e3ef0>] phy_request_interrupt+0x4c/0xe4
[<804df508>] phylink_bringup_phy+0x2c0/0x37c
[<804df7bc>] phylink_of_phy_connect+0x118/0x130
[<806c1a64>] dsa_slave_create+0x3d0/0x578
[<806bc4ec>] dsa_register_switch+0x934/0xa20
[<804eef98>] ar9331_sw_probe+0x34c/0x364
[<804eb48c>] mdio_probe+0x44/0x70
[<8049e3b4>] really_probe+0x30c/0x4f4
[<8049ea10>] driver_probe_device+0x264/0x26c
[<8049bc10>] bus_for_each_drv+0xb4/0xd8
[<8049e684>] __device_attach+0xe8/0x18c
[<8049ce58>] bus_probe_device+0x48/0xc4
[<8049db70>] deferred_probe_work_func+0xdc/0xf8
[<8009ff64>] process_one_work+0x2e4/0x4a0
[<800a0770>] worker_thread+0x2a8/0x354
[<800a774c>] kthread+0x16c/0x174
[<8006306c>] ret_from_kernel_thread+0x14/0x1c ar9331_switch ethernet.1:10 lan1 (uninitialized): PHY [!ahb!ethernet@1a000000!mdio!switch@10:02] driver [Qualcomm Atheros AR9331 built-in PHY] (irq=13)
DSA: tree 0 setup
To fix it, it is better to move access to MDIO register to the .irq_bus_sync_unlock call back.
--- drivers/net/dsa/qca/ar9331.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
drivers/net/dsa/qca/ar9331.c +24 -9
@@ -159,6 +159,8 @@ struct ar9331_sw_priv {struct dsa_switch ds;struct dsa_switch_ops ops;struct irq_domain *irqdomain; +u32 irq_mask; +struct mutex lock_irq;struct mii_bus *mbus;/* mdio master */ struct mii_bus *sbus;/* mdio slave */ struct regmap *regmap;
@@ -520,32 +522,44 @@ static irqreturn_t ar9331_sw_irq(int irq, void *data)static void ar9331_sw_mask_irq (struct irq_data *d) {struct ar9331_sw_priv *priv =irq_data_get_irq_chip_data (d); -struct regmap *regmap = priv->regmap; -int ret; - ret =regmap_update_bits (regmap,AR9331_SW_REG_GINT_MASK , -AR9331_SW_GINT_PHY_INT ,0 ); -if (ret) -dev_err (priv->dev,"could not mask IRQ\n" ); + priv->irq_mask =0 ; }static void ar9331_sw_unmask_irq (struct irq_data *d) +{ +struct ar9331_sw_priv *priv =irq_data_get_irq_chip_data (d); + + priv->irq_mask =AR9331_SW_GINT_PHY_INT ; +} + +static void ar9331_sw_irq_bus_lock (struct irq_data *d) +{ +struct ar9331_sw_priv *priv =irq_data_get_irq_chip_data (d); + +mutex_lock (&priv->lock_irq); +} + +static void ar9331_sw_irq_bus_sync_unlock (struct irq_data *d) {struct ar9331_sw_priv *priv =irq_data_get_irq_chip_data (d);struct regmap *regmap = priv->regmap;int ret; ret =regmap_update_bits (regmap,AR9331_SW_REG_GINT_MASK , -AR9331_SW_GINT_PHY_INT , -AR9331_SW_GINT_PHY_INT ); +AR9331_SW_GINT_PHY_INT , priv->irq_mask);if (ret) -dev_err (priv->dev,"could not unmask IRQ\n" ); +dev_err (priv->dev,"failed to change IRQ mask\n" ); + +mutex_unlock (&priv->lock_irq); }static struct irq_chip ar9331_sw_irq_chip = { .name =AR9331_SW_NAME , .irq_mask = ar9331_sw_mask_irq, .irq_unmask = ar9331_sw_unmask_irq, + .irq_bus_lock = ar9331_sw_irq_bus_lock, + .irq_bus_sync_unlock = ar9331_sw_irq_bus_sync_unlock, }; static int ar9331_sw_irq_map(struct irq_domain *domain, unsigned int irq,
@@ -584,6 +598,7 @@ static int ar9331_sw_irq_init(struct ar9331_sw_priv *priv)return irq ? irq : -EINVAL ; } +mutex_init (&priv->lock_irq); ret =devm_request_threaded_irq (dev, irq,NULL , ar9331_sw_irq,IRQF_ONESHOT ,AR9331_SW_NAME , priv);if (ret) {
Signature · 1 line
2.27.0