6.3.13-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 271/431 hwmon: (pmbus/adm1275) Fix problems with temperature monitoring on ADM1272
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit b153a0bb4199566abd337119207f82b59a8cd1ca ]
The PMON_CONFIG register on ADM1272 is a 16 bit register. Writing a 8 bit value into it clears the upper 8 bits of the register, resulting in unexpected side effects. Fix by writing the 16 bit register value.
Also, it has been reported that temperature readings are sometimes widely inaccurate, to the point where readings may result in device shutdown due to errant overtemperature faults. Improve by enabling temperature sampling.
While at it, move the common code for ADM1272 and ADM1278 into a separate function, and clarify in the error message that an attempt was made to enable both VOUT and temperature monitoring.
Last but not least, return the error code reported by the underlying I2C controller and not -ENODEV if updating the PMON_CONFIG register fails. After all, this does not indicate that the chip is not present, but an error in the communication with the chip.
--- drivers/hwmon/pmbus/adm1275.c | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-)
drivers/hwmon/pmbus/adm1275.c +26 -26
@@ -37,10 +37,13 @@ enum chips { adm1075, adm1272, adm1275, adm1276, adm1278, adm1293, adm1294 };#define ADM1272_IRANGE BIT(0) +#define ADM1278_TSFILT BIT(15)#define ADM1278_TEMP1_EN BIT(3)#define ADM1278_VIN_EN BIT(2)#define ADM1278_VOUT_EN BIT(1) +#define ADM1278_PMON_DEFCONFIG (ADM1278_VOUT_EN | ADM1278_TEMP1_EN | ADM1278_TSFILT) +#define ADM1293_IRANGE_25 0#define ADM1293_IRANGE_50 BIT(6)#define ADM1293_IRANGE_100 BIT(7)
@@ -462,6 +465,22 @@ static const struct i2c_device_id adm1275_id[] = { };MODULE_DEVICE_TABLE (i2c, adm1275_id); +/* Enable VOUT & TEMP1 if not enabled (disabled by default) */ +static int adm1275_enable_vout_temp (struct i2c_client *client,int config) +{ +int ret; + +if ((config &ADM1278_PMON_DEFCONFIG ) !=ADM1278_PMON_DEFCONFIG ) { + config |=ADM1278_PMON_DEFCONFIG ; + ret =i2c_smbus_write_word_data (client,ADM1275_PMON_CONFIG , config); +if (ret <0 ) { +dev_err (&client->dev,"Failed to enable VOUT/TEMP1 monitoring\n" ); +return ret; + } + } +return 0 ; +} +static int adm1275_probe (struct i2c_client *client) {s32 (*config_read_fn)(const struct i2c_client *client,u8 reg);
@@ -615,19 +634,10 @@ static int adm1275_probe(struct i2c_client *client)PMBUS_HAVE_VOUT |PMBUS_HAVE_STATUS_VOUT |PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_TEMP ; -/* Enable VOUT & TEMP1 if not enabled (disabled by default) */ -if ((config & (ADM1278_VOUT_EN |ADM1278_TEMP1_EN )) != - (ADM1278_VOUT_EN |ADM1278_TEMP1_EN )) { - config |=ADM1278_VOUT_EN |ADM1278_TEMP1_EN ; - ret =i2c_smbus_write_byte_data (client, -ADM1275_PMON_CONFIG , - config); -if (ret <0 ) { -dev_err (&client->dev, -"Failed to enable VOUT monitoring\n" ); -return -ENODEV ; - } - } + ret =adm1275_enable_vout_temp (client, config); +if (ret) +return ret; +if (config &ADM1278_VIN_EN ) info->func[0 ] |=PMBUS_HAVE_VIN ;break ;
@@ -684,19 +694,9 @@ static int adm1275_probe(struct i2c_client *client)PMBUS_HAVE_VOUT |PMBUS_HAVE_STATUS_VOUT |PMBUS_HAVE_TEMP |PMBUS_HAVE_STATUS_TEMP ; -/* Enable VOUT & TEMP1 if not enabled (disabled by default) */ -if ((config & (ADM1278_VOUT_EN |ADM1278_TEMP1_EN )) != - (ADM1278_VOUT_EN |ADM1278_TEMP1_EN )) { - config |=ADM1278_VOUT_EN |ADM1278_TEMP1_EN ; - ret =i2c_smbus_write_word_data (client, -ADM1275_PMON_CONFIG , - config); -if (ret <0 ) { -dev_err (&client->dev, -"Failed to enable VOUT monitoring\n" ); -return -ENODEV ; - } - } + ret =adm1275_enable_vout_temp (client, config); +if (ret) +return ret;if (config &ADM1278_VIN_EN ) info->func[0 ] |=PMBUS_HAVE_VIN ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 272/431 ARM: dts: BCM5301X: fix duplex-full => full-duplex
In reply to Greg Kroah-HartmanFrom: Christian Lamparter <[email protected]>
[ Upstream commit fd274b733bfdde3ca72f0fa2a37f032f3a8c402c ]
this typo was found by the dtbs_check
| ports:port@5:fixed-link: 'oneOf' conditional failed,
| {'speed': [[1000]], 'duplex-full': True} is not of type 'array'
| 'duplex-full' does not match any of the regexes: 'pinctrl-[0-]..."this should have been full-duplex;
--- arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 2 +- arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/bcm53015-meraki-mr26.dts +1 -1
@@ -128,7 +128,7 @@ port@5 { fixed-link { speed = <1000>; - duplex-full; + full-duplex; }; }; };
arch/arm/boot/dts/bcm53016-meraki-mr32.dts +1 -1
@@ -187,7 +187,7 @@ port@5 { fixed-link { speed = <1000>; - duplex-full; + full-duplex; }; }; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 273/431 clk: Export clk_hw_forward_rate_request()
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit ed046ac74da0b5602566073023a1519b5ae657b7 ]
Commit 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the parent") introduced the public clk_hw_forward_rate_request() function, but didn't export the symbol. Make sure it's the case.
--- drivers/clk/clk.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk.c +1 -0
@@ -1547,6 +1547,7 @@ void clk_hw_forward_rate_request(const struct clk_hw *hw, parent->core, req, parent_rate); } +EXPORT_SYMBOL_GPL (clk_hw_forward_rate_request);static bool clk_core_can_round (struct clk_core *const core) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 274/431 MIPS: DTS: CI20: Fix ACT8600 regulator node names
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 08384e80a70fb1942510ab5f0ce27bad134e634e ]
The Device Tree was using invalid node names for the ACT8600 regulators. To be fair, it is not the original committer's fault, as the documentation did gives invalid names as well.
In theory, the fix should have been to modify the driver to accept the alternative names. However, even though the act8865 driver spits warnings, the kernel seemed to work fine with what is currently supported upstream. For that reason, I think it is okay to just update the DTS.
I removed the "regulator-name" too, since they really didn't bring any information. The node names are enough.
--- arch/mips/boot/dts/ingenic/ci20.dts | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +8 -19
@@ -237,59 +237,49 @@ &i2c0 { act8600: act8600@5a { compatible = "active-semi,act8600"; reg = <0x5a>; - status = "okay"; regulators { - vddcore: SUDCDC1 { - regulator-name = "DCDC_REG1"; + vddcore: DCDC1 { regulator-min-microvolt = <1100000>; regulator-max-microvolt = <1100000>; regulator-always-on; }; - vddmem: SUDCDC2 { - regulator-name = "DCDC_REG2"; + vddmem: DCDC2 { regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; regulator-always-on; }; - vcc_33: SUDCDC3 { - regulator-name = "DCDC_REG3"; + vcc_33: DCDC3 { regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; }; - vcc_50: SUDCDC4 { - regulator-name = "SUDCDC_REG4"; + vcc_50: SUDCDC_REG4 { regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; regulator-always-on; }; - vcc_25: LDO_REG5 { - regulator-name = "LDO_REG5"; + vcc_25: LDO5 { regulator-min-microvolt = <2500000>; regulator-max-microvolt = <2500000>; regulator-always-on; }; - wifi_io: LDO_REG6 { - regulator-name = "LDO_REG6"; + wifi_io: LDO6 { regulator-min-microvolt = <2500000>; regulator-max-microvolt = <2500000>; regulator-always-on; }; - vcc_28: LDO_REG7 { - regulator-name = "LDO_REG7"; + cim_io_28: LDO7 { regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; regulator-always-on; }; - vcc_15: LDO_REG8 { - regulator-name = "LDO_REG8"; + cim_io_15: LDO8 { regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; regulator-always-on; }; vrtc_18: LDO_REG9 { - regulator-name = "LDO_REG9"; /* Despite the datasheet stating 3.3V * for REG9 and the driver expecting that, * REG9 outputs 1.8V.
@@ -303,7 +293,6 @@ vrtc_18: LDO_REG9 { regulator-always-on; }; vcc_11: LDO_REG10 { - regulator-name = "LDO_REG10"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-always-on;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 275/431 drm/amd/display: Fix a test CalculatePrefetchSchedule()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 960e27a5741cd3001996ff6ddfb3eb0ed3a4909d ]
It is likely Height was expected here, instead of Width.
Test the correct variable.
--- drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +1 -1
@@ -810,7 +810,7 @@ static bool CalculatePrefetchSchedule( *swath_width_chroma_ub =dml_ceil (SwathWidthY /2 -1 , myPipe->BlockWidth256BytesC) + myPipe->BlockWidth256BytesC; }else { *swath_width_luma_ub =dml_ceil (SwathWidthY -1 , myPipe->BlockHeight256BytesY) + myPipe->BlockHeight256BytesY; -if (myPipe->BlockWidth256BytesC >0 ) +if (myPipe->BlockHeight256BytesC >0 ) *swath_width_chroma_ub =dml_ceil (SwathWidthY /2 -1 , myPipe->BlockHeight256BytesC) + myPipe->BlockHeight256BytesC; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 276/431 drm/amd/display: Fix a test dml32_rq_dlg_get_rq_reg()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit bafc31166aa7df5fa26ae0ad8196d1717e6cdea9 ]
It is likely p1_min_meta_chunk_bytes was expected here, instead of min_meta_chunk_bytes.
Test the correct variable.
--- .../gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c +1 -1
@@ -116,7 +116,7 @@ void dml32_rq_dlg_get_rq_reg(display_rq_regs_st *rq_regs,else rq_regs->rq_regs_l.min_meta_chunk_size =dml_log2 (min_meta_chunk_bytes) -6 +1 ; -if (min_meta_chunk_bytes ==0 ) +if (p1_min_meta_chunk_bytes ==0 ) rq_regs->rq_regs_c.min_meta_chunk_size =0 ;else rq_regs->rq_regs_c.min_meta_chunk_size =dml_log2 (p1_min_meta_chunk_bytes) -6 +1 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 277/431 drm/amdkfd: Fix potential deallocation of previously deallocated memory.
In reply to Greg Kroah-HartmanFrom: Daniil Dulov <[email protected]>
[ Upstream commit cabbdea1f1861098991768d7bbf5a49ed1608213 ]
Pointer mqd_mem_obj can be deallocated in kfd_gtt_sa_allocate(). The function then returns non-zero value, which causes the second deallocation.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +7 -6
@@ -115,18 +115,19 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd, &(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gpu_addr), (void *)&(mqd_mem_obj->cpu_ptr), true); + +if (retval) { +kfree (mqd_mem_obj); +return NULL ; + } }else { retval =kfd_gtt_sa_allocate (kfd,sizeof (struct v9_mqd ), &mqd_mem_obj); - } - -if (retval) { -kfree (mqd_mem_obj); -return NULL ; +if (retval) +return NULL ; }return mqd_mem_obj; - } static void init_mqd(struct mqd_manager *mm, void **mqd,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 278/431 soc: mediatek: SVS: Fix MT8192 GPU node name
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 95094495401bdf6a0649d220dfd095e6079b5e39 ]
Device tree node names should be generic. The planned device node name for the GPU, according to the bindings and posted DT changes, is "gpu", not "mali".
Fix the GPU node name in the SVS driver to follow.
--- drivers/soc/mediatek/mtk-svs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/mediatek/mtk-svs.c +2 -2
@@ -2101,9 +2101,9 @@ static int svs_mt8192_platform_probe(struct svs_platform *svsp) svsb = &svsp->banks[idx];if (svsb->type ==SVSB_HIGH ) - svsb->opp_dev =svs_add_device_link (svsp,"mali" ); + svsb->opp_dev =svs_add_device_link (svsp,"gpu" );else if (svsb->type ==SVSB_LOW ) - svsb->opp_dev =svs_get_subsys_device (svsp,"mali" ); + svsb->opp_dev =svs_get_subsys_device (svsp,"gpu" );if (IS_ERR (svsb->opp_dev)) return dev_err_probe(svsp->dev, PTR_ERR(svsb->opp_dev),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 279/431 drm/amd/display: Fix artifacting on eDP panels when engaging freesync video mode
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit b18f05a0666aecd5cb19c26a8305bcfa4e9d6502 ]
[Why]
When freesync video mode is enabled, switching resolution from native mode to one of the freesync video compatible modes can trigger continous artifacts on some eDP panels when running under KDE. The articating can be seen in the attached bug report.
[How]
Fix this by restricting updates that require full commit by using the same checks for stream and scaling changes in the the enable pass of dm_update_crtc_state() along with the check for compatible timings for freesync vide mode.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -9276,6 +9276,8 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,/* Now check if we should set freesync video mode */ if (amdgpu_freesync_vid_mode && dm_new_crtc_state->stream && +dc_is_stream_unchanged (new_stream, dm_old_crtc_state->stream) && +dc_is_stream_scaling_unchanged (new_stream, dm_old_crtc_state->stream) &&is_timing_unchanged_for_freesync (new_crtc_state, old_crtc_state)) { new_crtc_state->mode_changed = false;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 280/431 drm/radeon: fix possible division-by-zero errors
In reply to Greg Kroah-HartmanFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit 1becc57cd1a905e2aa0e1eca60d2a37744525c4a ]
Function rv740_get_decoded_reference_divider() may return 0 due to unpredictable reference divider value calculated in radeon_atom_get_clock_dividers(). This will lead to division-by-zero error once that value is used as a divider in calculating 'clk_s'.
While unlikely, this issue should nonetheless be prevented so add a sanity check for such cases by testing 'decoded_ref' value against 0.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
v2: minor coding style fixes (Alex)
In practice this should actually happen as the vbios should be properly populated.
--- drivers/gpu/drm/radeon/cypress_dpm.c | 8 ++++++-- drivers/gpu/drm/radeon/ni_dpm.c | 8 ++++++-- drivers/gpu/drm/radeon/rv740_dpm.c | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/cypress_dpm.c +6 -2
@@ -557,8 +557,12 @@ static int cypress_populate_mclk_value(struct radeon_device *rdev, ASIC_INTERNAL_MEMORY_SS, vco_freq)) {u32 reference_clock = rdev->clock.mpll.reference_freq;u32 decoded_ref =rv740_get_decoded_reference_divider (dividers.ref_div); -u32 clk_s = reference_clock *5 / (decoded_ref * ss.rate); -u32 clk_v = ss.percentage * +u32 clk_s, clk_v; + +if (!decoded_ref) +return -EINVAL ; + clk_s = reference_clock *5 / (decoded_ref * ss.rate); + clk_v = ss.percentage * (0x4000 * dividers.whole_fb_div +0x800 * dividers.frac_fb_div) / (clk_s *625 ); mpll_ss1 &= ~CLKV_MASK ;
drivers/gpu/drm/radeon/ni_dpm.c +6 -2
@@ -2241,8 +2241,12 @@ static int ni_populate_mclk_value(struct radeon_device *rdev, ASIC_INTERNAL_MEMORY_SS, vco_freq)) {u32 reference_clock = rdev->clock.mpll.reference_freq;u32 decoded_ref =rv740_get_decoded_reference_divider (dividers.ref_div); -u32 clk_s = reference_clock *5 / (decoded_ref * ss.rate); -u32 clk_v = ss.percentage * +u32 clk_s, clk_v; + +if (!decoded_ref) +return -EINVAL ; + clk_s = reference_clock *5 / (decoded_ref * ss.rate); + clk_v = ss.percentage * (0x4000 * dividers.whole_fb_div +0x800 * dividers.frac_fb_div) / (clk_s *625 ); mpll_ss1 &= ~CLKV_MASK ;
drivers/gpu/drm/radeon/rv740_dpm.c +6 -2
@@ -249,8 +249,12 @@ int rv740_populate_mclk_value(struct radeon_device *rdev, ASIC_INTERNAL_MEMORY_SS, vco_freq)) {u32 reference_clock = rdev->clock.mpll.reference_freq;u32 decoded_ref =rv740_get_decoded_reference_divider (dividers.ref_div); -u32 clk_s = reference_clock *5 / (decoded_ref * ss.rate); -u32 clk_v =0x40000 * ss.percentage * +u32 clk_s, clk_v; + +if (!decoded_ref) +return -EINVAL ; + clk_s = reference_clock *5 / (decoded_ref * ss.rate); + clk_v =0x40000 * ss.percentage * (dividers.whole_fb_div + (dividers.frac_fb_div /8 )) / (clk_s *10000 ); mpll_ss1 &= ~CLKV_MASK ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 281/431 HID: uclogic: Modular KUnit tests should not depend on KUNIT=y
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 49904a0ebf23b15aad288a10f5354e7cd8193121 ]
While KUnit tests that cannot be built as a loadable module must depend on "KUNIT=y", this is not true for modular tests, where it adds an unnecessary limitation.
Fix this by relaxing the dependency to "KUNIT".
--- drivers/hid/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/Kconfig +1 -1
@@ -1285,7 +1285,7 @@ config HID_MCP2221 config HID_KUNIT_TEST tristate "KUnit tests for HID" if !KUNIT_ALL_TESTS - depends on KUNIT=y + depends on KUNIT depends on HID_BATTERY_STRENGTH depends on HID_UCLOGIC default KUNIT_ALL_TESTS
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 282/431 RDMA/rxe: Fix access checks in rxe_check_bind_mw
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 425e1c9018fdf25cb4531606cc92d9d01a55534f ]
The subroutine rxe_check_bind_mw() in rxe_mw.c performs checks on the mw access flags before they are set so they always succeed. This patch instead checks the access flags passed in the send wqe.
--- drivers/infiniband/sw/rxe/rxe_mw.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/infiniband/sw/rxe/rxe_mw.c +9 -8
@@ -48,7 +48,7 @@ int rxe_dealloc_mw(struct ib_mw *ibmw) }static int rxe_check_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe, -struct rxe_mw *mw,struct rxe_mr *mr) +struct rxe_mw *mw,struct rxe_mr *mr,int access) {if (mw->ibmw.type ==IB_MW_TYPE_1 ) {if (unlikely (mw->state !=RXE_MW_STATE_VALID )) {
@@ -58,7 +58,7 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }/* o10-36.2.2 */ -if (unlikely ((mw->access &IB_ZERO_BASED ))) { +if (unlikely ((access &IB_ZERO_BASED ))) {rxe_dbg_mw (mw,"attempt to bind a zero based type 1 MW\n" );return -EINVAL ; }
@@ -104,7 +104,7 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }/* C10-74 */ -if (unlikely ((mw->access & +if (unlikely ((access & (IB_ACCESS_REMOTE_WRITE |IB_ACCESS_REMOTE_ATOMIC )) && !(mr->access &IB_ACCESS_LOCAL_WRITE ))) { rxe_dbg_mw(mw,
@@ -113,7 +113,7 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }/* C10-75 */ -if (mw->access &IB_ZERO_BASED ) { +if (access &IB_ZERO_BASED ) {if (unlikely (wqe->wr.wr.mw.length > mr->ibmr.length)) {rxe_dbg_mw (mw,"attempt to bind a ZB MW outside of the MR\n" );
@@ -133,12 +133,12 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }static void rxe_do_bind_mw (struct rxe_qp *qp,struct rxe_send_wqe *wqe, -struct rxe_mw *mw,struct rxe_mr *mr) +struct rxe_mw *mw,struct rxe_mr *mr,int access) {u32 key = wqe->wr.wr.mw.rkey &0xff ; mw->rkey = (mw->rkey & ~0xff ) | key; - mw->access = wqe->wr.wr.mw.access; + mw->access = access; mw->state =RXE_MW_STATE_VALID ; mw->addr = wqe->wr.wr.mw.addr; mw->length = wqe->wr.wr.mw.length;
@@ -169,6 +169,7 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe)struct rxe_dev *rxe =to_rdev (qp->ibqp.device);u32 mw_rkey = wqe->wr.wr.mw.mw_rkey;u32 mr_lkey = wqe->wr.wr.mw.mr_lkey; +int access = wqe->wr.wr.mw.access; mw =rxe_pool_get_index (&rxe->mw_pool, mw_rkey >>8 );if (unlikely (!mw)) {
@@ -198,11 +199,11 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe)spin_lock_bh (&mw->lock); - ret =rxe_check_bind_mw (qp, wqe, mw, mr); + ret =rxe_check_bind_mw (qp, wqe, mw, mr, access);if (ret) goto err_unlock; -rxe_do_bind_mw (qp, wqe, mw, mr); +rxe_do_bind_mw (qp, wqe, mw, mr, access); err_unlock:spin_unlock_bh (&mw->lock); err_drop_mr:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 283/431 amdgpu: validate offset_in_bo of drm_amdgpu_gem_va
In reply to Greg Kroah-HartmanFrom: Chia-I Wu <[email protected]>
[ Upstream commit 9f0bcf49e9895cb005d78b33a5eebfa11711b425 ]
This is motivated by OOB access in amdgpu_vm_update_range when offset_in_bo+map_size overflows.
v2: keep the validations in amdgpu_vm_bo_map
v3: add the validations to amdgpu_vm_bo_map/amdgpu_vm_bo_replace_map
rather than to amdgpu_gem_va_ioctl
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +8 -8
@@ -1436,14 +1436,14 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,uint64_t eaddr;/* validate the parameters */ -if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || - size ==0 || size & ~PAGE_MASK ) +if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || size & ~PAGE_MASK ) +return -EINVAL ; +if (saddr + size <= saddr || offset + size <= offset)return -EINVAL ;/* make sure object fit at this offset */ eaddr = saddr + size -1 ; -if (saddr >= eaddr || - (bo && offset + size >amdgpu_bo_size (bo)) || +if ((bo && offset + size >amdgpu_bo_size (bo)) || (eaddr >= adev->vm_manager.max_pfn <<AMDGPU_GPU_PAGE_SHIFT ))return -EINVAL ;
@@ -1502,14 +1502,14 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev,int r;/* validate the parameters */ -if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || - size ==0 || size & ~PAGE_MASK ) +if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || size & ~PAGE_MASK ) +return -EINVAL ; +if (saddr + size <= saddr || offset + size <= offset)return -EINVAL ;/* make sure object fit at this offset */ eaddr = saddr + size -1 ; -if (saddr >= eaddr || - (bo && offset + size >amdgpu_bo_size (bo)) || +if ((bo && offset + size >amdgpu_bo_size (bo)) || (eaddr >= adev->vm_manager.max_pfn <<AMDGPU_GPU_PAGE_SHIFT ))return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 284/431 drm/msm/a6xx: dont set IO_PGTABLE_QUIRK_ARM_OUTER_WBWA with coherent SMMU
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 38e27a6fbf2206b18417c5985dbcdeca0f2026b8 ]
If the Adreno SMMU is dma-coherent, allocation will fail unless we disable IO_PGTABLE_QUIRK_ARM_OUTER_WBWA. Skip setting this quirk for the coherent SMMUs (like we have on sm8350 platform).
Patchwork: https://patchwork.freedesktop.org/patch/531562/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +2 -1
@@ -1793,7 +1793,8 @@ a6xx_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev)* This allows GPU to set the bus attributes required to use system * cache on behalf of the iommu page table walker. */ -if (!IS_ERR_OR_NULL (a6xx_gpu->htw_llc_slice)) +if (!IS_ERR_OR_NULL (a6xx_gpu->htw_llc_slice) && + !device_iommu_capable (&pdev->dev,IOMMU_CAP_CACHE_COHERENCY )) quirks |=IO_PGTABLE_QUIRK_ARM_OUTER_WBWA ;return adreno_iommu_create_address_space (gpu, pdev, quirks);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 285/431 drm/msm/a5xx: really check for A510 in a5xx_gpu_init
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 736a9327365644b460e4498b1ce172ca411efcbc ]
The commit 010c8bbad2cb ("drm: msm: adreno: Disable preemption on Adreno 510") added special handling for a510 (this SKU doesn't seem to support preemption, so the driver should clamp nr_rings to 1). However the gpu->revn is not yet set (it is set later, in adreno_gpu_init()) and thus the condition is always false. Check config->rev instead.
Patchwork: https://patchwork.freedesktop.org/patch/531511/
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +2 -1
@@ -1740,6 +1740,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) {struct msm_drm_private *priv = dev->dev_private;struct platform_device *pdev = priv->gpu_pdev; +struct adreno_platform_config *config = pdev->dev.platform_data;struct a5xx_gpu *a5xx_gpu =NULL ;struct adreno_gpu *adreno_gpu;struct msm_gpu *gpu;
@@ -1766,7 +1767,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) nr_rings =4 ; -if (adreno_is_a510 (adreno_gpu)) +if (adreno_cmp_rev (ADRENO_REV (5 ,1 ,0 ,ANY_ID ), config->rev)) nr_rings =1 ; ret =adreno_gpu_init (dev, pdev, adreno_gpu, &funcs, nr_rings);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 286/431 RDMA/bnxt_re: wraparound mbox producer index
In reply to Greg Kroah-HartmanFrom: Kashyap Desai <[email protected]>
[ Upstream commit 0af91306e17ef3d18e5f100aa58aa787869118af ]
Driver is not handling the wraparound of the mbox producer index correctly. Currently the wraparound happens once u32 max is reached.
Bit 31 of the producer index register is special and should be set only once for the first command. Because the producer index overflow setting bit31 after a long time, FW goes to initialization sequence and this causes FW hang.
Fix is to wraparound the mbox producer index once it reaches u16 max.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +2 -2
@@ -181,7 +181,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req, }while (size >0 ); cmdq->seq_num++; - cmdq_prod = hwq->prod; + cmdq_prod = hwq->prod &0xFFFF ;if (test_bit (FIRMWARE_FIRST_FLAG , &cmdq->flags)) {/* The very first doorbell write * is required to set this flag
@@ -598,7 +598,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, rcfw->cmdq_depth =BNXT_QPLIB_CMDQE_MAX_CNT_8192 ; sginfo.pgsize =bnxt_qplib_cmdqe_page_size (rcfw->cmdq_depth); - hwq_attr.depth = rcfw->cmdq_depth; + hwq_attr.depth = rcfw->cmdq_depth &0x7FFFFFFF ; hwq_attr.stride =BNXT_QPLIB_CMDQE_UNITS ; hwq_attr.type =HWQ_TYPE_CTX ;if (bnxt_qplib_alloc_init_hwq (&cmdq->hwq, &hwq_attr)) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 287/431 RDMA/bnxt_re: Avoid calling wake_up threads from spin_lock context
In reply to Greg Kroah-HartmanFrom: Kashyap Desai <[email protected]>
[ Upstream commit 3099bcdc19b701f732f638ee45679858c08559bb ]
bnxt_qplib_service_creq can be called from interrupt or tasklet or process context. So the function take irq variant of spin_lock. But when wake_up is invoked with the lock held, it is putting the calling context to sleep.
[exception RIP: __wake_up_common+190]
RIP: ffffffffb7539d7e RSP: ffffa73300207ad8 RFLAGS: 00000083 RAX: 0000000000000001 RBX: ffff91fa295f69b8 RCX: dead000000000200 RDX: ffffa733344af940 RSI: ffffa73336527940 RDI: ffffa73336527940 RBP: 000000000000001c R8: 0000000000000002 R9: 00000000000299c0 R10: 0000017230de82c5 R11: 0000000000000002 R12: ffffa73300207b28 R13: 0000000000000000 R14: ffffa733341bf928 R15: 0000000000000000 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
Call the wakeup after releasing the lock.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +10 -3
@@ -299,7 +299,8 @@ static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw, }static int bnxt_qplib_process_qp_event (struct bnxt_qplib_rcfw *rcfw, -struct creq_qp_event *qp_event) +struct creq_qp_event *qp_event, +u32 *num_wait) {struct creq_qp_error_notification *err_event;struct bnxt_qplib_hwq *hwq = &rcfw->cmdq.hwq;
@@ -308,6 +309,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,u16 cbit, blocked =0 ;struct pci_dev *pdev;unsigned long flags; +u32 wait_cmds =0 ;__le16 mcookie;u16 cookie;int rc =0 ;
@@ -367,9 +369,10 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, crsqe->req_size =0 ;if (!blocked) -wake_up (&rcfw->cmdq.waitq); + wait_cmds++;spin_unlock_irqrestore (&hwq->lock, flags); } + *num_wait += wait_cmds;return rc; }
@@ -383,6 +386,7 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t)struct creq_base *creqe;u32 sw_cons, raw_cons;unsigned long flags; +u32 num_wakeup =0 ;/* Service the CREQ until budget is over */ spin_lock_irqsave (&hwq->lock, flags);
@@ -401,7 +405,8 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t)switch (type) {case CREQ_BASE_TYPE_QP_EVENT :bnxt_qplib_process_qp_event - (rcfw, (struct creq_qp_event *)creqe); + (rcfw, (struct creq_qp_event *)creqe, + &num_wakeup); creq->stats.creq_qp_event_processed++;break ;case CREQ_BASE_TYPE_FUNC_EVENT :
@@ -429,6 +434,8 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t) rcfw->res->cctx, true); }spin_unlock_irqrestore (&hwq->lock, flags); +if (num_wakeup) +wake_up_nr (&rcfw->cmdq.waitq, num_wakeup); }static irqreturn_t bnxt_qplib_creq_irq (int irq,void *dev_instance)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 288/431 clk: imx: clk-imxrt1050: fix memory leak in imxrt1050_clocks_probe
In reply to Greg Kroah-HartmanFrom: Kai Ma <[email protected]>
[ Upstream commit 1b280598ab3bd8a2dc8b96a12530d5b1ee7a8f4a ]
Use devm_of_iomap() instead of of_iomap() to automatically handle the unused ioremap region. If any error occurs, regions allocated by kzalloc() will leak, but using devm_kzalloc() instead will automatically free the memory using devm_kfree().
Also, fix error handling of hws by adding unregister_hws label, which unregisters remaining hws when iomap failed.
--- drivers/clk/imx/clk-imxrt1050.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/clk/imx/clk-imxrt1050.c +15 -7
@@ -42,7 +42,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)struct device_node *anp;int ret; - clk_hw_data =kzalloc (struct_size (clk_hw_data, hws, + clk_hw_data =devm_kzalloc (dev,struct_size (clk_hw_data, hws,IMXRT1050_CLK_END ),GFP_KERNEL );if (WARN_ON (!clk_hw_data))return -ENOMEM ;
@@ -53,10 +53,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev) hws[IMXRT1050_CLK_OSC ] =imx_get_clk_hw_by_name (np,"osc" ); anp =of_find_compatible_node (NULL ,NULL ,"fsl,imxrt-anatop" ); - pll_base =of_iomap (anp,0 ); + pll_base =devm_of_iomap (dev, anp,0 ,NULL );of_node_put (anp); -if (WARN_ON (!pll_base)) -return -ENOMEM ; +if (WARN_ON (IS_ERR (pll_base))) { + ret =PTR_ERR (pll_base); + goto unregister_hws; + }/* Anatop clocks */ hws[IMXRT1050_CLK_DUMMY ] =imx_clk_hw_fixed ("dummy" ,0UL );
@@ -104,8 +106,10 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)/* CCM clocks */ ccm_base =devm_platform_ioremap_resource (pdev,0 ); -if (WARN_ON (IS_ERR (ccm_base))) -return PTR_ERR (ccm_base); +if (WARN_ON (IS_ERR (ccm_base))) { + ret =PTR_ERR (ccm_base); + goto unregister_hws; + } hws[IMXRT1050_CLK_ARM_PODF ] =imx_clk_hw_divider ("arm_podf" ,"pll1_arm" , ccm_base +0x10 ,0 ,3 ); hws[IMXRT1050_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", ccm_base + 0x18, 18, 2,
@@ -149,8 +153,12 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev) ret =of_clk_add_hw_provider (np, of_clk_hw_onecell_get, clk_hw_data);if (ret <0 ) {dev_err (dev,"Failed to register clks for i.MXRT1050.\n" ); -imx_unregister_hw_clocks (hws,IMXRT1050_CLK_END ); + goto unregister_hws; } +return 0 ; + +unregister_hws: +imx_unregister_hw_clocks (hws,IMXRT1050_CLK_END );return ret; }static const struct of_device_id imxrt1050_clk_of_match[] = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 289/431 clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe
In reply to Greg Kroah-HartmanFrom: Hao Luo <[email protected]>
[ Upstream commit 188d070de9132667956f5aadd98d2bd87d3eac89 ]
Use devm_of_iomap() instead of of_iomap() to automatically handle the unused ioremap region.
If any error occurs, regions allocated by kzalloc() will leak, but using devm_kzalloc() instead will automatically free the memory using devm_kfree().
--- drivers/clk/imx/clk-imx8mn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/imx/clk-imx8mn.c +4 -4
@@ -323,7 +323,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)void __iomem *base;int ret; - clk_hw_data =kzalloc (struct_size (clk_hw_data, hws, + clk_hw_data =devm_kzalloc (dev,struct_size (clk_hw_data, hws,IMX8MN_CLK_END ),GFP_KERNEL );if (WARN_ON (!clk_hw_data))return -ENOMEM ;
@@ -340,10 +340,10 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) hws[IMX8MN_CLK_EXT4 ] =imx_get_clk_hw_by_name (np,"clk_ext4" ); np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mn-anatop" ); - base =of_iomap (np,0 ); + base =devm_of_iomap (dev, np,0 ,NULL );of_node_put (np); -if (WARN_ON (!base)) { - ret = -ENOMEM ; +if (WARN_ON (IS_ERR (base))) { + ret =PTR_ERR (base); goto unregister_hws; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 290/431 clk: imx93: fix memory leak and missing unwind goto in imx93_clocks_probe
In reply to Greg Kroah-HartmanFrom: Zhanhao Hu <[email protected]>
[ Upstream commit e02ba11b457647050cb16e7cad16cec3c252fade ]
In function probe(), it returns directly without unregistered hws when error occurs.
Fix this by adding 'goto unregister_hws;' on line 295 and line 310.
Use devm_kzalloc() instead of kzalloc() to automatically free the memory using devm_kfree() when error occurs.
Replace of_iomap() with devm_of_iomap() to automatically handle the unused ioremap region and delete 'iounmap(anatop_base);' in unregister_hws.
--- drivers/clk/imx/clk-imx93.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/clk/imx/clk-imx93.c +8 -7
@@ -262,7 +262,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)void __iomem *base, *anatop_base;int i, ret; - clk_hw_data =kzalloc (struct_size (clk_hw_data, hws, + clk_hw_data =devm_kzalloc (dev,struct_size (clk_hw_data, hws,IMX93_CLK_END ),GFP_KERNEL );if (!clk_hw_data)return -ENOMEM ;
@@ -286,10 +286,12 @@ static int imx93_clocks_probe(struct platform_device *pdev) "sys_pll_pfd2", 1, 2); np =of_find_compatible_node (NULL ,NULL ,"fsl,imx93-anatop" ); - anatop_base =of_iomap (np,0 ); + anatop_base =devm_of_iomap (dev, np,0 ,NULL );of_node_put (np); -if (WARN_ON (!anatop_base)) -return -ENOMEM ; +if (WARN_ON (IS_ERR (anatop_base))) { + ret =PTR_ERR (base); + goto unregister_hws; + } clks[IMX93_CLK_AUDIO_PLL ] =imx_clk_fracn_gppll ("audio_pll" ,"osc_24m" , anatop_base +0x1200 , &imx_fracn_gppll);
@@ -299,8 +301,8 @@ static int imx93_clocks_probe(struct platform_device *pdev) np = dev->of_node; base =devm_platform_ioremap_resource (pdev,0 );if (WARN_ON (IS_ERR (base))) { -iounmap (anatop_base); -return PTR_ERR (base); + ret =PTR_ERR (base); + goto unregister_hws; }for (i =0 ; i <ARRAY_SIZE (root_array); i++) {
@@ -332,7 +334,6 @@ static int imx93_clocks_probe(struct platform_device *pdev) unregister_hws:imx_unregister_hw_clocks (clks,IMX93_CLK_END ); -iounmap (anatop_base);return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 291/431 clk: imx: clk-imx8mp: improve error handling in imx8mp_clocks_probe()
In reply to Greg Kroah-HartmanFrom: Yuxing Liu <[email protected]>
[ Upstream commit 878b02d5f3b56cb090dbe2c70c89273be144087f ]
Replace of_iomap() and kzalloc() with devm_of_iomap() and devm_kzalloc() which can automatically release the related memory when the device or driver is removed or unloaded to avoid potential memory leak.
In this case, iounmap(anatop_base) in line 427,433 are removed as manual release is not required.
Besides, referring to clk-imx8mq.c, check the return code of of_clk_add_hw_provider, if it returns negtive, print error info and unregister hws, which makes the program more robust.
--- drivers/clk/imx/clk-imx8mp.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/clk/imx/clk-imx8mp.c +13 -11
@@ -414,25 +414,22 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *np;void __iomem *anatop_base, *ccm_base; +int err; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mp-anatop" ); - anatop_base =of_iomap (np,0 ); + anatop_base =devm_of_iomap (dev, np,0 ,NULL );of_node_put (np); -if (WARN_ON (!anatop_base)) -return -ENOMEM ; +if (WARN_ON (IS_ERR (anatop_base))) +return PTR_ERR (anatop_base); np = dev->of_node; ccm_base =devm_platform_ioremap_resource (pdev,0 ); -if (WARN_ON (IS_ERR (ccm_base))) { -iounmap (anatop_base); +if (WARN_ON (IS_ERR (ccm_base)))return PTR_ERR (ccm_base); - } - clk_hw_data =kzalloc (struct_size (clk_hw_data, hws,IMX8MP_CLK_END ),GFP_KERNEL ); -if (WARN_ON (!clk_hw_data)) { -iounmap (anatop_base); + clk_hw_data =devm_kzalloc (dev,struct_size (clk_hw_data, hws,IMX8MP_CLK_END ),GFP_KERNEL ); +if (WARN_ON (!clk_hw_data))return -ENOMEM ; - } clk_hw_data->num =IMX8MP_CLK_END ; hws = clk_hw_data->hws;
@@ -721,7 +718,12 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)imx_check_clk_hws (hws,IMX8MP_CLK_END ); -of_clk_add_hw_provider (np, of_clk_hw_onecell_get, clk_hw_data); + err =of_clk_add_hw_provider (np, of_clk_hw_onecell_get, clk_hw_data); +if (err <0 ) { +dev_err (dev,"failed to register hws for i.MX8MP\n" ); +imx_unregister_hw_clocks (hws,IMX8MP_CLK_END ); +return err; + }imx_register_uart_clocks ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 292/431 clk: mediatek: fix of_iomap memory leak
In reply to Greg Kroah-HartmanFrom: Bosi Zhang <[email protected]>
[ Upstream commit 3db7285e044144fd88a356f5b641b9cd4b231a77 ]
Smatch reports:drivers/clk/mediatek/clk-mtk.c:583 mtk_clk_simple_probe() warn:
'base' from of_iomap() not released on lines: 496.
This problem was also found in linux-next. In mtk_clk_simple_probe(), base is not released when handling errors
if clk_data is not existed, which may cause a leak.
So free_base should be added here to release base.
--- drivers/clk/mediatek/clk-mtk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/clk/mediatek/clk-mtk.c +5 -2
@@ -492,8 +492,10 @@ int mtk_clk_simple_probe(struct platform_device *pdev) num_clks += mcd->num_mux_clks; clk_data =mtk_alloc_clk_data (num_clks); -if (!clk_data) -return -ENOMEM ; +if (!clk_data) { + r = -ENOMEM ; + goto free_base; + }if (mcd->fixed_clks) { r = mtk_clk_register_fixed_clks(mcd->fixed_clks,
@@ -578,6 +580,7 @@ int mtk_clk_simple_probe(struct platform_device *pdev) mcd->num_fixed_clks, clk_data); free_data:mtk_free_clk_data (clk_data); +free_base:if (mcd->shared_io && base)iounmap (base);return r;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 293/431 arm64: dts: qcom: qdu1000: Flush RSC sleep & wake votes
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit ab033e7846f91953244d0626b28ce66412b813b3 ]
The rpmh driver will cache sleep and wake votes until the cluster power-domain is about to enter idle, to avoid unnecessary writes. So associate the apps_rsc with the cluster pd, so that it can be notified about this event.
Without this, only AMC votes are being commited.
--- arch/arm64/boot/dts/qcom/qdu1000.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/qdu1000.dtsi +1 -0
@@ -1238,6 +1238,7 @@ apps_rsc: rsc@17a00000 { qcom,tcs-config = <ACTIVE_TCS 2>, <SLEEP_TCS 3>, <WAKE_TCS 3>, <CONTROL_TCS 0>; label = "apps_rsc"; + power-domains = <&CLUSTER_PD>; apps_bcm_voter: bcm-voter { compatible = "qcom,bcm-voter";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 294/431 arm64: dts: qcom: sdm670: Flush RSC sleep & wake votes
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 7b04cbd81b0e60c5151a310e7b730dc4a951a211 ]
The rpmh driver will cache sleep and wake votes until the cluster power-domain is about to enter idle, to avoid unnecessary writes. So associate the apps_rsc with the cluster pd, so that it can be notified about this event.
Without this, only AMC votes are being commited.
--- arch/arm64/boot/dts/qcom/sdm670.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm670.dtsi +1 -0
@@ -1155,6 +1155,7 @@ apps_rsc: rsc@179c0000 { <SLEEP_TCS 3>, <WAKE_TCS 3>, <CONTROL_TCS 1>; + power-domains = <&CLUSTER_PD>; apps_bcm_voter: bcm-voter { compatible = "qcom,bcm-voter";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 295/431 arm64: dts: qcom: sdm845: Flush RSC sleep & wake votes
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 91e83140b5dd5598fbcfada3ee1f8b2b410c3731 ]
The rpmh driver will cache sleep and wake votes until the cluster power-domain is about to enter idle, to avoid unnecessary writes. So associate the apps_rsc with the cluster pd, so that it can be notified about this event.
Without this, only AMC votes are being commited.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +1 -0
@@ -5058,6 +5058,7 @@ apps_rsc: rsc@179c0000 { <SLEEP_TCS 3>, <WAKE_TCS 3>, <CONTROL_TCS 1>; + power-domains = <&CLUSTER_PD>; apps_bcm_voter: bcm-voter { compatible = "qcom,bcm-voter";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 296/431 arm64: dts: qcom: sm8550: Flush RSC sleep & wake votes
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 4b2c7ac8e469ab7f92e50c34ad4012a77e79d078 ]
The rpmh driver will cache sleep and wake votes until the cluster power-domain is about to enter idle, to avoid unnecessary writes. So associate the apps_rsc with the cluster pd, so that it can be notified about this event.
Without this, only AMC votes are being commited.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sm8550.dtsi +1 -0
@@ -3250,6 +3250,7 @@ apps_rsc: rsc@17a00000 { qcom,drv-id = <2>; qcom,tcs-config = <ACTIVE_TCS 3>, <SLEEP_TCS 2>, <WAKE_TCS 2>, <CONTROL_TCS 0>; + power-domains = <&CLUSTER_PD>; apps_bcm_voter: bcm-voter { compatible = "qcom,bcm-voter";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 297/431 arm64: dts: qcom: sm8250-edo: Panel framebuffer is 2.5k instead of 4k
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 223ce29c8b7e5b00f01a68387aabeefd77d97f06 ]
The framebuffer configuration for edo pdx203, written in edo dtsi (which is overwritten in pdx206 dts for its smaller panel) has to use a 1096x2560 configuration as this is what the panel (and framebuffer area) has been initialized to. Downstream userspace also has access to (and uses) this 2.5k mode by default, and only switches the panel to 4k when requested.
This is similar to commit be8de06dc397 ("arm64: dts: qcom:
sm8150-kumano: Panel framebuffer is 2.5k instead of 4k") which fixed the same for the previous generation Sony platform.
--- arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo.dtsi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo.dtsi +4 -3
@@ -26,9 +26,10 @@ chosen { framebuffer: framebuffer@9c000000 { compatible = "simple-framebuffer"; reg = <0 0x9c000000 0 0x2300000>; - width = <1644>; - height = <3840>; - stride = <(1644 * 4)>; + /* pdx203 BL initializes in 2.5k mode, not 4k */ + width = <1096>; + height = <2560>; + stride = <(1096 * 4)>; format = "a8r8g8b8"; /* * That's a lot of clocks, but it's necessary due
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 298/431 arm64: dts: qcom: sm8550: Add missing interconnect path to USB HC
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
[ Upstream commit 11a1397bbf69e408223bb691858a0fcd295a8f76 ]
The USB HC node is missing the interconnect paths, so add them.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/sm8550.dtsi +4 -0
@@ -2441,6 +2441,10 @@ usb_1: usb@a6f8800 { resets = <&gcc GCC_USB30_PRIM_BCR>; + interconnects = <&aggre1_noc MASTER_USB3_0 0 &mc_virt SLAVE_EBI1 0>, + <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_0 0>; + interconnect-names = "usb-ddr", "apps-usb"; + status = "disabled"; usb_1_dwc3: usb@a600000 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 299/431 clk: bcm: rpi: Fix off by one in raspberrypi_discover_clocks()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit da2edb3e3c09fd1451b7f400ccd1070ef086619a ]
Smatch detected an off by one in this code:
drivers/clk/bcm/clk-raspberrypi.c:374 raspberrypi_discover_clocks()
error: buffer overflow 'data->hws' 16 <= 16The data->hws[] array has RPI_FIRMWARE_NUM_CLK_ID elements so the > comparison needs to changed to >=.
--- drivers/clk/bcm/clk-raspberrypi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/bcm/clk-raspberrypi.c +2 -2
@@ -356,9 +356,9 @@ static int raspberrypi_discover_clocks(struct raspberrypi_clk *rpi,while (clks->id) {struct raspberrypi_clk_variant *variant; -if (clks->id >RPI_FIRMWARE_NUM_CLK_ID ) { +if (clks->id >=RPI_FIRMWARE_NUM_CLK_ID ) {dev_err (rpi->dev,"Unknown clock id: %u (max: %u)\n" , - clks->id,RPI_FIRMWARE_NUM_CLK_ID ); + clks->id,RPI_FIRMWARE_NUM_CLK_ID -1 );return -EINVAL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 300/431 clk: clocking-wizard: Fix Oops in clk_wzrd_register_divider()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 9c632a6396505a019ea6d12b5ab45e659a542a93 ]
Smatch detected this potential error pointer dereference clk_wzrd_register_divider(). If devm_clk_hw_register() fails then it sets "hw" to an error pointer and then dereferences it on the next line. Return the error directly instead.
--- drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/xilinx/clk-xlnx-clock-wizard.c +1 -1
@@ -354,7 +354,7 @@ static struct clk *clk_wzrd_register_divider(struct device *dev, hw = &div->hw; ret =devm_clk_hw_register (dev, hw);if (ret) - hw =ERR_PTR (ret); +return ERR_PTR (ret);return hw->clk; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 301/431 clk: tegra: tegra124-emc: Fix potential memory leak
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 53a06e5924c0d43c11379a08c5a78529c3e61595 ]
The tegra and tegra needs to be freed in the error handling path, otherwise it will be leaked.
--- drivers/clk/tegra/clk-tegra124-emc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/tegra/clk-tegra124-emc.c +2 -0
@@ -464,6 +464,7 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra, err =load_one_timing_from_dt (tegra, timing, child);if (err) {of_node_put (child); +kfree (tegra->timings);return err; }
@@ -515,6 +516,7 @@ struct clk *tegra124_clk_register_emc(void __iomem *base, struct device_node *np err =load_timings_from_dt (tegra, node, node_ram_code);if (err) {of_node_put (node); +kfree (tegra);return ERR_PTR (err); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 302/431 arm64: dts: ti: k3-j721e-beagleboneai64: Fix mailbox node status
In reply to Greg Kroah-HartmanFrom: Andrew Davis <[email protected]>
[ Upstream commit 155e7635ed1f3814d94d12556a3a0fed41d05b76 ]
Mailbox nodes are now disabled by default. The BeagleBoard AI64 DT addition went in at around the same time and must have missed that change so the mailboxes are not re-enabled. Do that here.
--- arch/arm64/boot/dts/ti/k3-j721e-beagleboneai64.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/ti/k3-j721e-beagleboneai64.dts +5 -0
@@ -936,6 +936,7 @@ &ufs_wrapper { }; &mailbox0_cluster0 { + status = "okay"; interrupts = <436>; mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
@@ -950,6 +951,7 @@ mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 { }; &mailbox0_cluster1 { + status = "okay"; interrupts = <432>; mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
@@ -964,6 +966,7 @@ mbox_main_r5fss0_core1: mbox-main-r5fss0-core1 { }; &mailbox0_cluster2 { + status = "okay"; interrupts = <428>; mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
@@ -978,6 +981,7 @@ mbox_main_r5fss1_core1: mbox-main-r5fss1-core1 { }; &mailbox0_cluster3 { + status = "okay"; interrupts = <424>; mbox_c66_0: mbox-c66-0 {
@@ -992,6 +996,7 @@ mbox_c66_1: mbox-c66-1 { }; &mailbox0_cluster4 { + status = "okay"; interrupts = <420>; mbox_c71_0: mbox-c71-0 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 303/431 arm64: dts: ti: k3-j784s4-evm: Fix main_i2c0 alias
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit c10a9df30e3401bd5a5ee43f1afd6c2b2ca75ad7 ]
main_i2c0 is aliased as i2c0 which creates a problem for u-boot R5 SPL attempting to reuse the same definition in the common board detection logic as it looks for the first i2c instance as the bus on which to detect the eeprom to understand the board variant involved. Switch main_i2c0 to i2c3 alias allowing us to introduce wkup_i2c0 and potentially space for mcu_i2c instances in the gap for follow on patches.
--- arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j784s4-evm.dts +1 -1
@@ -22,7 +22,7 @@ chosen { aliases { serial2 = &main_uart8; mmc1 = &main_sdhci1; - i2c0 = &main_i2c0; + i2c3 = &main_i2c0; }; memory@80000000 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 304/431 arm64: dts: ti: k3-j784s4-evm: Enable MCU CPSW2G
In reply to Greg Kroah-HartmanFrom: Siddharth Vadapalli <[email protected]>
[ Upstream commit 6cd4b7cfbcca4a45f06a8031f299c4019221a4ce ]
Add device tree support to enable MCU CPSW with J784S4 EVM.
Stable-dep-of: 14462bd0b247 ("arm64: dts: ti: k3-j784s4: Fix wakeup pinmux range and pinctrl node offsets")
--- arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
arch/arm64/boot/dts/ti/k3-j784s4-evm.dts +50 -0
@@ -140,6 +140,32 @@ J784S4_IOPAD(0x020, PIN_INPUT, 7) /* (AJ35) MCAN15_RX.GPIO0_8 */ }; }; +&wkup_pmx0 { + mcu_cpsw_pins_default: mcu-cpsw-pins-default { + pinctrl-single,pins = < + J784S4_WKUP_IOPAD(0x094, PIN_INPUT, 0) /* (A35) MCU_RGMII1_RD0 */ + J784S4_WKUP_IOPAD(0x090, PIN_INPUT, 0) /* (B36) MCU_RGMII1_RD1 */ + J784S4_WKUP_IOPAD(0x08c, PIN_INPUT, 0) /* (C36) MCU_RGMII1_RD2 */ + J784S4_WKUP_IOPAD(0x088, PIN_INPUT, 0) /* (D36) MCU_RGMII1_RD3 */ + J784S4_WKUP_IOPAD(0x084, PIN_INPUT, 0) /* (B37) MCU_RGMII1_RXC */ + J784S4_WKUP_IOPAD(0x06c, PIN_INPUT, 0) /* (C37) MCU_RGMII1_RX_CTL */ + J784S4_WKUP_IOPAD(0x07c, PIN_OUTPUT, 0) /* (D37) MCU_RGMII1_TD0 */ + J784S4_WKUP_IOPAD(0x078, PIN_OUTPUT, 0) /* (D38) MCU_RGMII1_TD1 */ + J784S4_WKUP_IOPAD(0x074, PIN_OUTPUT, 0) /* (E37) MCU_RGMII1_TD2 */ + J784S4_WKUP_IOPAD(0x070, PIN_OUTPUT, 0) /* (E38) MCU_RGMII1_TD3 */ + J784S4_WKUP_IOPAD(0x080, PIN_OUTPUT, 0) /* (E36) MCU_RGMII1_TXC */ + J784S4_WKUP_IOPAD(0x068, PIN_OUTPUT, 0) /* (C38) MCU_RGMII1_TX_CTL */ + >; + }; + + mcu_mdio_pins_default: mcu-mdio-pins-default { + pinctrl-single,pins = < + J784S4_WKUP_IOPAD(0x09c, PIN_OUTPUT, 0) /* (A36) MCU_MDIO0_MDC */ + J784S4_WKUP_IOPAD(0x098, PIN_INPUT, 0) /* (B35) MCU_MDIO0_MDIO */ + >; + }; +}; + &main_uart8 { status = "okay"; pinctrl-names = "default";
@@ -194,3 +220,27 @@ &main_sdhci1 { &main_gpio0 { status = "okay"; }; + +&mcu_cpsw { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&mcu_cpsw_pins_default>; +}; + +&davinci_mdio { + pinctrl-names = "default"; + pinctrl-0 = <&mcu_mdio_pins_default>; + + mcu_phy0: ethernet-phy@0 { + reg = <0>; + ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>; + ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>; + ti,min-output-impedance; + }; +}; + +&mcu_cpsw_port1 { + status = "okay"; + phy-mode = "rgmii-rxid"; + phy-handle = <&mcu_phy0>; +};
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 305/431 arm64: dts: ti: k3-j784s4: Fix wakeup pinmux range and pinctrl node offsets
In reply to Greg Kroah-HartmanFrom: Thejasvi Konduru <[email protected]>
[ Upstream commit 14462bd0b247d05070d48d0f02eb7ca2680ab7bd ]
The wkup_pmx register region in j784s4 has multiple non-addressable regions, hence the existing wkup_pmx region is split as follows to avoid the non-addressable regions. The pinctrl node offsets are also corrected as per the newly split wkup_pmx* nodes.
wkup_pmx0 -> 13 pins (WKUP_PADCONFIG 0 - 12)wkup_pmx1 -> 11 pins (WKUP_PADCONFIG 14 - 24)wkup_pmx2 -> 72 pins (WKUP_PADCONFIG 26 - 97)wkup_pmx3 -> 1 pin (WKUP_PADCONFIG 100)
--- arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 30 +++++++++---------- .../boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi | 29 +++++++++++++++++- 2 files changed, 43 insertions(+), 16 deletions(-)
arch/arm64/boot/dts/ti/k3-j784s4-evm.dts +15 -15
@@ -140,28 +140,28 @@ J784S4_IOPAD(0x020, PIN_INPUT, 7) /* (AJ35) MCAN15_RX.GPIO0_8 */ }; }; -&wkup_pmx0 { +&wkup_pmx2 { mcu_cpsw_pins_default: mcu-cpsw-pins-default { pinctrl-single,pins = < - J784S4_WKUP_IOPAD(0x094, PIN_INPUT, 0) /* (A35) MCU_RGMII1_RD0 */ - J784S4_WKUP_IOPAD(0x090, PIN_INPUT, 0) /* (B36) MCU_RGMII1_RD1 */ - J784S4_WKUP_IOPAD(0x08c, PIN_INPUT, 0) /* (C36) MCU_RGMII1_RD2 */ - J784S4_WKUP_IOPAD(0x088, PIN_INPUT, 0) /* (D36) MCU_RGMII1_RD3 */ - J784S4_WKUP_IOPAD(0x084, PIN_INPUT, 0) /* (B37) MCU_RGMII1_RXC */ - J784S4_WKUP_IOPAD(0x06c, PIN_INPUT, 0) /* (C37) MCU_RGMII1_RX_CTL */ - J784S4_WKUP_IOPAD(0x07c, PIN_OUTPUT, 0) /* (D37) MCU_RGMII1_TD0 */ - J784S4_WKUP_IOPAD(0x078, PIN_OUTPUT, 0) /* (D38) MCU_RGMII1_TD1 */ - J784S4_WKUP_IOPAD(0x074, PIN_OUTPUT, 0) /* (E37) MCU_RGMII1_TD2 */ - J784S4_WKUP_IOPAD(0x070, PIN_OUTPUT, 0) /* (E38) MCU_RGMII1_TD3 */ - J784S4_WKUP_IOPAD(0x080, PIN_OUTPUT, 0) /* (E36) MCU_RGMII1_TXC */ - J784S4_WKUP_IOPAD(0x068, PIN_OUTPUT, 0) /* (C38) MCU_RGMII1_TX_CTL */ + J784S4_WKUP_IOPAD(0x02c, PIN_INPUT, 0) /* (A35) MCU_RGMII1_RD0 */ + J784S4_WKUP_IOPAD(0x028, PIN_INPUT, 0) /* (B36) MCU_RGMII1_RD1 */ + J784S4_WKUP_IOPAD(0x024, PIN_INPUT, 0) /* (C36) MCU_RGMII1_RD2 */ + J784S4_WKUP_IOPAD(0x020, PIN_INPUT, 0) /* (D36) MCU_RGMII1_RD3 */ + J784S4_WKUP_IOPAD(0x01c, PIN_INPUT, 0) /* (B37) MCU_RGMII1_RXC */ + J784S4_WKUP_IOPAD(0x004, PIN_INPUT, 0) /* (C37) MCU_RGMII1_RX_CTL */ + J784S4_WKUP_IOPAD(0x014, PIN_OUTPUT, 0) /* (D37) MCU_RGMII1_TD0 */ + J784S4_WKUP_IOPAD(0x010, PIN_OUTPUT, 0) /* (D38) MCU_RGMII1_TD1 */ + J784S4_WKUP_IOPAD(0x00c, PIN_OUTPUT, 0) /* (E37) MCU_RGMII1_TD2 */ + J784S4_WKUP_IOPAD(0x008, PIN_OUTPUT, 0) /* (E38) MCU_RGMII1_TD3 */ + J784S4_WKUP_IOPAD(0x018, PIN_OUTPUT, 0) /* (E36) MCU_RGMII1_TXC */ + J784S4_WKUP_IOPAD(0x000, PIN_OUTPUT, 0) /* (C38) MCU_RGMII1_TX_CTL */ >; }; mcu_mdio_pins_default: mcu-mdio-pins-default { pinctrl-single,pins = < - J784S4_WKUP_IOPAD(0x09c, PIN_OUTPUT, 0) /* (A36) MCU_MDIO0_MDC */ - J784S4_WKUP_IOPAD(0x098, PIN_INPUT, 0) /* (B35) MCU_MDIO0_MDIO */ + J784S4_WKUP_IOPAD(0x034, PIN_OUTPUT, 0) /* (A36) MCU_MDIO0_MDC */ + J784S4_WKUP_IOPAD(0x030, PIN_INPUT, 0) /* (B35) MCU_MDIO0_MDIO */ >; }; };
arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi +28 -1
@@ -50,7 +50,34 @@ mcu_ram: sram@41c00000 { wkup_pmx0: pinctrl@4301c000 { compatible = "pinctrl-single"; /* Proxy 0 addressing */ - reg = <0x00 0x4301c000 0x00 0x178>; + reg = <0x00 0x4301c000 0x00 0x034>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + wkup_pmx1: pinctrl@4301c038 { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x4301c038 0x00 0x02c>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + wkup_pmx2: pinctrl@4301c068 { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x4301c068 0x00 0x120>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + wkup_pmx3: pinctrl@4301c190 { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x4301c190 0x00 0x004>; #pinctrl-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 306/431 arm64: dts: ti: k3-am69-sk: Fix main_i2c0 alias
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit b38c6ced4ec5b3f6260ff6cc2b71e8a3d8c897d7 ]
main_i2c0 is aliased as i2c0 which creates a problem for u-boot R5 SPL attempting to reuse the same definition in the common board detection logic as it looks for the first i2c instance as the bus on which to detect the eeprom to understand the board variant involved. Switch main_i2c0 to i2c3 alias allowing us to introduce wkup_i2c0 and potentially space for mcu_i2c instances in the gap for follow on patches.
--- arch/arm64/boot/dts/ti/k3-am69-sk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am69-sk.dts +1 -1
@@ -23,7 +23,7 @@ chosen { aliases { serial2 = &main_uart8; mmc1 = &main_sdhci1; - i2c0 = &main_i2c0; + i2c3 = &main_i2c0; }; memory@80000000 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 307/431 ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
In reply to Greg Kroah-HartmanFrom: Su Hui <[email protected]>
[ Upstream commit 79597c8bf64ca99eab385115743131d260339da5 ]
smatch error:sound/pci/ac97/ac97_codec.c:2354 snd_ac97_mixer() error:
we previously assumed 'rac97' could be null (see line 2072)
remove redundant assignment, return error if rac97 is NULL.
--- sound/pci/ac97/ac97_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/ac97/ac97_codec.c +2 -2
@@ -2069,8 +2069,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, .dev_disconnect = snd_ac97_dev_disconnect, }; -if (rac97) - *rac97 =NULL ; +if (!rac97) +return -EINVAL ;if (snd_BUG_ON (!bus || !template))return -EINVAL ;if (snd_BUG_ON (template->num >=4 ))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 308/431 drm/msm/dpu: do not enable color-management if DSPPs are not available
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 3bcfc7b90465efd337d39b91b43972162f0d1908 ]
We can not support color management without DSPP blocks being provided in the HW catalog. Do not enable color management for CRTCs if num_dspps is 0.
Patchwork: https://patchwork.freedesktop.org/patch/542141/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +4 -1
@@ -1575,6 +1575,8 @@ static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {struct drm_crtc *dpu_crtc_init (struct drm_device *dev,struct drm_plane *plane,struct drm_plane *cursor) { +struct msm_drm_private *priv = dev->dev_private; +struct dpu_kms *dpu_kms =to_dpu_kms (priv->kms);struct drm_crtc *crtc =NULL ;struct dpu_crtc *dpu_crtc =NULL ;int i;
@@ -1606,7 +1608,8 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane,drm_crtc_helper_add (crtc, &dpu_crtc_helper_funcs); -drm_crtc_enable_color_mgmt (crtc,0 , true,0 ); +if (dpu_kms->catalog->dspp_count) +drm_crtc_enable_color_mgmt (crtc,0 , true,0 );/* save user friendly CRTC name for later */ snprintf (dpu_crtc->name,DPU_CRTC_NAME_SIZE ,"crtc%u" , crtc->base.id);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 309/431 drm/msm/dpu: Fix slice_last_group_size calculation
In reply to Greg Kroah-HartmanFrom: Jessica Zhang <[email protected]>
[ Upstream commit c223059e6f8340f7eac2319470984cbfc39c433b ]
Correct the math for slice_last_group_size so that it matches the calculations downstream.
Patchwork: https://patchwork.freedesktop.org/patch/539269/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c +3 -2
@@ -54,9 +54,10 @@ static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc,if (is_cmd_mode) initial_lines +=1 ; - slice_last_group_size =3 - (dsc->slice_width %3 ); + slice_last_group_size = (dsc->slice_width +2 ) %3 ; + data = (initial_lines <<20 ); - data |= ((slice_last_group_size -1 ) <<18 ); + data |= (slice_last_group_size <<18 );/* bpp is 6.4 format, 4 LSBs bits are for fractional part */ data |= (dsc->bits_per_pixel <<8 ); data |= (dsc->block_pred_enable <<7 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 310/431 drm/msm/dsi: Remove incorrect references to slice_count
In reply to Greg Kroah-HartmanFrom: Jessica Zhang <[email protected]>
[ Upstream commit 155fa3a91d64221eb0885fd221cc8085dbef908f ]
Currently, slice_count is being used to calculate word count and pkt_per_line. Instead, these values should be calculated using slice per packet, which is not the same as slice_count.
Slice count represents the number of slices per interface, and its value will not always match that of slice per packet. For example, it is possible to have cases where there are multiple slices per interface but the panel specifies only one slice per packet.
Thus, use the default value of one slice per packet and remove slice_count from the aforementioned calculations.
Patchwork: https://patchwork.freedesktop.org/patch/541965/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +16 -10
@@ -854,18 +854,17 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod*/ slice_per_intf =DIV_ROUND_UP (hdisplay, dsc->slice_width); -/* -* If slice_count is greater than slice_per_intf -* then default to 1. This can happen during partial -* update. -*/ -if (dsc->slice_count > slice_per_intf) - dsc->slice_count =1 ; - total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; eol_byte_num = total_bytes_per_intf %3 ; - pkt_per_line = slice_per_intf / dsc->slice_count; + +/* +* Typically, pkt_per_line = slice_per_intf * slice_per_pkt. +* +* Since the current driver only supports slice_per_pkt = 1, +* pkt_per_line will be equal to slice per intf for now. +*/ + pkt_per_line = slice_per_intf;if (is_cmd_mode)/* packet data type */ reg =DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE (MIPI_DSI_DCS_LONG_WRITE );
@@ -989,7 +988,14 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)if (!msm_host->dsc) wc = hdisplay *dsi_get_bpp (msm_host->format) /8 +1 ;else - wc = msm_host->dsc->slice_chunk_size * msm_host->dsc->slice_count +1 ; +/* +* When DSC is enabled, WC = slice_chunk_size * slice_per_pkt + 1. +* Currently, the driver only supports default value of slice_per_pkt = 1 +* +* TODO: Expand mipi_dsi_device struct to hold slice_per_pkt info +* and adjust DSC math to account for slice_per_pkt. +*/ + wc = msm_host->dsc->slice_chunk_size +1 ; dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) |
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 311/431 drm/msm/dp: Drop aux devices together with DP controller
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit a7bfb2ad2184a1fba78be35209b6019aa8cc8d4d ]
Using devres to depopulate the aux bus made sure that upon a probe deferral the EDP panel device would be destroyed and recreated upon next attempt.
But the struct device which the devres is tied to is the DPUs (drm_dev->dev), which may be happen after the DP controller is torn down.
Indications of this can be seen in the commonly seen EDID-hexdump full of zeros in the log, or the occasional/rare KASAN fault where the panel's attempt to read the EDID information causes a use after free on DP resources.
It's tempting to move the devres to the DP controller's struct device, but the resources used by the device(s) on the aux bus are explicitly torn down in the error path. The KASAN-reported use-after-free also remains, as the DP aux "module" explicitly frees its devres-allocated memory in this code path.
As such, explicitly depopulate the aux bus in the error path, and in the component unbind path, to avoid these issues.
Patchwork: https://patchwork.freedesktop.org/patch/542163/
--- drivers/gpu/drm/msm/dp/dp_display.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +3 -11
@@ -325,6 +325,8 @@ static void dp_display_unbind(struct device *dev, struct device *master,kthread_stop (dp->ev_tsk); +of_dp_aux_depopulate_bus (dp->aux); +dp_power_client_deinit (dp->power);dp_unregister_audio_driver (dev, dp->audio);dp_aux_unregister (dp->aux);
@@ -1538,11 +1540,6 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor) } } -static void of_dp_aux_depopulate_bus_void (void *data) -{ -of_dp_aux_depopulate_bus (data); -} -static int dp_display_get_next_bridge (struct msm_dp *dp) {int rc;
@@ -1571,12 +1568,6 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)of_node_put (aux_bus);if (rc) goto error; - - rc =devm_add_action_or_reset (dp->drm_dev->dev, - of_dp_aux_depopulate_bus_void, - dp_priv->aux); -if (rc) - goto error; }else if (dp->is_edp) {DRM_ERROR ("eDP aux_bus not found\n" );return -ENODEV ;
@@ -1601,6 +1592,7 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) error:if (dp->is_edp) {disable_irq (dp_priv->irq); +of_dp_aux_depopulate_bus (dp_priv->aux);dp_display_host_phy_exit (dp_priv);dp_display_host_deinit (dp_priv); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 312/431 drm/msm/dp: Free resources after unregistering them
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit fa0048a4b1fa7a50c8b0e514f5b428abdf69a6f8 ]
The DP component's unbind operation walks through the submodules to unregister and clean things up. But if the unbind happens because the DP controller itself is being removed, all the memory for those submodules has just been freed.
Change the order of these operations to avoid the many use-after-free that otherwise happens in this code path.
Patchwork: https://patchwork.freedesktop.org/patch/542166/
--- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dp/dp_display.c +1 -1
@@ -1354,9 +1354,9 @@ static int dp_display_remove(struct platform_device *pdev) {struct dp_display_private *dp =dev_get_dp_display_private (&pdev->dev); +component_del (&pdev->dev, &dp_display_comp_ops);dp_display_deinit_sub_modules (dp); -component_del (&pdev->dev, &dp_display_comp_ops);platform_set_drvdata (pdev,NULL );return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 313/431 arm64: dts: mediatek: Add cpufreq nodes for MT8192
In reply to Greg Kroah-HartmanFrom: Allen-KH Cheng <[email protected]>
[ Upstream commit 9d498cce9298a71e3896e2d1aee24a1a4c531d81 ]
Add the cpufreq nodes for MT8192 SoC.
Stable-dep-of: a4366b5695c9 ("arm64: dts: mediatek: mt8192: Fix CPUs capacity-dmips-mhz")
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +14 -0
@@ -70,6 +70,7 @@ cpu0: cpu@0 { d-cache-line-size = <64>; d-cache-sets = <128>; next-level-cache = <&l2_0>; + performance-domains = <&performance 0>; capacity-dmips-mhz = <530>; };
@@ -87,6 +88,7 @@ cpu1: cpu@100 { d-cache-line-size = <64>; d-cache-sets = <128>; next-level-cache = <&l2_0>; + performance-domains = <&performance 0>; capacity-dmips-mhz = <530>; };
@@ -104,6 +106,7 @@ cpu2: cpu@200 { d-cache-line-size = <64>; d-cache-sets = <128>; next-level-cache = <&l2_0>; + performance-domains = <&performance 0>; capacity-dmips-mhz = <530>; };
@@ -121,6 +124,7 @@ cpu3: cpu@300 { d-cache-line-size = <64>; d-cache-sets = <128>; next-level-cache = <&l2_0>; + performance-domains = <&performance 0>; capacity-dmips-mhz = <530>; };
@@ -138,6 +142,7 @@ cpu4: cpu@400 { d-cache-line-size = <64>; d-cache-sets = <256>; next-level-cache = <&l2_1>; + performance-domains = <&performance 1>; capacity-dmips-mhz = <1024>; };
@@ -155,6 +160,7 @@ cpu5: cpu@500 { d-cache-line-size = <64>; d-cache-sets = <256>; next-level-cache = <&l2_1>; + performance-domains = <&performance 1>; capacity-dmips-mhz = <1024>; };
@@ -172,6 +178,7 @@ cpu6: cpu@600 { d-cache-line-size = <64>; d-cache-sets = <256>; next-level-cache = <&l2_1>; + performance-domains = <&performance 1>; capacity-dmips-mhz = <1024>; };
@@ -189,6 +196,7 @@ cpu7: cpu@700 { d-cache-line-size = <64>; d-cache-sets = <256>; next-level-cache = <&l2_1>; + performance-domains = <&performance 1>; capacity-dmips-mhz = <1024>; };
@@ -318,6 +326,12 @@ soc { compatible = "simple-bus"; ranges; + performance: performance-controller@11bc10 { + compatible = "mediatek,cpufreq-hw"; + reg = <0 0x0011bc10 0 0x120>, <0 0x0011bd30 0 0x120>; + #performance-domain-cells = <1>; + }; + gic: interrupt-controller@c000000 { compatible = "arm,gic-v3"; #interrupt-cells = <4>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 314/431 arm64: dts: mediatek: mt8192: Fix CPUs capacity-dmips-mhz
In reply to Greg Kroah-HartmanFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit a4366b5695c984b8a3fc8b31de9e758c8f6d1aed ]
The capacity-dmips-mhz parameter was miscalculated: this SoC runs the first (Cortex-A55) cluster at a maximum of 2000MHz and the second (Cortex-A76) cluster at a maximum of 2200MHz.
In order to calculate the right capacity-dmips-mhz, the following test was performed:
1. CPUFREQ governor was set to 'performance' on both clusters
2. Ran dhrystone with 500000000 iterations for 10 times on each cluster
3. Calculated the mean result for each cluster
4. Calculated DMIPS/MHz: dmips_mhz = dmips_per_second / cpu_mhz
5. Scaled results to 1024:
result_c0 = dmips_mhz_c0 / dmips_mhz_c1 * 1024
The mean results for this SoC are:
Cluster 0 (LITTLE): 12016411 Dhry/s
Cluster 1 (BIG): 31702034 Dhry/s
The calculated scaled results are:
Cluster 0: 426.953226899238 (rounded to 427)
Cluster 1: 1024
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +4 -4
@@ -71,7 +71,7 @@ cpu0: cpu@0 { d-cache-sets = <128>; next-level-cache = <&l2_0>; performance-domains = <&performance 0>; - capacity-dmips-mhz = <530>; + capacity-dmips-mhz = <427>; }; cpu1: cpu@100 {
@@ -89,7 +89,7 @@ cpu1: cpu@100 { d-cache-sets = <128>; next-level-cache = <&l2_0>; performance-domains = <&performance 0>; - capacity-dmips-mhz = <530>; + capacity-dmips-mhz = <427>; }; cpu2: cpu@200 {
@@ -107,7 +107,7 @@ cpu2: cpu@200 { d-cache-sets = <128>; next-level-cache = <&l2_0>; performance-domains = <&performance 0>; - capacity-dmips-mhz = <530>; + capacity-dmips-mhz = <427>; }; cpu3: cpu@300 {
@@ -125,7 +125,7 @@ cpu3: cpu@300 { d-cache-sets = <128>; next-level-cache = <&l2_0>; performance-domains = <&performance 0>; - capacity-dmips-mhz = <530>; + capacity-dmips-mhz = <427>; }; cpu4: cpu@400 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 315/431 arm64: dts: mt7986: increase bl2 partition on NAND of Bananapi R3
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit 3bfbff9b461e3506dfb5b2904e8c15a0aea39e07 ]
The bootrom burned into the MT7986 SoC will try multiple locations on the SPI-NAND flash to load bl2 in case the bl2 image located at the the previously attempted offset is corrupt.
Use 0x100000 instead of 0x80000 as partition size for bl2 on SPI-NAND, allowing for up to four redundant copies of bl2 (typically sized a bit less than 0x40000).
--- .../boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso +3 -3
@@ -29,13 +29,13 @@ partitions { partition@0 { label = "bl2"; - reg = <0x0 0x80000>; + reg = <0x0 0x100000>; read-only; }; - partition@80000 { + partition@100000 { label = "reserved"; - reg = <0x80000 0x300000>; + reg = <0x100000 0x280000>; }; partition@380000 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 316/431 drm/amdgpu: Fix memcpy() in sienna_cichlid_append_powerplay_table function.
In reply to Greg Kroah-HartmanFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit d50dc746ff72b9c48812dac3344fa87fbde940a3 ]
Fixes the following gcc with W=1:
In file included from ./include/linux/string.h:253,
from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/processor.h:22,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:78,
from ./include/linux/spinlock.h:56,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/firmware.h:7,
from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/sienna_cichlid_ppt.c:26:In function ‘fortify_memcpy_chk’,
inlined from ‘sienna_cichlid_append_powerplay_table’ at drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/sienna_cichlid_ppt.c:444:2,
inlined from ‘sienna_cichlid_setup_pptable’ at drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/sienna_cichlid_ppt.c:506:8,
inlined from ‘sienna_cichlid_setup_pptable’ at drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/sienna_cichlid_ppt.c:494:12:./include/linux/fortify-string.h:413:4: warning: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
413 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~the compiler complains about the size calculation in the memcpy() - "sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)" is much larger than what fits into table_member.
Hence, reuse 'smu_memcpy_trailing' for nv1x
--- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +14 -4
@@ -431,7 +431,13 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) {struct atom_smc_dpm_info_v4_9 *smc_dpm_table;int index, ret; -I2cControllerConfig_t *table_member; +PPTable_beige_goby_t *ppt_beige_goby; +PPTable_t *ppt; + +if (smu->adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (11 ,0 ,13 )) + ppt_beige_goby = smu->smu_table.driver_pptable; +else + ppt = smu->smu_table.driver_pptable; index =get_index_into_master_table (atom_master_list_of_data_tables_v2_1, smc_dpm_info);
@@ -440,9 +446,13 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) (uint8_t **)&smc_dpm_table);if (ret)return ret; -GET_PPTABLE_MEMBER (I2cControllers, &table_member); -memcpy (table_member, smc_dpm_table->I2cControllers, -sizeof (*smc_dpm_table) -sizeof (smc_dpm_table->table_header)); + +if (smu->adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (11 ,0 ,13 )) +smu_memcpy_trailing (ppt_beige_goby, I2cControllers, BoardReserved, + smc_dpm_table, I2cControllers); +else +smu_memcpy_trailing (ppt, I2cControllers, BoardReserved, + smc_dpm_table, I2cControllers);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 317/431 drm/amdgpu: Fix usage of UMC fill record in RAS
In reply to Greg Kroah-HartmanFrom: Luben Tuikov <[email protected]>
[ Upstream commit 71344a718a9fda8c551cdc4381d354f9a9907f6f ]
The fixed commit listed in the Fixes tag below, introduced a bug in amdgpu_ras.c::amdgpu_reserve_page_direct(), in that when introducing the new amdgpu_umc_fill_error_record() and internally in that new function the physical address (argument "uint64_t retired_page"--wrong name) is right-shifted by AMDGPU_GPU_PAGE_SHIFT. Thus, in amdgpu_reserve_page_direct() when we pass "address" to that new function, we should NOT right-shift it, since this results, erroneously, in the page address to be 0 for first 2^(2*AMDGPU_GPU_PAGE_SHIFT) memory addresses.
This commit fixes this bug.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -2
@@ -170,8 +170,7 @@ static int amdgpu_reserve_page_direct(struct amdgpu_device *adev, uint64_t addrememset (&err_rec,0x0 ,sizeof (struct eeprom_table_record )); err_data.err_addr = &err_rec; -amdgpu_umc_fill_error_record (&err_data, address, - (address >>AMDGPU_GPU_PAGE_SHIFT ),0 ,0 ); +amdgpu_umc_fill_error_record (&err_data, address, address,0 ,0 );if (amdgpu_bad_page_threshold !=0 ) { amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
Signature · 1 line
2.39.2
RE: [PATCH 6.3 317/431] drm/amdgpu: Fix usage of UMC fill record in RAS
[AMD Official Use Only - General]
Quoted 61 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, July 9, 2023 7:14 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Zhou1, Tao <[email protected]>; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Sasha Levin <[email protected]>
Subject: [PATCH 6.3 317/431] drm/amdgpu: Fix usage of UMC fill record in RASFrom: Luben Tuikov <[email protected]>
[ Upstream commit
71344a718a9fda8c551cdc4381d354f9a9907f6f]The fixed commit listed in the Fixes tag below, introduced a bug in
amdgpu_ras.c::amdgpu_reserve_page_direct(), in that when introducing the newamdgpu_umc_fill_error_record()and internally in that new function the physical address (argument "uint64_tretired_page"--wrong name) is right-shifted byAMDGPU_GPU_PAGE_SHIFT. Thus, inamdgpu_reserve_page_direct()when we pass "address" to that new function, we should NOT right-shift it, since this results, erroneously, in the page address to be 0 for first 2^(2*AMDGPU_GPU_PAGE_SHIFT) memory addresses.This commit fixes this bug.
Cc Tao Zhou <[email protected]>Cc Hawking Zhang <[email protected]>Cc Alex Deucher <[email protected]>Fixes 400013b268cb ("drm/amdgpu: add umc_fill_error_record to make codemore simple")
Signed-off-by Luben Tuikov <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0@@ -170,8 +170,7 @@ static int amdgpu_reserve_page_direct(struct
amdgpu_device*adev,uint64_taddrememset(&err_rec, 0x0, sizeof(struct eeprom_table_record)); err_data.err_addr = &err_rec;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-3-amdgpu_umc_fill_error_record (&err_data, address, - (address >>AMDGPU_GPU_PAGE_SHIFT ),0 ,0 ); +amdgpu_umc_fill_error_record (&err_data, address, address,0 ,0 );if (amdgpu_bad_page_threshold !=0 ) { amdgpu_ras_add_bad_pages(adev, err_data.err_addr, --2.39.2
Greg Kroah-Hartman
maintainerPATCH 318/431 drm/msm/dpu: correct MERGE_3D length
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 9a6c13b847d61b0c3796820ca6e976789df59cd8 ]
Each MERGE_3D block has just two registers. Correct the block length accordingly.
Patchwork: https://patchwork.freedesktop.org/patch/542177/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +1 -1
@@ -1566,7 +1566,7 @@ static struct dpu_pingpong_cfg qcm2290_pp[] = {#define MERGE_3D_BLK (_name, _id, _base) \ {\ .name = _name, .id = _id, \ - .base = _base, .len = 0x100, \ + .base = _base, .len = 0x8, \ .features = MERGE_3D_SM8150_MASK, \ .sblk = NULL \ }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 319/431 clk: mediatek: clk-mt8173-apmixedsys: Fix return value for of_iomap() error
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 3dc265b369ee61db999d6d1588e888eb21dc421e ]
The of_iomap() function returns NULL in case of error so usage of PTR_ERR() is wrong!
Change that to return -ENOMEM in case of failure.
--- drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8173-apmixedsys.c +1 -1
@@ -92,7 +92,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) base =of_iomap (node,0 );if (!base) -return PTR_ERR (base); +return -ENOMEM ; clk_data =mtk_alloc_clk_data (CLK_APMIXED_NR_CLK );if (IS_ERR_OR_NULL (clk_data))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 320/431 clk: mediatek: clk-mt8173-apmixedsys: Fix iomap not released issue
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit b270ae61730e0ebccee39a21dd3311d6896a38ae ]
In case of error after of_ioremap() the resource must be released:
call iounmap() where appropriate to fix that.
--- drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8173-apmixedsys.c +4 -1
@@ -95,8 +95,10 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)return -ENOMEM ; clk_data =mtk_alloc_clk_data (CLK_APMIXED_NR_CLK ); -if (IS_ERR_OR_NULL (clk_data)) +if (IS_ERR_OR_NULL (clk_data)) { +iounmap (base);return -ENOMEM ; + } r =mtk_clk_register_plls (node, plls,ARRAY_SIZE (plls), clk_data);if (r)
@@ -127,6 +129,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)mtk_clk_unregister_plls (plls,ARRAY_SIZE (plls), clk_data); free_clk_data:mtk_free_clk_data (clk_data); +iounmap (base);return r; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 321/431 clk: vc5: check memory returned by kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 144601f6228de5598f03e693822b60a95c367a17 ]
kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- drivers/clk/clk-versaclock5.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/clk/clk-versaclock5.c +29 -0
@@ -1028,6 +1028,11 @@ static int vc5_probe(struct i2c_client *client) } init.name =kasprintf (GFP_KERNEL ,"%pOFn.mux" , client->dev.of_node); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } + init.ops = &vc5_mux_ops; init.flags =0 ; init.parent_names = parent_names;
@@ -1042,6 +1047,10 @@ static int vc5_probe(struct i2c_client *client)memset (&init,0 ,sizeof (init)); init.name =kasprintf (GFP_KERNEL ,"%pOFn.dbl" , client->dev.of_node); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } init.ops = &vc5_dbl_ops; init.flags =CLK_SET_RATE_PARENT ; init.parent_names = parent_names;
@@ -1057,6 +1066,10 @@ static int vc5_probe(struct i2c_client *client)/* Register PFD */ memset (&init,0 ,sizeof (init)); init.name =kasprintf (GFP_KERNEL ,"%pOFn.pfd" , client->dev.of_node); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } init.ops = &vc5_pfd_ops; init.flags =CLK_SET_RATE_PARENT ; init.parent_names = parent_names;
@@ -1074,6 +1087,10 @@ static int vc5_probe(struct i2c_client *client)/* Register PLL */ memset (&init,0 ,sizeof (init)); init.name =kasprintf (GFP_KERNEL ,"%pOFn.pll" , client->dev.of_node); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } init.ops = &vc5_pll_ops; init.flags =CLK_SET_RATE_PARENT ; init.parent_names = parent_names;
@@ -1093,6 +1110,10 @@ static int vc5_probe(struct i2c_client *client)memset (&init,0 ,sizeof (init)); init.name =kasprintf (GFP_KERNEL ,"%pOFn.fod%d" , client->dev.of_node, idx); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } init.ops = &vc5_fod_ops; init.flags =CLK_SET_RATE_PARENT ; init.parent_names = parent_names;
@@ -1111,6 +1132,10 @@ static int vc5_probe(struct i2c_client *client)memset (&init,0 ,sizeof (init)); init.name =kasprintf (GFP_KERNEL ,"%pOFn.out0_sel_i2cb" , client->dev.of_node); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } init.ops = &vc5_clk_out_ops; init.flags =CLK_SET_RATE_PARENT ; init.parent_names = parent_names;
@@ -1137,6 +1162,10 @@ static int vc5_probe(struct i2c_client *client)memset (&init,0 ,sizeof (init)); init.name =kasprintf (GFP_KERNEL ,"%pOFn.out%d" , client->dev.of_node, idx +1 ); +if (!init.name) { + ret = -ENOMEM ; + goto err_clk; + } init.ops = &vc5_clk_out_ops; init.flags =CLK_SET_RATE_PARENT ; init.parent_names = parent_names;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 322/431 clk: cdce925: check return value of kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit bb7d09ddbf361d51eae46f38e7c8a2b85914ea2a ]
kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
Depends-on: e665f029a283 ("clk: Convert to using %pOFn instead of device_node.name")
--- drivers/clk/clk-cdce925.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/clk/clk-cdce925.c +12 -0
@@ -701,6 +701,10 @@ static int cdce925_probe(struct i2c_client *client)for (i =0 ; i < data->chip_info->num_plls; ++i) { pll_clk_name[i] =kasprintf (GFP_KERNEL ,"%pOFn.pll%d" , client->dev.of_node, i); +if (!pll_clk_name[i]) { + err = -ENOMEM ; + goto error; + } init.name = pll_clk_name[i]; data->pll[i].chip = data; data->pll[i].hw.init = &init;
@@ -742,6 +746,10 @@ static int cdce925_probe(struct i2c_client *client) init.num_parents =1 ; init.parent_names = &parent_name;/* Mux Y1 to input */ init.name =kasprintf (GFP_KERNEL ,"%pOFn.Y1" , client->dev.of_node); +if (!init.name) { + err = -ENOMEM ; + goto error; + } data->clk[0 ].chip = data; data->clk[0 ].hw.init = &init; data->clk[0 ].index =0 ;
@@ -760,6 +768,10 @@ static int cdce925_probe(struct i2c_client *client)for (i =1 ; i < data->chip_info->num_outputs; ++i) { init.name =kasprintf (GFP_KERNEL ,"%pOFn.Y%d" , client->dev.of_node, i+1 ); +if (!init.name) { + err = -ENOMEM ; + goto error; + } data->clk[i].chip = data; data->clk[i].hw.init = &init; data->clk[i].index = i;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 323/431 clk: si5341: return error if one synth clock registration fails
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 2560114c06d7a752b3f4639f28cece58fed11267 ]
In case devm_clk_hw_register() fails for one of synth clocks the probe continues. Later on, when registering output clocks which have as parents all the synth clocks, in case there is registration failure for at least one synth clock the information passed to clk core for registering output clock is not right: init.num_parents is fixed but init.parents may contain an array with less parents.
--- drivers/clk/clk-si5341.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/clk/clk-si5341.c +8 -6
@@ -1553,7 +1553,7 @@ static int si5341_probe(struct i2c_client *client)struct clk_init_data init;struct clk *input;const char *root_clock_name; -const char *synth_clock_names[SI5341_NUM_SYNTH ]; +const char *synth_clock_names[SI5341_NUM_SYNTH ] = {NULL };int err;unsigned int i;struct clk_si5341_output_config config[SI5341_MAX_NUM_OUTPUTS ];
@@ -1705,6 +1705,7 @@ static int si5341_probe(struct i2c_client *client)if (err) {dev_err (&client->dev,"synth N%u registration failed\n" , i); + goto free_clk_names; } }
@@ -1782,16 +1783,17 @@ static int si5341_probe(struct i2c_client *client) goto cleanup; } +free_clk_names:/* Free the names, clk framework makes copies */ for (i =0 ; i < data->num_synth; ++i)devm_kfree (&client->dev, (void *)synth_clock_names[i]); -return 0 ; - cleanup: -for (i =0 ; i <SI5341_MAX_NUM_OUTPUTS ; ++i) { -if (data->clk[i].vddo_reg) -regulator_disable (data->clk[i].vddo_reg); +if (err) { +for (i =0 ; i <SI5341_MAX_NUM_OUTPUTS ; ++i) { +if (data->clk[i].vddo_reg) +regulator_disable (data->clk[i].vddo_reg); + } }return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 324/431 clk: si5341: check return value of {devm_}kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 36e4ef82016a2b785cf2317eade77e76699b7bff ]
{devm_}kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- drivers/clk/clk-si5341.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/clk-si5341.c +8 -0
@@ -1697,6 +1697,10 @@ static int si5341_probe(struct i2c_client *client)for (i =0 ; i < data->num_synth; ++i) { synth_clock_names[i] =devm_kasprintf (&client->dev,GFP_KERNEL ,"%s.N%u" , client->dev.of_node->name, i); +if (!synth_clock_names[i]) { + err = -ENOMEM ; + goto free_clk_names; + } init.name = synth_clock_names[i]; data->synth[i].index = i; data->synth[i].data = data;
@@ -1715,6 +1719,10 @@ static int si5341_probe(struct i2c_client *client)for (i =0 ; i < data->num_outputs; ++i) { init.name =kasprintf (GFP_KERNEL ,"%s.%d" , client->dev.of_node->name, i); +if (!init.name) { + err = -ENOMEM ; + goto free_clk_names; + } init.flags = config[i].synth_master ?CLK_SET_RATE_PARENT :0 ; data->clk[i].index = i; data->clk[i].data = data;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 325/431 clk: si5341: free unused memory on probe failure
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 267ad94b13c53d8c99a336f0841b1fa1595b1d0f ]
Pointers from synth_clock_names[] should be freed at the end of probe either on probe success or failure path.
--- drivers/clk/clk-si5341.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/clk/clk-si5341.c +7 -9
@@ -1744,7 +1744,7 @@ static int si5341_probe(struct i2c_client *client)if (err) {dev_err (&client->dev,"output %u registration failed\n" , i); - goto cleanup; + goto free_clk_names; }if (config[i].always_on)clk_prepare (data->clk[i].hw.clk);
@@ -1754,7 +1754,7 @@ static int si5341_probe(struct i2c_client *client) data);if (err) {dev_err (&client->dev,"unable to add clk provider\n" ); - goto cleanup; + goto free_clk_names; }if (initialization_required) {
@@ -1762,11 +1762,11 @@ static int si5341_probe(struct i2c_client *client)regcache_cache_only (data->regmap, false); err =regcache_sync (data->regmap);if (err <0 ) - goto cleanup; + goto free_clk_names; err =si5341_finalize_defaults (data);if (err <0 ) - goto cleanup; + goto free_clk_names; }/* wait for device to report input clock present and PLL lock */
@@ -1775,21 +1775,19 @@ static int si5341_probe(struct i2c_client *client) 10000, 250000);if (err) {dev_err (&client->dev,"Error waiting for input clock or PLL lock\n" ); - goto cleanup; + goto free_clk_names; }/* clear sticky alarm bits from initialization */ err =regmap_write (data->regmap,SI5341_STATUS_STICKY ,0 );if (err) {dev_err (&client->dev,"unable to clear sticky status\n" ); - goto cleanup; + goto free_clk_names; } err =sysfs_create_files (&client->dev.kobj, si5341_attributes); -if (err) { +if (err)dev_err (&client->dev,"unable to create sysfs files\n" ); - goto cleanup; - } free_clk_names:/* Free the names, clk framework makes copies */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 326/431 clk: keystone: sci-clk: check return value of kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit b73ed981da6d25c921aaefa7ca3df85bbd85b7fc ]
kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
Depends-on: 96488c09b0f4 ("clk: keystone: sci-clk: cut down the clock name length")
--- drivers/clk/keystone/sci-clk.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/keystone/sci-clk.c +2 -0
@@ -294,6 +294,8 @@ static int _sci_clk_build(struct sci_clk_provider *provider, name =kasprintf (GFP_KERNEL ,"clk:%d:%d" , sci_clk->dev_id, sci_clk->clk_id); +if (!name) +return -ENOMEM ; init.name = name;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 327/431 clk: ti: clkctrl: check return value of kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit bd46cd0b802d9c9576ca78007aa084ae3e74907b ]
kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- drivers/clk/ti/clkctrl.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/ti/clkctrl.c +7 -0
@@ -258,6 +258,9 @@ static const char * __init clkctrl_get_clock_name(struct device_node *np,if (clkctrl_name && !legacy_naming) { clock_name =kasprintf (GFP_KERNEL ,"%s-clkctrl:%04x:%d" , clkctrl_name, offset, index); +if (!clock_name) +return NULL ; +strreplace (clock_name,'_' ,'-' );return clock_name;
@@ -586,6 +589,10 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)if (clkctrl_name) { provider->clkdm_name =kasprintf (GFP_KERNEL ,"%s_clkdm" , clkctrl_name); +if (!provider->clkdm_name) { +kfree (provider); +return ; + } goto clkdm_found; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 328/431 drivers: meson: secure-pwrc: always enable DMA domain
In reply to Greg Kroah-HartmanFrom: Alexey Romanov <[email protected]>
[ Upstream commit 0bb4644d583789c97e74d3e3047189f0c59c4742 ]
Starting from commit e45f243409db ("firmware: meson_sm:
populate platform devices from sm device tree data") pwrc is probed successfully and disables unused pwr domains. By A1 SoC family design, any TEE requires DMA pwr domain always enabled.
--- drivers/soc/amlogic/meson-secure-pwrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/amlogic/meson-secure-pwrc.c +1 -1
@@ -105,7 +105,7 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {SEC_PD (ACODEC ,0 ),SEC_PD (AUDIO ,0 ),SEC_PD (OTP ,0 ), -SEC_PD (DMA ,0 ), +SEC_PD (DMA ,GENPD_FLAG_ALWAYS_ON |GENPD_FLAG_IRQ_SAFE ),SEC_PD (SD_EMMC ,0 ), SEC_PD(RAMA, 0),/* SRAMB is used as ATF runtime memory, and should be always on */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 329/431 ovl: update of dentry revalidate flags after copy up
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
[ Upstream commit b07d5cc93e1b28df47a72c519d09d0a836043613 ]
After copy up, we may need to update d_flags if upper dentry is on a remote fs and lower dentries are not.
Add helpers to allow incremental update of the revalidate flags.
--- fs/overlayfs/copy_up.c | 2 ++ fs/overlayfs/dir.c | 3 +-- fs/overlayfs/export.c | 3 +-- fs/overlayfs/namei.c | 3 +-- fs/overlayfs/overlayfs.h | 6 ++++-- fs/overlayfs/super.c | 2 +- fs/overlayfs/util.c | 24 ++++++++++++++++++++---- 7 files changed, 30 insertions(+), 13 deletions(-)
fs/overlayfs/copy_up.c +2 -0
@@ -576,6 +576,7 @@ static int ovl_link_up(struct ovl_copy_up_ctx *c)/* Restore timestamps on parent (best effort) */ ovl_set_timestamps (ofs, upperdir, &c->pstat);ovl_dentry_set_upper_alias (c->dentry); +ovl_dentry_update_reval (c->dentry, upper); } }inode_unlock (udir);
@@ -895,6 +896,7 @@ static int ovl_do_copy_up(struct ovl_copy_up_ctx *c)inode_unlock (udir);ovl_dentry_set_upper_alias (c->dentry); +ovl_dentry_update_reval (c->dentry,ovl_dentry_upper (c->dentry)); } out:
fs/overlayfs/dir.c +1 -2
@@ -269,8 +269,7 @@ static int ovl_instantiate(struct dentry *dentry, struct inode *inode,ovl_dir_modified (dentry->d_parent, false);ovl_dentry_set_upper_alias (dentry); -ovl_dentry_update_reval (dentry, newdentry, -DCACHE_OP_REVALIDATE |DCACHE_OP_WEAK_REVALIDATE ); +ovl_dentry_init_reval (dentry, newdentry);if (!hardlink) {/*
fs/overlayfs/export.c +1 -2
@@ -326,8 +326,7 @@ static struct dentry *ovl_obtain_alias(struct super_block *sb,if (upper_alias)ovl_dentry_set_upper_alias (dentry); -ovl_dentry_update_reval (dentry, upper, -DCACHE_OP_REVALIDATE |DCACHE_OP_WEAK_REVALIDATE ); +ovl_dentry_init_reval (dentry, upper);return d_instantiate_anon (dentry, inode);
fs/overlayfs/namei.c +1 -2
@@ -1122,8 +1122,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,ovl_set_flag (OVL_UPPERDATA , inode); } -ovl_dentry_update_reval (dentry, upperdentry, -DCACHE_OP_REVALIDATE |DCACHE_OP_WEAK_REVALIDATE ); +ovl_dentry_init_reval (dentry, upperdentry);revert_creds (old_cred);if (origin_path) {
fs/overlayfs/overlayfs.h +4 -2
@@ -375,8 +375,10 @@ bool ovl_index_all(struct super_block *sb);bool ovl_verify_lower (struct super_block *sb);struct ovl_entry *ovl_alloc_entry (unsigned int numlower);bool ovl_dentry_remote (struct dentry *dentry); -void ovl_dentry_update_reval (struct dentry *dentry,struct dentry *upperdentry, -unsigned int mask); +void ovl_dentry_update_reval (struct dentry *dentry,struct dentry *realdentry); +void ovl_dentry_init_reval (struct dentry *dentry,struct dentry *upperdentry); +void ovl_dentry_init_flags (struct dentry *dentry,struct dentry *upperdentry, +unsigned int mask);bool ovl_dentry_weird (struct dentry *dentry);enum ovl_path_type ovl_path_type (struct dentry *dentry);void ovl_path_upper (struct dentry *dentry,struct path *path);
fs/overlayfs/super.c +1 -1
@@ -1885,7 +1885,7 @@ static struct dentry *ovl_get_root(struct super_block *sb,ovl_dentry_set_flag (OVL_E_CONNECTED , root);ovl_set_upperdata (d_inode (root));ovl_inode_init (d_inode (root), &oip, ino, fsid); -ovl_dentry_update_reval (root, upperdentry,DCACHE_OP_WEAK_REVALIDATE ); +ovl_dentry_init_flags (root, upperdentry,DCACHE_OP_WEAK_REVALIDATE );return root; }
fs/overlayfs/util.c +20 -4
@@ -94,14 +94,30 @@ struct ovl_entry *ovl_alloc_entry(unsigned int numlower)return oe; } +#define OVL_D_REVALIDATE (DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE) +bool ovl_dentry_remote (struct dentry *dentry) { -return dentry->d_flags & - (DCACHE_OP_REVALIDATE |DCACHE_OP_WEAK_REVALIDATE ); +return dentry->d_flags &OVL_D_REVALIDATE ; +} + +void ovl_dentry_update_reval (struct dentry *dentry,struct dentry *realdentry) +{ +if (!ovl_dentry_remote (realdentry)) +return ; + +spin_lock (&dentry->d_lock); + dentry->d_flags |= realdentry->d_flags &OVL_D_REVALIDATE ; +spin_unlock (&dentry->d_lock); +} + +void ovl_dentry_init_reval (struct dentry *dentry,struct dentry *upperdentry) +{ +return ovl_dentry_init_flags (dentry, upperdentry,OVL_D_REVALIDATE ); } -void ovl_dentry_update_reval (struct dentry *dentry,struct dentry *upperdentry, -unsigned int mask) +void ovl_dentry_init_flags (struct dentry *dentry,struct dentry *upperdentry, +unsigned int mask) {struct ovl_entry *oe =OVL_E (dentry);unsigned int i, flags =0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 330/431 ASoC: imx-audmix: check return value of devm_kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 2f76e1d6ca524a888d29aafe29f2ad2003857971 ]
devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- sound/soc/fsl/imx-audmix.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/fsl/imx-audmix.c +9 -0
@@ -228,6 +228,8 @@ static int imx_audmix_probe(struct platform_device *pdev) dai_name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%s%s" , fe_name_pref, args.np->full_name +1 ); +if (!dai_name) +return -ENOMEM ;dev_info (pdev->dev.parent,"DAI FE name:%s\n" , dai_name);
@@ -236,6 +238,8 @@ static int imx_audmix_probe(struct platform_device *pdev) capture_dai_name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%s %s" , dai_name,"CPU-Capture" ); +if (!capture_dai_name) +return -ENOMEM ; } priv->dai[i].cpus = &dlc[0 ];
@@ -266,6 +270,8 @@ static int imx_audmix_probe(struct platform_device *pdev) "AUDMIX-Playback-%d", i); be_cp =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"AUDMIX-Capture-%d" , i); +if (!be_name || !be_pb || !be_cp) +return -ENOMEM ; priv->dai[num_dai + i].cpus = &dlc[3 ]; priv->dai[num_dai + i].codecs = &dlc[4 ];
@@ -293,6 +299,9 @@ static int imx_audmix_probe(struct platform_device *pdev) priv->dapm_routes[i].source =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%s %s" , dai_name,"CPU-Playback" ); +if (!priv->dapm_routes[i].source) +return -ENOMEM ; + priv->dapm_routes[i].sink = be_pb; priv->dapm_routes[num_dai + i].source = be_pb; priv->dapm_routes[num_dai + i].sink = be_cp;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 331/431 clk: Fix memory leak in devm_clk_notifier_register()
In reply to Greg Kroah-HartmanFrom: Fei Shao <[email protected]>
[ Upstream commit 7fb933e56f77a57ef7cfc59fc34cbbf1b1fa31ff ]
devm_clk_notifier_register() allocates a devres resource for clk notifier but didn't register that to the device, so the notifier didn't get unregistered on device detach and the allocated resource was leaked.
Fix the issue by registering the resource through devres_add().
This issue was found with kmemleak on a Chromebook.
--- drivers/clk/clk.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk.c +1 -0
@@ -4694,6 +4694,7 @@ int devm_clk_notifier_register(struct device *dev, struct clk *clk,if (!ret) { devres->clk = clk; devres->nb = nb; +devres_add (dev, devres); }else {devres_free (devres); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 332/431 ARM: dts: lan966x: kontron-d10: fix board reset
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit bfcd5714f6424c03e385e0e9296dcd69855cfea7 ]
The pinctrl node was missing which change the pin mux to GPIO mode. Add it.
--- arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt.dtsi +8 -0
@@ -18,6 +18,8 @@ chosen { gpio-restart { compatible = "gpio-restart"; + pinctrl-0 = <&reset_pins>; + pinctrl-names = "default"; gpios = <&gpio 56 GPIO_ACTIVE_LOW>; priority = <200>; };
@@ -59,6 +61,12 @@ miim_c_pins: miim-c-pins { function = "miim_c"; }; + reset_pins: reset-pins { + /* SYS_RST# */ + pins = "GPIO_56"; + function = "gpio"; + }; + sgpio_a_pins: sgpio-a-pins { /* SCK, D0, D1 */ pins = "GPIO_32", "GPIO_33", "GPIO_34";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 333/431 ARM: dts: lan966x: kontron-d10: fix SPI CS
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit fcb79ee3f0b15ed15f35eca5f24e952fdced9c61 ]
The pinctrl node was missing which change the pin mux to GPIO mode. Add it so we don't have to rely on the bootloader to set the correct mode.
--- arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt.dtsi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt.dtsi +7 -1
@@ -41,7 +41,7 @@ &flx3 { status = "okay"; spi3: spi@400 { - pinctrl-0 = <&fc3_b_pins>; + pinctrl-0 = <&fc3_b_pins>, <&spi3_cs_pins>; pinctrl-names = "default"; status = "okay"; cs-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
@@ -79,6 +79,12 @@ sgpio_b_pins: sgpio-b-pins { function = "sgpio_b"; }; + spi3_cs_pins: spi3-cs-pins { + /* CS# */ + pins = "GPIO_46"; + function = "gpio"; + }; + usart0_pins: usart0-pins { /* RXD, TXD */ pins = "GPIO_25", "GPIO_26";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 334/431 ASoC: amd: acp: clear pdm dma interrupt mask
In reply to Greg Kroah-HartmanFrom: Syed Saba Kareem <[email protected]>
[ Upstream commit ad60672394bd1f95c58d3d9336902f47e05126fc ]
Clear pdm dma interrupt mask in acp_dmic_shutdown().
'Fixes: c32bd332ce5c9 ("ASoC: amd: acp: Add generic support for PDM controller on ACP")'
--- sound/soc/amd/acp/acp-pdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp/acp-pdm.c +1 -1
@@ -176,7 +176,7 @@ static void acp_dmic_dai_shutdown(struct snd_pcm_substream *substream,/* Disable DMIC interrupts */ ext_int_ctrl =readl (ACP_EXTERNAL_INTR_CNTL (adata,0 )); - ext_int_ctrl |= ~PDM_DMA_INTR_MASK ; + ext_int_ctrl &= ~PDM_DMA_INTR_MASK ;writel (ext_int_ctrl,ACP_EXTERNAL_INTR_CNTL (adata,0 )); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 335/431 MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit fbf1e42093f8d6346baf17079585fbcebb2ff284 ]
Provide parent regulators to the ACT8600 regulators that need one.
Stable-dep-of: 944520f85d5b ("MIPS: DTS: CI20: Raise VDDCORE voltage to 1.125 volts")
--- arch/mips/boot/dts/ingenic/ci20.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/mips/boot/dts/ingenic/ci20.dts +7 -0
@@ -242,16 +242,19 @@ regulators { vddcore: DCDC1 { regulator-min-microvolt = <1100000>; regulator-max-microvolt = <1100000>; + vp1-supply = <&vcc_33v>; regulator-always-on; }; vddmem: DCDC2 { regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; + vp2-supply = <&vcc_33v>; regulator-always-on; }; vcc_33: DCDC3 { regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; + vp3-supply = <&vcc_33v>; regulator-always-on; }; vcc_50: SUDCDC_REG4 {
@@ -262,21 +265,25 @@ vcc_50: SUDCDC_REG4 { vcc_25: LDO5 { regulator-min-microvolt = <2500000>; regulator-max-microvolt = <2500000>; + inl-supply = <&vcc_33v>; regulator-always-on; }; wifi_io: LDO6 { regulator-min-microvolt = <2500000>; regulator-max-microvolt = <2500000>; + inl-supply = <&vcc_33v>; regulator-always-on; }; cim_io_28: LDO7 { regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; + inl-supply = <&vcc_33v>; regulator-always-on; }; cim_io_15: LDO8 { regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; + inl-supply = <&vcc_33v>; regulator-always-on; }; vrtc_18: LDO_REG9 {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 336/431 MIPS: DTS: CI20: Raise VDDCORE voltage to 1.125 volts
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 944520f85d5b1fb2f9ea243be41f9c9af3d4cef3 ]
Commit 08384e80a70f ("MIPS: DTS: CI20: Fix ACT8600 regulator node names") caused the VDDCORE power supply (regulated by the ACT8600's DCDC1 output) to drop from a voltage of 1.2V configured by the bootloader, to the 1.1V set in the Device Tree.
According to the documentation, the VDDCORE supply should be between 0.99V and 1.21V; both values are therefore within the supported range.
However, VDDCORE being 1.1V results in the CI20 being very unstable, with corrupted memory, failures to boot, or reboots at random. The reason might be succint drops of the voltage below the minimum required.
Raising the minimum voltage to 1.125 volts seems to be enough to address this issue, while still keeping a relatively low core voltage which helps for power consumption and thermals.
--- arch/mips/boot/dts/ingenic/ci20.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +2 -2
@@ -240,8 +240,8 @@ act8600: act8600@5a { regulators { vddcore: DCDC1 { - regulator-min-microvolt = <1100000>; - regulator-max-microvolt = <1100000>; + regulator-min-microvolt = <1125000>; + regulator-max-microvolt = <1125000>; vp1-supply = <&vcc_33v>; regulator-always-on; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 337/431 iommufd: Do not access the area pointer after unlocking
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 804ca14d04df09bf7924bacc5ad22a4bed80c94f ]
A concurrent unmap can trigger freeing of the area pointers while we are generating an unmapping notification for accesses.
syzkaller reports:
BUG: KASAN: slab-use-after-free in iopt_unmap_iova_range+0x5ba/0x5f0 Read of size 4 at addr ffff888075996184 by task syz-executor.2/31160 CPU: 1 PID: 31160 Comm: syz-executor.2 Not tainted 6.4.0-rc5-syzkaller-00313-g4c605260bc60 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Call Trace: <TASK> dump_stack_lvl+0xd9/0x150 print_address_description.constprop.0+0x2c/0x3c0 kasan_report+0x11c/0x130 iopt_unmap_iova_range+0x5ba/0x5f0 iopt_unmap_all+0x27/0x50 iommufd_ioas_unmap+0x3d0/0x490 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0812c8c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0813914168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f0812dabf80 RCX: 00007f0812c8c169 RDX: 0000000020000100 RSI: 0000000000003b86 RDI: 0000000000000005 RBP: 00007f0812ce7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f0812ecfb1f R14: 00007f0813914300 R15: 0000000000022000 </TASK> Allocated by task 31160: kasan_save_stack+0x22/0x40 kasan_set_track+0x25/0x30 __kasan_kmalloc+0xa2/0xb0 iopt_alloc_area_pages+0x94/0x560 iopt_map_user_pages+0x205/0x4e0 iommufd_ioas_map+0x329/0x5f0 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 31161: kasan_save_stack+0x22/0x40 kasan_set_track+0x25/0x30 kasan_save_free_info+0x2e/0x40 ____kasan_slab_free+0x160/0x1c0 slab_free_freelist_hook+0x8b/0x1c0 __kmem_cache_free+0xaf/0x2d0 iopt_unmap_iova_range+0x288/0x5f0 iopt_unmap_all+0x27/0x50 iommufd_ioas_unmap+0x3d0/0x490 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888075996100 which belongs to the cache kmalloc-cg-192 of size 192 The buggy address is located 132 bytes inside of freed 192-byte region [ffff888075996100, ffff8880759961c0) The buggy address belongs to the physical page: page:ffffea0001d66580 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x75996 memcg:ffff88801f1c2701 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000200 ffff88801244ddc0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080100010 00000001ffffffff ffff88801f1c2701 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 31157, tgid 31154 (syz-executor.0), ts 1984547323469, free_ts 1983933451331 post_alloc_hook+0x2db/0x350 get_page_from_freelist+0xf41/0x2c00 __alloc_pages+0x1cb/0x4a0 alloc_pages+0x1aa/0x270 allocate_slab+0x25f/0x390 ___slab_alloc+0xa91/0x1400 __slab_alloc.constprop.0+0x56/0xa0 __kmem_cache_alloc_node+0x136/0x320 kmalloc_trace+0x26/0xe0 iommufd_test+0x1328/0x2c20 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: free_unref_page_prepare+0x62e/0xcb0 free_unref_page_list+0xe3/0xa70 release_pages+0xcd8/0x1380 tlb_batch_pages_flush+0xa8/0x1a0 tlb_finish_mmu+0x14b/0x7e0 exit_mmap+0x2b2/0x930 __mmput+0x128/0x4c0 mmput+0x60/0x70 do_exit+0x9b0/0x29b0 do_group_exit+0xd4/0x2a0 get_signal+0x2318/0x25b0 arch_do_signal_or_restart+0x79/0x5c0 exit_to_user_mode_prepare+0x11f/0x240 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x46/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Precompute what is needed to call the access function and do not check the area's num_accesses again as the pointer may not be valid anymore. Use a counter instead.
--- drivers/iommu/iommufd/io_pagetable.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/iommu/iommufd/io_pagetable.c +11 -3
@@ -458,6 +458,7 @@ static int iopt_unmap_iova_range(struct io_pagetable *iopt, unsigned long start, {struct iopt_area *area;unsigned long unmapped_bytes =0 ; +unsigned int tries =0 ;int rc = -ENOENT ;/*
@@ -484,19 +485,26 @@ static int iopt_unmap_iova_range(struct io_pagetable *iopt, unsigned long start, goto out_unlock_iova; } +if (area_first != start) + tries =0 ; +/* * num_accesses writers must hold the iova_rwsem too, so we can * safely read it under the write side of the iovam_rwsem * without the pages->mutex. */ if (area->num_accesses) { +size_t length =iopt_area_length (area); + start = area_first; area->prevent_access = true;up_write (&iopt->iova_rwsem);up_read (&iopt->domains_rwsem); -iommufd_access_notify_unmap (iopt, area_first, -iopt_area_length (area)); -if (WARN_ON (READ_ONCE (area->num_accesses))) + +iommufd_access_notify_unmap (iopt, area_first, length); +/* Something is not responding to unmap requests. */ + tries++; +if (WARN_ON (tries >100 ))return -EDEADLOCK ; goto again; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 338/431 iommufd: Call iopt_area_contig_done() under the lock
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit dbe245cdf5189e88d680379ed13901356628b650 ]
The iter internally holds a pointer to the area and iopt_area_contig_done() will dereference it. The pointer is not valid outside the iova_rwsem.
syzkaller reports:
BUG: KASAN: slab-use-after-free in iommufd_access_unpin_pages+0x363/0x370 Read of size 8 at addr ffff888022286e20 by task syz-executor669/5771 CPU: 0 PID: 5771 Comm: syz-executor669 Not tainted 6.4.0-rc5-syzkaller-00313-g4c605260bc60 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Call Trace: <TASK> dump_stack_lvl+0xd9/0x150 print_address_description.constprop.0+0x2c/0x3c0 kasan_report+0x11c/0x130 iommufd_access_unpin_pages+0x363/0x370 iommufd_test_access_unmap+0x24b/0x390 iommufd_access_notify_unmap+0x24c/0x3a0 iopt_unmap_iova_range+0x4c4/0x5f0 iopt_unmap_all+0x27/0x50 iommufd_ioas_unmap+0x3d0/0x490 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fec1dae3b19 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fec1da74308 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fec1db6b438 RCX: 00007fec1dae3b19 RDX: 0000000020000100 RSI: 0000000000003b86 RDI: 0000000000000003 RBP: 00007fec1db6b430 R08: 00007fec1da74700 R09: 0000000000000000 R10: 00007fec1da74700 R11: 0000000000000246 R12: 00007fec1db6b43c R13: 00007fec1db39074 R14: 6d6f692f7665642f R15: 0000000000022000 </TASK> Allocated by task 5770: kasan_save_stack+0x22/0x40 kasan_set_track+0x25/0x30 __kasan_kmalloc+0xa2/0xb0 iopt_alloc_area_pages+0x94/0x560 iopt_map_user_pages+0x205/0x4e0 iommufd_ioas_map+0x329/0x5f0 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5770: kasan_save_stack+0x22/0x40 kasan_set_track+0x25/0x30 kasan_save_free_info+0x2e/0x40 ____kasan_slab_free+0x160/0x1c0 slab_free_freelist_hook+0x8b/0x1c0 __kmem_cache_free+0xaf/0x2d0 iopt_unmap_iova_range+0x288/0x5f0 iopt_unmap_all+0x27/0x50 iommufd_ioas_unmap+0x3d0/0x490 iommufd_fops_ioctl+0x317/0x4b0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The parallel unmap free'd iter->area the instant the lock was released.
--- drivers/iommu/iommufd/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommufd/device.c +1 -1
@@ -560,8 +560,8 @@ void iommufd_access_unpin_pages(struct iommufd_access *access,iopt_area_iova_to_index ( area, min(last_iova, iopt_area_last_iova(area)))); -up_read (&iopt->iova_rwsem);WARN_ON (!iopt_area_contig_done (&iter)); +up_read (&iopt->iova_rwsem); }EXPORT_SYMBOL_NS_GPL (iommufd_access_unpin_pages,IOMMUFD );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 339/431 PCI: cadence: Fix Gen2 Link Retraining process
In reply to Greg Kroah-HartmanFrom: Siddharth Vadapalli <[email protected]>
[ Upstream commit 0e12f830236928b6fadf40d917a7527f0a048d2f ]
The Link Retraining process is initiated to account for the Gen2 defect in the Cadence PCIe controller in J721E SoC. The errata corresponding to this is i2085, documented at:
https://www.ti.com/lit/er/sprz455c/sprz455c.pdf
The existing workaround implemented for the errata waits for the Data Link initialization to complete and assumes that the link retraining process at the Physical Layer has completed. However, it is possible that the Physical Layer training might be ongoing as indicated by the PCI_EXP_LNKSTA_LT bit in the PCI_EXP_LNKSTA register.
Fix the existing workaround, to ensure that the Physical Layer training has also completed, in addition to the Data Link initialization.
--- .../controller/cadence/pcie-cadence-host.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/pci/controller/cadence/pcie-cadence-host.c +27 -0
@@ -12,6 +12,8 @@#include "pcie-cadence.h" +#define LINK_RETRAIN_TIMEOUT HZ +static u64 bar_max_size[] = { [RP_BAR0 ] =_ULL (128 *SZ_2G ), [RP_BAR1 ] =SZ_2G ,
@@ -77,6 +79,27 @@ static struct pci_ops cdns_pcie_host_ops = { .write = pci_generic_config_write, }; +static int cdns_pcie_host_training_complete (struct cdns_pcie *pcie) +{ +u32 pcie_cap_off =CDNS_PCIE_RP_CAP_OFFSET ; +unsigned long end_jiffies; +u16 lnk_stat; + +/* Wait for link training to complete. Exit after timeout. */ + end_jiffies = jiffies +LINK_RETRAIN_TIMEOUT ; +do { + lnk_stat =cdns_pcie_rp_readw (pcie, pcie_cap_off +PCI_EXP_LNKSTA ); +if (!(lnk_stat &PCI_EXP_LNKSTA_LT )) +break ; +usleep_range (0 ,1000 ); + }while (time_before (jiffies, end_jiffies)); + +if (!(lnk_stat &PCI_EXP_LNKSTA_LT )) +return 0 ; + +return -ETIMEDOUT ; +} +static int cdns_pcie_host_wait_for_link (struct cdns_pcie *pcie) {struct device *dev = pcie->dev;
@@ -118,6 +141,10 @@ static int cdns_pcie_retrain(struct cdns_pcie *pcie)cdns_pcie_rp_writew (pcie, pcie_cap_off +PCI_EXP_LNKCTL , lnk_ctl); + ret =cdns_pcie_host_training_complete (pcie); +if (ret) +return ret; + ret =cdns_pcie_host_wait_for_link (pcie); }return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 340/431 PCI: vmd: Reset VMD config register between soft reboots
In reply to Greg Kroah-HartmanFrom: Nirmal Patel <[email protected]>
[ Upstream commit b61cf04c49c3dfa70a0d6725d3eb40bf9b35cf71 ]
VMD driver can disable or enable MSI remapping by changing VMCONFIG_MSI_REMAP register. This register needs to be set to the default value during soft reboots. Drives failed to enumerate when Windows boots after performing a soft reboot from Linux. Windows doesn't support MSI remapping disable feature and stale register value hinders Windows VMD driver initialization process. Adding vmd_shutdown function to make sure to set the VMCONFIG register to the default value.
--- drivers/pci/controller/vmd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pci/controller/vmd.c +8 -0
@@ -1036,6 +1036,13 @@ static void vmd_remove(struct pci_dev *dev)ida_simple_remove (&vmd_instance_ida, vmd->instance); } +static void vmd_shutdown (struct pci_dev *dev) +{ +struct vmd_dev *vmd =pci_get_drvdata (dev); + +vmd_remove_irq_domain (vmd); +} +#ifdef CONFIG_PM_SLEEP static int vmd_suspend (struct device *dev) {
@@ -1101,6 +1108,7 @@ static struct pci_driver vmd_drv = { .id_table = vmd_ids, .probe = vmd_probe, .remove = vmd_remove, + .shutdown = vmd_shutdown, .driver = { .pm = &vmd_dev_pm_ops, },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 341/431 scsi: qedf: Fix NULL dereference in error handling
In reply to Greg Kroah-HartmanFrom: Jinhong Zhu <[email protected]>
[ Upstream commit f025312b089474a54e4859f3453771314d9e3d4f ]
Smatch reported:
drivers/scsi/qedf/qedf_main.c:3056 qedf_alloc_global_queues()
warn: missing unwind goto?
At this point in the function, nothing has been allocated so we can return directly. In particular the "qedf->global_queues" have not been allocated so calling qedf_free_global_queues() will lead to a NULL dereference when we check if (!gl[i]) and "gl" is NULL.
--- drivers/scsi/qedf/qedf_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qedf/qedf_main.c +1 -2
@@ -3043,9 +3043,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)* addresses of our queues */ if (!qedf->p_cpuq) { - status = -EINVAL ;QEDF_ERR (&qedf->dbg_ctx,"p_cpuq is NULL.\n" ); - goto mem_alloc_failure; +return -EINVAL ; } qedf->global_queues = kzalloc((sizeof(struct global_queue *)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 342/431 pinctrl: bcm2835: Handle gpiochip_add_pin_range() errors
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit cdf7e616120065007687fe1df0412154f259daec ]
gpiochip_add_pin_range() can fail, so better return its error code than a hard coded '0'.
--- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pinctrl/bcm/pinctrl-bcm2835.c +2 -4
@@ -376,10 +376,8 @@ static int bcm2835_add_pin_ranges_fallback(struct gpio_chip *gc)if (!pctldev)return 0 ; -gpiochip_add_pin_range (gc,pinctrl_dev_get_devname (pctldev),0 ,0 , - gc->ngpio); - -return 0 ; +return gpiochip_add_pin_range (gc,pinctrl_dev_get_devname (pctldev),0 ,0 , + gc->ngpio); }static const struct gpio_chip bcm2835_gpio_chip = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 343/431 platform/x86: lenovo-yogabook: Fix work race on remove()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9148cd2eb4450a8e9c49c8a14201fb82f651128f ]
When yogabook_wmi_remove() runs yogabook_wmi_work might still be running and using the devices which yogabook_wmi_remove() puts.
To avoid this move to explicitly cancelling the work rather then using devm_work_autocancel().
This requires also making the yogabook_backside_hall_irq handler non devm managed, so that it cannot re-queue the work while yogabook_wmi_remove() runs.
--- drivers/platform/x86/lenovo-yogabook-wmi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/platform/x86/lenovo-yogabook-wmi.c +10 -10
@@ -2,7 +2,6 @@/* WMI driver for Lenovo Yoga Book YB1-X90* / -X91* tablets */ #include <linux/acpi.h> -#include <linux/devm-helpers.h> #include <linux/gpio/consumer.h> #include <linux/gpio/machine.h> #include <linux/interrupt.h>
@@ -248,10 +247,7 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context) data->brightness =YB_KBD_BL_DEFAULT ;set_bit (YB_KBD_IS_ON , &data->flags);set_bit (YB_DIGITIZER_IS_ON , &data->flags); - - r =devm_work_autocancel (&wdev->dev, &data->work, yogabook_wmi_work); -if (r) -return r; +INIT_WORK (&data->work, yogabook_wmi_work); data->kbd_adev =acpi_dev_get_first_match_dev ("GDIX1001" ,NULL ,-1 );if (!data->kbd_adev) {
@@ -299,10 +295,9 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context) } data->backside_hall_irq = r; - r =devm_request_irq (&wdev->dev, data->backside_hall_irq, - yogabook_backside_hall_irq, -IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , -"backside_hall_sw" , data); + r =request_irq (data->backside_hall_irq, yogabook_backside_hall_irq, +IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , +"backside_hall_sw" , data);if (r) {dev_err_probe (&wdev->dev, r,"Requesting backside_hall_sw IRQ\n" ); goto error_put_devs;
@@ -318,11 +313,14 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context) r =devm_led_classdev_register (&wdev->dev, &data->kbd_bl_led);if (r <0 ) {dev_err_probe (&wdev->dev, r,"Registering backlight LED device\n" ); - goto error_put_devs; + goto error_free_irq; }return 0 ; +error_free_irq: +free_irq (data->backside_hall_irq, data); +cancel_work_sync (&data->work); error_put_devs:put_device (data->dig_dev);put_device (data->kbd_dev);
@@ -335,6 +333,8 @@ static void yogabook_wmi_remove(struct wmi_device *wdev) {struct yogabook_wmi *data =dev_get_drvdata (&wdev->dev); +free_irq (data->backside_hall_irq, data); +cancel_work_sync (&data->work);put_device (data->dig_dev);put_device (data->kbd_dev);acpi_dev_put (data->dig_adev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 344/431 platform/x86: lenovo-yogabook: Reprobe devices on remove()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 711bcc0cb34e96a60e88d7b0260862781de3e530 ]
Ensure that both the keyboard touchscreen and the digitizer have their driver bound after remove(). Without this modprobing lenovo-yogabook-wmi after a rmmod fails because lenovo-yogabook-wmi defers probing until both devices have their driver bound.
--- drivers/platform/x86/lenovo-yogabook-wmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/platform/x86/lenovo-yogabook-wmi.c +11 -0
@@ -332,9 +332,20 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context)static void yogabook_wmi_remove (struct wmi_device *wdev) {struct yogabook_wmi *data =dev_get_drvdata (&wdev->dev); +int r =0 ;free_irq (data->backside_hall_irq, data);cancel_work_sync (&data->work); + +if (!test_bit (YB_KBD_IS_ON , &data->flags)) + r |=device_reprobe (data->kbd_dev); + +if (!test_bit (YB_DIGITIZER_IS_ON , &data->flags)) + r |=device_reprobe (data->dig_dev); + +if (r) +dev_warn (&wdev->dev,"Reprobe of devices failed\n" ); +put_device (data->dig_dev);put_device (data->kbd_dev);acpi_dev_put (data->dig_adev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 345/431 platform/x86: lenovo-yogabook: Set default keyboard backligh brightness on probe()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9e6380d6573181c555ca1b5019b08d19a9ee581c ]
Set default keyboard backlight brightness on probe(), this fixes the backlight being off after a rmmod + modprobe.
--- drivers/platform/x86/lenovo-yogabook-wmi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/lenovo-yogabook-wmi.c +3 -0
@@ -295,6 +295,9 @@ static int yogabook_wmi_probe(struct wmi_device *wdev, const void *context) } data->backside_hall_irq = r; +/* Set default brightness before enabling the IRQ */ +yogabook_wmi_set_kbd_backlight (data->wdev,YB_KBD_BL_DEFAULT ); + r =request_irq (data->backside_hall_irq, yogabook_backside_hall_irq,IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING ,"backside_hall_sw" , data);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 346/431 PCI/ASPM: Disable ASPM on MFD function removal to avoid use-after-free
In reply to Greg Kroah-HartmanFrom: Ding Hui <[email protected]>
[ Upstream commit 456d8aa37d0f56fc9e985e812496e861dcd6f2f2 ]
Struct pcie_link_state->downstream is a pointer to the pci_dev of function
0. Previously we retained that pointer when removing function 0, and subsequent ASPM policy changes dereferenced it, resulting in a use-after-free warning from KASAN, e.g.:
# echo 1 > /sys/bus/pci/devices/0000:03:00.0/remove # echo powersave > /sys/module/pcie_aspm/parameters/policy
BUG: KASAN: slab-use-after-free in pcie_config_aspm_link+0x42d/0x500 Call Trace: kasan_report+0xae/0xe0 pcie_config_aspm_link+0x42d/0x500 pcie_aspm_set_policy+0x8e/0x1a0 param_attr_store+0x162/0x2c0 module_attr_store+0x3e/0x80
PCIe spec r6.0, sec 7.5.3.7, recommends that software program the same ASPM Control value in all functions of multi-function devices.
Disable ASPM and free the pcie_link_state when any child function is removed so we can discard the dangling pcie_link_state->downstream pointer and maintain the same ASPM Control configuration for all functions.
--- drivers/pci/pcie/aspm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/pci/pcie/aspm.c +12 -9
@@ -1010,21 +1010,24 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)down_read (&pci_bus_sem);mutex_lock (&aspm_lock); -/* -* All PCIe functions are in one slot, remove one function will remove -* the whole slot, so just wait until we are the last function left. -*/ -if (!list_empty (&parent->subordinate->devices)) - goto out; link = parent->link_state; root = link->root; parent_link = link->parent; -/* All functions are removed, so just disable ASPM for the link */ +/* +* link->downstream is a pointer to the pci_dev of function 0. If +* we remove that function, the pci_dev is about to be deallocated, +* so we can't use link->downstream again. Free the link state to +* avoid this. +* +* If we're removing a non-0 function, it's possible we could +* retain the link state, but PCIe r6.0, sec 7.5.3.7, recommends +* programming the same ASPM Control value for all functions of +* multi-function devices, so disable ASPM for all of them. +*/ pcie_config_aspm_link (link,0 );list_del (&link->sibling); -/* Clock PM is for endpoint device */ free_link_state (link);/* Recheck latencies and configure upstream links */
@@ -1032,7 +1035,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)pcie_update_aspm_capable (root);pcie_config_aspm_path (parent_link); } -out: +mutex_unlock (&aspm_lock);up_read (&pci_bus_sem); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 347/431 scsi: 3w-xxxx: Add error handling for initialization failure in tw_probe()
In reply to Greg Kroah-HartmanFrom: Yuchen Yang <[email protected]>
[ Upstream commit 2e2fe5ac695a00ab03cab4db1f4d6be07168ed9d ]
Smatch complains that:
tw_probe() warn: missing error code 'retval'
This patch adds error checking to tw_probe() to handle initialization failure. If tw_reset_sequence() function returns a non-zero value, the function will return -EINVAL to indicate initialization failure.
--- drivers/scsi/3w-xxxx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/3w-xxxx.c +3 -1
@@ -2305,8 +2305,10 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)TW_DISABLE_INTERRUPTS (tw_dev);/* Initialize the card */ -if (tw_reset_sequence (tw_dev)) +if (tw_reset_sequence (tw_dev)) { + retval = -EINVAL ; goto out_release_mem_region; + }/* Set host specific parameters */ host->max_id =TW_MAX_UNITS ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 348/431 pinctrl: at91: Dont mix non-devm calls with devm ones
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 415a099ea55ae716b69beefdcaa654b96087c016 ]
Replace devm_clk_get() by devm_clk_get_enabled() and drop unneeded code pieces. This will make sure we keep the ordering of the resource allocation correct.
Stable-dep-of: 35216718c9ac ("pinctrl: at91: fix a couple NULL vs IS_ERR() checks")
--- drivers/pinctrl/pinctrl-at91.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/pinctrl/pinctrl-at91.c +2 -10
@@ -1849,19 +1849,13 @@ static int at91_gpio_probe(struct platform_device *pdev) at91_chip->pioc_virq = irq; at91_chip->pioc_idx = alias_idx; - at91_chip->clock =devm_clk_get (&pdev->dev,NULL ); + at91_chip->clock =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (at91_chip->clock)) {dev_err (&pdev->dev,"failed to get clock, ignoring.\n" ); ret =PTR_ERR (at91_chip->clock); goto err; } - ret =clk_prepare_enable (at91_chip->clock); -if (ret) { -dev_err (&pdev->dev,"failed to prepare and enable clock, ignoring.\n" ); - goto clk_enable_err; - } - at91_chip->chip = at91_gpio_template; at91_chip->id = alias_idx;
@@ -1882,7 +1876,7 @@ static int at91_gpio_probe(struct platform_device *pdev) names =devm_kasprintf_strarray (dev,"pio" , chip->ngpio);if (!names) { ret = -ENOMEM ; - goto clk_enable_err; + goto err; }for (i =0 ; i < chip->ngpio; i++)
@@ -1915,8 +1909,6 @@ static int at91_gpio_probe(struct platform_device *pdev)return 0 ; gpiochip_add_err: -clk_enable_err: -clk_disable_unprepare (at91_chip->clock); err:dev_err (&pdev->dev,"Failure %i for GPIO %i\n" , ret, alias_idx);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 349/431 pinctrl: at91: Use dev_err_probe() instead of custom messaging
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 472bbb2cfd6384fe4c4b956af2170c1225fe2a92 ]
The custom message has no value except printing the error code, the same does dev_err_probe(). Let's use the latter for the sake of unification.
Note that some APIs already have messaging in them and some simply do not require the current noise.
Stable-dep-of: 35216718c9ac ("pinctrl: at91: fix a couple NULL vs IS_ERR() checks")
--- drivers/pinctrl/pinctrl-at91.c | 64 +++++++++++----------------------- 1 file changed, 21 insertions(+), 43 deletions(-)
drivers/pinctrl/pinctrl-at91.c +21 -43
@@ -1294,10 +1294,11 @@ static const struct of_device_id at91_pinctrl_of_match[] = {static int at91_pinctrl_probe_dt (struct platform_device *pdev,struct at91_pinctrl *info) { +struct device *dev = &pdev->dev;int ret =0 ;int i, j, ngpio_chips_enabled =0 ;uint32_t *tmp; -struct device_node *np = pdev->dev.of_node; +struct device_node *np = dev->of_node;struct device_node *child;if (!np)
@@ -1361,9 +1362,8 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev,continue ; ret =at91_pinctrl_parse_functions (child, info, i++);if (ret) { -dev_err (&pdev->dev,"failed to parse function\n" );of_node_put (child); -return ret; +return dev_err_probe (dev, ret,"failed to parse function\n" ); } }
@@ -1416,11 +1416,8 @@ static int at91_pinctrl_probe(struct platform_device *pdev)platform_set_drvdata (pdev, info); info->pctl =devm_pinctrl_register (&pdev->dev, &at91_pinctrl_desc, info); - -if (IS_ERR (info->pctl)) { -dev_err (&pdev->dev,"could not register AT91 pinctrl driver\n" ); -return PTR_ERR (info->pctl); - } +if (IS_ERR (info->pctl)) +return dev_err_probe (dev,PTR_ERR (info->pctl),"could not register AT91 pinctrl driver\n" );/* We will handle a range of GPIO pins */ for (i =0 ; i < gpio_banks; i++)
@@ -1821,28 +1818,20 @@ static int at91_gpio_probe(struct platform_device *pdev)char **names;BUG_ON (alias_idx >=ARRAY_SIZE (gpio_chips)); -if (gpio_chips[alias_idx]) { - ret = -EBUSY ; - goto err; - } +if (gpio_chips[alias_idx]) +return dev_err_probe (dev, -EBUSY ,"%d slot is occupied.\n" , alias_idx); irq =platform_get_irq (pdev,0 ); -if (irq <0 ) { - ret = irq; - goto err; - } +if (irq <0 ) +return irq; at91_chip =devm_kzalloc (&pdev->dev,sizeof (*at91_chip),GFP_KERNEL ); -if (!at91_chip) { - ret = -ENOMEM ; - goto err; - } +if (!at91_chip) +return -ENOMEM ; at91_chip->regbase =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (at91_chip->regbase)) { - ret =PTR_ERR (at91_chip->regbase); - goto err; - } +if (IS_ERR (at91_chip->regbase)) +return PTR_ERR (at91_chip->regbase); at91_chip->ops = (const struct at91_pinctrl_mux_ops *)of_match_device (at91_gpio_of_match, &pdev->dev)->data;
@@ -1850,11 +1839,8 @@ static int at91_gpio_probe(struct platform_device *pdev) at91_chip->pioc_idx = alias_idx; at91_chip->clock =devm_clk_get_enabled (&pdev->dev,NULL ); -if (IS_ERR (at91_chip->clock)) { -dev_err (&pdev->dev,"failed to get clock, ignoring.\n" ); - ret =PTR_ERR (at91_chip->clock); - goto err; - } +if (IS_ERR (at91_chip->clock)) +return dev_err_probe (dev,PTR_ERR (at91_chip->clock),"failed to get clock, ignoring.\n" ); at91_chip->chip = at91_gpio_template; at91_chip->id = alias_idx;
@@ -1867,17 +1853,15 @@ static int at91_gpio_probe(struct platform_device *pdev)if (!of_property_read_u32 (np,"#gpio-lines" , &ngpio)) {if (ngpio >=MAX_NB_GPIO_PER_BANK ) -pr_err ("at91_gpio.%d, gpio-nb >= %d failback to %d\n" , - alias_idx,MAX_NB_GPIO_PER_BANK ,MAX_NB_GPIO_PER_BANK ); +dev_err (dev,"at91_gpio.%d, gpio-nb >= %d failback to %d\n" , + alias_idx,MAX_NB_GPIO_PER_BANK ,MAX_NB_GPIO_PER_BANK );else chip->ngpio = ngpio; } names =devm_kasprintf_strarray (dev,"pio" , chip->ngpio); -if (!names) { - ret = -ENOMEM ; - goto err; - } +if (!names) +return -ENOMEM ;for (i =0 ; i < chip->ngpio; i++)strreplace (names[i],'-' , alias_idx +'A' );
@@ -1894,11 +1878,11 @@ static int at91_gpio_probe(struct platform_device *pdev) ret =at91_gpio_of_irq_setup (pdev, at91_chip);if (ret) - goto gpiochip_add_err; +return ret; ret =gpiochip_add_data (chip, at91_chip);if (ret) - goto gpiochip_add_err; +return ret; gpio_chips[alias_idx] = at91_chip;platform_set_drvdata (pdev, at91_chip);
@@ -1907,12 +1891,6 @@ static int at91_gpio_probe(struct platform_device *pdev)dev_info (&pdev->dev,"at address %p\n" , at91_chip->regbase);return 0 ; - -gpiochip_add_err: -err: -dev_err (&pdev->dev,"Failure %i for GPIO %i\n" , ret, alias_idx); - -return ret; }static const struct dev_pm_ops at91_gpio_pm_ops = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 350/431 pinctrl: at91: fix a couple NULL vs IS_ERR() checks
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 35216718c9ac2aef934ea9cd229572d4996807b2 ]
The devm_kasprintf_strarray() function doesn't return NULL on error, it returns error pointers. Update the checks accordingly.
--- drivers/pinctrl/pinctrl-at91.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-at91.c +4 -4
@@ -1399,8 +1399,8 @@ static int at91_pinctrl_probe(struct platform_device *pdev)char **names; names =devm_kasprintf_strarray (dev,"pio" ,MAX_NB_GPIO_PER_BANK ); -if (!names) -return -ENOMEM ; +if (IS_ERR (names)) +return PTR_ERR (names);for (j =0 ; j <MAX_NB_GPIO_PER_BANK ; j++, k++) {char *name = names[j];
@@ -1860,8 +1860,8 @@ static int at91_gpio_probe(struct platform_device *pdev) } names =devm_kasprintf_strarray (dev,"pio" , chip->ngpio); -if (!names) -return -ENOMEM ; +if (IS_ERR (names)) +return PTR_ERR (names);for (i =0 ; i < chip->ngpio; i++)strreplace (names[i],'-' , alias_idx +'A' );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 351/431 PCI: pciehp: Cancel bringup sequence if card is not present
In reply to Greg Kroah-HartmanFrom: Rongguang Wei <[email protected]>
[ Upstream commit e8afd0d9fccc27c8ad263db5cf5952cfcf72d6fe ]
If a PCIe hotplug slot has an Attention Button, the normal hot-add flow is:
- Slot is empty and slot power is off
- User inserts card in slot and presses Attention Button
- OS blinks Power Indicator for 5 seconds
- After 5 seconds, OS turns on Power Indicator, turns on slot power, and enumerates the device
Previously, if a user pressed the Attention Button on an *empty* slot, pciehp logged the following messages and blinked the Power Indicator until a second button press:
[0.000] pciehp: Button press: will power on in 5 sec
[0.001] # Power Indicator starts blinking
[5.001] # 5 second timeout; slot is empty, so we should cancel the
request to power on and turn off Power Indicator[7.000] # Power Indicator still blinking [8.000] # possible card insertion [9.000] pciehp: Button press: canceling request to power on
The first button press incorrectly left the slot in BLINKINGON_STATE, so the second was interpreted as a "cancel power on" event regardless of whether a card was present.
If the slot is empty, turn off the Power Indicator and return from BLINKINGON_STATE to OFF_STATE after 5 seconds, effectively canceling the request to power on. Putting the slot in OFF_STATE also means the second button press will correctly request a slot power on if the slot is occupied.
--- drivers/pci/hotplug/pciehp_ctrl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pci/hotplug/pciehp_ctrl.c +8 -0
@@ -256,6 +256,14 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events) present =pciehp_card_present (ctrl); link_active =pciehp_check_link_active (ctrl);if (present <=0 && link_active <=0 ) { +if (ctrl->state ==BLINKINGON_STATE ) { + ctrl->state =OFF_STATE ; +cancel_delayed_work (&ctrl->button_work); +pciehp_set_indicators (ctrl,PCI_EXP_SLTCTL_PWR_IND_OFF , +INDICATOR_NOOP ); +ctrl_info (ctrl,"Slot(%s): Card not present\n" , +slot_name (ctrl)); + }mutex_unlock (&ctrl->state_lock);return ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 352/431 perf evsel: Dont let for_each_group() treat the head of the list as one of its nodes
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
[ Upstream commit 797b9ec8c4bc9ec89f633a9b2c710b7b64753ca4 ]
Address/memory sanitizer was reporting issues in evsel__group_pmu_name because the for_each_group_evsel loop didn't terminate when the head was reached, the head would then be cast and accessed as an evsel leading to invalid memory accesses.
Fix for_each_group_member and for_each_group_evsel to terminate at the list head. Note, evsel__group_pmu_name no longer iterates the group, but the problem is present regardless.
--- tools/perf/util/evsel.h | 24 ++++++++++++++++-------- tools/perf/util/evsel_fprintf.c | 1 + 2 files changed, 17 insertions(+), 8 deletions(-)
tools/perf/util/evsel.h +16 -8
@@ -457,16 +457,24 @@ static inline int evsel__group_idx(struct evsel *evsel) }/* Iterates group WITHOUT the leader. */ -#define for_each_group_member (_evsel, _leader) \ -for ((_evsel) = list_entry((_leader)->core.node.next, struct evsel, core.node); \ - (_evsel) && (_evsel)->core.leader == (&_leader->core); \ - (_evsel) = list_entry((_evsel)->core.node.next, struct evsel, core.node)) +#define for_each_group_member_head (_evsel, _leader, _head) \ +for ((_evsel) = list_entry((_leader)->core.node.next, struct evsel, core.node); \ + (_evsel) && &(_evsel)->core.node != (_head) && \ + (_evsel)->core.leader == &(_leader)->core; \ + (_evsel) = list_entry((_evsel)->core.node.next, struct evsel, core.node)) + +#define for_each_group_member (_evsel, _leader) \ + for_each_group_member_head(_evsel, _leader, &(_leader)->evlist->core.entries)/* Iterates group WITH the leader. */ -#define for_each_group_evsel (_evsel, _leader) \ -for ((_evsel) = _leader; \ - (_evsel) && (_evsel)->core.leader == (&_leader->core); \ - (_evsel) = list_entry((_evsel)->core.node.next, struct evsel, core.node)) +#define for_each_group_evsel_head (_evsel, _leader, _head) \ +for ((_evsel) = _leader; \ + (_evsel) && &(_evsel)->core.node != (_head) && \ + (_evsel)->core.leader == &(_leader)->core; \ + (_evsel) = list_entry((_evsel)->core.node.next, struct evsel, core.node)) + +#define for_each_group_evsel (_evsel, _leader) \ + for_each_group_evsel_head(_evsel, _leader, &(_leader)->evlist->core.entries)static inline bool evsel__has_branch_callstack (const struct evsel *evsel) {
tools/perf/util/evsel_fprintf.c +1 -0
@@ -2,6 +2,7 @@#include <inttypes.h> #include <stdio.h> #include <stdbool.h> +#include "util/evlist.h" #include "evsel.h" #include "util/evsel_fprintf.h" #include "util/event.h"
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 353/431 PCI: ftpci100: Release the clock resources
In reply to Greg Kroah-HartmanFrom: Junyan Ye <[email protected]>
[ Upstream commit c60738de85f40b0b9f5cb23c21f9246e5a47908c ]
Smatch reported:
1. drivers/pci/controller/pci-ftpci100.c:526 faraday_pci_probe() warn:
'clk' from clk_prepare_enable() not released on lines: 442,451,462,478,512,517.
2. drivers/pci/controller/pci-ftpci100.c:526 faraday_pci_probe() warn:
'p->bus_clk' from clk_prepare_enable() not released on lines: 451,462,478,512,517.
The clock resource is obtained by devm_clk_get(), and then clk_prepare_enable() makes the clock resource ready for use. After that, clk_disable_unprepare() should be called to release the clock resource when it is no longer needed. However, while doing some error handling in faraday_pci_probe(), clk_disable_unprepare() is not called to release clk and p->bus_clk before returning. These return lines are exactly 442, 451, 462, 478, 512, 517.
Fix this warning by replacing devm_clk_get() with devm_clk_get_enabled(), which is equivalent to devm_clk_get() + clk_prepare_enable(). And with devm_clk_get_enabled(), the clock will automatically be disabled, unprepared and freed when the device is unbound from the bus.
--- drivers/pci/controller/pci-ftpci100.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/pci/controller/pci-ftpci100.c +2 -12
@@ -429,22 +429,12 @@ static int faraday_pci_probe(struct platform_device *pdev) p->dev = dev;/* Retrieve and enable optional clocks */ - clk =devm_clk_get (dev,"PCLK" ); + clk =devm_clk_get_enabled (dev,"PCLK" );if (IS_ERR (clk))return PTR_ERR (clk); - ret =clk_prepare_enable (clk); -if (ret) { -dev_err (dev,"could not prepare PCLK\n" ); -return ret; - } - p->bus_clk =devm_clk_get (dev,"PCICLK" ); + p->bus_clk =devm_clk_get_enabled (dev,"PCICLK" );if (IS_ERR (p->bus_clk))return PTR_ERR (p->bus_clk); - ret =clk_prepare_enable (p->bus_clk); -if (ret) { -dev_err (dev,"could not prepare PCICLK\n" ); -return ret; - } p->base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (p->base))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 354/431 pinctrl: sunplus: Add check for kmalloc
In reply to Greg Kroah-HartmanFrom: Wells Lu <[email protected]>
[ Upstream commit a5961bed5429cf1134d7f539b4ed60317012f84d ]
Fix Smatch static checker warning:
potential null dereference 'configs'. (kmalloc returns null)
--- drivers/pinctrl/sunplus/sppctl.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/pinctrl/sunplus/sppctl.c +18 -6
@@ -834,11 +834,6 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_nodeint i, size =0 ; list =of_get_property (np_config,"sunplus,pins" , &size); - -if (nmG <=0 ) - nmG =0 ; - - parent =of_get_parent (np_config); *num_maps = size /sizeof (*list);/*
@@ -866,10 +861,14 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node } } +if (nmG <=0 ) + nmG =0 ; + *map =kcalloc (*num_maps + nmG,sizeof (**map),GFP_KERNEL ); -if (*map ==NULL ) +if (!(*map))return -ENOMEM ; + parent =of_get_parent (np_config);for (i =0 ; i < (*num_maps); i++) { dt_pin =be32_to_cpu (list[i]); pin_num =FIELD_GET (GENMASK (31 ,24 ), dt_pin);
@@ -883,6 +882,8 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node (*map)[i].data.configs.num_configs =1 ; (*map)[i].data.configs.group_or_pin =pin_get_name (pctldev, pin_num); configs =kmalloc (sizeof (*configs),GFP_KERNEL ); +if (!configs) + goto sppctl_map_err; *configs =FIELD_GET (GENMASK (7 ,0 ), dt_pin); (*map)[i].data.configs.configs = configs;
@@ -896,6 +897,8 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node (*map)[i].data.configs.num_configs =1 ; (*map)[i].data.configs.group_or_pin =pin_get_name (pctldev, pin_num); configs =kmalloc (sizeof (*configs),GFP_KERNEL ); +if (!configs) + goto sppctl_map_err; *configs =SPPCTL_IOP_CONFIGS ; (*map)[i].data.configs.configs = configs;
@@ -965,6 +968,15 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_nodeof_node_put (parent);dev_dbg (pctldev->dev,"%d pins mapped\n" , *num_maps);return 0 ; + +sppctl_map_err: +for (i =0 ; i < (*num_maps); i++) +if (((*map)[i].type ==PIN_MAP_TYPE_CONFIGS_PIN ) && + (*map)[i].data.configs.configs) +kfree ((*map)[i].data.configs.configs); +kfree (*map); +of_node_put (parent); +return -ENOMEM ; }static const struct pinctrl_ops sppctl_pctl_ops = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 355/431 scsi: ufs: Declare ufshcd_{hold,release}() once
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 4b68b7f9c46d90c541d39c8b397a86ac0ca4c765 ]
ufshcd_hold() and ufshcd_release are declared twice: once in drivers/ufs/core/ufshcd-priv.h and a second time in include/ufs/ufshcd.h. Remove the declarations from ufshcd-priv.h.
--- drivers/ufs/core/ufshcd-priv.h | 3 --- 1 file changed, 3 deletions(-)
drivers/ufs/core/ufshcd-priv.h +0 -3
@@ -84,9 +84,6 @@ unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,int ufshcd_read_string_desc (struct ufs_hba *hba,u8 desc_index,u8 **buf,bool ascii); -int ufshcd_hold (struct ufs_hba *hba,bool async); -void ufshcd_release (struct ufs_hba *hba); -int ufshcd_send_uic_cmd (struct ufs_hba *hba,struct uic_command *uic_cmd); int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 356/431 PCI: Add pci_clear_master() stub for non-CONFIG_PCI
In reply to Greg Kroah-HartmanFrom: Sui Jingfeng <[email protected]>
[ Upstream commit 2aa5ac633259843f656eb6ecff4cf01e8e810c5e ]
Add a pci_clear_master() stub when CONFIG_PCI is not set so drivers that support both PCI and platform devices don't need #ifdefs or extra Kconfig symbols for the PCI parts.
--- include/linux/pci.h | 1 + 1 file changed, 1 insertion(+)
include/linux/pci.h +1 -0
@@ -1866,6 +1866,7 @@ static inline int pci_dev_present(const struct pci_device_id *ids)#define pci_dev_put (dev) do { } while (0)static inline void pci_set_master (struct pci_dev *dev) { } +static inline void pci_clear_master (struct pci_dev *dev) { }static inline int pci_enable_device (struct pci_dev *dev) {return -EIO ; }static inline void pci_disable_device (struct pci_dev *dev) { }static inline int pcim_enable_device (struct pci_dev *pdev) {return -EIO ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 357/431 scsi: lpfc: Revise NPIV ELS unsol rcv cmpl logic to drop ndlp based on nlp_state
In reply to Greg Kroah-HartmanFrom: Justin Tee <[email protected]>
[ Upstream commit 9914a3d033d3e1d836a43e93e9738e7dd44a096a ]
When NPIV ports are zoned to devices that support both initiator and target mode, a remote device's initiated PRLI results in unintended final kref clean up of the device's ndlp structure. This disrupts NPIV ports' discovery for target devices that support both initiator and target mode.
Modify the NPIV lpfc_drop_node clause such that we allow the ndlp to live so long as it was in NLP_STE_PLOGI_ISSUE, NLP_STE_REG_LOGIN_ISSUE, or NLP_STE_PRLI_ISSUE nlp_state. This allows lpfc's issued PRLI completion routine to determine if the final kref clean up should execute rather than a remote device's issued PRLI.
--- drivers/scsi/lpfc/lpfc_els.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +12 -2
@@ -5466,9 +5466,19 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp->nlp_flag &= ~NLP_RELEASE_RPI ;spin_unlock_irq (&ndlp->lock); } +lpfc_drop_node (vport, ndlp); + }else if (ndlp->nlp_state !=NLP_STE_PLOGI_ISSUE && + ndlp->nlp_state !=NLP_STE_REG_LOGIN_ISSUE && + ndlp->nlp_state !=NLP_STE_PRLI_ISSUE ) { +/* Drop ndlp if there is no planned or outstanding +* issued PRLI. +* +* In cases when the ndlp is acting as both an initiator +* and target function, let our issued PRLI determine +* the final ndlp kref drop. +*/ +lpfc_drop_node (vport, ndlp); } - -lpfc_drop_node (vport, ndlp); }/* Release the originating I/O reference. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 358/431 scsi: ufs: core: Increase the START STOP UNIT timeout from one to ten seconds
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit fe8637f7708c16765ecf4035813efbfdd2c9be10 ]
One UFS vendor asked to increase the UFS timeout from 1 s to 3 s. Another UFS vendor asked to increase the UFS timeout from 1 s to 10 s. Hence this patch that increases the UFS timeout to 10 s. This patch can cause the total timeout to exceed 20 s, the Android shutdown timeout. This is fine since the loop around ufshcd_execute_start_stop() exists to deal with unit attentions and because unit attentions are reported quickly.
--- drivers/ufs/core/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +2 -1
@@ -9153,7 +9153,8 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, };return scsi_execute_cmd (sdev, cdb,REQ_OP_DRV_IN ,/*buffer=*/ NULL , -/*bufflen=*/ 0 ,/*timeout=*/ HZ ,/*retries=*/ 0 , &args); +/*bufflen=*/ 0 ,/*timeout=*/ 10 *HZ ,/*retries=*/ 0 , + &args); }/**
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 359/431 scsi: ufs: core: Fix handling of lrbp->cmd
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 549e91a9bbaa0ee480f59357868421a61d369770 ]
ufshcd_queuecommand() may be called two times in a row for a SCSI command before it is completed. Hence make the following changes:
- In the functions that submit a command, do not check the old value of lrbp->cmd nor clear lrbp->cmd in error paths.
- In ufshcd_release_scsi_cmd(), do not clear lrbp->cmd.
See also scsi_send_eh_cmnd().
This commit prevents that the following appears if a command times out:
WARNING: at drivers/ufs/core/ufshcd.c:2965 ufshcd_queuecommand+0x6f8/0x9a8 Call trace: ufshcd_queuecommand+0x6f8/0x9a8 scsi_send_eh_cmnd+0x2c0/0x960 scsi_eh_test_devices+0x100/0x314 scsi_eh_ready_devs+0xd90/0x114c scsi_error_handler+0x2b4/0xb70 kthread+0x16c/0x1e0
--- drivers/ufs/core/ufshcd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/ufs/core/ufshcd.c +1 -6
@@ -2917,7 +2917,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) (hba->clk_gating.state != CLKS_ON)); lrbp = &hba->lrb[tag]; -WARN_ON (lrbp->cmd); lrbp->cmd = cmd; lrbp->task_tag = tag; lrbp->lun =ufshcd_scsi_to_upiu_lun (cmd->device->lun);
@@ -2933,7 +2932,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) err =ufshcd_map_sg (hba, lrbp);if (err) { - lrbp->cmd =NULL ;ufshcd_release (hba); goto out; }
@@ -3152,7 +3150,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,down_read (&hba->clk_scaling_lock); lrbp = &hba->lrb[tag]; -WARN_ON (lrbp->cmd); + lrbp->cmd =NULL ; err =ufshcd_compose_dev_cmd (hba, lrbp, cmd_type, tag);if (unlikely (err)) goto out;
@@ -5391,7 +5389,6 @@ static void ufshcd_release_scsi_cmd(struct ufs_hba *hba,struct scsi_cmnd *cmd = lrbp->cmd;scsi_dma_unmap (cmd); - lrbp->cmd =NULL ;/* Mark the command as completed. */ ufshcd_release (hba);ufshcd_clk_scaling_update_busy (hba); }
@@ -7006,7 +7003,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,down_read (&hba->clk_scaling_lock); lrbp = &hba->lrb[tag]; -WARN_ON (lrbp->cmd); lrbp->cmd =NULL ; lrbp->task_tag = tag; lrbp->lun =0 ;
@@ -7178,7 +7174,6 @@ int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *rdown_read (&hba->clk_scaling_lock); lrbp = &hba->lrb[tag]; -WARN_ON (lrbp->cmd); lrbp->cmd =NULL ; lrbp->task_tag = tag; lrbp->lun =UFS_UPIU_RPMB_WLUN ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 360/431 pinctrl: tegra: Duplicate pinmux functions table
In reply to Greg Kroah-HartmanFrom: Thierry Reding <[email protected]>
[ Upstream commit fad57233501beb5bd25f037cb9128a533e710600 ]
The function table is filled with group information based on other instance-specific data at runtime. However, the function table can be shared between multiple instances, causing the ->probe() function for one instance to overwrite the table of a previously probed instance.
Fix this by sharing only the function names and allocating a separate function table for each instance.
--- drivers/pinctrl/tegra/pinctrl-tegra.c | 15 +++++++++++---- drivers/pinctrl/tegra/pinctrl-tegra.h | 3 ++- drivers/pinctrl/tegra/pinctrl-tegra114.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra124.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra194.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra20.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra210.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra30.c | 7 ++----- 8 files changed, 25 insertions(+), 35 deletions(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +11 -4
@@ -232,7 +232,7 @@ static const char *tegra_pinctrl_get_func_name(struct pinctrl_dev *pctldev, {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); -return pmx->soc->functions[function].name; +return pmx->functions[function].name; } static int tegra_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
@@ -242,8 +242,8 @@ static int tegra_pinctrl_get_func_groups(struct pinctrl_dev *pctldev, {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); - *groups = pmx->soc->functions[function].groups; - *num_groups = pmx->soc->functions[function].ngroups; + *groups = pmx->functions[function].groups; + *num_groups = pmx->functions[function].ngroups;return 0 ; }
@@ -795,10 +795,17 @@ int tegra_pinctrl_probe(struct platform_device *pdev,if (!pmx->group_pins)return -ENOMEM ; + pmx->functions =devm_kcalloc (&pdev->dev, pmx->soc->nfunctions, +sizeof (*pmx->functions),GFP_KERNEL ); +if (!pmx->functions) +return -ENOMEM ; + group_pins = pmx->group_pins; +for (fn =0 ; fn < soc_data->nfunctions; fn++) { -struct tegra_function *func = &soc_data->functions[fn]; +struct tegra_function *func = &pmx->functions[fn]; + func->name = pmx->soc->functions[fn]; func->groups = group_pins;for (gn =0 ; gn < soc_data->ngroups; gn++) {
drivers/pinctrl/tegra/pinctrl-tegra.h +2 -1
@@ -13,6 +13,7 @@ struct tegra_pmx {struct pinctrl_dev *pctl;const struct tegra_pinctrl_soc_data *soc; +struct tegra_function *functions;const char **group_pins;struct pinctrl_gpio_range gpio_range;
@@ -191,7 +192,7 @@ struct tegra_pinctrl_soc_data {const char *gpio_compatible;const struct pinctrl_pin_desc *pins;unsigned npins; -struct tegra_function *functions; +const char *const *functions;unsigned nfunctions;const struct tegra_pingroup *groups;unsigned ngroups;
drivers/pinctrl/tegra/pinctrl-tegra114.c +2 -5
@@ -1452,12 +1452,9 @@ enum tegra_mux { TEGRA_MUX_VI_ALT3, }; -#define FUNCTION (fname) \ - { \ - .name = #fname, \ - } +#define FUNCTION (fname) #fname -static struct tegra_function tegra114_functions[] = { +static const char *const tegra114_functions[] = {FUNCTION (blink),FUNCTION (cec),FUNCTION (cldvfs),
drivers/pinctrl/tegra/pinctrl-tegra124.c +2 -5
@@ -1611,12 +1611,9 @@ enum tegra_mux { TEGRA_MUX_VIMCLK2_ALT, }; -#define FUNCTION (fname) \ - { \ - .name = #fname, \ - } +#define FUNCTION (fname) #fname -static struct tegra_function tegra124_functions[] = { +static const char *const tegra124_functions[] = {FUNCTION (blink),FUNCTION (ccla),FUNCTION (cec),
drivers/pinctrl/tegra/pinctrl-tegra194.c +2 -5
@@ -1189,12 +1189,9 @@ enum tegra_mux_dt { };/* Make list of each function name */ -#define TEGRA_PIN_FUNCTION (lid) \ - { \ - .name = #lid, \ - } +#define TEGRA_PIN_FUNCTION (lid) #lid -static struct tegra_function tegra194_functions[] = { +static const char *const tegra194_functions[] = {TEGRA_PIN_FUNCTION (rsvd0),TEGRA_PIN_FUNCTION (rsvd1),TEGRA_PIN_FUNCTION (rsvd2),
drivers/pinctrl/tegra/pinctrl-tegra20.c +2 -5
@@ -1889,12 +1889,9 @@ enum tegra_mux { TEGRA_MUX_XIO, }; -#define FUNCTION (fname) \ - { \ - .name = #fname, \ - } +#define FUNCTION (fname) #fname -static struct tegra_function tegra20_functions[] = { +static const char *const tegra20_functions[] = {FUNCTION (ahb_clk),FUNCTION (apb_clk),FUNCTION (audio_sync),
drivers/pinctrl/tegra/pinctrl-tegra210.c +2 -5
@@ -1185,12 +1185,9 @@ enum tegra_mux { TEGRA_MUX_VIMCLK2, }; -#define FUNCTION (fname) \ - { \ - .name = #fname, \ - } +#define FUNCTION (fname) #fname -static struct tegra_function tegra210_functions[] = { +static const char *const tegra210_functions[] = {FUNCTION (aud),FUNCTION (bcl),FUNCTION (blink),
drivers/pinctrl/tegra/pinctrl-tegra30.c +2 -5
@@ -2010,12 +2010,9 @@ enum tegra_mux { TEGRA_MUX_VI_ALT3, }; -#define FUNCTION (fname) \ - { \ - .name = #fname, \ - } +#define FUNCTION (fname) #fname -static struct tegra_function tegra30_functions[] = { +static const char *const tegra30_functions[] = {FUNCTION (blink),FUNCTION (cec),FUNCTION (clk_12m_out),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 361/431 perf bench: Add missing setlocale() call to allow usage of %d style formatting
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 16203e9cd01896b4244100a8e3fb9f6e612ab2b1 ]
Without this we were not getting the thousands separator for big numbers.
Noticed while developing 'perf bench uprobe', but the use of %' predates that, for instance 'perf bench syscall' uses it.
Before:
# perf bench uprobe all
# Running uprobe/baseline benchmark...
# Executed 1000 usleep(1000) calls
Total time: 1054082243ns1054082.243000 nsecs/op
#
After:
# perf bench uprobe all
# Running uprobe/baseline benchmark...
# Executed 1,000 usleep(1000) calls
Total time: 1,053,715,144ns1,053,715.144000 nsecs/op
#
--- tools/perf/builtin-bench.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/builtin-bench.c +2 -0
@@ -21,6 +21,7 @@#include "builtin.h" #include "bench/bench.h" +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
@@ -258,6 +259,7 @@ int cmd_bench(int argc, const char **argv)/* Unbuffered output */ setvbuf (stdout,NULL , _IONBF,0 ); +setlocale (LC_ALL ,"" );if (argc <2 ) {/* No collection specified. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 362/431 pinctrl: cherryview: Return correct value if pin in push-pull mode
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5835196a17be5cfdcad0b617f90cf4abe16951a4 ]
Currently the getter returns ENOTSUPP on pin configured in the push-pull mode. Fix this by adding the missed switch case.
--- drivers/pinctrl/intel/pinctrl-cherryview.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/pinctrl/intel/pinctrl-cherryview.c +10 -5
@@ -949,11 +949,6 @@ static int chv_config_get(struct pinctrl_dev *pctldev, unsigned int pin,break ; -case PIN_CONFIG_DRIVE_OPEN_DRAIN : -if (!(ctrl1 &CHV_PADCTRL1_ODEN )) -return -EINVAL ; -break ; -case PIN_CONFIG_BIAS_HIGH_IMPEDANCE : {u32 cfg;
@@ -963,6 +958,16 @@ static int chv_config_get(struct pinctrl_dev *pctldev, unsigned int pin,return -EINVAL ;break ; + +case PIN_CONFIG_DRIVE_PUSH_PULL : +if (ctrl1 &CHV_PADCTRL1_ODEN ) +return -EINVAL ; +break ; + +case PIN_CONFIG_DRIVE_OPEN_DRAIN : +if (!(ctrl1 &CHV_PADCTRL1_ODEN )) +return -EINVAL ; +break ; }default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 363/431 platform/x86:intel/pmc: Remove Meteor Lake S platform support
In reply to Greg Kroah-HartmanFrom: Xi Pardee <[email protected]>
[ Upstream commit 416a87c972b978d71ab828442d1d48e3bd194855 ]
commit c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver") was supposed to add support for Meter Lake P/M and mistakenly added support for Meteor Lake S instead. Meteor Lake P/M support was added later and MTL-S support needs to be removed since its currently assigned to the wrong register maps.
--- drivers/platform/x86/intel/pmc/core.c | 1 - 1 file changed, 1 deletion(-)
drivers/platform/x86/intel/pmc/core.c +0 -1
@@ -1039,7 +1039,6 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE_P , tgl_core_init),X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE , adl_core_init),X86_MATCH_INTEL_FAM6_MODEL (RAPTORLAKE_S , adl_core_init), -X86_MATCH_INTEL_FAM6_MODEL (METEORLAKE , mtl_core_init), X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, mtl_core_init), {} };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 364/431 platform/x86: think-lmi: mutex protection around multiple WMI calls
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
[ Upstream commit c41e0121a1221894a1a9c4666156db9e1def4d6c ]
When an attribute is being changed if the Admin account is enabled, or if a password is being updated then multiple WMI calls are needed. Add mutex protection to ensure no race conditions are introduced.
--- drivers/platform/x86/think-lmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/platform/x86/think-lmi.c +10 -0
@@ -14,6 +14,7 @@#include <linux/acpi.h> #include <linux/errno.h> #include <linux/fs.h> +#include <linux/mutex.h> #include <linux/string.h> #include <linux/types.h> #include <linux/dmi.h>
@@ -195,6 +196,7 @@ static const char * const level_options[] = { };static struct think_lmi tlmi_priv;static struct class *fw_attr_class; +static DEFINE_MUTEX (tlmi_mutex);/* ------ Utility functions ------------*/ /* Strip out CR if one is present */
@@ -437,6 +439,9 @@ static ssize_t new_password_store(struct kobject *kobj,/* Strip out CR if one is present, setting password won't work if it is present */ strip_cr (new_pwd); +/* Use lock in case multiple WMI operations needed */ +mutex_lock (&tlmi_mutex); + pwdlen =strlen (new_pwd);/* pwdlen == 0 is allowed to clear the password */ if (pwdlen && ((pwdlen < setting->minlen) || (pwdlen > setting->maxlen))) {
@@ -493,6 +498,7 @@ static ssize_t new_password_store(struct kobject *kobj,kfree (auth_str); } out: +mutex_unlock (&tlmi_mutex);kfree (new_pwd);return ret ?: count; }
@@ -982,6 +988,9 @@ static ssize_t current_value_store(struct kobject *kobj,/* Strip out CR if one is present */ strip_cr (new_setting); +/* Use lock in case multiple WMI operations needed */ +mutex_lock (&tlmi_mutex); +/* Check if certificate authentication is enabled and active */ if (tlmi_priv.certificate_support && tlmi_priv.pwd_admin->cert_installed) {if (!tlmi_priv.pwd_admin->signature || !tlmi_priv.pwd_admin->save_signature) {
@@ -1040,6 +1049,7 @@ static ssize_t current_value_store(struct kobject *kobj,kobject_uevent (&tlmi_priv.class_dev->kobj,KOBJ_CHANGE ); } out: +mutex_unlock (&tlmi_mutex);kfree (auth_str);kfree (set_str);kfree (new_setting);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 365/431 platform/x86: think-lmi: Correct System password interface
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
[ Upstream commit 97eef5983372d7aee6549d644d788fd0c10d2b6e ]
The system password identification was incorrect. This means that if the password was enabled it wouldn't be detected correctly; and setting it would not work.
Also updated code to use TLMI_SMP_PWD instead of TLMI_SYS_PWD to be in sync with Lenovo documentation.
--- drivers/platform/x86/think-lmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/platform/x86/think-lmi.c +3 -3
@@ -172,7 +172,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support");#define TLMI_POP_PWD (1 << 0)#define TLMI_PAP_PWD (1 << 1)#define TLMI_HDD_PWD (1 << 2) -#define TLMI_SYS_PWD (1 << 3) +#define TLMI_SMP_PWD (1 << 6)/* System Management */ #define TLMI_CERT (1 << 7)#define to_tlmi_pwd_setting (kobj) container_of(kobj, struct tlmi_pwd_setting, kobj)
@@ -1522,11 +1522,11 @@ static int tlmi_analyze(void) tlmi_priv.pwd_power->valid = true;if (tlmi_priv.opcode_support) { - tlmi_priv.pwd_system =tlmi_create_auth ("sys" ,"system" ); + tlmi_priv.pwd_system =tlmi_create_auth ("smp" ,"system" );if (!tlmi_priv.pwd_system) goto fail_clear_attr; -if (tlmi_priv.pwdcfg.core.password_state &TLMI_SYS_PWD ) +if (tlmi_priv.pwdcfg.core.password_state &TLMI_SMP_PWD ) tlmi_priv.pwd_system->valid = true; tlmi_priv.pwd_hdd =tlmi_create_auth ("hdd" ,"hdd" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 366/431 platform/x86: think-lmi: Correct NVME password handling
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
[ Upstream commit 4cebb42412248d28df6de01420cfac5654428d41 ]
NVME passwords identifier have been standardised across the Lenovo systems and now use udrp and adrp (user and admin level) instead of unvp and mnvp.
This should apparently be backwards compatible.
--- drivers/platform/x86/think-lmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/think-lmi.c +2 -2
@@ -461,9 +461,9 @@ static ssize_t new_password_store(struct kobject *kobj,sprintf (pwd_type,"mhdp%d" , setting->index); }else if (setting == tlmi_priv.pwd_nvme) {if (setting->level ==TLMI_LEVEL_USER ) -sprintf (pwd_type,"unvp%d" , setting->index); +sprintf (pwd_type,"udrp%d" , setting->index);else -sprintf (pwd_type,"mnvp%d" , setting->index); +sprintf (pwd_type,"adrp%d" , setting->index); }else {sprintf (pwd_type,"%s" , setting->pwd_type); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 367/431 pinctrl:sunplus: Add check for kmalloc
In reply to Greg Kroah-HartmanFrom: Wells Lu <[email protected]>
[ Upstream commit 73f8ce7f961afcb3be49352efeb7c26cc1c00cc4 ]
Fix Smatch static checker warning:
potential null dereference 'configs'. (kmalloc returns null)
Changes in v2:
1. Add free allocated memory before returned -ENOMEM.
2. Add call of_node_put() before returned -ENOMEM.
--- drivers/pinctrl/sunplus/sppctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/sunplus/sppctl.c +1 -2
@@ -971,8 +971,7 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node sppctl_map_err:for (i =0 ; i < (*num_maps); i++) -if (((*map)[i].type ==PIN_MAP_TYPE_CONFIGS_PIN ) && - (*map)[i].data.configs.configs) +if ((*map)[i].type ==PIN_MAP_TYPE_CONFIGS_PIN )kfree ((*map)[i].data.configs.configs);kfree (*map);of_node_put (parent);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 368/431 pinctrl: npcm7xx: Add missing check for ioremap
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit ad64639417161e90b30dda00486570eb150aeee5 ]
Add check for ioremap() and return the error if it fails in order to guarantee the success of ioremap().
--- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +2 -0
@@ -1881,6 +1881,8 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) } pctrl->gpio_bank[id].base =ioremap (res.start,resource_size (&res)); +if (!pctrl->gpio_bank[id].base) +return -EINVAL ; ret = bgpio_init(&pctrl->gpio_bank[id].gc, dev, 4, pctrl->gpio_bank[id].base + NPCM7XX_GP_N_DIN,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 369/431 kcsan: Dont expect 64 bits atomic builtins from 32 bits architectures
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 353e7300a1db928e427462f2745f9a2cd1625b3d ]
Activating KCSAN on a 32 bits architecture leads to the following link-time failure:
LD .tmp_vmlinux.kallsyms1
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_load':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_load_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_store':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_store_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_exchange':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_exchange_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_fetch_add':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_fetch_add_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_fetch_sub':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_fetch_sub_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_fetch_and':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_fetch_and_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_fetch_or':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_fetch_or_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_fetch_xor':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_fetch_xor_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_fetch_nand':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_fetch_nand_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_compare_exchange_strong':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_compare_exchange_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_compare_exchange_weak':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_compare_exchange_8'
powerpc64-linux-ld: kernel/kcsan/core.o: in function `__tsan_atomic64_compare_exchange_val':
kernel/kcsan/core.c:1273: undefined reference to `__atomic_compare_exchange_8'
32 bits architectures don't have 64 bits atomic builtins. Only include DEFINE_TSAN_ATOMIC_OPS(64) on 64 bits architectures.
--- kernel/kcsan/core.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/kcsan/core.c +2 -0
@@ -1270,7 +1270,9 @@ static __always_inline void kcsan_atomic_builtin_memorder(int memorder)DEFINE_TSAN_ATOMIC_OPS (8 );DEFINE_TSAN_ATOMIC_OPS (16 );DEFINE_TSAN_ATOMIC_OPS (32 ); +#ifdef CONFIG_64BIT DEFINE_TSAN_ATOMIC_OPS (64 ); +#endif void __tsan_atomic_thread_fence (int memorder);void __tsan_atomic_thread_fence (int memorder)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 370/431 powerpc/interrupt: Dont read MSR from interrupt_exit_kernel_prepare()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 0eb089a72fda3f7969e6277804bde75dc1474a14 ]
A disassembly of interrupt_exit_kernel_prepare() shows a useless read of MSR register. This is shown by r9 being re-used immediately without doing anything with the value read.
c000e0e0: 60 00 00 00 nop c000e0e4: 7d 3a c2 a6 mfmd_ap r9 c000e0e8: 7d 20 00 a6 mfmsr r9 c000e0ec: 7c 51 13 a6 mtspr 81,r2 c000e0f0: 81 3f 00 84 lwz r9,132(r31) c000e0f4: 71 29 80 00 andi. r9,r9,32768
This is due to the use of local_irq_save(). The flags read by local_irq_save() are never used, use local_irq_disable() instead.
--- arch/powerpc/kernel/interrupt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/interrupt.c +1 -2
@@ -368,7 +368,6 @@ void preempt_schedule_irq(void);notrace unsigned long interrupt_exit_kernel_prepare (struct pt_regs *regs) { -unsigned long flags;unsigned long ret =0 ;unsigned long kuap;bool stack_store =read_thread_flags () & _TIF_EMULATE_STACK_STORE;
@@ -392,7 +391,7 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) kuap =kuap_get_and_assert_locked (); -local_irq_save (flags); +local_irq_disable ();if (!arch_irq_disabled_regs (regs)) {/* Returning to a kernel context with local irqs enabled. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 371/431 powerpc/signal32: Force inlining of __unsafe_save_user_regs() and save_tm_user_regs_unsafe()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit a03b1a0b19398a47489fdcef02ec19c2ba05a15d ]
Looking at generated code for handle_signal32() shows calls to a function called __unsafe_save_user_regs.constprop.0 while user access is open.
And that __unsafe_save_user_regs.constprop.0 function has two nops at the begining, allowing it to be traced, which is unexpected during user access open window.
The solution could be to mark __unsafe_save_user_regs() no trace, but to be on the safe side the most efficient is to flag it __always_inline as already done for function __unsafe_restore_general_regs(). The function is relatively small and only called twice, so the size increase will remain in the noise.
Do the same with save_tm_user_regs_unsafe() as it may suffer the same issue.
--- arch/powerpc/kernel/signal_32.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/powerpc/kernel/signal_32.c +9 -6
@@ -264,8 +264,9 @@ static void prepare_save_user_regs(int ctx_has_vsx_region)#endif } -static int __unsafe_save_user_regs (struct pt_regs *regs,struct mcontext __user *frame, -struct mcontext __user *tm_frame,int ctx_has_vsx_region) +static __always_inline int +__unsafe_save_user_regs (struct pt_regs *regs,struct mcontext __user *frame, +struct mcontext __user *tm_frame,int ctx_has_vsx_region) {unsigned long msr = regs->msr;
@@ -364,8 +365,9 @@ static void prepare_save_tm_user_regs(void) current->thread.ckvrsave =mfspr (SPRN_VRSAVE ); } -static int save_tm_user_regs_unsafe (struct pt_regs *regs,struct mcontext __user *frame, -struct mcontext __user *tm_frame,unsigned long msr) +static __always_inline int +save_tm_user_regs_unsafe (struct pt_regs *regs,struct mcontext __user *frame, +struct mcontext __user *tm_frame,unsigned long msr) {/* Save both sets of general registers */ unsafe_save_general_regs (¤t->thread.ckpt_regs, frame, failed);
@@ -444,8 +446,9 @@ static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user#else static void prepare_save_tm_user_regs (void ) { } -static int save_tm_user_regs_unsafe (struct pt_regs *regs,struct mcontext __user *frame, -struct mcontext __user *tm_frame,unsigned long msr) +static __always_inline int +save_tm_user_regs_unsafe (struct pt_regs *regs,struct mcontext __user *frame, +struct mcontext __user *tm_frame,unsigned long msr) {return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 372/431 perf script: Fix allocation of evsel->priv related to per-event dump files
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 36d3e4138e1b6cc9ab179f3f397b5548f8b1eaae ]
When printing output we may want to generate per event files, where the --per-event-dump option should be used, creating perf.data.EVENT.dump files instead of printing to stdout.
The callback thar processes event thus expects that evsel->priv->fp should point to either the per-event FILE descriptor or to stdout.
The a3af66f51bd0bca7 ("perf script: Fix crash because of missing evsel->priv") changeset fixed a case where evsel->priv wasn't setup, thus set to NULL, causing a segfault when trying to access evsel->priv->fp.
But it did it for the non --per-event-dump case by allocating a 'struct perf_evsel_script' just to set its ->fp to stdout.
Since evsel->priv is only freed when --per-event-dump is used, we ended up with a memory leak, detected using ASAN.
Fix it by using the same method as perf_script__setup_per_event_dump(), and reuse that static 'struct perf_evsel_script'.
Also check if evsel_script__new() failed.
--- tools/perf/builtin-script.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/perf/builtin-script.c +8 -8
@@ -2425,6 +2425,9 @@ static int process_sample_event(struct perf_tool *tool,return ret; } +// Used when scr->per_event_dump is not set +static struct evsel_script es_stdout; +static int process_attr (struct perf_tool *tool,union perf_event *event,struct evlist **pevlist) {
@@ -2433,7 +2436,6 @@ static int process_attr(struct perf_tool *tool, union perf_event *event,struct evsel *evsel, *pos;u64 sample_type;int err; -static struct evsel_script *es; err =perf_event__process_attr (tool, event, pevlist);if (err)
@@ -2443,14 +2445,13 @@ static int process_attr(struct perf_tool *tool, union perf_event *event, evsel =evlist__last (*pevlist);if (!evsel->priv) { -if (scr->per_event_dump) { +if (scr->per_event_dump) { evsel->priv =evsel_script__new (evsel, scr->session->data); - }else { - es =zalloc (sizeof (*es)); -if (!es) +if (!evsel->priv)return -ENOMEM ; - es->fp = stdout; - evsel->priv = es; + }else {// Replicate what is done in perf_script__setup_per_event_dump() + es_stdout.fp = stdout; + evsel->priv = &es_stdout; } }
@@ -2756,7 +2757,6 @@ static int perf_script__fopen_per_event_dump(struct perf_script *script)static int perf_script__setup_per_event_dump (struct perf_script *script) {struct evsel *evsel; -static struct evsel_script es_stdout;if (script->per_event_dump)return perf_script__fopen_per_event_dump (script);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 373/431 platform/x86: thinkpad_acpi: Fix lkp-tests warnings for platform profiles
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
[ Upstream commit f999e23ce66c1555d7b653fba171a88ecee53704 ]
Fix issues identified in dytc_profile_refresh identified by lkp-tests. drivers/platform/x86/thinkpad_acpi.c:10538
dytc_profile_refresh() error: uninitialized symbol 'funcmode'.drivers/platform/x86/thinkpad_acpi.c:10531
dytc_profile_refresh() error: uninitialized symbol 'output'.drivers/platform/x86/thinkpad_acpi.c:10537
dytc_profile_refresh() error: uninitialized symbol 'output'.
These issues should not lead to real problems in the field as the refresh function should only be called if MMC or PSC mode enabled. But good to fix.
Thanks to Dan Carpenter and the lkp-tests project for flagging these.
--- drivers/platform/x86/thinkpad_acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +4 -2
@@ -10524,8 +10524,8 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,static void dytc_profile_refresh (void ) {enum platform_profile_option profile; -int output, err =0 ; -int perfmode, funcmode; +int output =0 , err =0 ; +int perfmode, funcmode =0 ;mutex_lock (&dytc_mutex);if (dytc_capabilities &BIT (DYTC_FC_MMC )) {
@@ -10538,6 +10538,8 @@ static void dytc_profile_refresh(void) err =dytc_command (DYTC_CMD_GET , &output);/* Check if we are PSC mode, or have AMT enabled */ funcmode = (output >>DYTC_GET_FUNCTION_BIT ) &0xF ; + }else {/* Unknown profile mode */ + err = -ENODEV ; }mutex_unlock (&dytc_mutex);if (err)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 374/431 perf dwarf-aux: Fix off-by-one in die_get_varname()
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
[ Upstream commit 3abfcfd847717d232e36963f31a361747c388fe7 ]
The die_get_varname() returns "(unknown_type)" string if it failed to find a type for the variable. But it had a space before the opening parenthesis and it made the closing parenthesis cut off due to the off-by-one in the string length (14).
--- tools/perf/util/dwarf-aux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/dwarf-aux.c +1 -1
@@ -1103,7 +1103,7 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf) ret =die_get_typename (vr_die, buf);if (ret <0 ) {pr_debug ("Failed to get type, make it unknown.\n" ); - ret =strbuf_add (buf," (unknown_type)" ,14 ); + ret =strbuf_add (buf,"(unknown_type)" ,14 ); }return ret <0 ? ret :strbuf_addf (buf,"\t%s" ,dwarf_diename (vr_die));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 375/431 perf tests task_analyzer: Fix bad substitution ${$1}
In reply to Greg Kroah-HartmanFrom: Aditya Gupta <[email protected]>
[ Upstream commit 5c4396efb53ef07d046a2e9456b240880e0c3076 ]
${$1} gives bad substitution error on sh, bash, and zsh. This seems like a typo, and this patch modifies it to $1, since that is what it's usage looks like from wherever check_exec_0 is called.
This issue due to ${$1} caused all function calls to give error in find_str_or_fail line, and so no test runs completely. But 'perf test "perf script task-analyzer tests"' wrongly reports that tests passed with the status OK, which is wrong considering the tests didn't even run completely
--- tools/perf/tests/shell/test_task_analyzer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/test_task_analyzer.sh +1 -1
@@ -31,7 +31,7 @@ report() { check_exec_0() { if [ $? != 0 ]; then - report 1 "invokation of ${$1} command failed" + report 1 "invocation of $1 command failed" fi }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 376/431 perf tests task_analyzer: Skip tests if no libtraceevent support
In reply to Greg Kroah-HartmanFrom: Aditya Gupta <[email protected]>
[ Upstream commit c3ac3b0779770acd3ad7eecb5099ab4419ef2e2e ]
Test "perf script task-analyzer tests" fails in environment with missing libtraceevent support, as perf record fails to create the perf.data file, which further tests depend on.
Instead, when perf is not compiled with libtraceevent support, skip those tests instead of failing them, by checking the output of perf record --dry-run to see if it prints the error "libtraceevent is necessary for tracepoint support"
For the following output, perf compiled with: make NO_LIBTRACEEVENT=1
Before the patch:
108: perf script task-analyzer tests :
test child forked, pid 24105
failed to open perf.data: No such file or directory (try 'perf record' first)
FAIL: "invokation of perf script report task-analyzer command failed" Error message: ""
FAIL: "test_basic" Error message: "Failed to find required string:'Comm'."
failed to open perf.data: No such file or directory (try 'perf record' first)
FAIL: "invokation of perf script report task-analyzer --ns --rename-comms-by-tids 0:random command failed" Error message: ""
FAIL: "test_ns_rename" Error message: "Failed to find required string:'Comm'."
failed to open perf.data: No such file or directory (try 'perf record' first)
<...>
perf script task-analyzer tests: FAILED!
With this patch, the script instead returns 2 signifying SKIP, and after the patch:
108: perf script task-analyzer tests :
test child forked, pid 26010
libtraceevent is necessary for tracepoint support
WARN: Skipping tests. No libtraceevent support
test child finished with -2
perf script task-analyzer tests: Skip
--- tools/perf/tests/shell/test_task_analyzer.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/perf/tests/shell/test_task_analyzer.sh +18 -0
@@ -44,9 +44,20 @@ find_str_or_fail() { fi } +# check if perf is compiled with libtraceevent support +skip_no_probe_record_support() { + perf record -e "sched:sched_switch" -a -- sleep 1 2>&1 | grep "libtraceevent is necessary for tracepoint support" && return 2 + return 0 +} + prepare_perf_data() { # 1s should be sufficient to catch at least some switches perf record -e sched:sched_switch -a -- sleep 1 > /dev/null 2>&1 + # check if perf data file got created in above step. + if [ ! -e "perf.data" ]; then + printf "FAIL: perf record failed to create \"perf.data\" \n" + return 1 + fi } # check standard inkvokation with no arguments
@@ -134,6 +145,13 @@ test_csvsummary_extended() { find_str_or_fail "Out-Out;" csvsummary ${FUNCNAME[0]} } +skip_no_probe_record_support +err=$? +if [ $err -ne 0 ]; then + echo "WARN: Skipping tests. No libtraceevent support" + cleanup + exit $err +fi prepare_perf_data test_basic test_ns_rename
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 377/431 platform/x86/dell/dell-rbtn: Fix resources leaking on error path
In reply to Greg Kroah-HartmanFrom: Michal Wilczynski <[email protected]>
[ Upstream commit 966cca72ab20289083521a385fa56035d85a222d ]
Currently rbtn_add() in case of failure is leaking resources. Fix this by adding a proper rollback. Move devm_kzalloc() before rbtn_acquire(), so it doesn't require rollback in case of failure. While at it, remove unnecessary assignment of NULL to device->driver_data and unnecessary whitespace, plus add a break for the default case in a switch.
--- drivers/platform/x86/dell/dell-rbtn.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/platform/x86/dell/dell-rbtn.c +7 -6
@@ -395,16 +395,16 @@ static int rbtn_add(struct acpi_device *device)return -EINVAL ; } + rbtn_data =devm_kzalloc (&device->dev,sizeof (*rbtn_data),GFP_KERNEL ); +if (!rbtn_data) +return -ENOMEM ; + ret =rbtn_acquire (device, true);if (ret <0 ) {dev_err (&device->dev,"Cannot enable device\n" );return ret; } - rbtn_data =devm_kzalloc (&device->dev,sizeof (*rbtn_data),GFP_KERNEL ); -if (!rbtn_data) -return -ENOMEM ; - rbtn_data->type = type; device->driver_data = rbtn_data;
@@ -420,10 +420,12 @@ static int rbtn_add(struct acpi_device *device)break ;default : ret = -EINVAL ; +break ; } +if (ret) +rbtn_acquire (device, false);return ret; - }static void rbtn_remove (struct acpi_device *device)
@@ -442,7 +444,6 @@ static void rbtn_remove(struct acpi_device *device) }rbtn_acquire (device, false); - device->driver_data =NULL ; }static void rbtn_notify (struct acpi_device *device,u32 event)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 378/431 perf tool x86: Consolidate is_amd check into single function
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 0cd1ca4650c9cf5f318110f67d39cbebae3693b3 ]
There are multiple places where x86 specific code determines AMD vs Intel arch and acts based on that. Consolidate those checks into a single function.
Stable-dep-of: 99d4850062a8 ("perf tool x86: Fix perf_env memory leak")
--- tools/perf/arch/x86/util/Build | 1 + tools/perf/arch/x86/util/env.c | 19 +++++++++++++++++++ tools/perf/arch/x86/util/env.h | 7 +++++++ tools/perf/arch/x86/util/evsel.c | 16 ++-------------- tools/perf/arch/x86/util/mem-events.c | 19 ++----------------- 5 files changed, 31 insertions(+), 31 deletions(-) create mode 100644 tools/perf/arch/x86/util/env.c create mode 100644 tools/perf/arch/x86/util/env.h
tools/perf/arch/x86/util/Build +1 -0
@@ -10,6 +10,7 @@ perf-y += evlist.o perf-y += mem-events.o perf-y += evsel.o perf-y += iostat.o +perf-y += env.o perf-$(CONFIG_DWARF) += dwarf-regs.o perf-$(CONFIG_BPF_PROLOGUE) += dwarf-regs.o
tools/perf/arch/x86/util/env.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "linux/string.h" +#include "util/env.h" +#include "env.h" + +bool x86__is_amd_cpu (void ) +{ +struct perf_env env = { .total_mem =0 , }; +static int is_amd;/* 0: Uninitialized, 1: Yes, -1: No */ + +if (is_amd) + goto ret; + +perf_env__cpuid (&env); + is_amd = env.cpuid &&strstarts (env.cpuid,"AuthenticAMD" ) ?1 :-1 ; + +ret: +return is_amd >=1 ? true : false; +}
tools/perf/arch/x86/util/env.h new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _X86_ENV_H +#define _X86_ENV_H + +bool x86__is_amd_cpu (void ); + +#endif /* _X86_ENV_H */
tools/perf/arch/x86/util/evsel.c +2 -14
@@ -7,6 +7,7 @@#include "linux/string.h" #include "evsel.h" #include "util/debug.h" +#include "env.h" #define IBS_FETCH_L3MISSONLY (1ULL << 59)#define IBS_OP_L3MISSONLY (1ULL << 16)
@@ -97,23 +98,10 @@ void arch__post_evsel_config(struct evsel *evsel, struct perf_event_attr *attr) {struct perf_pmu *evsel_pmu, *ibs_fetch_pmu, *ibs_op_pmu;static int warned_once; -/* 0: Uninitialized, 1: Yes, -1: No */ -static int is_amd; -if (warned_once || is_amd ==-1 ) +if (warned_once || !x86__is_amd_cpu ())return ; -if (!is_amd) { -struct perf_env *env =evsel__env (evsel); - -if (!perf_env__cpuid (env) || !env->cpuid || - !strstarts (env->cpuid,"AuthenticAMD" )) { - is_amd =-1 ; -return ; - } - is_amd =1 ; - } - evsel_pmu =evsel__find_pmu (evsel);if (!evsel_pmu)return ;
tools/perf/arch/x86/util/mem-events.c +2 -17
@@ -4,6 +4,7 @@#include "map_symbol.h" #include "mem-events.h" #include "linux/string.h" +#include "env.h" static char mem_loads_name[100 ];static bool mem_loads_name__init;
@@ -26,28 +27,12 @@ static struct perf_mem_event perf_mem_events_amd[PERF_MEM_EVENTS__MAX] = { E("mem-ldst", "ibs_op//", "ibs_op"), }; -static int perf_mem_is_amd_cpu (void ) -{ -struct perf_env env = { .total_mem =0 , }; - -perf_env__cpuid (&env); -if (env.cpuid &&strstarts (env.cpuid,"AuthenticAMD" )) -return 1 ; -return -1 ; -} -struct perf_mem_event *perf_mem_events__ptr (int i) { -/* 0: Uninitialized, 1: Yes, -1: No */ -static int is_amd; -if (i >=PERF_MEM_EVENTS__MAX )return NULL ; -if (!is_amd) - is_amd =perf_mem_is_amd_cpu (); - -if (is_amd ==1 ) +if (x86__is_amd_cpu ())return &perf_mem_events_amd[i];return &perf_mem_events_intel[i];
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 379/431 perf tool x86: Fix perf_env memory leak
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
[ Upstream commit 99d4850062a84564f36923764bb93935ef2ed108 ]
Found by leak sanitizer:
```
==1632594==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 21 byte(s) in 1 object(s) allocated from:
#0 0x7f2953a7077b in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:439
#1 0x556701d6fbbf in perf_env__read_cpuid util/env.c:369
#2 0x556701d70589 in perf_env__cpuid util/env.c:465
#3 0x55670204bba2 in x86__is_amd_cpu arch/x86/util/env.c:14
#4 0x5567020487a2 in arch__post_evsel_config arch/x86/util/evsel.c:83
#5 0x556701d8f78b in evsel__config util/evsel.c:1366
#6 0x556701ef5872 in evlist__config util/record.c:108
#7 0x556701cd6bcd in test__PERF_RECORD tests/perf-record.c:112
#8 0x556701cacd07 in run_test tests/builtin-test.c:236
#9 0x556701cacfac in test_and_print tests/builtin-test.c:265
#10 0x556701cadddb in __cmd_test tests/builtin-test.c:402
#11 0x556701caf2aa in cmd_test tests/builtin-test.c:559
#12 0x556701d3b557 in run_builtin tools/perf/perf.c:323
#13 0x556701d3bac8 in handle_internal_command tools/perf/perf.c:377
#14 0x556701d3be90 in run_argv tools/perf/perf.c:421
#15 0x556701d3c3f8 in main tools/perf/perf.c:537
#16 0x7f2952a46189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: 21 byte(s) leaked in 1 allocation(s).
```--- tools/perf/arch/x86/util/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/env.c +1 -1
@@ -13,7 +13,7 @@ bool x86__is_amd_cpu(void)perf_env__cpuid (&env); is_amd = env.cpuid &&strstarts (env.cpuid,"AuthenticAMD" ) ?1 :-1 ; - +perf_env__exit (&env); ret:return is_amd >=1 ? true : false; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 380/431 powerpc/64s: Fix VAS mm use after free
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit b4bda59b47879cce38a6ec5a01cd3cac702b5331 ]
The refcount on mm is dropped before the coprocessor is detached.
--- arch/powerpc/platforms/powernv/vas-window.c | 2 +- arch/powerpc/platforms/pseries/vas.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/vas-window.c +1 -1
@@ -1310,8 +1310,8 @@ int vas_win_close(struct vas_window *vwin)/* if send window, drop reference to matching receive window */ if (window->tx_win) {if (window->user_win) { -put_vas_user_win_ref (&vwin->task_ref);mm_context_remove_vas_window (vwin->task_ref.mm); +put_vas_user_win_ref (&vwin->task_ref); }put_rx_win (window->rxwin); }
arch/powerpc/platforms/pseries/vas.c +1 -1
@@ -507,8 +507,8 @@ static int vas_deallocate_window(struct vas_window *vwin) vascaps[win->win_type].nr_open_windows--;mutex_unlock (&vas_pseries_mutex); -put_vas_user_win_ref (&vwin->task_ref);mm_context_remove_vas_window (vwin->task_ref.mm); +put_vas_user_win_ref (&vwin->task_ref);kfree (win);return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 381/431 pinctrl: freescale: Fix a memory out of bounds when num_configs is 1
In reply to Greg Kroah-HartmanFrom: Xiaolei Wang <[email protected]>
[ Upstream commit 9063777ca1e2e895c5fdd493ee0c3f18fa710ed4 ]
The config passed in by pad wakeup is 1, when num_configs is 1, Configuration [1] should not be fetched, which will be detected by KASAN as a memory out of bounds condition. Modify to get configs[1] when num_configs is 2.
--- drivers/pinctrl/freescale/pinctrl-scu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/freescale/pinctrl-scu.c +2 -1
@@ -90,7 +90,7 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,struct imx_sc_msg_req_pad_set msg;struct imx_sc_rpc_msg *hdr = &msg.hdr;unsigned int mux = configs[0 ]; -unsigned int conf = configs[1 ]; +unsigned int conf;unsigned int val;int ret;
@@ -115,6 +115,7 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id,* Set mux and conf together in one IPC call */ WARN_ON (num_configs !=2 ); + conf = configs[1 ]; val = conf |BM_PAD_CTL_IFMUX_ENABLE |BM_PAD_CTL_GP_ENABLE ; val |= mux <<BP_PAD_CTL_IFMUX ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 382/431 pinctrl: microchip-sgpio: check return value of devm_kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 310cd4c206cd04696ccbfd1927b5ab6973e8cc8e ]
devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pinctrl/pinctrl-microchip-sgpio.c +3 -0
@@ -818,6 +818,9 @@ static int microchip_sgpio_register_bank(struct device *dev, pctl_desc->name =devm_kasprintf (dev,GFP_KERNEL ,"%s-%sput" ,dev_name (dev), bank->is_input ?"in" :"out" ); +if (!pctl_desc->name) +return -ENOMEM ; + pctl_desc->pctlops = &sgpio_pctl_ops; pctl_desc->pmxops = &sgpio_pmx_ops; pctl_desc->confops = &sgpio_confops;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 383/431 pinctrl: at91-pio4: check return value of devm_kasprintf()
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit f6fd5d4ff8ca0b24cee1af4130bcb1fa96b61aa0 ]
devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
Depends-on: 1c4e5c470a56 ("pinctrl: at91: use devm_kasprintf() to avoid potential leaks")
Depends-on: 5a8f9cf269e8 ("pinctrl: at91-pio4: use proper format specifier for unsigned int")
--- drivers/pinctrl/pinctrl-at91-pio4.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-at91-pio4.c +2 -0
@@ -1151,6 +1151,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)/* Pin naming convention: P(bank_name)(bank_pin_number). */ pin_desc[i].name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"P%c%d" , bank +'A' , line); +if (!pin_desc[i].name) +return -ENOMEM ; group->name = group_names[i] = pin_desc[i].name; group->pin = pin_desc[i].number;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 384/431 perf stat: Reset aggr stats for each run
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
[ Upstream commit ed4090a22c123b9b33368741253edddc6ff8d18f ]
When it runs multiple times with -r option, it missed to reset the aggregation counters and the values were added up. The aggregation count has the values to be printed in the end. It should reset the counters at the beginning of each run. But the current code does that only when -I/--interval-print option is given.
--- tools/perf/builtin-stat.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/builtin-stat.c +2 -0
@@ -777,6 +777,8 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) all_counters_use_bpf = false; } +evlist__reset_aggr_stats (evsel_list); +evlist__for_each_cpu (evlist_cpu_itr, evsel_list, affinity) { counter = evlist_cpu_itr.evsel;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 385/431 scsi: ufs: core: Remove a ufshcd_add_command_trace() call
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 72554035b9797e00e68cd866e6cefa7f0b2c6f76 ]
ufshcd_add_command_trace() traces SCSI commands. Remove a ufshcd_add_command_trace() call from a code path that is not related to SCSI commands.
Stable-dep-of: 0fef6bb730c4 ("scsi: ufs: core: mcq: Fix the incorrect OCS value for the device command")
--- drivers/ufs/core/ufshcd.c | 1 - 1 file changed, 1 deletion(-)
drivers/ufs/core/ufshcd.c +0 -1
@@ -5420,7 +5420,6 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag, lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {if (hba->dev_cmd.complete) { hba->dev_cmd.cqe = cqe; -ufshcd_add_command_trace (hba, task_tag,UFS_DEV_COMP );complete (hba->dev_cmd.complete);ufshcd_clk_scaling_update_busy (hba); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 386/431 scsi: ufs: core: mcq: Fix the incorrect OCS value for the device command
In reply to Greg Kroah-HartmanFrom: Stanley Chu <[email protected]>
[ Upstream commit 0fef6bb730c490fcdc4347dbd21646d3ffe62cf5 ]
In MCQ mode, when a device command uses a hardware queue shared with other commands, a race condition may occur in the following scenario:
1. A device command is completed in CQx with CQE entry "e".
2. The interrupt handler copies the "cqe" pointer to "hba->dev_cmd.cqe"
and completes "hba->dev_cmd.complete".
3. The "ufshcd_wait_for_dev_cmd()" function is awakened and retrieves the
OCS value from "hba->dev_cmd.cqe".
However, there is a possibility that the CQE entry "e" will be overwritten by newly completed commands in CQx, resulting in an incorrect OCS value being received by "ufshcd_wait_for_dev_cmd()".
To avoid this race condition, the OCS value should be immediately copied to the struct "lrb" of the device command. Then "ufshcd_wait_for_dev_cmd()" can retrieve the OCS value from the struct "lrb".
--- drivers/ufs/core/ufshcd.c | 10 +++++++--- include/ufs/ufshcd.h | 1 - 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/ufs/core/ufshcd.c +7 -3
@@ -3069,7 +3069,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,* not trigger any race conditions. */ hba->dev_cmd.complete =NULL ; - err =ufshcd_get_tr_ocs (lrbp, hba->dev_cmd.cqe); + err =ufshcd_get_tr_ocs (lrbp,NULL );if (!err) err =ufshcd_dev_cmd_completion (hba, lrbp); }else {
@@ -3156,7 +3156,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, goto out; hba->dev_cmd.complete = &wait; - hba->dev_cmd.cqe =NULL ;ufshcd_add_query_upiu_trace (hba,UFS_QUERY_SEND , lrbp->ucd_req_ptr);
@@ -5404,6 +5403,7 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag, {struct ufshcd_lrb *lrbp;struct scsi_cmnd *cmd; +enum utp_ocs ocs; lrbp = &hba->lrb[task_tag]; lrbp->compl_time_stamp =ktime_get ();
@@ -5419,7 +5419,11 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag, }else if (lrbp->command_type ==UTP_CMD_TYPE_DEV_MANAGE || lrbp->command_type ==UTP_CMD_TYPE_UFS_STORAGE ) {if (hba->dev_cmd.complete) { - hba->dev_cmd.cqe = cqe; +if (cqe) { + ocs =le32_to_cpu (cqe->status) &MASK_OCS ; + lrbp->utr_descriptor_ptr->header.dword_2 = +cpu_to_le32 (ocs); + }complete (hba->dev_cmd.complete);ufshcd_clk_scaling_update_busy (hba); }
include/ufs/ufshcd.h +0 -1
@@ -225,7 +225,6 @@ struct ufs_dev_cmd {struct mutex lock;struct completion *complete;struct ufs_query query; -struct cq_entry *cqe; };/**
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 387/431 powerpc/powernv/sriov: perform null check on iov before dereferencing iov
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit f4f913c980bc6abe0ccfe88fe3909c125afe4a2d ]
Currently pointer iov is being dereferenced before the null check of iov which can lead to null pointer dereference errors. Fix this by moving the iov null check before the dereferencing.
Detected using cppcheck static analysis:linux/arch/powerpc/platforms/powernv/pci-sriov.c:597:12: warning: Either the condition '!iov' is redundant or there is possible null pointer
dereference: iov. [nullPointerRedundantCheck]
num_vfs = iov->num_vfs;
^--- arch/powerpc/platforms/powernv/pci-sriov.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/platforms/powernv/pci-sriov.c +3 -3
@@ -594,12 +594,12 @@ static void pnv_pci_sriov_disable(struct pci_dev *pdev)struct pnv_iov_data *iov; iov =pnv_iov_get (pdev); - num_vfs = iov->num_vfs; - base_pe = iov->vf_pe_arr[0 ].pe_number; -if (WARN_ON (!iov))return ; + num_vfs = iov->num_vfs; + base_pe = iov->vf_pe_arr[0 ].pe_number; +/* Release VF PEs */ pnv_ioda_release_vf_PE (pdev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 388/431 powerpc: update ppc_save_regs to save current r1 in pt_regs
In reply to Greg Kroah-HartmanFrom: Aditya Gupta <[email protected]>
[ Upstream commit b684c09f09e7a6af3794d4233ef785819e72db79 ]
ppc_save_regs() skips one stack frame while saving the CPU register states. Instead of saving current R1, it pulls the previous stack frame pointer.
When vmcores caused by direct panic call (such as echo c > /proc/sysrq-trigger), are debugged with gdb, gdb fails to show the backtrace correctly. On further analysis, it was found that it was because of mismatch between r1 and NIP.
GDB uses NIP to get current function symbol and uses corresponding debug info of that function to unwind previous frames, but due to the mismatching r1 and NIP, the unwinding does not work, and it fails to unwind to the 2nd frame and hence does not show the backtrace.
GDB backtrace with vmcore of kernel without this patch:
---------
(gdb) bt
#0 0xc0000000002a53e8 in crash_setup_regs (oldregs=<optimized out>,
newregs=0xc000000004f8f8d8) at ./arch/powerpc/include/asm/kexec.h:69 #1 __crash_kexec (regs=<optimized out>) at kernel/kexec_core.c:974 #2 0x0000000000000063 in ?? () #3 0xc000000003579320 in ?? ()
---------
Further analysis revealed that the mismatch occurred because "ppc_save_regs" was saving the previous stack's SP instead of the current r1. This patch fixes this by storing current r1 in the saved pt_regs.
GDB backtrace with vmcore of patched kernel:
--------
(gdb) bt
#0 0xc0000000002a53e8 in crash_setup_regs (oldregs=0x0, newregs=0xc00000000670b8d8)
at ./arch/powerpc/include/asm/kexec.h:69
#1 __crash_kexec (regs=regs@entry=0x0) at kernel/kexec_core.c:974
#2 0xc000000000168918 in panic (fmt=fmt@entry=0xc000000001654a60 "sysrq triggered crash\n")
at kernel/panic.c:358
#3 0xc000000000b735f8 in sysrq_handle_crash (key=<optimized out>) at drivers/tty/sysrq.c:155
#4 0xc000000000b742cc in __handle_sysrq (key=key@entry=99, check_mask=check_mask@entry=false)
at drivers/tty/sysrq.c:602
#5 0xc000000000b7506c in write_sysrq_trigger (file=<optimized out>, buf=<optimized out>,
count=2, ppos=<optimized out>) at drivers/tty/sysrq.c:1163
#6 0xc00000000069a7bc in pde_write (ppos=<optimized out>, count=<optimized out>,
buf=<optimized out>, file=<optimized out>, pde=0xc00000000362cb40) at fs/proc/inode.c:340
#7 proc_reg_write (file=<optimized out>, buf=<optimized out>, count=<optimized out>,
ppos=<optimized out>) at fs/proc/inode.c:352
#8 0xc0000000005b3bbc in vfs_write (file=file@entry=0xc000000006aa6b00,
buf=buf@entry=0x61f498b4f60 <error: Cannot access memory at address 0x61f498b4f60>,
count=count@entry=2, pos=pos@entry=0xc00000000670bda0) at fs/read_write.c:582
#9 0xc0000000005b4264 in ksys_write (fd=<optimized out>,
buf=0x61f498b4f60 <error: Cannot access memory at address 0x61f498b4f60>, count=2)
at fs/read_write.c:637
#10 0xc00000000002ea2c in system_call_exception (regs=0xc00000000670be80, r0=<optimized out>)
at arch/powerpc/kernel/syscall.c:171
#11 0xc00000000000c270 in system_call_vectored_common ()
at arch/powerpc/kernel/interrupt_64.S:192--------
Nick adds:
So this now saves regs as though it was an interrupt taken in the caller, at the instruction after the call to ppc_save_regs, whereas previously the NIP was there, but R1 came from the caller's caller and that mismatch is what causes gdb's dwarf unwinder to go haywire.
--- arch/powerpc/kernel/ppc_save_regs.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/ppc_save_regs.S +3 -3
@@ -31,10 +31,10 @@ _GLOBAL(ppc_save_regs) lbz r0,PACAIRQSOFTMASK(r13) PPC_STL r0,SOFTE(r3) #endif - /* go up one stack frame for SP */ - PPC_LL r4,0(r1) - PPC_STL r4,GPR1(r3) + /* store current SP */ + PPC_STL r1,GPR1(r3) /* get caller's LR */ + PPC_LL r4,0(r1) PPC_LL r0,LRSAVE(r4) PPC_STL r0,_LINK(r3) mflr r0
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 389/431 platform/x86:intel/pmc: Update maps for Meteor Lake P/M platforms
In reply to Greg Kroah-HartmanFrom: Xi Pardee <[email protected]>
[ Upstream commit 9682cfd1973d01e43c2764c662e6d3291ddf770d ]
Fix the IP name errors in the register maps used by the following debugfs attributes in the Meteor Lake SOC-M PMC.
pfear_stslpm_stsltr_show
--- drivers/platform/x86/intel/pmc/core.h | 28 +- drivers/platform/x86/intel/pmc/mtl.c | 448 +++++++++++++++++++++++++- 2 files changed, 466 insertions(+), 10 deletions(-)
drivers/platform/x86/intel/pmc/core.h +27 -1
@@ -247,6 +247,14 @@ enum ppfear_regs {#define MTL_LPM_STATUS_LATCH_EN_OFFSET 0x16F8#define MTL_LPM_STATUS_OFFSET 0x1700#define MTL_LPM_LIVE_STATUS_OFFSET 0x175C +#define MTL_PMC_LTR_IOE_PMC 0x1C0C +#define MTL_PMC_LTR_ESE 0x1BAC +#define MTL_SOCM_NUM_IP_IGN_ALLOWED 25 +#define MTL_SOC_PMC_MMIO_REG_LEN 0x2708 +#define MTL_PMC_LTR_SPG 0x1B74 + +/* Meteor Lake PGD PFET Enable Ack Status */ +#define MTL_SOCM_PPFEAR_NUM_ENTRIES 8extern const char *pmc_lpm_modes[];
@@ -393,7 +401,25 @@ extern const struct pmc_bit_map adl_vnn_req_status_3_map[];extern const struct pmc_bit_map adl_vnn_misc_status_map[];extern const struct pmc_bit_map *adl_lpm_maps[];extern const struct pmc_reg_map adl_reg_map; -extern const struct pmc_reg_map mtl_reg_map; +extern const struct pmc_bit_map mtl_socm_pfear_map[]; +extern const struct pmc_bit_map *ext_mtl_socm_pfear_map[]; +extern const struct pmc_bit_map mtl_socm_ltr_show_map[]; +extern const struct pmc_bit_map mtl_socm_clocksource_status_map[]; +extern const struct pmc_bit_map mtl_socm_power_gating_status_0_map[]; +extern const struct pmc_bit_map mtl_socm_power_gating_status_1_map[]; +extern const struct pmc_bit_map mtl_socm_power_gating_status_2_map[]; +extern const struct pmc_bit_map mtl_socm_d3_status_0_map[]; +extern const struct pmc_bit_map mtl_socm_d3_status_1_map[]; +extern const struct pmc_bit_map mtl_socm_d3_status_2_map[]; +extern const struct pmc_bit_map mtl_socm_d3_status_3_map[]; +extern const struct pmc_bit_map mtl_socm_vnn_req_status_0_map[]; +extern const struct pmc_bit_map mtl_socm_vnn_req_status_1_map[]; +extern const struct pmc_bit_map mtl_socm_vnn_req_status_2_map[]; +extern const struct pmc_bit_map mtl_socm_vnn_req_status_3_map[]; +extern const struct pmc_bit_map mtl_socm_vnn_misc_status_map[]; +extern const struct pmc_bit_map mtl_socm_signal_status_map[]; +extern const struct pmc_bit_map *mtl_socm_lpm_maps[]; +extern const struct pmc_reg_map mtl_socm_reg_map;extern void pmc_core_get_tgl_lpm_reqs (struct platform_device *pdev);extern int pmc_core_send_ltr_ignore (struct pmc_dev *pmcdev,u32 value);
drivers/platform/x86/intel/pmc/mtl.c +439 -9
473 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 390/431 riscv: uprobes: Restore thread.bad_cause
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 58b1294dd1d65bb62f08dddbf418f954210c2057 ]
thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation is meaningless, this change is similar with x86 and powerpc.
--- arch/riscv/kernel/probes/uprobes.c | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/kernel/probes/uprobes.c +2 -0
@@ -67,6 +67,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)struct uprobe_task *utask = current->utask;WARN_ON_ONCE (current->thread.bad_cause !=UPROBE_TRAP_NR ); + current->thread.bad_cause = utask->autask.saved_cause;instruction_pointer_set (regs, utask->vaddr + auprobe->insn_size);
@@ -102,6 +103,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) {struct uprobe_task *utask = current->utask; + current->thread.bad_cause = utask->autask.saved_cause;/* * Task has received a fatal signal, so reset back to probbed * address.
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 391/431 powerpc/book3s64/mm: Fix DirectMap stats in /proc/meminfo
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
[ Upstream commit 0da90af431abc3f497a38ec9ef6e43b0d0dabe80 ]
On memory unplug reduce DirectMap page count correctly.
root@ubuntu-guest:# grep Direct /proc/meminfo DirectMap4k: 0 kB DirectMap64k: 0 kB DirectMap2M: 115343360 kB DirectMap1G: 0 kB
Before fix:
root@ubuntu-guest:# ndctl disable-namespace all disabled 1 namespace root@ubuntu-guest:# grep Direct /proc/meminfo DirectMap4k: 0 kB DirectMap64k: 0 kB DirectMap2M: 115343360 kB DirectMap1G: 0 kB
After fix:
root@ubuntu-guest:# ndctl disable-namespace all disabled 1 namespace root@ubuntu-guest:# grep Direct /proc/meminfo DirectMap4k: 0 kB DirectMap64k: 0 kB DirectMap2M: 104857600 kB DirectMap1G: 0 kB
--- arch/powerpc/mm/book3s64/radix_pgtable.c | 34 +++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-)
arch/powerpc/mm/book3s64/radix_pgtable.c +22 -12
@@ -745,9 +745,9 @@ static void free_pud_table(pud_t *pud_start, p4d_t *p4d) }static void remove_pte_table (pte_t *pte_start,unsigned long addr, -unsigned long end) +unsigned long end,bool direct) { -unsigned long next; +unsigned long next, pages =0 ;pte_t *pte; pte = pte_start +pte_index (addr);
@@ -769,13 +769,16 @@ static void remove_pte_table(pte_t *pte_start, unsigned long addr, }pte_clear (&init_mm, addr, pte); + pages++; } +if (direct) +update_page_count (mmu_virtual_psize, -pages); }static void __meminit remove_pmd_table (pmd_t *pmd_start,unsigned long addr, -unsigned long end) +unsigned long end,bool direct) { -unsigned long next; +unsigned long next, pages =0 ;pte_t *pte_base;pmd_t *pmd;
@@ -793,19 +796,22 @@ static void __meminit remove_pmd_table(pmd_t *pmd_start, unsigned long addr,continue ; }pte_clear (&init_mm, addr, (pte_t *)pmd); + pages++;continue ; } pte_base = (pte_t *)pmd_page_vaddr (*pmd); -remove_pte_table (pte_base, addr, next); +remove_pte_table (pte_base, addr, next, direct);free_pte_table (pte_base, pmd); } +if (direct) +update_page_count (MMU_PAGE_2M , -pages); }static void __meminit remove_pud_table (pud_t *pud_start,unsigned long addr, -unsigned long end) +unsigned long end,bool direct) { -unsigned long next; +unsigned long next, pages =0 ;pmd_t *pmd_base;pud_t *pud;
@@ -823,16 +829,20 @@ static void __meminit remove_pud_table(pud_t *pud_start, unsigned long addr,continue ; }pte_clear (&init_mm, addr, (pte_t *)pud); + pages++;continue ; } pmd_base =pud_pgtable (*pud); -remove_pmd_table (pmd_base, addr, next); +remove_pmd_table (pmd_base, addr, next, direct);free_pmd_table (pmd_base, pud); } +if (direct) +update_page_count (MMU_PAGE_1G , -pages); } -static void __meminit remove_pagetable (unsigned long start,unsigned long end) +static void __meminit remove_pagetable (unsigned long start,unsigned long end, +bool direct) {unsigned long addr, next;pud_t *pud_base;
@@ -861,7 +871,7 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end) } pud_base =p4d_pgtable (*p4d); -remove_pud_table (pud_base, addr, next); +remove_pud_table (pud_base, addr, next, direct);free_pud_table (pud_base, p4d); }
@@ -884,7 +894,7 @@ int __meminit radix__create_section_mapping(unsigned long start,int __meminit radix__remove_section_mapping (unsigned long start,unsigned long end) { -remove_pagetable (start, end); +remove_pagetable (start, end, true);return 0 ; }#endif /* CONFIG_MEMORY_HOTPLUG */
@@ -920,7 +930,7 @@ int __meminit radix__vmemmap_create_mapping(unsigned long start,#ifdef CONFIG_MEMORY_HOTPLUG void __meminit radix__vmemmap_remove_mapping (unsigned long start,unsigned long page_size) { -remove_pagetable (start, start + page_size); +remove_pagetable (start, start + page_size, false); }#endif #endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 392/431 powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
[ Upstream commit c8eebc4a99f15280654f23e914e746c40a516e50 ]
Without this fix, the last subsection vmemmap can end up in memory even if the namespace is created with -M mem and has sufficient space in the altmap area.
--- arch/powerpc/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/init_64.c +1 -1
@@ -189,7 +189,7 @@ static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long starunsigned long nr_pfn = page_size /sizeof (struct page );unsigned long start_pfn =page_to_pfn ((struct page *)start); -if ((start_pfn + nr_pfn) > altmap->end_pfn) +if ((start_pfn + nr_pfn -1 ) > altmap->end_pfn)return true;if (start_pfn < altmap->base_pfn)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 393/431 perf test: Set PERF_EXEC_PATH for script execution
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
[ Upstream commit e4ef3ef1bc0a3d2535427da78b8095ef657eb474 ]
The task-analyzer.py script (actually every other scripts too) requires PERF_EXEC_PATH env to find dependent libraries and scripts. For scripts test to run correctly, it needs to set PERF_EXEC_PATH to the perf tool source directory.
Instead of blindly update the env, let's check the directory structure to make sure it points to the correct location.
--- tools/perf/tests/shell/test_task_analyzer.sh | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/tests/shell/test_task_analyzer.sh +6 -0
@@ -5,6 +5,12 @@ tmpdir=$(mktemp -d /tmp/perf-script-task-analyzer-XXXXX) err=0 +# set PERF_EXEC_PATH to find scripts in the source directory +perfdir=$(dirname "$0")/../.. +if [ -e "$perfdir/scripts/python/Perf-Trace-Util" ]; then + export PERF_EXEC_PATH=$perfdir +fi + cleanup() { rm -f perf.data rm -f perf.data.old
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 394/431 PCI: endpoint: Fix a Kconfig prompt of vNTB driver
In reply to Greg Kroah-HartmanFrom: Shunsuke Mie <[email protected]>
[ Upstream commit 37587673cda963ec950e4983db5023802f9b5ff2 ]
vNTB driver and NTB driver have same Kconfig prompt. Changed to make it distinguishable.
--- drivers/pci/endpoint/functions/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/Kconfig +1 -1
@@ -27,7 +27,7 @@ config PCI_EPF_NTB If in doubt, say "N" to disable Endpoint NTB driver. config PCI_EPF_VNTB - tristate "PCI Endpoint NTB driver" + tristate "PCI Endpoint Virtual NTB driver" depends on PCI_ENDPOINT depends on NTB select CONFIGFS_FS
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 395/431 PCI: endpoint: functions/pci-epf-test: Fix dma_chan direction
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit 880d51c729a3fa944794feb19f605eefe55916fc ]
In pci_epf_test_init_dma_chan() epf_test->dma_chan_rx is assigned from dma_request_channel() with DMA_DEV_TO_MEM as filter.dma_mask.
However, in pci_epf_test_data_transfer() if the dir is DMA_DEV_TO_MEM, epf->dma_chan_rx should be used but instead we are using epf_test->dma_chan_tx.
Fix it.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-test.c +1 -1
@@ -112,7 +112,7 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, size_t len, dma_addr_t dma_remote, enum dma_transfer_direction dir) { - struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ? + struct dma_chan *chan = (dir == DMA_MEM_TO_DEV) ? epf_test->dma_chan_tx : epf_test->dma_chan_rx;dma_addr_t dma_local = (dir ==DMA_MEM_TO_DEV ) ? dma_src : dma_dst;enum dma_ctrl_flags flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 396/431 PCI: vmd: Fix uninitialized variable usage in vmd_enable_domain()
In reply to Greg Kroah-HartmanFrom: Xinghui Li <[email protected]>
[ Upstream commit 0c0206dc4f5ba2d18b15e24d2047487d6f73916b ]
The ret variable in the vmd_enable_domain() function was used uninitialized when printing a warning message upon failure of the pci_reset_bus() function.
Thus, fix the issue by assigning ret with the value returned from pci_reset_bus() before referencing it in the warning message.
This was detected by Smatch:
drivers/pci/controller/vmd.c:931 vmd_enable_domain() error: uninitialized symbol 'ret'.
[kwilczynski: drop the second patch from the series, add missing reported by tag, commit log]
--- drivers/pci/controller/vmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/vmd.c +2 -1
@@ -927,7 +927,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)if (!list_empty (&child->devices)) { dev =list_first_entry (&child->devices, struct pci_dev, bus_list); -if (pci_reset_bus (dev)) + ret =pci_reset_bus (dev); +if (ret)pci_warn (dev,"can't reset device: %d\n" , ret);break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 397/431 vfio/mdev: Move the compat_class initialization to module init
In reply to Greg Kroah-HartmanFrom: Eric Farman <[email protected]>
[ Upstream commit ff598081e5b9d0bdd6874bfe340811bbb75b35e4 ]
The pointer to mdev_bus_compat_class is statically defined at the top of mdev_core, and was originally (commit 7b96953bc640 ("vfio: Mediated device Core driver") serialized by the parent_list_lock. The blamed commit removed this mutex, leaving the pointer initialization unserialized. As a result, the creation of multiple MDEVs in parallel (such as during boot) can encounter errors during the creation of the sysfs entries, such as:
[ 8.337509] sysfs: cannot create duplicate filename '/class/mdev_bus' [ 8.337514] vfio_ccw 0.0.01d8: MDEV: Registered [ 8.337516] CPU: 13 PID: 946 Comm: driverctl Not tainted 6.4.0-rc7 #20 [ 8.337522] Hardware name: IBM 3906 M05 780 (LPAR) [ 8.337525] Call Trace: [ 8.337528] [<0000000162b0145a>] dump_stack_lvl+0x62/0x80 [ 8.337540] [<00000001622aeb30>] sysfs_warn_dup+0x78/0x88 [ 8.337549] [<00000001622aeca6>] sysfs_create_dir_ns+0xe6/0xf8 [ 8.337552] [<0000000162b04504>] kobject_add_internal+0xf4/0x340 [ 8.337557] [<0000000162b04d48>] kobject_add+0x78/0xd0 [ 8.337561] [<0000000162b04e0a>] kobject_create_and_add+0x6a/0xb8 [ 8.337565] [<00000001627a110e>] class_compat_register+0x5e/0x90 [ 8.337572] [<000003ff7fd815da>] mdev_register_parent+0x102/0x130 [mdev] [ 8.337581] [<000003ff7fdc7f2c>] vfio_ccw_sch_probe+0xe4/0x178 [vfio_ccw] [ 8.337588] [<0000000162a7833c>] css_probe+0x44/0x80 [ 8.337599] [<000000016279f4da>] really_probe+0xd2/0x460 [ 8.337603] [<000000016279fa08>] driver_probe_device+0x40/0xf0 [ 8.337606] [<000000016279fb78>] __device_attach_driver+0xc0/0x140 [ 8.337610] [<000000016279cbe0>] bus_for_each_drv+0x90/0xd8 [ 8.337618] [<00000001627a00b0>] __device_attach+0x110/0x190 [ 8.337621] [<000000016279c7c8>] bus_rescan_devices_helper+0x60/0xb0 [ 8.337626] [<000000016279cd48>] drivers_probe_store+0x48/0x80 [ 8.337632] [<00000001622ac9b0>] kernfs_fop_write_iter+0x138/0x1f0 [ 8.337635] [<00000001621e5e14>] vfs_write+0x1ac/0x2f8 [ 8.337645] [<00000001621e61d8>] ksys_write+0x70/0x100 [ 8.337650] [<0000000162b2bdc4>] __do_syscall+0x1d4/0x200 [ 8.337656] [<0000000162b3c828>] system_call+0x70/0x98 [ 8.337664] kobject: kobject_add_internal failed for mdev_bus with -EEXIST, don't try to register things with the same name in the same directory. [ 8.337668] kobject: kobject_create_and_add: kobject_add error: -17 [ 8.337674] vfio_ccw: probe of 0.0.01d9 failed with error -12 [ 8.342941] vfio_ccw_mdev aeb9ca91-10c6-42bc-a168-320023570aea: Adding to iommu group 2
Move the initialization of the mdev_bus_compat_class pointer to the init path, to match the cleanup in module exit. This way the code in mdev_register_parent() can simply link the new parent to it, rather than determining whether initialization is required first.
--- drivers/vfio/mdev/mdev_core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/vfio/mdev/mdev_core.c +14 -9
@@ -72,12 +72,6 @@ int mdev_register_parent(struct mdev_parent *parent, struct device *dev, parent->nr_types = nr_types;atomic_set (&parent->available_instances, mdev_driver->max_instances); -if (!mdev_bus_compat_class) { - mdev_bus_compat_class =class_compat_register ("mdev_bus" ); -if (!mdev_bus_compat_class) -return -ENOMEM ; - } - ret =parent_create_sysfs_files (parent);if (ret)return ret;
@@ -251,13 +245,24 @@ int mdev_device_remove(struct mdev_device *mdev)static int __init mdev_init (void ) { -return bus_register (&mdev_bus_type); +int ret; + + ret =bus_register (&mdev_bus_type); +if (ret) +return ret; + + mdev_bus_compat_class =class_compat_register ("mdev_bus" ); +if (!mdev_bus_compat_class) { +bus_unregister (&mdev_bus_type); +return -ENOMEM ; + } + +return 0 ; } static void __exit mdev_exit(void) { -if (mdev_bus_compat_class) -class_compat_unregister (mdev_bus_compat_class); +class_compat_unregister (mdev_bus_compat_class);bus_unregister (&mdev_bus_type); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 398/431 hwrng: virtio - Fix race on data_avail and actual data
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit ac52578d6e8d300dd50f790f29a24169b1edd26c ]
The virtio rng device kicks off a new entropy request whenever the data available reaches zero. When a new request occurs at the end of a read operation, that is, when the result of that request is only needed by the next reader, then there is a race between the writing of the new data and the next reader.
This is because there is no synchronisation whatsoever between the writer and the reader.
Fix this by writing data_avail with smp_store_release and reading it with smp_load_acquire when we first enter read. The subsequent reads are safe because they're either protected by the first load acquire, or by the completion mechanism.
Also remove the redundant zeroing of data_idx in random_recv_done (data_idx must already be zero at this point) and data_avail in request_entropy (ditto).
--- drivers/char/hw_random/virtio-rng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/char/hw_random/virtio-rng.c +5 -5
@@ -4,6 +4,7 @@* Copyright (C) 2007, 2008 Rusty Russell IBM Corporation */ +#include <asm/barrier.h> #include <linux/err.h> #include <linux/hw_random.h> #include <linux/scatterlist.h>
@@ -37,13 +38,13 @@ struct virtrng_info {static void random_recv_done (struct virtqueue *vq) {struct virtrng_info *vi = vq->vdev->priv; +unsigned int len;/* We can get spurious callbacks, e.g. shared IRQs + virtio_pci. */ -if (!virtqueue_get_buf (vi->vq, &vi->data_avail)) +if (!virtqueue_get_buf (vi->vq, &len))return ; - vi->data_idx =0 ; - +smp_store_release (&vi->data_avail, len);complete (&vi->have_data); }
@@ -52,7 +53,6 @@ static void request_entropy(struct virtrng_info *vi)struct scatterlist sg;reinit_completion (&vi->have_data); - vi->data_avail =0 ; vi->data_idx =0 ;sg_init_one (&sg, vi->data,sizeof (vi->data));
@@ -88,7 +88,7 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) read =0 ;/* copy available data */ -if (vi->data_avail) { +if (smp_load_acquire (&vi->data_avail)) { chunk =copy_data (vi, buf, size); size -= chunk; read += chunk;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 399/431 modpost: remove broken calculation of exception_table_entry size
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit d0acc76a49aa917c1a455d11d32d34a01e8b2835 ]
find_extable_entry_size() is completely broken. It has awesome comments about how to calculate sizeof(struct exception_table_entry).
It was based on these assumptions:
- struct exception_table_entry has two fields
- both of the fields have the same size
Then, we came up with this equation:
(offset of the second field) * 2 == (size of struct)
It was true for all architectures when commit 52dc0595d540 ("modpost:
handle relocations mismatch in __ex_table.") was applied.
Our mathematics broke when commit 548acf19234d ("x86/mm: Expand the exception table logic to allow new handling options") introduced the third field.
Now, the definition of exception_table_entry is highly arch-dependent.
For x86, sizeof(struct exception_table_entry) is apparently 12, but find_extable_entry_size() sets extable_entry_size to 8.
I could fix it, but I do not see much value in this code.
extable_entry_size is used just for selecting a slightly different error message.
If the first field ("insn") references to a non-executable section,
The relocation at %s+0x%lx references section "%s" which is not executable, IOW it is not possible for the kernel to fault at that address. Something is seriously wrong and should be fixed.
If the second field ("fixup") references to a non-executable section,
The relocation at %s+0x%lx references
section "%s" which is not executable, IOW
the kernel will fault if it ever tries to
jump to it. Something is seriously wrong
and should be fixed.
Merge the two error messages rather than adding even more complexity.
Change fatal() to error() to make it continue running and catch more possible errors.
--- scripts/mod/modpost.c | 60 +++---------------------------------------- 1 file changed, 3 insertions(+), 57 deletions(-)
scripts/mod/modpost.c +3 -57
@@ -1298,43 +1298,6 @@ static int is_executable_section(struct elf_info* elf, unsigned int section_indereturn ((elf->sechdrs[section_index].sh_flags &SHF_EXECINSTR ) ==SHF_EXECINSTR ); } -/* -* We rely on a gross hack in section_rel[a]() calling find_extable_entry_size() -* to know the sizeof(struct exception_table_entry) for the target architecture. -*/ -static unsigned int extable_entry_size =0 ; -static void find_extable_entry_size (const char *const sec,const Elf_Rela * r) -{ -/* -* If we're currently checking the second relocation within __ex_table, -* that relocation offset tells us the offsetof(struct -* exception_table_entry, fixup) which is equal to sizeof(struct -* exception_table_entry) divided by two. We use that to our advantage -* since there's no portable way to get that size as every architecture -* seems to go with different sized types. Not pretty but better than -* hard-coding the size for every architecture.. -*/ -if (!extable_entry_size) - extable_entry_size = r->r_offset *2 ; -} - -static inline bool is_extable_fault_address (Elf_Rela *r) -{ -/* -* extable_entry_size is only discovered after we've handled the -* _second_ relocation in __ex_table, so only abort when we're not -* handling the first reloc and extable_entry_size is zero. -*/ -if (r->r_offset && extable_entry_size ==0 ) -fatal ("extable_entry size hasn't been discovered!\n" ); - -return ((r->r_offset ==0 ) || - (r->r_offset % extable_entry_size ==0 )); -} - -#define is_second_extable_reloc (Start, Cur, Sec) \ - (((Cur) == (Start) + 1) && (strcmp("__ex_table", (Sec)) == 0)) - static void report_extable_warnings(const char* modname, struct elf_info* elf, const struct sectioncheck* const mismatch, Elf_Rela* r, Elf_Sym* sym,
@@ -1390,22 +1353,9 @@ static void extable_mismatch_handler(const char* modname, struct elf_info *elf,"You might get more information about where this is\n" "coming from by using scripts/check_extable.sh %s\n" , fromsec, (long)r->r_offset, tosec, modname); - else if (!is_executable_section(elf, get_secindex(elf, sym))) { -if (is_extable_fault_address (r)) -fatal ("The relocation at %s+0x%lx references\n" -"section \"%s\" which is not executable, IOW\n" -"it is not possible for the kernel to fault\n" -"at that address. Something is seriously wrong\n" -"and should be fixed.\n" , - fromsec, (long )r->r_offset, tosec); -else -fatal ("The relocation at %s+0x%lx references\n" -"section \"%s\" which is not executable, IOW\n" -"the kernel will fault if it ever tries to\n" -"jump to it. Something is seriously wrong\n" -"and should be fixed.\n" , - fromsec, (long )r->r_offset, tosec); - } + else if (!is_executable_section(elf, get_secindex(elf, sym))) + error("%s+0x%lx references non-executable section '%s'\n", + fromsec, (long)r->r_offset, tosec); } static void check_section_mismatch(const char *modname, struct elf_info *elf,
@@ -1580,8 +1530,6 @@ static void section_rela(const char *modname, struct elf_info *elf,/* Skip special sections */ if (is_shndx_special (sym->st_shndx))continue ; -if (is_second_extable_reloc (start, rela, fromsec)) -find_extable_entry_size (fromsec, &r);check_section_mismatch (modname, elf, &r, sym, fromsec); } }
@@ -1639,8 +1587,6 @@ static void section_rel(const char *modname, struct elf_info *elf,/* Skip special sections */ if (is_shndx_special (sym->st_shndx))continue ; -if (is_second_extable_reloc (start, rel, fromsec)) -find_extable_entry_size (fromsec, &r);check_section_mismatch (modname, elf, &r, sym, fromsec); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 400/431 crypto: nx - fix build warnings when DEBUG_FS is not enabled
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]
Fix build warnings when DEBUG_FS is not enabled by using an empty do-while loop instead of a value:
In file included from ../drivers/crypto/nx/nx.c:27:../drivers/crypto/nx/nx.c: In function 'nx_register_algs':../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect [-Wunused-value]
173 | #define NX_DEBUGFS_INIT(drv) (0)../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
573 | NX_DEBUGFS_INIT(&nx_driver);../drivers/crypto/nx/nx.c: In function 'nx_remove':../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect [-Wunused-value]
174 | #define NX_DEBUGFS_FINI(drv) (0)../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
793 | NX_DEBUGFS_FINI(&nx_driver);
Also, there is no need to build nx_debugfs.o when DEBUG_FS is not enabled, so change the Makefile to accommodate that.
--- drivers/crypto/nx/Makefile | 2 +- drivers/crypto/nx/nx.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/nx/Makefile +1 -1
@@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o nx-crypto-objs := nx.o \ - nx_debugfs.o \ nx-aes-cbc.o \ nx-aes-ecb.o \ nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \ nx-sha256.o \ nx-sha512.o +nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o nx-compress.o obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o nx-compress.o nx-compress-objs := nx-842.o
drivers/crypto/nx/nx.h +2 -2
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int,void nx_debugfs_init (struct nx_crypto_driver *);void nx_debugfs_fini (struct nx_crypto_driver *);#else -#define NX_DEBUGFS_INIT (drv) (0) -#define NX_DEBUGFS_FINI (drv) (0) +#define NX_DEBUGFS_INIT (drv) do {} while (0) +#define NX_DEBUGFS_FINI (drv) do {} while (0)#endif #define NX_PAGE_NUM (x) ((u64)(x) & 0xfffffffffffff000ULL)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 401/431 modpost: fix section mismatch message for R_ARM_ABS32
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit b7c63520f6703a25eebb4f8138fed764fcae1c6f ]
addend_arm_rel() processes R_ARM_ABS32 in a wrong way.
Here, test code.
[test code 1]
#include <linux/init.h>
int __initdata foo;
int get_foo(void) { return foo; }If you compile it with ARM versatile_defconfig, modpost will show the symbol name, (unknown).
WARNING: modpost: vmlinux.o: section mismatch in reference: get_foo (section: .text) -> (unknown) (section: .init.data)
(You need to use GNU linker instead of LLD to reproduce it.)
If you compile it for other architectures, modpost will show the correct symbol name.
WARNING: modpost: vmlinux.o: section mismatch in reference: get_foo (section: .text) -> foo (section: .init.data)
For R_ARM_ABS32, addend_arm_rel() sets r->r_addend to a wrong value.
I just mimicked the code in arch/arm/kernel/module.c.
However, there is more difficulty for ARM.
Here, test code.
[test code 2]
#include <linux/init.h>
int __initdata foo;
int get_foo(void) { return foo; }
int __initdata bar;
int get_bar(void) { return bar; }With this commit applied, modpost will show the following messages for ARM versatile_defconfig:
WARNING: modpost: vmlinux.o: section mismatch in reference: get_foo (section: .text) -> foo (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: get_bar (section: .text) -> foo (section: .init.data)
The reference from 'get_bar' to 'foo' seems wrong.
I have no solution for this because it is true in assembly level.
In the following output, relocation at 0x1c is no longer associated with 'bar'. The two relocation entries point to the same symbol, and the offset to 'bar' is encoded in the instruction 'r0, [r3, #4]'.
Disassembly of section .text:
00000000 <get_foo>:
0: e59f3004 ldr r3, [pc, #4] @ c <get_foo+0xc>
4: e5930000 ldr r0, [r3]
8: e12fff1e bx lr
c: 00000000 .word 0x00000000 00000010 <get_bar>:
10: e59f3004 ldr r3, [pc, #4] @ 1c <get_bar+0xc>
14: e5930004 ldr r0, [r3, #4]
18: e12fff1e bx lr
1c: 00000000 .word 0x00000000 Relocation section '.rel.text' at offset 0x244 contains 2 entries:
Offset Info Type Sym.Value Sym. Name
0000000c 00000c02 R_ARM_ABS32 00000000 .init.data 0000001c 00000c02 R_ARM_ABS32 00000000 .init.data
When find_elf_symbol() gets into a situation where relsym->st_name is zero, there is no guarantee to get the symbol name as written in C.
I am keeping the current logic because it is useful in many architectures, but the symbol name is not always correct depending on the optimization. I left some comments in find_tosym().
--- scripts/mod/modpost.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +9 -3
@@ -1156,6 +1156,10 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,if (relsym->st_name !=0 )return relsym; +/* +* Strive to find a better symbol name, but the resulting name may not +* match the symbol referenced in the original code. +*/ relsym_secindex =get_secindex (elf, relsym);for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {if (get_secindex (elf, sym) != relsym_secindex)
@@ -1416,12 +1420,14 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)static int addend_arm_rel (struct elf_info *elf,Elf_Shdr *sechdr,Elf_Rela *r) {unsigned int r_typ =ELF_R_TYPE (r->r_info); +Elf_Sym *sym = elf->symtab_start +ELF_R_SYM (r->r_info); +void *loc =reloc_location (elf, sechdr, r); +uint32_t inst;switch (r_typ) {case R_ARM_ABS32 : -/* From ARM ABI: (S + A) | T */ - r->r_addend = (int )(long ) - (elf->symtab_start +ELF_R_SYM (r->r_info)); + inst =TO_NATIVE (*(uint32_t *)loc); + r->r_addend = inst + sym->st_value;break ;case R_ARM_PC24 :case R_ARM_CALL :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 402/431 modpost: fix section mismatch message for R_ARM_{PC24,CALL,JUMP24}
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 56a24b8ce6a7f9c4a21b2276a8644f6f3d8fc14d ]
addend_arm_rel() processes R_ARM_PC24, R_ARM_CALL, R_ARM_JUMP24 in a wrong way.
Here, test code.
[test code for R_ARM_JUMP24]
.section .init.text,"ax"
bar:
bx lr
.section .text,"ax"
.globl foo
foo:
b bar
[test code for R_ARM_CALL]
.section .init.text,"ax"
bar:
bx lr
.section .text,"ax"
.globl foo
foo:
push {lr}
bl bar
pop {pc}If you compile it with ARM multi_v7_defconfig, modpost will show the symbol name, (unknown).
WARNING: modpost: vmlinux.o: section mismatch in reference: foo (section: .text) -> (unknown) (section: .init.text)
(You need to use GNU linker instead of LLD to reproduce it.)
Fix the code to make modpost show the correct symbol name.
I imported (with adjustment) sign_extend32() from include/linux/bitops.h.
The '+8' is the compensation for pc-relative instruction. It is documented in "ELF for the Arm Architecture" [1].
"If the relocation is pc-relative then compensation for the PC bias (the PC value is 8 bytes ahead of the executing instruction in Arm state and 4 bytes in Thumb state) must be encoded in the relocation by the object producer."
[1]: https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst
--- scripts/mod/modpost.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
scripts/mod/modpost.c +12 -0
@@ -1417,12 +1417,20 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)#define R_ARM_THM_JUMP19 51#endif +static int32_t sign_extend32 (int32_t value,int index) +{ +uint8_t shift =31 - index; + +return (int32_t )(value << shift) >> shift; +} +static int addend_arm_rel (struct elf_info *elf,Elf_Shdr *sechdr,Elf_Rela *r) {unsigned int r_typ =ELF_R_TYPE (r->r_info);Elf_Sym *sym = elf->symtab_start +ELF_R_SYM (r->r_info);void *loc =reloc_location (elf, sechdr, r);uint32_t inst; +int32_t offset;switch (r_typ) {case R_ARM_ABS32 :
@@ -1432,6 +1440,10 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)case R_ARM_PC24 :case R_ARM_CALL :case R_ARM_JUMP24 : + inst =TO_NATIVE (*(uint32_t *)loc); + offset =sign_extend32 ((inst &0x00ffffff ) <<2 ,25 ); + r->r_addend = offset + sym->st_value +8 ; +break ;case R_ARM_THM_CALL :case R_ARM_THM_JUMP24 :case R_ARM_THM_JUMP19 :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 403/431 crypto: marvell/cesa - Fix type mismatch warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit efbc7764c4446566edb76ca05e903b5905673d2e ]
Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:
In function 'fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' at drivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
583 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is probably harmless as the actual data that is copied has the correct type, but clearly worth fixing nonetheless.
--- drivers/crypto/marvell/cesa/cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/marvell/cesa/cipher.c +1 -1
@@ -297,7 +297,7 @@ static int mv_cesa_des_setkey(struct crypto_skcipher *cipher, const u8 *key,static int mv_cesa_des3_ede_setkey (struct crypto_skcipher *cipher,const u8 *key,unsigned int len) { -struct mv_cesa_des_ctx *ctx =crypto_skcipher_ctx (cipher); +struct mv_cesa_des3_ctx *ctx =crypto_skcipher_ctx (cipher);int err; err =verify_skcipher_des3_key (cipher, key);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 404/431 crypto: jitter - correct health test during initialization
In reply to Greg Kroah-HartmanFrom: Stephan Müller <[email protected]>
[ Upstream commit d23659769ad1bf2cbafaa0efcbae20ef1a74f77e ]
With the update of the permanent and intermittent health errors, the actual indicator for the health test indicates a potential error only for the one offending time stamp gathered in the current iteration round. The next iteration round will "overwrite" the health test result.
Thus, the entropy collection loop in jent_gen_entropy checks for the health test failure upon each loop iteration. However, the initialization operation checked for the APT health test once for an APT window which implies it would not catch most errors.
Thus, the check for all health errors is now invoked unconditionally during each loop iteration for the startup test.
With the change, the error JENT_ERCT becomes unused as all health errors are only reported with the JENT_HEALTH return code. This allows the removal of the error indicator.
)
--- crypto/jitterentropy.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
crypto/jitterentropy.c +3 -6
@@ -117,7 +117,6 @@ struct rand_data {* zero). */ #define JENT_ESTUCK 8/* Too many stuck results during init. */ #define JENT_EHEALTH 9/* Health test failed during initialization */ -#define JENT_ERCT 10/* RCT failed during initialization */ /* * The output n bits can receive more than n bits of min entropy, of course,
@@ -762,14 +761,12 @@ int jent_entropy_init(void)if ((nonstuck %JENT_APT_WINDOW_SIZE ) ==0 ) {jent_apt_reset (&ec, delta &JENT_APT_WORD_MASK ); -if (jent_health_failure (&ec)) -return JENT_EHEALTH ; } } -/* Validate RCT */ -if (jent_rct_failure (&ec)) -return JENT_ERCT ; +/* Validate health test result */ +if (jent_health_failure (&ec)) +return JENT_EHEALTH ;/* test whether we have an increasing timer */ if (!(time2 > time))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 405/431 modpost: fix off by one in is_executable_section()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3a3f1e573a105328a2cca45a7cfbebabbf5e3192 ]
The > comparison should be >= to prevent an out of bounds array access.
--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mod/modpost.c +1 -1
@@ -1296,7 +1296,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,static int is_executable_section (struct elf_info * elf,unsigned int section_index) { -if (section_index > elf->num_sections) +if (section_index >= elf->num_sections)fatal ("section_index is outside elf->num_sections!\n" );return ((elf->sechdrs[section_index].sh_flags &SHF_EXECINSTR ) ==SHF_EXECINSTR );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 406/431 ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 92e2921eeafdfca9acd9b83f07d2b7ca099bac24 ]
ASM_NL is useful not only in *.S files but also in .c files for using inline assembler in C code.
On ARC, however, ASM_NL is evaluated inconsistently. It is expanded to a backquote (`) in *.S files, but a semicolon (;) in *.c files because arch/arc/include/asm/linkage.h defines it inside #ifdef __ASSEMBLY__, so the definition for C code falls back to the default value defined in include/linux/linkage.h.
If ASM_NL is used in inline assembler in .c files, it will result in wrong assembly code because a semicolon is not an instruction separator, but the start of a comment for ARC.
Move ASM_NL (also __ALIGN and __ALIGN_STR) out of the #ifdef.
--- arch/arc/include/asm/linkage.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arc/include/asm/linkage.h +4 -4
@@ -8,6 +8,10 @@#include <asm/dwarf.h> +#define ASM_NL `/* use '`' to mark new line in macro */ +#define __ALIGN .align 4 +#define __ALIGN_STR __stringify(__ALIGN) +#ifdef __ASSEMBLY__ .macro ST2 e, o, off
@@ -28,10 +32,6 @@#endif .endm -#define ASM_NL `/* use '`' to mark new line in macro */ -#define __ALIGN .align 4 -#define __ALIGN_STR __stringify(__ALIGN) - /* annotation for data we want in DCCM - if enabled in .config */ .macro ARCFP_DATA nm #ifdef CONFIG_ARC_HAS_DCCM
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 407/431 crypto: qat - unmap buffer before free for DH
In reply to Greg Kroah-HartmanFrom: Hareshx Sankar Raj <[email protected]>
[ Upstream commit eb7713f5ca97697b92f225127440d1525119b8de ]
The callback function for DH frees the memory allocated for the destination buffer before unmapping it.
This sequence is wrong.
Change the cleanup sequence to unmap the buffer before freeing it.
--- drivers/crypto/qat/qat_common/qat_asym_algs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_common/qat_asym_algs.c +2 -3
@@ -170,15 +170,14 @@ static void qat_dh_cb(struct icp_qat_fw_pke_resp *resp) } areq->dst_len = req->ctx.dh->p_size; +dma_unmap_single (dev, req->out.dh.r, req->ctx.dh->p_size, +DMA_FROM_DEVICE );if (req->dst_align) {scatterwalk_map_and_copy (req->dst_align, areq->dst,0 , areq->dst_len,1 );kfree_sensitive (req->dst_align); } -dma_unmap_single (dev, req->out.dh.r, req->ctx.dh->p_size, -DMA_FROM_DEVICE ); -dma_unmap_single (dev, req->phy_in,sizeof (struct qat_dh_input_params ),DMA_TO_DEVICE ); dma_unmap_single(dev, req->phy_out,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 408/431 crypto: qat - unmap buffers before free for RSA
In reply to Greg Kroah-HartmanFrom: Hareshx Sankar Raj <[email protected]>
[ Upstream commit d776b25495f2c71b9dbf1f5e53b642215ba72f3c ]
The callback function for RSA frees the memory allocated for the source and destination buffers before unmapping them.
This sequence is wrong.
Change the cleanup sequence to unmap the buffers before freeing them.
--- drivers/crypto/qat/qat_common/qat_asym_algs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/crypto/qat/qat_common/qat_asym_algs.c +4 -5
@@ -520,12 +520,14 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp) err = (err ==ICP_QAT_FW_COMN_STATUS_FLAG_OK ) ?0 : -EINVAL ; -kfree_sensitive (req->src_align); -dma_unmap_single (dev, req->in.rsa.enc.m, req->ctx.rsa->key_sz,DMA_TO_DEVICE ); +kfree_sensitive (req->src_align); + areq->dst_len = req->ctx.rsa->key_sz; +dma_unmap_single (dev, req->out.rsa.enc.c, req->ctx.rsa->key_sz, +DMA_FROM_DEVICE );if (req->dst_align) {scatterwalk_map_and_copy (req->dst_align, areq->dst,0 , areq->dst_len,1 );
@@ -533,9 +535,6 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp)kfree_sensitive (req->dst_align); } -dma_unmap_single (dev, req->out.rsa.enc.c, req->ctx.rsa->key_sz, -DMA_FROM_DEVICE ); -dma_unmap_single (dev, req->phy_in,sizeof (struct qat_rsa_input_params ),DMA_TO_DEVICE ); dma_unmap_single(dev, req->phy_out,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 409/431 NFSv4.2: fix wrong shrinker_id
In reply to Greg Kroah-HartmanFrom: Qi Zheng <[email protected]>
[ Upstream commit 7f7ab336898f281e58540ef781a8fb375acc32a9 ]
Currently, the list_lru::shrinker_id corresponding to the nfs4_xattr shrinkers is wrong:
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_cache_lru"].shrinker_id
(int)0
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_entry_lru"].shrinker_id
(int)0
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_large_entry_lru"].shrinker_id
(int)0
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_cache_shrinker"].id
(int)18
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_entry_shrinker"].id
(int)19
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_large_entry_shrinker"].id
(int)20
This is not what we expect, which will cause these shrinkers not to be found in shrink_slab_memcg().
We should assign shrinker::id before calling list_lru_init_memcg(), so that the corresponding list_lru::shrinker_id will be assigned the correct value like below:
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_cache_lru"].shrinker_id
(int)16
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_entry_lru"].shrinker_id
(int)17
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_large_entry_lru"].shrinker_id
(int)18
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_cache_shrinker"].id
(int)16
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_entry_shrinker"].id
(int)17
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog["nfs4_xattr_large_entry_shrinker"].id
(int)18
So just do it.
--- fs/nfs/nfs42xattr.c | 79 +++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 35 deletions(-)
fs/nfs/nfs42xattr.c +44 -35
@@ -991,6 +991,29 @@ static void nfs4_xattr_cache_init_once(void *p)INIT_LIST_HEAD (&cache->dispose); } +static int nfs4_xattr_shrinker_init (struct shrinker *shrinker, +struct list_lru *lru,const char *name) +{ +int ret =0 ; + + ret =register_shrinker (shrinker, name); +if (ret) +return ret; + + ret =list_lru_init_memcg (lru, shrinker); +if (ret) +unregister_shrinker (shrinker); + +return ret; +} + +static void nfs4_xattr_shrinker_destroy (struct shrinker *shrinker, +struct list_lru *lru) +{ +unregister_shrinker (shrinker); +list_lru_destroy (lru); +} +int __init nfs4_xattr_cache_init (void ) {int ret =0 ;
@@ -1002,44 +1025,30 @@ int __init nfs4_xattr_cache_init(void)if (nfs4_xattr_cache_cachep ==NULL )return -ENOMEM ; - ret =list_lru_init_memcg (&nfs4_xattr_large_entry_lru, - &nfs4_xattr_large_entry_shrinker); -if (ret) - goto out4; - - ret =list_lru_init_memcg (&nfs4_xattr_entry_lru, - &nfs4_xattr_entry_shrinker); -if (ret) - goto out3; - - ret =list_lru_init_memcg (&nfs4_xattr_cache_lru, - &nfs4_xattr_cache_shrinker); -if (ret) - goto out2; - - ret =register_shrinker (&nfs4_xattr_cache_shrinker,"nfs-xattr_cache" ); + ret =nfs4_xattr_shrinker_init (&nfs4_xattr_cache_shrinker, + &nfs4_xattr_cache_lru, +"nfs-xattr_cache" );if (ret) goto out1; - ret =register_shrinker (&nfs4_xattr_entry_shrinker,"nfs-xattr_entry" ); + ret =nfs4_xattr_shrinker_init (&nfs4_xattr_entry_shrinker, + &nfs4_xattr_entry_lru, +"nfs-xattr_entry" );if (ret) - goto out; + goto out2; - ret =register_shrinker (&nfs4_xattr_large_entry_shrinker, -"nfs-xattr_large_entry" ); + ret =nfs4_xattr_shrinker_init (&nfs4_xattr_large_entry_shrinker, + &nfs4_xattr_large_entry_lru, +"nfs-xattr_large_entry" );if (!ret)return 0 ; -unregister_shrinker (&nfs4_xattr_entry_shrinker); -out: -unregister_shrinker (&nfs4_xattr_cache_shrinker); -out1: -list_lru_destroy (&nfs4_xattr_cache_lru); +nfs4_xattr_shrinker_destroy (&nfs4_xattr_entry_shrinker, + &nfs4_xattr_entry_lru); out2: -list_lru_destroy (&nfs4_xattr_entry_lru); -out3: -list_lru_destroy (&nfs4_xattr_large_entry_lru); -out4: +nfs4_xattr_shrinker_destroy (&nfs4_xattr_cache_shrinker, + &nfs4_xattr_cache_lru); +out1:kmem_cache_destroy (nfs4_xattr_cache_cachep);return ret;
@@ -1047,11 +1056,11 @@ int __init nfs4_xattr_cache_init(void)void nfs4_xattr_cache_exit (void ) { -unregister_shrinker (&nfs4_xattr_large_entry_shrinker); -unregister_shrinker (&nfs4_xattr_entry_shrinker); -unregister_shrinker (&nfs4_xattr_cache_shrinker); -list_lru_destroy (&nfs4_xattr_large_entry_lru); -list_lru_destroy (&nfs4_xattr_entry_lru); -list_lru_destroy (&nfs4_xattr_cache_lru); +nfs4_xattr_shrinker_destroy (&nfs4_xattr_large_entry_shrinker, + &nfs4_xattr_large_entry_lru); +nfs4_xattr_shrinker_destroy (&nfs4_xattr_entry_shrinker, + &nfs4_xattr_entry_lru); +nfs4_xattr_shrinker_destroy (&nfs4_xattr_cache_shrinker, + &nfs4_xattr_cache_lru);kmem_cache_destroy (nfs4_xattr_cache_cachep); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 410/431 NFSv4.1: freeze the session table upon receiving NFS4ERR_BADSESSION
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit c907e72f58ed979a24a9fdcadfbc447c51d5e509 ]
When the client received NFS4ERR_BADSESSION, it schedules recovery and start the state manager thread which in turn freezes the session table and does not allow for any new requests to use the no-longer valid session. However, it is possible that before the state manager thread runs, a new operation would use the released slot that received BADSESSION and was therefore not updated its sequence number. Such re-use of the slot can lead the application errors.
--- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/nfs4proc.c +1 -0
@@ -921,6 +921,7 @@ static int nfs41_sequence_process(struct rpc_task *task, out_noaction:return ret; session_recover: +set_bit (NFS4_SLOT_TBL_DRAINING , &session->fc_slot_table.slot_tbl_state);nfs4_schedule_session_recovery (session, status);dprintk ("%s ERROR: %d Reset session\n" , __func__, status);nfs41_sequence_free_slot (res);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 411/431 SMB3: Do not send lease break acknowledgment if all file handles have been closed
In reply to Greg Kroah-HartmanFrom: Bharath SM <[email protected]>
[ Upstream commit da787d5b74983f7525d1eb4b9c0b4aff2821511a ]
In case if all existing file handles are deferred handles and if all of them gets closed due to handle lease break then we dont need to send lease break acknowledgment to server, because last handle close will be considered as lease break ack.
After closing deferred handels, we check for openfile list of inode, if its empty then we skip sending lease break ack.
--- fs/cifs/file.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
fs/cifs/file.c +12 -13
@@ -4936,20 +4936,19 @@ void cifs_oplock_break(struct work_struct *work)_cifsFileInfo_put (cfile, false/* do not wait for ourself */ , false);/* -* releasing stale oplock after recent reconnect of smb session using -* a now incorrect file handle is not a data integrity issue but do -* not bother sending an oplock release if session to server still is -* disconnected since oplock already released by the server +* MS-SMB2 3.2.5.19.1 and 3.2.5.19.2 (and MS-CIFS 3.2.5.42) do not require +* an acknowledgment to be sent when the file has already been closed. +* check for server null, since can race with kill_sb calling tree disconnect. */ -if (!oplock_break_cancelled) { -/* check for server null since can race with kill_sb calling tree disconnect */ -if (tcon->ses && tcon->ses->server) { - rc = tcon->ses->server->ops->oplock_response (tcon, persistent_fid, - volatile_fid, net_fid, cinode); -cifs_dbg (FYI ,"Oplock release rc = %d\n" , rc); - }else -pr_warn_once ("lease break not sent for unmounted share\n" ); - } +spin_lock (&cinode->open_file_lock); +if (tcon->ses && tcon->ses->server && !oplock_break_cancelled && + !list_empty (&cinode->openFileList)) { +spin_unlock (&cinode->open_file_lock); + rc = tcon->ses->server->ops->oplock_response (tcon, persistent_fid, + volatile_fid, net_fid, cinode); +cifs_dbg (FYI ,"Oplock release rc = %d\n" , rc); + }else +spin_unlock (&cinode->open_file_lock);cifs_done_oplock_break (cinode); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 412/431 dax: Fix dax_mapping_release() use after free
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit 6d24b170a9db0456f577b1ab01226a2254c016a8 ]
A CONFIG_DEBUG_KOBJECT_RELEASE test of removing a device-dax region provider (like modprobe -r dax_hmem) yields:
kobject: 'mapping0' (ffff93eb460e8800): kobject_release, parent 0000000000000000 (delayed 2000) [..]
DEBUG_LOCKS_WARN_ON(1)
WARNING: CPU: 23 PID: 282 at kernel/locking/lockdep.c:232 __lock_acquire+0x9fc/0x2260 [..] RIP: 0010:__lock_acquire+0x9fc/0x2260 [..] Call Trace: <TASK> [..] lock_acquire+0xd4/0x2c0 ? ida_free+0x62/0x130 _raw_spin_lock_irqsave+0x47/0x70 ? ida_free+0x62/0x130 ida_free+0x62/0x130 dax_mapping_release+0x1f/0x30 device_release+0x36/0x90 kobject_delayed_cleanup+0x46/0x150
Due to attempting ida_free() on an ida object that has already been freed. Devices typically only hold a reference on their parent while registered. If a child needs a parent object to complete its release it needs to hold a reference that it drops from its release callback. Arrange for a dax_mapping to pin its parent dev_dax instance until dax_mapping_release().
--- drivers/dax/bus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dax/bus.c +4 -1
@@ -635,10 +635,12 @@ EXPORT_SYMBOL_GPL(alloc_dax_region);static void dax_mapping_release (struct device *dev) {struct dax_mapping *mapping =to_dax_mapping (dev); -struct dev_dax *dev_dax =to_dev_dax (dev->parent); +struct device *parent = dev->parent; +struct dev_dax *dev_dax =to_dev_dax (parent);ida_free (&dev_dax->ida, mapping->id);kfree (mapping); +put_device (parent); }static void unregister_dax_mapping (void *data)
@@ -778,6 +780,7 @@ static int devm_register_dax_mapping(struct dev_dax *dev_dax, int range_id) dev = &mapping->dev;device_initialize (dev); dev->parent = &dev_dax->dev; +get_device (dev->parent); dev->type = &dax_mapping_type;dev_set_name (dev,"mapping%d" , mapping->id); rc =device_add (dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 413/431 dax: Introduce alloc_dev_dax_id()
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit 70aab281e18c68a1284bc387de127c2fc0bed3f8 ]
The reference counting of dax_region objects is needlessly complicated, has lead to confusion [1], and has hidden a bug [2]. Towards cleaning up that mess introduce alloc_dev_dax_id() to minimize the holding of a dax_region reference to only what dev_dax_release() needs, the dax_region->ida.
Part of the reason for the mess was the design to dereference a dax_region in all cases in free_dev_dax_id() even if the id was statically assigned by the upper level dax_region driver. Remove the need to call "is_static(dax_region)" by tracking whether the id is dynamic directly in the dev_dax instance itself.
With that flag the dax_region pinning and release per dev_dax instance can move to alloc_dev_dax_id() and free_dev_dax_id() respectively.
A follow-on cleanup address the unnecessary references in the dax_region setup and drivers.
--- drivers/dax/bus.c | 56 ++++++++++++++++++++++++--------------- drivers/dax/dax-private.h | 4 ++- 2 files changed, 37 insertions(+), 23 deletions(-)
drivers/dax/bus.c +34 -22
@@ -446,18 +446,34 @@ static void unregister_dev_dax(void *dev)put_device (dev); } +static void dax_region_free (struct kref *kref) +{ +struct dax_region *dax_region; + + dax_region = container_of(kref, struct dax_region, kref); +kfree (dax_region); +} + +void dax_region_put (struct dax_region *dax_region) +{ +kref_put (&dax_region->kref, dax_region_free); +} +EXPORT_SYMBOL_GPL (dax_region_put); +/* a return value >= 0 indicates this invocation invalidated the id */ static int __free_dev_dax_id (struct dev_dax *dev_dax) { -struct dax_region *dax_region = dev_dax->region;struct device *dev = &dev_dax->dev; +struct dax_region *dax_region;int rc = dev_dax->id;device_lock_assert (dev); -if (is_static (dax_region) || dev_dax->id <0 ) +if (!dev_dax->dyn_id || dev_dax->id <0 )return -1 ; + dax_region = dev_dax->region;ida_free (&dax_region->ida, dev_dax->id); +dax_region_put (dax_region); dev_dax->id =-1 ;return rc; }
@@ -473,6 +489,20 @@ static int free_dev_dax_id(struct dev_dax *dev_dax)return rc; } +static int alloc_dev_dax_id (struct dev_dax *dev_dax) +{ +struct dax_region *dax_region = dev_dax->region; +int id; + + id =ida_alloc (&dax_region->ida,GFP_KERNEL ); +if (id <0 ) +return id; +kref_get (&dax_region->kref); + dev_dax->dyn_id = true; + dev_dax->id = id; +return id; +} +static ssize_t delete_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t len) {
@@ -560,20 +590,6 @@ static const struct attribute_group *dax_region_attribute_groups[] = { NULL, }; -static void dax_region_free (struct kref *kref) -{ -struct dax_region *dax_region; - - dax_region = container_of(kref, struct dax_region, kref); -kfree (dax_region); -} - -void dax_region_put (struct dax_region *dax_region) -{ -kref_put (&dax_region->kref, dax_region_free); -} -EXPORT_SYMBOL_GPL (dax_region_put); -static void dax_region_unregister (void *region) {struct dax_region *dax_region = region;
@@ -1298,12 +1314,10 @@ static const struct attribute_group *dax_attribute_groups[] = {static void dev_dax_release (struct device *dev) {struct dev_dax *dev_dax =to_dev_dax (dev); -struct dax_region *dax_region = dev_dax->region;struct dax_device *dax_dev = dev_dax->dax_dev;put_dax (dax_dev);free_dev_dax_id (dev_dax); -dax_region_put (dax_region);kfree (dev_dax->pgmap);kfree (dev_dax); }
@@ -1327,6 +1341,7 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data)if (!dev_dax)return ERR_PTR (-ENOMEM ); + dev_dax->region = dax_region;if (is_static (dax_region)) {if (dev_WARN_ONCE (parent, data->id <0 ,"dynamic id specified to static region\n" )) {
@@ -1342,13 +1357,11 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) goto err_id; } - rc =ida_alloc (&dax_region->ida,GFP_KERNEL ); + rc =alloc_dev_dax_id (dev_dax);if (rc <0 ) goto err_id; - dev_dax->id = rc; } - dev_dax->region = dax_region; dev = &dev_dax->dev;device_initialize (dev);dev_set_name (dev,"dax%d.%d" , dax_region->id, dev_dax->id);
@@ -1389,7 +1402,6 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) dev_dax->target_node = dax_region->target_node; dev_dax->align = dax_region->align;ida_init (&dev_dax->ida); -kref_get (&dax_region->kref); inode =dax_inode (dax_dev); dev->devt = inode->i_rdev;
drivers/dax/dax-private.h +3 -1
@@ -52,7 +52,8 @@ struct dax_mapping {* @region - parent region * @dax_dev - core dax functionality * @target_node: effective numa node if dev_dax memory range is onlined -* @id: ida allocated id +* @dyn_id: is this a dynamic or statically created instance +* @id: ida allocated id when the dax_region is not static * @ida: mapping id allocator * @dev - device core * @pgmap - pgmap for memmap setup / lifetime (driver owned)
@@ -64,6 +65,7 @@ struct dev_dax {struct dax_device *dax_dev;unsigned int align;int target_node; +bool dyn_id;int id;struct ida ida;struct device dev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 414/431 dax/kmem: Pass valid argument to memory_group_register_static
In reply to Greg Kroah-HartmanFrom: Tarun Sahu <[email protected]>
[ Upstream commit 46e66dab8565f742374e9cc4ff7d35f344d774e2 ]
memory_group_register_static takes maximum number of pages as the argument while dev_dax_kmem_probe passes total_len (in bytes) as the argument.
IIUC, I don't see any crash/panic impact as such. As, memory_group_register_static just set the max_pages limit which is used in auto_movable_zone_for_pfn to determine the zone.
which might cause these condition to behave differently,
This will be true always so jump will happen to kernel_zone
...
if (!auto_movable_can_online_movable(NUMA_NO_NODE, group, nr_pages))
goto kernel_zone;
...
kernel_zone:
return default_kernel_zone_for_pfn(nid, pfn, nr_pages);Here, In below, zone_intersects compare range will be larger as nr_pages will be higher (derived from total_len passed in dev_dax_kmem_probe).
...
static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn,
unsigned long nr_pages)
{
struct pglist_data *pgdat = NODE_DATA(nid);
int zid;
for (zid = 0; zid < ZONE_NORMAL; zid++) {
struct zone *zone = &pgdat->node_zones[zid];
if (zone_intersects(zone, start_pfn, nr_pages))
return zone;
}
return &pgdat->node_zones[ZONE_NORMAL];
}Incorrect zone will be returned here, which in later time might cause bigger problem.
--- drivers/dax/kmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dax/kmem.c +1 -1
@@ -99,7 +99,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)if (!data->res_name) goto err_res_name; - rc =memory_group_register_static (numa_node, total_len); + rc =memory_group_register_static (numa_node,PFN_UP (total_len));if (rc <0 ) goto err_reg_mgid; data->mgid = rc;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 415/431 hwrng: st - keep clock enabled while hwrng is registered
In reply to Greg Kroah-HartmanFrom: Martin Kaiser <[email protected]>
[ Upstream commit 501e197a02d4aef157f53ba3a0b9049c3e52fedc ]
The st-rng driver uses devres to register itself with the hwrng core, the driver will be unregistered from hwrng when its device goes out of scope. This happens after the driver's remove function is called.
However, st-rng's clock is disabled in the remove function. There's a short timeframe where st-rng is still registered with the hwrng core although its clock is disabled. I suppose the clock must be active to access the hardware and serve requests from the hwrng core.
Switch to devm_clk_get_enabled and let devres disable the clock and unregister the hwrng. This avoids the race condition.
--- drivers/char/hw_random/st-rng.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)
drivers/char/hw_random/st-rng.c +1 -20
@@ -42,7 +42,6 @@struct st_rng_data {void __iomem *base; -struct clk *clk;struct hwrng ops; };
@@ -85,26 +84,18 @@ static int st_rng_probe(struct platform_device *pdev)if (IS_ERR (base))return PTR_ERR (base); - clk =devm_clk_get (&pdev->dev,NULL ); + clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (clk))return PTR_ERR (clk); - ret =clk_prepare_enable (clk); -if (ret) -return ret; - ddata->ops.priv = (unsigned long )ddata; ddata->ops.read = st_rng_read; ddata->ops.name = pdev->name; ddata->base = base; - ddata->clk = clk; - -dev_set_drvdata (&pdev->dev, ddata); ret =devm_hwrng_register (&pdev->dev, &ddata->ops);if (ret) {dev_err (&pdev->dev,"Failed to register HW RNG\n" ); -clk_disable_unprepare (clk);return ret; }
@@ -113,15 +104,6 @@ static int st_rng_probe(struct platform_device *pdev)return 0 ; } -static int st_rng_remove (struct platform_device *pdev) -{ -struct st_rng_data *ddata =dev_get_drvdata (&pdev->dev); - -clk_disable_unprepare (ddata->clk); - -return 0 ; -} -static const struct of_device_id st_rng_match[]__maybe_unused = { { .compatible ="st,rng" }, {},
@@ -134,7 +116,6 @@ static struct platform_driver st_rng_driver = { .of_match_table = of_match_ptr(st_rng_match), }, .probe = st_rng_probe, - .remove = st_rng_remove };module_platform_driver (st_rng_driver);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 416/431 kbuild: Fix CFI failures with GCOV
In reply to Greg Kroah-HartmanFrom: Sami Tolvanen <[email protected]>
[ Upstream commit ddf56288eebd1fe82c46fc9f693b5b18045cddb6 ]
With GCOV_PROFILE_ALL, Clang injects __llvm_gcov_* functions to each object file, and the functions are indirectly called during boot. However, when code is injected to object files that are not part of vmlinux.o, it's also not processed by objtool, which breaks CFI hash randomization as the hashes in these files won't be included in the .cfi_sites section and thus won't be randomized.
Similarly to commit 42633ed852de ("kbuild: Fix CFI hash randomization with KASAN"), disable GCOV for .vmlinux.export.o and init/version-timestamp.o to avoid emitting unnecessary functions to object files that don't otherwise have executable code.
--- init/Makefile | 1 + scripts/Makefile.vmlinux | 1 + 2 files changed, 2 insertions(+)
init/Makefile +1 -0
@@ -60,3 +60,4 @@ include/generated/utsversion.h: FORCE $(obj)/version-timestamp.o: include/generated/utsversion.h CFLAGS_version-timestamp.o := -include include/generated/utsversion.h KASAN_SANITIZE_version-timestamp.o := n +GCOV_PROFILE_version-timestamp.o := n
scripts/Makefile.vmlinux +1 -0
@@ -19,6 +19,7 @@ quiet_cmd_cc_o_c = CC $@ ifdef CONFIG_MODULES KASAN_SANITIZE_.vmlinux.export.o := n +GCOV_PROFILE_.vmlinux.export.o := n targets += .vmlinux.export.o vmlinux: .vmlinux.export.o endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 417/431 kbuild: Disable GCOV for *.mod.o
In reply to Greg Kroah-HartmanFrom: Sami Tolvanen <[email protected]>
[ Upstream commit 25a21fbb934a0d989e1858f83c2ddf4cfb2ebe30 ]
With GCOV_PROFILE_ALL, Clang injects __llvm_gcov_* functions to each object file, including the *.mod.o. As we filter out CC_FLAGS_CFI for *.mod.o, the compiler won't generate type hashes for the injected functions, and therefore indirectly calling them during module loading trips indirect call checking.
Enabling CFI for *.mod.o isn't sufficient to fix this issue after commit 0c3e806ec0f9 ("x86/cfi: Add boot time hash randomization"), as *.mod.o aren't processed by objtool, which means any hashes emitted there won't be randomized. Therefore, in addition to disabling CFI for *.mod.o, also disable GCOV, as the object files don't otherwise contain any executable code.
--- scripts/Makefile.modfinal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.modfinal +1 -1
@@ -23,7 +23,7 @@ modname = $(notdir $(@:.mod.o=)) part-of-module = y quiet_cmd_cc_o_c = CC [M] $@ - cmd_cc_o_c = $(CC) $(filter-out $(CC_FLAGS_CFI), $(c_flags)) -c -o $@ $< + cmd_cc_o_c = $(CC) $(filter-out $(CC_FLAGS_CFI) $(CFLAGS_GCOV), $(c_flags)) -c -o $@ $< %.mod.o: %.mod.c FORCE $(call if_changed_dep,cc_o_c)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 418/431 cxl/region: Move cache invalidation before region teardown, and before setup
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit d1257d098a5a38753a0736a50db0a26a62377ad7 ]
Vikram raised a concern with the theoretical case of a CPU sending MemClnEvict to a device that is not prepared to receive. MemClnEvict is a message that is sent after a CPU has taken ownership of a cacheline from accelerator memory (HDM-DB). In the case of hotplug or HDM decoder reconfiguration it is possible that the CPU is holding old contents for a new device that has taken over the physical address range being cached by the CPU.
To avoid this scenario, invalidate caches prior to tearing down an HDM decoder configuration.
Now, this poses another problem that it is possible for something to speculate into that space while the decode configuration is still up, so to close that gap also invalidate prior to establish new contents behind a given physical address range.
With this change the cache invalidation is now explicit and need not be checked in cxl_region_probe(), and that obviates the need for CXL_REGION_F_INCOHERENT.
--- drivers/cxl/core/region.c | 66 ++++++++++++++++++++++----------------- drivers/cxl/cxl.h | 8 +---- 2 files changed, 38 insertions(+), 36 deletions(-)
drivers/cxl/core/region.c +37 -29
@@ -125,10 +125,38 @@ static struct cxl_region_ref *cxl_rr_load(struct cxl_port *port,return xa_load (&port->regions, (unsigned long )cxlr); } +static int cxl_region_invalidate_memregion (struct cxl_region *cxlr) +{ +if (!cpu_cache_has_invalidate_memregion ()) { +if (IS_ENABLED (CONFIG_CXL_REGION_INVALIDATION_TEST )) { +dev_warn_once ( + &cxlr->dev, +"Bypassing cpu_cache_invalidate_memregion() for testing!\n" ); +return 0 ; + }else { +dev_err (&cxlr->dev, +"Failed to synchronize CPU cache state\n" ); +return -ENXIO ; + } + } + +cpu_cache_invalidate_memregion (IORES_DESC_CXL ); +return 0 ; +} +static int cxl_region_decode_reset (struct cxl_region *cxlr,int count) {struct cxl_region_params *p = &cxlr->params; -int i; +int i, rc =0 ; + +/* +* Before region teardown attempt to flush, and if the flush +* fails cancel the region teardown for data consistency +* concerns +*/ + rc =cxl_region_invalidate_memregion (cxlr); +if (rc) +return rc;for (i = count -1 ; i >=0 ; i--) {struct cxl_endpoint_decoder *cxled = p->targets[i];
@@ -136,7 +164,6 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)struct cxl_port *iter =cxled_to_port (cxled);struct cxl_dev_state *cxlds = cxlmd->cxlds;struct cxl_ep *ep; -int rc =0 ;if (cxlds->rcd) goto endpoint_reset;
@@ -256,6 +283,14 @@ static ssize_t commit_store(struct device *dev, struct device_attribute *attr, goto out; } +/* +* Invalidate caches before region setup to drop any speculative +* consumption of this address space +*/ + rc =cxl_region_invalidate_memregion (cxlr); +if (rc) +return rc; +if (commit) rc =cxl_region_decode_commit (cxlr);else {
@@ -1674,7 +1709,6 @@ static int cxl_region_attach(struct cxl_region *cxlr,if (rc) goto err_decrement; p->state =CXL_CONFIG_ACTIVE ; -set_bit (CXL_REGION_F_INCOHERENT , &cxlr->flags); } cxled->cxld.interleave_ways = p->interleave_ways;
@@ -2679,30 +2713,6 @@ int cxl_add_to_region(struct cxl_port *root, struct cxl_endpoint_decoder *cxled) }EXPORT_SYMBOL_NS_GPL (cxl_add_to_region,CXL ); -static int cxl_region_invalidate_memregion (struct cxl_region *cxlr) -{ -if (!test_bit (CXL_REGION_F_INCOHERENT , &cxlr->flags)) -return 0 ; - -if (!cpu_cache_has_invalidate_memregion ()) { -if (IS_ENABLED (CONFIG_CXL_REGION_INVALIDATION_TEST )) { -dev_warn_once ( - &cxlr->dev, -"Bypassing cpu_cache_invalidate_memregion() for testing!\n" ); -clear_bit (CXL_REGION_F_INCOHERENT , &cxlr->flags); -return 0 ; - }else { -dev_err (&cxlr->dev, -"Failed to synchronize CPU cache state\n" ); -return -ENXIO ; - } - } - -cpu_cache_invalidate_memregion (IORES_DESC_CXL ); -clear_bit (CXL_REGION_F_INCOHERENT , &cxlr->flags); -return 0 ; -} -static int is_system_ram (struct resource *res,void *arg) {struct cxl_region *cxlr = arg;
@@ -2730,8 +2740,6 @@ static int cxl_region_probe(struct device *dev) goto out; } - rc =cxl_region_invalidate_memregion (cxlr); -/* * From this point on any path that changes the region's state away from * CXL_CONFIG_COMMIT is also responsible for releasing the driver.
drivers/cxl/cxl.h +1 -7
@@ -462,18 +462,12 @@ struct cxl_region_params {int nr_targets; }; -/* -* Flag whether this region needs to have its HPA span synchronized with -* CPU cache state at region activation time. -*/ -#define CXL_REGION_F_INCOHERENT 0 -/* * Indicate whether this region has been assembled by autodetection or * userspace assembly. Prevent endpoint decoders outside of automatic * detection from being added to the region. */ -#define CXL_REGION_F_AUTO 1 +#define CXL_REGION_F_AUTO 0/** * struct cxl_region - CXL region
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 419/431 cxl/region: Flag partially torn down regions as unusable
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit 2ab47045ac96a605e3037d479a7d5854570ee5bf ]
cxl_region_decode_reset() walks all the decoders associated with a given region and disables them. Due to decoder ordering rules it is possible that a switch in the topology notices that a given decoder can not be shutdown before another region with a higher HPA is shutdown first. That can leave the region in a partially committed state.
Capture that state in a new CXL_REGION_F_NEEDS_RESET flag and require that a successful cxl_region_decode_reset() attempt must be completed before cxl_region_probe() accepts the region.
This is a corollary for the bug that Jonathan identified in "CXL/region : commit reset of out of order region appears to succeed." [1].
--- drivers/cxl/core/region.c | 12 ++++++++++++ drivers/cxl/cxl.h | 8 ++++++++ 2 files changed, 20 insertions(+)
drivers/cxl/core/region.c +12 -0
@@ -182,14 +182,19 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count) rc = cxld->reset (cxld);if (rc)return rc; +set_bit (CXL_REGION_F_NEEDS_RESET , &cxlr->flags); } endpoint_reset: rc = cxled->cxld.reset (&cxled->cxld);if (rc)return rc; +set_bit (CXL_REGION_F_NEEDS_RESET , &cxlr->flags); } +/* all decoders associated with this region have been torn down */ +clear_bit (CXL_REGION_F_NEEDS_RESET , &cxlr->flags); +return 0 ; }
@@ -2740,6 +2745,13 @@ static int cxl_region_probe(struct device *dev) goto out; } +if (test_bit (CXL_REGION_F_NEEDS_RESET , &cxlr->flags)) { +dev_err (&cxlr->dev, +"failed to activate, re-commit region and retry\n" ); + rc = -ENXIO ; + goto out; + } +/* * From this point on any path that changes the region's state away from * CXL_CONFIG_COMMIT is also responsible for releasing the driver.
drivers/cxl/cxl.h +8 -0
@@ -469,6 +469,14 @@ struct cxl_region_params {*/ #define CXL_REGION_F_AUTO 0 +/* +* Require that a committed region successfully complete a teardown once +* any of its associated decoders have been torn down. This maintains +* the commit state for the region since there are committed decoders, +* but blocks cxl_region_probe(). +*/ +#define CXL_REGION_F_NEEDS_RESET 1 +/** * struct cxl_region - CXL region * @dev: This region's device
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 420/431 cxl/region: Fix state transitions after reset failure
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit adfe19738b71a893da62cb2e30bd6bdb4299ea67 ]
Jonathan reports that failed attempts to reset a region (teardown its HDM decoder configuration) mistakenly advance the state of the region to "not committed". Revert to the previous state of the region on reset failure so that the reset can be re-attempted.
--- drivers/cxl/core/region.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/cxl/core/region.c +15 -11
@@ -296,9 +296,11 @@ static ssize_t commit_store(struct device *dev, struct device_attribute *attr,if (rc)return rc; -if (commit) +if (commit) { rc =cxl_region_decode_commit (cxlr); -else { +if (rc ==0 ) + p->state =CXL_CONFIG_COMMIT ; + }else { p->state =CXL_CONFIG_RESET_PENDING ;up_write (&cxl_region_rwsem);device_release_driver (&cxlr->dev);
@@ -308,18 +310,20 @@ static ssize_t commit_store(struct device *dev, struct device_attribute *attr,* The lock was dropped, so need to revalidate that the reset is * still pending. */ -if (p->state ==CXL_CONFIG_RESET_PENDING ) +if (p->state ==CXL_CONFIG_RESET_PENDING ) { rc =cxl_region_decode_reset (cxlr, p->interleave_ways); +/* +* Revert to committed since there may still be active +* decoders associated with this region, or move forward +* to active to mark the reset successful +*/ +if (rc) + p->state =CXL_CONFIG_COMMIT ; +else + p->state =CXL_CONFIG_ACTIVE ; + } } -if (rc) - goto out; - -if (commit) - p->state =CXL_CONFIG_COMMIT ; -else if (p->state ==CXL_CONFIG_RESET_PENDING ) - p->state =CXL_CONFIG_ACTIVE ; - out:up_write (&cxl_region_rwsem);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 421/431 kbuild: builddeb: always make modules_install, to install modules.builtin*
In reply to Greg Kroah-HartmanFrom: Josh Triplett <[email protected]>
[ Upstream commit 4243afdb932677a03770753be8c54b3190a512e8 ]
Even for a non-modular kernel, the kernel builds modules.builtin and modules.builtin.modinfo, with information about the built-in modules. Tools such as initramfs-tools need these files to build a working initramfs on some systems, such as those requiring firmware.
Now that make modules_install works even in non-modular kernels and installs these files, unconditionally invoke it when building a Debian package.
Stable-dep-of: 1240dabe8d58 ("kbuild: deb-pkg: remove the CONFIG_MODULES check in buildeb")
--- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/builddeb +1 -1
@@ -62,8 +62,8 @@ install_linux_image () { ${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install fi + ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install if is_enabled CONFIG_MODULES; then - ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build" rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source" if [ "${SRCARCH}" = um ] ; then
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 422/431 kbuild: deb-pkg: remove the CONFIG_MODULES check in buildeb
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 1240dabe8d58b4eff09e7edf1560da0360f997aa ]
When CONFIG_MODULES is disabled for ARCH=um, 'make (bin)deb-pkg' fails with an error like follows:
cp: cannot create regular file 'debian/linux-image/usr/lib/uml/modules/6.4.0-rc2+/System.map': No such file or directory
Remove the CONFIG_MODULES check completely so ${pdir}/usr/lib/uml/modules will always be created and modules.builtin.(modinfo) will be installed under it for ARCH=um.
--- scripts/package/builddeb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
scripts/package/builddeb +4 -8
@@ -63,17 +63,13 @@ install_linux_image () { fi ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install - if is_enabled CONFIG_MODULES; then - rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build" - rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source" - if [ "${SRCARCH}" = um ] ; then - mkdir -p "${pdir}/usr/lib/uml/modules" - mv "${pdir}/lib/modules/${KERNELRELEASE}" "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}" - fi - fi + rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build" + rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source" # Install the kernel if [ "${ARCH}" = um ] ; then + mkdir -p "${pdir}/usr/lib/uml/modules" + mv "${pdir}/lib/modules/${KERNELRELEASE}" "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}" mkdir -p "${pdir}/usr/bin" "${pdir}/usr/share/doc/${pname}" cp System.map "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}/System.map" cp ${KCONFIG_CONFIG} "${pdir}/usr/share/doc/${pname}/config"
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 423/431 efi/libstub: Disable PCI DMA before grabbing the EFI memory map
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 2e28a798c3092ea42b968fa16ac835969d124898 ]
Currently, the EFI stub will disable PCI DMA as the very last thing it does before calling ExitBootServices(), to avoid interfering with the firmware's normal operation as much as possible.
However, the stub will invoke DisconnectController() on all endpoints downstream of the PCI bridges it disables, and this may affect the layout of the EFI memory map, making it substantially more likely that ExitBootServices() will fail the first time around, and that the EFI memory map needs to be reloaded.
This, in turn, increases the likelihood that the slack space we allocated is insufficient (and we can no longer allocate memory via boot services after having called ExitBootServices() once), causing the second call to GetMemoryMap (and therefore the boot) to fail. This makes the PCI DMA disable feature a bit more fragile than it already is, so let's make it more robust, by allocating the space for the EFI memory map after disabling PCI DMA.
--- drivers/firmware/efi/libstub/efi-stub-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/efi/libstub/efi-stub-helper.c +3 -3
@@ -378,6 +378,9 @@ efi_status_t efi_exit_boot_services(void *handle, void *priv,struct efi_boot_memmap *map;efi_status_t status; +if (efi_disable_pci_dma) +efi_pci_disable_bridge_busmaster (); + status =efi_get_memory_map (&map, true);if (status !=EFI_SUCCESS )return status;
@@ -388,9 +391,6 @@ efi_status_t efi_exit_boot_services(void *handle, void *priv,return status; } -if (efi_disable_pci_dma) -efi_pci_disable_bridge_busmaster (); - status =efi_bs_call (exit_boot_services, handle, map->map_key);if (status ==EFI_INVALID_PARAMETER ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 424/431 cifs: prevent use-after-free by freeing the cfile later
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
[ Upstream commit 33f736187d08f6bc822117629f263b97d3df4165 ]
In smb2_compound_op we have a possible use-after-free which can cause hard to debug problems later on.
This was revealed during stress testing with KASAN enabled kernel. Fixing it by moving the cfile free call to a few lines below, after the usage.
--- fs/cifs/smb2inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/cifs/smb2inode.c +3 -3
@@ -398,9 +398,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, rsp_iov); finished: -if (cfile) -cifsFileInfo_put (cfile); -SMB2_open_free (&rqst[0 ]);if (rc == -EREMCHG ) {pr_warn_once ("server share %s deleted\n" , tcon->tree_name);
@@ -529,6 +526,9 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,break ; } +if (cfile) +cifsFileInfo_put (cfile); +if (rc && err_iov && err_buftype) {memcpy (err_iov, rsp_iov,3 *sizeof (*err_iov));memcpy (err_buftype, resp_buftype,3 *sizeof (*err_buftype));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 425/431 cifs: do all necessary checks for credits within or before locking
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
[ Upstream commit 326a8d04f147e2bf393f6f9cdb74126ee6900607 ]
All the server credits and in-flight info is protected by req_lock. Once the req_lock is held, and we've determined that we have enough credits to continue, this lock cannot be dropped till we've made the changes to credits and in-flight count.
However, we used to drop the lock in order to avoid deadlock with the recent srv_lock. This could cause the checks already made to be invalidated.
Fixed it by moving the server status check to before locking req_lock.
--- fs/cifs/smb2ops.c | 19 ++++++++++--------- fs/cifs/transport.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-)
fs/cifs/smb2ops.c +10 -9
@@ -208,6 +208,16 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,spin_lock (&server->req_lock);while (1 ) { +spin_unlock (&server->req_lock); + +spin_lock (&server->srv_lock); +if (server->tcpStatus == CifsExiting) { +spin_unlock (&server->srv_lock); +return -ENOENT ; + } +spin_unlock (&server->srv_lock); + +spin_lock (&server->req_lock);if (server->credits <=0 ) {spin_unlock (&server->req_lock);cifs_num_waiters_inc (server);
@@ -218,15 +228,6 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,return rc;spin_lock (&server->req_lock); }else { -spin_unlock (&server->req_lock); -spin_lock (&server->srv_lock); -if (server->tcpStatus == CifsExiting) { -spin_unlock (&server->srv_lock); -return -ENOENT ; - } -spin_unlock (&server->srv_lock); - -spin_lock (&server->req_lock); scredits = server->credits;/* can deadlock with reopen */ if (scredits <=8 ) {
fs/cifs/transport.c +10 -10
@@ -522,6 +522,16 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits, }while (1 ) { +spin_unlock (&server->req_lock); + +spin_lock (&server->srv_lock); +if (server->tcpStatus == CifsExiting) { +spin_unlock (&server->srv_lock); +return -ENOENT ; + } +spin_unlock (&server->srv_lock); + +spin_lock (&server->req_lock);if (*credits < num_credits) { scredits = *credits;spin_unlock (&server->req_lock);
@@ -547,15 +557,6 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits,return -ERESTARTSYS ;spin_lock (&server->req_lock); }else { -spin_unlock (&server->req_lock); - -spin_lock (&server->srv_lock); -if (server->tcpStatus == CifsExiting) { -spin_unlock (&server->srv_lock); -return -ENOENT ; - } -spin_unlock (&server->srv_lock); -/* * For normal commands, reserve the last MAX_COMPOUND * credits to compound requests.
@@ -569,7 +570,6 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits,* for servers that are slow to hand out credits on * new sessions. */ -spin_lock (&server->req_lock);if (!optype && num_credits ==1 && server->in_flight >2 *MAX_COMPOUND && *credits <=MAX_COMPOUND ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 426/431 smb: client: fix broken file attrs with nodfs mounts
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
[ Upstream commit d439b29057e26464120fc6c18f97433aa003b5fe ]
*_get_inode_info() functions expect -EREMOTE when query path info calls find a DFS link, regardless whether !CONFIG_CIFS_DFS_UPCALL or 'nodfs' mount option. Otherwise, those files will miss the fake DFS file attributes.
Before patch
$ mount.cifs //srv/dfs /mnt/1 -o ...,nodfs $ ls -l /mnt/1 ls: cannot access '/mnt/1/link': Operation not supported total 0 -rwxr-xr-x 1 root root 0 Jul 26 2022 dfstest2_file1.txt drwxr-xr-x 2 root root 0 Aug 8 2022 dir1 d????????? ? ? ? ? ? link
After patch
$ mount.cifs //srv/dfs /mnt/1 -o ...,nodfs $ ls -l /mnt/1 total 0 -rwxr-xr-x 1 root root 0 Jul 26 2022 dfstest2_file1.txt drwxr-xr-x 2 root root 0 Aug 8 2022 dir1 drwx--x--x 2 root root 0 Jun 26 20:29 link
--- fs/cifs/smb2inode.c | 3 --- 1 file changed, 3 deletions(-)
fs/cifs/smb2inode.c +0 -3
@@ -609,9 +609,6 @@ int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,if (islink) rc = -EREMOTE ; } -if (rc == -EREMOTE &&IS_ENABLED (CONFIG_CIFS_DFS_UPCALL ) && cifs_sb && - (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_DFS )) - rc = -EOPNOTSUPP ; } out:
Signature · 1 line
2.39.2