5.11.3-rc1 review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 297/775 ubifs: replay: Fix high stack usage, again
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 410b6de702ef84fea6e7abcb6620ef8bfc112fae ]
An earlier commit moved out some functions to not be inlined by gcc, but after some other rework to remove one of those, clang started inlining the other one and ran into the same problem as gcc did before:
fs/ubifs/replay.c:1174:5: error: stack frame size of 1152 bytes in function 'ubifs_replay_journal' [-Werror,-Wframe-larger-than=]
Mark the function as noinline_for_stack to ensure it doesn't happen again.
--- fs/ubifs/replay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ubifs/replay.c +3 -1
@@ -559,7 +559,9 @@ static int is_last_bud(struct ubifs_info *c, struct ubifs_bud *bud) }/* authenticate_sleb_hash is split out for stack usage */ -static int authenticate_sleb_hash (struct ubifs_info *c,struct shash_desc *log_hash,u8 *hash) +static int noinline_for_stack +authenticate_sleb_hash (struct ubifs_info *c, +struct shash_desc *log_hash,u8 *hash) {SHASH_DESC_ON_STACK (hash_desc, c->hash_tfm);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 298/775 ubifs: Fix error return code in alloc_wbufs()
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 42119dbe571eb419dae99b81dd20fa42f47464e1 ]
Fix to return PTR_ERR() error code from the error handling case instead fo 0 in function alloc_wbufs(), as done elsewhere in this function.
--- fs/ubifs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ubifs/super.c +3 -1
@@ -838,8 +838,10 @@ static int alloc_wbufs(struct ubifs_info *c) c->jheads[i].wbuf.jhead = i; c->jheads[i].grouped =1 ; c->jheads[i].log_hash =ubifs_hash_get_desc (c); -if (IS_ERR (c->jheads[i].log_hash)) +if (IS_ERR (c->jheads[i].log_hash)) { + err =PTR_ERR (c->jheads[i].log_hash); goto out; + } }/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 299/775 irqchip/imx: IMX_INTMUX should not default to y, unconditionally
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit a890caeb2ba40ca183969230e204ab144f258357 ]
Merely enabling CONFIG_COMPILE_TEST should not enable additional code. To fix this, restrict the automatic enabling of IMX_INTMUX to ARCH_MXC, and ask the user in case of compile-testing.
--- drivers/irqchip/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +2 -1
@@ -457,7 +457,8 @@ config IMX_IRQSTEER Support for the i.MX IRQSTEER interrupt multiplexer/remapper. config IMX_INTMUX - def_bool y if ARCH_MXC || COMPILE_TEST + bool "i.MX INTMUX support" if COMPILE_TEST + default y if ARCH_MXC select IRQ_DOMAIN help Support for the i.MX INTMUX interrupt multiplexer.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 300/775 smp: Process pending softirqs in flush_smp_call_function_from_idle()
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit f9d34595ae4feed38856b88769e2ba5af22d2548 ]
send_call_function_single_ipi() may wake an idle CPU without sending an IPI. The woken up CPU will process the SMP-functions in flush_smp_call_function_from_idle(). Any raised softirq from within the SMP-function call will not be processed.
Should the CPU have no tasks assigned, then it will go back to idle with pending softirqs and the NOHZ will rightfully complain.
Process pending softirqs on return from flush_smp_call_function_queue().
--- kernel/smp.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/smp.c +4 -0
@@ -14,6 +14,7 @@#include <linux/export.h> #include <linux/percpu.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/gfp.h> #include <linux/smp.h> #include <linux/cpu.h>
@@ -449,6 +450,9 @@ void flush_smp_call_function_from_idle(void)local_irq_save (flags);flush_smp_call_function_queue (true); +if (local_softirq_pending ()) +do_softirq (); +local_irq_restore (flags); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 301/775 drm/amdgpu/display: remove hdcp_srm sysfs on device removal
In reply to Greg Kroah-HartmanFrom: Nirmoy Das <[email protected]>
[ Upstream commit e96b1b2974989c6a25507b527843ede7594efc85 ]
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 3 ++- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -1131,7 +1131,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)#ifdef CONFIG_DRM_AMD_DC_HDCP if (adev->dm.hdcp_workqueue) { -hdcp_destroy (adev->dm.hdcp_workqueue); +hdcp_destroy (&adev->dev->kobj, adev->dm.hdcp_workqueue); adev->dm.hdcp_workqueue =NULL ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +2 -1
@@ -376,7 +376,7 @@ static void event_cpirq(struct work_struct *work) } -void hdcp_destroy (struct hdcp_workqueue *hdcp_work) +void hdcp_destroy (struct kobject *kobj,struct hdcp_workqueue *hdcp_work) {int i =0 ;
@@ -385,6 +385,7 @@ void hdcp_destroy(struct hdcp_workqueue *hdcp_work)cancel_delayed_work_sync (&hdcp_work[i].watchdog_timer_dwork); } +sysfs_remove_bin_file (kobj, &hdcp_work[0 ].attr);kfree (hdcp_work->srm);kfree (hdcp_work->srm_temp);kfree (hdcp_work);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.h +1 -1
@@ -69,7 +69,7 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work,void hdcp_reset_display (struct hdcp_workqueue *work,unsigned int link_index);void hdcp_handle_cpirq (struct hdcp_workqueue *work,unsigned int link_index); -void hdcp_destroy (struct hdcp_workqueue *work); +void hdcp_destroy (struct kobject *kobj,struct hdcp_workqueue *work);struct hdcp_workqueue *hdcp_create_workqueue (struct amdgpu_device *adev,struct cp_psp *cp_psp,struct dc *dc);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 302/775 Input: da7280 - fix missing error test
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 1e2020aa0da00051d94c4690c023c45d8f3834bd ]
An "if" testing for error condition has accidentally been dropped from the code.
--- drivers/input/misc/da7280.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/misc/da7280.c +1 -0
@@ -863,6 +863,7 @@ static void da7280_parse_properties(struct device *dev, gpi_str3[7 ] ='0' + i; haptics->gpi_ctl[i].polarity =0 ; error =device_property_read_string (dev, gpi_str3, &str); +if (!error) haptics->gpi_ctl[i].polarity =da7280_haptic_of_gpi_pol_str (dev, str); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 303/775 Input: da7280 - protect OF match table with CONFIG_OF
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 6d2ad82fece2f5adcafe77252614fcf7211dec28 ]
The OF match table is only used when OF is enabled.
--- drivers/input/misc/da7280.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/misc/da7280.c +2 -0
@@ -1300,11 +1300,13 @@ static int __maybe_unused da7280_resume(struct device *dev)return retval; } +#ifdef CONFIG_OF static const struct of_device_id da7280_of_match[] = { { .compatible ="dlg,da7280" , }, { } };MODULE_DEVICE_TABLE (of, da7280_of_match); +#endif static const struct i2c_device_id da7280_i2c_id[] = { {"da7280" , },
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 304/775 Input: imx_keypad - add dependency on HAS_IOMEM
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit f5cace4b93d736cef348211ae0814cabdd26d86a ]
devm_platform_ioremap_resource() depends on CONFIG_HAS_IOMEM, so let's add it to the dependencies when COMPILE_TEST is enabled.
--- drivers/input/keyboard/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/Kconfig +1 -1
@@ -446,7 +446,7 @@ config KEYBOARD_MPR121 config KEYBOARD_SNVS_PWRKEY tristate "IMX SNVS Power Key Driver" - depends on ARCH_MXC || COMPILE_TEST + depends on ARCH_MXC || (COMPILE_TEST && HAS_IOMEM) depends on OF help This is the snvs powerkey driver for the Freescale i.MX application
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 305/775 capabilities: Dont allow writing ambiguous v3 file capabilities
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
[ Upstream commit 95ebabde382c371572297915b104e55403674e73 ]
The v3 file capabilities have a uid field that records the filesystem uid of the root user of the user namespace the file capabilities are valid in.
When someone is silly enough to have the same underlying uid as the root uid of multiple nested containers a v3 filesystem capability can be ambiguous.
In the spirit of don't do that then, forbid writing a v3 filesystem capability if it is ambiguous.
--- security/commoncap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
security/commoncap.c +11 -1
@@ -500,7 +500,8 @@ int cap_convert_nscap(struct dentry *dentry, const void **ivalue, size_t size)__u32 magic, nsmagic;struct inode *inode =d_backing_inode (dentry);struct user_namespace *task_ns =current_user_ns (), - *fs_ns = inode->i_sb->s_user_ns; + *fs_ns = inode->i_sb->s_user_ns, + *ancestor;kuid_t rootid;size_t newsize;
@@ -523,6 +524,15 @@ int cap_convert_nscap(struct dentry *dentry, const void **ivalue, size_t size)if (nsrootid ==-1 )return -EINVAL ; +/* +* Do not allow allow adding a v3 filesystem capability xattr +* if the rootid field is ambiguous. +*/ +for (ancestor = task_ns->parent; ancestor; ancestor = ancestor->parent) { +if (from_kuid (ancestor, rootid) ==0 ) +return -EINVAL ; + } + newsize =sizeof (struct vfs_ns_cap_data ); nscap =kmalloc (newsize,GFP_ATOMIC );if (!nscap)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 306/775 HSI: Fix PM usage counter unbalance in ssi_hw_init
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit aa57e77b3d28f0df07149d88c47bc0f3aa77330b ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. We fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/hsi/controllers/omap_ssi_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hsi/controllers/omap_ssi_core.c +1 -1
@@ -424,7 +424,7 @@ static int ssi_hw_init(struct hsi_controller *ssi)struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi);int err; - err =pm_runtime_get_sync (ssi->device.parent); + err =pm_runtime_resume_and_get (ssi->device.parent);if (err <0 ) {dev_err (&ssi->device,"runtime PM failed %d\n" , err);return err;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 307/775 power: supply: cpcap: Add missing IRQF_ONESHOT to fix regression
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit e62333e26be649bfc3c167b9f2bbca38b92332c5 ]
Commit 25d76fed7ffe ("phy: cpcap-usb: Use IRQF_ONESHOT") started causing errors loading phy-cpcap-usb driver:
cpcap_battery cpcap_battery.0: failed to register power supply
genirq: Flags mismatch irq 211. 00002080 (se0conn) vs. 00000080 (se0conn) cpcap-usb-phy cpcap-usb-phy.0: could not get irq se0conn: -16
Let's fix this by adding the missing IRQF_ONESHOT to also cpcap-battery and cpcap-charger drivers.
--- drivers/power/supply/cpcap-battery.c | 2 +- drivers/power/supply/cpcap-charger.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/cpcap-battery.c +1 -1
@@ -666,7 +666,7 @@ static int cpcap_battery_init_irq(struct platform_device *pdev, error =devm_request_threaded_irq (ddata->dev, irq,NULL , cpcap_battery_irq_thread, -IRQF_SHARED , +IRQF_SHARED |IRQF_ONESHOT , name, ddata);if (error) { dev_err(ddata->dev, "could not get irq %s: %i\n",
drivers/power/supply/cpcap-charger.c +1 -1
@@ -708,7 +708,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev, error =devm_request_threaded_irq (ddata->dev, irq,NULL , cpcap_charger_irq_thread, -IRQF_SHARED , +IRQF_SHARED |IRQF_ONESHOT , name, ddata);if (error) { dev_err(ddata->dev, "could not get irq %s: %i\n",
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 308/775 clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 2f290b7c67adf6459a17a4c978102af35cd62e4a ]
The "rate" parameter in meson_clk_pll_set_rate() contains the new rate. Retrieve the old rate with clk_hw_get_rate() so we don't inifinitely try to switch from the new rate to the same rate again.
--- drivers/clk/meson/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/clk-pll.c +1 -1
@@ -371,7 +371,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,if (parent_rate ==0 || rate ==0 )return -EINVAL ; - old_rate = rate; + old_rate =clk_hw_get_rate (hw); ret =meson_clk_get_pll_settings (rate, parent_rate, &m, &n, pll);if (ret)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 309/775 clk: meson: clk-pll: make "ret" a signed integer
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 9e717285f0bd591d716fa0e7418f2cdaf756dd25 ]
The error codes returned by meson_clk_get_pll_settings() are all negative. Make "ret" a signed integer in meson_clk_pll_set_rate() to make it match with the clk_ops.set_rate API as well as the data type returned by meson_clk_get_pll_settings().
--- drivers/clk/meson/clk-pll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/meson/clk-pll.c +2 -1
@@ -365,8 +365,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, {struct clk_regmap *clk =to_clk_regmap (hw);struct meson_clk_pll_data *pll =meson_clk_pll_data (clk); -unsigned int enabled, m, n, frac =0 , ret; +unsigned int enabled, m, n, frac =0 ;unsigned long old_rate; +int ret;if (parent_rate ==0 || rate ==0 )return -EINVAL ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 310/775 clk: meson: clk-pll: propagate the error from meson_clk_pll_set_rate()
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit ccdc1f0836f8e37b558a424f1e491f929b2e7ede ]
Popagate the error code from meson_clk_pll_set_rate() when the PLL does not lock with the new settings.
--- drivers/clk/meson/clk-pll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/meson/clk-pll.c +3 -2
@@ -394,7 +394,8 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,if (!enabled)return 0 ; -if (meson_clk_pll_enable (hw)) { + ret =meson_clk_pll_enable (hw); +if (ret) {pr_warn ("%s: pll did not lock, trying to restore old rate %lu\n" , __func__, old_rate);/*
@@ -406,7 +407,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,meson_clk_pll_set_rate (hw, old_rate, parent_rate); } -return 0 ; +return ret; }/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 311/775 selftests/powerpc: Make the test check in eeh-basic.sh posix compliant
In reply to Greg Kroah-HartmanFrom: Po-Hsu Lin <[email protected]>
[ Upstream commit 3db380570af7052620ace20c29e244938610ca71 ]
The == operand is a bash extension, thus this will fail on Ubuntu with:
./eeh-basic.sh: 89: test: 2: unexpected operator
As the /bin/sh on Ubuntu is pointed to DASH.
Use -eq to fix this posix compatibility issue.
--- tools/testing/selftests/powerpc/eeh/eeh-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/powerpc/eeh/eeh-basic.sh +1 -1
@@ -86,5 +86,5 @@ echo "$failed devices failed to recover ($dev_count tested)" lspci | diff -u $pre_lspci - rm -f $pre_lspci -test "$failed" == 0 +test "$failed" -eq 0 exit $?
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 312/775 regulator: qcom-rpmh-regulator: add pm8009-1 chip revision
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 951384cabc5dfb09251d440dbc26058eba86f97e ]
PM8009 has special revision (P=1), which is to be used for sm8250 platform. The major difference is the S2 regulator which supplies 0.95 V instead of 2.848V. Declare regulators data to be used for this chip revision. The datasheet calls the chip just pm8009-1, so use the same name.
--- drivers/regulator/qcom-rpmh-regulator.c | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/regulator/qcom-rpmh-regulator.c +26 -0
@@ -732,6 +732,15 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, }; +static const struct rpmh_vreg_hw_data pmic5_hfsmps515_1 = { + .regulator_type =VRM , + .ops = &rpmh_regulator_vrm_ops, + .voltage_range =REGULATOR_LINEAR_RANGE (900000 ,0 ,4 ,16000 ), + .n_voltages =5 , + .pmic_mode_map = pmic_mode_map_pmic5_smps, + .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, +}; +static const struct rpmh_vreg_hw_data pmic5_bob = { .regulator_type =VRM , .ops = &rpmh_regulator_vrm_bypass_ops,
@@ -932,6 +941,19 @@ static const struct rpmh_vreg_init_data pm8009_vreg_data[] = { {}, }; +static const struct rpmh_vreg_init_data pm8009_1_vreg_data[] = { +RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_hfsmps510,"vdd-s1" ), +RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_hfsmps515_1,"vdd-s2" ), +RPMH_VREG ("ldo1" ,"ldo%s1" , &pmic5_nldo,"vdd-l1" ), +RPMH_VREG ("ldo2" ,"ldo%s2" , &pmic5_nldo,"vdd-l2" ), +RPMH_VREG ("ldo3" ,"ldo%s3" , &pmic5_nldo,"vdd-l3" ), +RPMH_VREG ("ldo4" ,"ldo%s4" , &pmic5_nldo,"vdd-l4" ), +RPMH_VREG ("ldo5" ,"ldo%s5" , &pmic5_pldo,"vdd-l5-l6" ), +RPMH_VREG ("ldo6" ,"ldo%s6" , &pmic5_pldo,"vdd-l5-l6" ), +RPMH_VREG ("ldo7" ,"ldo%s6" , &pmic5_pldo_lv,"vdd-l7" ), + {}, +}; +static const struct rpmh_vreg_init_data pm6150_vreg_data[] = {RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps510,"vdd-s1" ),RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps510,"vdd-s2" ),
@@ -1057,6 +1079,10 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = { .compatible = "qcom,pm8009-rpmh-regulators", .data = pm8009_vreg_data, }, + { + .compatible = "qcom,pm8009-1-rpmh-regulators", + .data = pm8009_1_vreg_data, + }, { .compatible = "qcom,pm8150-rpmh-regulators", .data = pm8150_vreg_data,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 313/775 arm64: dts: qcom: qrb5165-rb5: fix pm8009 regulators
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit c3da02421230639bf6ee5462b70b58f5b7f3b7c6 ]
Fix pm8009 compatibility string to reference pm8009 revision specific to sm8250 platform. Also add S2 regulator to be used for qca639x.
--- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +8 -1
@@ -122,7 +122,7 @@ &apps_rsc { pm8009-rpmh-regulators { - compatible = "qcom,pm8009-rpmh-regulators"; + compatible = "qcom,pm8009-1-rpmh-regulators"; qcom,pmic-id = "f"; vdd-s1-supply = <&vph_pwr>;
@@ -131,6 +131,13 @@ vdd-l5-l6-supply = <&vreg_bob>; vdd-l7-supply = <&vreg_s4a_1p8>; + vreg_s2f_0p95: smps2 { + regulator-name = "vreg_s2f_0p95"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <952000>; + regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>; + }; + vreg_l1f_1p1: ldo1 { regulator-name = "vreg_l1f_1p1"; regulator-min-microvolt = <1104000>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 314/775 quota: Fix memory leak when handling corrupted quota file
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit a4db1072e1a3bd7a8d9c356e1902b13ac5deb8ef ]
When checking corrupted quota file we can bail out and leak allocated info structure. Properly free info structure on error return.
--- fs/quota/quota_v2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/quota/quota_v2.c +8 -3
@@ -164,19 +164,24 @@ static int v2_read_file_info(struct super_block *sb, int type)quota_error (sb,"Number of blocks too big for quota file size (%llu > %llu)." , (loff_t )qinfo->dqi_blocks << qinfo->dqi_blocksize_bits,i_size_read (sb_dqopt (sb)->files[type])); - goto out; + goto out_free; }if (qinfo->dqi_free_blk >= qinfo->dqi_blocks) {quota_error (sb,"Free block number too big (%u >= %u)." , qinfo->dqi_free_blk, qinfo->dqi_blocks); - goto out; + goto out_free; }if (qinfo->dqi_free_entry >= qinfo->dqi_blocks) {quota_error (sb,"Block with free entry too big (%u >= %u)." , qinfo->dqi_free_entry, qinfo->dqi_blocks); - goto out; + goto out_free; } ret =0 ; +out_free: +if (ret) { +kfree (info->dqi_priv); + info->dqi_priv =NULL ; + } out:up_read (&dqopt->dqio_sem);return ret;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 315/775 i2c: iproc: handle only slave interrupts which are enabled
In reply to Greg Kroah-HartmanFrom: Rayagonda Kokatanur <[email protected]>
[ Upstream commit 545f4011e156554d704d6278245d54543f6680d1 ]
Handle only slave interrupts which are enabled.
The IS_OFFSET register contains the interrupt status bits which will be set regardless of the enabling of the corresponding interrupt condition. One must therefore look at both IS_OFFSET and IE_OFFSET to determine whether an interrupt condition is set and enabled.
--- drivers/i2c/busses/i2c-bcm-iproc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-bcm-iproc.c +9 -4
@@ -505,12 +505,17 @@ static void bcm_iproc_i2c_process_m_event(struct bcm_iproc_i2c_dev *iproc_i2c,static irqreturn_t bcm_iproc_i2c_isr (int irq,void *data) {struct bcm_iproc_i2c_dev *iproc_i2c = data; -u32 status =iproc_i2c_rd_reg (iproc_i2c,IS_OFFSET ); +u32 slave_status; +u32 status;bool ret; -u32 sl_status = status &ISR_MASK_SLAVE ; -if (sl_status) { - ret =bcm_iproc_i2c_slave_isr (iproc_i2c, sl_status); + status =iproc_i2c_rd_reg (iproc_i2c,IS_OFFSET ); +/* process only slave interrupt which are enabled */ + slave_status = status &iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ) & +ISR_MASK_SLAVE ; + +if (slave_status) { + ret =bcm_iproc_i2c_slave_isr (iproc_i2c, slave_status);if (ret)return IRQ_HANDLED ;else
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 316/775 i2c: iproc: update slave isr mask (ISR_MASK_SLAVE)
In reply to Greg Kroah-HartmanFrom: Rayagonda Kokatanur <[email protected]>
[ Upstream commit 603e77af7b0704bdb057de0368f1f2b04fc9552c ]
Update slave isr mask (ISR_MASK_SLAVE) to include remaining two slave interrupts.
--- drivers/i2c/busses/i2c-bcm-iproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-bcm-iproc.c +2 -1
@@ -215,7 +215,8 @@ struct bcm_iproc_i2c_dev {#define ISR_MASK_SLAVE (BIT(IS_S_START_BUSY_SHIFT)\ | BIT(IS_S_RX_EVENT_SHIFT) | BIT(IS_S_RD_EVENT_SHIFT)\ - | BIT(IS_S_TX_UNDERRUN_SHIFT)) + | BIT(IS_S_TX_UNDERRUN_SHIFT) | BIT(IS_S_RX_FIFO_FULL_SHIFT)\ + | BIT(IS_S_RX_THLD_SHIFT))static int bcm_iproc_i2c_reg_slave (struct i2c_client *slave);static int bcm_iproc_i2c_unreg_slave (struct i2c_client *slave);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 317/775 i2c: iproc: handle master read request
In reply to Greg Kroah-HartmanFrom: Rayagonda Kokatanur <[email protected]>
[ Upstream commit e21d79778768e4e187b2892d662c6aaa01e1d399 ]
Handle single or multi byte master read request with or without repeated start.
--- drivers/i2c/busses/i2c-bcm-iproc.c | 215 +++++++++++++++++++++++------ 1 file changed, 170 insertions(+), 45 deletions(-)
drivers/i2c/busses/i2c-bcm-iproc.c +170 -45
@@ -159,6 +159,11 @@#define IE_S_ALL_INTERRUPT_SHIFT 21#define IE_S_ALL_INTERRUPT_MASK 0x3f +/* +* It takes ~18us to reading 10bytes of data, hence to keep tasklet +* running for less time, max slave read per tasklet is set to 10 bytes. +*/ +#define MAX_SLAVE_RX_PER_INT 10enum i2c_slave_read_status {I2C_SLAVE_RX_FIFO_EMPTY =0 ,
@@ -205,8 +210,18 @@ struct bcm_iproc_i2c_dev {/* bytes that have been read */ unsigned int rx_bytes;unsigned int thld_bytes; + +bool slave_rx_only; +bool rx_start_rcvd; +bool slave_read_complete; +u32 tx_underrun; +u32 slave_int_mask; +struct tasklet_struct slave_rx_tasklet; }; +/* tasklet to process slave rx data */ +static void slave_rx_tasklet_fn (unsigned long ); +/* * Can be expanded in the future if more interrupt status bits are utilized */
@@ -260,6 +275,7 @@ static void bcm_iproc_i2c_slave_init( {u32 val; + iproc_i2c->tx_underrun =0 ;if (need_reset) {/* put controller in reset */ val =iproc_i2c_rd_reg (iproc_i2c,CFG_OFFSET );
@@ -296,8 +312,11 @@ static void bcm_iproc_i2c_slave_init(/* Enable interrupt register to indicate a valid byte in receive fifo */ val =BIT (IE_S_RX_EVENT_SHIFT ); +/* Enable interrupt register to indicate a Master read transaction */ + val |=BIT (IE_S_RD_EVENT_SHIFT );/* Enable interrupt register for the Slave BUSY command */ val |=BIT (IE_S_START_BUSY_SHIFT ); + iproc_i2c->slave_int_mask = val;iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); }
@@ -322,76 +341,176 @@ static void bcm_iproc_i2c_check_slave_status( } } -static bool bcm_iproc_i2c_slave_isr (struct bcm_iproc_i2c_dev *iproc_i2c, -u32 status) +static void bcm_iproc_i2c_slave_read (struct bcm_iproc_i2c_dev *iproc_i2c) { +u8 rx_data, rx_status; +u32 rx_bytes =0 ;u32 val; -u8 value, rx_status; -/* Slave RX byte receive */ -if (status &BIT (IS_S_RX_EVENT_SHIFT )) { +while (rx_bytes <MAX_SLAVE_RX_PER_INT ) { val =iproc_i2c_rd_reg (iproc_i2c,S_RX_OFFSET ); rx_status = (val >>S_RX_STATUS_SHIFT ) &S_RX_STATUS_MASK ; -if (rx_status ==I2C_SLAVE_RX_START ) { -/* Start of SMBUS for Master write */ -i2c_slave_event (iproc_i2c->slave, -I2C_SLAVE_WRITE_REQUESTED , &value); + rx_data = ((val >>S_RX_DATA_SHIFT ) &S_RX_DATA_MASK ); - val =iproc_i2c_rd_reg (iproc_i2c,S_RX_OFFSET ); - value = (u8)((val >>S_RX_DATA_SHIFT ) &S_RX_DATA_MASK ); +if (rx_status ==I2C_SLAVE_RX_START ) { +/* Start of SMBUS Master write */ i2c_slave_event (iproc_i2c->slave, -I2C_SLAVE_WRITE_RECEIVED , &value); - }else if (status &BIT (IS_S_RD_EVENT_SHIFT )) { -/* Start of SMBUS for Master Read */ +I2C_SLAVE_WRITE_REQUESTED , &rx_data); + iproc_i2c->rx_start_rcvd = true; + iproc_i2c->slave_read_complete = false; + }else if (rx_status ==I2C_SLAVE_RX_DATA && + iproc_i2c->rx_start_rcvd) { +/* Middle of SMBUS Master write */ i2c_slave_event (iproc_i2c->slave, -I2C_SLAVE_READ_REQUESTED , &value); -iproc_i2c_wr_reg (iproc_i2c,S_TX_OFFSET , value); +I2C_SLAVE_WRITE_RECEIVED , &rx_data); + }else if (rx_status ==I2C_SLAVE_RX_END && + iproc_i2c->rx_start_rcvd) { +/* End of SMBUS Master write */ +if (iproc_i2c->slave_rx_only) +i2c_slave_event (iproc_i2c->slave, +I2C_SLAVE_WRITE_RECEIVED , + &rx_data); + +i2c_slave_event (iproc_i2c->slave,I2C_SLAVE_STOP , + &rx_data); + }else if (rx_status ==I2C_SLAVE_RX_FIFO_EMPTY ) { + iproc_i2c->rx_start_rcvd = false; + iproc_i2c->slave_read_complete = true; +break ; + } - val =BIT (S_CMD_START_BUSY_SHIFT ); -iproc_i2c_wr_reg (iproc_i2c,S_CMD_OFFSET , val); + rx_bytes++; + } +} -/* -* Enable interrupt for TX FIFO becomes empty and -* less than PKT_LENGTH bytes were output on the SMBUS -*/ - val =iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ); - val |=BIT (IE_S_TX_UNDERRUN_SHIFT ); -iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); - }else { -/* Master write other than start */ - value = (u8)((val >>S_RX_DATA_SHIFT ) &S_RX_DATA_MASK ); +static void slave_rx_tasklet_fn (unsigned long data) +{ +struct bcm_iproc_i2c_dev *iproc_i2c = (struct bcm_iproc_i2c_dev *)data; +u32 int_clr; + +bcm_iproc_i2c_slave_read (iproc_i2c); + +/* clear pending IS_S_RX_EVENT_SHIFT interrupt */ + int_clr =BIT (IS_S_RX_EVENT_SHIFT ); + +if (!iproc_i2c->slave_rx_only && iproc_i2c->slave_read_complete) { +/* +* In case of single byte master-read request, +* IS_S_TX_UNDERRUN_SHIFT event is generated before +* IS_S_START_BUSY_SHIFT event. Hence start slave data send +* from first IS_S_TX_UNDERRUN_SHIFT event. +* +* This means don't send any data from slave when +* IS_S_RD_EVENT_SHIFT event is generated else it will increment +* eeprom or other backend slave driver read pointer twice. +*/ + iproc_i2c->tx_underrun =0 ; + iproc_i2c->slave_int_mask |=BIT (IE_S_TX_UNDERRUN_SHIFT ); + +/* clear IS_S_RD_EVENT_SHIFT interrupt */ + int_clr |=BIT (IS_S_RD_EVENT_SHIFT ); + } + +/* clear slave interrupt */ +iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , int_clr); +/* enable slave interrupts */ +iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , iproc_i2c->slave_int_mask); +} + +static bool bcm_iproc_i2c_slave_isr (struct bcm_iproc_i2c_dev *iproc_i2c, +u32 status) +{ +u32 val; +u8 value; + +/* +* Slave events in case of master-write, master-write-read and, +* master-read +* +* Master-write : only IS_S_RX_EVENT_SHIFT event +* Master-write-read: both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT +* events +* Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT +* events or only IS_S_RD_EVENT_SHIFT +*/ +if (status &BIT (IS_S_RX_EVENT_SHIFT ) || + status &BIT (IS_S_RD_EVENT_SHIFT )) { +/* disable slave interrupts */ + val =iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ); + val &= ~iproc_i2c->slave_int_mask; +iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); + +if (status &BIT (IS_S_RD_EVENT_SHIFT )) +/* Master-write-read request */ + iproc_i2c->slave_rx_only = false; +else +/* Master-write request only */ + iproc_i2c->slave_rx_only = true; + +/* schedule tasklet to read data later */ +tasklet_schedule (&iproc_i2c->slave_rx_tasklet); + +/* clear only IS_S_RX_EVENT_SHIFT interrupt */ +iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , +BIT (IS_S_RX_EVENT_SHIFT )); + } + +if (status &BIT (IS_S_TX_UNDERRUN_SHIFT )) { + iproc_i2c->tx_underrun++; +if (iproc_i2c->tx_underrun ==1 ) +/* Start of SMBUS for Master Read */ i2c_slave_event (iproc_i2c->slave, -I2C_SLAVE_WRITE_RECEIVED , &value); -if (rx_status ==I2C_SLAVE_RX_END ) -i2c_slave_event (iproc_i2c->slave, -I2C_SLAVE_STOP , &value); - } - }else if (status &BIT (IS_S_TX_UNDERRUN_SHIFT )) { -/* Master read other than start */ -i2c_slave_event (iproc_i2c->slave, -I2C_SLAVE_READ_PROCESSED , &value); +I2C_SLAVE_READ_REQUESTED , + &value); +else +/* Master read other than start */ +i2c_slave_event (iproc_i2c->slave, +I2C_SLAVE_READ_PROCESSED , + &value);iproc_i2c_wr_reg (iproc_i2c,S_TX_OFFSET , value); +/* start transfer */ val =BIT (S_CMD_START_BUSY_SHIFT );iproc_i2c_wr_reg (iproc_i2c,S_CMD_OFFSET , val); + +/* clear interrupt */ +iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , +BIT (IS_S_TX_UNDERRUN_SHIFT )); } -/* Stop */ +/* Stop received from master in case of master read transaction */ if (status &BIT (IS_S_START_BUSY_SHIFT )) { -i2c_slave_event (iproc_i2c->slave,I2C_SLAVE_STOP , &value);/* * Enable interrupt for TX FIFO becomes empty and * less than PKT_LENGTH bytes were output on the SMBUS */ - val =iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ); - val &= ~BIT (IE_S_TX_UNDERRUN_SHIFT ); -iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); + iproc_i2c->slave_int_mask &= ~BIT (IE_S_TX_UNDERRUN_SHIFT ); +iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , + iproc_i2c->slave_int_mask); + +/* End of SMBUS for Master Read */ + val =BIT (S_TX_WR_STATUS_SHIFT ); +iproc_i2c_wr_reg (iproc_i2c,S_TX_OFFSET , val); + + val =BIT (S_CMD_START_BUSY_SHIFT ); +iproc_i2c_wr_reg (iproc_i2c,S_CMD_OFFSET , val); + +/* flush TX FIFOs */ + val =iproc_i2c_rd_reg (iproc_i2c,S_FIFO_CTRL_OFFSET ); + val |= (BIT (S_FIFO_TX_FLUSH_SHIFT )); +iproc_i2c_wr_reg (iproc_i2c,S_FIFO_CTRL_OFFSET , val); + +i2c_slave_event (iproc_i2c->slave,I2C_SLAVE_STOP , &value); + +/* clear interrupt */ +iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , +BIT (IS_S_START_BUSY_SHIFT )); } -/* clear interrupt status */ -iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , status); +/* check slave transmit status only if slave is transmitting */ +if (!iproc_i2c->slave_rx_only) +bcm_iproc_i2c_check_slave_status (iproc_i2c); -bcm_iproc_i2c_check_slave_status (iproc_i2c);return true; }
@@ -1072,6 +1191,10 @@ static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave)return -EAFNOSUPPORT ; iproc_i2c->slave = slave; + +tasklet_init (&iproc_i2c->slave_rx_tasklet, slave_rx_tasklet_fn, + (unsigned long )iproc_i2c); +bcm_iproc_i2c_slave_init (iproc_i2c, false);return 0 ; }
@@ -1092,6 +1215,8 @@ static int bcm_iproc_i2c_unreg_slave(struct i2c_client *slave) IE_S_ALL_INTERRUPT_SHIFT);iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , tmp); +tasklet_kill (&iproc_i2c->slave_rx_tasklet); +/* Erase the slave address programmed */ tmp =iproc_i2c_rd_reg (iproc_i2c,S_CFG_SMBUS_ADDR_OFFSET ); tmp &= ~BIT (S_CFG_EN_NIC_SMB_ADDR3_SHIFT );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 318/775 spi: cadence-quadspi: Abort read if dummy cycles required are too many
In reply to Greg Kroah-HartmanFrom: Pratyush Yadav <[email protected]>
[ Upstream commit ceeda328edeeeeac7579e9dbf0610785a3b83d39 ]
The controller can only support up to 31 dummy cycles. If the command requires more it falls back to using 31. This command is likely to fail because the correct number of cycles are not waited upon. Rather than silently issuing an incorrect command, fail loudly so the caller can get a chance to find out the command can't be supported by the controller.
--- drivers/spi/spi-cadence-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-cadence-quadspi.c +1 -1
@@ -461,7 +461,7 @@ static int cqspi_read_setup(struct cqspi_flash_pdata *f_pdata,/* Setup dummy clock cycles */ dummy_clk = op->dummy.nbytes *8 ;if (dummy_clk >CQSPI_DUMMY_CLKS_MAX ) - dummy_clk =CQSPI_DUMMY_CLKS_MAX ; +return -EOPNOTSUPP ;if (dummy_clk) reg |= (dummy_clk &CQSPI_REG_RD_INSTR_DUMMY_MASK )
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 319/775 clk: sunxi-ng: h6: Fix CEC clock
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit 756650820abd4770c4200763505b634a3c04e05e ]
The CEC clock on the H6 SoC is a bit special, since it uses a fixed pre-dividier for one source clock (the PLL), but conveys the other clock (32K OSC) directly.
We are using a fixed predivider array for that, but fail to use the right flag to actually activate that.
--- drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-h6.c +1 -1
@@ -682,7 +682,7 @@ static struct ccu_mux hdmi_cec_clk = { .common = { .reg = 0xb10, - .features = CCU_FEATURE_VARIABLE_PREDIV, + .features = CCU_FEATURE_FIXED_PREDIV, .hw.init = CLK_HW_INIT_PARENTS("hdmi-cec", hdmi_cec_parents, &ccu_mux_ops,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 320/775 clk: renesas: r8a779a0: Remove non-existent S2 clock
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 5b30be15ca262d9cb2c36b173bb488e8d1952ea0 ]
The S2 internal core clock does not exist on R-Car V3U. Remove it.
--- drivers/clk/renesas/r8a779a0-cpg-mssr.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/renesas/r8a779a0-cpg-mssr.c +0 -1
@@ -69,7 +69,6 @@ enum clk_ids {CLK_PLL5_DIV2 ,CLK_PLL5_DIV4 ,CLK_S1 , -CLK_S2 ,CLK_S3 ,CLK_SDSRC , CLK_RPCSRC,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 321/775 clk: renesas: r8a779a0: Fix parent of CBFUSA clock
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 80d3e07ec509c5098d44e4f1416cc9f133fd436f ]
According to Figure 8.1.1 ("Block Diagram of CPG (R-Car V3U-AD)") in the R-Car V3U Series User's Manual Rev. 0.5, the parent of the CBFUSA clock is EXTAL.
--- drivers/clk/renesas/r8a779a0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779a0-cpg-mssr.c +1 -1
@@ -136,7 +136,7 @@ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = {DEF_FIXED ("icu" ,R8A779A0_CLK_ICU ,CLK_PLL5_DIV4 ,2 ,1 ),DEF_FIXED ("icud2" ,R8A779A0_CLK_ICUD2 ,CLK_PLL5_DIV4 ,4 ,1 ),DEF_FIXED ("vcbus" ,R8A779A0_CLK_VCBUS ,CLK_PLL5_DIV4 ,1 ,1 ), -DEF_FIXED ("cbfusa" ,R8A779A0_CLK_CBFUSA ,CLK_MAIN ,2 ,1 ), +DEF_FIXED ("cbfusa" ,R8A779A0_CLK_CBFUSA ,CLK_EXTAL ,2 ,1 ),DEF_DIV6P1 ("mso" ,R8A779A0_CLK_MSO ,CLK_PLL5_DIV4 ,0x87c ), DEF_DIV6P1("canfd", R8A779A0_CLK_CANFD, CLK_PLL5_DIV4, 0x878),
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 322/775 HID: core: detect and skip invalid inputs to snto32()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit a0312af1f94d13800e63a7d0a66e563582e39aec ]
Prevent invalid (0, 0) inputs to hid-core's snto32() function.
Maybe it is just the dummy device here that is causing this, but there are hundreds of calls to snto32(0, 0). Having n (bits count) of 0 is causing the current UBSAN trap with a shift value of 0xffffffff (-1, or n - 1 in this function).
Either of the value to shift being 0 or the bits count being 0 can be handled by just returning 0 to the caller, avoiding the following complex shift + OR operations:
return value & (1 << (n - 1)) ? value | (~0U << n) : value;
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1307,6 +1307,9 @@ EXPORT_SYMBOL_GPL(hid_open_report);static s32 snto32 (__u32 value,unsigned n) { +if (!value || !n) +return 0 ; +switch (n) {case 8 :return ((__s8 )value);case 16 :return ((__s16 )value);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 323/775 RDMA/siw: Fix handling of zero-sized Read and Receive Queues.
In reply to Greg Kroah-HartmanFrom: Bernard Metzler <[email protected]>
[ Upstream commit 661f385961f06f36da24cf408d461f988d0c39ad ]
During connection setup, the application may choose to zero-size inbound and outbound READ queues, as well as the Receive queue. This patch fixes handling of zero-sized queues, but not prevents it.
Kamal Heib says in an initial error report:
When running the blktests over siw the following shift-out-of-bounds is reported, this is happening because the passed IRD or ORD from the ulp could be zero which will lead to unexpected behavior when calling roundup_pow_of_two(), fix that by blocking zero values of ORD or IRD.
UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13
shift exponent 64 is too large for 64-bit type 'long unsigned int'
CPU: 20 PID: 3957 Comm: kworker/u64:13 Tainted: G S 5.10.0-rc6 #2
Hardware name: Dell Inc. PowerEdge R630/02C2CP, BIOS 2.1.5 04/11/2016
Workqueue: iw_cm_wq cm_work_handler [iw_cm]
Call Trace:
dump_stack+0x99/0xcb
ubsan_epilogue+0x5/0x40
__ubsan_handle_shift_out_of_bounds.cold.11+0xb4/0xf3
? down_write+0x183/0x3d0
siw_qp_modify.cold.8+0x2d/0x32 [siw]
? __local_bh_enable_ip+0xa5/0xf0
siw_accept+0x906/0x1b60 [siw]
? xa_load+0x147/0x1f0
? siw_connect+0x17a0/0x17a0 [siw]
? lock_downgrade+0x700/0x700
? siw_get_base_qp+0x1c2/0x340 [siw]
? _raw_spin_unlock_irqrestore+0x39/0x40
iw_cm_accept+0x1f4/0x430 [iw_cm]
rdma_accept+0x3fa/0xb10 [rdma_cm]
? check_flush_dependency+0x410/0x410
? cma_rep_recv+0x570/0x570 [rdma_cm]
nvmet_rdma_queue_connect+0x1a62/0x2680 [nvmet_rdma]
? nvmet_rdma_alloc_cmds+0xce0/0xce0 [nvmet_rdma]
? lock_release+0x56e/0xcc0
? lock_downgrade+0x700/0x700
? lock_downgrade+0x700/0x700
? __xa_alloc_cyclic+0xef/0x350
? __xa_alloc+0x2d0/0x2d0
? rdma_restrack_add+0xbe/0x2c0 [ib_core]
? __ww_mutex_die+0x190/0x190
cma_cm_event_handler+0xf2/0x500 [rdma_cm]
iw_conn_req_handler+0x910/0xcb0 [rdma_cm]
? _raw_spin_unlock_irqrestore+0x39/0x40
? trace_hardirqs_on+0x1c/0x150
? cma_ib_handler+0x8a0/0x8a0 [rdma_cm]
? __kasan_kmalloc.constprop.7+0xc1/0xd0
cm_work_handler+0x121c/0x17a0 [iw_cm]
? iw_cm_reject+0x190/0x190 [iw_cm]
? trace_hardirqs_on+0x1c/0x150
process_one_work+0x8fb/0x16c0
? pwq_dec_nr_in_flight+0x320/0x320
worker_thread+0x87/0xb40
? __kthread_parkme+0xd1/0x1a0
? process_one_work+0x16c0/0x16c0
kthread+0x35f/0x430
? kthread_mod_delayed_work+0x180/0x180
ret_from_fork+0x22/0x30--- drivers/infiniband/sw/siw/siw.h | 2 +- drivers/infiniband/sw/siw/siw_qp.c | 271 ++++++++++++++------------ drivers/infiniband/sw/siw/siw_qp_rx.c | 26 ++- drivers/infiniband/sw/siw/siw_qp_tx.c | 4 +- drivers/infiniband/sw/siw/siw_verbs.c | 20 +- 5 files changed, 177 insertions(+), 146 deletions(-)
drivers/infiniband/sw/siw/siw.h +1 -1
@@ -653,7 +653,7 @@ static inline struct siw_sqe *orq_get_free(struct siw_qp *qp) {struct siw_sqe *orq_e =orq_get_tail (qp); -if (orq_e &&READ_ONCE (orq_e->flags) ==0 ) +if (READ_ONCE (orq_e->flags) ==0 )return orq_e;return NULL ;
drivers/infiniband/sw/siw/siw_qp.c +142 -129
322 lines not on this page · raw message
drivers/infiniband/sw/siw/siw_qp_rx.c +18 -8
@@ -680,6 +680,10 @@ static int siw_init_rresp(struct siw_qp *qp, struct siw_rx_stream *srx) }spin_lock_irqsave (&qp->sq_lock, flags); +if (unlikely (!qp->attrs.irq_size)) { + run_sq =0 ; + goto error_irq; + }if (tx_work->wr_status ==SIW_WR_IDLE ) {/* * immediately schedule READ response w/o
@@ -712,8 +716,9 @@ static int siw_init_rresp(struct siw_qp *qp, struct siw_rx_stream *srx)/* RRESP now valid as current TX wqe or placed into IRQ */ smp_store_mb (resp->flags,SIW_WQE_VALID ); }else { -pr_warn ("siw: [QP %u]: irq %d exceeded %d\n" ,qp_id (qp), - qp->irq_put % qp->attrs.irq_size, qp->attrs.irq_size); +error_irq: +pr_warn ("siw: [QP %u]: IRQ exceeded or null, size %d\n" , +qp_id (qp), qp->attrs.irq_size); siw_init_terminate(qp, TERM_ERROR_LAYER_RDMAP, RDMAP_ETYPE_REMOTE_OPERATION,
@@ -740,6 +745,9 @@ static int siw_orqe_start_rx(struct siw_qp *qp)struct siw_sqe *orqe;struct siw_wqe *wqe =NULL ; +if (unlikely (!qp->attrs.orq_size)) +return -EPROTO ; +/* make sure ORQ indices are current */ smp_mb ();
@@ -796,8 +804,8 @@ int siw_proc_rresp(struct siw_qp *qp)*/ rv =siw_orqe_start_rx (qp);if (rv) { -pr_warn ("siw: [QP %u]: ORQ empty at idx %d\n" , -qp_id (qp), qp->orq_get % qp->attrs.orq_size); +pr_warn ("siw: [QP %u]: ORQ empty, size %d\n" , +qp_id (qp), qp->attrs.orq_size); goto error_term; } rv =siw_rresp_check_ntoh (srx, frx);
@@ -1290,11 +1298,13 @@ static int siw_rdmap_complete(struct siw_qp *qp, int error) wc_status);siw_wqe_put_mem (wqe,SIW_OP_READ ); -if (!error) +if (!error) { rv =siw_check_tx_fence (qp); -else -/* Disable current ORQ eleement */ -WRITE_ONCE (orq_get_current (qp)->flags,0 ); + }else { +/* Disable current ORQ element */ +if (qp->attrs.orq_size) +WRITE_ONCE (orq_get_current (qp)->flags,0 ); + }break ;case RDMAP_RDMA_READ_REQ :
drivers/infiniband/sw/siw/siw_qp_tx.c +2 -2
@@ -1107,8 +1107,8 @@ next_wqe:/* * RREQ may have already been completed by inbound RRESP! */ -if (tx_type ==SIW_OP_READ || - tx_type ==SIW_OP_READ_LOCAL_INV ) { +if ((tx_type ==SIW_OP_READ || + tx_type ==SIW_OP_READ_LOCAL_INV ) && qp->attrs.orq_size) {/* Cleanup pending entry in ORQ */ qp->orq_put--; qp->orq[qp->orq_put % qp->attrs.orq_size].flags =0 ;
drivers/infiniband/sw/siw/siw_verbs.c +14 -6
@@ -365,13 +365,23 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,if (rv) goto err_out; + num_sqe = attrs->cap.max_send_wr; + num_rqe = attrs->cap.max_recv_wr; +/* All queue indices are derived from modulo operations * on a free running 'get' (consumer) and 'put' (producer) * unsigned counter. Having queue sizes at power of two * avoids handling counter wrap around. */ - num_sqe =roundup_pow_of_two (attrs->cap.max_send_wr); - num_rqe =roundup_pow_of_two (attrs->cap.max_recv_wr); +if (num_sqe) + num_sqe =roundup_pow_of_two (num_sqe); +else { +/* Zero sized SQ is not supported */ + rv = -EINVAL ; + goto err_out; + } +if (num_rqe) + num_rqe =roundup_pow_of_two (num_rqe);if (udata) qp->sendq =vmalloc_user (num_sqe *sizeof (struct siw_sqe ));
@@ -379,7 +389,6 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, qp->sendq =vzalloc (num_sqe *sizeof (struct siw_sqe ));if (qp->sendq ==NULL ) { -siw_dbg (base_dev,"SQ size %d alloc failed\n" , num_sqe); rv = -ENOMEM ; goto err_out_xa; }
@@ -413,7 +422,6 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, qp->recvq =vzalloc (num_rqe *sizeof (struct siw_rqe ));if (qp->recvq ==NULL ) { -siw_dbg (base_dev,"RQ size %d alloc failed\n" , num_rqe); rv = -ENOMEM ; goto err_out_xa; }
@@ -966,9 +974,9 @@ int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr,unsigned long flags;int rv =0 ; -if (qp->srq) { +if (qp->srq || qp->attrs.rq_size ==0 ) { *bad_wr = wr; -return -EOPNOTSUPP ;/* what else from errno.h? */ +return -EINVAL ; }if (!rdma_is_kernel_res (&qp->base_qp.res)) {siw_dbg_qp (qp,"no kernel post_recv for user mapped rq\n" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 324/775 dmaengine: fsldma: Fix a resource leak in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit cbc0ad004c03ad7971726a5db3ec84dba3dcb857 ]
A 'irq_dispose_mapping()' call is missing in the remove function. Add it.
This is needed to undo the 'irq_of_parse_and_map() call from the probe function and already part of the error handling path of the probe function.
It was added in the probe function only in commit d3f620b2c4fe ("fsldma:
simplify IRQ probing and handling")
--- drivers/dma/fsldma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/fsldma.c +1 -0
@@ -1314,6 +1314,7 @@ static int fsldma_of_remove(struct platform_device *op)if (fdev->chan[i])fsl_dma_chan_remove (fdev->chan[i]); } +irq_dispose_mapping (fdev->irq);iounmap (fdev->regs);kfree (fdev);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 325/775 dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b202d4e82531a62a33a6b14d321dd2aad491578e ]
In case of error, the previous 'fsl_dma_chan_probe()' calls must be undone by some 'fsl_dma_chan_remove()', as already done in the remove function.
It was added in the remove function in commit 77cd62e8082b ("fsldma: allow Freescale Elo DMA driver to be compiled as a module")
--- drivers/dma/fsldma.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/dma/fsldma.c +5 -0
@@ -1214,6 +1214,7 @@ static int fsldma_of_probe(struct platform_device *op) {struct fsldma_device *fdev;struct device_node *child; +unsigned int i;int err; fdev =kzalloc (sizeof (*fdev),GFP_KERNEL );
@@ -1292,6 +1293,10 @@ static int fsldma_of_probe(struct platform_device *op)return 0 ; out_free_fdev: +for (i =0 ; i <FSL_DMA_MAX_CHANS_PER_DEVICE ; i++) { +if (fdev->chan[i]) +fsl_dma_chan_remove (fdev->chan[i]); + }irq_dispose_mapping (fdev->irq);iounmap (fdev->regs); out_free:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 326/775 dmaengine: owl-dma: Fix a resource leak in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 1f0a16f04113f9f0ab0c8e6d3abe661edab549e6 ]
A 'dma_pool_destroy()' call is missing in the remove function. Add it.
This call is already made in the error handling path of the probe function.
--- drivers/dma/owl-dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/owl-dma.c +1 -0
@@ -1245,6 +1245,7 @@ static int owl_dma_remove(struct platform_device *pdev)owl_dma_free (od);clk_disable_unprepare (od->clk); +dma_pool_destroy (od->lli_pool);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 327/775 rtc: rx6110: fix build against modular I2C
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit def8550f543e6c9101f3e1a03160b2aab8c02e8a ]
With CONFIG_I2C=m, the #ifdef section is disabled, as shown by this warning:
drivers/rtc/rtc-rx6110.c:314:12: error: unused function 'rx6110_probe' [-Werror,-Wunused-function]
Change the driver to use IS_ENABLED() instead, which works for both module and built-in subsystems.
--- drivers/rtc/rtc-rx6110.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-rx6110.c +2 -2
@@ -331,7 +331,7 @@ static int rx6110_probe(struct rx6110_data *rx6110, struct device *dev)return 0 ; } -#ifdef CONFIG_SPI_MASTER +#if IS_ENABLED (CONFIG_SPI_MASTER )static struct regmap_config regmap_spi_config = { .reg_bits =8 , .val_bits = 8,
@@ -411,7 +411,7 @@ static void rx6110_spi_unregister(void) }#endif /* CONFIG_SPI_MASTER */ -#ifdef CONFIG_I2C +#if IS_ENABLED (CONFIG_I2C )static struct regmap_config regmap_i2c_config = { .reg_bits =8 , .val_bits = 8,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 328/775 dmaengine: qcom: Always inline gpi_update_reg
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 0a6d3038d914b51d6860f23ea2b508590e8340de ]
When building with CONFIG_UBSAN_UNSIGNED_OVERFLOW, clang decides not to inline gpi_update_reg, which causes a linkage failure around __bad_mask:
ld.lld: error: undefined symbol: __bad_mask
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
referenced by bitfield.h:119 (
include/linux/bitfield.h:119)
dma/qcom/gpi.o:(gpi_update_reg) in archivedrivers/built-in.a
referenced by bitfield.h:119 (include/linux/bitfield.h:119)
dma/qcom/gpi.o:(gpi_update_reg) in archivedrivers/built-in.a
If gpi_update_reg is not inlined, the mask value will not be known at compile time so the check in field_multiplier stays in the final object file, causing the above linkage failure. Always inline gpi_update_reg so that this check can never fail.
--- drivers/dma/qcom/gpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/qcom/gpi.c +1 -1
@@ -584,7 +584,7 @@ static inline void gpi_write_reg_field(struct gpii *gpii, void __iomem *addr,gpi_write_reg (gpii, addr, val); } -static inline void +static __always_inline voidgpi_update_reg (struct gpii *gpii,u32 offset,u32 mask,u32 val) {void __iomem *addr = gpii->regs + offset;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 329/775 dmaengine: ti: k3-udma: Set rflow count for BCDMA split channels
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit aecf9d38361090857aa58708e500ee79bed1e273 ]
BCDMA RX channels have one flow per channel, therefore set the rflow_cnt to rchan_cnt.
Without this patch, request for BCDMA RX channel allocation fails as rflow_cnt is 0 thus fails to reserve a rflow for the channel.
--- drivers/dma/ti/k3-udma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/ti/k3-udma.c +1 -0
@@ -4306,6 +4306,7 @@ static int udma_get_mmrs(struct platform_device *pdev, struct udma_dev *ud) ud->bchan_cnt =BCDMA_CAP2_BCHAN_CNT (cap2); ud->tchan_cnt =BCDMA_CAP2_TCHAN_CNT (cap2); ud->rchan_cnt =BCDMA_CAP2_RCHAN_CNT (cap2); + ud->rflow_cnt = ud->rchan_cnt;break ;case DMA_TYPE_PKTDMA : cap4 =udma_read (ud->mmrs[MMR_GCFG ],0x30 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 330/775 dmaengine: hsu: disable spurious interrupt
In reply to Greg Kroah-HartmanFrom: Ferry Toth <[email protected]>
[ Upstream commit 035b73b2b3b2e074a56489a7bf84b6a8012c0e0d ]
On Intel Tangier B0 and Anniedale the interrupt line, disregarding to have different numbers, is shared between HSU DMA and UART IPs. Thus on such SoCs we are expecting that IRQ handler is called in UART driver only. hsu_pci_irq was handling the spurious interrupt from HSU DMA by returning immediately. This wastes CPU time and since HSU DMA and HSU UART interrupt occur simultaneously they race to be handled causing delay to the HSU UART interrupt handling. Fix this by disabling the interrupt entirely.
--- drivers/dma/hsu/pci.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/dma/hsu/pci.c +11 -10
@@ -26,22 +26,12 @@static irqreturn_t hsu_pci_irq (int irq,void *dev) {struct hsu_dma_chip *chip = dev; -struct pci_dev *pdev =to_pci_dev (chip->dev);u32 dmaisr;u32 status;unsigned short i;int ret =0 ;int err; -/* -* On Intel Tangier B0 and Anniedale the interrupt line, disregarding -* to have different numbers, is shared between HSU DMA and UART IPs. -* Thus on such SoCs we are expecting that IRQ handler is called in -* UART driver only. -*/ -if (pdev->device ==PCI_DEVICE_ID_INTEL_MRFLD_HSU_DMA ) -return IRQ_HANDLED ; - dmaisr =readl (chip->regs +HSU_PCI_DMAISR );for (i =0 ; i < chip->hsu->nr_channels; i++) {if (dmaisr &0x1 ) {
@@ -105,6 +95,17 @@ static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (ret) goto err_register_irq; +/* +* On Intel Tangier B0 and Anniedale the interrupt line, disregarding +* to have different numbers, is shared between HSU DMA and UART IPs. +* Thus on such SoCs we are expecting that IRQ handler is called in +* UART driver only. Instead of handling the spurious interrupt +* from HSU DMA here and waste CPU time and delay HSU UART interrupt +* handling, disable the interrupt entirely. +*/ +if (pdev->device ==PCI_DEVICE_ID_INTEL_MRFLD_HSU_DMA ) +disable_irq_nosync (chip->irq); +pci_set_drvdata (pdev, chip);return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 331/775 mfd: bd9571mwv: Use devm_mfd_add_devices()
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit c58ad0f2b052b5675d6394e03713ee41e721b44c ]
To remove mfd devices when unload this driver, should use devm_mfd_add_devices() instead.
--- drivers/mfd/bd9571mwv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/bd9571mwv.c +3 -3
@@ -185,9 +185,9 @@ static int bd9571mwv_probe(struct i2c_client *client,return ret; } - ret =mfd_add_devices (bd->dev,PLATFORM_DEVID_AUTO , bd9571mwv_cells, -ARRAY_SIZE (bd9571mwv_cells),NULL ,0 , -regmap_irq_get_domain (bd->irq_data)); + ret =devm_mfd_add_devices (bd->dev,PLATFORM_DEVID_AUTO , + bd9571mwv_cells,ARRAY_SIZE (bd9571mwv_cells), +NULL ,0 ,regmap_irq_get_domain (bd->irq_data));if (ret) {regmap_del_irq_chip (bd->irq, bd->irq_data);return ret;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 332/775 power: supply: cpcap-charger: Fix missing power_supply_put()
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 4bff91bb3231882b530af794c92ac3a5fe199481 ]
Fix missing power_supply_put().
--- drivers/power/supply/cpcap-charger.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/cpcap-charger.c +1 -0
@@ -302,6 +302,7 @@ cpcap_charger_get_bat_const_charge_voltage(struct cpcap_charger_ddata *ddata)if (!error) voltage = prop.intval; } +power_supply_put (battery);return voltage; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 333/775 power: supply: cpcap-battery: Fix missing power_supply_put()
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 97456a24acb41b74ab6910f40fb8f09b206fd3b5 ]
Fix missing power_supply_put().
--- drivers/power/supply/cpcap-battery.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/power/supply/cpcap-battery.c +7 -3
@@ -561,17 +561,21 @@ static int cpcap_battery_update_charger(struct cpcap_battery_ddata *ddata,POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE , &prop);if (error) -return error; + goto out_put;/* Allow charger const voltage lower than battery const voltage */ if (const_charge_voltage > prop.intval) -return 0 ; + goto out_put; val.intval = const_charge_voltage; -return power_supply_set_property (charger, + error =power_supply_set_property (charger,POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE , &val); +out_put: +power_supply_put (charger); + +return error; } static int cpcap_battery_set_property(struct power_supply *psy,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 334/775 scsi: ufs: Fix a possible NULL pointer issue
In reply to Greg Kroah-HartmanFrom: Can Guo <[email protected]>
[ Upstream commit fb7afe24ba1b7e27483be7d2ac3ed002e67eecd5 ]
During system resume/suspend, hba could be NULL. In this case, do not touch eh_sem.
--- drivers/scsi/ufs/ufshcd.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +14 -3
@@ -94,6 +94,8 @@ 16, 4, buf, __len, false); \ }while (0 ) +static bool early_suspend; +int ufshcd_dump_regs (struct ufs_hba *hba,size_t offset,size_t len,const char *prefix) {
@@ -8939,8 +8941,14 @@ int ufshcd_system_suspend(struct ufs_hba *hba)int ret =0 ;ktime_t start =ktime_get (); +if (!hba) { + early_suspend = true; +return 0 ; + } +down (&hba->eh_sem); -if (!hba || !hba->is_powered) + +if (!hba->is_powered)return 0 ; if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
@@ -8989,9 +8997,12 @@ int ufshcd_system_resume(struct ufs_hba *hba)int ret =0 ;ktime_t start =ktime_get (); -if (!hba) { -up (&hba->eh_sem); +if (!hba)return -EINVAL ; + +if (unlikely (early_suspend)) { + early_suspend = false; +down (&hba->eh_sem); }if (!hba->is_powered ||pm_runtime_suspended (hba->dev))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 335/775 power: supply: cpcap-charger: Fix power_supply_put on null battery pointer
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 39196cfe10dd2b46ee28b44abbc0db4f4cb7822f ]
Currently if the pointer battery is null there is a null pointer dereference on the call to power_supply_put. Fix this by only performing the put if battery is not null.
Addresses-Coverity: ("Dereference after null check")
--- drivers/power/supply/cpcap-charger.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/cpcap-charger.c +2 -1
@@ -301,8 +301,9 @@ cpcap_charger_get_bat_const_charge_voltage(struct cpcap_charger_ddata *ddata) &prop);if (!error) voltage = prop.intval; + +power_supply_put (battery); } -power_supply_put (battery);return voltage; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 336/775 fdt: Properly handle "no-map" field in the memory region
In reply to Greg Kroah-HartmanFrom: KarimAllah Ahmed <[email protected]>
[ Upstream commit 86588296acbfb1591e92ba60221e95677ecadb43 ]
Mark the memory region with NOMAP flag instead of completely removing it from the memory blocks. That makes the FDT handling consistent with the EFI memory map handling.
--- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/fdt.c +1 -1
@@ -1147,7 +1147,7 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, bool nomap) { if (nomap) - return memblock_remove(base, size); + return memblock_mark_nomap(base, size);return memblock_reserve (base, size); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 337/775 of/fdt: Make sure no-map does not remove already reserved regions
In reply to Greg Kroah-HartmanFrom: Nicolas Boichat <[email protected]>
[ Upstream commit 8a5a75e5e9e55de1cef5d83ca3589cb4899193ef ]
If the device tree is incorrectly configured, and attempts to define a "no-map" reserved memory that overlaps with the kernel data/code, the kernel would crash quickly after boot, with no obvious clue about the nature of the issue.
For example, this would happen if we have the kernel mapped at these addresses (from /proc/iomem):
40000000-41ffffff : System RAM
40080000-40dfffff : Kernel code
40e00000-411fffff : reserved
41200000-413e0fff : Kernel data
And we declare a no-map shared-dma-pool region at a fixed address within that range:
mem_reserved: mem_region {
compatible = "shared-dma-pool";
reg = <0 0x40000000 0 0x01A00000>;
no-map;
};To fix this, when removing memory regions at early boot (which is what "no-map" regions do), we need to make sure that the memory is not already reserved. If we do, __reserved_mem_reserve_reg will throw an error:
[ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for node 'mem_region': base 0x0000000040000000, size 26 MiB
and the code that will try to use the region should also fail, later on.
We do not do anything for non-"no-map" regions, as memblock explicitly allows reserved regions to overlap, and the commit that this fixes removed the check for that precise reason.
[ qperret: fixed conflicts caused by the usage of memblock_mark_nomap ]
--- drivers/of/fdt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/of/fdt.c +9 -1
@@ -1146,8 +1146,16 @@ int __init __weak early_init_dt_mark_hotplug_memory_arch(u64 base, u64 size)int __init __weak early_init_dt_reserve_memory_arch (phys_addr_t base,phys_addr_t size,bool nomap) { -if (nomap) +if (nomap) { +/* +* If the memory is already reserved (by another region), we +* should not allow it to be marked nomap. +*/ +if (memblock_is_region_reserved (base, size)) +return -EBUSY ; +return memblock_mark_nomap (base, size); + }return memblock_reserve (base, size); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 338/775 RDMA/rtrs: Extend ibtrs_cq_qp_create
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 7490fd1fe836ba3c7eda7a4b1cfd9e44389ffda5 ]
rtrs does not have same limit for both max_send_wr and max_recv_wr, To allow client and server set different values, export in a separate parameter for rtrs_cq_qp_create.
Also fix the type accordingly, u32 should be used instead of u16.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 ++-- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 5 +++-- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 +++-- drivers/infiniband/ulp/rtrs/rtrs.c | 14 ++++++++------ 4 files changed, 16 insertions(+), 12 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +2 -2
@@ -1511,7 +1511,7 @@ static void destroy_con(struct rtrs_clt_con *con)static int create_con_cq_qp (struct rtrs_clt_con *con) {struct rtrs_clt_sess *sess =to_clt_sess (con->c.sess); -u16 wr_queue_size; +u32 wr_queue_size;int err, cq_vector;struct rtrs_msg_rkey_rsp *rsp;
@@ -1573,7 +1573,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) cq_vector = con->cpu % sess->s.dev->ib_dev->num_comp_vectors; err =rtrs_cq_qp_create (&sess->s, &con->c, sess->max_send_sge, cq_vector, wr_queue_size, wr_queue_size, -IB_POLL_SOFTIRQ ); + wr_queue_size,IB_POLL_SOFTIRQ );/* * In case of error we do not bother to clean previous allocations, * since destroy_con_cq_qp() must be called.
drivers/infiniband/ulp/rtrs/rtrs-pri.h +3 -2
@@ -303,8 +303,9 @@ int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con, struct ib_cqe *cqe, struct ib_send_wr *head);int rtrs_cq_qp_create (struct rtrs_sess *rtrs_sess,struct rtrs_con *con, -u32 max_send_sge,int cq_vector,u16 cq_size, -u16 wr_queue_size,enum ib_poll_context poll_ctx); +u32 max_send_sge,int cq_vector,int cq_size, +u32 max_send_wr,u32 max_recv_wr, +enum ib_poll_context poll_ctx);void rtrs_cq_qp_destroy (struct rtrs_con *con); void rtrs_init_hb(struct rtrs_sess *sess, struct ib_cqe *cqe,
drivers/infiniband/ulp/rtrs/rtrs-srv.c +3 -2
@@ -1586,7 +1586,7 @@ static int create_con(struct rtrs_srv_sess *sess,struct rtrs_sess *s = &sess->s;struct rtrs_srv_con *con; -u16 cq_size, wr_queue_size; +u32 cq_size, wr_queue_size;int err, cq_vector; con =kzalloc (sizeof (*con),GFP_KERNEL );
@@ -1630,7 +1630,8 @@ static int create_con(struct rtrs_srv_sess *sess,/* TODO: SOFTIRQ can be faster, but be careful with softirq context */ err =rtrs_cq_qp_create (&sess->s, &con->c,1 , cq_vector, cq_size, - wr_queue_size,IB_POLL_WORKQUEUE ); + wr_queue_size, wr_queue_size, +IB_POLL_WORKQUEUE );if (err) {rtrs_err (s,"rtrs_cq_qp_create(), err: %d\n" , err); goto free_con;
drivers/infiniband/ulp/rtrs/rtrs.c +8 -6
@@ -231,14 +231,14 @@ static int create_cq(struct rtrs_con *con, int cq_vector, u16 cq_size, }static int create_qp (struct rtrs_con *con,struct ib_pd *pd, -u16 wr_queue_size,u32 max_sge) +u32 max_send_wr,u32 max_recv_wr,u32 max_sge) {struct ib_qp_init_attr init_attr = {NULL };struct rdma_cm_id *cm_id = con->cm_id;int ret; - init_attr.cap.max_send_wr = wr_queue_size; - init_attr.cap.max_recv_wr = wr_queue_size; + init_attr.cap.max_send_wr = max_send_wr; + init_attr.cap.max_recv_wr = max_recv_wr; init_attr.cap.max_recv_sge =1 ; init_attr.event_handler = qp_event_handler; init_attr.qp_context = con;
@@ -260,8 +260,9 @@ static int create_qp(struct rtrs_con *con, struct ib_pd *pd, }int rtrs_cq_qp_create (struct rtrs_sess *sess,struct rtrs_con *con, -u32 max_send_sge,int cq_vector,u16 cq_size, -u16 wr_queue_size,enum ib_poll_context poll_ctx) +u32 max_send_sge,int cq_vector,int cq_size, +u32 max_send_wr,u32 max_recv_wr, +enum ib_poll_context poll_ctx) {int err;
@@ -269,7 +270,8 @@ int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con,if (err)return err; - err =create_qp (con, sess->dev->ib_pd, wr_queue_size, max_send_sge); + err =create_qp (con, sess->dev->ib_pd, max_send_wr, max_recv_wr, + max_send_sge);if (err) {ib_free_cq (con->cq); con->cq =NULL ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 339/775 RDMA/rtrs-srv: Release lock before call into close_sess
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 99f0c3807973359bba8f37d9198eea59fe38c32a ]
In this error case, we don't need hold mutex to call close_sess.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -1
@@ -1863,8 +1863,8 @@ reject_w_econnreset:return rtrs_rdma_do_reject (cm_id, -ECONNRESET ); close_and_return_err: -close_sess (sess);mutex_unlock (&srv->paths_mutex); +close_sess (sess);return err; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 340/775 RDMA/rtrs-srv: Use sysfs_remove_file_self for disconnect
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit f991fdac813f1598a9bb17b602ce04812ba9148c ]
Remove self first to avoid deadlock, we don't want to use close_work to remove sess sysfs.
--- drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +2 -0
@@ -51,6 +51,8 @@ static ssize_t rtrs_srv_disconnect_store(struct kobject *kobj,sockaddr_to_str ((struct sockaddr *)&sess->s.dst_addr, str,sizeof (str));rtrs_info (s,"disconnect for path %s requested\n" , str); +/* first remove sysfs itself to avoid deadlock */ +sysfs_remove_file_self (&sess->kobj, &attr->attr);close_sess (sess);return count;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 341/775 RDMA/rtrs-clt: Set mininum limit when create QP
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit f47e4e3e71724f625958b0059f6c8ac5d44d27ef ]
Currently rtrs when create_qp use a coarse numbers (bigger in general), which leads to hardware create more resources which only waste memory with no benefits.
- SERVICE con,
For max_send_wr/max_recv_wr, it's 2 times SERVICE_CON_QUEUE_DEPTH + 2
- IO con
For max_send_wr/max_recv_wr, it's sess->queue_depth * 3 + 1
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +12 -7
@@ -1511,7 +1511,7 @@ static void destroy_con(struct rtrs_clt_con *con)static int create_con_cq_qp (struct rtrs_clt_con *con) {struct rtrs_clt_sess *sess =to_clt_sess (con->c.sess); -u32 wr_queue_size; +u32 max_send_wr, max_recv_wr, cq_size;int err, cq_vector;struct rtrs_msg_rkey_rsp *rsp;
@@ -1523,7 +1523,8 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)* + 2 for drain and heartbeat * in case qp gets into error state */ - wr_queue_size =SERVICE_CON_QUEUE_DEPTH *3 +2 ; + max_send_wr =SERVICE_CON_QUEUE_DEPTH *2 +2 ; + max_recv_wr =SERVICE_CON_QUEUE_DEPTH *2 +2 ;/* We must be the first here */ if (WARN_ON (sess->s.dev))return -EINVAL ;
@@ -1555,25 +1556,29 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)/* Shared between connections */ sess->s.dev_ref++; - wr_queue_size = + max_send_wr =min_t (int, sess->s.dev->ib_dev->attrs.max_qp_wr,/* QD * (REQ + RSP + FR REGS or INVS) + drain */ sess->queue_depth *3 +1 ); + max_recv_wr = +min_t (int, sess->s.dev->ib_dev->attrs.max_qp_wr, + sess->queue_depth *3 +1 ); }/* alloc iu to recv new rkey reply when server reports flags set */ if (sess->flags ==RTRS_MSG_NEW_RKEY_F || con->c.cid ==0 ) { - con->rsp_ius =rtrs_iu_alloc (wr_queue_size,sizeof (*rsp), + con->rsp_ius =rtrs_iu_alloc (max_recv_wr,sizeof (*rsp),GFP_KERNEL , sess->s.dev->ib_dev,DMA_FROM_DEVICE , rtrs_clt_rdma_done);if (!con->rsp_ius)return -ENOMEM ; - con->queue_size = wr_queue_size; + con->queue_size = max_recv_wr; } + cq_size = max_send_wr + max_recv_wr; cq_vector = con->cpu % sess->s.dev->ib_dev->num_comp_vectors; err =rtrs_cq_qp_create (&sess->s, &con->c, sess->max_send_sge, - cq_vector, wr_queue_size, wr_queue_size, - wr_queue_size,IB_POLL_SOFTIRQ ); + cq_vector, cq_size, max_send_wr, + max_recv_wr,IB_POLL_SOFTIRQ );/* * In case of error we do not bother to clean previous allocations, * since destroy_con_cq_qp() must be called.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 342/775 RDMA/rtrs-srv: Jump to dereg_mr label if allocate iu fails
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit f77c4839ee8f4612dcb6601602329096030bd813 ]
The rtrs_iu_free is called in rtrs_iu_alloc if memory is limited, so we don't need to free the same iu again.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -2
@@ -651,7 +651,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess)if (!srv_mr->iu) { err = -ENOMEM ;rtrs_err (ss,"rtrs_iu_alloc(), err: %d\n" , err); - goto free_iu; + goto dereg_mr; } }/* Eventually dma addr for each chunk can be cached */
@@ -667,7 +667,6 @@ err: srv_mr = &sess->mrs[mri]; sgt = &srv_mr->sgt; mr = srv_mr->mr; -free_iu:rtrs_iu_free (srv_mr->iu, sess->s.dev->ib_dev,1 ); dereg_mr:ib_dereg_mr (mr);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 343/775 RDMA/rtrs: Call kobject_put in the failure path
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit 424774c9f3fa100ef7d9cfb9ee211e2ba1cd5119 ]
Per the comment of kobject_init_and_add, we need to free the memory by call kobject_put.
--- drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 2 ++ drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c +2 -0
@@ -408,6 +408,7 @@ int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess) "%s", str);if (err) {pr_err ("kobject_init_and_add: %d\n" , err); +kobject_put (&sess->kobj);return err; } err =sysfs_create_group (&sess->kobj, &rtrs_clt_sess_attr_group);
@@ -419,6 +420,7 @@ int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess) &sess->kobj, "stats");if (err) {pr_err ("kobject_init_and_add: %d\n" , err); +kobject_put (&sess->stats->kobj_stats); goto remove_group; }
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +2 -1
@@ -236,6 +236,7 @@ static int rtrs_srv_create_stats_files(struct rtrs_srv_sess *sess) &sess->kobj, "stats");if (err) {rtrs_err (s,"kobject_init_and_add(): %d\n" , err); +kobject_put (&sess->stats->kobj_stats);return err; } err = sysfs_create_group(&sess->stats->kobj_stats,
@@ -292,8 +293,8 @@ remove_group:sysfs_remove_group (&sess->kobj, &rtrs_srv_sess_attr_group); put_kobj:kobject_del (&sess->kobj); -kobject_put (&sess->kobj); destroy_root: +kobject_put (&sess->kobj);rtrs_srv_destroy_once_sysfs_root_folders (sess);return err;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 344/775 RDMA/rtrs-srv: Fix missing wr_cqe
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 8537f2de6519945890a2b0f3739b23f32b5c0a89 ]
We had a few places wr_cqe is not set, which could lead to NULL pointer deref or GPF in error case.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +5 -0
@@ -267,6 +267,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)WARN_ON_ONCE (rkey != wr->rkey); wr->wr.opcode =IB_WR_RDMA_WRITE ; + wr->wr.wr_cqe = &io_comp_cqe; wr->wr.ex.imm_data =0 ; wr->wr.send_flags =0 ;
@@ -294,6 +295,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id) inv_wr.sg_list =NULL ; inv_wr.num_sge =0 ; inv_wr.opcode =IB_WR_SEND_WITH_INV ; + inv_wr.wr_cqe = &io_comp_cqe; inv_wr.send_flags =0 ; inv_wr.ex.invalidate_rkey = rkey; }
@@ -304,6 +306,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id) srv_mr = &sess->mrs[id->msg_id]; rwr.wr.opcode =IB_WR_REG_MR ; + rwr.wr.wr_cqe = &local_reg_cqe; rwr.wr.num_sge =0 ; rwr.mr = srv_mr->mr; rwr.wr.send_flags =0 ;
@@ -379,6 +382,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id,if (need_inval) {if (likely (sg_cnt)) { + inv_wr.wr_cqe = &io_comp_cqe; inv_wr.sg_list =NULL ; inv_wr.num_sge =0 ; inv_wr.opcode =IB_WR_SEND_WITH_INV ;
@@ -421,6 +425,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id, srv_mr = &sess->mrs[id->msg_id]; rwr.wr.next = &imm_wr; rwr.wr.opcode =IB_WR_REG_MR ; + rwr.wr.wr_cqe = &local_reg_cqe; rwr.wr.num_sge =0 ; rwr.wr.send_flags =0 ; rwr.mr = srv_mr->mr;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 345/775 RDMA/rtrs-clt: Refactor the failure cases in alloc_clt
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit eab098246625e91c1cbd6e8f75b09e4c9c28a9fc ]
Make all failure cases go to the common path to avoid duplicate code. And some issued existed before.
1. clt need to be freed to avoid memory leak.
2. return ERR_PTR(-ENOMEM) if kobject_create_and_add fails, because rtrs_clt_open checks the return value of by call "IS_ERR(clt)".
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +12 -13
@@ -2570,11 +2570,8 @@ static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num, clt->dev.class = rtrs_clt_dev_class; clt->dev.release = rtrs_clt_dev_release; err =dev_set_name (&clt->dev,"%s" , sessname); -if (err) { -free_percpu (clt->pcpu_path); -kfree (clt); -return ERR_PTR (err); - } +if (err) + goto err;/* * Suppress user space notification until * sysfs files are created
@@ -2582,29 +2579,31 @@ static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num,dev_set_uevent_suppress (&clt->dev, true); err =device_register (&clt->dev);if (err) { -free_percpu (clt->pcpu_path);put_device (&clt->dev); -return ERR_PTR (err); + goto err; } clt->kobj_paths =kobject_create_and_add ("paths" , &clt->dev.kobj);if (!clt->kobj_paths) { -free_percpu (clt->pcpu_path); -device_unregister (&clt->dev); -return NULL ; + err = -ENOMEM ; + goto err_dev; } err =rtrs_clt_create_sysfs_root_files (clt);if (err) { -free_percpu (clt->pcpu_path);kobject_del (clt->kobj_paths);kobject_put (clt->kobj_paths); -device_unregister (&clt->dev); -return ERR_PTR (err); + goto err_dev; }dev_set_uevent_suppress (&clt->dev, false);kobject_uevent (&clt->dev.kobj,KOBJ_ADD );return clt; +err_dev: +device_unregister (&clt->dev); +err: +free_percpu (clt->pcpu_path); +kfree (clt); +return ERR_PTR (err); }static void wait_for_inflight_permits (struct rtrs_clt *clt)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 346/775 RDMA/rtrs-srv: Init wr_cnt as 1
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 6f5d1b3016d650f351e65c645a5eee5394547dd0 ]
Fix up wr_avail accounting. if wr_cnt is 0, then we do SIGNAL for first wr, in completion we add queue_depth back, which is not right in the sense of tracking for available wr.
So fix it by init wr_cnt to 1.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -1
@@ -1604,7 +1604,7 @@ static int create_con(struct rtrs_srv_sess *sess, con->c.cm_id = cm_id; con->c.sess = &sess->s; con->c.cid = cid; -atomic_set (&con->wr_cnt,0 ); +atomic_set (&con->wr_cnt,1 );if (con->c.cid ==0 ) {/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 347/775 RDMA/rtrs: Fix KASAN: stack-out-of-bounds bug
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 7fbc3c373eefc291ff96d48496106c106b7f81c6 ]
When KASAN is enabled, we notice warning below:
[ 483.436975] ================================================================== [ 483.437234] BUG: KASAN: stack-out-of-bounds in _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] [ 483.437430] Read of size 4 at addr ffff88a195fd7d30 by task kworker/1:3/6954
[ 483.437731] CPU: 1 PID: 6954 Comm: kworker/1:3 Kdump: loaded Tainted: G O 5.4.82-pserver #5.4.82-1+feature+linux+5.4.y+dbg+20201210.1532+987e7a6~deb10 [ 483.437976] Hardware name: Supermicro Super Server/X11DDW-L, BIOS 3.3 02/21/2020 [ 483.438168] Workqueue: rtrs_server_wq hb_work [rtrs_core] [ 483.438323] Call Trace: [ 483.438486] dump_stack+0x96/0xe0 [ 483.438646] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] [ 483.438802] print_address_description.constprop.6+0x1b/0x220 [ 483.438966] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] [ 483.439133] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] [ 483.439285] __kasan_report.cold.9+0x1a/0x32 [ 483.439444] ? _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] [ 483.439597] kasan_report+0x10/0x20 [ 483.439752] _mlx5_ib_post_send+0x188a/0x2560 [mlx5_ib] [ 483.439910] ? update_sd_lb_stats+0xfb1/0xfc0 [ 483.440073] ? set_reg_wr+0x520/0x520 [mlx5_ib] [ 483.440222] ? update_group_capacity+0x340/0x340 [ 483.440377] ? find_busiest_group+0x314/0x870 [ 483.440526] ? update_sd_lb_stats+0xfc0/0xfc0 [ 483.440683] ? __bitmap_and+0x6f/0x100 [ 483.440832] ? __lock_acquire+0xa2/0x2150 [ 483.440979] ? __lock_acquire+0xa2/0x2150 [ 483.441128] ? __lock_acquire+0xa2/0x2150 [ 483.441279] ? debug_lockdep_rcu_enabled+0x23/0x60 [ 483.441430] ? lock_downgrade+0x390/0x390 [ 483.441582] ? __lock_acquire+0xa2/0x2150 [ 483.441729] ? __lock_acquire+0xa2/0x2150 [ 483.441876] ? newidle_balance+0x425/0x8f0 [ 483.442024] ? __lock_acquire+0xa2/0x2150 [ 483.442172] ? debug_lockdep_rcu_enabled+0x23/0x60 [ 483.442330] hb_work+0x15d/0x1d0 [rtrs_core] [ 483.442479] ? schedule_hb+0x50/0x50 [rtrs_core] [ 483.442627] ? lock_downgrade+0x390/0x390 [ 483.442781] ? process_one_work+0x40d/0xa50 [ 483.442931] process_one_work+0x4ee/0xa50 [ 483.443082] ? pwq_dec_nr_in_flight+0x110/0x110 [ 483.443231] ? do_raw_spin_lock+0x119/0x1d0 [ 483.443383] worker_thread+0x65/0x5c0 [ 483.443532] ? process_one_work+0xa50/0xa50 [ 483.451839] kthread+0x1e2/0x200 [ 483.451983] ? kthread_create_on_node+0xc0/0xc0 [ 483.452139] ret_from_fork+0x3a/0x50
The problem is we use wrong type when send wr, hw driver expect the type of IB_WR_RDMA_WRITE_WITH_IMM wr should be ib_rdma_wr, and doing container_of to access member. The fix is simple use ib_rdma_wr instread of ib_send_wr.
--- drivers/infiniband/ulp/rtrs/rtrs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs.c +7 -7
@@ -182,16 +182,16 @@ int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con, struct ib_cqe *cqe, u32 imm_data, enum ib_send_flags flags, struct ib_send_wr *head) { - struct ib_send_wr wr; + struct ib_rdma_wr wr; - wr = (struct ib_send_wr ) { - .wr_cqe = cqe, - .send_flags = flags, - .opcode =IB_WR_RDMA_WRITE_WITH_IMM , - .ex.imm_data =cpu_to_be32 (imm_data), + wr = (struct ib_rdma_wr ) { + .wr.wr_cqe = cqe, + .wr.send_flags = flags, + .wr.opcode =IB_WR_RDMA_WRITE_WITH_IMM , + .wr.ex.imm_data =cpu_to_be32 (imm_data), }; -return rtrs_post_send (con->qp, head, &wr); +return rtrs_post_send (con->qp, head, &wr.wr); }EXPORT_SYMBOL_GPL (rtrs_post_rdma_write_imm_empty);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 348/775 power: reset: at91-sama5d2_shdwc: fix wkupdbc mask
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 95aa21a3f1183260db1b0395e03df5bebc5ed641 ]
According to datasheet WKUPDBC mask is b/w bits 26..24.
--- drivers/power/reset/at91-sama5d2_shdwc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/reset/at91-sama5d2_shdwc.c +1 -1
@@ -37,7 +37,7 @@#define AT91_SHDW_MR 0x04/* Shut Down Mode Register */ #define AT91_SHDW_WKUPDBC_SHIFT 24 -#define AT91_SHDW_WKUPDBC_MASK GENMASK(31, 16) +#define AT91_SHDW_WKUPDBC_MASK GENMASK(26, 24)#define AT91_SHDW_WKUPDBC (x) (((x) << AT91_SHDW_WKUPDBC_SHIFT) \ & AT91_SHDW_WKUPDBC_MASK)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 349/775 rtc: s5m: select REGMAP_I2C
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit 1f0cbda3b452b520c5f3794f8f0e410e8bc7386a ]
The rtc-s5m uses the I2C regmap but doesn't select it in Kconfig so depending on the configuration the build may fail. Fix it.
--- drivers/rtc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/Kconfig +1 -0
@@ -692,6 +692,7 @@ config RTC_DRV_S5M tristate "Samsung S2M/S5M series" depends on MFD_SEC_CORE || COMPILE_TEST select REGMAP_IRQ + select REGMAP_I2C help If you say yes here you will get support for the RTC of Samsung S2MPS14 and S5M PMIC series.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 350/775 dmaengine: idxd: set DMA channel to be private
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit c06e424be5f5184468c5f761c0d2cf1ed0a4e0fc ]
Add DMA_PRIVATE attribute flag to idxd DMA channels. The dedicated WQs are expected to be used by a single client and not shared. While doing NTB testing this mistake was discovered, which prevented ntb_transport from requesting DSA wqs as DMA channels via dma_request_channel().
--- drivers/dma/idxd/dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/idxd/dma.c +1 -0
@@ -165,6 +165,7 @@ int idxd_register_dma_device(struct idxd_device *idxd)INIT_LIST_HEAD (&dma->channels); dma->dev = &idxd->pdev->dev; +dma_cap_set (DMA_PRIVATE , dma->cap_mask);dma_cap_set (DMA_COMPLETION_NO_ORDER , dma->cap_mask); dma->device_release = idxd_dma_release;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 351/775 power: supply: fix sbs-charger build, needs REGMAP_I2C
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit a4bdea2004b28f47ab48ea99172eda8628f6fb44 ]
CHARGER_SBS should select REGMAP_I2C since it uses API(s) that are provided by that Kconfig symbol.
Fixes these errors:
../drivers/power/supply/sbs-charger.c:149:21: error: variable ‘sbs_regmap’ has initializer but incomplete type
static const struct regmap_config sbs_regmap = {../drivers/power/supply/sbs-charger.c:150:3: error: ‘const struct regmap_config’ has no member named ‘reg_bits’
.reg_bits = 8,../drivers/power/supply/sbs-charger.c:155:23: error: ‘REGMAP_ENDIAN_LITTLE’ undeclared here (not in a function)
.val_format_endian = REGMAP_ENDIAN_LITTLE, /* since based on SMBus */../drivers/power/supply/sbs-charger.c: In function ‘sbs_probe’:../drivers/power/supply/sbs-charger.c:183:17: error: implicit declaration of function ‘devm_regmap_init_i2c’; did you mean ‘devm_request_irq’? [-Werror=implicit-function-declaration]
chip->regmap = devm_regmap_init_i2c(client, &sbs_regmap);../drivers/power/supply/sbs-charger.c: At top level:../drivers/power/supply/sbs-charger.c:149:35: error: storage size of ‘sbs_regmap’ isn’t known
static const struct regmap_config sbs_regmap = {
--- drivers/power/supply/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/Kconfig +1 -0
@@ -229,6 +229,7 @@ config BATTERY_SBS config CHARGER_SBS tristate "SBS Compliant charger" depends on I2C + select REGMAP_I2C help Say Y to include support for SBS compliant battery chargers.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 352/775 clocksource/drivers/ixp4xx: Select TIMER_OF when needed
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7a3b8758bd6e45f7b671723b5c9fa2b69d0787ae ]
Compile-testing the ixp4xx timer with CONFIG_OF enabled but CONFIG_TIMER_OF disabled leads to a harmless warning:
arm-linux-gnueabi-ld: warning: orphan section __timer_of_table' from drivers/clocksource/timer-ixp4xx.o' being placed in section `__timer_of_table'
Move the select statement from the platform code into the driver so it always gets enabled in configurations that rely on it.
--- arch/arm/mach-ixp4xx/Kconfig | 1 - drivers/clocksource/Kconfig | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-ixp4xx/Kconfig +0 -1
@@ -13,7 +13,6 @@ config MACH_IXP4XX_OF select I2C select I2C_IOP3XX select PCI - select TIMER_OF select USE_OF help Say 'Y' here to support Device Tree-based IXP4xx platforms.
drivers/clocksource/Kconfig +1 -0
@@ -79,6 +79,7 @@ config IXP4XX_TIMER bool "Intel XScale IXP4xx timer driver" if COMPILE_TEST depends on HAS_IOMEM select CLKSRC_MMIO + select TIMER_OF if OF help Enables support for the Intel XScale IXP4xx SoC timer.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 353/775 clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 7da390694afbaed8e0f05717a541dfaf1077ba51 ]
When DEBUG is defined this error occurs
drivers/clocksource/mxs_timer.c:138:1: error:
expected ‘;’ before ‘}’ token
The preceding statement needs a semicolon.
Replace pr_info() with pr_debug() and remove the unneeded ifdef.
--- drivers/clocksource/mxs_timer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clocksource/mxs_timer.c +1 -4
@@ -131,10 +131,7 @@ static void mxs_irq_clear(char *state)/* Clear pending interrupt */ timrot_irq_acknowledge (); - -#ifdef DEBUG - pr_info("%s: changing mode to %s\n", __func__, state) -#endif /* DEBUG */ +pr_debug ("%s: changing mode to %s\n" , __func__, state); }static int mxs_shutdown (struct clock_event_device *evt)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 354/775 module: harden ELF info handling
In reply to Greg Kroah-HartmanFrom: Frank van der Linden <[email protected]>
[ Upstream commit ec2a29593c83ed71a7f16e3243941ebfcf75fdf6 ]
5fdc7db644 ("module: setup load info before module_sig_check()") moved the ELF setup, so that it was done before the signature check. This made the module name available to signature error messages.
However, the checks for ELF correctness in setup_load_info are not sufficient to prevent bad memory references due to corrupted offset fields, indices, etc.
So, there's a regression in behavior here: a corrupt and unsigned (or badly signed) module, which might previously have been rejected immediately, can now cause an oops/crash.
Harden ELF handling for module loading by doing the following:
- Move the signature check back up so that it comes before ELF initialization. It's best to do the signature check to see if we can trust the module, before using the ELF structures inside it. This also makes checks against info->len more accurate again, as this field will be reduced by the length of the signature in mod_check_sig().
The module name is now once again not available for error messages during the signature check, but that seems like a fair tradeoff.
- Check if sections have offset / size fields that at least don't exceed the length of the module.
- Check if sections have section name offsets that don't fall outside the section name table.
- Add a few other sanity checks against invalid section indices, etc.
This is not an exhaustive consistency check, but the idea is to at least get through the signature and blacklist checks without crashing because of corrupted ELF info, and to error out gracefully for most issues that would have caused problems later on.
--- kernel/module.c | 143 +++++++++++++++++++++++++++++++++----- kernel/module_signature.c | 2 +- kernel/module_signing.c | 2 +- 3 files changed, 126 insertions(+), 21 deletions(-)
kernel/module.c +124 -19
@@ -2964,7 +2964,7 @@ static int module_sig_check(struct load_info *info, int flags) }if (is_module_sig_enforced ()) { -pr_notice ("%s: loading of %s is rejected\n" , info->name, reason); +pr_notice ("Loading of %s is rejected\n" , reason);return -EKEYREJECTED ; }
@@ -2977,9 +2977,33 @@ static int module_sig_check(struct load_info *info, int flags) }#endif /* !CONFIG_MODULE_SIG */ -/* Sanity checks against invalid binaries, wrong arch, weird elf version. */ -static int elf_header_check (struct load_info *info) +static int validate_section_offset (struct load_info *info,Elf_Shdr *shdr) { +unsigned long secend; + +/* +* Check for both overflow and offset/size being +* too large. +*/ + secend = shdr->sh_offset + shdr->sh_size; +if (secend < shdr->sh_offset || secend > info->len) +return -ENOEXEC ; + +return 0 ; +} + +/* +* Sanity checks against invalid binaries, wrong arch, weird elf version. +* +* Also do basic validity checks against section offsets and sizes, the +* section name string table, and the indices used for it (sh_name). +*/ +static int elf_validity_check (struct load_info *info) +{ +unsigned int i; +Elf_Shdr *shdr, *strhdr; +int err; +if (info->len <sizeof (*(info->hdr)))return -ENOEXEC ;
@@ -2989,11 +3013,78 @@ static int elf_header_check(struct load_info *info) || info->hdr->e_shentsize != sizeof(Elf_Shdr))return -ENOEXEC ; +/* +* e_shnum is 16 bits, and sizeof(Elf_Shdr) is +* known and small. So e_shnum * sizeof(Elf_Shdr) +* will not overflow unsigned long on any platform. +*/ if (info->hdr->e_shoff >= info->len || (info->hdr->e_shnum *sizeof (Elf_Shdr) > info->len - info->hdr->e_shoff))return -ENOEXEC ; + info->sechdrs = (void *)info->hdr + info->hdr->e_shoff; + +/* +* Verify if the section name table index is valid. +*/ +if (info->hdr->e_shstrndx ==SHN_UNDEF + || info->hdr->e_shstrndx >= info->hdr->e_shnum) +return -ENOEXEC ; + + strhdr = &info->sechdrs[info->hdr->e_shstrndx]; + err =validate_section_offset (info, strhdr); +if (err <0 ) +return err; + +/* +* The section name table must be NUL-terminated, as required +* by the spec. This makes strcmp and pr_* calls that access +* strings in the section safe. +*/ + info->secstrings = (void *)info->hdr + strhdr->sh_offset; +if (info->secstrings[strhdr->sh_size -1 ] !='\0' ) +return -ENOEXEC ; + +/* +* The code assumes that section 0 has a length of zero and +* an addr of zero, so check for it. +*/ +if (info->sechdrs[0 ].sh_type !=SHT_NULL + || info->sechdrs[0 ].sh_size !=0 + || info->sechdrs[0 ].sh_addr !=0 ) +return -ENOEXEC ; + +for (i =1 ; i < info->hdr->e_shnum; i++) { + shdr = &info->sechdrs[i]; +switch (shdr->sh_type) { +case SHT_NULL : +case SHT_NOBITS : +continue ; +case SHT_SYMTAB : +if (shdr->sh_link ==SHN_UNDEF + || shdr->sh_link >= info->hdr->e_shnum) +return -ENOEXEC ; + fallthrough; +default : + err =validate_section_offset (info, shdr); +if (err <0 ) { +pr_err ("Invalid ELF section in module (section %u type %u)\n" , + i, shdr->sh_type); +return err; + } + +if (shdr->sh_flags &SHF_ALLOC ) { +if (shdr->sh_name >= strhdr->sh_size) { +pr_err ("Invalid ELF section name in module (section %u type %u)\n" , + i, shdr->sh_type); +return -ENOEXEC ; + } + } +break ; + } + } +return 0 ; }
@@ -3095,11 +3186,6 @@ static int rewrite_section_headers(struct load_info *info, int flags)for (i =1 ; i < info->hdr->e_shnum; i++) {Elf_Shdr *shdr = &info->sechdrs[i]; -if (shdr->sh_type !=SHT_NOBITS - && info->len < shdr->sh_offset + shdr->sh_size) { -pr_err ("Module len %lu truncated\n" , info->len); -return -ENOEXEC ; - }/* * Mark all sections sh_addr with their address in the
@@ -3133,11 +3219,6 @@ static int setup_load_info(struct load_info *info, int flags) {unsigned int i; -/* Set up the convenience variables */ - info->sechdrs = (void *)info->hdr + info->hdr->e_shoff; - info->secstrings = (void *)info->hdr - + info->sechdrs[info->hdr->e_shstrndx].sh_offset; -/* Try to find a name early so we can log errors with a module name */ info->index.info =find_sec (info,".modinfo" );if (info->index.info)
@@ -3894,26 +3975,50 @@ static int load_module(struct load_info *info, const char __user *uargs,long err =0 ;char *after_dashes; - err =elf_header_check (info); +/* +* Do the signature check (if any) first. All that +* the signature check needs is info->len, it does +* not need any of the section info. That can be +* set up later. This will minimize the chances +* of a corrupt module causing problems before +* we even get to the signature check. +* +* The check will also adjust info->len by stripping +* off the sig length at the end of the module, making +* checks against info->len more correct. +*/ + err =module_sig_check (info, flags); +if (err) + goto free_copy; + +/* +* Do basic sanity checks against the ELF header and +* sections. +*/ + err =elf_validity_check (info);if (err) { -pr_err ("Module has invalid ELF header\n" ); +pr_err ("Module has invalid ELF structures\n" ); goto free_copy; } +/* +* Everything checks out, so set up the section info +* in the info structure. +*/ err =setup_load_info (info, flags);if (err) goto free_copy; +/* +* Now that we know we have the correct module name, check +* if it's blacklisted. +*/ if (blacklisted (info->name)) { err = -EPERM ;pr_err ("Module %s is blacklisted\n" , info->name); goto free_copy; } - err =module_sig_check (info, flags); -if (err) - goto free_copy; - err =rewrite_section_headers (info, flags);if (err) goto free_copy;
kernel/module_signature.c +1 -1
@@ -25,7 +25,7 @@ int mod_check_sig(const struct module_signature *ms, size_t file_len,return -EBADMSG ;if (ms->id_type !=PKEY_ID_PKCS7 ) { -pr_err ("%s: Module is not signed with expected PKCS#7 message\n" , +pr_err ("%s: not signed with expected PKCS#7 message\n" , name);return -ENOPKG ; }
kernel/module_signing.c +1 -1
@@ -30,7 +30,7 @@ int mod_verify_sig(const void *mod, struct load_info *info)memcpy (&ms, mod + (modlen -sizeof (ms)),sizeof (ms)); - ret =mod_check_sig (&ms, modlen, info->name); + ret =mod_check_sig (&ms, modlen,"module" );if (ret)return ret;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 355/775 spi: imx: Dont print error on -EPROBEDEFER
In reply to Greg Kroah-HartmanFrom: Guido Günther <[email protected]>
[ Upstream commit 8346633f2c87713a1852d802305e03555e9a9fce ]
This avoids
[ 0.962538] spi_imx 30820000.spi: bitbang start failed with -517
durig driver probe.
--- drivers/spi/spi-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-imx.c +1 -1
@@ -1685,7 +1685,7 @@ static int spi_imx_probe(struct platform_device *pdev) master->dev.of_node = pdev->dev.of_node; ret =spi_bitbang_start (&spi_imx->bitbang);if (ret) { -dev_err (&pdev->dev,"bitbang start failed with %d\n" , ret); +dev_err_probe (&pdev->dev, ret,"bitbang start failed\n" ); goto out_bitbang_start; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 356/775 RDMA/mlx5: Use the correct obj_id upon DEVX TIR creation
In reply to Greg Kroah-HartmanFrom: Yishai Hadas <[email protected]>
[ Upstream commit 8798e4ad0abe0ba1221928a46561981c510be0c6 ]
Use the correct obj_id upon DEVX TIR creation by strictly taking the tirn 24 bits and not the general obj_id which is 32 bits.
--- drivers/infiniband/hw/mlx5/devx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/devx.c +3 -1
@@ -1064,7 +1064,9 @@ static void devx_obj_build_destroy_cmd(void *in, void *out, void *din,MLX5_SET (general_obj_in_cmd_hdr, din, opcode,MLX5_CMD_OP_DESTROY_RQT );break ;case MLX5_CMD_OP_CREATE_TIR : -MLX5_SET (general_obj_in_cmd_hdr, din, opcode,MLX5_CMD_OP_DESTROY_TIR ); + *obj_id =MLX5_GET (create_tir_out, out, tirn); +MLX5_SET (destroy_tir_in, din, opcode,MLX5_CMD_OP_DESTROY_TIR ); +MLX5_SET (destroy_tir_in, din, tirn, *obj_id);break ;case MLX5_CMD_OP_CREATE_TIS :MLX5_SET (general_obj_in_cmd_hdr, din, opcode,MLX5_CMD_OP_DESTROY_TIS );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 357/775 IB/mlx5: Add mutex destroy call to cap_mask_mutex mutex
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit ab40530a2e0a7aca9a5187824c4fb072f3916e85 ]
mutex_destroy() call for device's cap_mask_mutex mutex is missing, let's add it to annotate destruction.
--- drivers/infiniband/hw/mlx5/main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/infiniband/hw/mlx5/main.c +5 -6
@@ -3927,7 +3927,7 @@ static void mlx5_ib_stage_init_cleanup(struct mlx5_ib_dev *dev)mlx5_ib_cleanup_multiport_master (dev);WARN_ON (!xa_empty (&dev->odp_mkeys));cleanup_srcu_struct (&dev->odp_srcu); - +mutex_destroy (&dev->cap_mask_mutex);WARN_ON (!xa_empty (&dev->sig_mrs));WARN_ON (!bitmap_empty (dev->dm.memic_alloc_pages,MLX5_MAX_MEMIC_PAGES )); }
@@ -3978,6 +3978,10 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev) dev->ib_dev.dev.parent = mdev->device; dev->ib_dev.lag_flags =RDMA_LAG_FLAGS_HASH_ALL_SLAVES ; + err =init_srcu_struct (&dev->odp_srcu); +if (err) + goto err_mp; +mutex_init (&dev->cap_mask_mutex);INIT_LIST_HEAD (&dev->qp_list);spin_lock_init (&dev->reset_flow_resource_lock);
@@ -3987,11 +3991,6 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)spin_lock_init (&dev->dm.lock); dev->dm.dev = mdev; - - err =init_srcu_struct (&dev->odp_srcu); -if (err) - goto err_mp; -return 0 ; err_mp:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 358/775 clk: sunxi-ng: h6: Fix clock divider range on some clocks
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit 04ef679591c76571a9e7d5ca48316cc86fa0ef12 ]
While comparing clocks between the H6 and H616, some of the M factor ranges were found to be wrong: the manual says they are only covering two bits [1:0], but our code had "5" in the number-of-bits field.
By writing 0xff into that register in U-Boot and via FEL, it could be confirmed that bits [4:2] are indeed masked off, so the manual is right.
Change to number of bits in the affected clock's description.
--- drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/sunxi-ng/ccu-sun50i-h6.c +4 -4
@@ -237,7 +237,7 @@ static const char * const psi_ahb1_ahb2_parents[] = { "osc24M", "osc32k", static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", psi_ahb1_ahb2_parents,0x510 , -0 ,5 ,/* M */ +0 ,2 ,/* M */ 8 ,2 ,/* P */ 24 ,2 ,/* mux */ 0);
@@ -246,19 +246,19 @@ static const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k","psi-ahb1-ahb2" , "pll-periph0" }; static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, -0 ,5 ,/* M */ +0 ,2 ,/* M */ 8 ,2 ,/* P */ 24 ,2 ,/* mux */ 0); static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, -0 ,5 ,/* M */ +0 ,2 ,/* M */ 8 ,2 ,/* P */ 24 ,2 ,/* mux */ 0); static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, -0 ,5 ,/* M */ +0 ,2 ,/* M */ 8 ,2 ,/* P */ 24 ,2 ,/* mux */ 0);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 359/775 platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
In reply to Greg Kroah-HartmanFrom: Evan Benn <[email protected]>
[ Upstream commit 0944ea07baa748741563c8842122010fa9017d16 ]
The host_event_code enum is 1-based, use EC_HOST_EVENT_MASK not BIT to generate the intended mask. This patch changes the behaviour of the mask, a following patch will restore the intended behaviour:
'Add LID and BATTERY to default mask'
--- drivers/platform/chrome/cros_ec_proto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/platform/chrome/cros_ec_proto.c +5 -5
@@ -526,11 +526,11 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)* power), not wake up. */ ec_dev->host_event_wake_mask =U32_MAX & - ~(BIT (EC_HOST_EVENT_AC_DISCONNECTED ) | -BIT (EC_HOST_EVENT_BATTERY_LOW ) | -BIT (EC_HOST_EVENT_BATTERY_CRITICAL ) | -BIT (EC_HOST_EVENT_PD_MCU ) | -BIT (EC_HOST_EVENT_BATTERY_STATUS )); + ~(EC_HOST_EVENT_MASK (EC_HOST_EVENT_AC_DISCONNECTED ) | +EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY_LOW ) | +EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY_CRITICAL ) | +EC_HOST_EVENT_MASK (EC_HOST_EVENT_PD_MCU ) | +EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY_STATUS ));/* * Old ECs may not support this command. Complain about all * other errors.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 360/775 platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask
In reply to Greg Kroah-HartmanFrom: Evan Benn <[email protected]>
[ Upstream commit 852405d8efcbca0e02f14592fb1d1dcd0d3fb508 ]
After 'platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT' some of the flags are not quite correct.LID_CLOSED is used to suspend the device, so it makes sense to ignore that. BATTERY events are also frequent and causing spurious wakes on elm/hana mt8173 devices.
--- drivers/platform/chrome/cros_ec_proto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_proto.c +3 -1
@@ -526,9 +526,11 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)* power), not wake up. */ ec_dev->host_event_wake_mask =U32_MAX & - ~(EC_HOST_EVENT_MASK (EC_HOST_EVENT_AC_DISCONNECTED ) | + ~(EC_HOST_EVENT_MASK (EC_HOST_EVENT_LID_CLOSED ) | +EC_HOST_EVENT_MASK (EC_HOST_EVENT_AC_DISCONNECTED ) |EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY_LOW ) |EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY_CRITICAL ) | +EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY ) |EC_HOST_EVENT_MASK (EC_HOST_EVENT_PD_MCU ) |EC_HOST_EVENT_MASK (EC_HOST_EVENT_BATTERY_STATUS ));/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 361/775 regulator: axp20x: Fix reference cout leak
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit e78bf6be7edaacb39778f3a89416caddfc6c6d70 ]
Decrements the reference count of device node and its child node.
--- drivers/regulator/axp20x-regulator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/axp20x-regulator.c +3 -4
@@ -1070,7 +1070,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)static int axp20x_regulator_parse_dt (struct platform_device *pdev) {struct device_node *np, *regulators; -int ret; +int ret =0 ;u32 dcdcfreq =0 ; np =of_node_get (pdev->dev.parent->of_node);
@@ -1085,13 +1085,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev) ret =axp20x_set_dcdc_freq (pdev, dcdcfreq);if (ret <0 ) {dev_err (&pdev->dev,"Error setting dcdc frequency: %d\n" , ret); -return ret; } -of_node_put (regulators); } -return 0 ; +of_node_put (np); +return ret; }static int axp20x_set_dcdc_workmode (struct regulator_dev *rdev,int id,u32 workmode)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 362/775 watch_queue: Drop references to /dev/watch_queue
In reply to Greg Kroah-HartmanFrom: Gabriel Krisman Bertazi <[email protected]>
[ Upstream commit 8fe62e0c0e2efa5437f3ee81b65d69e70a45ecd2 ]
The merged API doesn't use a watch_queue device, but instead relies on pipes, so let the documentation reflect that.
--- Documentation/security/keys/core.rst | 4 ++-- samples/Kconfig | 2 +- samples/watch_queue/watch_test.c | 2 +- security/keys/Kconfig | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-)
Documentation/security/keys/core.rst +2 -2
@@ -1040,8 +1040,8 @@ The keyctl syscall functions are: "key" is the ID of the key to be watched. - "queue_fd" is a file descriptor referring to an open "/dev/watch_queue" - which manages the buffer into which notifications will be delivered. + "queue_fd" is a file descriptor referring to an open pipe which + manages the buffer into which notifications will be delivered. "filter" is either NULL to remove a watch or a filter specification to indicate what events are required from the key.
samples/Kconfig +1 -1
@@ -210,7 +210,7 @@ config SAMPLE_WATCHDOG depends on CC_CAN_LINK config SAMPLE_WATCH_QUEUE - bool "Build example /dev/watch_queue notification consumer" + bool "Build example watch_queue notification API consumer" depends on CC_CAN_LINK && HEADERS_INSTALL help Build example userspace program to use the new mount_notify(),
samples/watch_queue/watch_test.c +1 -1
@@ -1,5 +1,5 @@// SPDX-License-Identifier: GPL-2.0 -/* Use /dev/watch_queue to watch for notifications. +/* Use watch_queue API to watch for notifications. * * Copyright (C) 2020 Red Hat, Inc. All Rights Reserved. * Written by David Howells ([email protected])
security/keys/Kconfig +4 -4
@@ -119,7 +119,7 @@ config KEY_NOTIFICATIONS bool "Provide key/keyring change notifications" depends on KEYS && WATCH_QUEUE help - This option provides support for getting change notifications on keys - and keyrings on which the caller has View permission. This makes use - of the /dev/watch_queue misc device to handle the notification - buffer and provides KEYCTL_WATCH_KEY to enable/disable watches. + This option provides support for getting change notifications + on keys and keyrings on which the caller has View permission. + This makes use of pipes to handle the notification buffer and + provides KEYCTL_WATCH_KEY to enable/disable watches.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 363/775 certs: Fix blacklist flag type confusion
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4993e1f9479a4161fd7d93e2b8b30b438f00cb0f ]
KEY_FLAG_KEEP is not meant to be passed to keyring_alloc() or key_alloc(), as these only take KEY_ALLOC_* flags. KEY_FLAG_KEEP has the same value as KEY_ALLOC_BYPASS_RESTRICTION, but fortunately only key_create_or_update() uses it. LSMs using the key_alloc hook don't check that flag.
KEY_FLAG_KEEP is then ignored but fortunately (again) the root user cannot write to the blacklist keyring, so it is not possible to remove a key/hash from it.
Fix this by adding a KEY_ALLOC_SET_KEEP flag that tells key_alloc() to set KEY_FLAG_KEEP on the new key. blacklist_init() can then, correctly, pass this to keyring_alloc().
We can also use this in ima_mok_init() rather than setting the flag manually.
Note that this doesn't fix an observable bug with the current implementation but it is required to allow addition of new hashes to the blacklist in the future without making it possible for them to be removed.
--- certs/blacklist.c | 2 +- include/linux/key.h | 1 + security/integrity/ima/ima_mok.c | 5 ++--- security/keys/key.c | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-)
certs/blacklist.c +1 -1
@@ -162,7 +162,7 @@ static int __init blacklist_init(void)KEY_USR_VIEW |KEY_USR_READ |KEY_USR_SEARCH ,KEY_ALLOC_NOT_IN_QUOTA | -KEY_FLAG_KEEP , +KEY_ALLOC_SET_KEEP , NULL, NULL);if (IS_ERR (blacklist_keyring))panic ("Can't allocate system blacklist keyring\n" );
include/linux/key.h +1 -0
@@ -289,6 +289,7 @@ extern struct key *key_alloc(struct key_type *type,#define KEY_ALLOC_BUILT_IN 0x0004/* Key is built into kernel */ #define KEY_ALLOC_BYPASS_RESTRICTION 0x0008/* Override the check on restricted keyrings */ #define KEY_ALLOC_UID_KEYRING 0x0010/* allocating a user or user session keyring */ +#define KEY_ALLOC_SET_KEEP 0x0020/* Set the KEEP flag on the key/keyring */ extern void key_revoke (struct key *key);extern void key_invalidate (struct key *key);
security/integrity/ima/ima_mok.c +2 -3
@@ -38,13 +38,12 @@ __init int ima_mok_init(void) (KEY_POS_ALL & ~KEY_POS_SETATTR ) |KEY_USR_VIEW |KEY_USR_READ |KEY_USR_WRITE |KEY_USR_SEARCH , -KEY_ALLOC_NOT_IN_QUOTA , +KEY_ALLOC_NOT_IN_QUOTA | +KEY_ALLOC_SET_KEEP , restriction, NULL);if (IS_ERR (ima_blacklist_keyring))panic ("Can't allocate IMA blacklist keyring." ); - -set_bit (KEY_FLAG_KEEP , &ima_blacklist_keyring->flags);return 0 ; }device_initcall (ima_mok_init);
security/keys/key.c +2 -0
@@ -303,6 +303,8 @@ struct key *key_alloc(struct key_type *type, const char *desc, key->flags |=1 <<KEY_FLAG_BUILTIN ;if (flags &KEY_ALLOC_UID_KEYRING ) key->flags |=1 <<KEY_FLAG_UID_KEYRING ; +if (flags &KEY_ALLOC_SET_KEEP ) + key->flags |=1 <<KEY_FLAG_KEEP ;#ifdef KEY_DEBUGGING key->magic =KEY_DEBUG_MAGIC ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 364/775 regulator: s5m8767: Fix reference count leak
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit dea6dd2ba63f8c8532addb8f32daf7b89a368a42 ]
Call of_node_put() to drop references of regulators_np and reg_np before returning error code.
--- drivers/regulator/s5m8767.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/regulator/s5m8767.c +5 -2
@@ -573,10 +573,13 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,"s5m8767,pmic-ext-control" ,GPIOD_OUT_HIGH |GPIOD_FLAGS_BIT_NONEXCLUSIVE , "s5m8767"); -if (PTR_ERR (rdata->ext_control_gpiod) == -ENOENT ) +if (PTR_ERR (rdata->ext_control_gpiod) == -ENOENT ) { rdata->ext_control_gpiod =NULL ; -else if (IS_ERR (rdata->ext_control_gpiod)) + }else if (IS_ERR (rdata->ext_control_gpiod)) { +of_node_put (reg_np); +of_node_put (regulators_np);return PTR_ERR (rdata->ext_control_gpiod); + } rdata->id = i; rdata->initdata = of_get_regulator_init_data(
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 365/775 spi: atmel: Put allocated master before return
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 21ea2743f015dbacec1831bdc8afc848db9c2b8c ]
The allocated master is not released. Goto error handling label rather than directly return.
--- drivers/spi/spi-atmel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-atmel.c +1 -1
@@ -1590,7 +1590,7 @@ static int atmel_spi_probe(struct platform_device *pdev)if (ret ==0 ) { as->use_dma = true; }else if (ret == -EPROBE_DEFER ) { -return ret; + goto out_unmap_regs; } }else if (as->caps.has_pdc_support) { as->use_pdc = true;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 366/775 regulator: s5m8767: Drop regulators OF node reference
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit a5872bd3398d0ff2ce4c77794bc7837899c69024 ]
The device node reference obtained with of_get_child_by_name() should be dropped on error paths.
--- drivers/regulator/s5m8767.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/regulator/s5m8767.c +6 -2
@@ -544,14 +544,18 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, rdata =devm_kcalloc (&pdev->dev, pdata->num_regulators,sizeof (*rdata),GFP_KERNEL ); -if (!rdata) +if (!rdata) { +of_node_put (regulators_np);return -ENOMEM ; + } rmode =devm_kcalloc (&pdev->dev, pdata->num_regulators,sizeof (*rmode),GFP_KERNEL ); -if (!rmode) +if (!rmode) { +of_node_put (regulators_np);return -ENOMEM ; + } pdata->regulators = rdata; pdata->opmode = rmode;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 367/775 scsi: libsas: Remove notifier indirection
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 121181f3f839c29d8dd9fdc3cc9babbdc74227f8 ]
LLDDs report events to libsas with .notify_port_event and .notify_phy_event callbacks.
These callbacks are fixed and so there is no reason why the functions cannot be called directly, so do that.
This neatens the code slightly, makes it more obvious, and reduces function pointer usage, which is generally a good thing. Downside is that there are 2x more symbol exports.
[[email protected]: Remove the now unused "sas_ha" local variables]
--- Documentation/scsi/libsas.rst | 9 ++---- drivers/scsi/aic94xx/aic94xx_scb.c | 20 ++++++------- drivers/scsi/hisi_sas/hisi_sas_main.c | 12 +++----- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 3 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +- drivers/scsi/isci/port.c | 7 ++--- drivers/scsi/libsas/sas_event.c | 13 +++------ drivers/scsi/libsas/sas_init.c | 6 ---- drivers/scsi/libsas/sas_internal.h | 1 - drivers/scsi/mvsas/mv_sas.c | 14 ++++----- drivers/scsi/pm8001/pm8001_hwi.c | 40 ++++++++++++-------------- drivers/scsi/pm8001/pm8001_sas.c | 7 ++--- drivers/scsi/pm8001/pm80xx_hwi.c | 35 ++++++++++------------ include/scsi/libsas.h | 7 ++--- 15 files changed, 70 insertions(+), 110 deletions(-)
Documentation/scsi/libsas.rst +3 -6
@@ -189,12 +189,9 @@ num_phys The event interface:: /* LLDD calls these to notify the class of an event. */ - void (*notify_port_event)(struct sas_phy *, enum port_event); - void (*notify_phy_event)(struct sas_phy *, enum phy_event); - -When sas_register_ha() returns, those are set and can be -called by the LLDD to notify the SAS layer of such events -the SAS layer. + void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event); + void sas_notify_port_event(struct sas_phy *, enum port_event); + void sas_notify_phy_event(struct sas_phy *, enum phy_event); The port notification::
drivers/scsi/aic94xx/aic94xx_scb.c +9 -11
@@ -68,7 +68,6 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb, struct done_list_struct *dl) {struct asd_ha_struct *asd_ha = ascb->ha; -struct sas_ha_struct *sas_ha = &asd_ha->sas_ha;int phy_id = dl->status_block[0 ] &DL_PHY_MASK ;struct asd_phy *phy = &asd_ha->phys[phy_id];
@@ -81,7 +80,7 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb,ASD_DPRINTK ("phy%d: device unplugged\n" , phy_id);asd_turn_led (asd_ha, phy_id,0 );sas_phy_disconnected (&phy->sas_phy); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); +sas_notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL );break ;case CURRENT_OOB_DONE :/* hot plugged device */
@@ -89,12 +88,12 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb,get_lrate_mode (phy, oob_mode);ASD_DPRINTK ("phy%d device plugged: lrate:0x%x, proto:0x%x\n" , phy_id, phy->sas_phy.linkrate, phy->sas_phy.iproto); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE );break ;case CURRENT_SPINUP_HOLD :/* hot plug SATA, no COMWAKE sent */ asd_turn_led (asd_ha, phy_id,1 ); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_SPINUP_HOLD ); +sas_notify_phy_event (&phy->sas_phy,PHYE_SPINUP_HOLD );break ;case CURRENT_GTO_TIMEOUT :case CURRENT_OOB_ERROR :
@@ -102,7 +101,7 @@ static void asd_phy_event_tasklet(struct asd_ascb *ascb, dl->status_block[1]);asd_turn_led (asd_ha, phy_id,0 );sas_phy_disconnected (&phy->sas_phy); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_ERROR ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_ERROR );break ; } }
@@ -222,7 +221,6 @@ static void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb,int edb_el = edb_id + ascb->edb_index;struct asd_dma_tok *edb = ascb->ha->seq.edb_arr[edb_el];struct asd_phy *phy = &ascb->ha->phys[phy_id]; -struct sas_ha_struct *sas_ha = phy->sas_phy.ha;u16 size = ((dl->status_block[3 ] &7 ) <<8 ) | dl->status_block[2 ]; size =min (size, (u16 )sizeof (phy->frame_rcvd));
@@ -234,7 +232,7 @@ static void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb,spin_unlock_irqrestore (&phy->sas_phy.frame_rcvd_lock, flags);asd_dump_frame_rcvd (phy, dl);asd_form_port (ascb->ha, phy); - sas_ha->notify_port_event (&phy->sas_phy,PORTE_BYTES_DMAED ); +sas_notify_port_event (&phy->sas_phy,PORTE_BYTES_DMAED ); } static void asd_link_reset_err_tasklet(struct asd_ascb *ascb,
@@ -270,7 +268,7 @@ static void asd_link_reset_err_tasklet(struct asd_ascb *ascb,asd_turn_led (asd_ha, phy_id,0 );sas_phy_disconnected (sas_phy);asd_deform_port (asd_ha, phy); - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );if (retries_left ==0 ) {int num =1 ;
@@ -315,7 +313,7 @@ static void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb,spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =ffs (cont);spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case LmUNKNOWNP:
@@ -336,7 +334,7 @@ static void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb,/* The sequencer disables all phys on that port. * We have to re-enable the phys ourselves. */ asd_deform_port (asd_ha, phy); - sas_ha->notify_port_event (sas_phy,PORTE_HARD_RESET ); +sas_notify_port_event (sas_phy,PORTE_HARD_RESET );break ;default :
@@ -567,7 +565,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb,/* the device is gone */ sas_phy_disconnected (sas_phy);asd_deform_port (asd_ha, phy); - sas_ha->notify_port_event (sas_phy,PORTE_TIMER_EVENT ); +sas_notify_port_event (sas_phy,PORTE_TIMER_EVENT );break ;default : ASD_DPRINTK("%s: phy%d: unknown event:0x%x\n", __func__,
drivers/scsi/hisi_sas/hisi_sas_main.c +4 -8
@@ -616,7 +616,6 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no) {struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];struct asd_sas_phy *sas_phy = &phy->sas_phy; -struct sas_ha_struct *sas_ha;if (!phy->phy_attached)return ;
@@ -627,8 +626,7 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no)return ; } - sas_ha = &hisi_hba->sha; - sas_ha->notify_phy_event (sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (sas_phy,PHYE_OOB_DONE );if (sas_phy->phy) {struct sas_phy *sphy = sas_phy->phy;
@@ -656,7 +654,7 @@ static void hisi_sas_bytes_dmaed(struct hisi_hba *hisi_hba, int phy_no) } sas_phy->frame_rcvd_size = phy->frame_rcvd_size; - sas_ha->notify_port_event (sas_phy,PORTE_BYTES_DMAED ); +sas_notify_port_event (sas_phy,PORTE_BYTES_DMAED ); }static struct hisi_sas_device *hisi_sas_alloc_dev (struct domain_device *device)
@@ -1411,7 +1409,6 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba)static void hisi_sas_rescan_topology (struct hisi_hba *hisi_hba,u32 state) { -struct sas_ha_struct *sas_ha = &hisi_hba->sha;struct asd_sas_port *_sas_port =NULL ;int phy_no;
@@ -1432,7 +1429,7 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) _sas_port = sas_port;if (dev_is_expander (dev->dev_type)) - sas_ha->notify_port_event (sas_phy, +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); } }else {
@@ -2194,7 +2191,6 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy) {struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];struct asd_sas_phy *sas_phy = &phy->sas_phy; -struct sas_ha_struct *sas_ha = &hisi_hba->sha;struct device *dev = hisi_hba->dev;if (rdy) {
@@ -2210,7 +2206,7 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy)return ; }/* Phy down and not ready */ - sas_ha->notify_phy_event (sas_phy,PHYE_LOSS_OF_SIGNAL ); +sas_notify_phy_event (sas_phy,PHYE_LOSS_OF_SIGNAL );sas_phy_disconnected (sas_phy);if (port) {
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1 -2
@@ -1408,7 +1408,6 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p)struct hisi_sas_phy *phy = p;struct hisi_hba *hisi_hba = phy->hisi_hba;struct asd_sas_phy *sas_phy = &phy->sas_phy; -struct sas_ha_struct *sha = &hisi_hba->sha;struct device *dev = hisi_hba->dev;int phy_no = sas_phy->id;u32 irq_value;
@@ -1424,7 +1423,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) }if (!test_bit (HISI_SAS_RESET_BIT , &hisi_hba->flags)) - sha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); end: hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT2,
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -2
@@ -2818,14 +2818,13 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba) {struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];struct asd_sas_phy *sas_phy = &phy->sas_phy; -struct sas_ha_struct *sas_ha = &hisi_hba->sha;u32 bcast_status;hisi_sas_phy_write32 (hisi_hba, phy_no,SL_RX_BCAST_CHK_MSK ,1 ); bcast_status =hisi_sas_phy_read32 (hisi_hba, phy_no,RX_PRIMS_STATUS );if ((bcast_status &RX_BCAST_CHG_MSK ) && !test_bit (HISI_SAS_RESET_BIT , &hisi_hba->flags)) - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );hisi_sas_phy_write32 (hisi_hba, phy_no,CHL_INT0 ,CHL_INT0_SL_RX_BCST_ACK_MSK );hisi_sas_phy_write32 (hisi_hba, phy_no,SL_RX_BCAST_CHK_MSK ,0 );
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -2
@@ -1600,14 +1600,13 @@ static irqreturn_t phy_bcast_v3_hw(int phy_no, struct hisi_hba *hisi_hba) {struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];struct asd_sas_phy *sas_phy = &phy->sas_phy; -struct sas_ha_struct *sas_ha = &hisi_hba->sha;u32 bcast_status;hisi_sas_phy_write32 (hisi_hba, phy_no,SL_RX_BCAST_CHK_MSK ,1 ); bcast_status =hisi_sas_phy_read32 (hisi_hba, phy_no,RX_PRIMS_STATUS );if ((bcast_status &RX_BCAST_CHG_MSK ) && !test_bit (HISI_SAS_RESET_BIT , &hisi_hba->flags)) - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );hisi_sas_phy_write32 (hisi_hba, phy_no,CHL_INT0 ,CHL_INT0_SL_RX_BCST_ACK_MSK );hisi_sas_phy_write32 (hisi_hba, phy_no,SL_RX_BCAST_CHK_MSK ,0 );
drivers/scsi/isci/port.c +3 -4
@@ -164,7 +164,7 @@ static void isci_port_bc_change_received(struct isci_host *ihost,"%s: isci_phy = %p, sas_phy = %p\n" , __func__, iphy, &iphy->sas_phy); - ihost->sas_ha.notify_port_event (&iphy->sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (&iphy->sas_phy,PORTE_BROADCAST_RCVD );sci_port_bcn_enable (iport); }
@@ -223,8 +223,7 @@ static void isci_port_link_up(struct isci_host *isci_host,/* Notify libsas that we have an address frame, if indeed * we've found an SSP, SMP, or STP target */ if (success) - isci_host->sas_ha.notify_port_event (&iphy->sas_phy, -PORTE_BYTES_DMAED ); +sas_notify_port_event (&iphy->sas_phy,PORTE_BYTES_DMAED ); }
@@ -270,7 +269,7 @@ static void isci_port_link_down(struct isci_host *isci_host,* isci_port_deformed and isci_dev_gone functions. */ sas_phy_disconnected (&isci_phy->sas_phy); - isci_host->sas_ha.notify_phy_event (&isci_phy->sas_phy, +sas_notify_phy_event (&isci_phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); dev_dbg(&isci_host->pdev->dev,
drivers/scsi/libsas/sas_event.c +4 -9
@@ -109,7 +109,7 @@ void sas_enable_revalidation(struct sas_ha_struct *ha) sas_phy = container_of(port->phy_list.next, struct asd_sas_phy, port_phy_el); - ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); }mutex_unlock (&ha->disco_mutex); }
@@ -131,7 +131,7 @@ static void sas_phy_event_worker(struct work_struct *work)sas_free_event (ev); } -static int sas_notify_port_event (struct asd_sas_phy *phy,enum port_event event) +int sas_notify_port_event (struct asd_sas_phy *phy,enum port_event event) {struct asd_sas_event *ev;struct sas_ha_struct *ha = phy->ha;
@@ -151,6 +151,7 @@ static int sas_notify_port_event(struct asd_sas_phy *phy, enum port_event event)return ret; } +EXPORT_SYMBOL_GPL (sas_notify_port_event);int sas_notify_phy_event (struct asd_sas_phy *phy,enum phy_event event) {
@@ -172,11 +173,5 @@ int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event)return ret; } +EXPORT_SYMBOL_GPL (sas_notify_phy_event); -int sas_init_events (struct sas_ha_struct *sas_ha) -{ - sas_ha->notify_port_event = sas_notify_port_event; - sas_ha->notify_phy_event = sas_notify_phy_event; - -return 0 ; -}
drivers/scsi/libsas/sas_init.c +0 -6
@@ -123,12 +123,6 @@ int sas_register_ha(struct sas_ha_struct *sas_ha) goto Undo_phys; } - error =sas_init_events (sas_ha); -if (error) { -pr_notice ("couldn't start event thread:%d\n" , error); - goto Undo_ports; - } - error = -ENOMEM ;snprintf (name,sizeof (name),"%s_event_q" ,dev_name (sas_ha->dev)); sas_ha->event_q =create_singlethread_workqueue (name);
drivers/scsi/libsas/sas_internal.h +0 -1
@@ -54,7 +54,6 @@ void sas_free_event(struct asd_sas_event *event);int sas_register_ports (struct sas_ha_struct *sas_ha);void sas_unregister_ports (struct sas_ha_struct *sas_ha); -int sas_init_events (struct sas_ha_struct *sas_ha);void sas_disable_revalidation (struct sas_ha_struct *ha);void sas_enable_revalidation (struct sas_ha_struct *ha);void __sas_drain_work (struct sas_ha_struct *ha);
drivers/scsi/mvsas/mv_sas.c +5 -9
@@ -220,7 +220,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) {struct mvs_phy *phy = &mvi->phy[i];struct asd_sas_phy *sas_phy = &phy->sas_phy; -struct sas_ha_struct *sas_ha; +if (!phy->phy_attached)return ;
@@ -229,8 +229,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)return ; } - sas_ha = mvi->sas; - sas_ha->notify_phy_event (sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (sas_phy,PHYE_OOB_DONE );if (sas_phy->phy) {struct sas_phy *sphy = sas_phy->phy;
@@ -262,8 +261,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) sas_phy->frame_rcvd_size = phy->frame_rcvd_size; - mvi->sas->notify_port_event (sas_phy, -PORTE_BYTES_DMAED ); +sas_notify_port_event (sas_phy,PORTE_BYTES_DMAED ); }void mvs_scan_start (struct Scsi_Host *shost)
@@ -1880,7 +1878,6 @@ static void mvs_work_queue(struct work_struct *work)struct mvs_info *mvi = mwq->mvi;unsigned long flags;u32 phy_no = (unsigned long ) mwq->data; -struct sas_ha_struct *sas_ha = mvi->sas;struct mvs_phy *phy = &mvi->phy[phy_no];struct asd_sas_phy *sas_phy = &phy->sas_phy;
@@ -1895,7 +1892,7 @@ static void mvs_work_queue(struct work_struct *work)if (!(tmp &PHY_READY_MASK )) {sas_phy_disconnected (sas_phy);mvs_phy_disconnected (phy); - sas_ha->notify_phy_event (sas_phy, +sas_notify_phy_event (sas_phy,PHYE_LOSS_OF_SIGNAL );mv_dprintk ("phy%d Removed Device\n" , phy_no); }else {
@@ -1908,8 +1905,7 @@ static void mvs_work_queue(struct work_struct *work) } }else if (mwq->handler &EXP_BRCT_CHG ) { phy->phy_event &= ~EXP_BRCT_CHG ; - sas_ha->notify_port_event (sas_phy, -PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );mv_dprintk ("phy%d Got Broadcast Change\n" , phy_no); }list_del (&mwq->entry);
drivers/scsi/pm8001/pm8001_hwi.c +19 -21
@@ -3179,7 +3179,7 @@ void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)pm8001_dbg (pm8001_ha,MSG ,"phy %d byte dmaded.\n" , i); sas_phy->frame_rcvd_size = phy->frame_rcvd_size; - pm8001_ha->sas->notify_port_event (sas_phy,PORTE_BYTES_DMAED ); +sas_notify_port_event (sas_phy,PORTE_BYTES_DMAED ); }/* Get the link rate speed */
@@ -3293,7 +3293,6 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)u32 npip_portstate =le32_to_cpu (pPayload->npip_portstate);u8 portstate = (u8)(npip_portstate &0x0000000F );struct pm8001_port *port = &pm8001_ha->port[port_id]; -struct sas_ha_struct *sas_ha = pm8001_ha->sas;struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];unsigned long flags;u8 deviceType = pPayload->sas_identify.dev_type;
@@ -3337,7 +3336,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)else if (phy->identify.device_type !=SAS_PHY_UNUSED ) phy->identify.target_port_protocols =SAS_PROTOCOL_SMP ; phy->sas_phy.oob_mode =SAS_OOB_MODE ; - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE );spin_lock_irqsave (&phy->sas_phy.frame_rcvd_lock, flags);memcpy (phy->frame_rcvd, &pPayload->sas_identify,sizeof (struct sas_identify_frame )-4 );
@@ -3369,7 +3368,6 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)u32 npip_portstate =le32_to_cpu (pPayload->npip_portstate);u8 portstate = (u8)(npip_portstate &0x0000000F );struct pm8001_port *port = &pm8001_ha->port[port_id]; -struct sas_ha_struct *sas_ha = pm8001_ha->sas;struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];unsigned long flags; pm8001_dbg(pm8001_ha, DEVIO, "HW_EVENT_SATA_PHY_UP port id = %d, phy id = %d\n",
@@ -3381,7 +3379,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) phy->phy_type |=PORT_TYPE_SATA ; phy->phy_attached =1 ; phy->sas_phy.oob_mode =SATA_OOB_MODE ; - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE );spin_lock_irqsave (&phy->sas_phy.frame_rcvd_lock, flags);memcpy (phy->frame_rcvd, ((u8 *)&pPayload->sata_fis -4 ),sizeof (struct dev_to_host_fis ));
@@ -3728,11 +3726,11 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)break ;case HW_EVENT_SATA_SPINUP_HOLD :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_SATA_SPINUP_HOLD\n" ); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_SPINUP_HOLD ); +sas_notify_phy_event (&phy->sas_phy,PHYE_SPINUP_HOLD );break ;case HW_EVENT_PHY_DOWN :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PHY_DOWN\n" ); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); +sas_notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); phy->phy_attached =0 ; phy->phy_state =0 ;hw_event_phy_down (pm8001_ha, piomb);
@@ -3741,7 +3739,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PORT_INVALID\n" );sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;/* the broadcast change primitive received, tell the LIBSAS this event to revalidate the sas domain*/
@@ -3752,20 +3750,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =HW_EVENT_BROADCAST_CHANGE ;spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case HW_EVENT_PHY_ERROR :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PHY_ERROR\n" );sas_phy_disconnected (&phy->sas_phy); phy->phy_attached =0 ; - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_ERROR ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_ERROR );break ;case HW_EVENT_BROADCAST_EXP :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_BROADCAST_EXP\n" );spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =HW_EVENT_BROADCAST_EXP ;spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case HW_EVENT_LINK_ERR_INVALID_DWORD : pm8001_dbg(pm8001_ha, MSG,
@@ -3774,7 +3772,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_LINK_ERR_DISPARITY_ERROR : pm8001_dbg(pm8001_ha, MSG,
@@ -3784,7 +3782,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_LINK_ERR_CODE_VIOLATION : pm8001_dbg(pm8001_ha, MSG,
@@ -3794,7 +3792,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH : pm8001_dbg(pm8001_ha, MSG,
@@ -3804,7 +3802,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_MALFUNCTION :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_MALFUNCTION\n" );
@@ -3814,7 +3812,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =HW_EVENT_BROADCAST_SES ;spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case HW_EVENT_INBOUND_CRC_ERROR :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_INBOUND_CRC_ERROR\n" );
@@ -3824,13 +3822,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb)break ;case HW_EVENT_HARD_RESET_RECEIVED :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_HARD_RESET_RECEIVED\n" ); - sas_ha->notify_port_event (sas_phy,PORTE_HARD_RESET ); +sas_notify_port_event (sas_phy,PORTE_HARD_RESET );break ;case HW_EVENT_ID_FRAME_TIMEOUT :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_ID_FRAME_TIMEOUT\n" );sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_LINK_ERR_PHY_RESET_FAILED : pm8001_dbg(pm8001_ha, MSG,
@@ -3840,20 +3838,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_PORT_RESET_TIMER_TMO :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PORT_RESET_TIMER_TMO\n" );sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_PORT_RECOVERY_TIMER_TMO :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PORT_RECOVERY_TIMER_TMO\n" );sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_PORT_RECOVER :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PORT_RECOVER\n" );
drivers/scsi/pm8001/pm8001_sas.c +2 -5
@@ -158,7 +158,6 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,int rc =0 , phy_id = sas_phy->id;struct pm8001_hba_info *pm8001_ha =NULL ;struct sas_phy_linkrates *rates; -struct sas_ha_struct *sas_ha;struct pm8001_phy *phy;DECLARE_COMPLETION_ONSTACK (completion);unsigned long flags;
@@ -207,18 +206,16 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,if (pm8001_ha->chip_id != chip_8001) {if (pm8001_ha->phy[phy_id].phy_state ==PHY_STATE_LINK_UP_SPCV ) { - sas_ha = pm8001_ha->sas;sas_phy_disconnected (&phy->sas_phy); - sas_ha->notify_phy_event (&phy->sas_phy, +sas_notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); phy->phy_attached =0 ; } }else {if (pm8001_ha->phy[phy_id].phy_state ==PHY_STATE_LINK_UP_SPC ) { - sas_ha = pm8001_ha->sas;sas_phy_disconnected (&phy->sas_phy); - sas_ha->notify_phy_event (&phy->sas_phy, +sas_notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); phy->phy_attached =0 ; }
drivers/scsi/pm8001/pm80xx_hwi.c +15 -20
@@ -3243,7 +3243,6 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)u8 portstate = (u8)(phyid_npip_portstate &0x0000000F );struct pm8001_port *port = &pm8001_ha->port[port_id]; -struct sas_ha_struct *sas_ha = pm8001_ha->sas;struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];unsigned long flags;u8 deviceType = pPayload->sas_identify.dev_type;
@@ -3288,7 +3287,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)else if (phy->identify.device_type !=SAS_PHY_UNUSED ) phy->identify.target_port_protocols =SAS_PROTOCOL_SMP ; phy->sas_phy.oob_mode =SAS_OOB_MODE ; - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE );spin_lock_irqsave (&phy->sas_phy.frame_rcvd_lock, flags);memcpy (phy->frame_rcvd, &pPayload->sas_identify,sizeof (struct sas_identify_frame )-4 );
@@ -3322,7 +3321,6 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)u8 portstate = (u8)(phyid_npip_portstate &0x0000000F );struct pm8001_port *port = &pm8001_ha->port[port_id]; -struct sas_ha_struct *sas_ha = pm8001_ha->sas;struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];unsigned long flags; pm8001_dbg(pm8001_ha, DEVIO,
@@ -3336,7 +3334,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) phy->phy_type |=PORT_TYPE_SATA ; phy->phy_attached =1 ; phy->sas_phy.oob_mode =SATA_OOB_MODE ; - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_DONE );spin_lock_irqsave (&phy->sas_phy.frame_rcvd_lock, flags);memcpy (phy->frame_rcvd, ((u8 *)&pPayload->sata_fis -4 ),sizeof (struct dev_to_host_fis ));
@@ -3418,11 +3416,8 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)break ; } -if (port_sata && (portstate !=PORT_IN_RESET )) { -struct sas_ha_struct *sas_ha = pm8001_ha->sas; - - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); - } +if (port_sata && (portstate !=PORT_IN_RESET )) +sas_notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); }static int mpi_phy_start_resp (struct pm8001_hba_info *pm8001_ha,void *piomb)
@@ -3520,7 +3515,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)break ;case HW_EVENT_SATA_SPINUP_HOLD :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_SATA_SPINUP_HOLD\n" ); - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_SPINUP_HOLD ); +sas_notify_phy_event (&phy->sas_phy,PHYE_SPINUP_HOLD );break ;case HW_EVENT_PHY_DOWN :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PHY_DOWN\n" );
@@ -3536,7 +3531,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PORT_INVALID\n" );sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;/* the broadcast change primitive received, tell the LIBSAS this event to revalidate the sas domain*/
@@ -3547,20 +3542,20 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =HW_EVENT_BROADCAST_CHANGE ;spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case HW_EVENT_PHY_ERROR :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PHY_ERROR\n" );sas_phy_disconnected (&phy->sas_phy); phy->phy_attached =0 ; - sas_ha->notify_phy_event (&phy->sas_phy,PHYE_OOB_ERROR ); +sas_notify_phy_event (&phy->sas_phy,PHYE_OOB_ERROR );break ;case HW_EVENT_BROADCAST_EXP :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_BROADCAST_EXP\n" );spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =HW_EVENT_BROADCAST_EXP ;spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case HW_EVENT_LINK_ERR_INVALID_DWORD : pm8001_dbg(pm8001_ha, MSG,
@@ -3597,7 +3592,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)spin_lock_irqsave (&sas_phy->sas_prim_lock, flags); sas_phy->sas_prim =HW_EVENT_BROADCAST_SES ;spin_unlock_irqrestore (&sas_phy->sas_prim_lock, flags); - sas_ha->notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD );break ;case HW_EVENT_INBOUND_CRC_ERROR :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_INBOUND_CRC_ERROR\n" );
@@ -3607,13 +3602,13 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)break ;case HW_EVENT_HARD_RESET_RECEIVED :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_HARD_RESET_RECEIVED\n" ); - sas_ha->notify_port_event (sas_phy,PORTE_HARD_RESET ); +sas_notify_port_event (sas_phy,PORTE_HARD_RESET );break ;case HW_EVENT_ID_FRAME_TIMEOUT :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_ID_FRAME_TIMEOUT\n" );sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_LINK_ERR_PHY_RESET_FAILED : pm8001_dbg(pm8001_ha, MSG,
@@ -3623,7 +3618,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );break ;case HW_EVENT_PORT_RESET_TIMER_TMO :pm8001_dbg (pm8001_ha,MSG ,"HW_EVENT_PORT_RESET_TIMER_TMO\n" );
@@ -3631,7 +3626,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) port_id, phy_id, 0, 0);sas_phy_disconnected (sas_phy); phy->phy_attached =0 ; - sas_ha->notify_port_event (sas_phy,PORTE_LINK_RESET_ERR ); +sas_notify_port_event (sas_phy,PORTE_LINK_RESET_ERR );if (pm8001_ha->phy[phy_id].reset_completion) { pm8001_ha->phy[phy_id].port_reset_status =PORT_RESET_TMO ;
@@ -3648,7 +3643,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)for (i =0 ; i < pm8001_ha->chip->n_phy; i++) {if (port->wide_port_phymap & (1 << i)) { phy = &pm8001_ha->phy[i]; - sas_ha->notify_phy_event (&phy->sas_phy, +sas_notify_phy_event (&phy->sas_phy,PHYE_LOSS_OF_SIGNAL ); port->wide_port_phymap &= ~(1 << i); }
include/scsi/libsas.h +3 -4
@@ -391,10 +391,6 @@ struct sas_ha_struct {int strict_wide_ports;/* both sas_addr and attached_sas_addr must match * their siblings when forming wide ports */ -/* LLDD calls these to notify the class of an event. */ -int (*notify_port_event)(struct asd_sas_phy *,enum port_event ); -int (*notify_phy_event)(struct asd_sas_phy *,enum phy_event ); -void *lldd_ha;/* not touched by sas class code */ struct list_head eh_done_q;/* complete via scsi_eh_flush_done_q */
@@ -706,4 +702,7 @@ struct sas_phy *sas_get_local_phy(struct domain_device *dev);int sas_request_addr (struct Scsi_Host *shost,u8 *addr); +int sas_notify_port_event (struct asd_sas_phy *phy,enum port_event event); +int sas_notify_phy_event (struct asd_sas_phy *phy,enum phy_event event); +#endif /* _SASLIB_H_ */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 368/775 scsi: libsas: Introduce a _gfp() variant of event notifiers
In reply to Greg Kroah-HartmanFrom: Ahmed S. Darwish <[email protected]>
[ Upstream commit c2d0f1a65ab9fbabebb463bf36f50ea8f4633386 ]
sas_alloc_event() uses in_interrupt() to decide which allocation should be used.
The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context.
The in_interrupt() check is also only partially correct, because it fails to choose the correct code path when just preemption or interrupts are disabled. For example, as in the following call chain:
mvsas/mv_sas.c: mvs_work_queue() [process context] spin_lock_irqsave(mvs_info::lock, )
-> libsas/sas_event.c: sas_notify_phy_event()
-> sas_alloc_event()
-> in_interrupt() = false
-> invalid GFP_KERNEL allocation
-> libsas/sas_event.c: sas_notify_port_event()
-> sas_alloc_event()
-> in_interrupt() = false
-> invalid GFP_KERNEL allocationIntroduce sas_alloc_event_gfp(), sas_notify_port_event_gfp(), and sas_notify_phy_event_gfp(), which all behave like the non _gfp() variants but use a caller-passed GFP mask for allocations.
For bisectability, all callers will be modified first to pass GFP context, then the non _gfp() libsas API variants will be modified to take a gfp_t by default.
--- Documentation/scsi/libsas.rst | 2 + drivers/scsi/libsas/sas_event.c | 65 ++++++++++++++++++++++++------ drivers/scsi/libsas/sas_init.c | 21 +++++++--- drivers/scsi/libsas/sas_internal.h | 4 ++ include/scsi/libsas.h | 4 ++ 5 files changed, 79 insertions(+), 17 deletions(-)
Documentation/scsi/libsas.rst +2 -0
@@ -192,6 +192,8 @@ The event interface:: void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event); void sas_notify_port_event(struct sas_phy *, enum port_event); void sas_notify_phy_event(struct sas_phy *, enum phy_event); + void sas_notify_port_event_gfp(struct sas_phy *, enum port_event, gfp_t); + void sas_notify_phy_event_gfp(struct sas_phy *, enum phy_event, gfp_t); The port notification::
drivers/scsi/libsas/sas_event.c +53 -12
96 lines not on this page · raw message
drivers/scsi/libsas/sas_init.c +16 -5
@@ -584,16 +584,15 @@ sas_domain_attach_transport(struct sas_domain_function_template *dft) }EXPORT_SYMBOL_GPL (sas_domain_attach_transport); - -struct asd_sas_event *sas_alloc_event (struct asd_sas_phy *phy) +static struct asd_sas_event *__sas_alloc_event (struct asd_sas_phy *phy, +gfp_t gfp_flags) {struct asd_sas_event *event; -gfp_t flags =in_interrupt () ?GFP_ATOMIC :GFP_KERNEL ;struct sas_ha_struct *sas_ha = phy->ha;struct sas_internal *i =to_sas_internal (sas_ha->core.shost->transportt); - event =kmem_cache_zalloc (sas_event_cache, flags); + event =kmem_cache_zalloc (sas_event_cache, gfp_flags);if (!event)return NULL ;
@@ -604,7 +603,8 @@ struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy)if (cmpxchg (&phy->in_shutdown,0 ,1 ) ==0 ) {pr_notice ("The phy%d bursting events, shut it down.\n" , phy->id); -sas_notify_phy_event (phy,PHYE_SHUTDOWN ); +sas_notify_phy_event_gfp (phy,PHYE_SHUTDOWN , + gfp_flags); } }else {/* Do not support PHY control, stop allocating events */
@@ -618,6 +618,17 @@ struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy)return event; } +struct asd_sas_event *sas_alloc_event (struct asd_sas_phy *phy) +{ +return __sas_alloc_event (phy,in_interrupt () ?GFP_ATOMIC :GFP_KERNEL ); +} + +struct asd_sas_event *sas_alloc_event_gfp (struct asd_sas_phy *phy, +gfp_t gfp_flags) +{ +return __sas_alloc_event (phy, gfp_flags); +} +void sas_free_event (struct asd_sas_event *event) {struct asd_sas_phy *phy = event->phy;
drivers/scsi/libsas/sas_internal.h +4 -0
@@ -49,6 +49,8 @@ int sas_register_phys(struct sas_ha_struct *sas_ha);void sas_unregister_phys (struct sas_ha_struct *sas_ha);struct asd_sas_event *sas_alloc_event (struct asd_sas_phy *phy); +struct asd_sas_event *sas_alloc_event_gfp (struct asd_sas_phy *phy, +gfp_t gfp_flags);void sas_free_event (struct asd_sas_event *event);int sas_register_ports (struct sas_ha_struct *sas_ha);
@@ -77,6 +79,8 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id,int sas_smp_get_phy_events (struct sas_phy *phy);int sas_notify_phy_event (struct asd_sas_phy *phy,enum phy_event event); +int sas_notify_phy_event_gfp (struct asd_sas_phy *phy,enum phy_event event, +gfp_t flags);void sas_device_set_phy (struct domain_device *dev,struct sas_port *port);struct domain_device *sas_find_dev_by_rphy (struct sas_rphy *rphy);struct domain_device *sas_ex_to_ata (struct domain_device *ex_dev,int phy_id);
include/scsi/libsas.h +4 -0
@@ -704,5 +704,9 @@ int sas_request_addr(struct Scsi_Host *shost, u8 *addr);int sas_notify_port_event (struct asd_sas_phy *phy,enum port_event event);int sas_notify_phy_event (struct asd_sas_phy *phy,enum phy_event event); +int sas_notify_port_event_gfp (struct asd_sas_phy *phy,enum port_event event, +gfp_t gfp_flags); +int sas_notify_phy_event_gfp (struct asd_sas_phy *phy,enum phy_event event, +gfp_t gfp_flags);#endif /* _SASLIB_H_ */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 369/775 scsi: mvsas: Pass gfp_t flags to libsas event notifiers
In reply to Greg Kroah-HartmanFrom: Ahmed S. Darwish <[email protected]>
[ Upstream commit feb18e900f0048001ff375dca639eaa327ab3c1b ]
mvsas calls the non _gfp version of the libsas event notifiers API, leading to the buggy call chains below:
mvsas/mv_sas.c: mvs_work_queue() [process context] spin_lock_irqsave(mvs_info::lock, )
-> libsas/sas_event.c: sas_notify_phy_event()
-> sas_alloc_event()
-> in_interrupt() = false
-> invalid GFP_KERNEL allocation
-> libsas/sas_event.c: sas_notify_port_event()
-> sas_alloc_event()
-> in_interrupt() = false
-> invalid GFP_KERNEL allocationUse the new event notifiers API instead, which requires callers to explicitly pass the gfp_t memory allocation flags.
Below are context analysis for the modified functions:
=> mvs_bytes_dmaed():
Since it is invoked from both process and atomic contexts, let its callers pass the gfp_t flags. Call chains:
scsi_scan.c: do_scsi_scan_host() [has msleep()]
-> shost->hostt->scan_start()
-> [mvsas/mv_init.c: Scsi_Host::scsi_host_template .scan_start = mvs_scan_start()]
-> mvsas/mv_sas.c: mvs_scan_start()
-> mvs_bytes_dmaed(..., GFP_KERNEL) mvsas/mv_sas.c: mvs_work_queue()
spin_lock_irqsave(mvs_info::lock,)
-> mvs_bytes_dmaed(..., GFP_ATOMIC)
mvsas/mv_64xx.c: mvs_64xx_isr() || mvsas/mv_94xx.c: mvs_94xx_isr()
-> mvsas/mv_chips.h: mvs_int_full()
-> mvsas/mv_sas.c: mvs_int_port()
-> mvs_bytes_dmaed(..., GFP_ATOMIC);=> mvs_work_queue():
Invoked from process context, but it calls all the libsas event notifier APIs under a spin_lock_irqsave(). Pass GFP_ATOMIC.
--- drivers/scsi/mvsas/mv_sas.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/scsi/mvsas/mv_sas.c +10 -9
@@ -216,7 +216,7 @@ void mvs_set_sas_addr(struct mvs_info *mvi, int port_id, u32 off_lo,MVS_CHIP_DISP ->write_port_cfg_data (mvi, port_id, hi); } -static void mvs_bytes_dmaed (struct mvs_info *mvi,int i) +static void mvs_bytes_dmaed (struct mvs_info *mvi,int i,gfp_t gfp_flags) {struct mvs_phy *phy = &mvi->phy[i];struct asd_sas_phy *sas_phy = &phy->sas_phy;
@@ -229,7 +229,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)return ; } -sas_notify_phy_event (sas_phy,PHYE_OOB_DONE ); +sas_notify_phy_event_gfp (sas_phy,PHYE_OOB_DONE , gfp_flags);if (sas_phy->phy) {struct sas_phy *sphy = sas_phy->phy;
@@ -261,7 +261,7 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) sas_phy->frame_rcvd_size = phy->frame_rcvd_size; -sas_notify_port_event (sas_phy,PORTE_BYTES_DMAED ); +sas_notify_port_event_gfp (sas_phy,PORTE_BYTES_DMAED , gfp_flags); }void mvs_scan_start (struct Scsi_Host *shost)
@@ -277,7 +277,7 @@ void mvs_scan_start(struct Scsi_Host *shost)for (j =0 ; j < core_nr; j++) { mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[j];for (i =0 ; i < mvi->chip->n_phy; ++i) -mvs_bytes_dmaed (mvi, i); +mvs_bytes_dmaed (mvi, i,GFP_KERNEL ); } mvs_prv->scan_finished =1 ; }
@@ -1892,20 +1892,21 @@ static void mvs_work_queue(struct work_struct *work)if (!(tmp &PHY_READY_MASK )) {sas_phy_disconnected (sas_phy);mvs_phy_disconnected (phy); -sas_notify_phy_event (sas_phy, -PHYE_LOSS_OF_SIGNAL ); +sas_notify_phy_event_gfp (sas_phy, +PHYE_LOSS_OF_SIGNAL ,GFP_ATOMIC );mv_dprintk ("phy%d Removed Device\n" , phy_no); }else {MVS_CHIP_DISP ->detect_porttype (mvi, phy_no);mvs_update_phyinfo (mvi, phy_no,1 ); -mvs_bytes_dmaed (mvi, phy_no); +mvs_bytes_dmaed (mvi, phy_no,GFP_ATOMIC );mvs_port_notify_formed (sas_phy,0 );mv_dprintk ("phy%d Attached Device\n" , phy_no); } } }else if (mwq->handler &EXP_BRCT_CHG ) { phy->phy_event &= ~EXP_BRCT_CHG ; -sas_notify_port_event (sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event_gfp (sas_phy, +PORTE_BROADCAST_RCVD ,GFP_ATOMIC );mv_dprintk ("phy%d Got Broadcast Change\n" , phy_no); }list_del (&mwq->entry);
@@ -2022,7 +2023,7 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)mdelay (10 ); } -mvs_bytes_dmaed (mvi, phy_no); +mvs_bytes_dmaed (mvi, phy_no,GFP_ATOMIC );/* whether driver is going to handle hot plug */ if (phy->phy_event &PHY_PLUG_OUT ) {mvs_port_notify_formed (&phy->sas_phy,0 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 370/775 scsi: isci: Pass gfp_t flags in isci_port_link_down()
In reply to Greg Kroah-HartmanFrom: Ahmed S. Darwish <[email protected]>
[ Upstream commit 885ab3b8926fdf9cdd7163dfad99deb9b0662b39 ]
Use the new libsas event notifiers API, which requires callers to explicitly pass the gfp_t memory allocation flags.
sas_notify_phy_event() is exclusively called by isci_port_link_down(). Below is the context analysis for all of its call chains:
port.c: port_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> port_state_machine_change(..., SCI_PORT_FAILED)
-> enter SCI port state: *SCI_PORT_FAILED*
-> sci_port_failed_state_enter()
-> isci_port_hard_reset_complete()
-> isci_port_link_down()port.c: isci_port_perform_hard_reset()spin_lock_irqsave(isci_host::scic_lock, )
-> port.c: sci_port_hard_reset(), atomic (*)
-> phy.c: sci_phy_reset()
-> sci_change_state(SCI_PHY_RESETTING)
-> enter SCI PHY state: *SCI_PHY_RESETTING*
-> sci_phy_resetting_state_enter()
-> port.c: sci_port_deactivate_phy()
-> isci_port_link_down()port.c: enter SCI port state: *SCI_PORT_READY* # Cont. from [1]
-> sci_port_ready_state_enter()
-> isci_port_hard_reset_complete()
-> isci_port_link_down()phy.c: enter SCI state: *SCI_PHY_STOPPED* # Cont. from [2]
-> sci_phy_stopped_state_enter()
-> host.c: sci_controller_link_down()
-> ->link_down_handler()
== port_config.c: sci_apc_agent_link_down()
-> port.c: sci_port_remove_phy()
-> sci_port_deactivate_phy()
-> isci_port_link_down()
== port_config.c: sci_mpc_agent_link_down()
-> port.c: sci_port_link_down()
-> sci_port_deactivate_phy()
-> isci_port_link_down()phy.c: enter SCI state: *SCI_PHY_STARTING* # Cont. from [3]
-> sci_phy_starting_state_enter()
-> host.c: sci_controller_link_down()
-> ->link_down_handler()
== port_config.c: sci_apc_agent_link_down()
-> port.c: sci_port_remove_phy()
-> isci_port_link_down()
== port_config.c: sci_mpc_agent_link_down()
-> port.c: sci_port_link_down()
-> sci_port_deactivate_phy()
-> isci_port_link_down()[1] Call chains for 'enter SCI port state: *SCI_PORT_READY*'
------------------------------------------------------------
host.c: isci_host_init() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_initialize(), atomic (*)
-> port_config.c: sci_port_configuration_agent_initialize()
-> sci_mpc_agent_validate_phy_configuration()
-> port.c: sci_port_add_phy()
-> sci_port_general_link_up_handler()
-> port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*host.c: isci_host_start() (@)spin_lock_irq(isci_host::scic_lock)
-> host.c: sci_controller_start(), atomic (*)
-> host.c: sci_port_start()
-> port.c: port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*port_config.c: apc_agent_timeout(), atomic, timer callback (*)
-> sci_apc_agent_configure_ports()
-> port.c: sci_port_add_phy()
-> sci_port_general_link_up_handler()
-> port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*port_config.c: mpc_agent_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> ->link_up_handler()
== port.c: sci_apc_agent_link_up()
-> sci_port_general_link_up_handler()
-> port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*
== port.c: sci_mpc_agent_link_up()
-> port.c: sci_port_link_up()
-> sci_port_general_link_up_handler()
-> port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*phy.c: enter SCI state: SCI_PHY_SUB_FINAL # Cont. from [1A]
-> sci_phy_starting_final_substate_enter()
-> sci_change_state(SCI_PHY_READY)
-> enter SCI state: *SCI_PHY_READY*
-> sci_phy_ready_state_enter()
-> host.c: sci_controller_link_up()
-> port_agent.link_up_handler()
== port_config.c: sci_apc_agent_link_up()
-> port.c: sci_port_link_up()
-> sci_port_general_link_up_handler()
-> port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*
== port_config.c: sci_mpc_agent_link_up()
-> port.c: sci_port_link_up()
-> sci_port_general_link_up_handler()
-> port_state_machine_change(, SCI_PORT_READY)
-> enter port state *SCI_PORT_READY*[1A] Call chains for entering SCI state: *SCI_PHY_SUB_FINAL*
------------------------------------------------------------
host.c: power_control_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> phy.c: sci_phy_consume_power_handler()
-> phy.c: sci_change_state(SCI_PHY_SUB_FINAL)
host.c: sci_controller_error_handler(): atomic, irq handler (*)
OR host.c: sci_controller_completion_handler(), atomic, tasklet (*)
-> sci_controller_process_completions()
-> sci_controller_unsolicited_frame()
-> phy.c: sci_phy_frame_handler()
-> sci_change_state(SCI_PHY_SUB_AWAIT_SAS_POWER)
-> sci_phy_starting_await_sas_power_substate_enter()
-> host.c: sci_controller_power_control_queue_insert()
-> phy.c: sci_phy_consume_power_handler()
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_controller_event_completion()
-> phy.c: sci_phy_event_handler()
-> sci_phy_start_sata_link_training()
-> sci_change_state(SCI_PHY_SUB_AWAIT_SATA_POWER)
-> sci_phy_starting_await_sata_power_substate_enter
-> host.c: sci_controller_power_control_queue_insert()
-> phy.c: sci_phy_consume_power_handler()
-> sci_change_state(SCI_PHY_SUB_FINAL)[2] Call chains for entering state: *SCI_PHY_STOPPED*
-----------------------------------------------------
host.c: isci_host_init() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_initialize(), atomic (*)
-> phy.c: sci_phy_initialize()
-> phy.c: sci_phy_link_layer_initialization()
-> phy.c: sci_change_state(SCI_PHY_STOPPED)init.c: PCI ->remove() || PM_OPS ->suspend, process context (+)
-> host.c: isci_host_deinit()
-> sci_controller_stop_phys()
-> phy.c: sci_phy_stop()
-> sci_change_state(SCI_PHY_STOPPED)phy.c: isci_phy_control()spin_lock_irqsave(isci_host::scic_lock, )
-> sci_phy_stop(), atomic (*)
-> sci_change_state(SCI_PHY_STOPPED)
[3] Call chains for entering state: *SCI_PHY_STARTING*
------------------------------------------------------
phy.c: phy_sata_timeout(), atimer, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> sci_change_state(SCI_PHY_STARTING)
host.c: phy_startup_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> sci_controller_start_next_phy()
-> sci_phy_start()
-> sci_change_state(SCI_PHY_STARTING)host.c: isci_host_start() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_start(), atomic (*)
-> sci_controller_start_next_phy()
-> sci_phy_start()
-> sci_change_state(SCI_PHY_STARTING)phy.c: Enter SCI state *SCI_PHY_SUB_FINAL*, atomic, check above (*)
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_phy_starting_final_substate_enter()
-> sci_change_state(SCI_PHY_READY)
-> Enter SCI state: *SCI_PHY_READY*
-> sci_phy_ready_state_enter()
-> host.c: sci_controller_link_up()
-> sci_controller_start_next_phy()
-> sci_phy_start()
-> sci_change_state(SCI_PHY_STARTING)phy.c: sci_phy_event_handler(), atomic, discussed earlier (*)
-> sci_change_state(SCI_PHY_STARTING), 11 instances
phy.c: enter SCI state: *SCI_PHY_RESETTING*, atomic, discussed (*)
-> sci_phy_resetting_state_enter()
-> sci_change_state(SCI_PHY_STARTING)
As can be seen from the "(*)" markers above, almost all the call-chains are atomic. The only exception, marked with "(+)", is a PCI ->remove() and PM_OPS ->suspend() cold path. Thus, pass GFP_ATOMIC to the libsas phy event notifier.
Note, The now-replaced libsas APIs used in_interrupt() to implicitly decide which memory allocation type to use. This was only partially correct, as it fails to choose the correct GFP flags when just preemption or interrupts are disabled. Such buggy code paths are marked with "(@)" in the call chains above.
--- drivers/scsi/isci/port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/isci/port.c +2 -2
@@ -269,8 +269,8 @@ static void isci_port_link_down(struct isci_host *isci_host,* isci_port_deformed and isci_dev_gone functions. */ sas_phy_disconnected (&isci_phy->sas_phy); -sas_notify_phy_event (&isci_phy->sas_phy, -PHYE_LOSS_OF_SIGNAL ); +sas_notify_phy_event_gfp (&isci_phy->sas_phy, +PHYE_LOSS_OF_SIGNAL ,GFP_ATOMIC );dev_dbg (&isci_host->pdev->dev,"%s: isci_port = %p - Done\n" , __func__, isci_port);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 371/775 scsi: isci: Pass gfp_t flags in isci_port_link_up()
In reply to Greg Kroah-HartmanFrom: Ahmed S. Darwish <[email protected]>
[ Upstream commit 5ce7902902adb8d154d67ba494f06daa29360ef0 ]
Use the new libsas event notifiers API, which requires callers to explicitly pass the gfp_t memory allocation flags.
libsas sas_notify_port_event() is called from isci_port_link_up(). Below is the context analysis for all of its call chains:
host.c: isci_host_init() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_initialize(), atomic (*)
-> port_config.c: sci_port_configuration_agent_initialize()
-> sci_mpc_agent_validate_phy_configuration()
-> port.c: sci_port_add_phy()
-> sci_port_general_link_up_handler()
-> sci_port_activate_phy()
-> isci_port_link_up()port_config.c: apc_agent_timeout(), atomic, timer callback (*)
-> sci_apc_agent_configure_ports()
-> port.c: sci_port_add_phy()
-> sci_port_general_link_up_handler()
-> sci_port_activate_phy()
-> isci_port_link_up()phy.c: enter SCI state: *SCI_PHY_SUB_FINAL* # Cont. from [1]
-> phy.c: sci_phy_starting_final_substate_enter()
-> phy.c: sci_change_state(SCI_PHY_READY)
-> enter SCI state: *SCI_PHY_READY*
-> phy.c: sci_phy_ready_state_enter()
-> host.c: sci_controller_link_up()
-> .link_up_handler()
== port_config.c: sci_apc_agent_link_up()
-> port.c: sci_port_link_up()
-> (continue at [A])
== port_config.c: sci_mpc_agent_link_up()
-> port.c: sci_port_link_up()
-> (continue at [A])port_config.c: mpc_agent_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> ->link_up_handler()
== port_config.c: sci_apc_agent_link_up()
-> port.c: sci_port_link_up()
-> (continue at [A])
== port_config.c: sci_mpc_agent_link_up()
-> port.c: sci_port_link_up()
-> (continue at [A])[A] port.c: sci_port_link_up()
-> sci_port_activate_phy()
-> isci_port_link_up()
-> sci_port_general_link_up_handler()
-> sci_port_activate_phy()
-> isci_port_link_up()[1] Call chains for entering SCI state: *SCI_PHY_SUB_FINAL*
-----------------------------------------------------------
host.c: power_control_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> phy.c: sci_phy_consume_power_handler()
-> phy.c: sci_change_state(SCI_PHY_SUB_FINAL)
host.c: sci_controller_error_handler(): atomic, irq handler (*)
OR host.c: sci_controller_completion_handler(), atomic, tasklet (*)
-> sci_controller_process_completions()
-> sci_controller_unsolicited_frame()
-> phy.c: sci_phy_frame_handler()
-> sci_change_state(SCI_PHY_SUB_AWAIT_SAS_POWER)
-> sci_phy_starting_await_sas_power_substate_enter()
-> host.c: sci_controller_power_control_queue_insert()
-> phy.c: sci_phy_consume_power_handler()
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_controller_event_completion()
-> phy.c: sci_phy_event_handler()
-> sci_phy_start_sata_link_training()
-> sci_change_state(SCI_PHY_SUB_AWAIT_SATA_POWER)
-> sci_phy_starting_await_sata_power_substate_enter
-> host.c: sci_controller_power_control_queue_insert()
-> phy.c: sci_phy_consume_power_handler()
-> sci_change_state(SCI_PHY_SUB_FINAL)As can be seen from the "(*)" markers above, all the call-chains are atomic. Pass GFP_ATOMIC to libsas port event notifier.
Note, the now-replaced libsas APIs used in_interrupt() to implicitly decide which memory allocation type to use. This was only partially correct, as it fails to choose the correct GFP flags when just preemption or interrupts are disabled. Such buggy code paths are marked with "(@)" in the call chains above.
--- drivers/scsi/isci/port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/isci/port.c +2 -1
@@ -223,7 +223,8 @@ static void isci_port_link_up(struct isci_host *isci_host,/* Notify libsas that we have an address frame, if indeed * we've found an SSP, SMP, or STP target */ if (success) -sas_notify_port_event (&iphy->sas_phy,PORTE_BYTES_DMAED ); +sas_notify_port_event_gfp (&iphy->sas_phy, +PORTE_BYTES_DMAED ,GFP_ATOMIC ); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 372/775 scsi: isci: Pass gfp_t flags in isci_port_bc_change_received()
In reply to Greg Kroah-HartmanFrom: Ahmed S. Darwish <[email protected]>
[ Upstream commit 71dca5539fcf977aead0c9ea1962e70e78484b8e ]
Use the new libsas event notifiers API, which requires callers to explicitly pass the gfp_t memory allocation flags.
libsas sas_notify_port_event() is called from isci_port_bc_change_received(). Below is the context analysis for all of its call chains:
host.c: sci_controller_error_handler(): atomic, irq handler (*)
OR host.c: sci_controller_completion_handler(), atomic, tasklet (*)
-> sci_controller_process_completions()
-> sci_controller_event_completion()
-> phy.c: sci_phy_event_handler()
-> port.c: sci_port_broadcast_change_received()
-> isci_port_bc_change_received()host.c: isci_host_init() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_initialize(), atomic (*)
-> port_config.c: sci_port_configuration_agent_initialize()
-> sci_mpc_agent_validate_phy_configuration()
-> port.c: sci_port_add_phy()
-> sci_port_set_phy()
-> phy.c: sci_phy_set_port()
-> port.c: sci_port_broadcast_change_received()
-> isci_port_bc_change_received()port_config.c: apc_agent_timeout(), atomic, timer callback (*)
-> sci_apc_agent_configure_ports()
-> port.c: sci_port_add_phy()
-> sci_port_set_phy()
-> phy.c: sci_phy_set_port()
-> port.c: sci_port_broadcast_change_received()
-> isci_port_bc_change_received()phy.c: enter SCI state: *SCI_PHY_STOPPED* # Cont. from [1]
-> sci_phy_stopped_state_enter()
-> host.c: sci_controller_link_down()
-> ->link_down_handler()
== port_config.c: sci_apc_agent_link_down()
-> port.c: sci_port_remove_phy()
-> sci_port_clear_phy()
-> phy.c: sci_phy_set_port()
-> port.c: sci_port_broadcast_change_received()
-> isci_port_bc_change_received()phy.c: enter SCI state: *SCI_PHY_STARTING* # Cont. from [2]
-> sci_phy_starting_state_enter()
-> host.c: sci_controller_link_down()
-> ->link_down_handler()
== port_config.c: sci_apc_agent_link_down()
-> port.c: sci_port_remove_phy()
-> sci_port_clear_phy()
-> phy.c: sci_phy_set_port()
-> port.c: sci_port_broadcast_change_received()
-> isci_port_bc_change_received()[1] Call chains for entering state: *SCI_PHY_STOPPED*
-----------------------------------------------------
host.c: isci_host_init() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_initialize(), atomic (*)
-> phy.c: sci_phy_initialize()
-> phy.c: sci_phy_link_layer_initialization()
-> phy.c: sci_change_state(SCI_PHY_STOPPED)init.c: PCI ->remove() || PM_OPS ->suspend, process context (+)
-> host.c: isci_host_deinit()
-> sci_controller_stop_phys()
-> phy.c: sci_phy_stop()
-> sci_change_state(SCI_PHY_STOPPED)phy.c: isci_phy_control()spin_lock_irqsave(isci_host::scic_lock, )
-> sci_phy_stop(), atomic (*)
-> sci_change_state(SCI_PHY_STOPPED)
[2] Call chains for entering state: *SCI_PHY_STARTING*
------------------------------------------------------
phy.c: phy_sata_timeout(), atimer, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> sci_change_state(SCI_PHY_STARTING)
host.c: phy_startup_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> sci_controller_start_next_phy()
-> sci_phy_start()
-> sci_change_state(SCI_PHY_STARTING)host.c: isci_host_start() (@)spin_lock_irq(isci_host::scic_lock)
-> sci_controller_start(), atomic (*)
-> sci_controller_start_next_phy()
-> sci_phy_start()
-> sci_change_state(SCI_PHY_STARTING)phy.c: Enter SCI state *SCI_PHY_SUB_FINAL* # Cont. from [2A]
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_phy_starting_final_substate_enter()
-> sci_change_state(SCI_PHY_READY)
-> Enter SCI state: *SCI_PHY_READY*
-> sci_phy_ready_state_enter()
-> host.c: sci_controller_link_up()
-> sci_controller_start_next_phy()
-> sci_phy_start()
-> sci_change_state(SCI_PHY_STARTING)phy.c: sci_phy_event_handler(), atomic, discussed earlier (*)
-> sci_change_state(SCI_PHY_STARTING), 11 instances
port.c: isci_port_perform_hard_reset()spin_lock_irqsave(isci_host::scic_lock, )
-> port.c: sci_port_hard_reset(), atomic (*)
-> phy.c: sci_phy_reset()
-> sci_change_state(SCI_PHY_RESETTING)
-> enter SCI PHY state: *SCI_PHY_RESETTING*
-> sci_phy_resetting_state_enter()
-> sci_change_state(SCI_PHY_STARTING)[2A] Call chains for entering SCI state: *SCI_PHY_SUB_FINAL*
------------------------------------------------------------
host.c: power_control_timeout(), atomic, timer callback (*)spin_lock_irqsave(isci_host::scic_lock, )
-> phy.c: sci_phy_consume_power_handler()
-> phy.c: sci_change_state(SCI_PHY_SUB_FINAL)
host.c: sci_controller_error_handler(): atomic, irq handler (*)
OR host.c: sci_controller_completion_handler(), atomic, tasklet (*)
-> sci_controller_process_completions()
-> sci_controller_unsolicited_frame()
-> phy.c: sci_phy_frame_handler()
-> sci_change_state(SCI_PHY_SUB_AWAIT_SAS_POWER)
-> sci_phy_starting_await_sas_power_substate_enter()
-> host.c: sci_controller_power_control_queue_insert()
-> phy.c: sci_phy_consume_power_handler()
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_change_state(SCI_PHY_SUB_FINAL)
-> sci_controller_event_completion()
-> phy.c: sci_phy_event_handler()
-> sci_phy_start_sata_link_training()
-> sci_change_state(SCI_PHY_SUB_AWAIT_SATA_POWER)
-> sci_phy_starting_await_sata_power_substate_enter
-> host.c: sci_controller_power_control_queue_insert()
-> phy.c: sci_phy_consume_power_handler()
-> sci_change_state(SCI_PHY_SUB_FINAL)As can be seen from the "(*)" markers above, almost all the call-chains are atomic. The only exception, marked with "(+)", is a PCI ->remove() and PM_OPS ->suspend() cold path. Thus, pass GFP_ATOMIC to the libsas port event notifier.
Note, the now-replaced libsas APIs used in_interrupt() to implicitly decide which memory allocation type to use. This was only partially correct, as it fails to choose the correct GFP flags when just preemption or interrupts are disabled. Such buggy code paths are marked with "(@)" in the call chains above.
--- drivers/scsi/isci/port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/isci/port.c +2 -1
@@ -164,7 +164,8 @@ static void isci_port_bc_change_received(struct isci_host *ihost,"%s: isci_phy = %p, sas_phy = %p\n" , __func__, iphy, &iphy->sas_phy); -sas_notify_port_event (&iphy->sas_phy,PORTE_BROADCAST_RCVD ); +sas_notify_port_event_gfp (&iphy->sas_phy, +PORTE_BROADCAST_RCVD ,GFP_ATOMIC );sci_port_bcn_enable (iport); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 373/775 power: supply: axp20x_usb_power: Init work before enabling IRQs
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
[ Upstream commit b5e8642ed95ff6ecc20cc6038fe831affa9d098c ]
The IRQ handler calls mod_delayed_work() on power->vbus_detect. However, that work item is not initialized until after the IRQs are enabled. If an IRQ is already pending when the driver is probed, the driver calls mod_delayed_work() on an uninitialized work item, which causes an oops.
--- drivers/power/supply/axp20x_usb_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/axp20x_usb_power.c +1 -1
@@ -593,6 +593,7 @@ static int axp20x_usb_power_probe(struct platform_device *pdev) power->axp20x_id = axp_data->axp20x_id; power->regmap = axp20x->regmap; power->num_irqs = axp_data->num_irq_names; +INIT_DELAYED_WORK (&power->vbus_detect, axp20x_usb_power_poll_vbus);if (power->axp20x_id ==AXP202_ID ) {/* Enable vbus valid checking */
@@ -645,7 +646,6 @@ static int axp20x_usb_power_probe(struct platform_device *pdev) } } -INIT_DELAYED_WORK (&power->vbus_detect, axp20x_usb_power_poll_vbus);if (axp20x_usb_vbus_needs_polling (power))queue_delayed_work (system_power_efficient_wq, &power->vbus_detect,0 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 374/775 power: supply: smb347-charger: Fix interrupt usage if interrupt is unavailable
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 6996312642d2dad3070c3d276c7621f35e721f30 ]
The IRQ=0 could be a valid interrupt number in kernel because interrupt numbers are virtual in a modern kernel. Hence fix the interrupt usage in a case if interrupt is unavailable by not overriding the interrupt number which is used by the driver.
Note that currently Nexus 7 is the only know device which uses SMB347 kernel diver and it has a properly working interrupt, hence this patch doesn't fix any real problems, it's a minor cleanup/improvement.
--- drivers/power/supply/smb347-charger.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/power/supply/smb347-charger.c +8 -4
@@ -137,6 +137,7 @@* @mains_online: is AC/DC input connected * @usb_online: is USB input connected * @charging_enabled: is charging enabled +* @irq_unsupported: is interrupt unsupported by SMB hardware * @max_charge_current: maximum current (in uA) the battery can be charged * @max_charge_voltage: maximum voltage (in uV) the battery can be charged * @pre_charge_current: current (in uA) to use in pre-charging phase
@@ -193,6 +194,7 @@ struct smb347_charger {bool mains_online;bool usb_online;bool charging_enabled; +bool irq_unsupported;unsigned int max_charge_current;unsigned int max_charge_voltage;
@@ -862,6 +864,9 @@ static int smb347_irq_set(struct smb347_charger *smb, bool enable) {int ret; +if (smb->irq_unsupported) +return 0 ; + ret =smb347_set_writable (smb, true);if (ret <0 )return ret;
@@ -923,8 +928,6 @@ static int smb347_irq_init(struct smb347_charger *smb, ret =regmap_update_bits (smb->regmap,CFG_STAT ,CFG_STAT_ACTIVE_HIGH |CFG_STAT_DISABLED ,CFG_STAT_DISABLED ); -if (ret <0 ) - client->irq =0 ;smb347_set_writable (smb, false);
@@ -1345,6 +1348,7 @@ static int smb347_probe(struct i2c_client *client,if (ret <0 ) {dev_warn (dev,"failed to initialize IRQ: %d\n" , ret);dev_warn (dev,"disabling IRQ support\n" ); + smb->irq_unsupported = true; }else {smb347_irq_enable (smb); }
@@ -1357,8 +1361,8 @@ static int smb347_remove(struct i2c_client *client) {struct smb347_charger *smb =i2c_get_clientdata (client); -if (client->irq) -smb347_irq_disable (smb); +smb347_irq_disable (smb); +return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 375/775 regulator: core: Avoid debugfs: Directory ... already present! error
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit dbe954d8f1635f949a1d9a5d6e6fb749ae022b47 ]
Sometimes regulator_get() gets called twice for the same supply on the same device. This may happen e.g. when a framework / library is used which uses the regulator; and the driver itself also needs to enable the regulator in some cases where the framework will not enable it.
Commit ff268b56ce8c ("regulator: core: Don't spew backtraces on duplicate sysfs") already takes care of the backtrace which would trigger when creating a duplicate consumer symlink under /sys/class/regulator/regulator.%d in this scenario.
Commit c33d442328f5 ("debugfs: make error message a bit more verbose") causes a new error to get logged in this scenario:
[ 26.938425] debugfs: Directory 'wm5102-codec-MICVDD' with parent 'spi-WM510204:00-MICVDD' already present!
There is no _nowarn variant of debugfs_create_dir(), but we can detect and avoid this problem by checking the return value of the earlier sysfs_create_link_nowarn() call.
Add a check for the earlier sysfs_create_link_nowarn() failing with -EEXIST and skip the debugfs_create_dir() call in that case, avoiding this error getting logged.
--- drivers/regulator/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/regulator/core.c +3 -3
@@ -1617,7 +1617,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, const char *supply_name) {struct regulator *regulator; -int err; +int err =0 ;if (dev) {char buf[REG_STR_SIZE ];
@@ -1663,8 +1663,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, } } - regulator->debugfs =debugfs_create_dir (supply_name, - rdev->debugfs); +if (err != -EEXIST ) + regulator->debugfs =debugfs_create_dir (supply_name, rdev->debugfs);if (!regulator->debugfs) {rdev_dbg (rdev,"Failed to create debugfs directory\n" ); }else {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 376/775 isofs: release buffer head before return
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa ]
Release the buffer_head before returning error code in do_isofs_readdir() and isofs_find_entry().
--- fs/isofs/dir.c | 1 + fs/isofs/namei.c | 1 + 2 files changed, 2 insertions(+)
fs/isofs/dir.c +1 -0
@@ -152,6 +152,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,printk (KERN_NOTICE "iso9660: Corrupted directory entry" " in block %lu of inode %lu\n" , block, inode->i_ino); +brelse (bh);return -EIO ; }
fs/isofs/namei.c +1 -0
@@ -102,6 +102,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,printk (KERN_NOTICE "iso9660: Corrupted directory entry" " in block %lu of inode %lu\n" , block, dir->i_ino); +brelse (bh);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 377/775 watchdog: intel-mid_wdt: Postpone IRQ handler registration till SCU is ready
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit f285c9532b5bd3de7e37a6203318437cab79bd9a ]
When SCU is not ready and CONFIG_DEBUG_SHIRQ=y we got deferred probe followed by fired test IRQ which immediately makes kernel panic. Fix this by delaying IRQ handler registration till SCU is ready.
--- drivers/watchdog/intel-mid_wdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/watchdog/intel-mid_wdt.c +4 -4
@@ -154,6 +154,10 @@ static int mid_wdt_probe(struct platform_device *pdev)watchdog_set_nowayout (wdt_dev,WATCHDOG_NOWAYOUT );watchdog_set_drvdata (wdt_dev, mid); + mid->scu =devm_intel_scu_ipc_dev_get (dev); +if (!mid->scu) +return -EPROBE_DEFER ; + ret =devm_request_irq (dev, pdata->irq, mid_wdt_irq,IRQF_SHARED |IRQF_NO_SUSPEND ,"watchdog" , wdt_dev);
@@ -162,10 +166,6 @@ static int mid_wdt_probe(struct platform_device *pdev)return ret; } - mid->scu =devm_intel_scu_ipc_dev_get (dev); -if (!mid->scu) -return -EPROBE_DEFER ; -/* * The firmware followed by U-Boot leaves the watchdog running * with the default threshold which may vary. When we get here
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 378/775 auxdisplay: ht16k33: Fix refresh rate handling
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit e89b0a426721a8ca5971bc8d70aa5ea35c020f90 ]
Drop the call to msecs_to_jiffies(), as "HZ / fbdev->refresh_rate" is already the number of jiffies to wait.
--- drivers/auxdisplay/ht16k33.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/auxdisplay/ht16k33.c +1 -2
@@ -117,8 +117,7 @@ static void ht16k33_fb_queue(struct ht16k33_priv *priv) {struct ht16k33_fbdev *fbdev = &priv->fbdev; -schedule_delayed_work (&fbdev->work, -msecs_to_jiffies (HZ / fbdev->refresh_rate)); +schedule_delayed_work (&fbdev->work,HZ / fbdev->refresh_rate); }/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 379/775 auxdisplay: Fix duplicate CHARLCD config symbol
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit b45616445a6e346daf8a173a0c51413aec067ebb ]
A second CHARLCD config symbol was added instead of moving the existing one. Fix this by removing the old one.
--- drivers/auxdisplay/Kconfig | 3 --- 1 file changed, 3 deletions(-)
drivers/auxdisplay/Kconfig +0 -3
@@ -507,6 +507,3 @@ config PANEL depends on PARPORT select AUXDISPLAY select PARPORT_PANEL - -config CHARLCD - tristate "Character LCD core support" if COMPILE_TEST
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 380/775 objtool: Fix error handling for STD/CLD warnings
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 6f567c9300a5ebd7b18c26dda1c8d6ffbdd0debd ]
Actually return an error (and display a backtrace, if requested) for directional bit warnings.
--- tools/objtool/check.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/objtool/check.c +6 -2
@@ -2592,15 +2592,19 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,break ;case INSN_STD : -if (state.df) +if (state.df) {WARN_FUNC ("recursive STD" , sec, insn->offset); +return 1 ; + } state.df = true;break ;case INSN_CLD : -if (!state.df && func) +if (!state.df && func) {WARN_FUNC ("redundant CLD" , sec, insn->offset); +return 1 ; + } state.df = false;break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 381/775 objtool: Fix retpoline detection in asm code
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 1f9a1b74942485a0a29e7c4a9a9f2fe8aea17766 ]
The JMP_NOSPEC macro branches to __x86_retpoline_*() rather than the __x86_indirect_thunk_*() wrappers used by C code. Detect jumps to __x86_retpoline_*() as retpoline dynamic jumps.
Presumably this doesn't trigger a user-visible bug. I only found it when testing vmlinux.o validation.
--- tools/objtool/arch/x86/special.c | 2 +- tools/objtool/check.c | 3 ++- tools/objtool/check.h | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-)
tools/objtool/arch/x86/special.c +1 -1
@@ -48,7 +48,7 @@ bool arch_support_alt_relocation(struct special_alt *special_alt,* replacement group. */ return insn->offset == special_alt->new_off && - (insn->type ==INSN_CALL ||is_static_jump (insn)); + (insn->type ==INSN_CALL ||is_jump (insn)); }/*
tools/objtool/check.c +2 -1
@@ -789,7 +789,8 @@ static int add_jump_destinations(struct objtool_file *file) dest_sec = reloc->sym->sec; dest_off = reloc->sym->sym.st_value +arch_dest_reloc_offset (reloc->addend); - }else if (strstr (reloc->sym->name,"_indirect_thunk_" )) { + }else if (!strncmp (reloc->sym->name,"__x86_indirect_thunk_" ,21 ) || + !strncmp (reloc->sym->name,"__x86_retpoline_" ,16 )) {/* * Retpoline jumps are really dynamic jumps in * disguise, so convert them accordingly.
tools/objtool/check.h +11 -0
@@ -54,6 +54,17 @@ static inline bool is_static_jump(struct instruction *insn) insn->type ==INSN_JUMP_UNCONDITIONAL ; } +static inline bool is_dynamic_jump (struct instruction *insn) +{ +return insn->type ==INSN_JUMP_DYNAMIC || + insn->type ==INSN_JUMP_DYNAMIC_CONDITIONAL ; +} + +static inline bool is_jump (struct instruction *insn) +{ +return is_static_jump (insn) ||is_dynamic_jump (insn); +} +struct instruction *find_insn (struct objtool_file *file,struct section *sec,unsigned long offset);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 382/775 objtool: Fix ".cold" section suffix check for newer versions of GCC
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 34ca59e109bdf69704c33b8eeffaa4c9f71076e5 ]
With my version of GCC 9.3.1 the ".cold" subfunctions no longer have a numbered suffix, so the trailing period is no longer there.
Presumably this doesn't yet trigger a user-visible bug since most of the
subfunction detection logic is duplicated. I only found it when
testing vmlinux.o validation.
--- tools/objtool/check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/objtool/check.c +2 -2
@@ -850,8 +850,8 @@ static int add_jump_destinations(struct objtool_file *file)* case where the parent function's only reference to a * subfunction is through a jump table. */ -if (!strstr (insn->func->name,".cold." ) && -strstr (insn->jump_dest->func->name,".cold." )) { +if (!strstr (insn->func->name,".cold" ) && +strstr (insn->jump_dest->func->name,".cold" )) { insn->func->cfunc = insn->jump_dest->func; insn->jump_dest->func->pfunc = insn->func;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 383/775 scsi: lpfc: Fix ancient double free
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 0be310979e5e1272d4c5b557642df4da4ce7eba4 ]
The "pmb" pointer is freed at the start of the function and then freed again in the error handling code.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +7 -8
@@ -1145,13 +1145,14 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)struct lpfc_vport *vport = pmb->vport;LPFC_MBOXQ_t *sparam_mb;struct lpfc_dmabuf *sparam_mp; +u16 status = pmb->u.mb.mbxStatus;int rc; -if (pmb->u.mb.mbxStatus) - goto out; -mempool_free (pmb, phba->mbox_mem_pool); +if (status) + goto out; +/* don't perform discovery for SLI4 loopback diagnostic test */ if ((phba->sli_rev == LPFC_SLI_REV4) && !(phba->hba_flag & HBA_FCOE_MODE) &&
@@ -1214,12 +1215,10 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) out:lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT , -"0306 CONFIG_LINK mbxStatus error x%x " -"HBA state x%x\n" , - pmb->u.mb.mbxStatus, vport->port_state); -sparam_out: -mempool_free (pmb, phba->mbox_mem_pool); +"0306 CONFIG_LINK mbxStatus error x%x HBA state x%x\n" , + status, vport->port_state); +sparam_out:lpfc_linkdown (phba); lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 384/775 iommu: Switch gather->end to the inclusive end
In reply to Greg Kroah-HartmanFrom: Yong Wu <[email protected]>
[ Upstream commit 862c3715de8f3e5350489240c951d697f04bd8c9 ]
Currently gather->end is "unsigned long" which may be overflow in arch32 in the corner case: 0xfff00000 + 0x100000(iova + size). Although it doesn't affect the size(end - start), it affects the checking "gather->end < end"
This patch changes this "end" to the real end address (end = start + size - 1). Correspondingly, update the length to "end - start + 1".
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- drivers/iommu/mtk_iommu.c | 2 +- include/linux/iommu.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -1
@@ -2280,7 +2280,7 @@ static void arm_smmu_iotlb_sync(struct iommu_domain *domain, {struct arm_smmu_domain *smmu_domain =to_smmu_domain (domain); -arm_smmu_tlb_inv_range (gather->start, gather->end - gather->start, +arm_smmu_tlb_inv_range (gather->start, gather->end - gather->start +1 , gather->pgsize, true, smmu_domain); }
drivers/iommu/mtk_iommu.c +1 -1
@@ -444,7 +444,7 @@ static void mtk_iommu_iotlb_sync(struct iommu_domain *domain, struct iommu_iotlb_gather *gather) {struct mtk_iommu_data *data =mtk_iommu_get_m4u_data (); -size_t length = gather->end - gather->start; +size_t length = gather->end - gather->start +1 ;if (gather->start ==ULONG_MAX )return ;
include/linux/iommu.h +2 -2
@@ -170,7 +170,7 @@ enum iommu_dev_features {* struct iommu_iotlb_gather - Range information for a pending IOTLB flush * * @start: IOVA representing the start of the range to be flushed -* @end: IOVA representing the end of the range to be flushed (exclusive) +* @end: IOVA representing the end of the range to be flushed (inclusive) * @pgsize: The interval at which to perform the flush * * This structure is intended to be updated by multiple calls to the
@@ -538,7 +538,7 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain,struct iommu_iotlb_gather *gather, unsigned long iova, size_t size) { - unsigned long start = iova, end = start + size; + unsigned long start = iova, end = start + size - 1;/* * If the new page is disjoint from the current range or is mapped at
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 385/775 tools/testing/scatterlist: Fix overflow of max segment size
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 96667052149da3855c4361925324b690c687152f ]
Because SCATTERLIST_MAX_SEGMENT was removed and replaced with UINT_MAX, the test overflows the max_sgement variable. Remove this case.
--- tools/testing/scatterlist/main.c | 1 - 1 file changed, 1 deletion(-)
tools/testing/scatterlist/main.c +0 -1
@@ -55,7 +55,6 @@ int main(void)struct test *test, tests[] = { { -EINVAL ,1 ,pfn (0 ),NULL ,PAGE_SIZE ,0 ,1 }, {0 ,1 ,pfn (0 ),NULL ,PAGE_SIZE ,PAGE_SIZE +1 ,1 }, - {0 ,1 ,pfn (0 ),NULL ,PAGE_SIZE , sgmax +1 ,1 }, {0 ,1 ,pfn (0 ),NULL ,PAGE_SIZE , sgmax,1 }, {0 ,1 ,pfn (0 ),NULL ,1 , sgmax,1 }, {0 ,2 ,pfn (0 ,1 ),NULL ,2 *PAGE_SIZE , sgmax,1 },
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 386/775 RDMA/mlx5: Allow creating all QPs even when non RDMA profile is used
In reply to Greg Kroah-HartmanFrom: Mark Bloch <[email protected]>
[ Upstream commit 2614488d1f3cd5989375042286b11424208e20c8 ]
The cited commit disallowed creating any QP which isn't raw ethernet, reg umr or the special UD qp for testing WC, this proved too strict.
While modify can't be done (no GIDS/GID table for example) just creating a QP is okay.
This patch partially reverts the bellow mentioned commit and places the restriction at the modify QP stage and not at the creation. DEVX commands should be used to manipulate such QPs.
--- drivers/infiniband/hw/mlx5/qp.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +20 -7
@@ -2432,9 +2432,6 @@ static int check_qp_type(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr,case MLX5_IB_QPT_HW_GSI :case IB_QPT_DRIVER :case IB_QPT_GSI : -if (dev->profile == &raw_eth_profile) - goto out; - fallthrough;case IB_QPT_RAW_PACKET :case IB_QPT_UD :case MLX5_IB_QPT_REG_UMR :
@@ -2629,10 +2626,6 @@ static int process_create_flags(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,int create_flags = attr->create_flags;bool cond; -if (qp->type ==IB_QPT_UD && dev->profile == &raw_eth_profile) -if (create_flags & ~MLX5_IB_QP_CREATE_WC_TEST ) -return -EINVAL ; -if (qp_type ==MLX5_IB_QPT_DCT )return (create_flags) ? -EINVAL :0 ;
@@ -4211,6 +4204,23 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,return 0 ; } +static bool mlx5_ib_modify_qp_allowed (struct mlx5_ib_dev *dev, +struct mlx5_ib_qp *qp, +enum ib_qp_type qp_type) +{ +if (dev->profile != &raw_eth_profile) +return true; + +if (qp_type ==IB_QPT_RAW_PACKET || qp_type ==MLX5_IB_QPT_REG_UMR ) +return true; + +/* Internal QP used for wc testing, with NOPs in wq */ +if (qp->flags &MLX5_IB_QP_CREATE_WC_TEST ) +return true; + +return false; +} +int mlx5_ib_modify_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr,int attr_mask,struct ib_udata *udata) {
@@ -4223,6 +4233,9 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,int err = -EINVAL ;int port; +if (!mlx5_ib_modify_qp_allowed (dev, qp, ibqp->qp_type)) +return -EOPNOTSUPP ; +if (attr_mask & ~(IB_QP_ATTR_STANDARD_BITS |IB_QP_RATE_LIMIT ))return -EOPNOTSUPP ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 387/775 IB/umad: Return EIO in case of when device disassociated
In reply to Greg Kroah-HartmanFrom: Shay Drory <[email protected]>
[ Upstream commit 4fc5461823c9cad547a9bdfbf17d13f0da0d6bb5 ]
MAD message received by the user has EINVAL error in all flows including when the device is disassociated. That makes it impossible for the applications to treat such flow differently.
Change it to return EIO, so the applications will be able to perform disassociation recovery.
--- drivers/infiniband/core/user_mad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/core/user_mad.c +6 -1
@@ -379,6 +379,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,mutex_lock (&file->mutex); +if (file->agents_dead) { +mutex_unlock (&file->mutex); +return -EIO ; + } +while (list_empty (&file->recv_list)) {mutex_unlock (&file->mutex);
@@ -524,7 +529,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, agent =__get_agent (file, packet->mad.hdr.id);if (!agent) { - ret = -EINVAL ; + ret = -EIO ; goto err_up; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 388/775 IB/umad: Return EPOLLERR in case of when device disassociated
In reply to Greg Kroah-HartmanFrom: Shay Drory <[email protected]>
[ Upstream commit def4cd43f522253645b72c97181399c241b54536 ]
Currently, polling a umad device will always works, even if the device was disassociated. A disassociated device should immediately return EPOLLERR from poll(). Otherwise userspace is endlessly hung on poll() with no idea that the device has been removed from the system.
--- drivers/infiniband/core/user_mad.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/infiniband/core/user_mad.c +10 -0
@@ -397,6 +397,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,mutex_lock (&file->mutex); } +if (file->agents_dead) { +mutex_unlock (&file->mutex); +return -EIO ; + } + packet = list_entry(file->recv_list.next, struct ib_umad_packet, list);list_del (&packet->list);
@@ -658,10 +663,14 @@ static __poll_t ib_umad_poll(struct file *filp, struct poll_table_struct *wait)/* we will always be able to post a MAD send */ __poll_t mask =EPOLLOUT |EPOLLWRNORM ; +mutex_lock (&file->mutex);poll_wait (filp, &file->recv_wait, wait);if (!list_empty (&file->recv_list)) mask |=EPOLLIN |EPOLLRDNORM ; +if (file->agents_dead) + mask =EPOLLERR ; +mutex_unlock (&file->mutex);return mask; }
@@ -1341,6 +1350,7 @@ static void ib_umad_kill_port(struct ib_umad_port *port)list_for_each_entry (file, &port->file_list, port_list) {mutex_lock (&file->mutex); file->agents_dead =1 ; +wake_up_interruptible (&file->recv_wait);mutex_unlock (&file->mutex);for (id =0 ; id <IB_UMAD_MAX_AGENTS ; ++id)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 389/775 KVM: PPC: Make the VMX instruction emulation routines static
In reply to Greg Kroah-HartmanFrom: Cédric Le Goater <[email protected]>
[ Upstream commit 9236f57a9e51c72ce426ccd2e53e123de7196a0f ]
These are only used locally. It fixes these W=1 compile errors :
../arch/powerpc/kvm/powerpc.c:1521:5: error: no previous prototype for ‘kvmppc_get_vmx_dword’ [-Werror=missing-prototypes]
1521 | int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val)
| ^~~~~~~~~~~~~~~~~~~~
../arch/powerpc/kvm/powerpc.c:1539:5: error: no previous prototype for ‘kvmppc_get_vmx_word’ [-Werror=missing-prototypes]
1539 | int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val)
| ^~~~~~~~~~~~~~~~~~~
../arch/powerpc/kvm/powerpc.c:1557:5: error: no previous prototype for ‘kvmppc_get_vmx_hword’ [-Werror=missing-prototypes]
1557 | int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val)
| ^~~~~~~~~~~~~~~~~~~~
../arch/powerpc/kvm/powerpc.c:1575:5: error: no previous prototype for ‘kvmppc_get_vmx_byte’ [-Werror=missing-prototypes]
1575 | int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val)
| ^~~~~~~~~~~~~~~~~~~--- arch/powerpc/kvm/powerpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kvm/powerpc.c +4 -4
@@ -1518,7 +1518,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu,return emulated; } -int kvmppc_get_vmx_dword (struct kvm_vcpu *vcpu,int index,u64 *val) +static int kvmppc_get_vmx_dword (struct kvm_vcpu *vcpu,int index,u64 *val) {union kvmppc_one_reg reg;int vmx_offset =0 ;
@@ -1536,7 +1536,7 @@ int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val)return result; } -int kvmppc_get_vmx_word (struct kvm_vcpu *vcpu,int index,u64 *val) +static int kvmppc_get_vmx_word (struct kvm_vcpu *vcpu,int index,u64 *val) {union kvmppc_one_reg reg;int vmx_offset =0 ;
@@ -1554,7 +1554,7 @@ int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val)return result; } -int kvmppc_get_vmx_hword (struct kvm_vcpu *vcpu,int index,u64 *val) +static int kvmppc_get_vmx_hword (struct kvm_vcpu *vcpu,int index,u64 *val) {union kvmppc_one_reg reg;int vmx_offset =0 ;
@@ -1572,7 +1572,7 @@ int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val)return result; } -int kvmppc_get_vmx_byte (struct kvm_vcpu *vcpu,int index,u64 *val) +static int kvmppc_get_vmx_byte (struct kvm_vcpu *vcpu,int index,u64 *val) {union kvmppc_one_reg reg;int vmx_offset =0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 390/775 powerpc/kvm: Force selection of CONFIG_PPC_FPU
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 27f699579b64dbf27caf31e5c0eac567ec0aa8b8 ]
book3s/32 kvm is designed with the assumption that an FPU is always present.
Force selection of FPU support in the kernel when
build KVM.
--- arch/powerpc/kvm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kvm/Kconfig +1 -0
@@ -54,6 +54,7 @@ config KVM_BOOK3S_32 select KVM select KVM_BOOK3S_32_HANDLER select KVM_BOOK3S_PR_POSSIBLE + select PPC_FPU help Support running unmodified book3s_32 guest kernels in virtual machines on book3s_32 host processors.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 391/775 powerpc/47x: Disable 256k page size
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 910a0cb6d259736a0c86e795d4c2f42af8d0d775 ]
PPC47x_TLBE_SIZE isn't defined for 256k pages, leading to a build break if 256k pages is selected.
So change the kconfig so that 256k pages can't be selected for 47x.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -772,7 +772,7 @@ config PPC_64K_PAGES config PPC_256K_PAGES bool "256k page size" - depends on 44x && !STDBINUTILS + depends on 44x && !STDBINUTILS && !PPC_47x help Make the page size 256k.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 392/775 powerpc/sstep: Check instruction validity against ISA version before emulation
In reply to Greg Kroah-HartmanFrom: Ananth N Mavinakayanahalli <[email protected]>
[ Upstream commit 8813ff49607eab3caaf40fe8929b0ce7dc68e85f ]
We currently unconditionally try to emulate newer instructions on older Power versions that could cause issues. Gate it.
--- arch/powerpc/lib/sstep.c | 78 +++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 16 deletions(-)
arch/powerpc/lib/sstep.c +62 -16
@@ -1306,9 +1306,11 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,if ((word &0xfe2 ) ==2 ) op->type =SYSCALL ;else if (IS_ENABLED (CONFIG_PPC_BOOK3S_64 ) && - (word &0xfe3 ) ==1 ) + (word &0xfe3 ) ==1 ) {/* scv */ op->type =SYSCALL_VECTORED_0 ; -else +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; + }else op->type =UNKNOWN ;return 0 ;#endif
@@ -1412,7 +1414,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#ifdef __powerpc64__case 1 :if (!cpu_has_feature (CPU_FTR_ARCH_31 )) -return -1 ; + goto unknown_opcode; prefix_r =GET_PREFIX_R (word); ra =GET_PREFIX_RA (suffix);
@@ -1446,7 +1448,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#ifdef __powerpc64__case 4 :if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode;switch (word &0x3f ) {case 48 :/* maddhd */
@@ -1532,6 +1534,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 19 :if (((word >>1 ) &0x1f ) ==2 ) {/* addpcis */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; imm = (short ) (word &0xffc1 );/* d0 + d2 fields */ imm |= (word >>15 ) &0x3e ;/* d1 field */ op->val = regs->nip + (imm <<16 ) +4 ;
@@ -1844,7 +1848,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#ifdef __powerpc64__case 265 :/* modud */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; op->val = regs->gpr[ra] % regs->gpr[rb]; goto compute_done;#endif
@@ -1854,7 +1858,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 267 :/* moduw */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; op->val = (unsigned int ) regs->gpr[ra] % (unsigned int ) regs->gpr[rb]; goto compute_done;
@@ -1891,7 +1895,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#endif case 755 :/* darn */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode;switch (ra &0x3 ) {case 0 :/* 32-bit conditioned */
@@ -1913,14 +1917,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#ifdef __powerpc64__case 777 :/* modsd */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; op->val = (long int ) regs->gpr[ra] % (long int ) regs->gpr[rb]; goto compute_done;#endif case 779 :/* modsw */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; op->val = (int ) regs->gpr[ra] % (int ) regs->gpr[rb]; goto compute_done;
@@ -1997,14 +2001,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#endif case 538 :/* cnttzw */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; val = (unsigned int ) regs->gpr[rd]; op->val = (val ?__builtin_ctz (val) :32 ); goto logical_done;#ifdef __powerpc64__case 570 :/* cnttzd */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; val = regs->gpr[rd]; op->val = (val ?__builtin_ctzl (val) :64 ); goto logical_done;
@@ -2114,7 +2118,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 890 :/* extswsli with sh_5 = 0 */ case 891 :/* extswsli with sh_5 = 1 */ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) -return -1 ; + goto unknown_opcode; op->type =COMPUTE +SETREG ; sh = rb | ((word &2 ) <<4 ); val = (signed int ) regs->gpr[rd];
@@ -2441,6 +2445,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 268 :/* lxvx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (LOAD_VSX ,0 ,16 ); op->element_size =16 ;
@@ -2450,6 +2456,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 269 :/* lxvl */ case 301 : {/* lxvll */ int nb; +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->ea = ra ? regs->gpr[ra] :0 ; nb = regs->gpr[rb] &0xff ;
@@ -2470,13 +2478,15 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 333 :/* lxvpx */ if (!cpu_has_feature (CPU_FTR_ARCH_31 )) -return -1 ; + goto unknown_opcode; op->reg =VSX_REGISTER_XTP (rd); op->type =MKOP (LOAD_VSX ,0 ,32 ); op->element_size =32 ;break ;case 364 :/* lxvwsx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (LOAD_VSX ,0 ,4 ); op->element_size =4 ;
@@ -2484,6 +2494,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 396 :/* stxvx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (STORE_VSX ,0 ,16 ); op->element_size =16 ;
@@ -2493,6 +2505,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 397 :/* stxvl */ case 429 : {/* stxvll */ int nb; +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->ea = ra ? regs->gpr[ra] :0 ; nb = regs->gpr[rb] &0xff ;
@@ -2506,7 +2520,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, }case 461 :/* stxvpx */ if (!cpu_has_feature (CPU_FTR_ARCH_31 )) -return -1 ; + goto unknown_opcode; op->reg =VSX_REGISTER_XTP (rd); op->type =MKOP (STORE_VSX ,0 ,32 ); op->element_size =32 ;
@@ -2544,6 +2558,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 781 :/* lxsibzx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (LOAD_VSX ,0 ,1 ); op->element_size =8 ;
@@ -2551,6 +2567,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 812 :/* lxvh8x */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (LOAD_VSX ,0 ,16 ); op->element_size =2 ;
@@ -2558,6 +2576,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 813 :/* lxsihzx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (LOAD_VSX ,0 ,2 ); op->element_size =8 ;
@@ -2571,6 +2591,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 876 :/* lxvb16x */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (LOAD_VSX ,0 ,16 ); op->element_size =1 ;
@@ -2584,6 +2606,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 909 :/* stxsibx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (STORE_VSX ,0 ,1 ); op->element_size =8 ;
@@ -2591,6 +2615,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 940 :/* stxvh8x */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (STORE_VSX ,0 ,16 ); op->element_size =2 ;
@@ -2598,6 +2624,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 941 :/* stxsihx */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (STORE_VSX ,0 ,2 ); op->element_size =8 ;
@@ -2611,6 +2639,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 1004 :/* stxvb16x */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd | ((word &1 ) <<5 ); op->type =MKOP (STORE_VSX ,0 ,16 ); op->element_size =1 ;
@@ -2719,12 +2749,16 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, op->type =MKOP (LOAD_FP ,0 ,16 );break ;case 2 :/* lxsd */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd +32 ; op->type =MKOP (LOAD_VSX ,0 ,8 ); op->element_size =8 ; op->vsx_flags =VSX_CHECK_VEC ;break ;case 3 :/* lxssp */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->reg = rd +32 ; op->type =MKOP (LOAD_VSX ,0 ,4 ); op->element_size =8 ;
@@ -2754,7 +2788,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#ifdef CONFIG_VSX case 6 :if (!cpu_has_feature (CPU_FTR_ARCH_31 )) -return -1 ; + goto unknown_opcode; op->ea =dqform_ea (word, regs); op->reg =VSX_REGISTER_XTP (rd); op->element_size =32 ;
@@ -2777,6 +2811,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 1 :/* lxv */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->ea =dqform_ea (word, regs);if (word &8 ) op->reg = rd +32 ;
@@ -2787,6 +2823,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 2 :/* stxsd with LSB of DS field = 0 */ case 6 :/* stxsd with LSB of DS field = 1 */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->ea =dsform_ea (word, regs); op->reg = rd +32 ; op->type =MKOP (STORE_VSX ,0 ,8 );
@@ -2796,6 +2834,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,case 3 :/* stxssp with LSB of DS field = 0 */ case 7 :/* stxssp with LSB of DS field = 1 */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->ea =dsform_ea (word, regs); op->reg = rd +32 ; op->type =MKOP (STORE_VSX ,0 ,4 );
@@ -2804,6 +2844,8 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,break ;case 5 :/* stxv */ +if (!cpu_has_feature (CPU_FTR_ARCH_300 )) + goto unknown_opcode; op->ea =dqform_ea (word, regs);if (word &8 ) op->reg = rd +32 ;
@@ -2833,7 +2875,7 @@ 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 ; + goto unknown_opcode; prefix_r =GET_PREFIX_R (word); ra =GET_PREFIX_RA (suffix);
@@ -2982,6 +3024,10 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,return 0 ; + unknown_opcode: + op->type =UNKNOWN ; +return 0 ; + logical_done:if (word &1 )set_cr0 (regs, op);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 393/775 powerpc/sstep: Fix incorrect return from analyze_instr()
In reply to Greg Kroah-HartmanFrom: Ananth N Mavinakayanahalli <[email protected]>
[ Upstream commit 718aae916fa6619c57c348beaedd675835cf1aa1 ]
We currently just percolate the return value from analyze_instr() to the caller of emulate_step(), especially if it is a -1.
For one particular case (opcode = 4) for instructions that aren't currently emulated, we are returning 'should not be single-stepped' while we should have returned 0 which says 'did not emulate, may have to single-step'.
--- arch/powerpc/lib/sstep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +6 -1
@@ -1447,6 +1447,11 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,#ifdef __powerpc64__case 4 : +/* +* There are very many instructions with this primary opcode +* introduced in the ISA as early as v2.03. However, the ones +* we currently emulate were all introduced with ISA 3.0 +*/ if (!cpu_has_feature (CPU_FTR_ARCH_300 )) goto unknown_opcode;
@@ -1474,7 +1479,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,* There are other instructions from ISA 3.0 with the same * primary opcode which do not have emulation support yet. */ -return -1 ; + goto unknown_opcode;#endif case 7 :/* mulli */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 394/775 powerpc/time: Enable sched clock for irqtime
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
[ Upstream commit b709e32ef570b8b91dfbcb63cffac4324c87799f ]
When CONFIG_IRQ_TIME_ACCOUNTING and CONFIG_VIRT_CPU_ACCOUNTING_GEN, powerpc does not enable "sched_clock_irqtime" and can not utilize irq time accounting.
Like x86, powerpc does not use the sched_clock_register() interface. So it needs an dedicated call to enable_sched_clock_irqtime() to enable irq time accounting.
--- arch/powerpc/kernel/time.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/time.c +2 -0
@@ -53,6 +53,7 @@#include <linux/of_clk.h> #include <linux/suspend.h> #include <linux/sched/cputime.h> +#include <linux/sched/clock.h> #include <linux/processor.h> #include <asm/trace.h>
@@ -1030,6 +1031,7 @@ void __init time_init(void)tick_setup_hrtimer_broadcast ();of_clk_init (NULL ); +enable_sched_clock_irqtime (); }/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 395/775 powerpc: Fix build error in paravirt.h
In reply to Greg Kroah-HartmanFrom: Michal Suchanek <[email protected]>
[ Upstream commit 9899a56f1eca964cd0de21008a9fa1523a571231 ]
./arch/powerpc/include/asm/paravirt.h:83:44: error: implicit declaration of function 'smp_processor_id'; did you mean 'raw_smp_processor_id'?
smp_processor_id is defined in linux/smp.h but it is not included.
The build error happens only when the patch is applied to 5.3 kernel but it only works by chance in mainline.
--- arch/powerpc/include/asm/paravirt.h | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/include/asm/paravirt.h +1 -0
@@ -10,6 +10,7 @@#endif #ifdef CONFIG_PPC_SPLPAR +#include <linux/smp.h> #include <asm/kvm_guest.h> #include <asm/cputhreads.h>
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 396/775 mmc: owl-mmc: Fix a resource leak in an error handling path and in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5d15cbf63515c6183d2ed7c9dd0586b4db23ffb1 ]
'dma_request_chan()' calls should be balanced by a corresponding 'dma_release_channel()' call.
Add the missing call both in the error handling path of the probe function and in the remove function.
--- drivers/mmc/host/owl-mmc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mmc/host/owl-mmc.c +6 -3
@@ -640,7 +640,7 @@ static int owl_mmc_probe(struct platform_device *pdev) owl_host->irq =platform_get_irq (pdev,0 );if (owl_host->irq <0 ) { ret = -EINVAL ; - goto err_free_host; + goto err_release_channel; } ret = devm_request_irq(&pdev->dev, owl_host->irq, owl_irq_handler,
@@ -648,19 +648,21 @@ static int owl_mmc_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"Failed to request irq %d\n" , owl_host->irq); - goto err_free_host; + goto err_release_channel; } ret =mmc_add_host (mmc);if (ret) {dev_err (&pdev->dev,"Failed to add host\n" ); - goto err_free_host; + goto err_release_channel; }dev_dbg (&pdev->dev,"Owl MMC Controller Initialized\n" );return 0 ; +err_release_channel: +dma_release_channel (owl_host->dma); err_free_host:mmc_free_host (mmc);
@@ -674,6 +676,7 @@ static int owl_mmc_remove(struct platform_device *pdev)mmc_remove_host (mmc);disable_irq (owl_host->irq); +dma_release_channel (owl_host->dma);mmc_free_host (mmc);return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 397/775 mmc: sdhci-sprd: Fix some resource leaks in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit c9c256a8b0dc09c305c409d6264cc016af2ba38d ]
'sdhci_remove_host()' and 'sdhci_pltfm_free()' should be used in place of 'mmc_remove_host()' and 'mmc_free_host()'.
This avoids some resource leaks, is more in line with the error handling path of the probe function, and is more consistent with other drivers.
--- drivers/mmc/host/sdhci-sprd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-sprd.c +3 -3
@@ -708,14 +708,14 @@ static int sdhci_sprd_remove(struct platform_device *pdev) {struct sdhci_host *host =platform_get_drvdata (pdev);struct sdhci_sprd_host *sprd_host =TO_SPRD_HOST (host); -struct mmc_host *mmc = host->mmc; -mmc_remove_host (mmc); +sdhci_remove_host (host,0 ); +clk_disable_unprepare (sprd_host->clk_sdio);clk_disable_unprepare (sprd_host->clk_enable);clk_disable_unprepare (sprd_host->clk_2x_enable); -mmc_free_host (mmc); +sdhci_pltfm_free (pdev);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 398/775 mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 6052b3c370fb82dec28bcfff6d7ec0da84ac087a ]
A call to 'ausdhi6_dma_release()' to undo a previous call to 'usdhi6_dma_request()' is missing in the error handling path of the probe function.
It is already present in the remove function.
--- drivers/mmc/host/usdhi6rol0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +3 -1
@@ -1858,10 +1858,12 @@ static int usdhi6_probe(struct platform_device *pdev) ret =mmc_add_host (mmc);if (ret <0 ) - goto e_clk_off; + goto e_release_dma;return 0 ; +e_release_dma: +usdhi6_dma_release (host); e_clk_off:clk_disable_unprepare (host->clk); e_free_mmc:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 399/775 mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes
In reply to Greg Kroah-HartmanFrom: Takeshi Saito <[email protected]>
[ Upstream commit d7aefb2887601cf1fc3f86f55d43b2c9aece5e8f ]
According to the latest datasheet, the internal DMAC buffer alignment R-Car Gen3 SDHI HW should be 128-bytes. So, fix it.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +2 -2
@@ -186,8 +186,8 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host, mmc_get_dma_dir(data))) goto force_pio; -/* This DMAC cannot handle if buffer is not 8-bytes alignment */ -if (!IS_ALIGNED (sg_dma_address (sg),8 )) +/* This DMAC cannot handle if buffer is not 128-bytes alignment */ +if (!IS_ALIGNED (sg_dma_address (sg),128 )) goto force_pio_with_unmap;if (data->flags &MMC_DATA_READ ) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 400/775 ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores
In reply to Greg Kroah-HartmanFrom: Vladimir Murzin <[email protected]>
[ Upstream commit 2acb909750431030b65a0a2a17fd8afcbd813a84 ]
It was observed that decompressor running on hardware implementing ARM v8.2 Load/Store Multiple Atomicity and Ordering Control (LSMAOC), say, as guest, would stuck just after:
Uncompressing Linux... done, booting the kernel.
The reason is that it clears nTLSMD bit when disabling caches:
nTLSMD, bit [3]
When ARMv8.2-LSMAOC is implemented:
No Trap Load Multiple and Store Multiple to Device-nGRE/Device-nGnRE/Device-nGnRnE memory.
0b0 All memory accesses by A32 and T32 Load Multiple and Store
Multiple at EL1 or EL0 that are marked at stage 1 as Device-nGRE/Device-nGnRE/Device-nGnRnE memory are trapped and generate a stage 1 Alignment fault.
0b1 All memory accesses by A32 and T32 Load Multiple and Store
Multiple at EL1 or EL0 that are marked at stage 1 as Device-nGRE/Device-nGnRE/Device-nGnRnE memory are not trapped.
This bit is permitted to be cached in a TLB.
This field resets to 1.
Otherwise:
Reserved, RES1
So as effect we start getting traps we are not quite ready for.
Looking into history it seems that mask used for SCTLR clear came from the similar code for ARMv4, where bit[3] is the enable/disable bit for the write buffer. That not applicable to ARMv7 and onwards, so retire that bit from the masks.
--- arch/arm/boot/compressed/head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/compressed/head.S +2 -2
@@ -1164,9 +1164,9 @@ __armv4_mmu_cache_off: __armv7_mmu_cache_off: mrc p15, 0, r0, c1, c0 #ifdef CONFIG_MMU - bic r0, r0, #0x000d + bic r0, r0, #0x0005 #else - bic r0, r0, #0x000c + bic r0, r0, #0x0004 #endif mcr p15, 0, r0, c1, c0 @ turn MMU and cache off mov r0, #0
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 401/775 i2c: qcom-geni: Store DMA mapping data in geni_i2c_dev struct
In reply to Greg Kroah-HartmanFrom: Roja Rani Yarubandi <[email protected]>
[ Upstream commit 357ee8841d0b7bd822f25fc768afbc0c2ab7e47b ]
Store DMA mapping data in geni_i2c_dev struct to enhance DMA mapping data scope. For example during shutdown callback to unmap DMA mapping, this stored DMA mapping data can be used to call geni_se_tx_dma_unprep and geni_se_rx_dma_unprep functions.
Add two helper functions geni_i2c_rx_msg_cleanup and geni_i2c_tx_msg_cleanup to unwrap the things after rx/tx FIFO/DMA transfers, so that the same can be used in geni_i2c_stop_xfer() function during shutdown callback.
--- drivers/i2c/busses/i2c-qcom-geni.c | 59 ++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +43 -16
@@ -86,6 +86,9 @@ struct geni_i2c_dev {u32 clk_freq_out;const struct geni_i2c_clk_fld *clk_fld;int suspended; +void *dma_buf; +size_t xfer_len; +dma_addr_t dma_addr; };struct geni_i2c_err_log {
@@ -348,14 +351,39 @@ static void geni_i2c_tx_fsm_rst(struct geni_i2c_dev *gi2c)dev_err (gi2c->se.dev,"Timeout resetting TX_FSM\n" ); } +static void geni_i2c_rx_msg_cleanup (struct geni_i2c_dev *gi2c, +struct i2c_msg *cur) +{ + gi2c->cur_rd =0 ; +if (gi2c->dma_buf) { +if (gi2c->err) +geni_i2c_rx_fsm_rst (gi2c); +geni_se_rx_dma_unprep (&gi2c->se, gi2c->dma_addr, gi2c->xfer_len); +i2c_put_dma_safe_msg_buf (gi2c->dma_buf, cur, !gi2c->err); + } +} + +static void geni_i2c_tx_msg_cleanup (struct geni_i2c_dev *gi2c, +struct i2c_msg *cur) +{ + gi2c->cur_wr =0 ; +if (gi2c->dma_buf) { +if (gi2c->err) +geni_i2c_tx_fsm_rst (gi2c); +geni_se_tx_dma_unprep (&gi2c->se, gi2c->dma_addr, gi2c->xfer_len); +i2c_put_dma_safe_msg_buf (gi2c->dma_buf, cur, !gi2c->err); + } +} +static int geni_i2c_rx_one_msg (struct geni_i2c_dev *gi2c,struct i2c_msg *msg,u32 m_param) { -dma_addr_t rx_dma; +dma_addr_t rx_dma =0 ;unsigned long time_left;void *dma_buf;struct geni_se *se = &gi2c->se;size_t len = msg->len; +struct i2c_msg *cur; dma_buf =i2c_get_dma_safe_msg_buf (msg,32 );if (dma_buf)
@@ -370,19 +398,18 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,geni_se_select_mode (se,GENI_SE_FIFO );i2c_put_dma_safe_msg_buf (dma_buf, msg, false); dma_buf =NULL ; + }else { + gi2c->xfer_len = len; + gi2c->dma_addr = rx_dma; + gi2c->dma_buf = dma_buf; } + cur = gi2c->cur; time_left =wait_for_completion_timeout (&gi2c->done,XFER_TIMEOUT );if (!time_left)geni_i2c_abort_xfer (gi2c); - gi2c->cur_rd =0 ; -if (dma_buf) { -if (gi2c->err) -geni_i2c_rx_fsm_rst (gi2c); -geni_se_rx_dma_unprep (se, rx_dma, len); -i2c_put_dma_safe_msg_buf (dma_buf, msg, !gi2c->err); - } +geni_i2c_rx_msg_cleanup (gi2c, cur);return gi2c->err; }
@@ -390,11 +417,12 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,static int geni_i2c_tx_one_msg (struct geni_i2c_dev *gi2c,struct i2c_msg *msg,u32 m_param) { -dma_addr_t tx_dma; +dma_addr_t tx_dma =0 ;unsigned long time_left;void *dma_buf;struct geni_se *se = &gi2c->se;size_t len = msg->len; +struct i2c_msg *cur; dma_buf =i2c_get_dma_safe_msg_buf (msg,32 );if (dma_buf)
@@ -409,22 +437,21 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,geni_se_select_mode (se,GENI_SE_FIFO );i2c_put_dma_safe_msg_buf (dma_buf, msg, false); dma_buf =NULL ; + }else { + gi2c->xfer_len = len; + gi2c->dma_addr = tx_dma; + gi2c->dma_buf = dma_buf; }if (!dma_buf)/* Get FIFO IRQ */ writel_relaxed (1 , se->base +SE_GENI_TX_WATERMARK_REG ); + cur = gi2c->cur; time_left =wait_for_completion_timeout (&gi2c->done,XFER_TIMEOUT );if (!time_left)geni_i2c_abort_xfer (gi2c); - gi2c->cur_wr =0 ; -if (dma_buf) { -if (gi2c->err) -geni_i2c_tx_fsm_rst (gi2c); -geni_se_tx_dma_unprep (se, tx_dma, len); -i2c_put_dma_safe_msg_buf (dma_buf, msg, !gi2c->err); - } +geni_i2c_tx_msg_cleanup (gi2c, cur);return gi2c->err; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 402/775 i2c: i2c-qcom-geni: Add shutdown callback for i2c
In reply to Greg Kroah-HartmanFrom: Roja Rani Yarubandi <[email protected]>
[ Upstream commit e0371298ddc51761be257698554ea507ac8bf831 ]
If the hardware is still accessing memory after SMMU translation is disabled (as part of smmu shutdown callback), then the IOVAs (I/O virtual address) which it was using will go on the bus as the physical addresses which will result in unknown crashes like NoC/interconnect errors.
So, implement shutdown callback to i2c driver to stop on-going transfer and unmap DMA mappings during system "reboot" or "shutdown".
--- drivers/i2c/busses/i2c-qcom-geni.c | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/i2c/busses/i2c-qcom-geni.c +34 -0
@@ -375,6 +375,32 @@ static void geni_i2c_tx_msg_cleanup(struct geni_i2c_dev *gi2c, } } +static void geni_i2c_stop_xfer (struct geni_i2c_dev *gi2c) +{ +int ret; +u32 geni_status; +struct i2c_msg *cur; + +/* Resume device, as runtime suspend can happen anytime during transfer */ + ret =pm_runtime_get_sync (gi2c->se.dev); +if (ret <0 ) { +dev_err (gi2c->se.dev,"Failed to resume device: %d\n" , ret); +return ; + } + + geni_status =readl_relaxed (gi2c->se.base +SE_GENI_STATUS ); +if (geni_status &M_GENI_CMD_ACTIVE ) { + cur = gi2c->cur; +geni_i2c_abort_xfer (gi2c); +if (cur->flags &I2C_M_RD ) +geni_i2c_rx_msg_cleanup (gi2c, cur); +else +geni_i2c_tx_msg_cleanup (gi2c, cur); + } + +pm_runtime_put_sync_suspend (gi2c->se.dev); +} +static int geni_i2c_rx_one_msg (struct geni_i2c_dev *gi2c,struct i2c_msg *msg,u32 m_param) {
@@ -650,6 +676,13 @@ static int geni_i2c_remove(struct platform_device *pdev)return 0 ; } +static void geni_i2c_shutdown (struct platform_device *pdev) +{ +struct geni_i2c_dev *gi2c =platform_get_drvdata (pdev); + +geni_i2c_stop_xfer (gi2c); +} +static int __maybe_unused geni_i2c_runtime_suspend (struct device *dev) {int ret;
@@ -714,6 +747,7 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match);static struct platform_driver geni_i2c_driver = { .probe = geni_i2c_probe, .remove = geni_i2c_remove, + .shutdown = geni_i2c_shutdown, .driver = { .name ="geni_i2c" , .pm = &geni_i2c_pm_ops,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 403/775 i3c/master/mipi-i3c-hci: Specify HAS_IOMEM dependency
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 9d909f1b1e91b4aa7d016ed14b7b76dbf2675414 ]
The MIPI i3c HCI driver makes use of IOMEM functions like devm_platform_ioremap_resource(), which are only available if CONFIG_HAS_IOMEM is defined.
This causes the driver to be enabled under make ARCH=um allyesconfig, even though it won't build.
By adding a dependency on HAS_IOMEM, the driver will not be enabled on architectures which don't support it.
--- drivers/i3c/master/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/Kconfig +1 -0
@@ -25,6 +25,7 @@ config DW_I3C_MASTER config MIPI_I3C_HCI tristate "MIPI I3C Host Controller Interface driver (EXPERIMENTAL)" depends on I3C + depends on HAS_IOMEM help Support for hardware following the MIPI Aliance's I3C Host Controller Interface specification.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 404/775 amba: Fix resource leak for drivers without .remove
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit de5d7adb89367bbc87b4e5ce7afe7ae9bd86dc12 ]
Consider an amba driver with a .probe but without a .remove callback (e.g. pl061_gpio_driver). The function amba_probe() is called to bind a device and so dev_pm_domain_attach() and others are called. As there is no remove callback amba_remove() isn't called at unbind time however and so calling dev_pm_domain_detach() is missed and the pm domain keeps active.
To fix this always use the core driver callbacks and handle missing amba callbacks there. For probe refuse registration as a driver without probe doesn't make sense.
--- drivers/amba/bus.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/amba/bus.c +12 -8
@@ -299,10 +299,11 @@ static int amba_remove(struct device *dev) {struct amba_device *pcdev =to_amba_device (dev);struct amba_driver *drv =to_amba_driver (dev->driver); -int ret; +int ret =0 ;pm_runtime_get_sync (dev); - ret = drv->remove (pcdev); +if (drv->remove) + ret = drv->remove (pcdev);pm_runtime_put_noidle (dev);/* Undo the runtime PM settings in amba_probe() */
@@ -319,7 +320,9 @@ static int amba_remove(struct device *dev)static void amba_shutdown (struct device *dev) {struct amba_driver *drv =to_amba_driver (dev->driver); - drv->shutdown (to_amba_device (dev)); + +if (drv->shutdown) + drv->shutdown (to_amba_device (dev)); }/**
@@ -332,12 +335,13 @@ static void amba_shutdown(struct device *dev)*/ int amba_driver_register (struct amba_driver *drv) { - drv->drv.bus = &amba_bustype; +if (!drv->probe) +return -EINVAL ; -#define SETFN (fn) if (drv->fn) drv->drv.fn = amba_##fn -SETFN (probe); -SETFN (remove); -SETFN (shutdown); + drv->drv.bus = &amba_bustype; + drv->drv.probe = amba_probe; + drv->drv.remove = amba_remove; + drv->drv.shutdown = amba_shutdown;return driver_register (&drv->drv); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 405/775 iommu: Move iotlb_sync_map out from __iommu_map
In reply to Greg Kroah-HartmanFrom: Yong Wu <[email protected]>
[ Upstream commit d8c1df02ac7f2c802a9b2afc0f5c888c4217f1d5 ]
In the end of __iommu_map, It alway call iotlb_sync_map.
This patch moves iotlb_sync_map out from __iommu_map since it is unnecessary to call this for each sg segment especially iotlb_sync_map is flush tlb all currently. Add a little helper _iommu_map for this.
--- drivers/iommu/iommu.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/iommu/iommu.c +18 -5
@@ -2426,9 +2426,6 @@ static int __iommu_map(struct iommu_domain *domain, unsigned long iova, size -= pgsize; } -if (ops->iotlb_sync_map) - ops->iotlb_sync_map (domain); -/* unroll mapping in case something went wrong */ if (ret)iommu_unmap (domain, orig_iova, orig_size - size);
@@ -2438,18 +2435,31 @@ static int __iommu_map(struct iommu_domain *domain, unsigned long iova,return ret; } +static int _iommu_map (struct iommu_domain *domain,unsigned long iova, +phys_addr_t paddr,size_t size,int prot,gfp_t gfp) +{ +const struct iommu_ops *ops = domain->ops; +int ret; + + ret =__iommu_map (domain, iova, paddr, size, prot,GFP_KERNEL ); +if (ret ==0 && ops->iotlb_sync_map) + ops->iotlb_sync_map (domain); + +return ret; +} +int iommu_map (struct iommu_domain *domain,unsigned long iova,phys_addr_t paddr,size_t size,int prot) {might_sleep (); -return __iommu_map (domain, iova, paddr, size, prot,GFP_KERNEL ); +return _iommu_map (domain, iova, paddr, size, prot,GFP_KERNEL ); }EXPORT_SYMBOL_GPL (iommu_map);int iommu_map_atomic (struct iommu_domain *domain,unsigned long iova,phys_addr_t paddr,size_t size,int prot) { -return __iommu_map (domain, iova, paddr, size, prot,GFP_ATOMIC ); +return _iommu_map (domain, iova, paddr, size, prot,GFP_ATOMIC ); }EXPORT_SYMBOL_GPL (iommu_map_atomic);
@@ -2533,6 +2543,7 @@ static size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova, struct scatterlist *sg, unsigned int nents, int prot, gfp_t gfp) { + const struct iommu_ops *ops = domain->ops;size_t len =0 , mapped =0 ;phys_addr_t start;unsigned int i =0 ;
@@ -2563,6 +2574,8 @@ static size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova, sg =sg_next (sg); } +if (ops->iotlb_sync_map) + ops->iotlb_sync_map (domain);return mapped; out_err:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 406/775 iommu: Properly pass gfp_t in _iommu_map() to avoid atomic sleeping
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit b8437a3ef8c485903d05d1f261328aaf0c0a6cc2 ]
Sleeping while atomic = bad. Let's fix an obvious typo to try to avoid it.
The warning that was seen (on a downstream kernel with the problematic patch backported):
BUG: sleeping function called from invalid context at mm/page_alloc.c:4726 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 9, name: ksoftirqd/0 CPU: 0 PID: 9 Comm: ksoftirqd/0 Not tainted 5.4.93-12508-gc10c93e28e39 #1 Call trace: dump_backtrace+0x0/0x154 show_stack+0x20/0x2c dump_stack+0xa0/0xfc ___might_sleep+0x11c/0x12c __might_sleep+0x50/0x84 __alloc_pages_nodemask+0xf8/0x2bc __arm_lpae_alloc_pages+0x48/0x1b4 __arm_lpae_map+0x124/0x274 __arm_lpae_map+0x1cc/0x274 arm_lpae_map+0x140/0x170 arm_smmu_map+0x78/0xbc __iommu_map+0xd4/0x210 _iommu_map+0x4c/0x84 iommu_map_atomic+0x44/0x58 __iommu_dma_map+0x8c/0xc4 iommu_dma_map_page+0xac/0xf0
--- drivers/iommu/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
@@ -2441,7 +2441,7 @@ static int _iommu_map(struct iommu_domain *domain, unsigned long iova,const struct iommu_ops *ops = domain->ops;int ret; - ret =__iommu_map (domain, iova, paddr, size, prot,GFP_KERNEL ); + ret =__iommu_map (domain, iova, paddr, size, prot, gfp);if (ret ==0 && ops->iotlb_sync_map) ops->iotlb_sync_map (domain);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 407/775 IB/mlx5: Return appropriate error code instead of ENOMEM
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit d286ac1d05210695c312b9018b3aa7c2048e9aca ]
When mlx5_ib_stage_init_init() fails, return the error code related to failure instead of -ENOMEM.
--- drivers/infiniband/hw/mlx5/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/main.c +1 -2
@@ -3995,8 +3995,7 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev) err_mp:mlx5_ib_cleanup_multiport_master (dev); - -return -ENOMEM ; +return err; }static int mlx5_ib_enable_driver (struct ib_device *dev)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 408/775 IB/cm: Avoid a loop when device has 255 ports
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 131be26750379592f0dd6244b2a90bbb504a10bb ]
When RDMA device has 255 ports, loop iterator i overflows. Due to which cm_add_one() port iterator loops infinitely. Use core provided port iterator to avoid the infinite loop.
--- drivers/infiniband/core/cm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/core/cm.c +4 -4
@@ -4333,7 +4333,7 @@ static int cm_add_one(struct ib_device *ib_device)unsigned long flags;int ret;int count =0 ; -u8 i; +unsigned int i; cm_dev =kzalloc (struct_size (cm_dev, port, ib_device->phys_port_cnt),GFP_KERNEL );
@@ -4345,7 +4345,7 @@ static int cm_add_one(struct ib_device *ib_device) cm_dev->going_down =0 ;set_bit (IB_MGMT_METHOD_SEND , reg_req.method_mask); -for (i =1 ; i <= ib_device->phys_port_cnt; i++) { + rdma_for_each_port (ib_device, i) {if (!rdma_cap_ib_cm (ib_device, i))continue ;
@@ -4431,7 +4431,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) .clr_port_cap_mask = IB_PORT_CM_SUP };unsigned long flags; -int i; +unsigned int i;write_lock_irqsave (&cm.device_lock, flags);list_del (&cm_dev->list);
@@ -4441,7 +4441,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) cm_dev->going_down =1 ;spin_unlock_irq (&cm.lock); -for (i =1 ; i <= ib_device->phys_port_cnt; i++) { + rdma_for_each_port (ib_device, i) {if (!rdma_cap_ib_cm (ib_device, i))continue ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 409/775 tracepoint: Do not fail unregistering a probe due to memory failure
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
[ Upstream commit befe6d946551d65cddbd32b9cb0170b0249fd5ed ]
The list of tracepoint callbacks is managed by an array that is protected by RCU. To update this array, a new array is allocated, the updates are copied over to the new array, and then the list of functions for the tracepoint is switched over to the new array. After a completion of an RCU grace period, the old array is freed.
This process happens for both adding a callback as well as removing one. But on removing a callback, if the new array fails to be allocated, the callback is not removed, and may be used after it is freed by the clients of the tracepoint.
There's really no reason to fail if the allocation for a new array fails when removing a function. Instead, the function can simply be replaced by a stub function that could be cleaned up on the next modification of the array. That is, instead of calling the function registered to the tracepoint, it would call a stub function in its place.
[ Note, this version does use undefined compiler behavior (assuming that
a stub function with no parameters or return, can be called by a location that thinks it has parameters but still no return value. Static calls do the same thing, so this trick is not without precedent.
There's another solution that uses RCU tricks and is more complex, but can be an alternative if this solution becomes an issue.
]
--- kernel/tracepoint.c | 80 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 16 deletions(-)
kernel/tracepoint.c +64 -16
@@ -53,6 +53,12 @@ struct tp_probes {struct tracepoint_func probes[]; }; +/* Called in removal of a func but failed to allocate a new tp_funcs */ +static void tp_stub_func (void ) +{ +return ; +} +static inline void *allocate_probes (int count) { struct tp_probes *p = kmalloc(struct_size(p, probes, count),
@@ -131,6 +137,7 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func, {struct tracepoint_func *old, *new;int nr_probes =0 ; +int stub_funcs =0 ;int pos =-1 ;if (WARN_ON (!tp_func->func))
@@ -147,14 +154,34 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func,if (old[nr_probes].func == tp_func->func && old[nr_probes].data == tp_func->data)return ERR_PTR (-EEXIST ); +if (old[nr_probes].func == tp_stub_func) + stub_funcs++; } } -/* + 2 : one for new probe, one for NULL func */ - new =allocate_probes (nr_probes +2 ); +/* + 2 : one for new probe, one for NULL func - stub functions */ + new =allocate_probes (nr_probes +2 - stub_funcs);if (new ==NULL )return ERR_PTR (-ENOMEM );if (old) { -if (pos <0 ) { +if (stub_funcs) { +/* Need to copy one at a time to remove stubs */ +int probes =0 ; + + pos =-1 ; +for (nr_probes =0 ; old[nr_probes].func; nr_probes++) { +if (old[nr_probes].func == tp_stub_func) +continue ; +if (pos <0 && old[nr_probes].prio < prio) + pos = probes++; + new[probes++] = old[nr_probes]; + } + nr_probes = probes; +if (pos <0 ) + pos = probes; +else + nr_probes--;/* Account for insertion */ + + }else if (pos <0 ) { pos = nr_probes;memcpy (new, old, nr_probes *sizeof (struct tracepoint_func )); }else {
@@ -188,8 +215,9 @@ static void *func_remove(struct tracepoint_func **funcs,/* (N -> M), (N > 1, M >= 0) probes */ if (tp_func->func) {for (nr_probes =0 ; old[nr_probes].func; nr_probes++) { -if (old[nr_probes].func == tp_func->func && - old[nr_probes].data == tp_func->data) +if ((old[nr_probes].func == tp_func->func && + old[nr_probes].data == tp_func->data) || + old[nr_probes].func == tp_stub_func) nr_del++; } }
@@ -208,14 +236,32 @@ static void *func_remove(struct tracepoint_func **funcs,/* N -> M, (N > 1, M > 0) */ /* + 1 for NULL */ new =allocate_probes (nr_probes - nr_del +1 ); -if (new ==NULL ) -return ERR_PTR (-ENOMEM ); -for (i =0 ; old[i].func; i++) -if (old[i].func != tp_func->func - || old[i].data != tp_func->data) - new[j++] = old[i]; - new[nr_probes - nr_del].func =NULL ; - *funcs = new; +if (new) { +for (i =0 ; old[i].func; i++) +if ((old[i].func != tp_func->func + || old[i].data != tp_func->data) + && old[i].func != tp_stub_func) + new[j++] = old[i]; + new[nr_probes - nr_del].func =NULL ; + *funcs = new; + }else { +/* +* Failed to allocate, replace the old function +* with calls to tp_stub_func. +*/ +for (i =0 ; old[i].func; i++) +if (old[i].func == tp_func->func && + old[i].data == tp_func->data) { + old[i].func = tp_stub_func; +/* Set the prio to the next event. */ +if (old[i +1 ].func) + old[i].prio = + old[i +1 ].prio; +else + old[i].prio =-1 ; + } + *funcs = old; + } }debug_print_probes (*funcs);return old;
@@ -295,10 +341,12 @@ static int tracepoint_remove_func(struct tracepoint *tp, tp_funcs =rcu_dereference_protected (tp->funcs,lockdep_is_held (&tracepoints_mutex)); old =func_remove (&tp_funcs, func); -if (IS_ERR (old)) { -WARN_ON_ONCE (PTR_ERR (old) != -ENOMEM ); +if (WARN_ON_ONCE (IS_ERR (old)))return PTR_ERR (old); - } + +if (tp_funcs == old) +/* Failed allocating new tp_funcs, replaced func with stub */ +return 0 ;if (!tp_funcs) {/* Removed last function */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 410/775 rtc: zynqmp: depend on HAS_IOMEM
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit ddd0521549a975e6148732d6ca6b89ffa862c0e5 ]
The Xilinx zynqmp RTC driver makes use of IOMEM functions like devm_platform_ioremap_resource(), which are only available if CONFIG_HAS_IOMEM is defined.
This causes the driver not to be enable under make ARCH=um allyesconfig, even though it won't build.
By adding a dependency on HAS_IOMEM, the driver will not be enabled on architectures which don't support it.
--- drivers/rtc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/Kconfig +1 -1
@@ -1301,7 +1301,7 @@ config RTC_DRV_OPAL config RTC_DRV_ZYNQMP tristate "Xilinx Zynq Ultrascale+ MPSoC RTC" - depends on OF + depends on OF && HAS_IOMEM help If you say yes here you get support for the RTC controller found on Xilinx Zynq Ultrascale+ MPSoC.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 411/775 platform/x86: intel_pmt: Make INTEL_PMT_CLASS non-user-selectable
In reply to Greg Kroah-HartmanFrom: David E. Box <[email protected]>
[ Upstream commit 35d8a973fe4d38afee944db636c3d2b1df3741a7 ]
Fix error in Kconfig that exposed INTEL_PMT_CLASS as a user selectable option. It is already selected by INTEL_PMT_TELEMETRY and INTEL_PMT_CRASHLOG which are user selectable.
--- drivers/platform/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/Kconfig +1 -1
@@ -1369,7 +1369,7 @@ config INTEL_PMC_CORE - MPHY/PLL gating status (Sunrisepoint PCH only) config INTEL_PMT_CLASS - tristate "Intel Platform Monitoring Technology (PMT) Class driver" + tristate help The Intel Platform Monitoring Technology (PMT) class driver provides the basic sysfs interface and file hierarchy uses by PMT devices.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 412/775 platform/x86: intel_pmt_telemetry: Add dependency on MFD_INTEL_PMT
In reply to Greg Kroah-HartmanFrom: David E. Box <[email protected]>
[ Upstream commit f3f6da5014dea3cc005b36948abe3664b5d1f7d3 ]
All devices that expose Intel Platform Monitoring Technology (PMT) telemetry are currently owned by the intel_pmt MFD driver. Therefore make the telemetry driver depend on the MFD driver for build.
--- drivers/platform/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/Kconfig +1 -0
@@ -1382,6 +1382,7 @@ config INTEL_PMT_CLASS config INTEL_PMT_TELEMETRY tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" + depends on MFD_INTEL_PMT select INTEL_PMT_CLASS help The Intel Platform Monitory Technology (PMT) Telemetry driver provides
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 413/775 platform/x86: intel_pmt_crashlog: Add dependency on MFD_INTEL_PMT
In reply to Greg Kroah-HartmanFrom: David E. Box <[email protected]>
[ Upstream commit fdd3feb37e36bec2ad75d76f8ac4d0273c5c0a91 ]
All devices that expose Intel Platform Monitoring Technology (PMT) crashlog are currently owned by the intel_pmt MFD driver. Therefore make the crashlog driver depend on the MFD driver for build.
--- drivers/platform/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/Kconfig +1 -0
@@ -1394,6 +1394,7 @@ config INTEL_PMT_TELEMETRY config INTEL_PMT_CRASHLOG tristate "Intel Platform Monitoring Technology (PMT) Crashlog driver" + depends on MFD_INTEL_PMT select INTEL_PMT_CLASS help The Intel Platform Monitoring Technology (PMT) crashlog driver provides
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 414/775 perf tools: Fix DSO filtering when not finding a map for a sampled address
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit c69bf11ad3d30b6bf01cfa538ddff1a59467c734 ]
When we lookup an address and don't find a map we should filter that sample if the user specified a list of --dso entries to filter on, fix it.
Before:
$ perf script
sleep 274800 2843.556162: 1 cycles:u: ffffffffbb26bff4 [unknown] ([unknown])
sleep 274800 2843.556168: 1 cycles:u: ffffffffbb2b047d [unknown] ([unknown])
sleep 274800 2843.556171: 1 cycles:u: ffffffffbb2706b2 [unknown] ([unknown])
sleep 274800 2843.556174: 6 cycles:u: ffffffffbb2b0267 [unknown] ([unknown])
sleep 274800 2843.556176: 59 cycles:u: ffffffffbb2b03b1 [unknown] ([unknown])
sleep 274800 2843.556180: 691 cycles:u: ffffffffbb26bff4 [unknown] ([unknown])
sleep 274800 2843.556189: 9160 cycles:u: 7fa9550eeaa3 __GI___tunables_init+0xf3 (/usr/lib64/ld-2.32.so)
sleep 274800 2843.556312: 86937 cycles:u: 7fa9550e157b _dl_lookup_symbol_x+0x4b (/usr/lib64/ld-2.32.so)
$So we have some samples we somehow didn't find in a map for, if we now do:
$ perf report --stdio --dso /usr/lib64/ld-2.32.so
# dso: /usr/lib64/ld-2.32.so
#
# Total Lost Samples: 0
#
# Samples: 8 of event 'cycles:u'
# Event count (approx.): 96856
#
# Overhead Command Symbol
# ........ ....... ........................
#
89.76% sleep [.] _dl_lookup_symbol_x
9.46% sleep [.] __GI___tunables_init
0.71% sleep [k] 0xffffffffbb26bff4
0.06% sleep [k] 0xffffffffbb2b03b1
0.01% sleep [k] 0xffffffffbb2b0267
0.00% sleep [k] 0xffffffffbb2706b2
0.00% sleep [k] 0xffffffffbb2b047d
$After this patch we get the right output with just entries for the DSOs specified in --dso:
$ perf report --stdio --dso /usr/lib64/ld-2.32.so
# dso: /usr/lib64/ld-2.32.so
#
# Total Lost Samples: 0
#
# Samples: 8 of event 'cycles:u'
# Event count (approx.): 96856
#
# Overhead Command Symbol
# ........ ....... ........................
#
89.76% sleep [.] _dl_lookup_symbol_x
9.46% sleep [.] __GI___tunables_init
$
#--- tools/perf/util/event.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/event.c +2 -0
@@ -673,6 +673,8 @@ int machine__resolve(struct machine *machine, struct addr_location *al, } al->sym =map__find_symbol (al->map, al->addr); + }else if (symbol_conf.dso_list) { + al->filtered |= (1 <<HIST_FILTER__DSO ); }if (symbol_conf.sym_list) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 415/775 perf vendor events arm64: Fix Ampere eMag event typo
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 2bf797be81fa808f05f1a7a65916619132256a27 ]
The "briefdescription" for event 0x35 has a typo - fix it.
--- tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json +1 -1
@@ -114,7 +114,7 @@ "PublicDescription": "Level 2 access to instruciton TLB that caused a page table walk. This event counts on any instruciton access which causes L2I_TLB_REFILL to count", "EventCode": "0x35", "EventName": "L2I_TLB_ACCESS", - "BriefDescription": "L2D TLB access" + "BriefDescription": "L2I TLB access" }, { "PublicDescription": "Branch target buffer misprediction",
Signature · 9 lines
2.27.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 416/775 RDMA/rxe: Fix coding error in rxe_recv.c
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 7d9ae80e31df57dd3253e1ec514f0000aa588a81 ]
check_type_state() in rxe_recv.c is written as if the type bits in the packet opcode were a bit mask which is not correct. This patch corrects this code to compare all 3 type bits to the required type.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_recv.c +8 -3
@@ -9,21 +9,26 @@#include "rxe.h" #include "rxe_loc.h" +/* check that QP matches packet opcode type and is in a valid state */ static int check_type_state (struct rxe_dev *rxe,struct rxe_pkt_info *pkt,struct rxe_qp *qp) { +unsigned int pkt_type; +if (unlikely (!qp->valid)) goto err1; + pkt_type = pkt->opcode &0xe0 ; +switch (qp_type (qp)) {case IB_QPT_RC : -if (unlikely ((pkt->opcode &IB_OPCODE_RC ) !=0 )) { +if (unlikely (pkt_type !=IB_OPCODE_RC )) {pr_warn_ratelimited ("bad qp type\n" ); goto err1; }break ;case IB_QPT_UC : -if (unlikely (!(pkt->opcode &IB_OPCODE_UC ))) { +if (unlikely (pkt_type !=IB_OPCODE_UC )) {pr_warn_ratelimited ("bad qp type\n" ); goto err1; }
@@ -31,7 +36,7 @@ static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,case IB_QPT_UD :case IB_QPT_SMI :case IB_QPT_GSI : -if (unlikely (!(pkt->opcode &IB_OPCODE_UD ))) { +if (unlikely (pkt_type !=IB_OPCODE_UD )) {pr_warn_ratelimited ("bad qp type\n" ); goto err1; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 417/775 RDMA/rxe: Fix coding error in rxe_rcv_mcast_pkt
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 8fc1b7027fc162738d5a85c82410e501a371a404 ]
rxe_rcv_mcast_pkt() in rxe_recv.c can leak SKBs in error path code. The loop over the QPs attached to a multicast group creates new cloned SKBs for all but the last QP in the list and passes the SKB and its clones to rxe_rcv_pkt() for further processing. Any QPs that do not pass some checks are skipped. If the last QP in the list fails the tests the SKB is leaked. This patch checks if the SKB for the last QP was used and if not frees it. Also removes a redundant loop invariant assignment.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/infiniband/sw/rxe/rxe_recv.c +10 -6
@@ -257,7 +257,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)list_for_each_entry (mce, &mcg->qp_list, qp_list) { qp = mce->qp; - pkt =SKB_TO_PKT (skb);/* validate qp for incoming packet */ err =check_type_state (rxe, pkt, qp);
@@ -269,12 +268,18 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)continue ;/* for all but the last qp create a new clone of the -* skb and pass to the qp. +* skb and pass to the qp. If an error occurs in the +* checks for the last qp in the list we need to +* free the skb since it hasn't been passed on to +* rxe_rcv_pkt() which would free it later. */ -if (mce->qp_list.next != &mcg->qp_list) +if (mce->qp_list.next != &mcg->qp_list) { per_qp_skb =skb_clone (skb,GFP_ATOMIC ); -else + }else { per_qp_skb = skb; +/* show we have consumed the skb */ + skb =NULL ; + }if (unlikely (!per_qp_skb))continue ;
@@ -289,9 +294,8 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)rxe_drop_ref (mcg);/* drop ref from rxe_pool_get_key. */ -return ; - err1: +/* free skb if not consumed */ kfree_skb (skb); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 418/775 RDMA/rxe: Correct skb on loopback path
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 5120bf0a5fc15dec210a0fe0f39e4a256bb6e349 ]
rxe_net.c sends packets at the IP layer with skb->data pointing at the IP header but receives packets from a UDP tunnel with skb->data pointing at the UDP header. On the loopback path this was not correctly accounted for. This patch corrects for this by using sbk_pull() to strip the IP header from the skb on received packets.
--- drivers/infiniband/sw/rxe/rxe_net.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/sw/rxe/rxe_net.c +5 -0
@@ -414,6 +414,11 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb)void rxe_loopback (struct sk_buff *skb) { +if (skb->protocol ==htons (ETH_P_IP )) +skb_pull (skb,sizeof (struct iphdr )); +else +skb_pull (skb,sizeof (struct ipv6hdr )); +rxe_rcv (skb); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 419/775 spi: stm32: properly handle 0 byte transfer
In reply to Greg Kroah-HartmanFrom: Alain Volmat <[email protected]>
[ Upstream commit 2269f5a8b1a7b38651d62676b98182828f29d11a ]
On 0 byte transfer request, return straight from the xfer function after finalizing the transfer.
--- drivers/spi/spi-stm32.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi-stm32.c +4 -0
@@ -1677,6 +1677,10 @@ static int stm32_spi_transfer_one(struct spi_master *master,struct stm32_spi *spi =spi_master_get_devdata (master);int ret; +/* Don't do anything on 0 bytes transfers */ +if (transfer->len ==0 ) +return 0 ; + spi->tx_buf = transfer->tx_buf; spi->rx_buf = transfer->rx_buf; spi->tx_len = spi->tx_buf ? transfer->len :0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 420/775 mfd: altera-sysmgr: Fix physical address storing more
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit b0b5b16b78cea1b2b990a69ab8e07a42ccf7a2ed ]
A recent fix improved the way the resource gets passed to the low-level accessors, but left one warning that appears in configurations with a resource_size_t that is wider than a pointer:
In file included from drivers/mfd/altera-sysmgr.c:19:drivers/mfd/altera-sysmgr.c: In function 'sysmgr_probe':drivers/mfd/altera-sysmgr.c:148:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start,
| ^include/linux/regmap.h:646:6: note: in definition of macro '__regmap_lockdep_wrapper'
646 | fn(__VA_ARGS__, &_key, \
| ^~~~~~~~~~~
drivers/mfd/altera-sysmgr.c:148:12: note: in expansion of macro 'devm_regmap_init'
148 | regmap = devm_regmap_init(dev, NULL, (void *)res->start,
| ^~~~~~~~~~~~~~~~I had tried a different approach that would store the address in the private data as a phys_addr_t, but the easiest solution now seems to be to add a double cast to shut up the warning.
As the address is passed to an inline assembly, it is guaranteed to not be wider than a register anyway.
--- drivers/mfd/altera-sysmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/altera-sysmgr.c +2 -1
@@ -145,7 +145,8 @@ static int sysmgr_probe(struct platform_device *pdev) sysmgr_config.reg_write = s10_protected_reg_write;/* Need physical address for SMCC call */ - regmap =devm_regmap_init (dev,NULL , (void *)res->start, + regmap =devm_regmap_init (dev,NULL , + (void *)(uintptr_t )res->start, &sysmgr_config); }else { base =devm_ioremap (dev, res->start,resource_size (res));
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 421/775 mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 26783d74cc6a440ee3ef9836a008a697981013d0 ]
The "req" struct is always added to the "wm831x->auxadc_pending" list, but it's only removed from the list on the success path. If a failure occurs then the "req" struct is freed but it's still on the list, leading to a use after free.
--- drivers/mfd/wm831x-auxadc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mfd/wm831x-auxadc.c +1 -2
@@ -93,11 +93,10 @@ static int wm831x_auxadc_read_irq(struct wm831x *wm831x,wait_for_completion_timeout (&req->done,msecs_to_jiffies (500 ));mutex_lock (&wm831x->auxadc_lock); - -list_del (&req->list); ret = req->val; out: +list_del (&req->list);mutex_unlock (&wm831x->auxadc_lock);kfree (req);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 422/775 powerpc/pseries/dlpar: handle ibm, configure-connector delay status
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit 768d70e19ba525debd571b36e6d0ab19956c63d7 ]
dlpar_configure_connector() has two problems in its handling of ibm,configure-connector's return status:
1. When the status is -2 (busy, call again), we call ibm,configure-connector again immediately without checking whether to schedule, which can result in monopolizing the CPU.
2. Extended delay status (9900..9905) goes completely unhandled, causing the configuration to unnecessarily terminate.
Fix both of these issues by using rtas_busy_delay().
--- arch/powerpc/platforms/pseries/dlpar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/dlpar.c +3 -4
@@ -127,7 +127,6 @@ void dlpar_free_cc_nodes(struct device_node *dn)#define NEXT_PROPERTY 3#define PREV_PARENT 4#define MORE_MEMORY 5 -#define CALL_AGAIN -2#define ERR_CFG_USE -9003 struct device_node *dlpar_configure_connector(__be32 drc_index,
@@ -168,6 +167,9 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,spin_unlock (&rtas_data_buf_lock); +if (rtas_busy_delay (rc)) +continue ; +switch (rc) {case COMPLETE :break ;
@@ -216,9 +218,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, last_dn = last_dn->parent;break ; -case CALL_AGAIN : -break ; -case MORE_MEMORY :case ERR_CFG_USE :default :
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 423/775 powerpc/8xx: Fix software emulation interrupt
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 903178d0ce6bb30ef80a3604ab9ee2b57869fbc9 ]
For unimplemented instructions or unimplemented SPRs, the 8xx triggers a "Software Emulation Exception" (0x1000). That interrupt doesn't set reason bits in SRR1 as the "Program Check Exception" does.
Go through emulation_assist_interrupt() to set REASON_ILLEGAL.
--- arch/powerpc/kernel/head_8xx.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/head_8xx.S +1 -1
@@ -165,7 +165,7 @@ SystemCall: /* On the MPC8xx, this is a software emulation interrupt. It occurs * for all unimplemented and illegal instructions. */ - EXCEPTION(0x1000, SoftEmu, program_check_exception, EXC_XFER_STD) + EXCEPTION(0x1000, SoftEmu, emulation_assist_interrupt, EXC_XFER_STD) . = 0x1100 /*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 424/775 powerpc/sstep: Fix load-store and update emulation
In reply to Greg Kroah-HartmanFrom: Sandipan Das <[email protected]>
[ Upstream commit bbda4b6c7d7c7f79da71f95c92a5d76be22c3efd ]
The Power ISA says that the fixed-point load and update instructions must neither use R0 for the base address (RA) nor have the destination (RT) and the base address (RA) as the same register. Similarly, for fixed-point stores and floating-point loads and stores, the instruction is invalid when R0 is used as the base address (RA).
This is applicable to the following instructions.
* Load Byte and Zero with Update (lbzu)
* Load Byte and Zero with Update Indexed (lbzux)
* Load Halfword and Zero with Update (lhzu)
* Load Halfword and Zero with Update Indexed (lhzux)
* Load Halfword Algebraic with Update (lhau)
* Load Halfword Algebraic with Update Indexed (lhaux)
* Load Word and Zero with Update (lwzu)
* Load Word and Zero with Update Indexed (lwzux)
* Load Word Algebraic with Update Indexed (lwaux)
* Load Doubleword with Update (ldu)
* Load Doubleword with Update Indexed (ldux)
* Load Floating Single with Update (lfsu)
* Load Floating Single with Update Indexed (lfsux)
* Load Floating Double with Update (lfdu)
* Load Floating Double with Update Indexed (lfdux)
* Store Byte with Update (stbu)
* Store Byte with Update Indexed (stbux)
* Store Halfword with Update (sthu)
* Store Halfword with Update Indexed (sthux)
* Store Word with Update (stwu)
* Store Word with Update Indexed (stwux)
* Store Doubleword with Update (stdu)
* Store Doubleword with Update Indexed (stdux)
* Store Floating Single with Update (stfsu)
* Store Floating Single with Update Indexed (stfsux)
* Store Floating Double with Update (stfdu)
* Store Floating Double with Update Indexed (stfdux)
E.g. the following behaviour is observed for an invalid load and update instruction having RA = RT.
While a userspace program having an instruction word like 0xe9ce0001, i.e. ldu r14, 0(r14), runs without getting receiving a SIGILL on a Power system (observed on P8 and P9), the outcome of executing that instruction word varies and its behaviour can be considered to be undefined.
Attaching an uprobe at that instruction's address results in emulation which currently performs the load as well as writes the effective address back to the base register. This might not match the outcome from hardware.
To remove any inconsistencies, this adds additional checks for the aforementioned instructions to make sure that the emulation infrastructure treats them as unknown. The kernel can then fallback to executing such instructions on hardware.
--- arch/powerpc/lib/sstep.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/powerpc/lib/sstep.c +14 -0
@@ -3019,6 +3019,20 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, } +if (OP_IS_LOAD_STORE (op->type) && (op->type &UPDATE )) { +switch (GETTYPE (op->type)) { +case LOAD : +if (ra == rd) + goto unknown_opcode; + fallthrough; +case STORE : +case LOAD_FP : +case STORE_FP : +if (ra ==0 ) + goto unknown_opcode; + } + } +#ifdef CONFIG_VSX if ((GETTYPE(op->type) == LOAD_VSX || GETTYPE(op->type) == STORE_VSX) &&
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 425/775 powerpc/sstep: Fix darn emulation
In reply to Greg Kroah-HartmanFrom: Sandipan Das <[email protected]>
[ Upstream commit 22b89ba178dd0a66a26699ead014a3e73ff8e044 ]
Commit 8813ff49607e ("powerpc/sstep: Check instruction validity against ISA version before emulation") introduced a proper way to skip unknown instructions. This makes sure that the same is used for the darn instruction when the range selection bits have a reserved value.
--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +1 -1
@@ -1918,7 +1918,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, goto compute_done; } -return -1 ; + goto unknown_opcode;#ifdef __powerpc64__case 777 :/* modsd */ if (!cpu_has_feature (CPU_FTR_ARCH_300 ))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 426/775 clk: qcom: gfm-mux: fix clk mask
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 78ddb79cab178534b2c1d9ab95823f2af882ee8e ]
For some reason global GFM_MASK ended up with bit 1 instead of bit 0. Remove the global GFM_MASK and reuse mux_mask field.
--- drivers/clk/qcom/lpass-gfm-sm8250.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/lpass-gfm-sm8250.c +4 -4
@@ -33,14 +33,13 @@ struct clk_gfm {void __iomem *gfm_mux; }; -#define GFM_MASK BIT(1)#define to_clk_gfm (_hw) container_of(_hw, struct clk_gfm, hw)static u8 clk_gfm_get_parent (struct clk_hw *hw) {struct clk_gfm *clk =to_clk_gfm (hw); -return readl (clk->gfm_mux) &GFM_MASK ; +return readl (clk->gfm_mux) & clk->mux_mask; }static int clk_gfm_set_parent (struct clk_hw *hw,u8 index)
@@ -51,9 +50,10 @@ static int clk_gfm_set_parent(struct clk_hw *hw, u8 index) val =readl (clk->gfm_mux);if (index) - val |=GFM_MASK ; + val |= clk->mux_mask;else - val &= ~GFM_MASK ; + val &= ~clk->mux_mask; +writel (val, clk->gfm_mux);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 427/775 clk: qcom: gcc-sc7180: Mark the MM XO clocks to be always ON
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit d79dfa19ca4235c28be62952bda6091babdcf8f3 ]
There are intermittent GDSC power-up failures observed for titan top gdsc, which requires the XO clock. Thus mark all the MM XO clocks always enabled from probe.
--- drivers/clk/qcom/gcc-sc7180.c | 47 +++-------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-)
drivers/clk/qcom/gcc-sc7180.c +4 -43
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. +* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */ #include <linux/clk-provider.h>
@@ -919,19 +919,6 @@ static struct clk_branch gcc_camera_throttle_hf_axi_clk = { }, }; -static struct clk_branch gcc_camera_xo_clk = { - .halt_reg =0xb02c , - .halt_check =BRANCH_HALT , - .clkr = { - .enable_reg =0xb02c , - .enable_mask =BIT (0 ), - .hw.init = &(struct clk_init_data ){ - .name ="gcc_camera_xo_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gcc_ce1_ahb_clk = { .halt_reg =0x4100c , .halt_check =BRANCH_HALT_VOTED ,
@@ -1096,19 +1083,6 @@ static struct clk_branch gcc_disp_throttle_hf_axi_clk = { }, }; -static struct clk_branch gcc_disp_xo_clk = { - .halt_reg =0xb030 , - .halt_check =BRANCH_HALT , - .clkr = { - .enable_reg =0xb030 , - .enable_mask =BIT (0 ), - .hw.init = &(struct clk_init_data ){ - .name ="gcc_disp_xo_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gcc_gp1_clk = { .halt_reg =0x64000 , .halt_check =BRANCH_HALT ,
@@ -2159,19 +2133,6 @@ static struct clk_branch gcc_video_throttle_axi_clk = { }, }; -static struct clk_branch gcc_video_xo_clk = { - .halt_reg =0xb028 , - .halt_check =BRANCH_HALT , - .clkr = { - .enable_reg =0xb028 , - .enable_mask =BIT (0 ), - .hw.init = &(struct clk_init_data ){ - .name ="gcc_video_xo_clk" , - .ops = &clk_branch2_ops, - }, - }, -}; -static struct clk_branch gcc_mss_cfg_ahb_clk = { .halt_reg =0x8a000 , .halt_check =BRANCH_HALT ,
@@ -2304,7 +2265,6 @@ static struct clk_regmap *gcc_sc7180_clocks[] = { [GCC_BOOT_ROM_AHB_CLK] = &gcc_boot_rom_ahb_clk.clkr, [GCC_CAMERA_HF_AXI_CLK] = &gcc_camera_hf_axi_clk.clkr, [GCC_CAMERA_THROTTLE_HF_AXI_CLK] = &gcc_camera_throttle_hf_axi_clk.clkr, - [GCC_CAMERA_XO_CLK] = &gcc_camera_xo_clk.clkr, [GCC_CE1_AHB_CLK] = &gcc_ce1_ahb_clk.clkr, [GCC_CE1_AXI_CLK] = &gcc_ce1_axi_clk.clkr, [GCC_CE1_CLK] = &gcc_ce1_clk.clkr,
@@ -2317,7 +2277,6 @@ static struct clk_regmap *gcc_sc7180_clocks[] = { [GCC_DISP_GPLL0_DIV_CLK_SRC] = &gcc_disp_gpll0_div_clk_src.clkr, [GCC_DISP_HF_AXI_CLK] = &gcc_disp_hf_axi_clk.clkr, [GCC_DISP_THROTTLE_HF_AXI_CLK] = &gcc_disp_throttle_hf_axi_clk.clkr, - [GCC_DISP_XO_CLK] = &gcc_disp_xo_clk.clkr, [GCC_GP1_CLK] = &gcc_gp1_clk.clkr, [GCC_GP1_CLK_SRC] = &gcc_gp1_clk_src.clkr, [GCC_GP2_CLK] = &gcc_gp2_clk.clkr,
@@ -2413,7 +2372,6 @@ static struct clk_regmap *gcc_sc7180_clocks[] = { [GCC_VIDEO_AXI_CLK] = &gcc_video_axi_clk.clkr, [GCC_VIDEO_GPLL0_DIV_CLK_SRC] = &gcc_video_gpll0_div_clk_src.clkr, [GCC_VIDEO_THROTTLE_AXI_CLK] = &gcc_video_throttle_axi_clk.clkr, - [GCC_VIDEO_XO_CLK] = &gcc_video_xo_clk.clkr, [GPLL0] = &gpll0.clkr, [GPLL0_OUT_EVEN] = &gpll0_out_even.clkr, [GPLL6] = &gpll6.clkr,
@@ -2510,6 +2468,9 @@ static int gcc_sc7180_probe(struct platform_device *pdev)regmap_update_bits (regmap,0x0b004 ,BIT (0 ),BIT (0 ));regmap_update_bits (regmap,0x0b008 ,BIT (0 ),BIT (0 ));regmap_update_bits (regmap,0x0b00c ,BIT (0 ),BIT (0 )); +regmap_update_bits (regmap,0x0b02c ,BIT (0 ),BIT (0 )); +regmap_update_bits (regmap,0x0b028 ,BIT (0 ),BIT (0 )); +regmap_update_bits (regmap,0x0b030 ,BIT (0 ),BIT (0 ));regmap_update_bits (regmap,0x71004 ,BIT (0 ),BIT (0 )); ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 428/775 clk: qcom: gcc-msm8998: Fix Alpha PLL type for all GPLLs
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 292f75ecff07e8a07fe2e3e19b4b567d0b698842 ]
All of the GPLLs in the MSM8998 Global Clock Controller are Fabia PLLs and not generic alphas: this was producing bad effects over the entire clock tree of MSM8998, where any GPLL child clock was declaring a false clock rate, due to their parent also showing the same.
The issue resides in the calculation of the clock rate for the specific Alpha PLL type, where Fabia has a different register layout; switching the MSM8998 GPLLs to the correct Alpha Fabia PLL type fixes the rate (calculation) reading. While at it, also make these PLLs fixed since their rate is supposed to *never* be changed while the system runs, as this would surely crash the entire SoC.
Now all the children of all the PLLs are also complying with their specified clock table and system stability is improved.
--- drivers/clk/qcom/gcc-msm8998.c | 100 ++++++++++++++++----------------- 1 file changed, 50 insertions(+), 50 deletions(-)
drivers/clk/qcom/gcc-msm8998.c +50 -50
@@ -135,7 +135,7 @@ static struct pll_vco fabia_vco[] = {static struct clk_alpha_pll gpll0 = { .offset =0x0 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .vco_table = fabia_vco, .num_vco =ARRAY_SIZE (fabia_vco), .clkr = {
@@ -145,58 +145,58 @@ static struct clk_alpha_pll gpll0 = { .name = "gpll0", .parent_names = (const char *[]){ "xo" }, .num_parents = 1, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_fabia_ops, } }, };static struct clk_alpha_pll_postdiv gpll0_out_even = { .offset =0x0 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll0_out_even" , .parent_names = (const char *[]){"gpll0" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll0_out_main = { .offset =0x0 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll0_out_main" , .parent_names = (const char *[]){"gpll0" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll0_out_odd = { .offset =0x0 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll0_out_odd" , .parent_names = (const char *[]){"gpll0" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll0_out_test = { .offset =0x0 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll0_out_test" , .parent_names = (const char *[]){"gpll0" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll gpll1 = { .offset =0x1000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .vco_table = fabia_vco, .num_vco =ARRAY_SIZE (fabia_vco), .clkr = {
@@ -206,58 +206,58 @@ static struct clk_alpha_pll gpll1 = { .name = "gpll1", .parent_names = (const char *[]){ "xo" }, .num_parents = 1, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_fabia_ops, } }, };static struct clk_alpha_pll_postdiv gpll1_out_even = { .offset =0x1000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll1_out_even" , .parent_names = (const char *[]){"gpll1" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll1_out_main = { .offset =0x1000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll1_out_main" , .parent_names = (const char *[]){"gpll1" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll1_out_odd = { .offset =0x1000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll1_out_odd" , .parent_names = (const char *[]){"gpll1" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll1_out_test = { .offset =0x1000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll1_out_test" , .parent_names = (const char *[]){"gpll1" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll gpll2 = { .offset =0x2000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .vco_table = fabia_vco, .num_vco =ARRAY_SIZE (fabia_vco), .clkr = {
@@ -267,58 +267,58 @@ static struct clk_alpha_pll gpll2 = { .name = "gpll2", .parent_names = (const char *[]){ "xo" }, .num_parents = 1, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_fabia_ops, } }, };static struct clk_alpha_pll_postdiv gpll2_out_even = { .offset =0x2000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll2_out_even" , .parent_names = (const char *[]){"gpll2" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll2_out_main = { .offset =0x2000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll2_out_main" , .parent_names = (const char *[]){"gpll2" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll2_out_odd = { .offset =0x2000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll2_out_odd" , .parent_names = (const char *[]){"gpll2" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll2_out_test = { .offset =0x2000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll2_out_test" , .parent_names = (const char *[]){"gpll2" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll gpll3 = { .offset =0x3000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .vco_table = fabia_vco, .num_vco =ARRAY_SIZE (fabia_vco), .clkr = {
@@ -328,58 +328,58 @@ static struct clk_alpha_pll gpll3 = { .name = "gpll3", .parent_names = (const char *[]){ "xo" }, .num_parents = 1, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_fabia_ops, } }, };static struct clk_alpha_pll_postdiv gpll3_out_even = { .offset =0x3000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll3_out_even" , .parent_names = (const char *[]){"gpll3" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll3_out_main = { .offset =0x3000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll3_out_main" , .parent_names = (const char *[]){"gpll3" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll3_out_odd = { .offset =0x3000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll3_out_odd" , .parent_names = (const char *[]){"gpll3" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll3_out_test = { .offset =0x3000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll3_out_test" , .parent_names = (const char *[]){"gpll3" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll gpll4 = { .offset =0x77000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .vco_table = fabia_vco, .num_vco =ARRAY_SIZE (fabia_vco), .clkr = {
@@ -389,52 +389,52 @@ static struct clk_alpha_pll gpll4 = { .name = "gpll4", .parent_names = (const char *[]){ "xo" }, .num_parents = 1, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_fabia_ops, } }, };static struct clk_alpha_pll_postdiv gpll4_out_even = { .offset =0x77000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll4_out_even" , .parent_names = (const char *[]){"gpll4" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll4_out_main = { .offset =0x77000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll4_out_main" , .parent_names = (const char *[]){"gpll4" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll4_out_odd = { .offset =0x77000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll4_out_odd" , .parent_names = (const char *[]){"gpll4" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };static struct clk_alpha_pll_postdiv gpll4_out_test = { .offset =0x77000 , - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA ], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll4_out_test" , .parent_names = (const char *[]){"gpll4" }, .num_parents =1 , - .ops = &clk_alpha_pll_postdiv_ops, + .ops = &clk_alpha_pll_postdiv_fabia_ops, }, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 429/775 kunit: tool: fix unit test cleanup handling
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit cfd607e43da4a20753744f134e201310262b827a ]
* Stop leaking file objects.
* Use self.addCleanup() to ensure we call cleanup functions even if setUp() fails.
* use mock.patch.stopall instead of more error-prone manual approach
--- tools/testing/kunit/kunit_tool_test.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
tools/testing/kunit/kunit_tool_test.py +6 -8
@@ -288,19 +288,17 @@ class StrContains(str): class KUnitMainTest(unittest.TestCase): def setUp(self): path = get_absolute_path('test_data/test_is_test_passed-all_passed.log') - file = open(path) - all_passed_log = file.readlines() - self.print_patch = mock.patch('builtins.print') - self.print_mock = self.print_patch.start() + with open(path) as file: + all_passed_log = file.readlines() + + self.print_mock = mock.patch('builtins.print').start() + self.addCleanup(mock.patch.stopall) + self.linux_source_mock = mock.Mock() self.linux_source_mock.build_reconfig = mock.Mock(return_value=True) self.linux_source_mock.build_um_kernel = mock.Mock(return_value=True) self.linux_source_mock.run_kernel = mock.Mock(return_value=all_passed_log) - def tearDown(self): - self.print_patch.stop() - pass - def test_config_passes_args_pass(self): kunit.main(['config', '--build_dir=.kunit'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 1
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 430/775 kselftests: dmabuf-heaps: Fix Makefiles inclusion of the kernels usr/include dir
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
[ Upstream commit 64ba3d591c9d2be2a9c09e99b00732afe002ad0d ]
Copied in from somewhere else, the makefile was including the kerne's usr/include dir, which caused the asm/ioctl.h file to be used.
Unfortunately, that file has different values for _IOC_SIZEBITS and _IOC_WRITE than include/uapi/asm-generic/ioctl.h which then causes the _IOCW macros to give the wrong ioctl numbers, specifically for DMA_BUF_IOCTL_SYNC.
This patch simply removes the extra include from the Makefile
--- tools/testing/selftests/dmabuf-heaps/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/dmabuf-heaps/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS += -static -O3 -Wl,-no-as-needed -Wall -I../../../../usr/include +CFLAGS += -static -O3 -Wl,-no-as-needed -Wall TEST_GEN_PROGS = dmabuf-heap
Signature · 8 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 431/775 RDMA/hns: Allocate one more recv SGE for HIP08
In reply to Greg Kroah-HartmanFrom: Lang Cheng <[email protected]>
[ Upstream commit 9dd052474a2645b2a6171d19ad17b05b180d446d ]
The RQ/SRQ of HIP08 needs one special sge to stop receive reliably. So the driver needs to allocate at least one SGE when creating RQ/SRQ and ensure that at least one SGE is filled with the special value during post_recv.
Besides, the kernel driver should only do this for kernel ULP. For userspace ULP, the userspace driver will allocate the reserved SGE in buffer, and the kernel driver just needs to pin the corresponding size of memory based on the userspace driver's requirements.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 4 +++ drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 28 ++++++++++----- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 3 +- drivers/infiniband/hw/hns/hns_roce_qp.c | 37 +++++++++++++++---- drivers/infiniband/hw/hns/hns_roce_srq.c | 40 +++++++++++++++++++-- 5 files changed, 93 insertions(+), 19 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +4 -0
@@ -65,6 +65,8 @@#define HNS_ROCE_CQE_WCMD_EMPTY_BIT 0x2#define HNS_ROCE_MIN_CQE_CNT 16 +#define HNS_ROCE_RESERVED_SGE 1 +#define HNS_ROCE_MAX_IRQ_NUM 128#define HNS_ROCE_SGE_IN_WQE 2
@@ -393,6 +395,7 @@ struct hns_roce_wq {spinlock_t lock;u32 wqe_cnt;/* WQE num */ u32 max_gs; +u32 rsv_sge;int offset;int wqe_shift;/* WQE size */ u32 head;
@@ -496,6 +499,7 @@ struct hns_roce_srq {unsigned long srqn;u32 wqe_cnt;int max_gs; +u32 rsv_sge;int wqe_shift;void __iomem *db_reg_l;
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +19 -9
@@ -741,6 +741,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,unsigned long flags;void *wqe =NULL ;u32 wqe_idx; +u32 max_sge;int nreq;int ret;int i;
@@ -754,6 +755,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp, goto out; } + max_sge = hr_qp->rq.max_gs - hr_qp->rq.rsv_sge;for (nreq =0 ; wr; ++nreq, wr = wr->next) {if (unlikely (hns_roce_wq_overflow (&hr_qp->rq, nreq, hr_qp->ibqp.recv_cq))) {
@@ -764,9 +766,9 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp, wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt -1 ); -if (unlikely (wr->num_sge > hr_qp->rq.max_gs)) { +if (unlikely (wr->num_sge > max_sge)) {ibdev_err (ibdev,"num_sge = %d >= max_sge = %u.\n" , - wr->num_sge, hr_qp->rq.max_gs); + wr->num_sge, max_sge); ret = -EINVAL ; *bad_wr = wr; goto out;
@@ -781,9 +783,10 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp, dseg++; } -if (wr->num_sge < hr_qp->rq.max_gs) { +if (hr_qp->rq.rsv_sge) { dseg->lkey =cpu_to_le32 (HNS_ROCE_INVALID_LKEY ); dseg->addr =0 ; + dseg->len =cpu_to_le32 (HNS_ROCE_INVALID_SGE_LENGTH ); }/* rq support inline data */
@@ -879,6 +882,7 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,__le32 *srq_idx;int ret =0 ;int wqe_idx; +u32 max_sge;void *wqe;int nreq;int i;
@@ -886,9 +890,13 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,spin_lock_irqsave (&srq->lock, flags); ind = srq->head & (srq->wqe_cnt -1 ); + max_sge = srq->max_gs - srq->rsv_sge;for (nreq =0 ; wr; ++nreq, wr = wr->next) { -if (unlikely (wr->num_sge >= srq->max_gs)) { +if (unlikely (wr->num_sge > max_sge)) { +ibdev_err (&hr_dev->ib_dev, +"srq: num_sge = %d, max_sge = %u.\n" , + wr->num_sge, max_sge); ret = -EINVAL ; *bad_wr = wr;break ;
@@ -916,9 +924,9 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq, dseg[i].addr =cpu_to_le64 (wr->sg_list[i].addr); } -if (wr->num_sge < srq->max_gs) { - dseg[i].len =0 ; - dseg[i].lkey =cpu_to_le32 (0x100 ); +if (srq->rsv_sge) { + dseg[i].len =cpu_to_le32 (HNS_ROCE_INVALID_SGE_LENGTH ); + dseg[i].lkey =cpu_to_le32 (HNS_ROCE_INVALID_LKEY ); dseg[i].addr =0 ; }
@@ -1999,10 +2007,12 @@ static int hns_roce_query_pf_caps(struct hns_roce_dev *hr_dev) caps->max_sq_sg =le16_to_cpu (resp_a->max_sq_sg); caps->max_sq_inline =le16_to_cpu (resp_a->max_sq_inline); caps->max_rq_sg =le16_to_cpu (resp_a->max_rq_sg); + caps->max_rq_sg =roundup_pow_of_two (caps->max_rq_sg); caps->max_extend_sg =le32_to_cpu (resp_a->max_extend_sg); caps->num_qpc_timer =le16_to_cpu (resp_a->num_qpc_timer); caps->num_cqc_timer =le16_to_cpu (resp_a->num_cqc_timer); caps->max_srq_sges =le16_to_cpu (resp_a->max_srq_sges); + caps->max_srq_sges =roundup_pow_of_two (caps->max_srq_sges); caps->num_aeq_vectors = resp_a->num_aeq_vectors; caps->num_other_vectors = resp_a->num_other_vectors; caps->max_sq_desc_sz = resp_a->max_sq_desc_sz;
@@ -5083,7 +5093,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, done: qp_attr->cur_qp_state = qp_attr->qp_state; qp_attr->cap.max_recv_wr = hr_qp->rq.wqe_cnt; - qp_attr->cap.max_recv_sge = hr_qp->rq.max_gs; + qp_attr->cap.max_recv_sge = hr_qp->rq.max_gs - hr_qp->rq.rsv_sge;if (!ibqp->uobject) { qp_attr->cap.max_send_wr = hr_qp->sq.wqe_cnt;
@@ -5395,7 +5405,7 @@ static int hns_roce_v2_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr) attr->srq_limit = limit_wl; attr->max_wr = srq->wqe_cnt -1 ; - attr->max_sge = srq->max_gs; + attr->max_sge = srq->max_gs - srq->rsv_sge; out:hns_roce_free_cmd_mailbox (hr_dev, mailbox);
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +2 -1
@@ -96,7 +96,8 @@#define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ PAGE_SIZE#define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFFF000#define HNS_ROCE_V2_MAX_INNER_MTPT_NUM 2 -#define HNS_ROCE_INVALID_LKEY 0x100 +#define HNS_ROCE_INVALID_LKEY 0x0 +#define HNS_ROCE_INVALID_SGE_LENGTH 0x80000000#define HNS_ROCE_CMQ_TX_TIMEOUT 30000#define HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE 2#define HNS_ROCE_V2_RSV_QPS 8
drivers/infiniband/hw/hns/hns_roce_qp.c +31 -6
@@ -413,9 +413,32 @@ static void free_qpn(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp)mutex_unlock (&hr_dev->qp_table.bank_mutex); } +static u32 proc_rq_sge (struct hns_roce_dev *dev,struct hns_roce_qp *hr_qp, +bool user) +{ +u32 max_sge = dev->caps.max_rq_sg; + +if (dev->pci_dev->revision >=PCI_REVISION_ID_HIP09 ) +return max_sge; + +/* Reserve SGEs only for HIP08 in kernel; The userspace driver will +* calculate number of max_sge with reserved SGEs when allocating wqe +* buf, so there is no need to do this again in kernel. But the number +* may exceed the capacity of SGEs recorded in the firmware, so the +* kernel driver should just adapt the value accordingly. +*/ +if (user) + max_sge =roundup_pow_of_two (max_sge +1 ); +else + hr_qp->rq.rsv_sge =1 ; + +return max_sge; +} +static int set_rq_size (struct hns_roce_dev *hr_dev,struct ib_qp_cap *cap, -struct hns_roce_qp *hr_qp,int has_rq) +struct hns_roce_qp *hr_qp,int has_rq,bool user) { +u32 max_sge =proc_rq_sge (hr_dev, hr_qp, user);u32 cnt;/* If srq exist, set zero for relative number of rq */
@@ -431,8 +454,9 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap,/* Check the validity of QP support capacity */ if (!cap->max_recv_wr || cap->max_recv_wr > hr_dev->caps.max_wqes || - cap->max_recv_sge > hr_dev->caps.max_rq_sg) { -ibdev_err (&hr_dev->ib_dev,"RQ config error, depth=%u, sge=%d\n" , + cap->max_recv_sge > max_sge) { +ibdev_err (&hr_dev->ib_dev, +"RQ config error, depth = %u, sge = %u\n" , cap->max_recv_wr, cap->max_recv_sge);return -EINVAL ; }
@@ -444,7 +468,8 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap,return -EINVAL ; } - hr_qp->rq.max_gs =roundup_pow_of_two (max (1U , cap->max_recv_sge)); + hr_qp->rq.max_gs =roundup_pow_of_two (max (1U , cap->max_recv_sge) + + hr_qp->rq.rsv_sge);if (hr_dev->caps.max_rq_sg <=HNS_ROCE_SGE_IN_WQE ) hr_qp->rq.wqe_shift =ilog2 (hr_dev->caps.max_rq_desc_sz);
@@ -459,7 +484,7 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap, hr_qp->rq_inl_buf.wqe_cnt =0 ; cap->max_recv_wr = cnt; - cap->max_recv_sge = hr_qp->rq.max_gs; + cap->max_recv_sge = hr_qp->rq.max_gs - hr_qp->rq.rsv_sge;return 0 ; }
@@ -919,7 +944,7 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, hr_qp->sq_signal_bits =IB_SIGNAL_REQ_WR ; ret =set_rq_size (hr_dev, &init_attr->cap, hr_qp, -hns_roce_qp_has_rq (init_attr)); +hns_roce_qp_has_rq (init_attr), !!udata);if (ret) {ibdev_err (ibdev,"failed to set user RQ size, ret = %d.\n" , ret);
drivers/infiniband/hw/hns/hns_roce_srq.c +37 -3
@@ -3,6 +3,7 @@* Copyright (c) 2018 Hisilicon Limited. */ +#include <linux/pci.h> #include <rdma/ib_umem.h> #include "hns_roce_device.h" #include "hns_roce_cmd.h"
@@ -279,6 +280,28 @@ static void free_srq_wrid(struct hns_roce_srq *srq) srq->wrid =NULL ; } +static u32 proc_srq_sge (struct hns_roce_dev *dev,struct hns_roce_srq *hr_srq, +bool user) +{ +u32 max_sge = dev->caps.max_srq_sges; + +if (dev->pci_dev->revision >=PCI_REVISION_ID_HIP09 ) +return max_sge; + +/* Reserve SGEs only for HIP08 in kernel; The userspace driver will +* calculate number of max_sge with reserved SGEs when allocating wqe +* buf, so there is no need to do this again in kernel. But the number +* may exceed the capacity of SGEs recorded in the firmware, so the +* kernel driver should just adapt the value accordingly. +*/ +if (user) + max_sge =roundup_pow_of_two (max_sge +1 ); +else + hr_srq->rsv_sge =1 ; + +return max_sge; +} +int hns_roce_create_srq (struct ib_srq *ib_srq,struct ib_srq_init_attr *init_attr,struct ib_udata *udata)
@@ -288,6 +311,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,struct hns_roce_srq *srq =to_hr_srq (ib_srq);struct ib_device *ibdev = &hr_dev->ib_dev;struct hns_roce_ib_create_srq ucmd = {}; +u32 max_sge;int ret;u32 cqn;
@@ -295,16 +319,24 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, init_attr->srq_type != IB_SRQT_XRC)return -EOPNOTSUPP ; -/* Check the actual SRQ wqe and SRQ sge num */ + max_sge =proc_srq_sge (hr_dev, srq, !!udata); +if (init_attr->attr.max_wr >= hr_dev->caps.max_srq_wrs || - init_attr->attr.max_sge > hr_dev->caps.max_srq_sges) + init_attr->attr.max_sge > max_sge) { +ibdev_err (&hr_dev->ib_dev, +"SRQ config error, depth = %u, sge = %d\n" , + init_attr->attr.max_wr, init_attr->attr.max_sge);return -EINVAL ; + }mutex_init (&srq->mutex);spin_lock_init (&srq->lock); srq->wqe_cnt =roundup_pow_of_two (init_attr->attr.max_wr +1 ); - srq->max_gs = init_attr->attr.max_sge; + srq->max_gs = +roundup_pow_of_two (init_attr->attr.max_sge + srq->rsv_sge); + init_attr->attr.max_wr = srq->wqe_cnt; + init_attr->attr.max_sge = srq->max_gs;if (udata) { ret = ib_copy_from_udata(&ucmd, udata,
@@ -351,6 +383,8 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, srq->event = hns_roce_ib_srq_event; resp.srqn = srq->srqn; + srq->max_gs = init_attr->attr.max_sge; + init_attr->attr.max_sge = srq->max_gs - srq->rsv_sge;if (udata) { ret = ib_copy_to_udata(udata, &resp,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 432/775 RDMA/hns: Bugfix for checking whether the srq is full when post wr
In reply to Greg Kroah-HartmanFrom: Wenpeng Liang <[email protected]>
[ Upstream commit 1620f09b96ec14c1ff1ff64ee0aeabc027c653d5 ]
If a user posts WR by wr_list, the head pointer of idx_queue won't be updated until all wqes are filled, so the judgment of whether head equals to tail will get a wrong result. Fix above issue and move the head and tail pointer from the srq structure into the idx_queue structure. After idx_queue is filled with wqe idx, the head pointer of it will increase.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 4 ++-- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 19 ++++++++++++++----- drivers/infiniband/hw/hns/hns_roce_srq.c | 5 +++-- 3 files changed, 19 insertions(+), 9 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +2 -2
@@ -492,6 +492,8 @@ struct hns_roce_idx_que {struct hns_roce_mtr mtr;int entry_shift;unsigned long *bitmap; +u32 head; +u32 tail; };struct hns_roce_srq {
@@ -511,8 +513,6 @@ struct hns_roce_srq {u64 *wrid;struct hns_roce_idx_que idx_que;spinlock_t lock; -u16 head; -u16 tail;struct mutex mutex;void (*event)(struct hns_roce_srq *srq,enum hns_roce_event event); };
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +14 -5
@@ -849,11 +849,20 @@ static void hns_roce_free_srq_wqe(struct hns_roce_srq *srq, int wqe_index)spin_lock (&srq->lock);bitmap_clear (srq->idx_que.bitmap, wqe_index,1 ); - srq->tail++; + srq->idx_que.tail++;spin_unlock (&srq->lock); } +int hns_roce_srqwq_overflow (struct hns_roce_srq *srq,int nreq) +{ +struct hns_roce_idx_que *idx_que = &srq->idx_que; +unsigned int cur; + + cur = idx_que->head - idx_que->tail; +return cur + nreq >= srq->wqe_cnt -1 ; +} +static int find_empty_entry (struct hns_roce_idx_que *idx_que,unsigned long size) {
@@ -889,7 +898,7 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,spin_lock_irqsave (&srq->lock, flags); - ind = srq->head & (srq->wqe_cnt -1 ); + ind = srq->idx_que.head & (srq->wqe_cnt -1 ); max_sge = srq->max_gs - srq->rsv_sge;for (nreq =0 ; wr; ++nreq, wr = wr->next) {
@@ -902,7 +911,7 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,break ; } -if (unlikely (srq->head == srq->tail)) { +if (unlikely (hns_roce_srqwq_overflow (srq, nreq))) { ret = -ENOMEM ; *bad_wr = wr;break ;
@@ -938,7 +947,7 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq, }if (likely (nreq)) { - srq->head += nreq; + srq->idx_que.head += nreq;/* * Make sure that descriptors are written before
@@ -950,7 +959,7 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,cpu_to_le32 (HNS_ROCE_V2_SRQ_DB <<V2_DB_BYTE_4_CMD_S | (srq->srqn &V2_DB_BYTE_4_TAG_M )); srq_db.parameter = -cpu_to_le32 (srq->head &V2_DB_PARAMETER_IDX_M ); +cpu_to_le32 (srq->idx_que.head &V2_DB_PARAMETER_IDX_M );hns_roce_write64 (hr_dev, (__le32 *)&srq_db, srq->db_reg_l); }
drivers/infiniband/hw/hns/hns_roce_srq.c +3 -2
@@ -247,6 +247,9 @@ static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, } } + idx_que->head =0 ; + idx_que->tail =0 ; +return 0 ; err_idx_mtr:hns_roce_mtr_destroy (hr_dev, &idx_que->mtr);
@@ -265,8 +268,6 @@ static void free_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)static int alloc_srq_wrid (struct hns_roce_dev *hr_dev,struct hns_roce_srq *srq) { - srq->head =0 ; - srq->tail = srq->wqe_cnt -1 ; srq->wrid =kvmalloc_array (srq->wqe_cnt,sizeof (u64),GFP_KERNEL );if (!srq->wrid)return -ENOMEM ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 433/775 RDMA/hns: Force srq_limit to 0 when creating SRQ
In reply to Greg Kroah-HartmanFrom: Wenpeng Liang <[email protected]>
[ Upstream commit b5df9b7a2f965b7903850d8f89846ffe0080b84b ]
According to the IB Specification, srq_limit shouldn't be configured during SRQ creation. If a user set srq_limit at this time, the driver should forced it to zero, or the result of creating SRQ will conflict with the result of querying SRQ.
--- drivers/infiniband/hw/hns/hns_roce_srq.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hns/hns_roce_srq.c +1 -0
@@ -338,6 +338,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,roundup_pow_of_two (init_attr->attr.max_sge + srq->rsv_sge); init_attr->attr.max_wr = srq->wqe_cnt; init_attr->attr.max_sge = srq->max_gs; + init_attr->attr.srq_limit =0 ;if (udata) { ret = ib_copy_from_udata(&ucmd, udata,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 434/775 RDMA/hns: Fixed wrong judgments in the goto branch
In reply to Greg Kroah-HartmanFrom: Wenpeng Liang <[email protected]>
[ Upstream commit bb74fe7e81c8b2b65c6a351a247fdb9a969cbaec ]
When an error occurs, the qp_table must be cleared, regardless of whether the SRQ feature is enabled.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_main.c +1 -2
@@ -772,8 +772,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)return 0 ; err_qp_table_free: -if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_SRQ ) -hns_roce_cleanup_qp_table (hr_dev); +hns_roce_cleanup_qp_table (hr_dev); err_cq_table_free:hns_roce_cleanup_cq_table (hr_dev);
Signature · 1 line
2.27.0