6.6.23-rc1 review
Subsystems (12)
Sasha Levin
maintainerPATCH 415/638 drm: ci: use clk_ignore_unused for apq8016
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit aa1267e673fe5307cf00d02add4017d2878598b6 ]
If the ADV7511 bridge driver is compiled as a module, while DRM_MSM is built-in, the clk_disable_unused congests with the runtime PM handling of the DSI PHY for the clk_prepare_lock(). This causes apq8016 runner to fail without completing any jobs ([1]). Drop the BM_CMDLINE which duplicate the command line from the .baremetal-igt-arm64 clause and enforce the clk_ignore_unused kernelarg instead to make apq8016 runner work.
[1] https://gitlab.freedesktop.org/drm/msm/-/jobs/54990475
--- drivers/gpu/drm/ci/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/ci/test.yml +4 -1
@@ -104,7 +104,10 @@ msm:apq8016: DRIVER_NAME: msm BM_DTB: https://${PIPELINE_ARTIFACTS_BASE}/arm64/apq8016-sbc.dtb GPU_VERSION: apq8016 - BM_CMDLINE: "ip=dhcp console=ttyMSM0,115200n8 $BM_KERNEL_EXTRA_ARGS root=/dev/nfs rw nfsrootdebug nfsroot=,tcp,nfsvers=4.2 init=/init $BM_KERNELARGS" + # disabling unused clocks congests with the MDSS runtime PM trying to + # disable those clocks and causes boot to fail. + # Reproducer: DRM_MSM=y, DRM_I2C_ADV7511=m + BM_KERNEL_EXTRA_ARGS: clk_ignore_unused RUNNER_TAG: google-freedreno-db410c script: - ./install/bare-metal/fastboot.sh
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 416/638 NTB: fix possible name leak in ntb_register_device()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit aebfdfe39b9327a3077d0df8db3beb3160c9bdd0 ]
If device_register() fails in ntb_register_device(), the device name allocated by dev_set_name() should be freed. As per the comment in device_register(), callers should use put_device() to give up the reference in the error path. So fix this by calling put_device() in the error path so that the name can be freed in kobject_cleanup().
As a result of this, put_device() in the error path of ntb_register_device() is removed and the actual error is returned.
--- drivers/ntb/core.c | 8 +++++++- drivers/pci/endpoint/functions/pci-epf-vntb.c | 6 +----- 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/ntb/core.c +7 -1
@@ -100,6 +100,8 @@ EXPORT_SYMBOL(ntb_unregister_client);int ntb_register_device (struct ntb_dev *ntb) { +int ret; +if (!ntb)return -EINVAL ;if (!ntb->pdev)
@@ -120,7 +122,11 @@ int ntb_register_device(struct ntb_dev *ntb) ntb->ctx_ops =NULL ;spin_lock_init (&ntb->ctx_lock); -return device_register (&ntb->dev); + ret =device_register (&ntb->dev); +if (ret) +put_device (&ntb->dev); + +return ret; }EXPORT_SYMBOL (ntb_register_device);
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -5
@@ -1278,15 +1278,11 @@ static int pci_vntb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret =ntb_register_device (&ndev->ntb);if (ret) {dev_err (dev,"Failed to register NTB device\n" ); - goto err_register_dev; +return ret; }dev_dbg (dev,"PCI Virtual NTB driver loaded\n" );return 0 ; - -err_register_dev: -put_device (&ndev->ntb.dev); -return -EINVAL ; }static struct pci_device_id pci_vntb_table[] = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 417/638 media: cedrus: h265: Fix configuring bitstream size
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 3a11887f7f11a6bb1f05e7f67b3ea20dadfec443 ]
bit_size field holds size of slice, not slice + header. Because of HW quirks, driver can't program in just slice, but also preceding header. But that means that currently used bit_size is wrong (too small). Instead, just use size of whole buffer. There is no harm in doing this.
--- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +4 -6
@@ -427,11 +427,11 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)unsigned int ctb_addr_x, ctb_addr_y;struct cedrus_buffer *cedrus_buf;dma_addr_t src_buf_addr; -dma_addr_t src_buf_end_addr;u32 chroma_log2_weight_denom;u32 num_entry_point_offsets;u32 output_pic_list_index;u32 pic_order_cnt[2 ]; +size_t slice_bytes;u8 padding;int count;u32 reg;
@@ -443,6 +443,7 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run) pred_weight_table = &slice_params->pred_weight_table; num_entry_point_offsets = slice_params->num_entry_point_offsets; cedrus_buf =vb2_to_cedrus_buffer (&run->dst->vb2_buf); + slice_bytes =vb2_get_plane_payload (&run->src->vb2_buf,0 );/* * If entry points offsets are present, we should get them
@@ -490,7 +491,7 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)cedrus_write (dev,VE_DEC_H265_BITS_OFFSET ,0 ); - reg = slice_params->bit_size; + reg = slice_bytes *8 ;cedrus_write (dev,VE_DEC_H265_BITS_LEN , reg);/* Source beginning and end addresses. */
@@ -504,10 +505,7 @@ static int cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)cedrus_write (dev,VE_DEC_H265_BITS_ADDR , reg); - src_buf_end_addr = src_buf_addr + -DIV_ROUND_UP (slice_params->bit_size,8 ); - - reg =VE_DEC_H265_BITS_END_ADDR_BASE (src_buf_end_addr); + reg =VE_DEC_H265_BITS_END_ADDR_BASE (src_buf_addr + slice_bytes);cedrus_write (dev,VE_DEC_H265_BITS_END_ADDR , reg);/* Coding tree block address */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 418/638 media: sun8i-di: Fix coefficient writes
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 794b581f8c6eb7b60fe468ccb96dd3cd38ff779f ]
Currently coefficients are applied only once, since they don't change. However, this is done before enable bit is set and thus it doesn't get applied properly.
Fix that by applying coefficients after enable bit is set. While this means that it will be done evey time, it doesn't bring much time penalty.
--- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +21 -21
@@ -66,6 +66,7 @@ static void deinterlace_device_run(void *priv)struct vb2_v4l2_buffer *src, *dst;unsigned int hstep, vstep;dma_addr_t addr; +int i; src =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx);
@@ -160,6 +161,26 @@ static void deinterlace_device_run(void *priv)deinterlace_write (dev,DEINTERLACE_CH1_HORZ_FACT , hstep);deinterlace_write (dev,DEINTERLACE_CH1_VERT_FACT , vstep); +/* neutral filter coefficients */ +deinterlace_set_bits (dev,DEINTERLACE_FRM_CTRL , +DEINTERLACE_FRM_CTRL_COEF_ACCESS ); +readl_poll_timeout (dev->base +DEINTERLACE_STATUS , val, + val &DEINTERLACE_STATUS_COEF_STATUS ,2 ,40 ); + +for (i =0 ; i <32 ; i++) { +deinterlace_write (dev,DEINTERLACE_CH0_HORZ_COEF0 + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH0_VERT_COEF + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH1_HORZ_COEF0 + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH1_VERT_COEF + i *4 , +DEINTERLACE_IDENTITY_COEF ); + } + +deinterlace_clr_set_bits (dev,DEINTERLACE_FRM_CTRL , +DEINTERLACE_FRM_CTRL_COEF_ACCESS ,0 ); +deinterlace_clr_set_bits (dev,DEINTERLACE_FIELD_CTRL ,DEINTERLACE_FIELD_CTRL_FIELD_CNT_MSK ,DEINTERLACE_FIELD_CTRL_FIELD_CNT (ctx->field));
@@ -248,7 +269,6 @@ static irqreturn_t deinterlace_irq(int irq, void *data)static void deinterlace_init (struct deinterlace_dev *dev) {u32 val; -int i;deinterlace_write (dev,DEINTERLACE_BYPASS ,DEINTERLACE_BYPASS_CSC );
@@ -285,26 +305,6 @@ static void deinterlace_init(struct deinterlace_dev *dev)deinterlace_clr_set_bits (dev,DEINTERLACE_CHROMA_DIFF ,DEINTERLACE_CHROMA_DIFF_TH_MSK ,DEINTERLACE_CHROMA_DIFF_TH (5 )); - -/* neutral filter coefficients */ -deinterlace_set_bits (dev,DEINTERLACE_FRM_CTRL , -DEINTERLACE_FRM_CTRL_COEF_ACCESS ); -readl_poll_timeout (dev->base +DEINTERLACE_STATUS , val, - val &DEINTERLACE_STATUS_COEF_STATUS ,2 ,40 ); - -for (i =0 ; i <32 ; i++) { -deinterlace_write (dev,DEINTERLACE_CH0_HORZ_COEF0 + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH0_VERT_COEF + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH1_HORZ_COEF0 + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH1_VERT_COEF + i *4 , -DEINTERLACE_IDENTITY_COEF ); - } - -deinterlace_clr_set_bits (dev,DEINTERLACE_FRM_CTRL , -DEINTERLACE_FRM_CTRL_COEF_ACCESS ,0 ); }static inline struct deinterlace_ctx *deinterlace_file2ctx (struct file *file)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 419/638 media: sun8i-di: Fix power on/off sequences
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit cff104e33bad38f4b2c8d58816a7accfaa2879f9 ]
According to user manual, reset line should be deasserted before clocks are enabled. Also fix power down sequence to be reverse of that.
--- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +13 -12
@@ -929,11 +929,18 @@ static int deinterlace_runtime_resume(struct device *device)return ret; } + ret =reset_control_deassert (dev->rstc); +if (ret) { +dev_err (dev->dev,"Failed to apply reset\n" ); + + goto err_exclusive_rate; + } + ret =clk_prepare_enable (dev->bus_clk);if (ret) {dev_err (dev->dev,"Failed to enable bus clock\n" ); - goto err_exclusive_rate; + goto err_rst; } ret =clk_prepare_enable (dev->mod_clk);
@@ -950,23 +957,16 @@ static int deinterlace_runtime_resume(struct device *device) goto err_mod_clk; } - ret =reset_control_deassert (dev->rstc); -if (ret) { -dev_err (dev->dev,"Failed to apply reset\n" ); - - goto err_ram_clk; - } -deinterlace_init (dev);return 0 ; -err_ram_clk: -clk_disable_unprepare (dev->ram_clk); err_mod_clk:clk_disable_unprepare (dev->mod_clk); err_bus_clk:clk_disable_unprepare (dev->bus_clk); +err_rst: +reset_control_assert (dev->rstc); err_exclusive_rate:clk_rate_exclusive_put (dev->mod_clk);
@@ -977,11 +977,12 @@ static int deinterlace_runtime_suspend(struct device *device) {struct deinterlace_dev *dev =dev_get_drvdata (device); -reset_control_assert (dev->rstc); -clk_disable_unprepare (dev->ram_clk);clk_disable_unprepare (dev->mod_clk);clk_disable_unprepare (dev->bus_clk); + +reset_control_assert (dev->rstc); +clk_rate_exclusive_put (dev->mod_clk);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 420/638 media: sun8i-di: Fix chroma difference threshold
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 856525e8db272b0ce6d9c6e6c2eeb97892b485a6 ]
While there is no good explanation what this value does, vendor driver uses value 31 for it. Align driver with it.
--- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +1 -1
@@ -304,7 +304,7 @@ static void deinterlace_init(struct deinterlace_dev *dev)deinterlace_clr_set_bits (dev,DEINTERLACE_CHROMA_DIFF ,DEINTERLACE_CHROMA_DIFF_TH_MSK , -DEINTERLACE_CHROMA_DIFF_TH (5 )); +DEINTERLACE_CHROMA_DIFF_TH (31 )); }static inline struct deinterlace_ctx *deinterlace_file2ctx (struct file *file)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 421/638 media: imx: csc/scaler: fix v4l2_ctrl_handler memory leak
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit 4797a3dd46f220e6d83daf54d70c5b33db6deb01 ]
Free the memory allocated in v4l2_ctrl_handler_init on release.
--- drivers/staging/media/imx/imx-media-csc-scaler.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx-media-csc-scaler.c +1 -0
@@ -803,6 +803,7 @@ static int ipu_csc_scaler_release(struct file *file)dev_dbg (priv->dev,"Releasing instance %p\n" , ctx); +v4l2_ctrl_handler_free (&ctx->ctrl_hdlr);v4l2_m2m_ctx_release (ctx->fh.m2m_ctx);v4l2_fh_del (&ctx->fh);v4l2_fh_exit (&ctx->fh);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 422/638 media: go7007: add check of return value of go7007_read_addr()
In reply to Sasha LevinFrom: Daniil Dulov <[email protected]>
[ Upstream commit 0b70530ee740861f4776ff724fcc25023df1799a ]
If go7007_read_addr() returns error channel is not assigned a value. In this case go to allocfail.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/usb/go7007/go7007-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/go7007/go7007-usb.c +3 -1
@@ -1201,7 +1201,9 @@ static int go7007_usb_probe(struct usb_interface *intf,u16 channel;/* read channel number from GPIO[1:0] */ -go7007_read_addr (go,0x3c81 , &channel); +if (go7007_read_addr (go,0x3c81 , &channel)) + goto allocfail; + channel &=0x3 ; go->board_id =GO7007_BOARDID_ADLINK_MPG24 ; usb->board = board = &board_adlink_mpg24;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 423/638 media: pvrusb2: remove redundant NULL check
In reply to Sasha LevinFrom: Daniil Dulov <[email protected]>
[ Upstream commit 95ac1210fb2753f968ebce0730d4fbc553c2a3dc ]
Pointer dip->stream cannot be NULL due to a shift, thus remove redundant NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +0 -5
@@ -1198,11 +1198,6 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, dip->minor_type = pvr2_v4l_type_video; nr_ptr = video_nr; caps |=V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_AUDIO ; -if (!dip->stream) { -pr_err (KBUILD_MODNAME -": Failed to set up pvrusb2 v4l video dev due to missing stream instance\n" ); -return ; - }break ;case VFL_TYPE_VBI : dip->config = pvr2_config_vbi;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 424/638 media: pvrusb2: fix pvr2_stream_callback casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 30baa4a96b23add91a87305baaeba82c4e109e1f ]
clang-16 complains about a control flow integrity (KCFI) issue in pvrusb2, which casts three different prototypes into pvr2_stream_callback:
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c:1070:30: error: cast from 'void (*)(struct pvr2_v4l2_fh *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1070 | pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-context.c:110:6: error: cast from 'void (*)(struct pvr2_context *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
110 | (void (*)(void *))pvr2_context_notify,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-dvb.c:152:6: error: cast from 'void (*)(struct pvr2_dvb_adapter *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
152 | (pvr2_stream_callback) pvr2_dvb_notify, adap);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Change the functions to actually take a void* argument so the cast is no longer needed.
--- drivers/media/usb/pvrusb2/pvrusb2-context.c | 8 ++++---- drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 6 ++++-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-context.c +4 -4
@@ -90,8 +90,10 @@ static void pvr2_context_destroy(struct pvr2_context *mp) } -static void pvr2_context_notify (struct pvr2_context *mp) +static void pvr2_context_notify (void *ptr) { +struct pvr2_context *mp = ptr; +pvr2_context_set_notify (mp,!0 ); }
@@ -106,9 +108,7 @@ static void pvr2_context_check(struct pvr2_context *mp)pvr2_trace (PVR2_TRACE_CTXT ,"pvr2_context %p (initialize)" , mp);/* Finish hardware initialization */ -if (pvr2_hdw_initialize (mp->hdw, - (void (*)(void *))pvr2_context_notify, - mp)) { +if (pvr2_hdw_initialize (mp->hdw, pvr2_context_notify, mp)) { mp->video_stream.stream =pvr2_hdw_get_video_stream (mp->hdw);/* Trigger interface initialization. By doing this
drivers/media/usb/pvrusb2/pvrusb2-dvb.c +4 -2
@@ -88,8 +88,10 @@ static int pvr2_dvb_feed_thread(void *data)return stat; } -static void pvr2_dvb_notify (struct pvr2_dvb_adapter *adap) +static void pvr2_dvb_notify (void *ptr) { +struct pvr2_dvb_adapter *adap = ptr; +wake_up (&adap->buffer_wait_data); }
@@ -149,7 +151,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) }pvr2_stream_set_callback (pvr->video_stream.stream, - (pvr2_stream_callback ) pvr2_dvb_notify, adap); + pvr2_dvb_notify, adap); ret =pvr2_stream_set_buffer_count (stream,PVR2_DVB_BUFFER_COUNT );if (ret <0 )return ret;
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +4 -2
@@ -1033,8 +1033,10 @@ static int pvr2_v4l2_open(struct file *file) } -static void pvr2_v4l2_notify (struct pvr2_v4l2_fh *fhp) +static void pvr2_v4l2_notify (void *ptr) { +struct pvr2_v4l2_fh *fhp = ptr; +wake_up (&fhp->wait_data); }
@@ -1067,7 +1069,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) hdw = fh->channel.mc_head->hdw; sp = fh->pdi->stream->stream; -pvr2_stream_set_callback (sp,(pvr2_stream_callback )pvr2_v4l2_notify,fh); +pvr2_stream_set_callback (sp, pvr2_v4l2_notify, fh);pvr2_hdw_set_stream_type (hdw,fh->pdi->config);if ((ret =pvr2_hdw_set_streaming (hdw,!0 )) <0 )return ret;return pvr2_ioread_set_enabled (fh->rhp,!0 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 425/638 clk: qcom: dispcc-sdm845: Adjust internal GDSC wait times
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 117e7dc697c2739d754db8fe0c1e2d4f1f5d5f82 ]
SDM845 downstream uses non-default values for GDSC internal waits. Program them accordingly to avoid surprises.
--- drivers/clk/qcom/dispcc-sdm845.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/dispcc-sdm845.c +2 -0
@@ -759,6 +759,8 @@ static struct clk_branch disp_cc_mdss_vsync_clk = {static struct gdsc mdss_gdsc = { .gdscr =0x3000 , + .en_few_wait_val =0x6 , + .en_rest_wait_val =0x5 , .pd = { .name ="mdss_gdsc" , },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 426/638 drm/amd/display: Add 'replay' NULL check in 'edp_set_replay_allow_active()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit f6aed043ee5d75b3d1bfc452b1a9584b63c8f76b ]
In the first if statement, we're checking if 'replay' is NULL. But in the second if statement, we're not checking if 'replay' is NULL again before calling replay->funcs->replay_set_power_opt().
if (replay == NULL && force_static)
return false;
...
if (link->replay_settings.replay_feature_enabled &&
replay->funcs->replay_set_power_opt) {
replay->funcs->replay_set_power_opt(replay, *power_opts, panel_inst);
link->replay_settings.replay_power_opt_active = *power_opts;
}If 'replay' is NULL, this will cause a null pointer dereference.
Fixes the below found by smatch:drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:895 edp_set_replay_allow_active() error: we previously assumed 'replay' could be null (see line 887)
--- .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -1
@@ -882,7 +882,8 @@ bool edp_set_replay_allow_active(struct dc_link *link, const bool *allow_active,/* Set power optimization flag */ if (power_opts && link->replay_settings.replay_power_opt_active != *power_opts) { -if (link->replay_settings.replay_feature_enabled && replay->funcs->replay_set_power_opt) { +if (replay !=NULL && link->replay_settings.replay_feature_enabled && + replay->funcs->replay_set_power_opt) { replay->funcs->replay_set_power_opt (replay, *power_opts, panel_inst); link->replay_settings.replay_power_opt_active = *power_opts; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 427/638 drm/panel: boe-tv101wum-nl6: make use of prepare_prev_first
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 42a7a16bedc991190310a02dd202e29cfac52525 ]
The panel on sc7180-trogdor-wormdingler and sc7180-trogdor-quackingstick hasn't been coming up since commit 9e15123eca79 ("drm/msm/dsi: Stop unconditionally powering up DSI hosts at modeset"). Let's add "prepare_prev_first" as has been done for many other DSI panels.
--- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +2 -0
@@ -2239,6 +2239,8 @@ static int boe_panel_add(struct boe_panel *boe)gpiod_set_value (boe->enable_gpio,0 ); + boe->base.prepare_prev_first = true; +drm_panel_init (&boe->base, dev, &boe_panel_funcs,DRM_MODE_CONNECTOR_DSI ); err =of_drm_get_panel_orientation (dev->of_node, &boe->orientation);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 428/638 drm/mediatek: dsi: Fix DSI RGB666 formats and definitions
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit fae6f815505301b92d9113764f4d76d0bfe45607 ]
The register bits definitions for RGB666 formats are wrong in multiple
ways: first, in the DSI_PS_SEL bits region, the Packed 18-bits RGB666 format is selected with bit 1, while the Loosely Packed one is bit 2, and second - the definition name "LOOSELY_PS_18BIT_RGB666" is wrong because the loosely packed format is 24 bits instead!
Either way, functions mtk_dsi_ps_control_vact() and mtk_dsi_ps_control() do not even agree on the DSI_PS_SEL bit to set in DSI_PSCTRL: one sets loosely packed (24) on RGB666, the other sets packed (18), and the other way around for RGB666_PACKED.
Fixing this entire stack of issues is done in one go:
- Use the correct bit for the Loosely Packed RGB666 definition
- Rename LOOSELY_PS_18BIT_RGB666 to LOOSELY_PS_24BIT_RGB666
- Change ps_bpp_mode in mtk_dsi_ps_control_vact() to set:
- Loosely Packed, 24-bits for MIPI_DSI_FMT_RGB666
- Packed, 18-bits for MIPI_DSI_FMT_RGB666_PACKED
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +5 -5
@@ -71,8 +71,8 @@#define DSI_PS_WC 0x3fff#define DSI_PS_SEL (3 << 16)#define PACKED_PS_16BIT_RGB565 (0 << 16) -#define LOOSELY_PS_18BIT_RGB666 (1 << 16) -#define PACKED_PS_18BIT_RGB666 (2 << 16) +#define PACKED_PS_18BIT_RGB666 (1 << 16) +#define LOOSELY_PS_24BIT_RGB666 (2 << 16)#define PACKED_PS_24BIT_RGB888 (3 << 16)#define DSI_VSA_NL 0x20
@@ -367,10 +367,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi) ps_bpp_mode |=PACKED_PS_24BIT_RGB888 ;break ;case MIPI_DSI_FMT_RGB666 : - ps_bpp_mode |=PACKED_PS_18BIT_RGB666 ; + ps_bpp_mode |=LOOSELY_PS_24BIT_RGB666 ;break ;case MIPI_DSI_FMT_RGB666_PACKED : - ps_bpp_mode |=LOOSELY_PS_18BIT_RGB666 ; + ps_bpp_mode |=PACKED_PS_18BIT_RGB666 ;break ;case MIPI_DSI_FMT_RGB565 : ps_bpp_mode |=PACKED_PS_16BIT_RGB565 ;
@@ -424,7 +424,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi) dsi_tmp_buf_bpp =3 ;break ;case MIPI_DSI_FMT_RGB666 : - tmp_reg =LOOSELY_PS_18BIT_RGB666 ; + tmp_reg =LOOSELY_PS_24BIT_RGB666 ; dsi_tmp_buf_bpp =3 ;break ;case MIPI_DSI_FMT_RGB666_PACKED :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 429/638 PCI: Mark 3ware-9650SE Root Port Extended Tags as broken
In reply to Sasha LevinFrom: Jörg Wedekind <[email protected]>
[ Upstream commit baf67aefbe7d7deafa59ca49612d163f8889934c ]
Per PCIe r6.1, sec 2.2.6.2 and 7.5.3.4, a Requester may not use 8-bit Tags unless its Extended Tag Field Enable is set, but all Receivers/Completers must handle 8-bit Tags correctly regardless of their Extended Tag Field Enable.
Some devices do not handle 8-bit Tags as Completers, so add a quirk for them. If we find such a device, we disable Extended Tags for the entire hierarchy to make peer-to-peer DMA possible.
The 3ware 9650SE seems to have issues with handling 8-bit tags. Mark it as broken.
This fixes PCI Parity Errors like :
3w-9xxx: scsi0: ERROR: (0x06:0x000C): PCI Parity Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000D): PCI Abort: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000E): Controller Queue Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x0010): Microcontroller Error: clearing.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -5520,6 +5520,7 @@ static void quirk_no_ext_tags(struct pci_dev *pdev)pci_walk_bus (bridge->bus, pci_configure_extended_tags,NULL ); } +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_3WARE ,0x1004 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0132 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0140 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0141 , quirk_no_ext_tags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 430/638 powerpc/ps3: Fix lv1 hcall assembly for ELFv2 calling convention
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 6735fef14c1f089ae43fd6d43add818b7ff682a8 ]
Stack-passed parameters begin at a different offset in the caller's stack in the ELFv2 ABI.
--- arch/powerpc/include/asm/ppc_asm.h | 6 ++++-- arch/powerpc/platforms/ps3/hvcall.S | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-)
arch/powerpc/include/asm/ppc_asm.h +4 -2
@@ -201,11 +201,13 @@#ifdef CONFIG_PPC64_ELF_ABI_V2 #define STK_GOT 24 -#define __STK_PARAM (i) (32 + ((i)-3)*8) +#define STK_PARAM_AREA 32#else #define STK_GOT 40 -#define __STK_PARAM (i) (48 + ((i)-3)*8) +#define STK_PARAM_AREA 48#endif + +#define __STK_PARAM (i) (STK_PARAM_AREA + ((i)-3)*8)#define STK_PARAM (i) __STK_PARAM(__REG_##i)#ifdef CONFIG_PPC64_ELF_ABI_V2
arch/powerpc/platforms/ps3/hvcall.S +9 -9
@@ -714,7 +714,7 @@ _GLOBAL(_##API_NAME) \ std r4, 0(r11); \ ld r11, -16(r1); \ std r5, 0(r11); \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r6, 0(r11); \ \ ld r0, 16(r1); \
@@ -746,22 +746,22 @@ _GLOBAL(_##API_NAME) \ mflr r0; \ std r0, 16(r1); \ \ - std r10, 48+8*7(r1); \ + std r10, STK_PARAM_AREA+8*7(r1); \ \ li r11, API_NUMBER; \ lv1call; \ \ - ld r11, 48+8*7(r1); \ + ld r11, STK_PARAM_AREA+8*7(r1); \ std r4, 0(r11); \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r5, 0(r11); \ - ld r11, 48+8*9(r1); \ + ld r11, STK_PARAM_AREA+8*9(r1); \ std r6, 0(r11); \ - ld r11, 48+8*10(r1); \ + ld r11, STK_PARAM_AREA+8*10(r1); \ std r7, 0(r11); \ - ld r11, 48+8*11(r1); \ + ld r11, STK_PARAM_AREA+8*11(r1); \ std r8, 0(r11); \ - ld r11, 48+8*12(r1); \ + ld r11, STK_PARAM_AREA+8*12(r1); \ std r9, 0(r11); \ \ ld r0, 16(r1); \
@@ -777,7 +777,7 @@ _GLOBAL(_##API_NAME) \ li r11, API_NUMBER; \ lv1call; \ \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r4, 0(r11); \ \ ld r0, 16(r1); \
Signature · 1 line
2.43.0
Re: [PATCH 6.6 430/638] powerpc/ps3: Fix lv1 hcall assembly for ELFv2 calling convention
Quoted 14 lines · Sasha Levin
From: Nicholas Piggin <[email protected]>
[ Upstream commit
6735fef14c1f089ae43fd6d43add818b7ff682a8]Stack-passed parameters begin at a different offset in the caller's stack in the ELFv2 ABI.
Reported-by Geoff Levand <[email protected]>Fixes 8c5fa3b5c4df ("powerpc/64: Make ELFv2 the default for big-endian builds")Signed-off-by Nicholas Piggin <[email protected]>Tested-by Geoff Levand <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 4 lines
--- arch/powerpc/include/asm/ppc_asm.h | 6 ++++-- arch/powerpc/platforms/ps3/hvcall.S | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-)
This commit is OK on its own, but it doesn't have any effect unless the full series up to 914d081ead11 ("Revert "powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2"") is backported.
I don't think the full series warrants backporting, it's really enabling a new feature (ELFv2 build for ps3).
So IMHO please drop this patch from 6.6, 6.7, 6.8.
cheers
Quoted 74 lines
arch/powerpc/include/asm/ppc_asm.h +4
-2@@ -201,11 +201,13 @@#ifdef CONFIG_PPC64_ELF_ABI_V2 #define STK_GOT 24 -#define __STK_PARAM (i) (32 + ((i)-3)*8) +#define STK_PARAM_AREA 32#else #define STK_GOT 40 -#define __STK_PARAM (i) (48 + ((i)-3)*8) +#define STK_PARAM_AREA 48#endif + +#define __STK_PARAM (i) (STK_PARAM_AREA + ((i)-3)*8)#define STK_PARAM (i) __STK_PARAM(__REG_##i)#ifdef CONFIG_PPC64_ELF_ABI_V2 arch/powerpc/platforms/ps3/hvcall.S +9
-9@@ -714,7 +714,7 @@ _GLOBAL(_##API_NAME) \ std r4, 0(r11); \ ld r11, -16(r1); \ std r5, 0(r11); \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r6, 0(r11); \ \ ld r0, 16(r1); \@@ -746,22 +746,22 @@ _GLOBAL(_##API_NAME) \ mflr r0; \ std r0, 16(r1); \ \ - std r10, 48+8*7(r1); \ + std r10, STK_PARAM_AREA+8*7(r1); \ \ li r11, API_NUMBER; \ lv1call; \ \ - ld r11, 48+8*7(r1); \ + ld r11, STK_PARAM_AREA+8*7(r1); \ std r4, 0(r11); \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r5, 0(r11); \ - ld r11, 48+8*9(r1); \ + ld r11, STK_PARAM_AREA+8*9(r1); \ std r6, 0(r11); \ - ld r11, 48+8*10(r1); \ + ld r11, STK_PARAM_AREA+8*10(r1); \ std r7, 0(r11); \ - ld r11, 48+8*11(r1); \ + ld r11, STK_PARAM_AREA+8*11(r1); \ std r8, 0(r11); \ - ld r11, 48+8*12(r1); \ + ld r11, STK_PARAM_AREA+8*12(r1); \ std r9, 0(r11); \ \ ld r0, 16(r1); \@@ -777,7 +777,7 @@ _GLOBAL(_##API_NAME) \ li r11, API_NUMBER; \ lv1call; \ \ - ld r11, 48+8*8(r1); \ + ld r11, STK_PARAM_AREA+8*8(r1); \ std r4, 0(r11); \ \ ld r0, 16(r1); \Signature · 1 line
2.43.0
Sasha Levin
maintainerRe: [PATCH 6.6 430/638] powerpc/ps3: Fix lv1 hcall assembly for ELFv2 calling convention
Quoted 20 lines · Michael Ellerman
Quoted 14 lines · Sasha Levin
From: Nicholas Piggin <[email protected]>
[ Upstream commit
6735fef14c1f089ae43fd6d43add818b7ff682a8]Stack-passed parameters begin at a different offset in the caller's stack in the ELFv2 ABI.
Reported-by Geoff Levand <[email protected]>Fixes 8c5fa3b5c4df ("powerpc/64: Make ELFv2 the default for big-endian builds")Signed-off-by Nicholas Piggin <[email protected]>Tested-by Geoff Levand <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 4 lines
--- arch/powerpc/include/asm/ppc_asm.h | 6 ++++-- arch/powerpc/platforms/ps3/hvcall.S | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-)
Quoted 8 lines
This commit is OK on its own, but it doesn't have any effect unless the full series up to
914d081ead11("Revert "powerpc/ps3_defconfig: DisablePPC64_BIG_ENDIAN_ELF_ABI_V2"") is backported.I don't think the full series warrants backporting, it's really enabling a new feature (ELFv2 build for ps3).
So IMHO please drop this patch from 6.6, 6.7, 6.8.
Dropped, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 431/638 pinctrl: renesas: Allow the compiler to optimize away sh_pfc_pm
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit a6f06b909fee72c679c565adfa7f080f9595e336 ]
The conversion to DEFINE_NOIRQ_DEV_PM_OPS() lost the ability of the compiler to optimize away the struct dev_pm_ops object when it is not needed.
Fix this by replacing the use of pm_sleep_ptr() by a custom wrapper.
--- drivers/pinctrl/renesas/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/core.c +3 -1
@@ -731,10 +731,12 @@ static int sh_pfc_resume_noirq(struct device *dev)sh_pfc_walk_regs (pfc, sh_pfc_restore_reg);return 0 ; } +#define pm_psci_sleep_ptr (_ptr) pm_sleep_ptr(_ptr)#else static int sh_pfc_suspend_init (struct sh_pfc *pfc) {return 0 ; }static int sh_pfc_suspend_noirq (struct device *dev) {return 0 ; }static int sh_pfc_resume_noirq (struct device *dev) {return 0 ; } +#define pm_psci_sleep_ptr (_ptr) PTR_IF(false, (_ptr))#endif /* CONFIG_ARM_PSCI_FW */ static DEFINE_NOIRQ_DEV_PM_OPS(sh_pfc_pm, sh_pfc_suspend_noirq, sh_pfc_resume_noirq);
@@ -1415,7 +1417,7 @@ static struct platform_driver sh_pfc_driver = { .driver = { .name = DRV_NAME, .of_match_table = of_match_ptr(sh_pfc_of_table), - .pm = pm_sleep_ptr(&sh_pfc_pm), + .pm = pm_psci_sleep_ptr(&sh_pfc_pm), }, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 432/638 clk: hisilicon: hi3519: Release the correct number of gates in hi3519_clk_unregister()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 74e39f526d95c0c119ada1874871ee328c59fbee ]
The gates are stored in 'hi3519_gate_clks', not 'hi3519_mux_clks'. This is also in line with how hisi_clk_register_gate() is called in the probe.
--- drivers/clk/hisilicon/clk-hi3519.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/hisilicon/clk-hi3519.c +1 -1
@@ -130,7 +130,7 @@ static void hi3519_clk_unregister(struct platform_device *pdev)of_clk_del_provider (pdev->dev.of_node);hisi_clk_unregister_gate (hi3519_gate_clks, -ARRAY_SIZE (hi3519_mux_clks), +ARRAY_SIZE (hi3519_gate_clks), crg->clk_data); hisi_clk_unregister_mux(hi3519_mux_clks, ARRAY_SIZE(hi3519_mux_clks),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 433/638 clk: hisilicon: hi3559a: Fix an erroneous devm_kfree()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 64c6a38136b74a2f18c42199830975edd9fbc379 ]
'p_clk' is an array allocated just before the for loop for all clk that need to be registered.
It is incremented at each loop iteration.
If a clk_register() call fails, 'p_clk' may point to something different from what should be freed.
The best we can do, is to avoid this wrong release of memory.
--- drivers/clk/hisilicon/clk-hi3559a.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/hisilicon/clk-hi3559a.c +0 -1
@@ -491,7 +491,6 @@ static void hisi_clk_register_pll(struct hi3559av100_pll_clock *clks, clk =clk_register (NULL , &p_clk->hw);if (IS_ERR (clk)) { -devm_kfree (dev, p_clk);dev_err (dev,"%s: failed to register clock %s\n" , __func__, clks[i].name);continue ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 434/638 clk: mediatek: mt8135: Fix an error handling path in clk_mt8135_apmixed_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 03c1c51eba6be49b42816af9db114553131af6c8 ]
If an error occurs after mtk_alloc_clk_data(), mtk_free_clk_data() should be called, as already done in the remove function.
--- drivers/clk/mediatek/clk-mt8135-apmixedsys.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8135-apmixedsys.c +3 -1
@@ -59,7 +59,7 @@ static int clk_mt8135_apmixed_probe(struct platform_device *pdev) ret =mtk_clk_register_plls (node, plls,ARRAY_SIZE (plls), clk_data);if (ret) -return ret; + goto free_clk_data; ret =of_clk_add_hw_provider (node, of_clk_hw_onecell_get, clk_data);if (ret)
@@ -69,6 +69,8 @@ static int clk_mt8135_apmixed_probe(struct platform_device *pdev) unregister_plls:mtk_clk_unregister_plls (plls,ARRAY_SIZE (plls), clk_data); +free_clk_data: +mtk_free_clk_data (clk_data);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 435/638 clk: mediatek: mt7622-apmixedsys: Fix an error handling path in clk_mt8135_apmixed_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a32e88f2b20259f5fe4f8eed598bbc85dc4879ed ]
'clk_data' is allocated with mtk_devm_alloc_clk_data(). So calling mtk_free_clk_data() explicitly in the remove function would lead to a double-free.
Remove the redundant call.
--- drivers/clk/mediatek/clk-mt7622-apmixedsys.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/mediatek/clk-mt7622-apmixedsys.c +0 -1
@@ -127,7 +127,6 @@ static void clk_mt7622_apmixed_remove(struct platform_device *pdev)of_clk_del_provider (node);mtk_clk_unregister_gates (apmixed_clks,ARRAY_SIZE (apmixed_clks), clk_data);mtk_clk_unregister_plls (plls,ARRAY_SIZE (plls), clk_data); -mtk_free_clk_data (clk_data); }static const struct of_device_id of_match_clk_mt7622_apmixed[] = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 436/638 clk: mediatek: mt8183: Correct parent of CLK_INFRA_SSPM_32K_SELF
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit a65083fa663a335008e34f65e184041174a9dc7e ]
CLK_INFRA_SSPM_32K_SELF has the "f_f26m_ck" clock assigned as its parent. This is inconsistent as the clock is part of a group that are all gates without dividers, and this makes the kernel think it runs at 26 MHz.
After clarification from MediaTek engineers, the correct parent is actually the system 32 KHz clock.
--- drivers/clk/mediatek/clk-mt8183.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8183.c +1 -1
@@ -790,7 +790,7 @@ static const struct mtk_gate infra_clks[] = {/* infra_sspm_26m_self is main clock in co-processor, should not be closed in Linux. */ GATE_INFRA3_FLAGS (CLK_INFRA_SSPM_26M_SELF ,"infra_sspm_26m_self" ,"f_f26m_ck" ,3 ,CLK_IS_CRITICAL ),/* infra_sspm_32k_self is main clock in co-processor, should not be closed in Linux. */ -GATE_INFRA3_FLAGS (CLK_INFRA_SSPM_32K_SELF ,"infra_sspm_32k_self" ,"f_f26m_ck" ,4 ,CLK_IS_CRITICAL ), +GATE_INFRA3_FLAGS (CLK_INFRA_SSPM_32K_SELF ,"infra_sspm_32k_self" ,"clk32k" ,4 ,CLK_IS_CRITICAL ),GATE_INFRA3 (CLK_INFRA_UFS_AXI ,"infra_ufs_axi" ,"axi_sel" ,5 ),GATE_INFRA3 (CLK_INFRA_I2C6 ,"infra_i2c6" ,"i2c_sel" ,6 ), GATE_INFRA3(CLK_INFRA_AP_MSDC0, "infra_ap_msdc0", "msdc50_hclk_sel", 7),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 437/638 clk: mediatek: mt7981-topckgen: flag SGM_REG_SEL as critical
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit aa690050c00a251ab69e3c5204d582833d0b958c ]
Without the SGM_REG_SEL clock enabled the cpu freezes if trying to access registers used by MT7981 clock drivers itself. Mark SGM_REG_SEL as critical to make sure it is always enabled to prevent freezes on boot even if the Ethernet driver which prepares and enables the clock is not loaded or probed at a later point.
--- drivers/clk/mediatek/clk-mt7981-topckgen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/mediatek/clk-mt7981-topckgen.c +3 -2
@@ -357,8 +357,9 @@ static const struct mtk_mux top_muxes[] = {MUX_GATE_CLR_SET_UPD (CLK_TOP_SGM_325M_SEL ,"sgm_325m_sel" , sgm_325m_parents,0x050 ,0x054 ,0x058 ,8 ,1 ,15 ,0x1C0 ,21 ), -MUX_GATE_CLR_SET_UPD (CLK_TOP_SGM_REG_SEL ,"sgm_reg_sel" , sgm_reg_parents, -0x050 ,0x054 ,0x058 ,16 ,1 ,23 ,0x1C0 ,22 ), +MUX_GATE_CLR_SET_UPD_FLAGS (CLK_TOP_SGM_REG_SEL ,"sgm_reg_sel" , sgm_reg_parents, +0x050 ,0x054 ,0x058 ,16 ,1 ,23 ,0x1C0 ,22 , +CLK_IS_CRITICAL |CLK_SET_RATE_PARENT ),MUX_GATE_CLR_SET_UPD (CLK_TOP_EIP97B_SEL ,"eip97b_sel" , eip97b_parents, 0x050, 0x054, 0x058, 24, 3, 31, 0x1C0, 23),/* CLK_CFG_6 */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 438/638 drm/tegra: put drm_gem_object ref on error in tegra_fb_create
In reply to Sasha LevinFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 32e5a120a5105bce01561978ee55aee8e40ac0dc ]
Inside tegra_fb_create(), drm_gem_object_lookup() increments ref count of the found object. But if the following size check fails then the last found object's ref count should be put there as the unreferencing loop can't detect this situation.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/gpu/drm/tegra/fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/fb.c +1 -0
@@ -159,6 +159,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,if (gem->size < size) { err = -EINVAL ; +drm_gem_object_put (gem); goto unreference; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 439/638 media: ivsc: csi: Swap SINK and SOURCE pads
In reply to Sasha LevinFrom: Sakari Ailus <[email protected]>
[ Upstream commit 48f5fd8967f8dd01679fc1618b0cba02095cddc5 ]
This patch swaps SINK and SOURCE pads of the MEI CSI sub-device. While this does change the UAPI by swapping the pads, the driver has never been usable in upstream kernel as the Intel IPU6 driver it depends on any functionality has not yet been merged.
--- drivers/media/pci/intel/ivsc/mei_csi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/intel/ivsc/mei_csi.c +2 -2
@@ -72,8 +72,8 @@ enum ivsc_privacy_status { };enum csi_pads { -CSI_PAD_SOURCE ,CSI_PAD_SINK , +CSI_PAD_SOURCE ,CSI_NUM_PADS };
@@ -585,7 +585,7 @@ static int mei_csi_notify_bound(struct v4l2_async_notifier *notifier, csi->remote_pad = pad;return media_create_pad_link (&subdev->entity, pad, - &csi->subdev.entity,1 , + &csi->subdev.entity,CSI_PAD_SINK ,MEDIA_LNK_FL_ENABLED |MEDIA_LNK_FL_IMMUTABLE ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 440/638 media: i2c: imx290: Fix IMX920 typo
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 6fc62efa266b0918c7b226f45c2eccfcf99a6d8e ]
Replace IMX920 by IMX290.
--- drivers/media/i2c/imx290.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/media/i2c/imx290.c +8 -8
@@ -150,10 +150,10 @@#define IMX290_PIXEL_ARRAY_WIDTH 1945#define IMX290_PIXEL_ARRAY_HEIGHT 1097 -#define IMX920_PIXEL_ARRAY_MARGIN_LEFT 12 -#define IMX920_PIXEL_ARRAY_MARGIN_RIGHT 13 -#define IMX920_PIXEL_ARRAY_MARGIN_TOP 8 -#define IMX920_PIXEL_ARRAY_MARGIN_BOTTOM 9 +#define IMX290_PIXEL_ARRAY_MARGIN_LEFT 12 +#define IMX290_PIXEL_ARRAY_MARGIN_RIGHT 13 +#define IMX290_PIXEL_ARRAY_MARGIN_TOP 8 +#define IMX290_PIXEL_ARRAY_MARGIN_BOTTOM 9#define IMX290_PIXEL_ARRAY_RECORDING_WIDTH 1920#define IMX290_PIXEL_ARRAY_RECORDING_HEIGHT 1080
@@ -1161,10 +1161,10 @@ static int imx290_get_selection(struct v4l2_subdev *sd,* The sensor moves the readout by 1 pixel based on flips to * keep the Bayer order the same. */ - sel->r.top =IMX920_PIXEL_ARRAY_MARGIN_TOP + sel->r.top =IMX290_PIXEL_ARRAY_MARGIN_TOP + (IMX290_PIXEL_ARRAY_RECORDING_HEIGHT - format->height) /2 + imx290->vflip->val; - sel->r.left =IMX920_PIXEL_ARRAY_MARGIN_LEFT + sel->r.left =IMX290_PIXEL_ARRAY_MARGIN_LEFT + (IMX290_PIXEL_ARRAY_RECORDING_WIDTH - format->width) /2 + imx290->hflip->val; sel->r.width = format->width;
@@ -1183,8 +1183,8 @@ static int imx290_get_selection(struct v4l2_subdev *sd,return 0 ;case V4L2_SEL_TGT_CROP_DEFAULT : - sel->r.top =IMX920_PIXEL_ARRAY_MARGIN_TOP ; - sel->r.left =IMX920_PIXEL_ARRAY_MARGIN_LEFT ; + sel->r.top =IMX290_PIXEL_ARRAY_MARGIN_TOP ; + sel->r.left =IMX290_PIXEL_ARRAY_MARGIN_LEFT ; sel->r.width =IMX290_PIXEL_ARRAY_RECORDING_WIDTH ; sel->r.height =IMX290_PIXEL_ARRAY_RECORDING_HEIGHT ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 441/638 mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit d2b0680cf3b05490b579e71b0df6e07451977745 ]
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node.
--- drivers/mfd/syscon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/syscon.c +3 -1
@@ -238,7 +238,9 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,return ERR_PTR (-ENODEV ); regmap =syscon_node_to_regmap (syscon_np); -of_node_put (syscon_np); + +if (property) +of_node_put (syscon_np);return regmap; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 442/638 mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit e28c28a34ee9fa2ea671a20e5e7064e6220d55e7 ]
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node.
--- drivers/mfd/altera-sysmgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/altera-sysmgr.c +3 -1
@@ -109,7 +109,9 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, dev =driver_find_device_by_of_node (&altr_sysmgr_driver.driver, (void *)sysmgr_np); -of_node_put (sysmgr_np); +if (property) +of_node_put (sysmgr_np); +if (!dev)return ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 443/638 perf print-events: make is_event_supported() more robust
In reply to Sasha LevinFrom: Mark Rutland <[email protected]>
[ Upstream commit 25412c0364f7110faa6053c73e3fd47ca956b8c3 ]
Currently the perf tool doesn't detect support for extended event types on Apple M1/M2 systems, and will not auto-expand plain PERF_EVENT_TYPE hardware events into per-PMU events. This is due to the detection of extended event types not handling mandatory filters required by the M1/M2 PMU driver.
PMU drivers and the core perf_events code can require that perf_event_attr::exclude_* filters are configured in a specific way and may reject certain configurations of filters, for example:
(a) Many PMUs lack support for any event filtering, and require all perf_event_attr::exclude_* bits to be clear. This includes Alpha's CPU PMU, and ARM CPU PMUs prior to the introduction of PMUv2 in ARMv7,
(b) When /proc/sys/kernel/perf_event_paranoid >= 2, the perf core requires that perf_event_attr::exclude_kernel is set.
(c) The Apple M1/M2 PMU requires that perf_event_attr::exclude_guest is set as the hardware PMU does not count while a guest is running (but might be extended in future to do so).
In is_event_supported(), we try to account for cases (a) and (b), first attempting to open an event without any filters, and if this fails, retrying with perf_event_attr::exclude_kernel set. We do not account for case (c), or any other filters that drivers could theoretically require to be set.
Thus is_event_supported() will fail to detect support for any events targeting an Apple M1/M2 PMU, even where events would be supported with perf_event_attr:::exclude_guest set.
Since commit:
82fe2e45cdb00de4 ("perf pmus: Check if we can encode the PMU number in perf_event_attr.type")
... we use is_event_supported() to detect support for extended types, with the PMU ID encoded into the perf_event_attr::type. As above, on an Apple M1/M2 system this will always fail to detect that the event is supported, and consequently we fail to detect support for extended types even when these are supported, as they have been since commit:
5c816728651ae425 ("arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability")
Due to this, the perf tool will not automatically expand plain PERF_TYPE_HARDWARE events into per-PMU events, even when all the necessary kernel support is present.
This patch updates is_event_supported() to additionally try opening events with perf_event_attr::exclude_guest set, allowing support for events to be detected on Apple M1/M2 systems. I believe that this is sufficient for all contemporary CPU PMU drivers, though in future it may be necessary to check for other combinations of filter bits.
I've deliberately changed the check to not expect a specific error code for missing filters, as today ;the kernel may return a number of different error codes for missing filters (e.g. -EACCESS, -EINVAL, or -EOPNOTSUPP) depending on why and where the filter configuration is rejected, and retrying for any error is more robust.
Note that this does not remove the need for commit:
a24d9d9dc096fc0d ("perf parse-events: Make legacy events lower priority than sysfs/JSON")
... which is still necessary so that named-pmu/event/ events work on kernels without extended type support, even if the event name happens to be the same as a PERF_EVENT_TYPE_HARDWARE event (e.g. as is the case for the M1/M2 PMU's 'cycles' and 'instructions' events).
--- tools/perf/util/print-events.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
tools/perf/util/print-events.c +19 -8
@@ -232,7 +232,6 @@ void print_sdt_events(const struct print_callbacks *print_cb, void *print_state)bool is_event_supported (u8 type,u64 config) {bool ret = true; -int open_return;struct evsel *evsel;struct perf_event_attr attr = { .type = type,
@@ -246,20 +245,32 @@ bool is_event_supported(u8 type, u64 config) evsel =evsel__new (&attr);if (evsel) { - open_return =evsel__open (evsel,NULL , tmap); - ret = open_return >=0 ; + ret =evsel__open (evsel,NULL , tmap) >=0 ; -if (open_return == -EACCES ) { +if (!ret) {/* -* This happens if the paranoid value +* The event may fail to open if the paranoid value * /proc/sys/kernel/perf_event_paranoid is set to 2 -* Re-run with exclude_kernel set; we don't do that -* by default as some ARM machines do not support it. -* +* Re-run with exclude_kernel set; we don't do that by +* default as some ARM machines do not support it. */ evsel->core.attr.exclude_kernel =1 ; ret =evsel__open (evsel,NULL , tmap) >=0 ; } + +if (!ret) { +/* +* The event may fail to open if the PMU requires +* exclude_guest to be set (e.g. as the Apple M1 PMU +* requires). +* Re-run with exclude_guest set; we don't do that by +* default as it's equally legitimate for another PMU +* driver to require that exclude_guest is clear. +*/ + evsel->core.attr.exclude_guest =1 ; + ret =evsel__open (evsel,NULL , tmap) >=0 ; + } +evsel__delete (evsel); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 444/638 crypto: arm/sha - fix function cast warnings
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 53cc9baeb9bc2a187eb9c9790d30995148852b12 ]
clang-16 warns about casting between incompatible function types:
arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsigned int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
37 | (sha256_block_fn *)sha256_block_data_order);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, int)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
34 | (sha512_block_fn *)sha512_block_data_order);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Fix the prototypes for the assembler functions to match the typedef. The code already relies on the digest being the first part of the state structure, so there is no change in behavior.
--- arch/arm/crypto/sha256_glue.c | 13 +++++-------- arch/arm/crypto/sha512-glue.c | 12 +++++------- 2 files changed, 10 insertions(+), 15 deletions(-)
arch/arm/crypto/sha256_glue.c +5 -8
@@ -24,8 +24,8 @@#include "sha256_glue.h" -asmlinkage void sha256_block_data_order(u32 *digest, const void *data, -unsigned int num_blks); +asmlinkage void sha256_block_data_order(struct sha256_state *state, +const u8 *data,int num_blks);int crypto_sha256_arm_update (struct shash_desc *desc,const u8 *data,unsigned int len)
@@ -33,23 +33,20 @@ int crypto_sha256_arm_update(struct shash_desc *desc, const u8 *data,/* make sure casting to sha256_block_fn() is safe */ BUILD_BUG_ON (offsetof(struct sha256_state , state) !=0 ); -return sha256_base_do_update (desc, data, len, - (sha256_block_fn *)sha256_block_data_order); +return sha256_base_do_update (desc, data, len, sha256_block_data_order); }EXPORT_SYMBOL (crypto_sha256_arm_update);static int crypto_sha256_arm_final (struct shash_desc *desc,u8 *out) { -sha256_base_do_finalize (desc, - (sha256_block_fn *)sha256_block_data_order); +sha256_base_do_finalize (desc, sha256_block_data_order);return sha256_base_finish (desc, out); }int crypto_sha256_arm_finup (struct shash_desc *desc,const u8 *data,unsigned int len,u8 *out) { -sha256_base_do_update (desc, data, len, - (sha256_block_fn *)sha256_block_data_order); +sha256_base_do_update (desc, data, len, sha256_block_data_order);return crypto_sha256_arm_final (desc, out); }EXPORT_SYMBOL (crypto_sha256_arm_finup);
arch/arm/crypto/sha512-glue.c +5 -7
@@ -25,27 +25,25 @@ MODULE_ALIAS_CRYPTO("sha512");MODULE_ALIAS_CRYPTO ("sha384-arm" );MODULE_ALIAS_CRYPTO ("sha512-arm" ); -asmlinkage void sha512_block_data_order(u64 *state, u8 const *src, int blocks); +asmlinkage void sha512_block_data_order(struct sha512_state *state, +u8 const *src,int blocks);int sha512_arm_update (struct shash_desc *desc,const u8 *data,unsigned int len) { -return sha512_base_do_update (desc, data, len, - (sha512_block_fn *)sha512_block_data_order); +return sha512_base_do_update (desc, data, len, sha512_block_data_order); }static int sha512_arm_final (struct shash_desc *desc,u8 *out) { -sha512_base_do_finalize (desc, - (sha512_block_fn *)sha512_block_data_order); +sha512_base_do_finalize (desc, sha512_block_data_order);return sha512_base_finish (desc, out); }int sha512_arm_finup (struct shash_desc *desc,const u8 *data,unsigned int len,u8 *out) { -sha512_base_do_update (desc, data, len, - (sha512_block_fn *)sha512_block_data_order); +sha512_base_do_update (desc, data, len, sha512_block_data_order);return sha512_arm_final (desc, out); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 445/638 crypto: ccp - Avoid discarding errors in psp_send_platform_access_msg()
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 0e8fca2f12ceb77c3a6b6f210135031f264aa612 ]
Errors can potentially occur in the "processing" of PSP commands or commands can be processed successfully but still return an error code in the header.
This second case was being discarded because PSP communication worked but the command returned an error code in the payload header.
Capture both cases and return them to the caller as -EIO for the caller to investigate. The caller can detect the latter by looking at req->header->status.
--- drivers/crypto/ccp/platform-access.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/crypto/ccp/platform-access.c +9 -2
@@ -118,9 +118,16 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, goto unlock; } -/* Store the status in request header for caller to investigate */ +/* +* Read status from PSP. If status is non-zero, it indicates an error +* occurred during "processing" of the command. +* If status is zero, it indicates the command was "processed" +* successfully, but the result of the command is in the payload. +* Return both cases to the caller as -EIO to investigate. +*/ cmd_reg =ioread32 (cmd); - req->header.status =FIELD_GET (PSP_CMDRESP_STS , cmd_reg); +if (FIELD_GET (PSP_CMDRESP_STS , cmd_reg)) + req->header.status =FIELD_GET (PSP_CMDRESP_STS , cmd_reg);if (req->header.status) { ret = -EIO ; goto unlock;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 446/638 crypto: qat - avoid division by zero
In reply to Sasha LevinFrom: Adam Guerin <[email protected]>
[ Upstream commit f99fb7d660f7c818105803f1f1915396a14d18ad ]
Check if delta_us is not zero and return -EINVAL if it is. delta_us is unlikely to be zero as there is a sleep between the reads of the two timestamps.
This is to fix the following warning when compiling the QAT driver using clang scan-build:
drivers/crypto/intel/qat/qat_common/adf_clock.c:87:9: warning: Division by zero [core.DivideZero]
87 | temp = DIV_ROUND_CLOSEST_ULL(temp, delta_us);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/crypto/intel/qat/qat_common/adf_clock.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/intel/qat/qat_common/adf_clock.c +3 -0
@@ -82,6 +82,9 @@ static int measure_clock(struct adf_accel_dev *accel_dev, u32 *frequency) } delta_us =timespec_to_us (&ts3) -timespec_to_us (&ts1); +if (!delta_us) +return -EINVAL ; + temp = (timestamp2 - timestamp1) *ME_CLK_DIVIDER *10 ; temp =DIV_ROUND_CLOSEST_ULL (temp, delta_us);/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 447/638 crypto: qat - move adf_cfg_services
In reply to Sasha LevinFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 03c76e8e7a8d0d465838b8eaffcc07bdcc364f4d ]
The file adf_cfg_services.h cannot be included in header files since it instantiates the structure adf_cfg_services. Move that structure to its own file and export the symbol.
This does not introduce any functional change.
Stable-dep-of: df018f82002a ("crypto: qat - fix ring to service map for dcc in 4xxx")
--- .../intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 2 +- drivers/crypto/intel/qat/qat_common/Makefile | 1 + .../intel/qat/qat_common/adf_cfg_services.c | 20 +++++++++++++++++++ .../intel/qat/qat_common/adf_cfg_services.h | 14 ++----------- 4 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +1 -1
@@ -3,6 +3,7 @@#include <linux/iopoll.h> #include <adf_accel_devices.h> #include <adf_cfg.h> +#include <adf_cfg_services.h> #include <adf_clock.h> #include <adf_common_drv.h> #include <adf_gen4_dc.h>
@@ -11,7 +12,6 @@#include <adf_gen4_pm.h> #include <adf_gen4_timer.h> #include "adf_4xxx_hw_data.h" -#include "adf_cfg_services.h" #include "icp_qat_hw.h" #define ADF_AE_GROUP_0 GENMASK(3, 0)
drivers/crypto/intel/qat/qat_common/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-$(CONFIG_CRYPTO_DEV_QAT) += intel_qat.o intel_qat-objs := adf_cfg.o \ adf_isr.o \ adf_ctl_drv.o \ + adf_cfg_services.o \ adf_dev_mgr.o \ adf_init.o \ adf_accel_engine.o \
drivers/crypto/intel/qat/qat_common/adf_cfg_services.c new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright(c) 2023 Intel Corporation */ + +#include <linux/export.h> +#include "adf_cfg_services.h" +#include "adf_cfg_strings.h" + +const char *const adf_cfg_services[] = { + [SVC_CY ] =ADF_CFG_CY , + [SVC_CY2 ] =ADF_CFG_ASYM_SYM , + [SVC_DC ] =ADF_CFG_DC , + [SVC_DCC ] =ADF_CFG_DCC , + [SVC_SYM ] =ADF_CFG_SYM , + [SVC_ASYM ] =ADF_CFG_ASYM , + [SVC_DC_ASYM ] =ADF_CFG_DC_ASYM , + [SVC_ASYM_DC ] =ADF_CFG_ASYM_DC , + [SVC_DC_SYM ] =ADF_CFG_DC_SYM , + [SVC_SYM_DC ] =ADF_CFG_SYM_DC , +}; +EXPORT_SYMBOL_GPL (adf_cfg_services);
drivers/crypto/intel/qat/qat_common/adf_cfg_services.h +2 -12
@@ -16,19 +16,9 @@ enum adf_services {SVC_ASYM_DC ,SVC_DC_SYM ,SVC_SYM_DC , +SVC_COUNT }; -static const char *const adf_cfg_services[] = { - [SVC_CY ] =ADF_CFG_CY , - [SVC_CY2 ] =ADF_CFG_ASYM_SYM , - [SVC_DC ] =ADF_CFG_DC , - [SVC_DCC ] =ADF_CFG_DCC , - [SVC_SYM ] =ADF_CFG_SYM , - [SVC_ASYM ] =ADF_CFG_ASYM , - [SVC_DC_ASYM ] =ADF_CFG_DC_ASYM , - [SVC_ASYM_DC ] =ADF_CFG_ASYM_DC , - [SVC_DC_SYM ] =ADF_CFG_DC_SYM , - [SVC_SYM_DC ] =ADF_CFG_SYM_DC , -}; +extern const char *const adf_cfg_services[SVC_COUNT ];#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 448/638 crypto: qat - relocate and rename get_service_enabled()
In reply to Sasha LevinFrom: Jie Wang <[email protected]>
[ Upstream commit 4db87a5f9e3026d72e03bbdf1dac1dc5303e37f7 ]
Move the function get_service_enabled() from adf_4xxx_hw_data.c to adf_cfg_services.c and rename it as adf_get_service_enabled(). This function is not specific to the 4xxx and will be used by other QAT drivers.
This does not introduce any functional change.
Stable-dep-of: df018f82002a ("crypto: qat - fix ring to service map for dcc in 4xxx")
--- .../intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 29 ++----------------- .../intel/qat/qat_common/adf_cfg_services.c | 27 +++++++++++++++++ .../intel/qat/qat_common/adf_cfg_services.h | 4 +++ 3 files changed, 34 insertions(+), 26 deletions(-)
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +3 -26
@@ -118,29 +118,6 @@ static struct adf_hw_device_class adf_4xxx_class = { .instances = 0, }; -static int get_service_enabled (struct adf_accel_dev *accel_dev) -{ -char services[ADF_CFG_MAX_VAL_LEN_IN_BYTES ] = {0 }; -int ret; - - ret =adf_cfg_get_param_value (accel_dev,ADF_GENERAL_SEC , -ADF_SERVICES_ENABLED , services); -if (ret) { -dev_err (&GET_DEV (accel_dev), -ADF_SERVICES_ENABLED " param not found\n" ); -return ret; - } - - ret =match_string (adf_cfg_services,ARRAY_SIZE (adf_cfg_services), - services); -if (ret <0 ) -dev_err (&GET_DEV (accel_dev), -"Invalid value of " ADF_SERVICES_ENABLED " param: %s\n" , - services); - -return ret; -} -static u32 get_accel_mask (struct adf_hw_device_data *self) {return ADF_4XXX_ACCELERATORS_MASK ;
@@ -273,7 +250,7 @@ static u32 get_accel_cap(struct adf_accel_dev *accel_dev) capabilities_dc &= ~ICP_ACCEL_CAPABILITIES_CNV_INTEGRITY64 ; } -switch (get_service_enabled (accel_dev)) { +switch (adf_get_service_enabled (accel_dev)) {case SVC_CY :case SVC_CY2 :return capabilities_sym | capabilities_asym;
@@ -309,7 +286,7 @@ static enum dev_sku_info get_sku(struct adf_hw_device_data *self)static const u32 *adf_get_arbiter_mapping (struct adf_accel_dev *accel_dev) { -switch (get_service_enabled (accel_dev)) { +switch (adf_get_service_enabled (accel_dev)) {case SVC_DC :return thrd_to_arb_map_dc;case SVC_DCC :
@@ -400,7 +377,7 @@ static u32 uof_get_num_objs(void)static const struct adf_fw_config *get_fw_config (struct adf_accel_dev *accel_dev) { -switch (get_service_enabled (accel_dev)) { +switch (adf_get_service_enabled (accel_dev)) {case SVC_CY :case SVC_CY2 :return adf_fw_cy_config;
drivers/crypto/intel/qat/qat_common/adf_cfg_services.c +27 -0
@@ -2,6 +2,9 @@/* Copyright(c) 2023 Intel Corporation */ #include <linux/export.h> +#include <linux/pci.h> +#include <linux/string.h> +#include "adf_cfg.h" #include "adf_cfg_services.h" #include "adf_cfg_strings.h"
@@ -18,3 +21,27 @@ const char *const adf_cfg_services[] = { [SVC_SYM_DC ] =ADF_CFG_SYM_DC , };EXPORT_SYMBOL_GPL (adf_cfg_services); + +int adf_get_service_enabled (struct adf_accel_dev *accel_dev) +{ +char services[ADF_CFG_MAX_VAL_LEN_IN_BYTES ] = {0 }; +int ret; + + ret =adf_cfg_get_param_value (accel_dev,ADF_GENERAL_SEC , +ADF_SERVICES_ENABLED , services); +if (ret) { +dev_err (&GET_DEV (accel_dev), +ADF_SERVICES_ENABLED " param not found\n" ); +return ret; + } + + ret =match_string (adf_cfg_services,ARRAY_SIZE (adf_cfg_services), + services); +if (ret <0 ) +dev_err (&GET_DEV (accel_dev), +"Invalid value of " ADF_SERVICES_ENABLED " param: %s\n" , + services); + +return ret; +} +EXPORT_SYMBOL_GPL (adf_get_service_enabled);
drivers/crypto/intel/qat/qat_common/adf_cfg_services.h +4 -0
@@ -5,6 +5,8 @@#include "adf_cfg_strings.h" +struct adf_accel_dev ; +enum adf_services {SVC_CY =0 ,SVC_CY2 ,
@@ -21,4 +23,6 @@ enum adf_services {extern const char *const adf_cfg_services[SVC_COUNT ]; +int adf_get_service_enabled (struct adf_accel_dev *accel_dev); +#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 449/638 crypto: qat - fix ring to service map for dcc in 4xxx
In reply to Sasha LevinFrom: Damian Muszynski <[email protected]>
[ Upstream commit df018f82002a8b4dc407bc9a6f416b9241d14415 ]
If a device is configured for data compression chaining (dcc), half of the engines are loaded with the symmetric crypto image and the rest are loaded with the compression image.
However, in such configuration all rings can handle compression requests.
Fix the ring to service mapping so that when a device is configured for dcc, the ring to service mapping reports that all rings in a bank can be used for compression.
--- drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +8 -0
@@ -417,6 +417,13 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev)if (!fw_config)return 0 ; +/* If dcc, all rings handle compression requests */ +if (adf_get_service_enabled (accel_dev) ==SVC_DCC ) { +for (i =0 ; i <RP_GROUP_COUNT ; i++) + rps[i] =COMP ; + goto set_mask; + } +for (i =0 ; i <RP_GROUP_COUNT ; i++) {switch (fw_config[i].ae_mask) {case ADF_AE_GROUP_0 :
@@ -445,6 +452,7 @@ static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev) } } +set_mask: ring_to_svc_map = rps[RP_GROUP_0 ] <<ADF_CFG_SERV_RING_PAIR_0_SHIFT | rps[RP_GROUP_1 ] <<ADF_CFG_SERV_RING_PAIR_1_SHIFT | rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_2_SHIFT |
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 450/638 crypto: jitter - fix CRYPTO_JITTERENTROPY help text
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit e63df1ec9a16dd9e13e9068243e64876de06f795 ]
Correct various small problems in the help text:
a. change 2 spaces to ", "
b. finish an incomplete sentence
c. change non-working URL to working URL
--- crypto/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
crypto/Kconfig +3 -2
@@ -1291,10 +1291,11 @@ config CRYPTO_JITTERENTROPY A non-physical non-deterministic ("true") RNG (e.g., an entropy source compliant with NIST SP800-90B) intended to provide a seed to a - deterministic RNG (e.g. per NIST SP800-90C). + deterministic RNG (e.g., per NIST SP800-90C). This RNG does not perform any cryptographic whitening of the generated + random numbers. - See https://www.chronox.de/jent.html + See https://www.chronox.de/jent/ config CRYPTO_JITTERENTROPY_TESTINTERFACE bool "CPU Jitter RNG Test Interface"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 451/638 drm/tidss: Fix initial plane zpos values
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 3ec948ccb2c4b99e8fbfdd950adbe92ea577b395 ]
When the driver sets up the zpos property it sets the default zpos value to the HW id of the plane. That is fine as such, but as on many DSS versions the driver arranges the DRM planes in a different order than the HW planes (to keep the non-scalable planes first), this leads to odd initial zpos values. An example is J721e, where the initial zpos values for DRM planes are 1, 3, 0, 2.
In theory the userspace should configure the zpos values properly when using multiple planes, and in that sense the initial zpos values shouldn't matter, but there's really no reason not to fix this and help the userspace apps which don't handle zpos perfectly. In particular, some versions of Weston seem to have issues dealing with the planes with the current default zpos values.
So let's change the zpos values for the DRM planes to 0, 1, 2, 3.
Another option would be to configure the planes marked as primary planes to zpos 0. On a two display system this would give us plane zpos values of 0, 0, 1, 2. The end result and behavior would be very similar in this option, and I'm not aware that this would actually help us in any way. So, to keep the code simple, I opted for the 0, 1, 2, 3 values.
--- drivers/gpu/drm/tidss/tidss_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_plane.c +1 -1
@@ -213,7 +213,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,drm_plane_helper_add (&tplane->plane, &tidss_plane_helper_funcs); -drm_plane_create_zpos_property (&tplane->plane, hw_plane_id,0 , +drm_plane_create_zpos_property (&tplane->plane, tidss->num_planes,0 , num_planes -1 ); ret = drm_plane_create_color_properties(&tplane->plane,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 452/638 drm/tidss: Fix sync-lost issue with two displays
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit c079e2e113f2ec2803ba859bbb442a6ab82c96bd ]
A sync lost issue can be observed with two displays, when moving a plane from one disabled display to an another disabled display, and then enabling the display to which the plane was moved to. The exact requirements for this to trigger are not clear.
It looks like the issue is that the layers are left enabled in the first display's OVR registers. Even if the corresponding VP is disabled, it still causes an issue, as if the disabled VP and its OVR would still be in use, leading to the same VID being used by two OVRs. However, this is just speculation based on testing the DSS behavior.
Experimentation shows that as a workaround, we can disable all the layers in the OVR when disabling a VP. There should be no downside to this, as the OVR is anyway effectively disabled if its VP is disabled, and it seems to solve the sync lost issue.
However, there may be a bigger issue in play here, related to J721e erratum i2097 ("DSS: Disabling a Layer Connected to Overlay May Result in Synclost During the Next Frame"). Experimentation also shows that the OVR's CHANNELIN field has similar issue. So we may need to revisit this when we find out more about the core issue.
--- drivers/gpu/drm/tidss/tidss_crtc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/tidss/tidss_crtc.c +10 -0
@@ -269,6 +269,16 @@ static void tidss_crtc_atomic_disable(struct drm_crtc *crtc,reinit_completion (&tcrtc->framedone_completion); +/* +* If a layer is left enabled when the videoport is disabled, and the +* vid pipeline that was used for the layer is taken into use on +* another videoport, the DSS will report sync lost issues. Disable all +* the layers here as a work-around. +*/ +for (u32 layer =0 ; layer < tidss->feat->num_planes; layer++) +dispc_ovr_enable_layer (tidss->dispc, tcrtc->hw_videoport, layer, + false); +dispc_vp_disable (tidss->dispc, tcrtc->hw_videoport); if (!wait_for_completion_timeout(&tcrtc->framedone_completion,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 453/638 clk: imx: imx8mp: Fix SAI_MCLK_SEL definition
In reply to Sasha LevinFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 13269dc6c70444528f0093585e3559cd2f38850a ]
There is SAI1, SAI2, SAI3, SAI5, SAI6, SAI7 existing in this block control, the order is discontinuous. The definition of SAI_MCLK_SEL(n) is not match with the usage of CLK_SAIn(n).
So define SAI##n##_MCLK_SEL separately to fix the issue.
--- drivers/clk/imx/clk-imx8mp-audiomix.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clk/imx/clk-imx8mp-audiomix.c +8 -3
@@ -18,7 +18,12 @@#define CLKEN0 0x000#define CLKEN1 0x004 -#define SAI_MCLK_SEL (n) (0x300 + 4 * (n))/* n in 0..5 */ +#define SAI1_MCLK_SEL 0x300 +#define SAI2_MCLK_SEL 0x304 +#define SAI3_MCLK_SEL 0x308 +#define SAI5_MCLK_SEL 0x30C +#define SAI6_MCLK_SEL 0x310 +#define SAI7_MCLK_SEL 0x314#define PDM_SEL 0x318#define SAI_PLL_GNRL_CTL 0x400
@@ -95,13 +100,13 @@ static const struct clk_parent_data clk_imx8mp_audiomix_pll_bypass_sels[] = { IMX8MP_CLK_AUDIOMIX_SAI##n##_MCLK1_SEL, {}, \ clk_imx8mp_audiomix_sai##n##_mclk1_parents, \ ARRAY_SIZE(clk_imx8mp_audiomix_sai##n##_mclk1_parents), \ - SAI_MCLK_SEL(n), 1, 0 \ + SAI##n##_MCLK_SEL, 1, 0 \ }, { \ "sai"__stringify(n)"_mclk2_sel", \ IMX8MP_CLK_AUDIOMIX_SAI##n##_MCLK2_SEL, {}, \ clk_imx8mp_audiomix_sai_mclk2_parents, \ ARRAY_SIZE(clk_imx8mp_audiomix_sai_mclk2_parents), \ - SAI_MCLK_SEL(n), 4, 1 \ + SAI##n##_MCLK_SEL, 4, 1 \ }, { \ "sai"__stringify(n)"_ipg_cg", \ IMX8MP_CLK_AUDIOMIX_SAI##n##_IPG, \
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 454/638 mtd: maps: physmap-core: fix flash size larger than 32-bit
In reply to Sasha LevinFrom: Baruch Siach <[email protected]>
[ Upstream commit 3884f03edd34887514a0865a80769cd5362d5c3b ]
mtd-ram can potentially be larger than 4GB. get_bitmask_order() uses fls() that is not guaranteed to work with values larger than 32-bit. Specifically on aarch64 fls() returns 0 when all 32 LSB bits are clear. Use fls64() instead.
--- drivers/mtd/maps/physmap-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap-core.c +1 -1
@@ -523,7 +523,7 @@ static int physmap_flash_probe(struct platform_device *dev)if (!info->maps[i].phys) info->maps[i].phys = res->start; - info->win_order =get_bitmask_order (resource_size (res)) -1 ; + info->win_order =fls64 (resource_size (res)) -1 ; info->maps[i].size =BIT (info->win_order + (info->gpios ? info->gpios->ndescs :0 ));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 455/638 mtd: rawnand: lpc32xx_mlc: fix irq handler prototype
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 347b828882e6334690e7003ce5e2fe5f233dc508 ]
clang-16 warns about mismatched function prototypes:
drivers/mtd/nand/raw/lpc32xx_mlc.c:783:29: error: cast from 'irqreturn_t (*)(int, struct lpc32xx_nand_host *)' (aka 'enum irqreturn (*)(int, struct lpc32xx_nand_host *)') to 'irq_handler_t' (aka 'enum irqreturn (*)(int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Change the interrupt handler to the normal way of just passing a void* pointer and converting it inside the function..
--- drivers/mtd/nand/raw/lpc32xx_mlc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/lpc32xx_mlc.c +3 -2
@@ -303,8 +303,9 @@ static int lpc32xx_nand_device_ready(struct nand_chip *nand_chip)return 0 ; } -static irqreturn_t lpc3xxx_nand_irq (int irq,struct lpc32xx_nand_host *host) +static irqreturn_t lpc3xxx_nand_irq (int irq,void *data) { +struct lpc32xx_nand_host *host = data;uint8_t sr;/* Clear interrupt flag by reading status */
@@ -780,7 +781,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) goto release_dma_chan; } -if (request_irq (host->irq, (irq_handler_t)&lpc3xxx_nand_irq, +if (request_irq (host->irq, &lpc3xxx_nand_irq,IRQF_TRIGGER_HIGH ,DRV_NAME , host)) {dev_err (&pdev->dev,"Error requesting NAND IRQ\n" ); res = -ENXIO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 456/638 ASoC: meson: axg-tdm-interface: fix mclk setup without mclk-fs
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit e3741a8d28a1137f8b19ae6f3d6e3be69a454a0a ]
By default, when mclk-fs is not provided, the tdm-interface driver requests an MCLK that is 4x the bit clock, SCLK.
However there is no justification for this:
* If the codec needs MCLK for its operation, mclk-fs is expected to be set according to the codec requirements.
* If the codec does not need MCLK the minimum is 2 * SCLK, because this is minimum the divider between SCLK and MCLK can do.
Multiplying by 4 may cause problems because the PLL limit may be reached sooner than it should, so use 2x instead.
--- sound/soc/meson/axg-tdm-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/meson/axg-tdm-interface.c +2 -2
@@ -264,8 +264,8 @@ static int axg_tdm_iface_set_sclk(struct snd_soc_dai *dai, srate = iface->slots * iface->slot_width *params_rate (params);if (!iface->mclk_rate) { -/* If no specific mclk is requested, default to bit clock * 4 */ -clk_set_rate (iface->mclk,4 * srate); +/* If no specific mclk is requested, default to bit clock * 2 */ +clk_set_rate (iface->mclk,2 * srate); }else {/* Check if we can actually get the bit clock from mclk */ if (iface->mclk_rate % srate) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 457/638 ASoC: meson: axg-tdm-interface: add frame rate constraint
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 59c6a3a43b221cc2a211181b1298e43b2c2df782 ]
According to Amlogic datasheets for the SoCs supported by this driver, the maximum bit clock rate is 100MHz.
The tdm interface allows the rates listed by the DAI driver, regardless of the number slots or their width. However, these will impact the bit clock rate.
Hitting the 100MHz limit is very unlikely for most use cases but it is possible.
For example with 32 slots / 32 bits wide, the maximum rate is no longer 384kHz but ~96kHz.
Add the constraint accordingly if the component is not already active. If it is active, the rate is already constrained by the first stream rate.
--- sound/soc/meson/axg-tdm-interface.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
sound/soc/meson/axg-tdm-interface.c +18 -7
@@ -12,6 +12,9 @@#include "axg-tdm.h" +/* Maximum bit clock frequency according the datasheets */ +#define MAX_SCLK 100000000/* Hz */ +enum {TDM_IFACE_PAD ,TDM_IFACE_LOOPBACK ,
@@ -153,19 +156,27 @@ static int axg_tdm_iface_startup(struct snd_pcm_substream *substream,return -EINVAL ; } -/* Apply component wide rate symmetry */ if (snd_soc_component_active (dai->component)) { +/* Apply component wide rate symmetry */ ret =snd_pcm_hw_constraint_single (substream->runtime,SNDRV_PCM_HW_PARAM_RATE , iface->rate); -if (ret <0 ) { -dev_err (dai->dev, -"can't set iface rate constraint\n" ); -return ret; - } + + }else { +/* Limit rate according to the slot number and width */ +unsigned int max_rate = +MAX_SCLK / (iface->slots * iface->slot_width); + ret =snd_pcm_hw_constraint_minmax (substream->runtime, +SNDRV_PCM_HW_PARAM_RATE , +0 , max_rate); } -return 0 ; +if (ret <0 ) +dev_err (dai->dev,"can't set iface rate constraint\n" ); +else + ret =0 ; + +return ret; } static int axg_tdm_iface_set_stream(struct snd_pcm_substream *substream,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 458/638 perf pmu: Fix a potential memory leak in perf_pmu__lookup()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ef5de1613d7d92bdc975e6beb34bb0fa94f34078 ]
The commit in Fixes has reordered some code, but missed an error handling path.
'goto err' now, in order to avoid a memory leak in case of error.
--- tools/perf/util/pmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tools/perf/util/pmu.c +3 -4
@@ -992,10 +992,9 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char* type value and format definitions. Load both right * now. */ -if (pmu_format (pmu, dirfd, name)) { -free (pmu); -return NULL ; - } +if (pmu_format (pmu, dirfd, name)) + goto err; + pmu->is_core =is_pmu_core (name); pmu->cpus =pmu_cpumask (dirfd, name, pmu->is_core);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 459/638 HID: amd_sfh: Update HPD sensor structure elements
In reply to Sasha LevinFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit bbf0dec30696638b8bdc28cb2f5bf23f8d760b52 ]
HPD sensor data is not populating properly because of wrong order of HPD sensor structure elements. So update the order of structure elements to match the HPD sensor data received from the firmware.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +3 -3
@@ -90,10 +90,10 @@ enum mem_use_type {struct hpd_status {union {struct { -u32 human_presence_report :4 ; -u32 human_presence_actual :4 ; -u32 probablity :8 ;u32 object_distance :16 ; +u32 probablity :8 ; +u32 human_presence_actual :4 ; +u32 human_presence_report :4 ; } shpd;u32 val; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 460/638 HID: amd_sfh: Avoid disabling the interrupt
In reply to Sasha LevinFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit c1db0073212ef39d5a46c2aea5e49bf884375ce4 ]
HP ProBook x360 435 G7 using older version of firmware which doesn't support disabling the interrupt for all commands. Hence avoid disabling the interrupt for that particular model.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 30 +++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +27 -3
@@ -35,6 +35,8 @@ static int sensor_mask_override = -1;module_param_named (sensor_mask, sensor_mask_override, int,0444 );MODULE_PARM_DESC (sensor_mask,"override the detected sensors mask" ); +static bool intr_disable = true; +static int amd_sfh_wait_response_v2 (struct amd_mp2_dev *mp2,u8 sid,u32 sensor_sts) {union cmd_response cmd_resp;
@@ -55,7 +57,7 @@ static void amd_start_sensor_v2(struct amd_mp2_dev *privdata, struct amd_mp2_sen cmd_base.ul =0 ; cmd_base.cmd_v2.cmd_id =ENABLE_SENSOR ; - cmd_base.cmd_v2.intr_disable =1 ; + cmd_base.cmd_v2.intr_disable = intr_disable; cmd_base.cmd_v2.period = info.period; cmd_base.cmd_v2.sensor_id = info.sensor_idx; cmd_base.cmd_v2.length =16 ;
@@ -73,7 +75,7 @@ static void amd_stop_sensor_v2(struct amd_mp2_dev *privdata, u16 sensor_idx) cmd_base.ul =0 ; cmd_base.cmd_v2.cmd_id =DISABLE_SENSOR ; - cmd_base.cmd_v2.intr_disable =1 ; + cmd_base.cmd_v2.intr_disable = intr_disable; cmd_base.cmd_v2.period =0 ; cmd_base.cmd_v2.sensor_id = sensor_idx; cmd_base.cmd_v2.length =16 ;
@@ -87,7 +89,7 @@ static void amd_stop_all_sensor_v2(struct amd_mp2_dev *privdata)union sfh_cmd_base cmd_base; cmd_base.cmd_v2.cmd_id =STOP_ALL_SENSORS ; - cmd_base.cmd_v2.intr_disable =1 ; + cmd_base.cmd_v2.intr_disable = intr_disable; cmd_base.cmd_v2.period =0 ; cmd_base.cmd_v2.sensor_id =0 ;
@@ -292,6 +294,26 @@ int amd_sfh_irq_init(struct amd_mp2_dev *privdata)return 0 ; } +static int mp2_disable_intr (const struct dmi_system_id *id) +{ + intr_disable = false; +return 0 ; +} + +static const struct dmi_system_id dmi_sfh_table[] = { + { +/* +* https://bugzilla.kernel.org/show_bug.cgi?id=218104 +*/ + .callback = mp2_disable_intr, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"HP" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"HP ProBook x360 435 G7" ), + }, + }, + {} +}; +static const struct dmi_system_id dmi_nodevs[] = { {/*
@@ -315,6 +337,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *iif (dmi_first_match (dmi_nodevs))return -ENODEV ; +dmi_check_system (dmi_sfh_table); + privdata =devm_kzalloc (&pdev->dev,sizeof (*privdata),GFP_KERNEL );if (!privdata)return -ENOMEM ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 461/638 drm/amdgpu: Fix missing break in ATOM_ARG_IMM Case of atom_get_src_int()
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 7cf1ad2fe10634238b38442a851d89514cb14ea2 ]
Missing break statement in the ATOM_ARG_IMM case of a switch statement, adds the missing break statement, ensuring that the program's control flow is as intended.
Fixes the below:drivers/gpu/drm/amd/amdgpu/atom.c:323 atom_get_src_int() warn: ignoring unreachable code.
--- drivers/gpu/drm/amd/amdgpu/atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -1
@@ -313,7 +313,7 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,DEBUG ("IMM 0x%02X\n" , val);return val; } -return 0 ; +break ;case ATOM_ARG_PLL : idx =U8 (*ptr); (*ptr)++;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 462/638 media: pvrusb2: fix uaf in pvr2_context_set_notify
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit 0a0b79ea55de8514e1750884e5fec77f9fdd01ee ]
[Syzbot reported]
BUG: KASAN: slab-use-after-free in pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 Read of size 4 at addr ffff888113aeb0d8 by task kworker/1:1/26 CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.8.0-rc1-syzkaller-00046-gf1a27f081c1f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Workqueue: usb_hub_wq hub_event Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 pvr2_context_notify drivers/media/usb/pvrusb2/pvrusb2-context.c:95 [inline] pvr2_context_disconnect+0x94/0xb0 drivers/media/usb/pvrusb2/pvrusb2-context.c:272 Freed by task 906: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x106/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x105/0x340 mm/slub.c:4409 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline] pvr2_context_thread_func+0x69d/0x960 drivers/media/usb/pvrusb2/pvrusb2-context.c:158
[Analyze]
Task A set disconnect_flag = !0, which resulted in Task B's condition being met and releasing mp, leading to this issue.
[Fix]
Place the disconnect_flag assignment operation after all code in pvr2_context_disconnect() to avoid this issue.
--- drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/pvrusb2/pvrusb2-context.c +1 -1
@@ -267,9 +267,9 @@ static void pvr2_context_exit(struct pvr2_context *mp)void pvr2_context_disconnect (struct pvr2_context *mp) {pvr2_hdw_disconnect (mp->hdw); - mp->disconnect_flag = !0 ;if (!pvr2_context_shutok ())pvr2_context_notify (mp); + mp->disconnect_flag = !0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 463/638 media: dvb-frontends: avoid stack overflow warnings with clang
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7a4cf27d1f0538f779bf31b8c99eda394e277119 ]
A previous patch worked around a KASAN issue in stv0367, now a similar problem showed up with clang:
drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (3624) exceeds limit (2048) in 'stv0367ter_set_frontend' [-Werror,-Wframe-larger-than]
1214 | static int stv0367ter_set_frontend(struct dvb_frontend *fe)
Rework the stv0367_writereg() function to be simpler and mark both register access functions as noinline_for_stack so the temporary i2c_msg structures do not get duplicated on the stack when KASAN_STACK is enabled.
--- drivers/media/dvb-frontends/stv0367.c | 34 +++++++-------------------- 1 file changed, 8 insertions(+), 26 deletions(-)
drivers/media/dvb-frontends/stv0367.c +8 -26
@@ -118,50 +118,32 @@ static const s32 stv0367cab_RF_LookUp2[RF_LOOKUP_TABLE2_SIZE][RF_LOOKUP_TABLE2_S } }; -static -int stv0367_writeregs (struct stv0367_state *state,u16 reg,u8 *data,int len) +static noinline_for_stack +int stv0367_writereg(struct stv0367_state *state, u16 reg, u8 data) { -u8 buf[MAX_XFER_SIZE ]; +u8 buf[3 ] = {MSB (reg),LSB (reg), data };struct i2c_msg msg = { .addr = state->config->demod_address, .flags =0 , .buf = buf, - .len = len +2 + .len =3 , };int ret; -if (2 + len >sizeof (buf)) { -printk (KERN_WARNING -"%s: i2c wr reg=%04x: len=%d is too big!\n" , -KBUILD_MODNAME , reg, len); -return -EINVAL ; - } - - - buf[0 ] =MSB (reg); - buf[1 ] =LSB (reg); -memcpy (buf +2 , data, len); -if (i2cdebug)printk (KERN_DEBUG "%s: [%02x] %02x: %02x\n" , __func__, - state->config->demod_address, reg, buf[2 ]); + state->config->demod_address, reg, data); ret =i2c_transfer (state->i2c, &msg,1 );if (ret !=1 )printk (KERN_ERR "%s: i2c write error! ([%02x] %02x: %02x)\n" , - __func__, state->config->demod_address, reg, buf[2 ]); + __func__, state->config->demod_address, reg, data);return (ret !=1 ) ? -EREMOTEIO :0 ; } -static int stv0367_writereg (struct stv0367_state *state,u16 reg,u8 data) -{ -u8 tmp = data;/* see gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */ - -return stv0367_writeregs (state, reg, &tmp,1 ); -} - -static u8 stv0367_readreg (struct stv0367_state *state,u16 reg) +static noinline_for_stack +u8 stv0367_readreg(struct stv0367_state *state, u16 reg) {u8 b0[] = {0 ,0 };u8 b1[] = {0 };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 464/638 media: go7007: fix a memleak in go7007_load_encoder
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit b9b683844b01d171a72b9c0419a2d760d946ee12 ]
In go7007_load_encoder, bounce(i.e. go->boot_fw), is allocated without a deallocation thereafter. After the following call chain:
saa7134_go7007_init
|-> go7007_boot_encoder
|-> go7007_load_encoder
|-> kfree(go)
go is freed and thus bounce is leaked.
--- drivers/media/usb/go7007/go7007-driver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/usb/go7007/go7007-driver.c +5 -3
@@ -80,7 +80,7 @@ static int go7007_load_encoder(struct go7007 *go)const struct firmware *fw_entry;char fw_name[] ="go7007/go7007fw.bin" ;void *bounce; -int fw_len, rv =0 ; +int fw_len;u16 intr_val, intr_data;if (go->boot_fw ==NULL ) {
@@ -109,9 +109,11 @@ static int go7007_load_encoder(struct go7007 *go) go7007_read_interrupt(go, &intr_val, &intr_data) < 0 || (intr_val & ~0x1) != 0x5a5a) {v4l2_err (go,"error transferring firmware\n" ); - rv =-1 ; +kfree (go->boot_fw); + go->boot_fw =NULL ; +return -1 ; } -return rv; +return 0 ; }MODULE_FIRMWARE ("go7007/go7007fw.bin" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 465/638 media: ttpci: fix two memleaks in budget_av_attach
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit d0b07f712bf61e1a3cf23c87c663791c42e50837 ]
When saa7146_register_device and saa7146_vv_init fails, budget_av_attach should free the resources it allocates, like the error-handling of ttpci_budget_init does. Besides, there are two fixme comment refers to such deallocations.
--- drivers/media/pci/ttpci/budget-av.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/pci/ttpci/budget-av.c +5 -3
@@ -1463,7 +1463,8 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio budget_av->has_saa7113 =1 ; err =saa7146_vv_init (dev, &vv_data);if (err !=0 ) { -/* fixme: proper cleanup here */ +ttpci_budget_deinit (&budget_av->budget); +kfree (budget_av);ERR ("cannot init vv subsystem\n" );return err; }
@@ -1472,9 +1473,10 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio vv_data.vid_ops.vidioc_s_input = vidioc_s_input;if ((err =saa7146_register_device (&budget_av->vd, dev,"knc1" ,VFL_TYPE_VIDEO ))) { -/* fixme: proper cleanup here */ -ERR ("cannot register capture v4l2 device\n" );saa7146_vv_release (dev); +ttpci_budget_deinit (&budget_av->budget); +kfree (budget_av); +ERR ("cannot register capture v4l2 device\n" );return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 466/638 media: mediatek: vcodec: avoid -Wcast-function-type-strict warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit bfb1b99802ef16045402deb855c197591dc78886 ]
The ipi handler here tries hard to maintain const-ness of its argument, but by doing that causes a warning about function type casts:
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c:38:32: error: cast from 'mtk_vcodec_ipi_handler' (aka 'void (*)(void *, unsigned int, void *)') to 'ipi_handler_t' (aka 'void (*)(const void *, unsigned int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
38 | ipi_handler_t handler_const = (ipi_handler_t)handler;
| ^~~~~~~~~~~~~~~~~~~~~~Remove the hack and just use a non-const argument.
--- drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c | 2 +- .../mediatek/vcodec/common/mtk_vcodec_fw_vpu.c | 10 +--------- drivers/media/platform/mediatek/vpu/mtk_vpu.c | 2 +- drivers/media/platform/mediatek/vpu/mtk_vpu.h | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-)
drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c +1 -1
@@ -26,7 +26,7 @@ static void mtk_mdp_vpu_handle_init_ack(const struct mdp_ipi_comm_ack *msg) vpu->inst_addr = msg->vpu_inst_addr; } -static void mtk_mdp_vpu_ipi_handler (const void *data,unsigned int len, +static void mtk_mdp_vpu_ipi_handler (void *data,unsigned int len,void *priv) {const struct mdp_ipi_comm_ack *msg = data;
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c +1 -9
@@ -29,15 +29,7 @@ static int mtk_vcodec_vpu_set_ipi_register(struct mtk_vcodec_fw *fw, int id,mtk_vcodec_ipi_handler handler, const char *name, void *priv) { -/* -* The handler we receive takes a void * as its first argument. We -* cannot change this because it needs to be passed down to the rproc -* subsystem when SCP is used. VPU takes a const argument, which is -* more constrained, so the conversion below is safe. -*/ - ipi_handler_t handler_const = (ipi_handler_t)handler; - -return vpu_ipi_register (fw->pdev, id, handler_const, name, priv); + return vpu_ipi_register(fw->pdev, id, handler, name, priv); } static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,
drivers/media/platform/mediatek/vpu/mtk_vpu.c +1 -1
@@ -635,7 +635,7 @@ int vpu_load_firmware(struct platform_device *pdev) }EXPORT_SYMBOL_GPL (vpu_load_firmware); -static void vpu_init_ipi_handler (const void *data,unsigned int len,void *priv) +static void vpu_init_ipi_handler (void *data,unsigned int len,void *priv) {struct mtk_vpu *vpu = priv;const struct vpu_run *run = data;
drivers/media/platform/mediatek/vpu/mtk_vpu.h +1 -1
@@ -17,7 +17,7 @@* VPU interfaces with other blocks by share memory and interrupt. */ -typedef void (*ipi_handler_t ) (const void *data, +typedef void (*ipi_handler_t ) (void *data,unsigned int len,void *priv);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 467/638 arm64: ftrace: Don't forbid CALL_OPS+CC_OPTIMIZE_FOR_SIZE with Clang
In reply to Sasha LevinFrom: Stephen Boyd <[email protected]>
[ Upstream commit a743f26d03a96593c0f3d05dc26b388f45de67c9 ]
Per commit b3f11af9b2ce ("arm64: ftrace: forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE"), GCC is silently ignoring -falign-functions=N when passed -Os, causing functions to be improperly aligned. This doesn't seem to be a problem with Clang though, where enabling CALL_OPS with CC_OPTIMIZE_FOR_SIZE doesn't spit out any warnings at boot about misaligned patch-sites. Only forbid CALL_OPS if GCC is used and we're optimizing for size so that CALL_OPS can be used with clang optimizing for size.
--- arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Kconfig +1 -1
@@ -196,7 +196,7 @@ config ARM64 if DYNAMIC_FTRACE_WITH_ARGS && DYNAMIC_FTRACE_WITH_CALL_OPS select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \ if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG && \ - !CC_OPTIMIZE_FOR_SIZE) + (CC_IS_CLANG || !CC_OPTIMIZE_FOR_SIZE)) select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \ if DYNAMIC_FTRACE_WITH_ARGS select HAVE_SAMPLE_FTRACE_DIRECT
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 468/638 drm/tests: helpers: Include missing drm_drv header
In reply to Sasha LevinFrom: Maxime Ripard <[email protected]>
[ Upstream commit 73984daf07a1a89ace8f0db6dd2d640654ebbbee ]
We have a few functions declared in our kunit helpers header, some of them dereferencing the struct drm_driver.
However, we don't include the drm_drv.h header file defining that structure, leading to compilation errors if we don't include both headers.
--- include/drm/drm_kunit_helpers.h | 2 ++ 1 file changed, 2 insertions(+)
include/drm/drm_kunit_helpers.h +2 -0
@@ -3,6 +3,8 @@#ifndef DRM_KUNIT_HELPERS_H_ #define DRM_KUNIT_HELPERS_H_ +#include <drm/drm_drv.h> +#include <linux/device.h> #include <kunit/test.h>
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 469/638 drm/amd/pm: Fix esm reg mask use to get pcie speed
In reply to Sasha LevinFrom: Asad Kamal <[email protected]>
[ Upstream commit b485b899e5b8f83723833feca30a1a1e3df778df ]
Fix mask used for esm ctrl register to get pcie link speed on smu_v11_0_3, smu_v13_0_2 & smu_v13_0_6
--- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +2 -2
@@ -2356,8 +2356,8 @@ static uint16_t arcturus_get_current_pcie_link_speed(struct smu_context *smu)/* TODO: confirm this on real target */ esm_ctrl =RREG32_PCIE (smnPCIE_ESM_CTRL); -if ((esm_ctrl >>15 ) &0x1FFFF ) -return (uint16_t )(((esm_ctrl >>8 ) &0x3F ) +128 ); +if ((esm_ctrl >>15 ) &0x1 ) +return (uint16_t )(((esm_ctrl >>8 ) &0x7F ) +128 );return smu_v11_0_get_current_pcie_link_speed (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -2
@@ -1720,8 +1720,8 @@ static int aldebaran_get_current_pcie_link_speed(struct smu_context *smu)/* TODO: confirm this on real target */ esm_ctrl =RREG32_PCIE (smnPCIE_ESM_CTRL); -if ((esm_ctrl >>15 ) &0x1FFFF ) -return (((esm_ctrl >>8 ) &0x3F ) +128 ); +if ((esm_ctrl >>15 ) &0x1 ) +return (((esm_ctrl >>8 ) &0x7F ) +128 );return smu_v13_0_get_current_pcie_link_speed (smu); }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -2
@@ -1941,8 +1941,8 @@ static int smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu)/* TODO: confirm this on real target */ esm_ctrl =RREG32_PCIE (smnPCIE_ESM_CTRL); -if ((esm_ctrl >>15 ) &0x1FFFF ) -return (((esm_ctrl >>8 ) &0x3F ) +128 ); +if ((esm_ctrl >>15 ) &0x1 ) +return (((esm_ctrl >>8 ) &0x7F ) +128 ); speed_level = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) &PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 470/638 gpio: nomadik: fix offset bug in nmk_pmx_set()
In reply to Sasha LevinFrom: Théo Lebrun <[email protected]>
[ Upstream commit 53cf6b72e074864b94ade97dcb6f30b5ac1a82dc ]
Previously, the statement looked like:
slpm[x] &= ~BIT(g->grp.pins[i]);
Where:
- slpm is a unsigned int pointer;
- g->grp.pins[i] is a pin number. It can grow to more than 32.
The expected shift amount is a pin bank offset.
This bug does not occur on every group or pin: the altsetting must be NMK_GPIO_ALT_C and the pin must be 32 or above. It might have occured. For example, in pinctrl-nomadik-db8500.c, pin group i2c3_c_2 has the right altsetting and pins 229 and 230.
--- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/nomadik/pinctrl-nomadik.c +4 -2
@@ -1573,8 +1573,10 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function,* Then mask the pins that need to be sleeping now when we're * switching to the ALT C function. */ -for (i =0 ; i < g->grp.npins; i++) - slpm[g->grp.pins[i] /NMK_GPIO_PER_CHIP ] &= ~BIT (g->grp.pins[i]); +for (i =0 ; i < g->grp.npins; i++) { +unsigned int bit = g->grp.pins[i] %NMK_GPIO_PER_CHIP ; + slpm[g->grp.pins[i] /NMK_GPIO_PER_CHIP ] &= ~BIT (bit); + }nmk_gpio_glitch_slpm_init (slpm); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 471/638 drm/mediatek: Fix a null pointer crash in mtk_drm_crtc_finish_page_flip
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit c958e86e9cc1b48cac004a6e245154dfba8e163b ]
It's possible that mtk_crtc->event is NULL inmtk_drm_crtc_finish_page_flip().
pending_needs_vblank value is set by mtk_crtc->event, but in mtk_drm_crtc_atomic_flush(), it's is not guarded by the same lock in mtk_drm_finish_page_flip(), thus a race condition happens.
Consider the following case:
CPU1 CPU2
step 1:mtk_drm_crtc_atomic_begin()mtk_crtc->event is not null,
step 1:
mtk_drm_crtc_atomic_flush:
mtk_drm_crtc_update_config(
!!mtk_crtc->event)step 2:mtk_crtc_ddp_irq ->mtk_drm_finish_page_flip:
lockmtk_crtc->event set to null,pending_needs_vblank set to false
unlock
pending_needs_vblank set to true,
step 2:
mtk_crtc_ddp_irq -> mtk_drm_finish_page_flip called again, pending_needs_vblank is still true //null pointer
Instead of guarding the entire mtk_drm_crtc_atomic_flush(), it's more efficient to just check if mtk_crtc->event is null before use.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +7 -5
@@ -93,11 +93,13 @@ static void mtk_drm_crtc_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)struct drm_crtc *crtc = &mtk_crtc->base;unsigned long flags; -spin_lock_irqsave (&crtc->dev->event_lock, flags); -drm_crtc_send_vblank_event (crtc, mtk_crtc->event); -drm_crtc_vblank_put (crtc); - mtk_crtc->event =NULL ; -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); +if (mtk_crtc->event) { +spin_lock_irqsave (&crtc->dev->event_lock, flags); +drm_crtc_send_vblank_event (crtc, mtk_crtc->event); +drm_crtc_vblank_put (crtc); + mtk_crtc->event =NULL ; +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + } }static void mtk_drm_finish_page_flip (struct mtk_drm_crtc *mtk_crtc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 472/638 mfd: cs42l43: Fix wrong register defaults
In reply to Sasha LevinFrom: Maciej Strozek <[email protected]>
[ Upstream commit c9e1e505cde1a8ddd0968b4d54ec2ea1937dfe00 ]
A few regs have unnecessary values in defaults, change them to match the datasheet
--- drivers/mfd/cs42l43.c | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-)
drivers/mfd/cs42l43.c +34 -34
@@ -131,38 +131,38 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_ASP_TX_CH4_CTRL, 0x00170091 }, { CS42L43_ASP_TX_CH5_CTRL, 0x001700C1 }, { CS42L43_ASP_TX_CH6_CTRL, 0x001700F1 }, - { CS42L43_ASPTX1_INPUT, 0x00800000 }, - { CS42L43_ASPTX2_INPUT, 0x00800000 }, - { CS42L43_ASPTX3_INPUT, 0x00800000 }, - { CS42L43_ASPTX4_INPUT, 0x00800000 }, - { CS42L43_ASPTX5_INPUT, 0x00800000 }, - { CS42L43_ASPTX6_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH2_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH3_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP1_CH4_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP2_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP2_CH2_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP3_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP3_CH2_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP4_CH1_INPUT, 0x00800000 }, - { CS42L43_SWIRE_DP4_CH2_INPUT, 0x00800000 }, - { CS42L43_ASRC_INT1_INPUT1, 0x00800000 }, - { CS42L43_ASRC_INT2_INPUT1, 0x00800000 }, - { CS42L43_ASRC_INT3_INPUT1, 0x00800000 }, - { CS42L43_ASRC_INT4_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC1_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC2_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC3_INPUT1, 0x00800000 }, - { CS42L43_ASRC_DEC4_INPUT1, 0x00800000 }, - { CS42L43_ISRC1INT1_INPUT1, 0x00800000 }, - { CS42L43_ISRC1INT2_INPUT1, 0x00800000 }, - { CS42L43_ISRC1DEC1_INPUT1, 0x00800000 }, - { CS42L43_ISRC1DEC2_INPUT1, 0x00800000 }, - { CS42L43_ISRC2INT1_INPUT1, 0x00800000 }, - { CS42L43_ISRC2INT2_INPUT1, 0x00800000 }, - { CS42L43_ISRC2DEC1_INPUT1, 0x00800000 }, - { CS42L43_ISRC2DEC2_INPUT1, 0x00800000 }, + { CS42L43_ASPTX1_INPUT, 0x00000000 }, + { CS42L43_ASPTX2_INPUT, 0x00000000 }, + { CS42L43_ASPTX3_INPUT, 0x00000000 }, + { CS42L43_ASPTX4_INPUT, 0x00000000 }, + { CS42L43_ASPTX5_INPUT, 0x00000000 }, + { CS42L43_ASPTX6_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH2_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH3_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP1_CH4_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP2_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP2_CH2_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP3_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP3_CH2_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP4_CH1_INPUT, 0x00000000 }, + { CS42L43_SWIRE_DP4_CH2_INPUT, 0x00000000 }, + { CS42L43_ASRC_INT1_INPUT1, 0x00000000 }, + { CS42L43_ASRC_INT2_INPUT1, 0x00000000 }, + { CS42L43_ASRC_INT3_INPUT1, 0x00000000 }, + { CS42L43_ASRC_INT4_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC1_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC2_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC3_INPUT1, 0x00000000 }, + { CS42L43_ASRC_DEC4_INPUT1, 0x00000000 }, + { CS42L43_ISRC1INT1_INPUT1, 0x00000000 }, + { CS42L43_ISRC1INT2_INPUT1, 0x00000000 }, + { CS42L43_ISRC1DEC1_INPUT1, 0x00000000 }, + { CS42L43_ISRC1DEC2_INPUT1, 0x00000000 }, + { CS42L43_ISRC2INT1_INPUT1, 0x00000000 }, + { CS42L43_ISRC2INT2_INPUT1, 0x00000000 }, + { CS42L43_ISRC2DEC1_INPUT1, 0x00000000 }, + { CS42L43_ISRC2DEC2_INPUT1, 0x00000000 }, { CS42L43_EQ1MIX_INPUT1, 0x00800000 }, { CS42L43_EQ1MIX_INPUT2, 0x00800000 }, { CS42L43_EQ1MIX_INPUT3, 0x00800000 },
@@ -171,8 +171,8 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_EQ2MIX_INPUT2, 0x00800000 }, { CS42L43_EQ2MIX_INPUT3, 0x00800000 }, { CS42L43_EQ2MIX_INPUT4, 0x00800000 }, - { CS42L43_SPDIF1_INPUT1, 0x00800000 }, - { CS42L43_SPDIF2_INPUT1, 0x00800000 }, + { CS42L43_SPDIF1_INPUT1, 0x00000000 }, + { CS42L43_SPDIF2_INPUT1, 0x00000000 }, { CS42L43_AMP1MIX_INPUT1, 0x00800000 }, { CS42L43_AMP1MIX_INPUT2, 0x00800000 }, { CS42L43_AMP1MIX_INPUT3, 0x00800000 },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 473/638 powerpc/pseries: Fix potential memleak in papr_get_attr()
In reply to Sasha LevinFrom: Qiheng Lin <[email protected]>
[ Upstream commit cda9c0d556283e2d4adaa9960b2dc19b16156bae ]
buf is allocated in papr_get_attr(), and krealloc() of buf could fail. We need to free the original buf in the case of failure.
--- arch/powerpc/platforms/pseries/papr_platform_attributes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/papr_platform_attributes.c +5 -3
@@ -101,10 +101,12 @@ static int papr_get_attr(u64 id, struct energy_scale_attribute *esi) esi_buf_size =ESI_HDR_SIZE + (CURR_MAX_ESI_ATTRS * max_esi_attrs); temp_buf =krealloc (buf, esi_buf_size,GFP_KERNEL ); -if (temp_buf) +if (temp_buf) { buf = temp_buf; -else -return -ENOMEM ; + }else { + ret = -ENOMEM ; + goto out_buf; + } goto retry; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 474/638 powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
In reply to Sasha LevinFrom: Kajol Jain <[email protected]>
[ Upstream commit ad86d7ee43b22aa2ed60fb982ae94b285c1be671 ]
Running event hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ in one of the system throws below error:
---Logs---
# perf list | grep hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=?/[Kernel PMU event]
# perf stat -v -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2 Using CPUID 00800200 Control descriptor is not initialized Warning: hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event is not supported by the kernel. failed to read counter hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
Performance counter stats for 'system wide':
<not supported> hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
2.000700771 seconds time elapsed
The above error is because of the hcall failure as required permission "Enable Performance Information Collection" is not set. Based on current code, single_gpci_request function did not check the error type incase hcall fails and by default returns EINVAL. But we can have other reasons for hcall failures like H_AUTHORITY/H_PARAMETER with detail_rc as GEN_BUF_TOO_SMALL, for which we need to act accordingly.
Fix this issue by adding new checks in the single_gpci_request and h_gpci_event_init functions.
Result after fix patch changes:
# perf stat -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2 Error: No permission to enable hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event.
--- arch/powerpc/perf/hv-gpci.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/powerpc/perf/hv-gpci.c +27 -2
@@ -695,6 +695,20 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index, ret =plpar_hcall_norets (H_GET_PERF_COUNTER_INFO ,virt_to_phys (arg),HGPCI_REQ_BUFFER_SIZE ); + +/* +* ret value as 'H_PARAMETER' with detail_rc as 'GEN_BUF_TOO_SMALL', +* specifies that the current buffer size cannot accommodate +* all the information and a partial buffer returned. +* Since in this function we are only accessing data for a given starting index, +* we don't need to accommodate whole data and can get required count by +* accessing first entry data. +* Hence hcall fails only incase the ret value is other than H_SUCCESS or +* H_PARAMETER with detail_rc value as GEN_BUF_TOO_SMALL(0x1B). +*/ +if (ret ==H_PARAMETER &&be32_to_cpu (arg->params.detail_rc) ==0x1B ) + ret =0 ; +if (ret) {pr_devel ("hcall failed: 0x%lx\n" , ret); goto out;
@@ -759,6 +773,7 @@ static int h_gpci_event_init(struct perf_event *event) {u64 count;u8 length; +unsigned long ret;/* Not our event */ if (event->attr.type != event->pmu->type)
@@ -789,13 +804,23 @@ static int h_gpci_event_init(struct perf_event *event) }/* check if the request works... */ -if (single_gpci_request (event_get_request (event), + ret =single_gpci_request (event_get_request (event),event_get_starting_index (event),event_get_secondary_index (event),event_get_counter_info_version (event),event_get_offset (event), length, - &count)) { + &count); + +/* +* ret value as H_AUTHORITY implies that partition is not permitted to retrieve +* performance information, and required to set +* "Enable Performance Information Collection" option. +*/ +if (ret ==H_AUTHORITY ) +return -EPERM ; + +if (ret) {pr_devel ("gpci hcall failed\n" );return -EINVAL ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 475/638 clk: qcom: gcc-ipq5018: fix 'enable_reg' offset of 'gcc_gmac0_sys_clk'
In reply to Sasha LevinFrom: Gabor Juhos <[email protected]>
[ Upstream commit f982adcc1b1c02a3114f68ac73c811cbfabe90fa ]
The value of the 'enable_reg' field in the 'gcc_gmac0_sys_clk' clock definition seems wrong as it is greater than the 'max_register' value defined in the regmap configuration. Additionally, all other gmac specific branch clock definitions within the driver uses the same value both for the 'enable_reg' and for the 'halt_reg' fields.
Due to the lack of documentation the correct value is not known. Looking into the downstream driver does not help either, as that uses the same (presumably wrong) value [1].
Nevertheless, change the 'enable_reg' field of 'gcc_gmac0_sys_clk' to use the value from the 'halt_reg' field so it follows the pattern used in other gmac clock definitions. The change is based on the assumption that the register layout of this clock is the same as the other gmac clocks.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -1753,7 +1753,7 @@ static struct clk_branch gcc_gmac0_sys_clk = { .halt_check = BRANCH_HALT_DELAY, .halt_bit = 31, .clkr = { - .enable_reg = 0x683190, + .enable_reg = 0x68190, .enable_mask = BIT(0), .hw.init = &(struct clk_init_data) { .name = "gcc_gmac0_sys_clk",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 476/638 clk: qcom: gcc-ipq5018: fix 'halt_reg' offset of 'gcc_pcie1_pipe_clk'
In reply to Sasha LevinFrom: Gabor Juhos <[email protected]>
[ Upstream commit 11b752ac5a07cbfd95592fac5237a02f45662926 ]
The following table shows the values of the 'halt_reg' and the 'enable_reg' fields from the pcie clocks defined in the current driver:
clock halt_reg enable_reg
gcc_pcie0_ahb_clk 0x75010 0x75010 gcc_pcie0_aux_clk 0x75014 0x75014 gcc_pcie0_axi_m_clk 0x75008 0x75008 gcc_pcie0_axi_s_bridge_clk 0x75048 0x75048 gcc_pcie0_axi_s_clk 0x7500c 0x7500c gcc_pcie0_pipe_clk 0x75018 0x75018
gcc_pcie1_ahb_clk 0x76010 0x76010 gcc_pcie1_aux_clk 0x76014 0x76014 gcc_pcie1_axi_m_clk 0x76008 0x76008 gcc_pcie1_axi_s_bridge_clk 0x76048 0x76048 gcc_pcie1_axi_s_clk 0x7600c 0x7600c gcc_pcie1_pipe_clk 8* 0x76018
Based on the table, it is quite likely that the pcie0 and the pci1 clocks are using the same register layout, however it seems that the value of the 'halt_reg' field in the 'gcc_pcie1_pipe_clk' clock is wrong.
In the downstream driver [1], the same '0x76018' value is used for both the 'halt_reg' and for the 'enable_reg' fields of the 'gcc_pcie1_pipe_clk' clock.
Update the current driver to use the same value used downstream as probably that is the correct value.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -2179,7 +2179,7 @@ static struct clk_branch gcc_pcie1_axi_s_clk = { };static struct clk_branch gcc_pcie1_pipe_clk = { - .halt_reg =8 , + .halt_reg =0x76018 , .halt_check =BRANCH_HALT_DELAY , .halt_bit =31 , .clkr = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 477/638 clk: qcom: gcc-ipq5018: fix register offset for GCC_UBI0_AXI_ARES reset
In reply to Sasha LevinFrom: Gabor Juhos <[email protected]>
[ Upstream commit 7d474b43087aa356d714d39870c90d77fc6f1186 ]
The current register offset used for the GCC_UBI0_AXI_ARES reset seems wrong. Or at least, the downstream driver uses [1] the same offset which is used for other the GCC_UBI0_*_ARES resets.
Change the code to use the same offset used in the downstream driver and also specify the reset bit explicitly to use the same format as the followup entries.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -3631,7 +3631,7 @@ static const struct qcom_reset_map gcc_ipq5018_resets[] = { [GCC_SYSTEM_NOC_BCR] = { 0x26000, 0 }, [GCC_TCSR_BCR] = { 0x28000, 0 }, [GCC_TLMM_BCR] = { 0x34000, 0 }, - [GCC_UBI0_AXI_ARES] = { 0x680}, + [GCC_UBI0_AXI_ARES] = { 0x68010, 0 }, [GCC_UBI0_AHB_ARES] = { 0x68010, 1 }, [GCC_UBI0_NC_AXI_ARES] = { 0x68010, 2 }, [GCC_UBI0_DBG_ARES] = { 0x68010, 3 },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 478/638 drm/msm/dpu: add division of drm_display_mode's hskew parameter
In reply to Sasha LevinFrom: Paloma Arellano <[email protected]>
[ Upstream commit 551ee0f210991d25f336bc27262353bfe99d3eed ]
Setting up the timing engine when the physical encoder has a split role neglects dividing the drm_display_mode's hskew parameter. Let's fix this since this must also be done in preparation for implementing YUV420 over DP.
Patchwork: https://patchwork.freedesktop.org/patch/579605/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +4 -2
@@ -258,12 +258,14 @@ static void dpu_encoder_phys_vid_setup_timing_engine( mode.htotal >>=1 ; mode.hsync_start >>=1 ; mode.hsync_end >>=1 ; + mode.hskew >>=1 ;DPU_DEBUG_VIDENC (phys_enc, -"split_role %d, halve horizontal %d %d %d %d\n" , +"split_role %d, halve horizontal %d %d %d %d %d\n" , phys_enc->split_role, mode.hdisplay, mode.htotal, - mode.hsync_start, mode.hsync_end); + mode.hsync_start, mode.hsync_end, + mode.hskew); }drm_mode_to_intf_timing_params (phys_enc, &mode, &timing_params);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 479/638 modules: wait do_free_init correctly
In reply to Sasha LevinFrom: Changbin Du <[email protected]>
[ Upstream commit 8f8cd6c0a43ed637e620bbe45a8d0e0c2f4d5130 ]
The synchronization here is to ensure the ordering of freeing of a module init so that it happens before W+X checking. It is worth noting it is not that the freeing was not happening, it is just that our sanity checkers raced against the permission checkers which assume init memory is already gone.
Commit 1a7b7d922081 ("modules: Use vmalloc special flag") moved calling do_free_init() into a global workqueue instead of relying on it being called through call_rcu(..., do_free_init), which used to allowed us call do_free_init() asynchronously after the end of a subsequent grace period. The move to a global workqueue broke the gaurantees for code which needed to be sure the do_free_init() would complete with rcu_barrier(). To fix this callers which used to rely on rcu_barrier() must now instead use flush_work(&init_free_wq).
Without this fix, we still could encounter false positive reports in W+X checking since the rcu_barrier() here can not ensure the ordering now.
Even worse, the rcu_barrier() can introduce significant delay. Eric Chanudet reported that the rcu_barrier introduces ~0.1s delay on a PREEMPT_RT kernel.
[ 0.291444] Freeing unused kernel memory: 5568K [ 0.402442] Run /sbin/init as init process
With this fix, the above delay can be eliminated.
--- include/linux/moduleloader.h | 8 ++++++++ init/main.c | 5 +++-- kernel/module/main.c | 9 +++++++-- 3 files changed, 18 insertions(+), 4 deletions(-)
include/linux/moduleloader.h +8 -0
@@ -115,6 +115,14 @@ int module_finalize(const Elf_Ehdr *hdr,const Elf_Shdr *sechdrs, struct module *mod); +#ifdef CONFIG_MODULES +void flush_module_init_free_work (void ); +#else +static inline void flush_module_init_free_work (void ) +{ +} +#endif +/* Any cleanup needed when module leaves. */ void module_arch_cleanup (struct module *mod);
init/main.c +3 -2
@@ -88,6 +88,7 @@#include <linux/sched/task_stack.h> #include <linux/context_tracking.h> #include <linux/random.h> +#include <linux/moduleloader.h> #include <linux/list.h> #include <linux/integrity.h> #include <linux/proc_ns.h>
@@ -1402,11 +1403,11 @@ static void mark_readonly(void)if (rodata_enabled) {/* * load_module() results in W+X mappings, which are cleaned -* up with call_rcu(). Let's make sure that queued work is +* up with init_free_wq. Let's make sure that queued work is * flushed so that we don't hit false positives looking for * insecure pages which are W+X. */ -rcu_barrier (); +flush_module_init_free_work ();mark_rodata_ro ();rodata_test (); }else
kernel/module/main.c +7 -2
@@ -2486,6 +2486,11 @@ static void do_free_init(struct work_struct *w) } } +void flush_module_init_free_work (void ) +{ +flush_work (&init_free_wq); +} +#undef MODULE_PARAM_PREFIX#define MODULE_PARAM_PREFIX "module."/* Default value for module->async_probe_requested */
@@ -2590,8 +2595,8 @@ static noinline int do_init_module(struct module *mod)* Note that module_alloc() on most architectures creates W+X page * mappings which won't be cleaned up until do_free_init() runs. Any * code such as mark_rodata_ro() which depends on those mappings to -* be cleaned up needs to sync with the queued work - ie -* rcu_barrier() +* be cleaned up needs to sync with the queued work by invoking +* flush_module_init_free_work(). */ if (llist_add (&freeinit->node, &init_free_list))schedule_work (&init_free_wq);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 480/638 mfd: cs42l43: Fix wrong GPIO_FN_SEL and SPI_CLK_CONFIG1 defaults
In reply to Sasha LevinFrom: Maciej Strozek <[email protected]>
[ Upstream commit 78334c343bef528b911da83a6b041d15a1a72efb ]
Two regs have wrong values in existing fields, change them to match the datasheet.
--- drivers/mfd/cs42l43.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/cs42l43.c +2 -2
@@ -84,7 +84,7 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_DRV_CTRL_5, 0x136C00C0 }, { CS42L43_GPIO_CTRL1, 0x00000707 }, { CS42L43_GPIO_CTRL2, 0x00000000 }, - { CS42L43_GPIO_FN_SEL, 0x00000000 }, + { CS42L43_GPIO_FN_SEL, 0x00000004 }, { CS42L43_MCLK_SRC_SEL, 0x00000000 }, { CS42L43_SAMPLE_RATE1, 0x00000003 }, { CS42L43_SAMPLE_RATE2, 0x00000003 },
@@ -217,7 +217,7 @@ const struct reg_default cs42l43_reg_default[CS42L43_N_DEFAULTS] = { { CS42L43_CTRL_REG, 0x00000006 }, { CS42L43_FDIV_FRAC, 0x40000000 }, { CS42L43_CAL_RATIO, 0x00000080 }, - { CS42L43_SPI_CLK_CONFIG1, 0x00000000 }, + { CS42L43_SPI_CLK_CONFIG1, 0x00000001 }, { CS42L43_SPI_CONFIG1, 0x00000000 }, { CS42L43_SPI_CONFIG2, 0x00000000 }, { CS42L43_SPI_CONFIG3, 0x00000001 },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 481/638 powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc.
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit 20933531be0577cdd782216858c26150dbc7936f ]
Move the prototypes into mpc10x.h which is included by all the relevant C files, fixes:
arch/powerpc/platforms/embedded6xx/ls_uart.c:59:6: error: no previous prototype for 'avr_uart_configure' arch/powerpc/platforms/embedded6xx/ls_uart.c:82:6: error: no previous prototype for 'avr_uart_send'
--- arch/powerpc/platforms/embedded6xx/linkstation.c | 3 --- arch/powerpc/platforms/embedded6xx/mpc10x.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/linkstation.c +0 -3
@@ -99,9 +99,6 @@ static void __init linkstation_init_IRQ(void)mpic_init (mpic); } -extern void avr_uart_configure (void ); -extern void avr_uart_send (const char ); -static void __noreturn linkstation_restart (char *cmd) {local_irq_disable ();
arch/powerpc/platforms/embedded6xx/mpc10x.h +3 -0
@@ -156,4 +156,7 @@ int mpc10x_disable_store_gathering(struct pci_controller *hose);/* For MPC107 boards that use the built-in openpic */ void mpc10x_set_openpic (void ); +void avr_uart_configure (void ); +void avr_uart_send (const char c); +#endif /* __PPC_KERNEL_MPC10X_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 482/638 leds: aw2013: Unlock mutex before destroying it
In reply to Sasha LevinFrom: George Stark <[email protected]>
[ Upstream commit 6969d0a2ba1adc9ba6a49b9805f24080896c255c ]
In the probe() callback in case of error mutex is destroyed being locked which is not allowed so unlock the mutex before destroying.
--- drivers/leds/leds-aw2013.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/leds-aw2013.c +1 -0
@@ -405,6 +405,7 @@ static int aw2013_probe(struct i2c_client *client) chip->regulators); error: +mutex_unlock (&chip->mutex);mutex_destroy (&chip->mutex);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 483/638 leds: sgm3140: Add missing timer cleanup and flash gpio control
In reply to Sasha LevinFrom: Ondrej Jirman <[email protected]>
[ Upstream commit 205c29887a333ee4b37596e6533373e38cb23947 ]
Enabling strobe and then setting brightness to 0 causes the driver to enter invalid state after strobe end timer fires. We should cancel strobe mode resources when changing brightness (aka torch mode).
--- drivers/leds/flash/leds-sgm3140.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/leds/flash/leds-sgm3140.c +3 -0
@@ -114,8 +114,11 @@ static int sgm3140_brightness_set(struct led_classdev *led_cdev, "failed to enable regulator: %d\n", ret);return ret; } +gpiod_set_value_cansleep (priv->flash_gpio,0 );gpiod_set_value_cansleep (priv->enable_gpio,1 ); }else { +del_timer_sync (&priv->powerdown_timer); +gpiod_set_value_cansleep (priv->flash_gpio,0 );gpiod_set_value_cansleep (priv->enable_gpio,0 ); ret =regulator_disable (priv->vin_regulator);if (ret) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 484/638 backlight: ktz8866: Correct the check for of_property_read_u32
In reply to Sasha LevinFrom: Jianhua Lu <[email protected]>
[ Upstream commit f1ac3c9825f99c93a9833beee6b78aa386e55b0b ]
of_property_read_u32 returns 0 when success, so reverse the return value to get the true value.
--- drivers/video/backlight/ktz8866.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/backlight/ktz8866.c +3 -3
@@ -97,20 +97,20 @@ static void ktz8866_init(struct ktz8866 *ktz) {unsigned int val =0 ; -if (of_property_read_u32 (ktz->client->dev.of_node,"current-num-sinks" , &val)) +if (!of_property_read_u32 (ktz->client->dev.of_node,"current-num-sinks" , &val))ktz8866_write (ktz,BL_EN ,BIT (val) -1 );else /* Enable all 6 current sinks if the number of current sinks isn't specified. */ ktz8866_write (ktz,BL_EN ,BIT (6 ) -1 ); -if (of_property_read_u32 (ktz->client->dev.of_node,"kinetic,current-ramp-delay-ms" , &val)) { +if (!of_property_read_u32 (ktz->client->dev.of_node,"kinetic,current-ramp-delay-ms" , &val)) {if (val <=128 )ktz8866_write (ktz,BL_CFG2 ,BIT (7 ) | (ilog2 (val) <<3 ) |PWM_HYST );else ktz8866_write (ktz,BL_CFG2 ,BIT (7 ) | ((5 + val /64 ) <<3 ) |PWM_HYST ); } -if (of_property_read_u32 (ktz->client->dev.of_node,"kinetic,led-enable-ramp-delay-ms" , &val)) { +if (!of_property_read_u32 (ktz->client->dev.of_node,"kinetic,led-enable-ramp-delay-ms" , &val)) {if (val ==0 )ktz8866_write (ktz,BL_DIMMING ,0 );else {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 485/638 backlight: lm3630a: Initialize backlight_properties on init
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit ad9aeb0e3aa90ebdad5fabf9c21783740eb95907 ]
The backlight_properties struct should be initialized to zero before using, otherwise there will be some random values in the struct.
--- drivers/video/backlight/lm3630a_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lm3630a_bl.c +1 -0
@@ -343,6 +343,7 @@ static int lm3630a_backlight_register(struct lm3630a_chip *pchip)struct backlight_properties props;const char *label; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ;if (pdata->leda_ctrl !=LM3630A_LEDA_DISABLE ) { props.brightness = pdata->leda_init_brt;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 486/638 backlight: lm3630a: Don't set bl->props.brightness in get_brightness
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit 4bf7ddd2d2f0f8826f25f74c7eba4e2c323a1446 ]
There's no need to set bl->props.brightness, the get_brightness function is just supposed to return the current brightness and not touch the struct.
With that done we can also remove the 'goto out' and just return the value.
--- drivers/video/backlight/lm3630a_bl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/video/backlight/lm3630a_bl.c +4 -10
@@ -233,7 +233,7 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl)if (rval <0 ) goto out_i2c_err; brightness |= rval; - goto out; +return brightness; }/* disable sleep */
@@ -244,11 +244,8 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl) rval =lm3630a_read (pchip,REG_BRT_A );if (rval <0 ) goto out_i2c_err; - brightness = rval; +return rval; -out: - bl->props.brightness = brightness; -return bl->props.brightness; out_i2c_err:dev_err (pchip->dev,"i2c failed to access register\n" );return 0 ;
@@ -310,7 +307,7 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl)if (rval <0 ) goto out_i2c_err; brightness |= rval; - goto out; +return brightness; }/* disable sleep */
@@ -321,11 +318,8 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl) rval =lm3630a_read (pchip,REG_BRT_B );if (rval <0 ) goto out_i2c_err; - brightness = rval; +return rval; -out: - bl->props.brightness = brightness; -return bl->props.brightness; out_i2c_err:dev_err (pchip->dev,"i2c failed to access register\n" );return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 487/638 backlight: da9052: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 0285e9efaee8276305db5c52a59baf84e9731556 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/da9052_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/da9052_bl.c +1 -0
@@ -117,6 +117,7 @@ static int da9052_backlight_probe(struct platform_device *pdev) wleds->led_reg =platform_get_device_id (pdev)->driver_data; wleds->state =DA9052_WLEDS_OFF ; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ; props.max_brightness =DA9052_MAX_BRIGHTNESS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 488/638 backlight: lm3639: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit abb5a5d951fbea3feb5c4ba179b89bb96a1d3462 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/lm3639_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lm3639_bl.c +1 -0
@@ -338,6 +338,7 @@ static int lm3639_probe(struct i2c_client *client) }/* backlight */ +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ; props.brightness = pdata->init_brt_led; props.max_brightness = pdata->max_brt_led;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 489/638 backlight: lp8788: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 392346827fbe8a7fd573dfb145170d7949f639a6 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/lp8788_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lp8788_bl.c +1 -0
@@ -191,6 +191,7 @@ static int lp8788_backlight_register(struct lp8788_bl *bl)int init_brt;char *name; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_PLATFORM ; props.max_brightness =MAX_BRIGHTNESS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 490/638 arch/powerpc: Remove <linux/fb.h> from backlight code
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit 838f865802b9f26135ea7df4e30f89ac2f50c23e ]
Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to resolve an unnecessary dependency. Remove pmac_backlight_curve_lookup() and struct fb_info from source and header files. The function and the framebuffer struct are unused. No functional changes.
v3:
* Add Fixes tag (Christophe)
* fix typos in commit message (Jani)
--- arch/powerpc/include/asm/backlight.h | 5 ++-- arch/powerpc/platforms/powermac/backlight.c | 26 --------------------- 2 files changed, 2 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/backlight.h +2 -3
@@ -10,15 +10,14 @@#define __ASM_POWERPC_BACKLIGHT_H#ifdef __KERNEL__ -#include <linux/fb.h> #include <linux/mutex.h> +struct backlight_device ; +/* For locking instructions, see the implementation file */ extern struct backlight_device *pmac_backlight;extern struct mutex pmac_backlight_mutex; -extern int pmac_backlight_curve_lookup (struct fb_info *info,int value); -extern int pmac_has_backlight_type (const char *type);extern void pmac_backlight_key (int direction);
arch/powerpc/platforms/powermac/backlight.c +0 -26
@@ -9,7 +9,6 @@*/ #include <linux/kernel.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/adb.h> #include <linux/pmu.h>
@@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)return 0 ; } -int pmac_backlight_curve_lookup (struct fb_info *info,int value) -{ -int level = (FB_BACKLIGHT_LEVELS -1 ); - -if (info && info->bl_dev) { -int i, max =0 ; - -/* Look for biggest value */ -for (i =0 ; i <FB_BACKLIGHT_LEVELS ; i++) - max =max ((int )info->bl_curve[i], max); - -/* Look for nearest value */ -for (i =0 ; i <FB_BACKLIGHT_LEVELS ; i++) { -int diff =abs (info->bl_curve[i] - value); -if (diff < max) { - max = diff; - level = i; - } - } - - } - -return level; -} -static void pmac_backlight_key_worker (struct work_struct *work) {if (atomic_read (&kernel_backlight_disabled))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 491/638 sparc32: Fix section mismatch in leon_pci_grpci
In reply to Sasha LevinFrom: Sam Ravnborg <[email protected]>
[ Upstream commit 24338a6ae13cb743ced77da1b3a12c83f08a0c96 ]
Passing a datastructre marked _initconst to platform_driver_register() is wrong. Drop the __initconst notation.
This fixes the following warnings:
WARNING: modpost: vmlinux: section mismatch in reference: grpci1_of_driver+0x30 (section: .data) -> grpci1_of_match (section: .init.rodata)
WARNING: modpost: vmlinux: section mismatch in reference: grpci2_of_driver+0x30 (section: .data) -> grpci2_of_match (section: .init.rodata)
--- arch/sparc/kernel/leon_pci_grpci1.c | 2 +- arch/sparc/kernel/leon_pci_grpci2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/leon_pci_grpci1.c +1 -1
@@ -697,7 +697,7 @@ static int grpci1_of_probe(struct platform_device *ofdev)return err; } -static const struct of_device_id grpci1_of_match[]__initconst = { +static const struct of_device_id grpci1_of_match[] = { { .name ="GAISLER_PCIFBRG" , },
arch/sparc/kernel/leon_pci_grpci2.c +1 -1
@@ -889,7 +889,7 @@ static int grpci2_of_probe(struct platform_device *ofdev)return err; } -static const struct of_device_id grpci2_of_match[]__initconst = { +static const struct of_device_id grpci2_of_match[] = { { .name ="GAISLER_GRPCI2" , },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 492/638 clk: Fix clk_core_get NULL dereference
In reply to Sasha LevinFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit e97fe4901e0f59a0bfd524578fe3768f8ca42428 ]
It is possible for clk_core_get to dereference a NULL in the following sequence:
clk_core_get()
of_clk_get_hw_from_clkspec()
__of_clk_get_hw_from_provider()
__clk_get_hw()__clk_get_hw() can return NULL which is dereferenced by clk_core_get() at hw->core.
Prior to commit dde4eff47c82 ("clk: Look for parents with clkdev based clk_lookups") the check IS_ERR_OR_NULL() was performed which would have caught the NULL.
Reading the description of this function it talks about returning NULL but that cannot be so at the moment.
Update the function to check for hw before dereferencing it and return NULL if hw is NULL.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -418,6 +418,9 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)if (IS_ERR (hw))return ERR_CAST (hw); +if (!hw) +return NULL ; +return hw->core; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 493/638 clk: zynq: Prevent null pointer dereference caused by kmalloc failure
In reply to Sasha LevinFrom: Duoming Zhou <[email protected]>
[ Upstream commit 7938e9ce39d6779d2f85d822cc930f73420e54a6 ]
The kmalloc() in zynq_clk_setup() will return null if the physical memory has run out. As a result, if we use snprintf() to write data to the null address, the null pointer dereference bug will happen.
This patch uses a stack variable to replace the kmalloc().
--- drivers/clk/zynq/clkc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/clk/zynq/clkc.c +3 -5
@@ -42,6 +42,7 @@ static void __iomem *zynq_clkc_base;#define SLCR_SWDT_CLK_SEL (zynq_clkc_base + 0x204)#define NUM_MIO_PINS 54 +#define CLK_NAME_LEN 16#define DBG_CLK_CTRL_CLKACT_TRC BIT(0)#define DBG_CLK_CTRL_CPU_1XCLKACT BIT(1)
@@ -215,7 +216,7 @@ static void __init zynq_clk_setup(struct device_node *np)int i;u32 tmp;int ret; -char *clk_name; +char clk_name[CLK_NAME_LEN ];unsigned int fclk_enable =0 ;const char *clk_output_name[clk_max];const char *cpu_parents[4 ];
@@ -426,12 +427,10 @@ static void __init zynq_clk_setup(struct device_node *np)"gem1_emio_mux" ,CLK_SET_RATE_PARENT , SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock); - tmp =strlen ("mio_clk_00x" ); - clk_name =kmalloc (tmp,GFP_KERNEL );for (i =0 ; i <NUM_MIO_PINS ; i++) {int idx; -snprintf (clk_name, tmp,"mio_clk_%2.2d" , i); +snprintf (clk_name,CLK_NAME_LEN ,"mio_clk_%2.2d" , i); idx =of_property_match_string (np,"clock-names" , clk_name);if (idx >=0 ) can_mio_mux_parents[i] = of_clk_get_parent_name(np,
@@ -439,7 +438,6 @@ static void __init zynq_clk_setup(struct device_node *np)else can_mio_mux_parents[i] = dummy_nm; } -kfree (clk_name);clk_register_mux (NULL ,"can_mux" , periph_parents,4 ,CLK_SET_RATE_NO_REPARENT ,SLCR_CAN_CLK_CTRL ,4 ,2 ,0 , &canclk_lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 494/638 PCI: brcmstb: Fix broken brcm_pcie_mdio_write() polling
In reply to Sasha LevinFrom: Jonathan Bell <[email protected]>
[ Upstream commit 039741a8d7c9a01c1bc84a5ac5aa770a5e138a30 ]
The MDIO_WT_DONE() macro tests bit 31, which is always 0 (== done) as readw_poll_timeout_atomic() does a 16-bit read. Replace with the readl variant.
--- drivers/pci/controller/pcie-brcmstb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-brcmstb.c +1 -1
@@ -330,7 +330,7 @@ static int brcm_pcie_mdio_write(void __iomem *base, u8 port,readl (base +PCIE_RC_DL_MDIO_ADDR );writel (MDIO_DATA_DONE_MASK | wrdata, base +PCIE_RC_DL_MDIO_WR_DATA ); - err =readw_poll_timeout_atomic (base +PCIE_RC_DL_MDIO_WR_DATA , data, + err =readl_poll_timeout_atomic (base +PCIE_RC_DL_MDIO_WR_DATA , data,MDIO_WT_DONE (data),10 ,100 );return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 495/638 smb: do not test the return value of folio_start_writeback()
In reply to Sasha LevinFrom: "Matthew Wilcox (Oracle)" <[email protected]>
[ Upstream commit a9540e35624d1475f47dbf6353eed8b99936d36e ]
In preparation for removing the return value entirely, stop testing it in smb.
Stable-dep-of: f3dc1bdb6b0b ("cifs: Fix writeback data corruption")
--- fs/smb/client/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/smb/client/file.c +2 -4
@@ -2709,8 +2709,7 @@ static void cifs_extend_writeback(struct address_space *mapping,*/ if (!folio_clear_dirty_for_io (folio))WARN_ON (1 ); -if (folio_start_writeback (folio)) -WARN_ON (1 ); +folio_start_writeback (folio); *_count -=folio_nr_pages (folio);folio_unlock (folio);
@@ -2745,8 +2744,7 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,int rc;/* The folio should be locked, dirty and not undergoing writeback. */ -if (folio_start_writeback (folio)) -WARN_ON (1 ); +folio_start_writeback (folio); count -=folio_nr_pages (folio); len =folio_size (folio);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 496/638 cifs: Don't use certain unnecessary folio_*() functions
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit c40497d82387188f14d9adc4caa58ee1cb1999e1 ]
Filesystems should use folio->index and folio->mapping, instead of folio_index(folio), folio_mapping() and folio_file_mapping() since they know that it's in the pagecache.
Change this automagically with:
perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c perl -p -i -e 's/folio_file_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c perl -p -i -e 's/folio_index[(]([^)]*)[)]/\1->index/g' fs/smb/client/*.c
Stable-dep-of: f3dc1bdb6b0b ("cifs: Fix writeback data corruption")
--- fs/smb/client/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/smb/client/file.c +5 -5
@@ -87,7 +87,7 @@ void cifs_pages_written_back(struct inode *inode, loff_t start, unsigned int lencontinue ;if (!folio_test_writeback (folio)) {WARN_ONCE (1 ,"bad %x @%llx page %lx %lx\n" , - len, start,folio_index (folio), end); + len, start, folio->index, end);continue ; }
@@ -120,7 +120,7 @@ void cifs_pages_write_failed(struct inode *inode, loff_t start, unsigned int lencontinue ;if (!folio_test_writeback (folio)) {WARN_ONCE (1 ,"bad %x @%llx page %lx %lx\n" , - len, start,folio_index (folio), end); + len, start, folio->index, end);continue ; }
@@ -151,7 +151,7 @@ void cifs_pages_write_redirty(struct inode *inode, loff_t start, unsigned int lexas_for_each (&xas, folio, end) {if (!folio_test_writeback (folio)) {WARN_ONCE (1 ,"bad %x @%llx page %lx %lx\n" , - len, start,folio_index (folio), end); + len, start, folio->index, end);continue ; }
@@ -2652,7 +2652,7 @@ static void cifs_extend_writeback(struct address_space *mapping,continue ;if (xa_is_value (folio))break ; -if (folio_index (folio) != index) +if (folio->index != index)break ;if (!folio_try_get_rcu (folio)) {xas_reset (&xas);
@@ -2900,7 +2900,7 @@ static int cifs_writepages_region(struct address_space *mapping, goto skip_write; } -if (folio_mapping (folio) != mapping || +if (folio->mapping != mapping || !folio_test_dirty (folio)) { start +=folio_size (folio);folio_unlock (folio);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 497/638 cifs: Fix writeback data corruption
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit f3dc1bdb6b0b0693562c7c54a6c28bafa608ba3c ]
cifs writeback doesn't correctly handle the case where cifs_extend_writeback() hits a point where it is considering an additional folio, but this would overrun the wsize - at which point it drops out of the xarray scanning loop and calls xas_pause(). The problem is that xas_pause() advances the loop counter - thereby skipping that page.
What needs to happen is for xas_reset() to be called any time we decide we don't want to process the page we're looking at, but rather send the request we are building and start a new one.
Fix this by copying and adapting the netfslib writepages code as a temporary measure, with cifs writeback intending to be offloaded to netfslib in the near future.
This also fixes the issue with the use of filemap_get_folios_tag() causing retry of a bunch of pages which the extender already dealt with.
This can be tested by creating, say, a 64K file somewhere not on cifs (otherwise copy-offload may get underfoot), mounting a cifs share with a wsize of 64000, copying the file to it and then comparing the original file and the copy:
dd if=/dev/urandom of=/tmp/64K bs=64k count=1
mount //192.168.6.1/test /mnt -o user=...,pass=...,wsize=64000
cp /tmp/64K /mnt/64K
cmp /tmp/64K /mnt/64KWithout the fix, the cmp fails at position 64000 (or shortly thereafter).
--- fs/smb/client/file.c | 283 ++++++++++++++++++++++++------------------- 1 file changed, 157 insertions(+), 126 deletions(-)
fs/smb/client/file.c +157 -126
@@ -2622,20 +2622,20 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)* dirty pages if possible, but don't sleep while doing so. */ static void cifs_extend_writeback (struct address_space *mapping, +struct xa_state *xas,long *_count,loff_t start,int max_pages, -size_t max_len, -unsigned int *_len) +loff_t max_len, +size_t *_len) {struct folio_batch batch;struct folio *folio; -unsigned int psize, nr_pages; -size_t len = *_len; -pgoff_t index = (start + len) /PAGE_SIZE ; +unsigned int nr_pages; +pgoff_t index = (start + *_len) /PAGE_SIZE ; +size_t len;bool stop = true;unsigned int i; -XA_STATE (xas, &mapping->i_pages, index);folio_batch_init (&batch);
@@ -2646,54 +2646,64 @@ static void cifs_extend_writeback(struct address_space *mapping,*/ rcu_read_lock (); -xas_for_each (&xas, folio,ULONG_MAX ) { +xas_for_each (xas, folio,ULONG_MAX ) { stop = true; -if (xas_retry (&xas, folio)) +if (xas_retry (xas, folio))continue ;if (xa_is_value (folio))break ; -if (folio->index != index) +if (folio->index != index) { +xas_reset (xas);break ; + } +if (!folio_try_get_rcu (folio)) { -xas_reset (&xas); +xas_reset (xas);continue ; } nr_pages =folio_nr_pages (folio); -if (nr_pages > max_pages) +if (nr_pages > max_pages) { +xas_reset (xas);break ; + }/* Has the page moved or been split? */ -if (unlikely (folio !=xas_reload (&xas))) { +if (unlikely (folio !=xas_reload (xas))) {folio_put (folio); +xas_reset (xas);break ; }if (!folio_trylock (folio)) {folio_put (folio); +xas_reset (xas);break ; } -if (!folio_test_dirty (folio) ||folio_test_writeback (folio)) { +if (!folio_test_dirty (folio) || +folio_test_writeback (folio)) {folio_unlock (folio);folio_put (folio); +xas_reset (xas);break ; } max_pages -= nr_pages; - psize =folio_size (folio); - len += psize; + len =folio_size (folio); stop = false; -if (max_pages <=0 || len >= max_len || *_count <=0 ) - stop = true; index += nr_pages; + *_count -= nr_pages; + *_len += len; +if (max_pages <=0 || *_len >= max_len || *_count <=0 ) + stop = true; +if (!folio_batch_add (&batch, folio))break ;if (stop)break ; } -if (!stop) -xas_pause (&xas); +xas_pause (xas);rcu_read_unlock ();/* Now, if we obtained any pages, we can shift them to being
@@ -2710,16 +2720,12 @@ static void cifs_extend_writeback(struct address_space *mapping,if (!folio_clear_dirty_for_io (folio))WARN_ON (1 );folio_start_writeback (folio); - - *_count -=folio_nr_pages (folio);folio_unlock (folio); }folio_batch_release (&batch);cond_resched (); }while (!stop); - - *_len = len; }/*
@@ -2727,8 +2733,10 @@ static void cifs_extend_writeback(struct address_space *mapping,*/ static ssize_t cifs_write_back_from_locked_folio (struct address_space *mapping,struct writeback_control *wbc, +struct xa_state *xas,struct folio *folio, -loff_t start,loff_t end) +unsigned long long start, +unsigned long long end) {struct inode *inode = mapping->host;struct TCP_Server_Info *server;
@@ -2737,17 +2745,18 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,struct cifs_credits credits_on_stack;struct cifs_credits *credits = &credits_on_stack;struct cifsFileInfo *cfile =NULL ; -unsigned int xid, wsize, len; -loff_t i_size =i_size_read (inode); -size_t max_len; +unsigned long long i_size =i_size_read (inode), max_len; +unsigned int xid, wsize; +size_t len =folio_size (folio);long count = wbc->nr_to_write;int rc;/* The folio should be locked, dirty and not undergoing writeback. */ +if (!folio_clear_dirty_for_io (folio)) +WARN_ON_ONCE (1 );folio_start_writeback (folio); count -=folio_nr_pages (folio); - len =folio_size (folio); xid =get_xid (); server =cifs_pick_channel (cifs_sb_master_tcon (cifs_sb)->ses);
@@ -2777,9 +2786,10 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, wdata->server = server; cfile =NULL ; -/* Find all consecutive lockable dirty pages, stopping when we find a -* page that is not immediately lockable, is not dirty or is missing, -* or we reach the end of the range. +/* Find all consecutive lockable dirty pages that have contiguous +* written regions, stopping when we find a page that is not +* immediately lockable, is not dirty or is missing, or we reach the +* end of the range. */ if (start < i_size) {/* Trim the write to the EOF; the extra data is ignored. Also
@@ -2799,19 +2809,18 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, max_pages -=folio_nr_pages (folio);if (max_pages >0 ) -cifs_extend_writeback (mapping, &count, start, +cifs_extend_writeback (mapping, xas, &count, start, max_pages, max_len, &len); } - len =min_t (loff_t, len, max_len); } - - wdata->bytes = len; + len = min_t(unsigned long long, len, i_size - start);/* We now have a contiguous set of dirty pages, each with writeback * set; the first page is still locked at this point, but all the rest * have been unlocked. */ folio_unlock (folio); + wdata->bytes = len;if (start < i_size) { iov_iter_xarray(&wdata->iter, ITER_SOURCE, &mapping->i_pages,
@@ -2862,102 +2871,118 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,/* * write a region of pages back to the server */ -static int cifs_writepages_region (struct address_space *mapping, -struct writeback_control *wbc, -loff_t start,loff_t end,loff_t *_next) +static ssize_t cifs_writepages_begin (struct address_space *mapping, +struct writeback_control *wbc, +struct xa_state *xas, +unsigned long long *_start, +unsigned long long end) { -struct folio_batch fbatch; +struct folio *folio; +unsigned long long start = *_start; +ssize_t ret;int skips =0 ; -folio_batch_init (&fbatch); -do { -int nr; -pgoff_t index = start /PAGE_SIZE ; +search_again: +/* Find the first dirty page. */ +rcu_read_lock (); - nr =filemap_get_folios_tag (mapping, &index, end /PAGE_SIZE , -PAGECACHE_TAG_DIRTY , &fbatch); -if (!nr) +for (;;) { + folio =xas_find_marked (xas, end /PAGE_SIZE ,PAGECACHE_TAG_DIRTY ); +if (xas_retry (xas, folio) ||xa_is_value (folio)) +continue ; +if (!folio)break ; -for (int i =0 ; i < nr; i++) { -ssize_t ret; -struct folio *folio = fbatch.folios[i]; +if (!folio_try_get_rcu (folio)) { +xas_reset (xas); +continue ; + } -redo_folio: - start =folio_pos (folio);/* May regress with THPs */ +if (unlikely (folio !=xas_reload (xas))) { +folio_put (folio); +xas_reset (xas); +continue ; + } -/* At this point we hold neither the i_pages lock nor the -* page lock: the page may be truncated or invalidated -* (changing page->mapping to NULL), or even swizzled -* back from swapper_space to tmpfs file mapping -*/ -if (wbc->sync_mode !=WB_SYNC_NONE ) { - ret =folio_lock_killable (folio); -if (ret <0 ) - goto write_error; - }else { -if (!folio_trylock (folio)) - goto skip_write; - } +xas_pause (xas); +break ; + } +rcu_read_unlock (); +if (!folio) +return 0 ; -if (folio->mapping != mapping || - !folio_test_dirty (folio)) { - start +=folio_size (folio); -folio_unlock (folio); -continue ; - } + start =folio_pos (folio);/* May regress with THPs */ -if (folio_test_writeback (folio) || -folio_test_fscache (folio)) { -folio_unlock (folio); -if (wbc->sync_mode ==WB_SYNC_NONE ) - goto skip_write; +/* At this point we hold neither the i_pages lock nor the page lock: +* the page may be truncated or invalidated (changing page->mapping to +* NULL), or even swizzled back from swapper_space to tmpfs file +* mapping +*/ +lock_again: +if (wbc->sync_mode !=WB_SYNC_NONE ) { + ret =folio_lock_killable (folio); +if (ret <0 ) +return ret; + }else { +if (!folio_trylock (folio)) + goto search_again; + } -folio_wait_writeback (folio); +if (folio->mapping != mapping || + !folio_test_dirty (folio)) { + start +=folio_size (folio); +folio_unlock (folio); + goto search_again; + } + +if (folio_test_writeback (folio) || +folio_test_fscache (folio)) { +folio_unlock (folio); +if (wbc->sync_mode !=WB_SYNC_NONE ) { +folio_wait_writeback (folio);#ifdef CONFIG_CIFS_FSCACHE -folio_wait_fscache (folio); +folio_wait_fscache (folio);#endif - goto redo_folio; - } - -if (!folio_clear_dirty_for_io (folio)) -/* We hold the page lock - it should've been dirty. */ -WARN_ON (1 ); - - ret =cifs_write_back_from_locked_folio (mapping, wbc, folio, start, end); -if (ret <0 ) - goto write_error; - - start += ret; -continue ; - -write_error: -folio_batch_release (&fbatch); - *_next = start; -return ret; + goto lock_again; + } -skip_write: -/* -* Too many skipped writes, or need to reschedule? -* Treat it as a write error without an error code. -*/ + start +=folio_size (folio); +if (wbc->sync_mode ==WB_SYNC_NONE ) {if (skips >=5 ||need_resched ()) { ret =0 ; - goto write_error; + goto out; } - -/* Otherwise, just skip that folio and go on to the next */ skips++; - start +=folio_size (folio); -continue ; } + goto search_again; + } -folio_batch_release (&fbatch); -cond_resched (); - }while (wbc->nr_to_write >0 ); + ret =cifs_write_back_from_locked_folio (mapping, wbc, xas, folio, start, end); +out: +if (ret >0 ) + *_start = start + ret; +return ret; +} - *_next = start; -return 0 ; +/* +* Write a region of pages back to the server +*/ +static int cifs_writepages_region (struct address_space *mapping, +struct writeback_control *wbc, +unsigned long long *_start, +unsigned long long end) +{ +ssize_t ret; + +XA_STATE (xas, &mapping->i_pages, *_start /PAGE_SIZE ); + +do { + ret =cifs_writepages_begin (mapping, wbc, &xas, _start, end); +if (ret >0 && wbc->nr_to_write >0 ) +cond_resched (); + }while (ret >0 && wbc->nr_to_write >0 ); + +return ret >0 ?0 : ret; }/*
@@ -2966,7 +2991,7 @@ static int cifs_writepages_region(struct address_space *mapping,static int cifs_writepages (struct address_space *mapping,struct writeback_control *wbc) { -loff_t start, next; +loff_t start, end;int ret;/* We have to be careful as we can end up racing with setattr()
@@ -2974,28 +2999,34 @@ static int cifs_writepages(struct address_space *mapping,* to prevent it. */ -if (wbc->range_cyclic) { +if (wbc->range_cyclic && mapping->writeback_index) { start = mapping->writeback_index *PAGE_SIZE ; - ret =cifs_writepages_region (mapping, wbc, start,LLONG_MAX , &next); -if (ret ==0 ) { - mapping->writeback_index = next /PAGE_SIZE ; -if (start >0 && wbc->nr_to_write >0 ) { - ret =cifs_writepages_region (mapping, wbc,0 , - start, &next); -if (ret ==0 ) - mapping->writeback_index = - next /PAGE_SIZE ; - } + ret =cifs_writepages_region (mapping, wbc, &start,LLONG_MAX ); +if (ret <0 ) + goto out; + +if (wbc->nr_to_write <=0 ) { + mapping->writeback_index = start /PAGE_SIZE ; + goto out; } + + start =0 ; + end = mapping->writeback_index *PAGE_SIZE ; + mapping->writeback_index =0 ; + ret =cifs_writepages_region (mapping, wbc, &start, end); +if (ret ==0 ) + mapping->writeback_index = start /PAGE_SIZE ; }else if (wbc->range_start ==0 && wbc->range_end ==LLONG_MAX ) { - ret =cifs_writepages_region (mapping, wbc,0 ,LLONG_MAX , &next); + start =0 ; + ret =cifs_writepages_region (mapping, wbc, &start,LLONG_MAX );if (wbc->nr_to_write >0 && ret ==0 ) - mapping->writeback_index = next /PAGE_SIZE ; + mapping->writeback_index = start /PAGE_SIZE ; }else { - ret =cifs_writepages_region (mapping, wbc, - wbc->range_start, wbc->range_end, &next); + start = wbc->range_start; + ret =cifs_writepages_region (mapping, wbc, &start, wbc->range_end); } +out:return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 498/638 ALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops
In reply to Sasha LevinFrom: Athaariq Ardhiansyah <[email protected]>
[ Upstream commit c062166995c9e57d5cd508b332898f79da319802 ]
Realtek codec on HP Envy laptop series are heavily modified by vendor. Therefore, need intervention to make it work properly. The patch fixes:
- B&O soundbar speakers (between lid and keyboard) activation
- Enable LED on mute button
- Add missing process coefficient which affects the output amplifier
- Volume control synchronization between B&O soundbar and side speakers
- Unmute headset output on several HP Envy models
- Auto-enable headset mic when plugged
This patch was tested on HP Envy x360 13-AR0107AU with Realtek ALC285
The only unsolved problem is output amplifier of all built-in speakers is too weak, which causes volume of built-in speakers cannot be loud as vendor's proprietary driver due to missing _DSD parameter in the firmware. The solution is currently on research. Expected to has another patch in the future.
Potential fix to related issues, need test before close those issues:
- https://bugzilla.kernel.org/show_bug.cgi?id=189331
- https://bugzilla.kernel.org/show_bug.cgi?id=216632
- https://bugzilla.kernel.org/show_bug.cgi?id=216311
- https://bugzilla.kernel.org/show_bug.cgi?id=213507
Message-ID: <[email protected]>
--- sound/pci/hda/patch_realtek.c | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
sound/pci/hda/patch_realtek.c +63 -0
@@ -6695,6 +6695,60 @@ static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, } } +static void alc285_fixup_hp_envy_x360 (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +static const struct coef_fw coefs[] = { +WRITE_COEF (0x08 ,0x6a0c ),WRITE_COEF (0x0d ,0xa023 ), +WRITE_COEF (0x10 ,0x0320 ),WRITE_COEF (0x1a ,0x8c03 ), +WRITE_COEF (0x25 ,0x1800 ),WRITE_COEF (0x26 ,0x003a ), +WRITE_COEF (0x28 ,0x1dfe ),WRITE_COEF (0x29 ,0xb014 ), +WRITE_COEF (0x2b ,0x1dfe ),WRITE_COEF (0x37 ,0xfe15 ), +WRITE_COEF (0x38 ,0x7909 ),WRITE_COEF (0x45 ,0xd489 ), +WRITE_COEF (0x46 ,0x00f4 ),WRITE_COEF (0x4a ,0x21e0 ), +WRITE_COEF (0x66 ,0x03f0 ),WRITE_COEF (0x67 ,0x1000 ), +WRITE_COEF (0x6e ,0x1005 ), { } + }; + +static const struct hda_pintbl pincfgs[] = { + {0x12 ,0xb7a60130 },/* Internal microphone*/ + {0x14 ,0x90170150 },/* B&O soundbar speakers */ + {0x17 ,0x90170153 },/* Side speakers */ + {0x19 ,0x03a11040 },/* Headset microphone */ + { } + }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +snd_hda_apply_pincfgs (codec, pincfgs); + +/* Fixes volume control problem for side speakers */ +alc295_fixup_disable_dac3 (codec, fix, action); + +/* Fixes no sound from headset speaker */ +snd_hda_codec_amp_stereo (codec,0x21 ,HDA_OUTPUT ,0 ,-1 ,0 ); + +/* Auto-enable headset mic when plugged */ +snd_hda_jack_set_gating_jack (codec,0x19 ,0x21 ); + +/* Headset mic volume enhancement */ +snd_hda_codec_set_pin_target (codec,0x19 ,PIN_VREF50 ); +break ; +case HDA_FIXUP_ACT_INIT : +alc_process_coef_fw (codec, coefs); +break ; +case HDA_FIXUP_ACT_BUILD : +rename_ctl (codec,"Bass Speaker Playback Volume" , +"B&O-Tuned Playback Volume" ); +rename_ctl (codec,"Front Playback Switch" , +"B&O Soundbar Playback Switch" ); +rename_ctl (codec,"Bass Speaker Playback Switch" , +"Side Speaker Playback Switch" ); +break ; + } +} +/* for hda_fixup_thinkpad_acpi() */ #include "thinkpad_helper.c"
@@ -7205,6 +7259,7 @@ enum {ALC280_FIXUP_HP_9480M ,ALC245_FIXUP_HP_X360_AMP ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 , +ALC285_FIXUP_HP_ENVY_X360 ,ALC288_FIXUP_DELL_HEADSET_MODE ,ALC288_FIXUP_DELL1_MIC_NO_PRESENCE , ALC288_FIXUP_DELL_XPS_13,
@@ -9179,6 +9234,12 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_eb1 }, + [ALC285_FIXUP_HP_ENVY_X360] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_envy_x360, + .chained = true, + .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT, + }, [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_ideapad_s740_coef,
@@ -9753,6 +9814,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8519 ,"HP Spectre x360 15-df0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360 ),SND_PCI_QUIRK (0x103c ,0x8537 ,"HP ProBook 440 G6" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x85de ,"HP Envy x360 13-ar0xxx" ,ALC285_FIXUP_HP_ENVY_X360 ),SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x861f ,"HP Elite Dragonfly G1" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
@@ -10430,6 +10492,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, + {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"}, {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"}, {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 499/638 ALSA: hda/tas2781: use dev_dbg in system_resume
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit c850c9121cc8de867ce3ac36b9ae9d05f62bef14 ]
The system_resume function uses dev_info for tracing, but the other pm functions use dev_dbg.
Use dev_dbg as the other pm functions.
Message-ID: <140f3c689c9eb5874e6eb48a570fcd8207f06a41.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/tas2781_hda_i2c.c +1 -1
@@ -813,7 +813,7 @@ static int tas2781_system_resume(struct device *dev) tas_hda->priv->ndev *TASDEVICE_SPEAKER_CALIBRATION_SIZE ;int i, ret; -dev_info (tas_hda->priv->dev,"System Resume\n" ); +dev_dbg (tas_hda->priv->dev,"System Resume\n" ); ret =pm_runtime_force_resume (dev);if (ret)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 500/638 ALSA: hda/tas2781: add lock to system_suspend
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit c58e6ed55a1bb9811d6d936d001b068bb0419467 ]
Add the missing lock around tasdevice_tuning_switch().
Message-ID: <c666da13d4bc48cd1ab1357479e0c6096541372c.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/tas2781_hda_i2c.c +4 -0
@@ -796,9 +796,13 @@ static int tas2781_system_suspend(struct device *dev)if (ret)return ret; +mutex_lock (&tas_hda->priv->codec_lock); +/* Shutdown chip before system suspend */ tasdevice_tuning_switch (tas_hda->priv,1 ); +mutex_unlock (&tas_hda->priv->codec_lock); +/* * Reset GPIO may be shared, so cannot reset here. * However beyond this point, amps may be powered down.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 501/638 ALSA: hda/tas2781: do not reset cur_* values in runtime_suspend
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit bec7760a6c5fa59593dac264fa0c628e46815986 ]
The amplifier doesn't loose register state in software shutdown mode, so there is no need to reset the cur_* values.
Without these resets, the amplifier can be turned on after runtime_suspend without waiting for the program and profile to be restored.
Message-ID: <aa27ae084150988bf6a0ead7e3403bc485d790f8.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 7 ------- 1 file changed, 7 deletions(-)
sound/pci/hda/tas2781_hda_i2c.c +0 -7
@@ -740,7 +740,6 @@ static void tas2781_hda_i2c_remove(struct i2c_client *clt)static int tas2781_runtime_suspend (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -int i;dev_dbg (tas_hda->dev,"Runtime Suspend\n" );
@@ -751,12 +750,6 @@ static int tas2781_runtime_suspend(struct device *dev) tas_hda->priv->playback_started = false; } -for (i =0 ; i < tas_hda->priv->ndev; i++) { - tas_hda->priv->tasdevice[i].cur_book =-1 ; - tas_hda->priv->tasdevice[i].cur_prog =-1 ; - tas_hda->priv->tasdevice[i].cur_conf =-1 ; - } -mutex_unlock (&tas_hda->priv->codec_lock);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 502/638 ALSA: hda/tas2781: add ptrs to calibration functions
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit 76f5f55c45b906710c9565a7e68c8d782c46b394 ]
Make calibration functions configurable to support different calibration data storage modes.
Stable-dep-of: 5f51de7e30c7 ("ALSA: hda/tas2781: do not call pm_runtime_force_* in system_resume/suspend")
--- include/sound/tas2781.h | 5 +++++ sound/pci/hda/tas2781_hda_i2c.c | 25 +++++++++++-------------- sound/soc/codecs/tas2781-comlib.c | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 14 deletions(-)
include/sound/tas2781.h +5 -0
@@ -131,6 +131,9 @@ struct tasdevice_priv { const struct firmware *fmw, int offset);int (*tasdevice_load_block)(struct tasdevice_priv *tas_priv,struct tasdev_blk *block); + +int (*save_calibration)(struct tasdevice_priv *tas_priv); +void (*apply_calibration)(struct tasdevice_priv *tas_priv); };void tas2781_reset (struct tasdevice_priv *tas_dev);
@@ -140,6 +143,8 @@ int tascodec_init(struct tasdevice_priv *tas_priv, void *codec,struct tasdevice_priv *tasdevice_kzalloc (struct i2c_client *i2c);int tasdevice_init (struct tasdevice_priv *tas_priv);void tasdevice_remove (struct tasdevice_priv *tas_priv); +int tasdevice_save_calibration (struct tasdevice_priv *tas_priv); +void tasdevice_apply_calibration (struct tasdevice_priv *tas_priv);int tasdevice_dev_read (struct tasdevice_priv *tas_priv,unsigned short chn,unsigned int reg,unsigned int *value); int tasdevice_dev_write(struct tasdevice_priv *tas_priv,
sound/pci/hda/tas2781_hda_i2c.c +11 -14
@@ -479,7 +479,7 @@ static int tas2781_save_calibration(struct tasdevice_priv *tas_priv)dev_dbg (tas_priv->dev,"%4ld-%2d-%2d, %2d:%2d:%2d\n" , tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); -tas2781_apply_calib (tas_priv); +tasdevice_apply_calibration (tas_priv); }else tas_priv->cali_data.total_sz =0 ;
@@ -582,7 +582,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)/* If calibrated data occurs error, dsp will still works with default * calibrated data inside algo. */ -tas2781_save_calibration (tas_priv); +tasdevice_save_calibration (tas_priv); out:mutex_unlock (&tas_hda->priv->codec_lock);
@@ -683,10 +683,6 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)const char *device_name;int ret; -if (strstr (dev_name (&clt->dev),"TIAS2781" )) - device_name ="TIAS2781" ; -else -return -ENODEV ; tas_hda =devm_kzalloc (&clt->dev,sizeof (*tas_hda),GFP_KERNEL );if (!tas_hda)
@@ -699,6 +695,13 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt)if (!tas_hda->priv)return -ENOMEM ; +if (strstr (dev_name (&clt->dev),"TIAS2781" )) { + device_name ="TIAS2781" ; + tas_hda->priv->save_calibration = tas2781_save_calibration; + tas_hda->priv->apply_calibration = tas2781_apply_calib; + }else +return -ENODEV ; + tas_hda->priv->irq_info.irq = clt->irq; ret =tas2781_read_acpi (tas_hda->priv, device_name);if (ret)
@@ -758,8 +761,6 @@ static int tas2781_runtime_suspend(struct device *dev)static int tas2781_runtime_resume (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -unsigned long calib_data_sz = - tas_hda->priv->ndev *TASDEVICE_SPEAKER_CALIBRATION_SIZE ;dev_dbg (tas_hda->dev,"Runtime Resume\n" );
@@ -770,8 +771,7 @@ static int tas2781_runtime_resume(struct device *dev)/* If calibrated data occurs error, dsp will still works with default * calibrated data inside algo. */ -if (tas_hda->priv->cali_data.total_sz > calib_data_sz) -tas2781_apply_calib (tas_hda->priv); +tasdevice_apply_calibration (tas_hda->priv);mutex_unlock (&tas_hda->priv->codec_lock);
@@ -806,8 +806,6 @@ static int tas2781_system_suspend(struct device *dev)static int tas2781_system_resume (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -unsigned long calib_data_sz = - tas_hda->priv->ndev *TASDEVICE_SPEAKER_CALIBRATION_SIZE ;int i, ret;dev_dbg (tas_hda->priv->dev,"System Resume\n" );
@@ -829,8 +827,7 @@ static int tas2781_system_resume(struct device *dev)/* If calibrated data occurs error, dsp will still work with default * calibrated data inside algo. */ -if (tas_hda->priv->cali_data.total_sz > calib_data_sz) -tas2781_apply_calib (tas_hda->priv); +tasdevice_apply_calibration (tas_hda->priv);mutex_unlock (&tas_hda->priv->codec_lock);return 0 ;
sound/soc/codecs/tas2781-comlib.c +15 -0
@@ -413,6 +413,21 @@ void tasdevice_remove(struct tasdevice_priv *tas_priv) }EXPORT_SYMBOL_GPL (tasdevice_remove); +int tasdevice_save_calibration (struct tasdevice_priv *tas_priv) +{ +if (tas_priv->save_calibration) +return tas_priv->save_calibration (tas_priv); +return -EINVAL ; +} +EXPORT_SYMBOL_GPL (tasdevice_save_calibration); + +void tasdevice_apply_calibration (struct tasdevice_priv *tas_priv) +{ +if (tas_priv->apply_calibration && tas_priv->cali_data.total_sz) + tas_priv->apply_calibration (tas_priv); +} +EXPORT_SYMBOL_GPL (tasdevice_apply_calibration); +static int tasdevice_clamp (int val,int max,unsigned int invert) {if (val > max)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 503/638 ALSA: hda/tas2781: do not call pm_runtime_force_* in system_resume/suspend
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit 5f51de7e30c7282162a631af8a425b54a4576346 ]
The runtime_resume function calls prmg_load and apply_calibration functions, but system_resume also calls them, so calling pm_runtime_force_resume before reset is unnecessary.
For consistency, do not call the pm_runtime_force_suspend in system_suspend, as runtime_suspend does the same.
Message-ID: <d0b4cc1248b9d375d59c009563da42d60d69eac3.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
sound/pci/hda/tas2781_hda_i2c.c +1 -10
@@ -781,14 +781,9 @@ static int tas2781_runtime_resume(struct device *dev)static int tas2781_system_suspend (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -int ret;dev_dbg (tas_hda->priv->dev,"System Suspend\n" ); - ret =pm_runtime_force_suspend (dev); -if (ret) -return ret; -mutex_lock (&tas_hda->priv->codec_lock);/* Shutdown chip before system suspend */
@@ -806,14 +801,10 @@ static int tas2781_system_suspend(struct device *dev)static int tas2781_system_resume (struct device *dev) {struct tas2781_hda *tas_hda =dev_get_drvdata (dev); -int i, ret; +int i;dev_dbg (tas_hda->priv->dev,"System Resume\n" ); - ret =pm_runtime_force_resume (dev); -if (ret) -return ret; -mutex_lock (&tas_hda->priv->codec_lock);for (i =0 ; i < tas_hda->priv->ndev; i++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 504/638 ALSA: hda/tas2781: configure the amp after firmware load
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit 68f7f3ff6c2a0998be9dc07622bd0d16fd1fda20 ]
Make the amp available immediately after a module load to avoid having to wait for a PCM hook action. (eg. unloading & loading the module while listening music)
Stable-dep-of: 9fc91a6fe37c ("ALSA: hda/tas2781: restore power state after system_resume")
--- sound/pci/hda/tas2781_hda_i2c.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/tas2781_hda_i2c.c +2 -0
@@ -584,6 +584,8 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)*/ tasdevice_save_calibration (tas_priv); +tasdevice_tuning_switch (tas_hda->priv,0 ); + out:mutex_unlock (&tas_hda->priv->codec_lock);if (fmw)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 505/638 ALSA: hda/tas2781: restore power state after system_resume
In reply to Sasha LevinFrom: Gergo Koteles <[email protected]>
[ Upstream commit 9fc91a6fe37c78ef301aed4251f7e50b8524e72d ]
After system_resume the amplifers will remain off, even if they were on before system_suspend.
Use playback_started bool to save the playback state, and restore power state based on it.
Message-ID: <1742b61901781826f6e6212ffe1d21af542d134a.1709918447.git.soyer@irl.hu>
--- sound/pci/hda/tas2781_hda_i2c.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
sound/pci/hda/tas2781_hda_i2c.c +12 -1
@@ -142,11 +142,13 @@ static void tas2781_hda_playback_hook(struct device *dev, int action)pm_runtime_get_sync (dev);mutex_lock (&tas_hda->priv->codec_lock);tasdevice_tuning_switch (tas_hda->priv,0 ); + tas_hda->priv->playback_started = true;mutex_unlock (&tas_hda->priv->codec_lock);break ;case HDA_GEN_PCM_ACT_CLOSE :mutex_lock (&tas_hda->priv->codec_lock);tasdevice_tuning_switch (tas_hda->priv,1 ); + tas_hda->priv->playback_started = false;mutex_unlock (&tas_hda->priv->codec_lock);pm_runtime_mark_last_busy (dev);
@@ -585,6 +587,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)tasdevice_save_calibration (tas_priv);tasdevice_tuning_switch (tas_hda->priv,0 ); + tas_hda->priv->playback_started = true; out:mutex_unlock (&tas_hda->priv->codec_lock);
@@ -750,6 +753,9 @@ static int tas2781_runtime_suspend(struct device *dev)mutex_lock (&tas_hda->priv->codec_lock); +/* The driver powers up the amplifiers at module load time. +* Stop the playback if it's unused. +*/ if (tas_hda->priv->playback_started) {tasdevice_tuning_switch (tas_hda->priv,1 ); tas_hda->priv->playback_started = false;
@@ -789,7 +795,8 @@ static int tas2781_system_suspend(struct device *dev)mutex_lock (&tas_hda->priv->codec_lock);/* Shutdown chip before system suspend */ -tasdevice_tuning_switch (tas_hda->priv,1 ); +if (tas_hda->priv->playback_started) +tasdevice_tuning_switch (tas_hda->priv,1 );mutex_unlock (&tas_hda->priv->codec_lock);
@@ -821,6 +828,10 @@ static int tas2781_system_resume(struct device *dev)* calibrated data inside algo. */ tasdevice_apply_calibration (tas_hda->priv); + +if (tas_hda->priv->playback_started) +tasdevice_tuning_switch (tas_hda->priv,0 ); +mutex_unlock (&tas_hda->priv->codec_lock);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 506/638 ALSA: usb-audio: Stop parsing channels bits when all channels are found.
In reply to Sasha LevinFrom: Johan Carlsson <[email protected]>
[ Upstream commit a39d51ff1f52cd0b6fe7d379ac93bd8b4237d1b7 ]
If a usb audio device sets more bits than the amount of channels it could write outside of the map array.
Message-ID: <[email protected]>
--- sound/usb/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/usb/stream.c +4 -1
@@ -300,9 +300,12 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, c =0 ;if (bits) { -for (; bits && *maps; maps++, bits >>=1 ) +for (; bits && *maps; maps++, bits >>=1 ) {if (bits &1 ) chmap->map[c++] = *maps; +if (c == chmap->channels) +break ; + } }else {/* If we're missing wChannelConfig, then guess something to make sure the channel map is not skipped entirely */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 507/638 RDMA/irdma: Remove duplicate assignment
In reply to Sasha LevinFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 926e8ea4b8dac84f6d14a4b60d0653f1f2ba9431 ]
Remove the unneeded assignment of the qp_num which is already set in irdma_create_qp().
--- drivers/infiniband/hw/irdma/verbs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +1 -2
@@ -719,7 +719,6 @@ static int irdma_setup_kmode_qp(struct irdma_device *iwdev, info->rq_pa + (ukinfo->rq_depth *IRDMA_QP_WQE_MIN_SIZE ); ukinfo->sq_size = ukinfo->sq_depth >> ukinfo->sq_shift; ukinfo->rq_size = ukinfo->rq_depth >> ukinfo->rq_shift; - ukinfo->qp_id = iwqp->ibqp.qp_num; iwqp->max_send_wr = (ukinfo->sq_depth -IRDMA_SQ_RSVD ) >> ukinfo->sq_shift; iwqp->max_recv_wr = (ukinfo->rq_depth -IRDMA_RQ_RSVD ) >> ukinfo->rq_shift;
@@ -944,7 +943,7 @@ static int irdma_create_qp(struct ib_qp *ibqp, iwqp->host_ctx.size =IRDMA_QP_CTX_SIZE ; init_info.pd = &iwpd->sc_pd; - init_info.qp_uk_init_info.qp_id = iwqp->ibqp.qp_num; + init_info.qp_uk_init_info.qp_id = qp_num;if (!rdma_protocol_roce (&iwdev->ibdev,1 )) init_info.qp_uk_init_info.first_sq_wq =1 ; iwqp->ctx_info.qp_compl_ctx = (uintptr_t )qp;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 508/638 RDMA/srpt: Do not register event handler until srpt device is fully setup
In reply to Sasha LevinFrom: William Kucharski <[email protected]>
[ Upstream commit c21a8870c98611e8f892511825c9607f1e2cd456 ]
Upon rare occasions, KASAN reports a use-after-free Write in srpt_refresh_port().
This seems to be because an event handler is registered before the srpt device is fully setup and a race condition upon error may leave a partially setup event handler in place.
Instead, only register the event handler after srpt device initialization is complete.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -2
@@ -3209,7 +3209,6 @@ static int srpt_add_one(struct ib_device *device)INIT_IB_EVENT_HANDLER (&sdev->event_handler, sdev->device, srpt_event_handler); -ib_register_event_handler (&sdev->event_handler);for (i =1 ; i <= sdev->device->phys_port_cnt; i++) { sport = &sdev->port[i -1 ];
@@ -3232,6 +3231,7 @@ static int srpt_add_one(struct ib_device *device) } } +ib_register_event_handler (&sdev->event_handler);spin_lock (&srpt_dev_lock);list_add_tail (&sdev->list, &srpt_dev_list);spin_unlock (&srpt_dev_lock);
@@ -3242,7 +3242,6 @@ static int srpt_add_one(struct ib_device *device) err_port:srpt_unregister_mad_agent (sdev, i); -ib_unregister_event_handler (&sdev->event_handler); err_cm:if (sdev->cm_id)ib_destroy_cm_id (sdev->cm_id);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 509/638 f2fs: compress: fix to guarantee persisting compressed blocks by CP
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 8a430dd49e9cb021372b0ad91e60aeef9c6ced00 ]
If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint.
--- fs/f2fs/compress.c | 4 +++- fs/f2fs/data.c | 17 +++++++++-------- fs/f2fs/f2fs.h | 4 +++- 3 files changed, 15 insertions(+), 10 deletions(-)
fs/f2fs/compress.c +3 -1
@@ -1413,6 +1413,8 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page)struct f2fs_sb_info *sbi = bio->bi_private;struct compress_io_ctx *cic = (struct compress_io_ctx *)page_private (page); +enum count_type type =WB_DATA_TYPE (page, +f2fs_is_compressed_page (page));int i;if (unlikely (bio->bi_status))
@@ -1420,7 +1422,7 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page)f2fs_compress_free_page (page); -dec_page_count (sbi,F2FS_WB_DATA ); +dec_page_count (sbi, type);if (atomic_dec_return (&cic->pending_pages))return ;
fs/f2fs/data.c +9 -8
@@ -48,7 +48,7 @@ void f2fs_destroy_bioset(void)bioset_exit (&f2fs_bioset); } -static bool __is_cp_guaranteed (struct page *page) +bool f2fs_is_cp_guaranteed (struct page *page) {struct address_space *mapping = page->mapping;struct inode *inode;
@@ -65,8 +65,6 @@ static bool __is_cp_guaranteed(struct page *page) S_ISDIR(inode->i_mode))return true; -if (f2fs_is_compressed_page (page)) -return false;if ((S_ISREG (inode->i_mode) &&IS_NOQUOTA (inode)) ||page_private_gcing (page))return true;
@@ -338,7 +336,7 @@ static void f2fs_write_end_io(struct bio *bio)bio_for_each_segment_all (bvec, bio, iter_all) {struct page *page = bvec->bv_page; -enum count_type type =WB_DATA_TYPE (page); +enum count_type type =WB_DATA_TYPE (page, false);if (page_private_dummy (page)) {clear_page_private_dummy (page);
@@ -762,7 +760,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)wbc_account_cgroup_owner (fio->io_wbc, fio->page,PAGE_SIZE );inc_page_count (fio->sbi,is_read_io (fio->op) ? -__read_io_type (page) :WB_DATA_TYPE (fio->page)); +__read_io_type (page) :WB_DATA_TYPE (fio->page, false));if (is_read_io (bio_op (bio)))f2fs_submit_read_bio (fio->sbi, bio, fio->type);
@@ -973,7 +971,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)if (fio->io_wbc)wbc_account_cgroup_owner (fio->io_wbc, fio->page,PAGE_SIZE ); -inc_page_count (fio->sbi,WB_DATA_TYPE (page)); +inc_page_count (fio->sbi,WB_DATA_TYPE (page, false)); *fio->last_block = fio->new_blkaddr; *fio->bio = bio;
@@ -1007,6 +1005,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)enum page_type btype =PAGE_TYPE_OF_BIO (fio->type);struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp;struct page *bio_page; +enum count_type type;f2fs_bug_on (sbi,is_read_io (fio->op));
@@ -1046,7 +1045,8 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)/* set submitted = true as a return value */ fio->submitted =1 ; -inc_page_count (sbi,WB_DATA_TYPE (bio_page)); + type =WB_DATA_TYPE (bio_page, fio->compressed_page); +inc_page_count (sbi, type); if (io->bio && (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio,
@@ -1059,7 +1059,8 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)if (F2FS_IO_ALIGNED (sbi) && (fio->type ==DATA || fio->type ==NODE ) && fio->new_blkaddr &F2FS_IO_SIZE_MASK (sbi)) { -dec_page_count (sbi,WB_DATA_TYPE (bio_page)); +dec_page_count (sbi,WB_DATA_TYPE (bio_page, + fio->compressed_page)); fio->retry =1 ; goto skip; }
fs/f2fs/f2fs.h +3 -1
@@ -1075,7 +1075,8 @@ struct f2fs_sm_info {* f2fs monitors the number of several block types such as on-writeback, * dirty dentry blocks, dirty node blocks, and dirty meta blocks. */ -#define WB_DATA_TYPE (p) (__is_cp_guaranteed(p) ? F2FS_WB_CP_DATA : F2FS_WB_DATA) +#define WB_DATA_TYPE (p, f) \ + (f || f2fs_is_cp_guaranteed(p) ? F2FS_WB_CP_DATA : F2FS_WB_DATA)enum count_type {F2FS_DIRTY_DENTS ,F2FS_DIRTY_DATA ,
@@ -3794,6 +3795,7 @@ void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi);*/ int __init f2fs_init_bioset (void );void f2fs_destroy_bioset (void ); +bool f2fs_is_cp_guaranteed (struct page *page);int f2fs_init_bio_entry_cache (void );void f2fs_destroy_bio_entry_cache (void ); void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 510/638 f2fs: compress: fix to cover normal cluster write with cp_rwsem
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit fd244524c2cf07b5f4c3fe8abd6a99225c76544b ]
When we overwrite compressed cluster w/ normal cluster, we should not unlock cp_rwsem during f2fs_write_raw_pages(), otherwise data will be corrupted if partial blocks were persisted before CP & SPOR, due to cluster metadata wasn't updated atomically.
--- fs/f2fs/compress.c | 27 ++++++++++++++++++--------- fs/f2fs/data.c | 3 ++- 2 files changed, 20 insertions(+), 10 deletions(-)
fs/f2fs/compress.c +18 -9
@@ -1438,12 +1438,14 @@ void f2fs_compress_write_end_io(struct bio *bio, struct page *page) }static int f2fs_write_raw_pages (struct compress_ctx *cc, -int *submitted, +int *submitted_p,struct writeback_control *wbc,enum iostat_type io_type) {struct address_space *mapping = cc->inode->i_mapping; -int _submitted, compr_blocks, ret, i; +struct f2fs_sb_info *sbi =F2FS_M_SB (mapping); +int submitted, compr_blocks, i; +int ret =0 ; compr_blocks =f2fs_compressed_blocks (cc);
@@ -1458,6 +1460,10 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,if (compr_blocks <0 )return compr_blocks; +/* overwrite compressed cluster w/ normal cluster */ +if (compr_blocks >0 ) +f2fs_lock_op (sbi); +for (i =0 ; i < cc->cluster_size; i++) {if (!cc->rpages[i])continue ;
@@ -1482,7 +1488,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,if (!clear_page_dirty_for_io (cc->rpages[i])) goto continue_unlock; - ret =f2fs_write_single_data_page (cc->rpages[i], &_submitted, + ret =f2fs_write_single_data_page (cc->rpages[i], &submitted,NULL ,NULL , wbc, io_type, compr_blocks, false);if (ret) {
@@ -1490,26 +1496,29 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,unlock_page (cc->rpages[i]); ret =0 ; }else if (ret == -EAGAIN ) { + ret =0 ;/* * for quota file, just redirty left pages to * avoid deadlock caused by cluster update race * from foreground operation. */ if (IS_NOQUOTA (cc->inode)) -return 0 ; - ret =0 ; + goto out;f2fs_io_schedule_timeout (DEFAULT_IO_TIMEOUT ); goto retry_write; } -return ret; + goto out; } - *submitted += _submitted; + *submitted_p += submitted; } -f2fs_balance_fs (F2FS_M_SB (mapping), true); +out: +if (compr_blocks >0 ) +f2fs_unlock_op (sbi); -return 0 ; +f2fs_balance_fs (sbi, true); +return ret; } int f2fs_write_multi_pages(struct compress_ctx *cc,
fs/f2fs/data.c +2 -1
@@ -2848,7 +2848,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, .encrypted_page = NULL, .submitted = 0, .compr_blocks = compr_blocks, - .need_lock = LOCK_RETRY, + .need_lock = compr_blocks ? LOCK_DONE : LOCK_RETRY, .post_read = f2fs_post_read_required(inode) ? 1 : 0, .io_type = io_type, .io_wbc = wbc,
@@ -2932,6 +2932,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,if (err == -EAGAIN ) { err =f2fs_do_write_data_page (&fio);if (err == -EAGAIN ) { +f2fs_bug_on (sbi, compr_blocks); fio.need_lock =LOCK_REQ ; err =f2fs_do_write_data_page (&fio); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 511/638 f2fs: compress: fix to check unreleased compressed cluster
In reply to Sasha LevinFrom: Sheng Yong <[email protected]>
[ Upstream commit eb8fbaa53374e0a2d4381190abfe708481517bbb ]
Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks().
--- fs/f2fs/file.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/f2fs/file.c +12 -1
@@ -3631,7 +3631,13 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) goto next; } -if (__is_valid_data_blkaddr (blkaddr)) { +/* +* compressed cluster was not released due to it +* fails in release_compress_blocks(), so NEW_ADDR +* is a possible case. +*/ +if (blkaddr ==NEW_ADDR || +__is_valid_data_blkaddr (blkaddr)) { compr_blocks++;continue ; }
@@ -3641,6 +3647,11 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) } reserved = cluster_size - compr_blocks; + +/* for the case all blocks in cluster were reserved */ +if (reserved ==1 ) + goto next; + ret =inc_valid_block_count (sbi, dn->inode, &reserved);if (ret)return ret;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 512/638 f2fs: delete obsolete FI_FIRST_BLOCK_WRITTEN
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit a53936361330e4c55c0654605178281387d9c761 ]
Commit 3c6c2bebef79 ("f2fs: avoid punch_hole overhead when releasing volatile data") introduced FI_FIRST_BLOCK_WRITTEN as below reason:
This patch is to avoid some punch_hole overhead when releasing volatile data. If volatile data was not written yet, we just can make the first page as zero.
After commit 7bc155fec5b3 ("f2fs: kill volatile write support"), we won't support volatile write, but it missed to remove obsolete FI_FIRST_BLOCK_WRITTEN, delete it in this patch.
Stable-dep-of: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode")
--- fs/f2fs/compress.c | 2 -- fs/f2fs/data.c | 2 -- fs/f2fs/f2fs.h | 6 ------ fs/f2fs/file.c | 3 --- fs/f2fs/gc.c | 2 -- fs/f2fs/inode.c | 25 ------------------------- 6 files changed, 40 deletions(-)
fs/f2fs/compress.c +0 -2
@@ -1364,8 +1364,6 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,add_compr_block_stat (inode, cc->valid_nr_cpages);set_inode_flag (cc->inode,FI_APPEND_WRITE ); -if (cc->cluster_idx ==0 ) -set_inode_flag (inode,FI_FIRST_BLOCK_WRITTEN );f2fs_put_dnode (&dn);if (quota_inode)
fs/f2fs/data.c +0 -2
@@ -2809,8 +2809,6 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)f2fs_outplace_write_data (&dn, fio);trace_f2fs_do_write_data_page (page,OPU );set_inode_flag (inode,FI_APPEND_WRITE ); -if (page->index ==0 ) -set_inode_flag (inode,FI_FIRST_BLOCK_WRITTEN ); out_writepage:f2fs_put_dnode (&dn); out:
fs/f2fs/f2fs.h +0 -6
@@ -774,7 +774,6 @@ enum {FI_UPDATE_WRITE ,/* inode has in-place-update data */ FI_NEED_IPU ,/* used for ipu per file */ FI_ATOMIC_FILE ,/* indicate atomic file */ -FI_FIRST_BLOCK_WRITTEN ,/* indicate #0 data block was written */ FI_DROP_CACHE ,/* drop dirty page cache */ FI_DATA_EXIST ,/* indicate data exists */ FI_INLINE_DOTS, /* indicate inline dot dentries */
@@ -3272,11 +3271,6 @@ static inline bool f2fs_is_cow_file(struct inode *inode)return is_inode_flag_set (inode,FI_COW_FILE ); } -static inline bool f2fs_is_first_block_written (struct inode *inode) -{ -return is_inode_flag_set (inode,FI_FIRST_BLOCK_WRITTEN ); -} -static inline bool f2fs_is_drop_cache (struct inode *inode) {return is_inode_flag_set (inode,FI_DROP_CACHE );
fs/f2fs/file.c +0 -3
@@ -599,9 +599,6 @@ void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count) valid_blocks++; } -if (dn->ofs_in_node ==0 &&IS_INODE (dn->node_page)) -clear_inode_flag (dn->inode,FI_FIRST_BLOCK_WRITTEN ); -f2fs_invalidate_blocks (sbi, blkaddr);if (!released || blkaddr !=COMPRESS_ADDR )
fs/f2fs/gc.c +0 -2
@@ -1405,8 +1405,6 @@ static int move_data_block(struct inode *inode, block_t bidx,f2fs_update_data_blkaddr (&dn, newaddr);set_inode_flag (inode,FI_APPEND_WRITE ); -if (page->index ==0 ) -set_inode_flag (inode,FI_FIRST_BLOCK_WRITTEN ); put_page_out:f2fs_put_page (fio.encrypted_page,1 ); recover_block:
fs/f2fs/inode.c +0 -25
@@ -76,20 +76,6 @@ static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri) } } -static int __written_first_block (struct f2fs_sb_info *sbi, -struct f2fs_inode *ri) -{ -block_t addr =le32_to_cpu (ri->i_addr[offset_in_addr (ri)]); - -if (!__is_valid_data_blkaddr (addr)) -return 1 ; -if (!f2fs_is_valid_blkaddr (sbi, addr,DATA_GENERIC_ENHANCE )) { -f2fs_handle_error (sbi,ERROR_INVALID_BLKADDR ); -return -EFSCORRUPTED ; - } -return 0 ; -} -static void __set_inode_rdev (struct inode *inode,struct f2fs_inode *ri) {int extra_size =get_extra_isize (inode);
@@ -398,7 +384,6 @@ static int do_read_inode(struct inode *inode)struct page *node_page;struct f2fs_inode *ri;projid_t i_projid; -int err;/* Check if ino is within scope */ if (f2fs_check_nid_range (sbi, inode->i_ino))
@@ -480,16 +465,6 @@ static int do_read_inode(struct inode *inode)/* get rdev by using inline_info */ __get_inode_rdev (inode, ri); -if (S_ISREG (inode->i_mode)) { - err =__written_first_block (sbi, ri); -if (err <0 ) { -f2fs_put_page (node_page,1 ); -return err; - } -if (!err) -set_inode_flag (inode,FI_FIRST_BLOCK_WRITTEN ); - } -if (!f2fs_need_inode_block_update (sbi, inode->i_ino)) fi->last_disk_size = inode->i_size;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 513/638 f2fs: delete obsolete FI_DROP_CACHE
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit bb6e1c8fa5b9b95bbb8e39b6105f8f6550e070fc ]
FI_DROP_CACHE was introduced in commit 1e84371ffeef ("f2fs: change atomic and volatile write policies") for volatile write feature, after commit 7bc155fec5b3 ("f2fs: kill volatile write support"), we won't support volatile write, let's delete related codes.
Stable-dep-of: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode")
--- fs/f2fs/data.c | 3 --- fs/f2fs/f2fs.h | 6 ------ 2 files changed, 9 deletions(-)
fs/f2fs/data.c +0 -3
@@ -2891,9 +2891,6 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,zero_user_segment (page, offset,PAGE_SIZE ); write: -if (f2fs_is_drop_cache (inode)) - goto out; -/* Dentry/quota blocks are controlled by checkpoint */ if (S_ISDIR (inode->i_mode) || quota_inode) {/*
fs/f2fs/f2fs.h +0 -6
@@ -774,7 +774,6 @@ enum {FI_UPDATE_WRITE ,/* inode has in-place-update data */ FI_NEED_IPU ,/* used for ipu per file */ FI_ATOMIC_FILE ,/* indicate atomic file */ -FI_DROP_CACHE ,/* drop dirty page cache */ FI_DATA_EXIST ,/* indicate data exists */ FI_INLINE_DOTS ,/* indicate inline dot dentries */ FI_SKIP_WRITES, /* should skip data page writeback */
@@ -3271,11 +3270,6 @@ static inline bool f2fs_is_cow_file(struct inode *inode)return is_inode_flag_set (inode,FI_COW_FILE ); } -static inline bool f2fs_is_drop_cache (struct inode *inode) -{ -return is_inode_flag_set (inode,FI_DROP_CACHE ); -} -static inline void *inline_data_addr (struct inode *inode,struct page *page) {struct f2fs_inode *ri =F2FS_INODE (page);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 514/638 f2fs: introduce get_dnode_addr() to clean up codes
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 2020cd48e41cb8470bb1ca0835033d13d3178425 ]
Just cleanup, no logic changes.
Stable-dep-of: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode")
--- fs/f2fs/data.c | 11 ++--------- fs/f2fs/f2fs.h | 18 +++++++++++++++--- fs/f2fs/file.c | 8 +------- fs/f2fs/inode.c | 32 ++++++++++++++------------------ 4 files changed, 32 insertions(+), 37 deletions(-)
fs/f2fs/data.c +2 -9
@@ -1182,16 +1182,9 @@ static int f2fs_submit_page_read(struct inode *inode, struct page *page,static void __set_data_blkaddr (struct dnode_of_data *dn) { -struct f2fs_node *rn =F2FS_NODE (dn->node_page); -__le32 *addr_array; -int base =0 ; +__le32 *addr =get_dnode_addr (dn->inode, dn->node_page); -if (IS_INODE (dn->node_page) &&f2fs_has_extra_attr (dn->inode)) - base =get_extra_isize (dn->inode); - -/* Get physical address of data block */ - addr_array =blkaddr_in_node (rn); - addr_array[base + dn->ofs_in_node] =cpu_to_le32 (dn->data_blkaddr); + addr[dn->ofs_in_node] =cpu_to_le32 (dn->data_blkaddr); }/*
fs/f2fs/f2fs.h +15 -3
@@ -3270,12 +3270,13 @@ static inline bool f2fs_is_cow_file(struct inode *inode)return is_inode_flag_set (inode,FI_COW_FILE ); } +static inline __le32 *get_dnode_addr (struct inode *inode, +struct page *node_page);static inline void *inline_data_addr (struct inode *inode,struct page *page) { -struct f2fs_inode *ri =F2FS_INODE (page); -int extra_size =get_extra_isize (inode); +__le32 *addr =get_dnode_addr (inode, page); -return (void *)&(ri->i_addr[extra_size +DEF_INLINE_RESERVED_SIZE ]); +return (void *)(addr +DEF_INLINE_RESERVED_SIZE ); }static inline int f2fs_has_inline_dentry (struct inode *inode)
@@ -3418,6 +3419,17 @@ static inline int get_inline_xattr_addrs(struct inode *inode)return F2FS_I (inode)->i_inline_xattr_size; } +static inline __le32 *get_dnode_addr (struct inode *inode, +struct page *node_page) +{ +int base =0 ; + +if (IS_INODE (node_page) &&f2fs_has_extra_attr (inode)) + base =get_extra_isize (inode); + +return blkaddr_in_node (F2FS_NODE (node_page)) + base; +} +#define f2fs_get_inode_mode (i) \ ((is_inode_flag_set(i, FI_ACL_MODE)) ? \ (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
fs/f2fs/file.c +1 -7
@@ -557,20 +557,14 @@ static int f2fs_file_open(struct inode *inode, struct file *filp)void f2fs_truncate_data_blocks_range (struct dnode_of_data *dn,int count) {struct f2fs_sb_info *sbi =F2FS_I_SB (dn->inode); -struct f2fs_node *raw_node;int nr_free =0 , ofs = dn->ofs_in_node, len = count;__le32 *addr; -int base =0 ;bool compressed_cluster = false;int cluster_index =0 , valid_blocks =0 ;int cluster_size =F2FS_I (dn->inode)->i_cluster_size;bool released = !atomic_read (&F2FS_I (dn->inode)->i_compr_blocks); -if (IS_INODE (dn->node_page) &&f2fs_has_extra_attr (dn->inode)) - base =get_extra_isize (dn->inode); - - raw_node =F2FS_NODE (dn->node_page); - addr =blkaddr_in_node (raw_node) + base + ofs; + addr =get_dnode_addr (dn->inode, dn->node_page) + ofs;/* Assumption: truncation starts with cluster */ for (; count >0 ; count--, addr++, dn->ofs_in_node++, cluster_index++) {
fs/f2fs/inode.c +14 -18
@@ -61,35 +61,31 @@ void f2fs_set_inode_flags(struct inode *inode) S_ENCRYPTED|S_VERITY|S_CASEFOLD); } -static void __get_inode_rdev (struct inode *inode,struct f2fs_inode *ri) +static void __get_inode_rdev (struct inode *inode,struct page *node_page) { -int extra_size =get_extra_isize (inode); +__le32 *addr =get_dnode_addr (inode, node_page);if (S_ISCHR (inode->i_mode) ||S_ISBLK (inode->i_mode) ||S_ISFIFO (inode->i_mode) ||S_ISSOCK (inode->i_mode)) { -if (ri->i_addr[extra_size]) - inode->i_rdev =old_decode_dev ( -le32_to_cpu (ri->i_addr[extra_size])); +if (addr[0 ]) + inode->i_rdev =old_decode_dev (le32_to_cpu (addr[0 ]));else - inode->i_rdev =new_decode_dev ( -le32_to_cpu (ri->i_addr[extra_size +1 ])); + inode->i_rdev =new_decode_dev (le32_to_cpu (addr[1 ])); } } -static void __set_inode_rdev (struct inode *inode,struct f2fs_inode *ri) +static void __set_inode_rdev (struct inode *inode,struct page *node_page) { -int extra_size =get_extra_isize (inode); +__le32 *addr =get_dnode_addr (inode, node_page);if (S_ISCHR (inode->i_mode) ||S_ISBLK (inode->i_mode)) {if (old_valid_dev (inode->i_rdev)) { - ri->i_addr[extra_size] = -cpu_to_le32 (old_encode_dev (inode->i_rdev)); - ri->i_addr[extra_size +1 ] =0 ; + addr[0 ] =cpu_to_le32 (old_encode_dev (inode->i_rdev)); + addr[1 ] =0 ; }else { - ri->i_addr[extra_size] =0 ; - ri->i_addr[extra_size +1 ] = -cpu_to_le32 (new_encode_dev (inode->i_rdev)); - ri->i_addr[extra_size +2 ] =0 ; + addr[0 ] =0 ; + addr[1 ] =cpu_to_le32 (new_encode_dev (inode->i_rdev)); + addr[2 ] =0 ; } } }
@@ -463,7 +459,7 @@ static int do_read_inode(struct inode *inode) }/* get rdev by using inline_info */ -__get_inode_rdev (inode, ri); +__get_inode_rdev (inode, node_page);if (!f2fs_need_inode_block_update (sbi, inode->i_ino)) fi->last_disk_size = inode->i_size;
@@ -736,7 +732,7 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page) } } -__set_inode_rdev (inode, ri); +__set_inode_rdev (inode, node_page);/* deleted inode */ if (inode->i_nlink ==0 )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 515/638 f2fs: update blkaddr in __set_data_blkaddr() for cleanup
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 59d0d4c3eae0f3dd8886ed59f89f21fa09e324f5 ]
This patch allows caller to pass blkaddr to f2fs_set_data_blkaddr() and let __set_data_blkaddr() inside f2fs_set_data_blkaddr() to update dn->data_blkaddr w/ last value of blkaddr.
Just cleanup, no logic changes.
Stable-dep-of: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode")
--- fs/f2fs/data.c | 13 ++++++------- fs/f2fs/f2fs.h | 2 +- fs/f2fs/file.c | 12 ++++-------- 3 files changed, 11 insertions(+), 16 deletions(-)
fs/f2fs/data.c +6 -7
@@ -1180,10 +1180,11 @@ static int f2fs_submit_page_read(struct inode *inode, struct page *page,return 0 ; } -static void __set_data_blkaddr (struct dnode_of_data *dn) +static void __set_data_blkaddr (struct dnode_of_data *dn,block_t blkaddr) {__le32 *addr =get_dnode_addr (dn->inode, dn->node_page); + dn->data_blkaddr = blkaddr; addr[dn->ofs_in_node] =cpu_to_le32 (dn->data_blkaddr); }
@@ -1193,18 +1194,17 @@ static void __set_data_blkaddr(struct dnode_of_data *dn)* ->node_page * update block addresses in the node page */ -void f2fs_set_data_blkaddr (struct dnode_of_data *dn) +void f2fs_set_data_blkaddr (struct dnode_of_data *dn,block_t blkaddr) {f2fs_wait_on_page_writeback (dn->node_page,NODE , true, true); -__set_data_blkaddr (dn); +__set_data_blkaddr (dn, blkaddr);if (set_page_dirty (dn->node_page)) dn->node_changed = true; }void f2fs_update_data_blkaddr (struct dnode_of_data *dn,block_t blkaddr) { - dn->data_blkaddr = blkaddr; -f2fs_set_data_blkaddr (dn); +f2fs_set_data_blkaddr (dn, blkaddr);f2fs_update_read_extent_cache (dn); }
@@ -1231,8 +1231,7 @@ int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count)block_t blkaddr =f2fs_data_blkaddr (dn);if (blkaddr ==NULL_ADDR ) { - dn->data_blkaddr =NEW_ADDR ; -__set_data_blkaddr (dn); +__set_data_blkaddr (dn,NEW_ADDR ); count--; } }
fs/f2fs/f2fs.h +1 -1
@@ -3814,7 +3814,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio);struct block_device *f2fs_target_device (struct f2fs_sb_info *sbi,block_t blk_addr,sector_t *sector);int f2fs_target_device_index (struct f2fs_sb_info *sbi,block_t blkaddr); -void f2fs_set_data_blkaddr (struct dnode_of_data *dn); +void f2fs_set_data_blkaddr (struct dnode_of_data *dn,block_t blkaddr);void f2fs_update_data_blkaddr (struct dnode_of_data *dn,block_t blkaddr);int f2fs_reserve_new_blocks (struct dnode_of_data *dn,blkcnt_t count);int f2fs_reserve_new_block (struct dnode_of_data *dn);
fs/f2fs/file.c +4 -8
@@ -582,8 +582,7 @@ void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count)if (blkaddr ==NULL_ADDR )continue ; - dn->data_blkaddr =NULL_ADDR ; -f2fs_set_data_blkaddr (dn); +f2fs_set_data_blkaddr (dn,NULL_ADDR ); if (__is_valid_data_blkaddr(blkaddr)) { if (!f2fs_is_valid_blkaddr(sbi, blkaddr,
@@ -1479,8 +1478,7 @@ static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start, }f2fs_invalidate_blocks (sbi, dn->data_blkaddr); - dn->data_blkaddr =NEW_ADDR ; -f2fs_set_data_blkaddr (dn); +f2fs_set_data_blkaddr (dn,NEW_ADDR ); }f2fs_update_read_extent_cache_range (dn, start,0 , index - start);
@@ -3460,8 +3458,7 @@ static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count)if (blkaddr !=NEW_ADDR )continue ; - dn->data_blkaddr =NULL_ADDR ; -f2fs_set_data_blkaddr (dn); +f2fs_set_data_blkaddr (dn,NULL_ADDR ); }f2fs_i_compr_blocks_update (dn->inode, compr_blocks, false);
@@ -3633,8 +3630,7 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count)continue ; } - dn->data_blkaddr =NEW_ADDR ; -f2fs_set_data_blkaddr (dn); +f2fs_set_data_blkaddr (dn,NEW_ADDR ); } reserved = cluster_size - compr_blocks;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 516/638 f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 54607494875edd636aff3c21ace3ad9a7da758a9 ]
In reserve_compress_blocks(), we update blkaddrs of dnode in prior to inc_valid_block_count(), it may cause inconsistent status bewteen i_blocks and blkaddrs once inc_valid_block_count() fails.
To fix this issue, it needs to reverse their invoking order.
--- fs/f2fs/data.c | 5 +++-- fs/f2fs/f2fs.h | 7 ++++++- fs/f2fs/file.c | 26 ++++++++++++++------------ fs/f2fs/segment.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-)
fs/f2fs/data.c +3 -2
@@ -1219,7 +1219,8 @@ int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count)if (unlikely (is_inode_flag_set (dn->inode,FI_NO_ALLOC )))return -EPERM ; -if (unlikely ((err =inc_valid_block_count (sbi, dn->inode, &count)))) + err =inc_valid_block_count (sbi, dn->inode, &count, true); +if (unlikely (err))return err; trace_f2fs_reserve_new_blocks(dn->inode, dn->nid,
@@ -1476,7 +1477,7 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type) dn->data_blkaddr =f2fs_data_blkaddr (dn);if (dn->data_blkaddr ==NULL_ADDR ) { - err =inc_valid_block_count (sbi, dn->inode, &count); + err =inc_valid_block_count (sbi, dn->inode, &count, true);if (unlikely (err))return err; }
fs/f2fs/f2fs.h +6 -1
@@ -2244,7 +2244,7 @@ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi,static inline void f2fs_i_blocks_write (struct inode *,block_t ,bool ,bool );static inline int inc_valid_block_count (struct f2fs_sb_info *sbi, -struct inode *inode,blkcnt_t *count) +struct inode *inode,blkcnt_t *count,bool partial) {blkcnt_t diff =0 , release =0 ;block_t avail_user_block_count;
@@ -2284,6 +2284,11 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, avail_user_block_count =0 ; }if (unlikely (sbi->total_valid_block_count > avail_user_block_count)) { +if (!partial) { +spin_unlock (&sbi->stat_lock); + goto enospc; + } + diff = sbi->total_valid_block_count - avail_user_block_count;if (diff > *count) diff = *count;
fs/f2fs/file.c +14 -12
@@ -3609,14 +3609,16 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count)blkcnt_t reserved;int ret; -for (i =0 ; i < cluster_size; i++, dn->ofs_in_node++) { - blkaddr =f2fs_data_blkaddr (dn); +for (i =0 ; i < cluster_size; i++) { + blkaddr =data_blkaddr (dn->inode, dn->node_page, + dn->ofs_in_node + i);if (i ==0 ) { -if (blkaddr ==COMPRESS_ADDR ) -continue ; - dn->ofs_in_node += cluster_size; - goto next; +if (blkaddr !=COMPRESS_ADDR ) { + dn->ofs_in_node += cluster_size; + goto next; + } +continue ; }/*
@@ -3629,8 +3631,6 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) compr_blocks++;continue ; } - -f2fs_set_data_blkaddr (dn,NEW_ADDR ); } reserved = cluster_size - compr_blocks;
@@ -3639,12 +3639,14 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count)if (reserved ==1 ) goto next; - ret =inc_valid_block_count (sbi, dn->inode, &reserved); -if (ret) + ret =inc_valid_block_count (sbi, dn->inode, &reserved, false); +if (unlikely (ret))return ret; -if (reserved != cluster_size - compr_blocks) -return -ENOSPC ; +for (i =0 ; i < cluster_size; i++, dn->ofs_in_node++) { +if (f2fs_data_blkaddr (dn) ==NULL_ADDR ) +f2fs_set_data_blkaddr (dn,NEW_ADDR ); + }f2fs_i_compr_blocks_update (dn->inode, compr_blocks, true);
fs/f2fs/segment.c +1 -1
@@ -248,7 +248,7 @@ static int __replace_atomic_write_block(struct inode *inode, pgoff_t index, }else {blkcnt_t count =1 ; - err =inc_valid_block_count (sbi, inode, &count); + err =inc_valid_block_count (sbi, inode, &count, true);if (err) {f2fs_put_dnode (&dn);return err;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 517/638 f2fs: fix to remove unnecessary f2fs_bug_on() to avoid panic
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit b896e302f79678451a94769ddd9e52e954c64fbb ]
verify_blkaddr() will trigger panic once we inject fault into f2fs_is_valid_blkaddr(), fix to remove this unnecessary f2fs_bug_on().
--- fs/f2fs/f2fs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/f2fs/f2fs.h +1 -3
@@ -3460,11 +3460,9 @@ bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,static inline void verify_blkaddr (struct f2fs_sb_info *sbi,block_t blkaddr,int type) { -if (!f2fs_is_valid_blkaddr (sbi, blkaddr, type)) { +if (!f2fs_is_valid_blkaddr (sbi, blkaddr, type))f2fs_err (sbi,"invalid blkaddr: %u, type: %d, run fsck to fix." , blkaddr, type); -f2fs_bug_on (sbi,1 ); - } }static inline bool __is_valid_data_blkaddr (block_t blkaddr)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 518/638 f2fs: zone: fix to wait completion of last bio in zone correctly
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 536af8211586af09c5bea1c15ad28ddec5f66a97 ]
It needs to check last zone_pending_bio and wait IO completion before traverse next fio in io->io_list, otherwise, bio in next zone may be submitted before all IO completion in current zone.
--- fs/f2fs/data.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/f2fs/data.c +1 -2
@@ -1010,7 +1010,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)f2fs_bug_on (sbi,is_read_io (fio->op));f2fs_down_write (&io->io_rwsem); - +next:#ifdef CONFIG_BLK_DEV_ZONED if (f2fs_sb_has_blkzoned (sbi) && btype <META && io->zone_pending_bio) {wait_for_completion_io (&io->zone_wait);
@@ -1020,7 +1020,6 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) }#endif -next:if (fio->in_list) {spin_lock (&io->io_lock);if (list_empty (&io->io_list)) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 519/638 f2fs: fix NULL pointer dereference in f2fs_submit_page_write()
In reply to Sasha LevinFrom: Wenjie Qi <[email protected]>
[ Upstream commit c2034ef6192a65a986a45c2aa2ed05824fdc0e9f ]
BUG: kernel NULL pointer dereference, address: 0000000000000014 RIP: 0010:f2fs_submit_page_write+0x6cf/0x780 [f2fs] Call Trace: <TASK> ? show_regs+0x6e/0x80 ? __die+0x29/0x70 ? page_fault_oops+0x154/0x4a0 ? prb_read_valid+0x20/0x30 ? __irq_work_queue_local+0x39/0xd0 ? irq_work_queue+0x36/0x70 ? do_user_addr_fault+0x314/0x6c0 ? exc_page_fault+0x7d/0x190 ? asm_exc_page_fault+0x2b/0x30 ? f2fs_submit_page_write+0x6cf/0x780 [f2fs] ? f2fs_submit_page_write+0x736/0x780 [f2fs] do_write_page+0x50/0x170 [f2fs] f2fs_outplace_write_data+0x61/0xb0 [f2fs] f2fs_do_write_data_page+0x3f8/0x660 [f2fs] f2fs_write_single_data_page+0x5bb/0x7a0 [f2fs] f2fs_write_cache_pages+0x3da/0xbe0 [f2fs]
...
It is possible that other threads have added this fio to io->bio and submitted the io->bio before entering f2fs_submit_page_write(). At this point io->bio = NULL.
If is_end_zone_blkaddr(sbi, fio->new_blkaddr) of this fio is true, then an NULL pointer dereference error occurs at bio_get(io->bio). The original code for determining zone end was after "out:", which would have missed some fio who is zone end. I've moved
this code before "skip:" to make sure it's done for each fio.
--- fs/f2fs/data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/f2fs/data.c +4 -4
@@ -1080,10 +1080,6 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) io->last_block_in_bio = fio->new_blkaddr;trace_f2fs_submit_page_write (fio->page, fio); -skip: -if (fio->in_list) - goto next; -out:#ifdef CONFIG_BLK_DEV_ZONED if (f2fs_sb_has_blkzoned (sbi) && btype <META &&is_end_zone_blkaddr (sbi, fio->new_blkaddr)) {
@@ -1096,6 +1092,10 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) __submit_merged_bio(io); }#endif +skip: +if (fio->in_list) + goto next; +out:if (is_sbi_flag_set (sbi,SBI_IS_SHUTDOWN ) || !f2fs_is_checkpoint_ready (sbi))__submit_merged_bio (io);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 520/638 f2fs: compress: fix to cover f2fs_disable_compressed_file() w/ i_sem
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 2f9420d3a94aeebd92db88f00f4f2f1a3bd3f6cf ]
- f2fs_disable_compressed_file
- check inode_has_data
- f2fs_file_mmap
- mkwrite
- f2fs_get_block_locked : update metadata in compressed inode's disk layout
- fi->i_flags &= ~F2FS_COMPR_FL
- clear_inode_flag(inode, FI_COMPRESSED_FILE);
we should use i_sem lock to prevent above race case.
--- fs/f2fs/f2fs.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/f2fs/f2fs.h +11 -2
@@ -4396,15 +4396,24 @@ static inline bool f2fs_disable_compressed_file(struct inode *inode) {struct f2fs_inode_info *fi =F2FS_I (inode); -if (!f2fs_compressed_file (inode)) +f2fs_down_write (&F2FS_I (inode)->i_sem); + +if (!f2fs_compressed_file (inode)) { +f2fs_up_write (&F2FS_I (inode)->i_sem);return true; -if (S_ISREG (inode->i_mode) &&F2FS_HAS_BLOCKS (inode)) + } +if (f2fs_is_mmap_file (inode) || + (S_ISREG (inode->i_mode) &&F2FS_HAS_BLOCKS (inode))) { +f2fs_up_write (&F2FS_I (inode)->i_sem);return false; + } fi->i_flags &= ~F2FS_COMPR_FL ;stat_dec_compr_inode (inode);clear_inode_flag (inode,FI_COMPRESSED_FILE );f2fs_mark_inode_dirty_sync (inode, true); + +f2fs_up_write (&F2FS_I (inode)->i_sem);return true; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 521/638 f2fs: fix to avoid potential panic during recovery
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 21ec68234826b1b54ab980a8df6e33c74cfbee58 ]
During recovery, if FAULT_BLOCK is on, it is possible that f2fs_reserve_new_block() will return -ENOSPC during recovery, then it may trigger panic.
Also, if fault injection rate is 1 and only FAULT_BLOCK fault type is on, it may encounter deadloop in loop of block reservation.
Let's change as below to fix these issues:
- remove bug_on() to avoid panic.
- limit the loop count of block reservation to avoid potential deadloop.
--- fs/f2fs/f2fs.h | 5 +++++ fs/f2fs/recovery.c | 33 ++++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-)
fs/f2fs/f2fs.h +5 -0
@@ -75,6 +75,11 @@ struct f2fs_fault_info {extern const char *f2fs_fault_name[FAULT_MAX ];#define IS_FAULT_SET (fi, type) ((fi)->inject_type & BIT(type)) + +/* maximum retry count for injected failure */ +#define DEFAULT_FAILURE_RETRY_COUNT 8 +#else +#define DEFAULT_FAILURE_RETRY_COUNT 1#endif /*
fs/f2fs/recovery.c +16 -17
@@ -611,6 +611,19 @@ static int check_index_in_prev_nodes(struct f2fs_sb_info *sbi,return 0 ; } +static int f2fs_reserve_new_block_retry (struct dnode_of_data *dn) +{ +int i, err =0 ; + +for (i =DEFAULT_FAILURE_RETRY_COUNT ; i >0 ; i--) { + err =f2fs_reserve_new_block (dn); +if (!err) +break ; + } + +return err; +} +static int do_recover_data (struct f2fs_sb_info *sbi,struct inode *inode,struct page *page) {
@@ -712,14 +725,8 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,*/ if (dest ==NEW_ADDR ) {f2fs_truncate_data_blocks_range (&dn,1 ); -do { - err =f2fs_reserve_new_block (&dn); -if (err == -ENOSPC ) { -f2fs_bug_on (sbi,1 ); -break ; - } - }while (err && -IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )); + + err =f2fs_reserve_new_block_retry (&dn);if (err) goto err;continue ;
@@ -727,16 +734,8 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,/* dest is valid block, try to recover from src to dest */ if (f2fs_is_valid_blkaddr (sbi, dest,META_POR )) { -if (src ==NULL_ADDR ) { -do { - err =f2fs_reserve_new_block (&dn); -if (err == -ENOSPC ) { -f2fs_bug_on (sbi,1 ); -break ; - } - }while (err && -IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )); + err =f2fs_reserve_new_block_retry (&dn);if (err) goto err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 522/638 scsi: csiostor: Avoid function pointer casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9f3dbcb5632d6876226031d552ef6163bb3ad215 ]
csiostor uses function pointer casts to keep the csio_ln_ev state machine hidden, but this causes warnings about control flow integrity (KCFI) violations in clang-16 and higher:
drivers/scsi/csiostor/csio_lnode.c:1098:33: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1098 | return (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1369:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1369 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_uninit)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1373:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1373 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1377:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1377 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_offline)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Move the enum into a shared header so the correct types can be used without the need for casts.
--- drivers/scsi/csiostor/csio_defs.h | 18 ++++++++++++++++-- drivers/scsi/csiostor/csio_lnode.c | 8 ++++---- drivers/scsi/csiostor/csio_lnode.h | 13 ------------- 3 files changed, 20 insertions(+), 19 deletions(-)
drivers/scsi/csiostor/csio_defs.h +16 -2
@@ -73,7 +73,21 @@ csio_list_deleted(struct list_head *list)#define csio_list_prev (elem) (((struct list_head *)(elem))->prev)/* State machine */ -typedef void (*csio_sm_state_t )(void *,uint32_t ); +struct csio_lnode ; + +/* State machine evets */ +enum csio_ln_ev { +CSIO_LNE_NONE = (uint32_t )0 , +CSIO_LNE_LINKUP , +CSIO_LNE_FAB_INIT_DONE , +CSIO_LNE_LINK_DOWN , +CSIO_LNE_DOWN_LINK , +CSIO_LNE_LOGO , +CSIO_LNE_CLOSE , +CSIO_LNE_MAX_EVENT , +}; + +typedef void (*csio_sm_state_t )(struct csio_lnode *ln,enum csio_ln_ev evt);struct csio_sm {struct list_head sm_list;
@@ -83,7 +97,7 @@ struct csio_sm {static inline void csio_set_state (void *smp,void *state) { - ((struct csio_sm *)smp)->sm_state = (csio_sm_state_t )state; + ((struct csio_sm *)smp)->sm_state = state; } static inline void
drivers/scsi/csiostor/csio_lnode.c +4 -4
@@ -1095,7 +1095,7 @@ csio_handle_link_down(struct csio_hw *hw, uint8_t portid, uint32_t fcfi,int csio_is_lnode_ready (struct csio_lnode *ln) { -return (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_ready)); +return (csio_get_state (ln) == csio_lns_ready); }/*****************************************************************************/
@@ -1366,15 +1366,15 @@ csio_free_fcfinfo(struct kref *kref)void csio_lnode_state_to_str (struct csio_lnode *ln,int8_t *str) { -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_uninit)) { +if (csio_get_state (ln) == csio_lns_uninit) {strcpy (str,"UNINIT" );return ; } -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_ready)) { +if (csio_get_state (ln) == csio_lns_ready) {strcpy (str,"READY" );return ; } -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_offline)) { +if (csio_get_state (ln) == csio_lns_offline) {strcpy (str,"OFFLINE" );return ; }
drivers/scsi/csiostor/csio_lnode.h +0 -13
@@ -53,19 +53,6 @@extern int csio_fcoe_rnodes;extern int csio_fdmi_enable; -/* State machine evets */ -enum csio_ln_ev { -CSIO_LNE_NONE = (uint32_t )0 , -CSIO_LNE_LINKUP , -CSIO_LNE_FAB_INIT_DONE , -CSIO_LNE_LINK_DOWN , -CSIO_LNE_DOWN_LINK , -CSIO_LNE_LOGO , -CSIO_LNE_CLOSE , -CSIO_LNE_MAX_EVENT , -}; - -struct csio_fcf_info {struct list_head list;uint8_t priority;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 523/638 i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling
In reply to Sasha LevinFrom: Dylan Hung <[email protected]>
[ Upstream commit 10201396ef6455a68ac671fa0163205d327ebb70 ]
Disable IBI IRQ signal and status only when hot-join and SIR enabling of all target devices attached to the bus are disabled.
--- drivers/i3c/master/dw-i3c-master.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i3c/master/dw-i3c-master.c +3 -1
@@ -1163,8 +1163,10 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master, global = reg ==0xffffffff ; reg &= ~BIT (idx); }else { - global = reg ==0 ; +bool hj_rejected = !!(readl (master->regs +DEVICE_CTRL ) &DEV_CTRL_HOT_JOIN_NACK ); + reg |=BIT (idx); + global = (reg ==0xffffffff ) && hj_rejected; }writel (reg, master->regs +IBI_SIR_REQ_REJECT );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 524/638 RDMA/hns: Fix mis-modifying default congestion control algorithm
In reply to Sasha LevinFrom: Luoyouming <[email protected]>
[ Upstream commit d20a7cf9f714f0763efb56f0f2eeca1cb91315ed ]
Commit 27c5fd271d8b ("RDMA/hns: The UD mode can only be configured with DCQCN") adds a check of congest control alorithm for UD. But that patch causes a problem: hr_dev->caps.congest_type is global, used by all QPs, so modifying this field to DCQCN for UD QPs causes other QPs unable to use any other algorithm except DCQCN.
Revert the modification in commit 27c5fd271d8b ("RDMA/hns: The UD mode can only be configured with DCQCN"). Add a new field cong_type to struct hns_roce_qp and configure DCQCN for UD QPs.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 17 +++++++++-------- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 16 ++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +9 -8
@@ -581,6 +581,13 @@ struct hns_roce_work {u32 queue_num; }; +enum hns_roce_cong_type { +CONG_TYPE_DCQCN , +CONG_TYPE_LDCP , +CONG_TYPE_HC3 , +CONG_TYPE_DIP , +}; +struct hns_roce_qp {struct ib_qp ibqp;struct hns_roce_wq rq;
@@ -624,6 +631,7 @@ struct hns_roce_qp {struct list_head sq_node;/* all send qps are on a list */ struct hns_user_mmap_entry *dwqe_mmap_entry;u32 config; +enum hns_roce_cong_type cong_type; };struct hns_roce_ib_iboe {
@@ -695,13 +703,6 @@ struct hns_roce_eq_table {struct hns_roce_eq *eq; }; -enum cong_type { -CONG_TYPE_DCQCN , -CONG_TYPE_LDCP , -CONG_TYPE_HC3 , -CONG_TYPE_DIP , -}; -struct hns_roce_caps {u64 fw_ver;u8 num_ports;
@@ -831,7 +832,7 @@ struct hns_roce_caps {u16 default_aeq_period;u16 default_aeq_arm_st;u16 default_ceq_arm_st; -enum cong_type cong_type; +enum hns_roce_cong_type cong_type; };enum hns_roce_device_state {
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +10 -6
@@ -4728,12 +4728,15 @@ static int check_cong_type(struct ib_qp *ibqp, struct hns_roce_congestion_algorithm *cong_alg) {struct hns_roce_dev *hr_dev =to_hr_dev (ibqp->device); +struct hns_roce_qp *hr_qp =to_hr_qp (ibqp); -if (ibqp->qp_type ==IB_QPT_UD ) - hr_dev->caps.cong_type =CONG_TYPE_DCQCN ; +if (ibqp->qp_type ==IB_QPT_UD || ibqp->qp_type ==IB_QPT_GSI ) + hr_qp->cong_type =CONG_TYPE_DCQCN ; +else + hr_qp->cong_type = hr_dev->caps.cong_type;/* different congestion types match different configurations */ -switch (hr_dev->caps.cong_type) { +switch (hr_qp->cong_type) {case CONG_TYPE_DCQCN : cong_alg->alg_sel =CONG_DCQCN ; cong_alg->alg_sub_sel =UNSUPPORT_CONG_LEVEL ;
@@ -4761,8 +4764,8 @@ static int check_cong_type(struct ib_qp *ibqp,default :ibdev_warn (&hr_dev->ib_dev,"invalid type(%u) for congestion selection.\n" , - hr_dev->caps.cong_type); - hr_dev->caps.cong_type =CONG_TYPE_DCQCN ; + hr_qp->cong_type); + hr_qp->cong_type =CONG_TYPE_DCQCN ; cong_alg->alg_sel =CONG_DCQCN ; cong_alg->alg_sub_sel =UNSUPPORT_CONG_LEVEL ; cong_alg->dip_vld =DIP_INVALID ;
@@ -4781,6 +4784,7 @@ static int fill_cong_field(struct ib_qp *ibqp, const struct ib_qp_attr *attr,struct hns_roce_congestion_algorithm cong_field;struct ib_device *ibdev = ibqp->device;struct hns_roce_dev *hr_dev =to_hr_dev (ibdev); +struct hns_roce_qp *hr_qp =to_hr_qp (ibqp);u32 dip_idx =0 ;int ret;
@@ -4793,7 +4797,7 @@ static int fill_cong_field(struct ib_qp *ibqp, const struct ib_qp_attr *attr,return ret;hr_reg_write (context,QPC_CONG_ALGO_TMPL_ID , hr_dev->cong_algo_tmpl_id + - hr_dev->caps.cong_type *HNS_ROCE_CONG_SIZE ); + hr_qp->cong_type *HNS_ROCE_CONG_SIZE );hr_reg_clear (qpc_mask,QPC_CONG_ALGO_TMPL_ID );hr_reg_write (&context->ext,QPCEX_CONG_ALG_SEL , cong_field.alg_sel);hr_reg_clear (&qpc_mask->ext,QPCEX_CONG_ALG_SEL );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 525/638 RDMA/device: Fix a race between mad_client and cm_client init
In reply to Sasha LevinFrom: Shifeng Li <[email protected]>
[ Upstream commit 7a8bccd8b29c321ac181369b42b04fecf05f98e2 ]
The mad_client will be initialized in enable_device_and_get(), while the devices_rwsem will be downgraded to a read semaphore. There is a window that leads to the failed initialization for cm_client, since it can not get matched mad port from ib_mad_port_list, and the matched mad port will be added to the list after that.
mad_client | cm_client ------------------|-------------------------------------------------------- ib_register_device|
enable_device_and_getdown_write(&devices_rwsem)xa_set_mark(&devices, DEVICE_REGISTERED)downgrade_write(&devices_rwsem)
|
|ib_cm_init
|ib_register_client(&cm_client)
|down_read(&devices_rwsem)
|xa_for_each_marked (&devices, DEVICE_REGISTERED)
|add_client_context
|cm_add_one
|ib_register_mad_agent
|ib_get_mad_port
|__ib_get_mad_port
|list_for_each_entry(entry, &ib_mad_port_list, port_list)
|return NULL
|up_read(&devices_rwsem)
|
add_client_context|
ib_mad_init_device|
ib_mad_port_open |
list_add_tail(&port_priv->port_list, &ib_mad_port_list)
up_read(&devices_rwsem)
|Fix it by using down_write(&devices_rwsem) in ib_register_client().
--- drivers/infiniband/core/device.c | 37 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-)
drivers/infiniband/core/device.c +22 -15
@@ -1730,7 +1730,7 @@ static int assign_client_id(struct ib_client *client) {int ret; -down_write (&clients_rwsem); +lockdep_assert_held (&clients_rwsem);/* * The add/remove callbacks must be called in FIFO/LIFO order. To * achieve this we assign client_ids so they are sorted in
@@ -1739,14 +1739,11 @@ static int assign_client_id(struct ib_client *client) client->client_id = highest_client_id; ret =xa_insert (&clients, client->client_id, client,GFP_KERNEL );if (ret) - goto out; +return ret; highest_client_id++;xa_set_mark (&clients, client->client_id,CLIENT_REGISTERED ); - -out: -up_write (&clients_rwsem); -return ret; +return 0 ; }static void remove_client_id (struct ib_client *client)
@@ -1776,25 +1773,35 @@ int ib_register_client(struct ib_client *client) {struct ib_device *device;unsigned long index; +bool need_unreg = false;int ret;refcount_set (&client->uses,1 );init_completion (&client->uses_zero); + +/* +* The devices_rwsem is held in write mode to ensure that a racing +* ib_register_device() sees a consisent view of clients and devices. +*/ +down_write (&devices_rwsem); +down_write (&clients_rwsem); ret =assign_client_id (client);if (ret) -return ret; + goto out; -down_read (&devices_rwsem); + need_unreg = true; xa_for_each_marked (&devices, index, device, DEVICE_REGISTERED) { ret =add_client_context (device, client); -if (ret) { -up_read (&devices_rwsem); -ib_unregister_client (client); -return ret; - } +if (ret) + goto out; } -up_read (&devices_rwsem); -return 0 ; + ret =0 ; +out: +up_write (&clients_rwsem); +up_write (&devices_rwsem); +if (need_unreg && ret) +ib_unregister_client (client); +return ret; }EXPORT_SYMBOL (ib_register_client);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 526/638 RDMA/rtrs-clt: Check strnlen return len in sysfs mpath_policy_store()
In reply to Sasha LevinFrom: Alexey Kodanev <[email protected]>
[ Upstream commit 7a7b7f575a25aa68ee934ee8107294487efcb3fe ]
strnlen() may return 0 (e.g. for "\0\n" string), it's better to check the result of strnlen() before using 'len - 1' expression for the 'buf' array index.
Detected using the static analysis tool - Svace.
--- drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c +1 -1
@@ -133,7 +133,7 @@ static ssize_t mpath_policy_store(struct device *dev,/* distinguish "mi" and "min-latency" with length */ len =strnlen (buf,NAME_MAX ); -if (buf[len -1 ] =='\n' ) +if (len && buf[len -1 ] =='\n' ) len--; if (!strncasecmp(buf, "round-robin", 11) ||
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 527/638 scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit b69600231f751304db914c63b937f7098ed2895c ]
Some callback functions used here take a boolean argument, others take a status argument. This breaks KCFI type checking, so clang now warns about the function pointer cast:
drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enum bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Assuming the code is actually correct here and the callers always match the argument types of the callee, rework this to replace the explicit cast with a union of the two pointer types. This does not change the behavior of the code, so if something is actually broken here, a larger rework may be necessary.
--- drivers/scsi/bfa/bfa.h | 9 ++++++++- drivers/scsi/bfa/bfa_core.c | 4 +--- drivers/scsi/bfa/bfa_ioc.h | 8 ++++++-- drivers/scsi/bfa/bfad_bsg.c | 11 ++++------- 4 files changed, 19 insertions(+), 13 deletions(-)
drivers/scsi/bfa/bfa.h +8 -1
@@ -20,7 +20,6 @@struct bfa_s ;typedef void (*bfa_isr_func_t ) (struct bfa_s *bfa,struct bfi_msg_s *m); -typedef void (*bfa_cb_cbfn_status_t ) (void *cbarg,bfa_status_t status);/* * Interrupt message handlers
@@ -437,4 +436,12 @@ struct bfa_cb_pending_q_s { (__qe)->data = (__data); \ } while (0) +#define bfa_pending_q_init_status (__qe, __cbfn, __cbarg, __data) do { \ + bfa_q_qe_init(&((__qe)->hcb_qe.qe)); \ + (__qe)->hcb_qe.cbfn_status = (__cbfn); \ + (__qe)->hcb_qe.cbarg = (__cbarg); \ + (__qe)->hcb_qe.pre_rmv = BFA_TRUE; \ + (__qe)->data = (__data); \ +} while (0) +#endif /* __BFA_H__ */
drivers/scsi/bfa/bfa_core.c +1 -3
@@ -1907,15 +1907,13 @@ bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q)struct list_head *qe;struct list_head *qen;struct bfa_cb_qe_s *hcb_qe; -bfa_cb_cbfn_status_t cbfn;list_for_each_safe (qe, qen, comp_q) { hcb_qe = (struct bfa_cb_qe_s *) qe;if (hcb_qe->pre_rmv) {/* qe is invalid after return, dequeue before cbfn() */ list_del (qe); - cbfn = (bfa_cb_cbfn_status_t)(hcb_qe->cbfn); -cbfn (hcb_qe->cbarg, hcb_qe->fw_status); + hcb_qe->cbfn_status (hcb_qe->cbarg, hcb_qe->fw_status); }else hcb_qe->cbfn (hcb_qe->cbarg,BFA_TRUE ); }
drivers/scsi/bfa/bfa_ioc.h +6 -2
@@ -361,14 +361,18 @@ struct bfa_reqq_wait_s {void *cbarg; }; -typedef void (*bfa_cb_cbfn_t ) (void *cbarg,bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_t ) (void *cbarg,bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_status_t ) (void *cbarg,bfa_status_t status);/* * Generic BFA callback element. */ struct bfa_cb_qe_s {struct list_head qe; -bfa_cb_cbfn_t cbfn; +union { +bfa_cb_cbfn_status_t cbfn_status; +bfa_cb_cbfn_t cbfn; + };bfa_boolean_t once;bfa_boolean_t pre_rmv;/* set for stack based qe(s) */ bfa_status_t fw_status;/* to access fw status in comp proc */
drivers/scsi/bfa/bfad_bsg.c +4 -7
@@ -2135,8 +2135,7 @@ bfad_iocmd_fcport_get_stats(struct bfad_s *bfad, void *cmd)struct bfa_cb_pending_q_s cb_qe;init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp, &iocmd->stats); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats);spin_lock_irqsave (&bfad->bfad_lock, flags); iocmd->status =bfa_fcport_get_stats (&bfad->bfa, &cb_qe);spin_unlock_irqrestore (&bfad->bfad_lock, flags);
@@ -2159,7 +2158,7 @@ bfad_iocmd_fcport_reset_stats(struct bfad_s *bfad, void *cmd)struct bfa_cb_pending_q_s cb_qe;init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, &fcomp,NULL ); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp,NULL );spin_lock_irqsave (&bfad->bfad_lock, flags); iocmd->status =bfa_fcport_clear_stats (&bfad->bfa, &cb_qe);
@@ -2443,8 +2442,7 @@ bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *cmd)struct bfa_fcport_s *fcport =BFA_FCPORT_MOD (&bfad->bfa);init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp, &iocmd->stats); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats);spin_lock_irqsave (&bfad->bfad_lock, flags);WARN_ON (!bfa_ioc_get_fcmode (&bfad->bfa.ioc));
@@ -2474,8 +2472,7 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd)struct bfa_fcport_s *fcport =BFA_FCPORT_MOD (&bfad->bfa);init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp,NULL ); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp,NULL );spin_lock_irqsave (&bfad->bfad_lock, flags);WARN_ON (!bfa_ioc_get_fcmode (&bfad->bfa.ioc));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 528/638 f2fs: fix to create selinux label during whiteout initialization
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 40b2d55e045222dd6de2a54a299f682e0f954b03 ]
#generic/700 - output mismatch (see /media/fstests/results//generic/700.out.bad)
# --- tests/generic/700.out 2023-03-28 10:40:42.735529223 +0000 # +++ /media/fstests/results//generic/700.out.bad 2024-02-06 04:37:56.000000000 +0000 # @@ -1,2 +1,4 @@
# QA output created by 700
# +/mnt/scratch_f2fs/f1: security.selinux: No such attribute
# +/mnt/scratch_f2fs/f2: security.selinux: No such attribute
# Silence is golden
# ...
# (Run 'diff -u /media/fstests/tests/generic/700.out /media/fstests/results//generic/700.out.bad' to see the entire diff)
HINT: You _MAY_ be missing kernel fix:
70b589a37e1a xfs: add selinux labels to whiteout inodes
Previously, it missed to create selinux labels during whiteout inode initialization, fix this issue.
--- fs/f2fs/dir.c | 5 +++-- fs/f2fs/f2fs.h | 3 ++- fs/f2fs/namei.c | 25 +++++++++++++++++-------- 3 files changed, 22 insertions(+), 11 deletions(-)
fs/f2fs/dir.c +3 -2
@@ -830,13 +830,14 @@ int f2fs_do_add_link(struct inode *dir, const struct qstr *name,return err; } -int f2fs_do_tmpfile (struct inode *inode,struct inode *dir) +int f2fs_do_tmpfile (struct inode *inode,struct inode *dir, +struct f2fs_filename *fname) {struct page *page;int err =0 ;f2fs_down_write (&F2FS_I (inode)->i_sem); - page =f2fs_init_inode_metadata (inode, dir,NULL ,NULL ); + page =f2fs_init_inode_metadata (inode, dir, fname,NULL );if (IS_ERR (page)) { err =PTR_ERR (page); goto fail;
fs/f2fs/f2fs.h +2 -1
@@ -3569,7 +3569,8 @@ int f2fs_do_add_link(struct inode *dir, const struct qstr *name, struct inode *inode, nid_t ino, umode_t mode);void f2fs_delete_entry (struct f2fs_dir_entry *dentry,struct page *page,struct inode *dir,struct inode *inode); -int f2fs_do_tmpfile (struct inode *inode,struct inode *dir); +int f2fs_do_tmpfile (struct inode *inode,struct inode *dir, +struct f2fs_filename *fname);bool f2fs_empty_dir (struct inode *dir);static inline int f2fs_add_link (struct dentry *dentry,struct inode *inode)
fs/f2fs/namei.c +17 -8
@@ -853,7 +853,7 @@ static int f2fs_mknod(struct mnt_idmap *idmap, struct inode *dir,static int __f2fs_tmpfile (struct mnt_idmap *idmap,struct inode *dir,struct file *file,umode_t mode,bool is_whiteout, -struct inode **new_inode) +struct inode **new_inode,struct f2fs_filename *fname) {struct f2fs_sb_info *sbi =F2FS_I_SB (dir);struct inode *inode;
@@ -881,7 +881,7 @@ static int __f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,if (err) goto out; - err =f2fs_do_tmpfile (inode, dir); + err =f2fs_do_tmpfile (inode, dir, fname);if (err) goto release_out;
@@ -932,22 +932,24 @@ static int f2fs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,if (!f2fs_is_checkpoint_ready (sbi))return -ENOSPC ; - err =__f2fs_tmpfile (idmap, dir, file, mode, false,NULL ); + err =__f2fs_tmpfile (idmap, dir, file, mode, false,NULL ,NULL );return finish_open_simple (file, err); }static int f2fs_create_whiteout (struct mnt_idmap *idmap, -struct inode *dir,struct inode **whiteout) +struct inode *dir,struct inode **whiteout, +struct f2fs_filename *fname) { -return __f2fs_tmpfile (idmap, dir,NULL , -S_IFCHR |WHITEOUT_MODE , true, whiteout); +return __f2fs_tmpfile (idmap, dir,NULL ,S_IFCHR |WHITEOUT_MODE , + true, whiteout, fname); }int f2fs_get_tmpfile (struct mnt_idmap *idmap,struct inode *dir,struct inode **new_inode) { -return __f2fs_tmpfile (idmap, dir,NULL ,S_IFREG , false, new_inode); +return __f2fs_tmpfile (idmap, dir,NULL ,S_IFREG , + false, new_inode,NULL ); } static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
@@ -990,7 +992,14 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir, }if (flags &RENAME_WHITEOUT ) { - err =f2fs_create_whiteout (idmap, old_dir, &whiteout); +struct f2fs_filename fname; + + err =f2fs_setup_filename (old_dir, &old_dentry->d_name, +0 , &fname); +if (err) +return err; + + err =f2fs_create_whiteout (idmap, old_dir, &whiteout, &fname);if (err)return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 529/638 f2fs: compress: fix to check zstd compress level correctly in mount option
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit e39602da752cd1d0462e3fa04074146f6f2803f6 ]
f2fs only support to config zstd compress level w/ a positive number due to layout design, but since commit e0c1b49f5b67 ("lib: zstd: Upgrade to latest upstream zstd version 1.4.10"), zstd supports negative compress level, so that zstd_min_clevel() may return a negative number, then w/ below mount option, .compress_level can be configed w/ a negative number, which is not allowed to f2fs, let's add check condition to avoid it.
mount -o compress_algorithm=zstd:4294967295 /dev/sdx /mnt/f2fs
--- fs/f2fs/super.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/f2fs/super.c +8 -2
@@ -648,7 +648,7 @@ static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str)#ifdef CONFIG_F2FS_FS_ZSTD static int f2fs_set_zstd_level (struct f2fs_sb_info *sbi,const char *str) { -unsigned int level; +int level;int len =4 ;if (strlen (str) == len) {
@@ -662,9 +662,15 @@ static int f2fs_set_zstd_level(struct f2fs_sb_info *sbi, const char *str)f2fs_info (sbi,"wrong format, e.g. <alg_name>:<compr_level>" );return -EINVAL ; } -if (kstrtouint (str +1 ,10 , &level)) +if (kstrtoint (str +1 ,10 , &level))return -EINVAL ; +/* f2fs does not support negative compress level now */ +if (level <0 ) { +f2fs_info (sbi,"do not support negative compress level: %d" , level); +return -ERANGE ; + } +if (!f2fs_is_compress_level_valid (COMPRESS_ZSTD , level)) {f2fs_info (sbi,"invalid zstd compress level: %d" , level);return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 530/638 net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d6f4de70f73a106986ee315d7d512539f2f3303a ]
The intent is to check if the strings' are truncated or not. So, >= should be used instead of >, because strlcat() and snprintf() return the length of the output, excluding the trailing NULL.
--- net/sunrpc/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/addr.c +2 -2
@@ -284,10 +284,10 @@ char *rpc_sockaddr2uaddr(const struct sockaddr *sap, gfp_t gfp_flags) }if (snprintf (portbuf,sizeof (portbuf), -".%u.%u" , port >>8 , port &0xff ) > (int )sizeof (portbuf)) +".%u.%u" , port >>8 , port &0xff ) >= (int )sizeof (portbuf))return NULL ; -if (strlcat (addrbuf, portbuf,sizeof (addrbuf)) >sizeof (addrbuf)) +if (strlcat (addrbuf, portbuf,sizeof (addrbuf)) >=sizeof (addrbuf))return NULL ;return kstrdup (addrbuf, gfp_flags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 531/638 NFSv4.2: fix nfs4_listxattr kernel BUG at mm/usercopy.c:102
In reply to Sasha LevinFrom: Jorge Mora <[email protected]>
[ Upstream commit 251a658bbfceafb4d58c76b77682c8bf7bcfad65 ]
A call to listxattr() with a buffer size = 0 returns the actual size of the buffer needed for a subsequent call. When size > 0, nfs4_listxattr() does not return an error because either generic_listxattr() or nfs4_listxattr_nfs4_label() consumes exactly all the bytes then size is 0 when calling nfs4_listxattr_nfs4_user() which then triggers the following kernel BUG:
[ 99.403778] kernel BUG at mm/usercopy.c:102! [ 99.404063] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [ 99.408463] CPU: 0 PID: 3310 Comm: python3 Not tainted 6.6.0-61.fc40.aarch64 #1 [ 99.415827] Call trace: [ 99.415985] usercopy_abort+0x70/0xa0 [ 99.416227] __check_heap_object+0x134/0x158 [ 99.416505] check_heap_object+0x150/0x188 [ 99.416696] __check_object_size.part.0+0x78/0x168 [ 99.416886] __check_object_size+0x28/0x40 [ 99.417078] listxattr+0x8c/0x120 [ 99.417252] path_listxattr+0x78/0xe0 [ 99.417476] __arm64_sys_listxattr+0x28/0x40 [ 99.417723] invoke_syscall+0x78/0x100 [ 99.417929] el0_svc_common.constprop.0+0x48/0xf0 [ 99.418186] do_el0_svc+0x24/0x38 [ 99.418376] el0_svc+0x3c/0x110 [ 99.418554] el0t_64_sync_handler+0x120/0x130 [ 99.418788] el0t_64_sync+0x194/0x198 [ 99.418994] Code: aa0003e3 d000a3e0 91310000 97f49bdb (d4210000)
Issue is reproduced when generic_listxattr() returns 'system.nfs4_acl', thus calling lisxattr() with size = 16 will trigger the bug.
Add check on nfs4_listxattr() to return ERANGE error when it is called with size > 0 and the return value is greater than size.
--- fs/nfs/nfs4proc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
fs/nfs/nfs4proc.c +10 -6
@@ -10587,29 +10587,33 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {static ssize_t nfs4_listxattr (struct dentry *dentry,char *list,size_t size) {ssize_t error, error2, error3; +size_t left = size; - error =generic_listxattr (dentry, list, size); + error =generic_listxattr (dentry, list, left);if (error <0 )return error;if (list) { list += error; - size -= error; + left -= error; } - error2 =nfs4_listxattr_nfs4_label (d_inode (dentry), list, size); + error2 =nfs4_listxattr_nfs4_label (d_inode (dentry), list, left);if (error2 <0 )return error2;if (list) { list += error2; - size -= error2; + left -= error2; } - error3 =nfs4_listxattr_nfs4_user (d_inode (dentry), list, size); + error3 =nfs4_listxattr_nfs4_user (d_inode (dentry), list, left);if (error3 <0 )return error3; -return error + error2 + error3; + error += error2 + error3; +if (size && error > size) +return -ERANGE ; +return error; }static void nfs4_enable_swap (struct inode *inode)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 532/638 NFSv4.2: fix listxattr maximum XDR buffer size
In reply to Sasha LevinFrom: Jorge Mora <[email protected]>
[ Upstream commit bcac8bff90a6ee1629f90669cdb9d28fb86049b0 ]
Switch order of operations to avoid creating a short XDR buffer:
e.g., buflen = 12, old xdrlen = 12, new xdrlen = 20.
Having a short XDR buffer leads to lxa_maxcount be a few bytes less than what is needed to retrieve the whole list when using a buflen as returned by a call with size = 0:
buflen = listxattr(path, NULL, 0);
buf = malloc(buflen);
buflen = listxattr(path, buf, buflen);For a file with one attribute (name = '123456'), the first call with size = 0 will return buflen = 12 ('user.123456\x00'). The second call with size = 12, sends LISTXATTRS with lxa_maxcount = 12 + 8 (cookie) + 4 (array count) = 24. The XDR buffer needs 8 (cookie) + 4 (array count) + 4 (name count)
+ 6 (name len) + 2 (padding) + 4 (eof) = 28 which is 4 bytes shorter than the lxa_maxcount provided in the call.
--- fs/nfs/nfs42.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfs/nfs42.h +5 -2
@@ -55,11 +55,14 @@ int nfs42_proc_removexattr(struct inode *inode, const char *name);* They would be 7 bytes long in the eventual buffer ("user.x\0"), and * 8 bytes long XDR-encoded. * -* Include the trailing eof word as well. +* Include the trailing eof word as well and make the result a multiple +* of 4 bytes. */ static inline u32 nfs42_listxattr_xdrsize (u32 buflen) { -return ((buflen / (XATTR_USER_PREFIX_LEN +2 )) *8 ) +4 ; +u32 size =8 * buflen / (XATTR_USER_PREFIX_LEN +2 ) +4 ; + +return (size +3 ) & ~3 ; }#endif /* CONFIG_NFS_V4_2 */ #endif /* __LINUX_FS_NFS_NFS4_2_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 533/638 f2fs: compress: fix to check compress flag w/ .i_sem lock
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit ea59b12ac69774c08aa95cd5b6100700ea0cce97 ]
It needs to check compress flag w/ .i_sem lock, otherwise, compressed inode may be disabled after the check condition, it's not needed to set compress option on non-compress inode.
--- fs/f2fs/file.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/f2fs/file.c +8 -4
@@ -3989,16 +3989,20 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) sizeof(option)))return -EFAULT ; -if (!f2fs_compressed_file (inode) || - option.log_cluster_size <MIN_COMPRESS_LOG_SIZE || - option.log_cluster_size >MAX_COMPRESS_LOG_SIZE || - option.algorithm >=COMPRESS_MAX ) +if (option.log_cluster_size <MIN_COMPRESS_LOG_SIZE || + option.log_cluster_size >MAX_COMPRESS_LOG_SIZE || + option.algorithm >=COMPRESS_MAX )return -EINVAL ;file_start_write (filp);inode_lock (inode);f2fs_down_write (&F2FS_I (inode)->i_sem); +if (!f2fs_compressed_file (inode)) { + ret = -EINVAL ; + goto out; + } +if (f2fs_is_mmap_file (inode) ||get_dirty_pages (inode)) { ret = -EBUSY ; goto out;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 534/638 f2fs: check number of blocks in a current section
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 7af2df0f67a1469762e59be3726a803882d83f6f ]
In cfd66bb715fd ("f2fs: fix deadloop in foreground GC"), we needed to check the number of blocks in a section instead of the segment.
--- fs/f2fs/segment.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
fs/f2fs/segment.h +8 -9
@@ -573,23 +573,22 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi, unsigned int node_blocks, unsigned int dent_blocks) { -unsigned int segno, left_blocks; + unsigned segno, left_blocks;int i; -/* check current node segment */ +/* check current node sections in the worst case. */ for (i =CURSEG_HOT_NODE ; i <=CURSEG_COLD_NODE ; i++) { segno =CURSEG_I (sbi, i)->segno; - left_blocks =f2fs_usable_blks_in_seg (sbi, segno) - -get_seg_entry (sbi, segno)->ckpt_valid_blocks; - + left_blocks =CAP_BLKS_PER_SEC (sbi) - +get_ckpt_valid_blocks (sbi, segno, true);if (node_blocks > left_blocks)return false; } -/* check current data segment */ +/* check current data section for dentry blocks. */ segno =CURSEG_I (sbi,CURSEG_HOT_DATA )->segno; - left_blocks =f2fs_usable_blks_in_seg (sbi, segno) - -get_seg_entry (sbi, segno)->ckpt_valid_blocks; + left_blocks =CAP_BLKS_PER_SEC (sbi) - +get_ckpt_valid_blocks (sbi, segno, true);if (dent_blocks > left_blocks)return false;return true;
@@ -638,7 +637,7 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi,if (free_secs > upper_secs)return false; -else if (free_secs <= lower_secs) +if (free_secs <= lower_secs)return true;return !curseg_space; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 535/638 watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counter
In reply to Sasha LevinFrom: Ji Sheng Teoh <[email protected]>
[ Upstream commit 8bc22a2f1bf0f402029087fcb53130233a544fed ]
In the probe function, pm_runtime_put_sync() will fail on platform with runtime PM disabled.
Check if runtime PM is enabled before calling pm_runtime_put_sync() to fix it.
--- drivers/watchdog/starfive-wdt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/watchdog/starfive-wdt.c +7 -2
@@ -494,8 +494,13 @@ static int starfive_wdt_probe(struct platform_device *pdev)if (ret) goto err_exit; -if (!early_enable) -pm_runtime_put_sync (&pdev->dev); +if (!early_enable) { +if (pm_runtime_enabled (&pdev->dev)) { + ret =pm_runtime_put_sync (&pdev->dev); +if (ret) + goto err_exit; + } + }return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 536/638 watchdog: stm32_iwdg: initialize default timeout
In reply to Sasha LevinFrom: Ben Wolsieffer <[email protected]>
[ Upstream commit dbd7c0088b7f44aa0b9276ed3449df075a7b5b54 ]
The driver never sets a default timeout value, therefore it is initialized to zero. When CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is enabled, the watchdog is started during probe. The kernel is supposed to automatically ping the watchdog from this point until userspace takes over, but this does not happen if the configured timeout is zero. A zero timeout causes watchdog_need_worker() to return false, so the heartbeat worker does not run and the system therefore resets soon after the driver is probed.
This patch fixes this by setting an arbitrary non-zero default timeout. The default could be read from the hardware instead, but I didn't see any reason to add this complexity.
This has been tested on an STM32F746.
--- drivers/watchdog/stm32_iwdg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/watchdog/stm32_iwdg.c +3 -0
@@ -20,6 +20,8 @@#include <linux/platform_device.h> #include <linux/watchdog.h> +#define DEFAULT_TIMEOUT 10 +/* IWDG registers */ #define IWDG_KR 0x00/* Key register */ #define IWDG_PR 0x04/* Prescaler Register */
@@ -248,6 +250,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev) wdd->parent = dev; wdd->info = &stm32_iwdg_info; wdd->ops = &stm32_iwdg_ops; + wdd->timeout =DEFAULT_TIMEOUT ; wdd->min_timeout =DIV_ROUND_UP ((RLR_MIN +1 ) *PR_MIN , wdt->rate); wdd->max_hw_heartbeat_ms = ((RLR_MAX +1 ) * wdt->data->max_prescaler *1000 ) / wdt->rate;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 537/638 f2fs: fix to use correct segment type in f2fs_allocate_data_block()
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 7324858237829733dec9c670170df2377c5ca6e2 ]
@type in f2fs_allocate_data_block() indicates log header's type, it can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later one, fix it.
--- fs/f2fs/segment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +2 -2
@@ -3490,12 +3490,12 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,locate_dirty_segment (sbi,GET_SEGNO (sbi, old_blkaddr));locate_dirty_segment (sbi,GET_SEGNO (sbi, *new_blkaddr)); -if (IS_DATASEG (type)) +if (IS_DATASEG (curseg->seg_type))atomic64_inc (&sbi->allocated_data_blocks);up_write (&sit_i->sentry_lock); -if (page &&IS_NODESEG (type)) { +if (page &&IS_NODESEG (curseg->seg_type)) {fill_node_footer_blkaddr (page,NEXT_FREE_BLKADDR (sbi, curseg));f2fs_inode_chksum_set (sbi, page);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 538/638 f2fs: ro: compress: fix to avoid caching unaligned extent
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 4b99ecd304290c4ef55666a62c89dfb2dbf0b2cd ]
Mapping info from dump.f2fs:
i_addr[0x2d] cluster flag [0xfffffffe : 4294967294] i_addr[0x2e] [0x 10428 : 66600] i_addr[0x2f] [0x 10429 : 66601] i_addr[0x30] [0x 1042a : 66602]
f2fs_io fiemap 37 1 /mnt/f2fs/disk-58390c8c.raw
Previsouly, it missed to align fofs and ofs_in_node to cluster_size, result in adding incorrect read extent cache, fix it.
Before:f2fs_update_read_extent_tree_range: dev = (253,48), ino = 5, pgofs = 37, len = 4, blkaddr = 66600, c_len = 3
After:f2fs_update_read_extent_tree_range: dev = (253,48), ino = 5, pgofs = 36, len = 4, blkaddr = 66600, c_len = 3
--- fs/f2fs/compress.c | 10 ++++++---- fs/f2fs/f2fs.h | 6 ++++-- fs/f2fs/node.c | 20 ++++++++++++++------ 3 files changed, 24 insertions(+), 12 deletions(-)
fs/f2fs/compress.c +6 -4
@@ -1810,16 +1810,18 @@ void f2fs_put_page_dic(struct page *page, bool in_task)* check whether cluster blocks are contiguous, and add extent cache entry * only if cluster blocks are logically and physically contiguous. */ -unsigned int f2fs_cluster_blocks_are_contiguous (struct dnode_of_data *dn) +unsigned int f2fs_cluster_blocks_are_contiguous (struct dnode_of_data *dn, +unsigned int ofs_in_node) { -bool compressed =f2fs_data_blkaddr (dn) ==COMPRESS_ADDR ; +bool compressed =data_blkaddr (dn->inode, dn->node_page, + ofs_in_node) ==COMPRESS_ADDR ;int i = compressed ?1 :0 ;block_t first_blkaddr =data_blkaddr (dn->inode, dn->node_page, - dn->ofs_in_node + i); + ofs_in_node + i);for (i +=1 ; i <F2FS_I (dn->inode)->i_cluster_size; i++) {block_t blkaddr =data_blkaddr (dn->inode, dn->node_page, - dn->ofs_in_node + i); + ofs_in_node + i);if (!__is_valid_data_blkaddr (blkaddr))break ;
fs/f2fs/f2fs.h +4 -2
@@ -4288,7 +4288,8 @@ struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc);void f2fs_decompress_end_io (struct decompress_io_ctx *dic,bool failed,bool in_task);void f2fs_put_page_dic (struct page *page,bool in_task); -unsigned int f2fs_cluster_blocks_are_contiguous (struct dnode_of_data *dn); +unsigned int f2fs_cluster_blocks_are_contiguous (struct dnode_of_data *dn, +unsigned int ofs_in_node);int f2fs_init_compress_ctx (struct compress_ctx *cc);void f2fs_destroy_compress_ctx (struct compress_ctx *cc,bool reuse);void f2fs_init_compress_info (struct f2fs_sb_info *sbi);
@@ -4345,7 +4346,8 @@ static inline void f2fs_put_page_dic(struct page *page, bool in_task) {WARN_ON_ONCE (1 ); } -static inline unsigned int f2fs_cluster_blocks_are_contiguous (struct dnode_of_data *dn) {return 0 ; } +static inline unsigned int f2fs_cluster_blocks_are_contiguous ( +struct dnode_of_data *dn,unsigned int ofs_in_node) {return 0 ; }static inline bool f2fs_sanity_check_cluster (struct dnode_of_data *dn) {return false; }static inline int f2fs_init_compress_inode (struct f2fs_sb_info *sbi) {return 0 ; }static inline void f2fs_destroy_compress_inode (struct f2fs_sb_info *sbi) { }
fs/f2fs/node.c +14 -6
@@ -852,21 +852,29 @@ int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)if (is_inode_flag_set (dn->inode,FI_COMPRESSED_FILE ) &&f2fs_sb_has_readonly (sbi)) { -unsigned int c_len =f2fs_cluster_blocks_are_contiguous (dn); +unsigned int cluster_size =F2FS_I (dn->inode)->i_cluster_size; +unsigned int ofs_in_node = dn->ofs_in_node; +pgoff_t fofs = index; +unsigned int c_len;block_t blkaddr; +/* should align fofs and ofs_in_node to cluster_size */ +if (fofs % cluster_size) { + fofs =round_down (fofs, cluster_size); + ofs_in_node =round_down (ofs_in_node, cluster_size); + } + + c_len =f2fs_cluster_blocks_are_contiguous (dn, ofs_in_node);if (!c_len) goto out; - blkaddr =f2fs_data_blkaddr (dn); + blkaddr =data_blkaddr (dn->inode, dn->node_page, ofs_in_node);if (blkaddr ==COMPRESS_ADDR ) blkaddr =data_blkaddr (dn->inode, dn->node_page, - dn->ofs_in_node +1 ); + ofs_in_node +1 );f2fs_update_read_extent_tree_range_compressed (dn->inode, - index, blkaddr, -F2FS_I (dn->inode)->i_cluster_size, - c_len); + fofs, blkaddr, cluster_size, c_len); } out:return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 539/638 RDMA/mana_ib: Fix bug in creation of dma regions
In reply to Sasha LevinFrom: Konstantin Taranov <[email protected]>
[ Upstream commit e02497fb654689049ba8b46f098f17d5f19e0b3c ]
Use ib_umem_dma_offset() helper to calculate correct dma offset.
--- drivers/infiniband/hw/mana/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mana/main.c +1 -1
@@ -358,7 +358,7 @@ int mana_ib_gd_create_dma_region(struct mana_ib_dev *dev, struct ib_umem *umem, sizeof(struct gdma_create_dma_region_resp)); create_req->length = umem->length; - create_req->offset_in_page = umem->address & (page_sz -1 ); + create_req->offset_in_page =ib_umem_dma_offset (umem, page_sz); create_req->gdma_page_type =order_base_2 (page_sz) -PAGE_SHIFT ; create_req->page_count = num_pages_total;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 540/638 Input: iqs7222 - add support for IQS7222D v1.1 and v1.2
In reply to Sasha LevinFrom: Jeff LaBundy <[email protected]>
[ Upstream commit 992cf65674778e22436807796b2df927de21bb75 ]
The vendor has introduced two new revisions with slightly different memory maps; update the driver to support them.
--- drivers/input/misc/iqs7222.c | 112 +++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+)
drivers/input/misc/iqs7222.c +112 -0
@@ -620,6 +620,118 @@ static const struct iqs7222_dev_desc iqs7222_devs[] = { }, }, }, + { + .prod_num = IQS7222_PROD_NUM_D, + .fw_major = 1, + .fw_minor = 2, + .touch_link = 1770, + .allow_offset = 9, + .event_offset = 10, + .comms_offset = 11, + .reg_grps = { + [IQS7222_REG_GRP_STAT] = { + .base = IQS7222_SYS_STATUS, + .num_row = 1, + .num_col = 7, + }, + [IQS7222_REG_GRP_CYCLE] = { + .base = 0x8000, + .num_row = 7, + .num_col = 2, + }, + [IQS7222_REG_GRP_GLBL] = { + .base = 0x8700, + .num_row = 1, + .num_col = 3, + }, + [IQS7222_REG_GRP_BTN] = { + .base = 0x9000, + .num_row = 14, + .num_col = 3, + }, + [IQS7222_REG_GRP_CHAN] = { + .base = 0xA000, + .num_row = 14, + .num_col = 4, + }, + [IQS7222_REG_GRP_FILT] = { + .base = 0xAE00, + .num_row = 1, + .num_col = 2, + }, + [IQS7222_REG_GRP_TPAD] = { + .base = 0xB000, + .num_row = 1, + .num_col = 24, + }, + [IQS7222_REG_GRP_GPIO] = { + .base = 0xC000, + .num_row = 3, + .num_col = 3, + }, + [IQS7222_REG_GRP_SYS] = { + .base = IQS7222_SYS_SETUP, + .num_row = 1, + .num_col = 12, + }, + }, + }, + { + .prod_num = IQS7222_PROD_NUM_D, + .fw_major = 1, + .fw_minor = 1, + .touch_link = 1774, + .allow_offset = 9, + .event_offset = 10, + .comms_offset = 11, + .reg_grps = { + [IQS7222_REG_GRP_STAT] = { + .base = IQS7222_SYS_STATUS, + .num_row = 1, + .num_col = 7, + }, + [IQS7222_REG_GRP_CYCLE] = { + .base = 0x8000, + .num_row = 7, + .num_col = 2, + }, + [IQS7222_REG_GRP_GLBL] = { + .base = 0x8700, + .num_row = 1, + .num_col = 3, + }, + [IQS7222_REG_GRP_BTN] = { + .base = 0x9000, + .num_row = 14, + .num_col = 3, + }, + [IQS7222_REG_GRP_CHAN] = { + .base = 0xA000, + .num_row = 14, + .num_col = 4, + }, + [IQS7222_REG_GRP_FILT] = { + .base = 0xAE00, + .num_row = 1, + .num_col = 2, + }, + [IQS7222_REG_GRP_TPAD] = { + .base = 0xB000, + .num_row = 1, + .num_col = 24, + }, + [IQS7222_REG_GRP_GPIO] = { + .base = 0xC000, + .num_row = 3, + .num_col = 3, + }, + [IQS7222_REG_GRP_SYS] = { + .base = IQS7222_SYS_SETUP, + .num_row = 1, + .num_col = 12, + }, + }, + }, { .prod_num = IQS7222_PROD_NUM_D, .fw_major = 0,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 541/638 NFS: Fix nfs_netfs_issue_read() xarray locking for writeback interrupt
In reply to Sasha LevinFrom: Dave Wysochanski <[email protected]>
[ Upstream commit fd5860ab6341506004219b080aea40213b299d2e ]
The loop inside nfs_netfs_issue_read() currently does not disable interrupts while iterating through pages in the xarray to submit for NFS read. This is not safe though since after taking xa_lock, another page in the mapping could be processed for writeback inside an interrupt, and deadlock can occur. The fix is simple and clean if we use xa_for_each_range(), which handles the iteration with RCU while reducing code complexity.
The problem is easily reproduced with the following test:
mount -o vers=3,fsc 127.0.0.1:/export /mnt/nfs dd if=/dev/zero of=/mnt/nfs/file1.bin bs=4096 count=1 echo 3 > /proc/sys/vm/drop_caches
dd if=/mnt/nfs/file1.bin of=/dev/null
umount /mnt/nfs
On the console with a lockdep-enabled kernel a message similar to the following will be seen:
================================
WARNING: inconsistent lock state 6.7.0-lockdbg+ #10 Not tainted
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage. test5/1708 [HC0[0]:SC0[0]:HE1:SE1] takes:
ffff888127baa598 (&xa->xa_lock#4){+.?.}-{3:3}, at:
nfs_netfs_issue_read+0x1b2/0x4b0 [nfs]
{IN-SOFTIRQ-W} state was registered at:
lock_acquire+0x144/0x380
_raw_spin_lock_irqsave+0x4e/0xa0
__folio_end_writeback+0x17e/0x5c0
folio_end_writeback+0x93/0x1b0
iomap_finish_ioend+0xeb/0x6a0
blk_update_request+0x204/0x7f0
blk_mq_end_request+0x30/0x1c0
blk_complete_reqs+0x7e/0xa0
__do_softirq+0x113/0x544
__irq_exit_rcu+0xfe/0x120
irq_exit_rcu+0xe/0x20
sysvec_call_function_single+0x6f/0x90
asm_sysvec_call_function_single+0x1a/0x20
pv_native_safe_halt+0xf/0x20
default_idle+0x9/0x20
default_idle_call+0x67/0xa0
do_idle+0x2b5/0x300
cpu_startup_entry+0x34/0x40
start_secondary+0x19d/0x1c0
secondary_startup_64_no_verify+0x18f/0x19b
irq event stamp: 176891
hardirqs last enabled at (176891): [<ffffffffa67a0be4>]
_raw_spin_unlock_irqrestore+0x44/0x60
hardirqs last disabled at (176890): [<ffffffffa67a0899>]
_raw_spin_lock_irqsave+0x79/0xa0
softirqs last enabled at (176646): [<ffffffffa515d91e>]
__irq_exit_rcu+0xfe/0x120
softirqs last disabled at (176633): [<ffffffffa515d91e>]
__irq_exit_rcu+0xfe/0x120other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&xa->xa_lock#4);
<Interrupt>
lock(&xa->xa_lock#4);*** DEADLOCK ***
2 locks held by test5/1708:
#0: ffff888127baa498 (&sb->s_type->i_mutex_key#22){++++}-{4:4}, at:
nfs_start_io_read+0x28/0x90 [nfs]
#1: ffff888127baa650 (mapping.invalidate_lock#3){.+.+}-{4:4}, at:
page_cache_ra_unbounded+0xa4/0x280
stack backtrace:
CPU: 6 PID: 1708 Comm: test5 Kdump: loaded Not tainted 6.7.0-lockdbg+
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-1.fc39
04/01/2014
Call Trace:
dump_stack_lvl+0x5b/0x90
mark_lock+0xb3f/0xd20
__lock_acquire+0x77b/0x3360
_raw_spin_lock+0x34/0x80
nfs_netfs_issue_read+0x1b2/0x4b0 [nfs]
netfs_begin_read+0x77f/0x980 [netfs]
nfs_netfs_readahead+0x45/0x60 [nfs]
nfs_readahead+0x323/0x5a0 [nfs]
read_pages+0xf3/0x5c0
page_cache_ra_unbounded+0x1c8/0x280
filemap_get_pages+0x38c/0xae0
filemap_read+0x206/0x5e0
nfs_file_read+0xb7/0x140 [nfs]
vfs_read+0x2a9/0x460
ksys_read+0xb7/0x140--- fs/nfs/fscache.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
fs/nfs/fscache.c +2 -7
@@ -307,11 +307,11 @@ static void nfs_netfs_issue_read(struct netfs_io_subrequest *sreq)struct inode *inode = sreq->rreq->inode;struct nfs_open_context *ctx = sreq->rreq->netfs_priv;struct page *page; +unsigned long idx;int err;pgoff_t start = (sreq->start + sreq->transferred) >>PAGE_SHIFT ;pgoff_t last = ((sreq->start + sreq->len - sreq->transferred -1 ) >>PAGE_SHIFT ); -XA_STATE (xas, &sreq->rreq->mapping->i_pages, start);nfs_pageio_init_read (&pgio, inode, false, &nfs_async_read_completion_ops);
@@ -322,19 +322,14 @@ static void nfs_netfs_issue_read(struct netfs_io_subrequest *sreq) pgio.pg_netfs = netfs;/* used in completion */ -xas_lock (&xas); -xas_for_each (&xas, page, last) { +xa_for_each_range (&sreq->rreq->mapping->i_pages, idx, page, start, last) {/* nfs_read_add_folio() may schedule() due to pNFS layout and other RPCs */ -xas_pause (&xas); -xas_unlock (&xas); err =nfs_read_add_folio (&pgio, ctx,page_folio (page));if (err <0 ) { netfs->error = err; goto out; } -xas_lock (&xas); } -xas_unlock (&xas); out:nfs_pageio_complete_read (&pgio);nfs_netfs_put (netfs);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 542/638 NFS: Fix an off by one in root_nfs_cat()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 698ad1a538da0b6bf969cfee630b4e3a026afb87 ]
The intent is to check if 'dest' is truncated or not. So, >= should be used instead of >, because strlcat() returns the length of 'dest' and 'src' excluding the trailing NULL.
--- fs/nfs/nfsroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfsroot.c +2 -2
@@ -175,10 +175,10 @@ static int __init root_nfs_cat(char *dest, const char *src,size_t len =strlen (dest);if (len && dest[len -1 ] !=',' ) -if (strlcat (dest,"," , destlen) > destlen) +if (strlcat (dest,"," , destlen) >= destlen)return -1 ; -if (strlcat (dest, src, destlen) > destlen) +if (strlcat (dest, src, destlen) >= destlen)return -1 ;return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 543/638 NFSv4.1/pnfs: fix NFS with TLS in pnfs
In reply to Sasha LevinFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit a35518cae4b325632840bc8c3aa9ad9bac430038 ]
Currently, even though xprtsec=tls is specified and used for operations to MDS, any operations that go to DS travel over unencrypted connection. Or additionally, if more than 1 DS can serve the data, then trunked connections are also done unencrypted.
IN GETDEVINCEINFO, we get an entry for the DS which carries a protocol type (which is TCP), then nfs4_set_ds_client() gets called with TCP instead of TCP with TLS.
Currently, each trunked connection is created and uses clp->cl_hostname value which if TLS is used would get passed up in the handshake upcall, but instead we need to pass in the appropriate trunked address value.
--- fs/nfs/pnfs_nfs.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)
fs/nfs/pnfs_nfs.c +43 -1
@@ -919,6 +919,8 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv,dprintk ("--> %s DS %s\n" , __func__, ds->ds_remotestr);list_for_each_entry (da, &ds->ds_addrs, da_node) { +char servername[48 ]; +dprintk ("%s: DS %s: trying address %s\n" , __func__, ds->ds_remotestr, da->da_remotestr);
@@ -929,6 +931,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv, .dstaddr = (struct sockaddr *)&da->da_addr, .addrlen = da->da_addrlen, .servername = clp->cl_hostname, + .xprtsec = clp->cl_xprtsec, };struct nfs4_add_xprt_data xprtdata = { .clp = clp,
@@ -938,10 +941,45 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv, .data = &xprtdata, }; -if (da->da_transport != clp->cl_proto) +if (da->da_transport != clp->cl_proto && + clp->cl_proto !=XPRT_TRANSPORT_TCP_TLS )continue ; +if (da->da_transport ==XPRT_TRANSPORT_TCP && + mds_srv->nfs_client->cl_proto == +XPRT_TRANSPORT_TCP_TLS ) { +struct sockaddr *addr = + (struct sockaddr *)&da->da_addr; +struct sockaddr_in *sin = + (struct sockaddr_in *)&da->da_addr; +struct sockaddr_in6 *sin6 = + (struct sockaddr_in6 *)&da->da_addr; + +/* for NFS with TLS we need to supply a correct +* servername of the trunked transport, not the +* servername of the main transport stored in +* clp->cl_hostname. And set the protocol to +* indicate to use TLS +*/ + servername[0 ] ='\0' ; +switch (addr->sa_family) { +case AF_INET : +snprintf (servername,sizeof (servername), +"%pI4" , &sin->sin_addr.s_addr); +break ; +case AF_INET6 : +snprintf (servername,sizeof (servername), +"%pI6" , &sin6->sin6_addr); +break ; +default : +/* do not consider this address */ +continue ; + } + xprt_args.ident =XPRT_TRANSPORT_TCP_TLS ; + xprt_args.servername = servername; + }if (da->da_addr.ss_family != clp->cl_addr.ss_family)continue ; +/** * Test this address for session trunking and * add as an alias
@@ -953,6 +991,10 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv,if (xprtdata.cred)put_cred (xprtdata.cred); }else { +if (da->da_transport ==XPRT_TRANSPORT_TCP && + mds_srv->nfs_client->cl_proto == +XPRT_TRANSPORT_TCP_TLS ) + da->da_transport =XPRT_TRANSPORT_TCP_TLS ; clp = nfs4_set_ds_client(mds_srv, &da->da_addr, da->da_addrlen,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 544/638 f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks
In reply to Sasha LevinFrom: Xiuhong Wang <[email protected]>
[ Upstream commit b7d797d241c154d73ec5523f87f3b06d4f299da1 ]
The following f2fs_io test will get a "0" result instead of -EINVAL, unisoc # ./f2fs_io compress file
unisoc # ./f2fs_io reserve_cblocks file
0
it's not reasonable, so the judgement of atomic_read(&F2FS_I(inode)->i_compr_blocks) should be placed after the judgement of is_inode_flag_set(inode, FI_COMPRESS_RELEASED).
--- fs/f2fs/file.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/file.c +3 -4
@@ -3679,9 +3679,6 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)if (ret)return ret; -if (atomic_read (&F2FS_I (inode)->i_compr_blocks)) - goto out; -f2fs_balance_fs (sbi, true);inode_lock (inode);
@@ -3691,6 +3688,9 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) goto unlock_inode; } +if (atomic_read (&F2FS_I (inode)->i_compr_blocks)) + goto unlock_inode; +f2fs_down_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]);filemap_invalidate_lock (inode->i_mapping);
@@ -3737,7 +3737,6 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) } unlock_inode:inode_unlock (inode); -out:mnt_drop_write_file (filp);if (ret >=0 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 545/638 f2fs: compress: fix reserve_cblocks counting error when out of space
In reply to Sasha LevinFrom: Xiuhong Wang <[email protected]>
[ Upstream commit 2f6d721e14b69d6e1251f69fa238b48e8374e25f ]
When a file only needs one direct_node, performing the following operations will cause the file to be unrepairable:
unisoc # ./f2fs_io compress test.apk
unisoc #df -h | grep dm-48/dev/block/dm-48 112G 112G 1.2M 100% /data
unisoc # ./f2fs_io release_cblocks test.apk
924
unisoc # df -h | grep dm-48/dev/block/dm-48 112G 112G 4.8M 100% /data
unisoc # dd if=/dev/random of=file4 bs=1M count=3
3145728 bytes (3.0 M) copied, 0.025 s, 120 M/s
unisoc # df -h | grep dm-48/dev/block/dm-48 112G 112G 1.8M 100% /data
unisoc # ./f2fs_io reserve_cblocks test.apk F2FS_IOC_RESERVE_COMPRESS_BLOCKS failed: No space left on device
adb reboot
unisoc # df -h | grep dm-48/dev/block/dm-48 112G 112G 11M 100% /data
unisoc # ./f2fs_io reserve_cblocks test.apk
0
This is because the file has only one direct_node. After returning to -ENOSPC, reserved_blocks += ret will not be executed. As a result, the reserved_blocks at this time is still 0, which is not the real number of reserved blocks. Therefore, fsck cannot be set to repair the file.
After this patch, the fsck flag will be set to fix this problem.
unisoc # df -h | grep dm-48/dev/block/dm-48 112G 112G 1.8M 100% /data
unisoc # ./f2fs_io reserve_cblocks test.apk F2FS_IOC_RESERVE_COMPRESS_BLOCKS failed: No space left on device
adb reboot then fsck will be executed
unisoc # df -h | grep dm-48/dev/block/dm-48 112G 112G 11M 100% /data
unisoc # ./f2fs_io reserve_cblocks test.apk
924
--- fs/f2fs/file.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
fs/f2fs/file.c +7 -8
@@ -3583,10 +3583,10 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)return ret; } -static int reserve_compress_blocks (struct dnode_of_data *dn,pgoff_t count) +static int reserve_compress_blocks (struct dnode_of_data *dn,pgoff_t count, +unsigned int *reserved_blocks) {struct f2fs_sb_info *sbi =F2FS_I_SB (dn->inode); -unsigned int reserved_blocks =0 ;int cluster_size =F2FS_I (dn->inode)->i_cluster_size;block_t blkaddr;int i;
@@ -3650,12 +3650,12 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count)f2fs_i_compr_blocks_update (dn->inode, compr_blocks, true); - reserved_blocks += reserved; + *reserved_blocks += reserved; next: count -= cluster_size; } -return reserved_blocks; +return 0 ; }static int f2fs_reserve_compress_blocks (struct file *filp,unsigned long arg)
@@ -3716,7 +3716,7 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) count =min (end_offset - dn.ofs_in_node, last_idx - page_idx); count =round_up (count,F2FS_I (inode)->i_cluster_size); - ret =reserve_compress_blocks (&dn, count); + ret =reserve_compress_blocks (&dn, count, &reserved_blocks);f2fs_put_dnode (&dn);
@@ -3724,13 +3724,12 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)break ; page_idx += count; - reserved_blocks += ret; }filemap_invalidate_unlock (inode->i_mapping);f2fs_up_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]); -if (ret >=0 ) { +if (!ret) {clear_inode_flag (inode,FI_COMPRESS_RELEASED );inode_set_ctime_current (inode);f2fs_mark_inode_dirty_sync (inode, true);
@@ -3739,7 +3738,7 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)inode_unlock (inode);mnt_drop_write_file (filp); -if (ret >=0 ) { +if (!ret) { ret =put_user (reserved_blocks, (u64 __user *)arg); }else if (reserved_blocks &&atomic_read (&F2FS_I (inode)->i_compr_blocks)) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 546/638 f2fs: introduce f2fs_invalidate_internal_cache() for cleanup
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 4e4f1eb9949b10cb7d76370fd27d41f20ef2b32b ]
Just cleanup, no logic changes.
Stable-dep-of: 9f0c4a46be1f ("f2fs: fix to truncate meta inode pages forcely")
--- fs/f2fs/data.c | 8 +++----- fs/f2fs/f2fs.h | 7 +++++++ fs/f2fs/gc.c | 5 ++--- fs/f2fs/segment.c | 14 ++++---------- 4 files changed, 16 insertions(+), 18 deletions(-)
fs/f2fs/data.c +3 -5
@@ -1485,11 +1485,9 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type) old_blkaddr = dn->data_blkaddr;f2fs_allocate_data_block (sbi,NULL , old_blkaddr, &dn->data_blkaddr, &sum, seg_type,NULL ); -if (GET_SEGNO (sbi, old_blkaddr) !=NULL_SEGNO ) { -invalidate_mapping_pages (META_MAPPING (sbi), - old_blkaddr, old_blkaddr); -f2fs_invalidate_compress_page (sbi, old_blkaddr); - } +if (GET_SEGNO (sbi, old_blkaddr) !=NULL_SEGNO ) +f2fs_invalidate_internal_cache (sbi, old_blkaddr); +f2fs_update_data_blkaddr (dn, dn->data_blkaddr);return 0 ; }
fs/f2fs/f2fs.h +7 -0
@@ -4625,6 +4625,13 @@ static inline bool f2fs_is_readonly(struct f2fs_sb_info *sbi)return f2fs_sb_has_readonly (sbi) ||f2fs_readonly (sbi->sb); } +static inline void f2fs_invalidate_internal_cache (struct f2fs_sb_info *sbi, +block_t blkaddr) +{ +invalidate_mapping_pages (META_MAPPING (sbi), blkaddr, blkaddr); +f2fs_invalidate_compress_page (sbi, blkaddr); +} +#define EFSBADCRC EBADMSG/* Bad CRC detected */ #define EFSCORRUPTED EUCLEAN/* Filesystem is corrupted */
fs/f2fs/gc.c +2 -3
@@ -1380,9 +1380,8 @@ static int move_data_block(struct inode *inode, block_t bidx,memcpy (page_address (fio.encrypted_page),page_address (mpage),PAGE_SIZE );f2fs_put_page (mpage,1 ); -invalidate_mapping_pages (META_MAPPING (fio.sbi), - fio.old_blkaddr, fio.old_blkaddr); -f2fs_invalidate_compress_page (fio.sbi, fio.old_blkaddr); + +f2fs_invalidate_internal_cache (fio.sbi, fio.old_blkaddr);set_page_dirty (fio.encrypted_page);if (clear_page_dirty_for_io (fio.encrypted_page))
fs/f2fs/segment.c +4 -10
@@ -2495,8 +2495,7 @@ void f2fs_invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr)if (addr ==NEW_ADDR || addr ==COMPRESS_ADDR )return ; -invalidate_mapping_pages (META_MAPPING (sbi), addr, addr); -f2fs_invalidate_compress_page (sbi, addr); +f2fs_invalidate_internal_cache (sbi, addr);/* add it into sit main buffer */ down_write (&sit_i->sentry_lock);
@@ -3557,11 +3556,8 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) reallocate:f2fs_allocate_data_block (fio->sbi, fio->page, fio->old_blkaddr, &fio->new_blkaddr, sum, type, fio); -if (GET_SEGNO (fio->sbi, fio->old_blkaddr) !=NULL_SEGNO ) { -invalidate_mapping_pages (META_MAPPING (fio->sbi), - fio->old_blkaddr, fio->old_blkaddr); -f2fs_invalidate_compress_page (fio->sbi, fio->old_blkaddr); - } +if (GET_SEGNO (fio->sbi, fio->old_blkaddr) !=NULL_SEGNO ) +f2fs_invalidate_internal_cache (fio->sbi, fio->old_blkaddr);/* writeout dirty page into bdev */ f2fs_submit_page_write (fio);
@@ -3757,9 +3753,7 @@ void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,update_sit_entry (sbi, new_blkaddr,1 ); }if (GET_SEGNO (sbi, old_blkaddr) !=NULL_SEGNO ) { -invalidate_mapping_pages (META_MAPPING (sbi), - old_blkaddr, old_blkaddr); -f2fs_invalidate_compress_page (sbi, old_blkaddr); +f2fs_invalidate_internal_cache (sbi, old_blkaddr);if (!from_gc)update_segment_mtime (sbi, old_blkaddr,0 );update_sit_entry (sbi, old_blkaddr,-1 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 547/638 f2fs: fix to truncate meta inode pages forcely
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 9f0c4a46be1fe9b97dbe66d49204c1371e3ece65 ]
Below race case can cause data corruption:
Thread A GC thread
- gc_data_segment
- ra_data_block
- locked meta_inode page
- f2fs_inplace_write_data
- invalidate_mapping_pages
: fail to invalidate meta_inode page
due to lock failure or dirty|writeback
status
- f2fs_submit_page_bio
: write last dirty data to old blkaddr
- move_data_block
- load old data from meta_inode page
- f2fs_submit_page_write : write old data to new blkaddr
Because invalidate_mapping_pages() will skip invalidating page which has unclear status including locked, dirty, writeback and so on, so we need to use truncate_inode_pages_range() instead of invalidate_mapping_pages() to make sure meta_inode page will be dropped.
--- fs/f2fs/checkpoint.c | 5 +++-- fs/f2fs/f2fs.h | 28 +++++++++++++++++++++++++++- fs/f2fs/segment.c | 5 ++--- include/linux/f2fs_fs.h | 1 + 4 files changed, 33 insertions(+), 6 deletions(-)
fs/f2fs/checkpoint.c +3 -2
@@ -1587,8 +1587,9 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)*/ if (f2fs_sb_has_encrypt (sbi) ||f2fs_sb_has_verity (sbi) ||f2fs_sb_has_compression (sbi)) -invalidate_mapping_pages (META_MAPPING (sbi), -MAIN_BLKADDR (sbi),MAX_BLKADDR (sbi) -1 ); +f2fs_bug_on (sbi, +invalidate_inode_pages2_range (META_MAPPING (sbi), +MAIN_BLKADDR (sbi),MAX_BLKADDR (sbi) -1 ));f2fs_release_ino_entry (sbi, false);
fs/f2fs/f2fs.h +27 -1
@@ -4625,10 +4625,36 @@ static inline bool f2fs_is_readonly(struct f2fs_sb_info *sbi)return f2fs_sb_has_readonly (sbi) ||f2fs_readonly (sbi->sb); } +static inline void f2fs_truncate_meta_inode_pages (struct f2fs_sb_info *sbi, +block_t blkaddr,unsigned int cnt) +{ +bool need_submit = false; +int i =0 ; + +do { +struct page *page; + + page =find_get_page (META_MAPPING (sbi), blkaddr + i); +if (page) { +if (PageWriteback (page)) + need_submit = true; +f2fs_put_page (page,0 ); + } + }while (++i < cnt && !need_submit); + +if (need_submit) +f2fs_submit_merged_write_cond (sbi, sbi->meta_inode, +NULL ,0 ,DATA ); + +truncate_inode_pages_range (META_MAPPING (sbi), +F2FS_BLK_TO_BYTES ((loff_t )blkaddr), +F2FS_BLK_END_BYTES ((loff_t)(blkaddr + cnt -1 ))); +} +static inline void f2fs_invalidate_internal_cache (struct f2fs_sb_info *sbi,block_t blkaddr) { -invalidate_mapping_pages (META_MAPPING (sbi), blkaddr, blkaddr); +f2fs_truncate_meta_inode_pages (sbi, blkaddr,1 );f2fs_invalidate_compress_page (sbi, blkaddr); }
fs/f2fs/segment.c +2 -3
@@ -3651,8 +3651,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio) }if (fio->post_read) -invalidate_mapping_pages (META_MAPPING (sbi), - fio->new_blkaddr, fio->new_blkaddr); +f2fs_truncate_meta_inode_pages (sbi, fio->new_blkaddr,1 );stat_inc_inplace_blocks (fio->sbi);
@@ -3842,7 +3841,7 @@ void f2fs_wait_on_block_writeback_range(struct inode *inode, block_t blkaddr,for (i =0 ; i < len; i++)f2fs_wait_on_block_writeback (inode, blkaddr + i); -invalidate_mapping_pages (META_MAPPING (sbi), blkaddr, blkaddr + len -1 ); +f2fs_truncate_meta_inode_pages (sbi, blkaddr, len); }static int read_compacted_summaries (struct f2fs_sb_info *sbi)
include/linux/f2fs_fs.h +1 -0
@@ -27,6 +27,7 @@#define F2FS_BYTES_TO_BLK (bytes) ((bytes) >> F2FS_BLKSIZE_BITS)#define F2FS_BLK_TO_BYTES (blk) ((blk) << F2FS_BLKSIZE_BITS) +#define F2FS_BLK_END_BYTES (blk) (F2FS_BLK_TO_BYTES(blk + 1) - 1)/* 0, 1(node nid), 2(meta nid) are reserved node id */ #define F2FS_RESERVED_NODE_NUM 3
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 548/638 f2fs: zone: fix to remove pow2 check condition for zoned block device
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 11bec96afbfbc4679863db55258de440d786821e ]
Commit 2e2c6e9b72ce ("f2fs: remove power-of-two limitation of zoned device") missed to remove pow2 check condition in init_blkz_info(), fix it.
--- fs/f2fs/super.c | 5 ----- 1 file changed, 5 deletions(-)
fs/f2fs/super.c +0 -5
@@ -3920,11 +3920,6 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)return 0 ; zone_sectors =bdev_zone_sectors (bdev); -if (!is_power_of_2 (zone_sectors)) { -f2fs_err (sbi,"F2FS does not support non power of 2 zone sizes\n" ); -return -EINVAL ; - } -if (sbi->blocks_per_blkz && sbi->blocks_per_blkz !=SECTOR_TO_BLOCK (zone_sectors))return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 549/638 perf/x86/amd/core: Avoid register reset when CPU is dead
In reply to Sasha LevinFrom: Sandipan Das <[email protected]>
[ Upstream commit ad8c91282c95f801c37812d59d2d9eba6899b384 ]
When bringing a CPU online, some of the PMC and LBR related registers are reset. The same is done when a CPU is taken offline although that is unnecessary. This currently happens in the "cpu_dead" callback which is also incorrect as the callback runs on a control CPU instead of the one that is being taken offline. This also affects hibernation and suspend to RAM on some platforms as reported in the link below.
--- arch/x86/events/amd/core.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/events/amd/core.c +0 -1
@@ -604,7 +604,6 @@ static void amd_pmu_cpu_dead(int cpu)kfree (cpuhw->lbr_sel); cpuhw->lbr_sel =NULL ; -amd_pmu_cpu_reset (cpu);if (!x86_pmu.amd_nb_constraints)return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 550/638 afs: Revert "afs: Hide silly-rename files from userspace"
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 0aec3847d044273733285dcff90afda89ad461d2 ]
This reverts commit 57e9d49c54528c49b8bffe6d99d782ea051ea534.
This undoes the hiding of .__afsXXXX silly-rename files. The problem with hiding them is that rm can't then manually delete them.
This also reverts commit 5f7a07646655fb4108da527565dcdc80124b14c4 ("afs: Fix endless loop in directory parsing") as that's a bugfix for the above.
--- fs/afs/dir.c | 10 ---------- 1 file changed, 10 deletions(-)
fs/afs/dir.c +0 -10
@@ -474,16 +474,6 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode,continue ; } -/* Don't expose silly rename entries to userspace. */ -if (nlen >6 && - dire->u.name[0 ] =='.' && - ctx->actor != afs_lookup_filldir && - ctx->actor != afs_lookup_one_filldir && -memcmp (dire->u.name,".__afs" ,6 ) ==0 ) { - ctx->pos = blkoff + next *sizeof (union afs_xdr_dirent ); -continue ; - } -/* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen, ntohl(dire->u.vnode),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 551/638 nfs: fix panic when nfs4_ff_layout_prepare_ds() fails
In reply to Sasha LevinFrom: Josef Bacik <[email protected]>
[ Upstream commit 719fcafe07c12646691bd62d7f8d94d657fa0766 ]
We've been seeing the following panic in production
BUG: kernel NULL pointer dereference, address: 0000000000000065 PGD 2f485f067 P4D 2f485f067 PUD 2cc5d8067 PMD 0 RIP: 0010:ff_layout_cancel_io+0x3a/0x90 [nfs_layout_flexfiles] Call Trace: <TASK> ? __die+0x78/0xc0 ? page_fault_oops+0x286/0x380 ? __rpc_execute+0x2c3/0x470 [sunrpc] ? rpc_new_task+0x42/0x1c0 [sunrpc] ? exc_page_fault+0x5d/0x110 ? asm_exc_page_fault+0x22/0x30 ? ff_layout_free_layoutreturn+0x110/0x110 [nfs_layout_flexfiles] ? ff_layout_cancel_io+0x3a/0x90 [nfs_layout_flexfiles] ? ff_layout_cancel_io+0x6f/0x90 [nfs_layout_flexfiles] pnfs_mark_matching_lsegs_return+0x1b0/0x360 [nfsv4] pnfs_error_mark_layout_for_return+0x9e/0x110 [nfsv4] ? ff_layout_send_layouterror+0x50/0x160 [nfs_layout_flexfiles] nfs4_ff_layout_prepare_ds+0x11f/0x290 [nfs_layout_flexfiles] ff_layout_pg_init_write+0xf0/0x1f0 [nfs_layout_flexfiles] __nfs_pageio_add_request+0x154/0x6c0 [nfs] nfs_pageio_add_request+0x26b/0x380 [nfs] nfs_do_writepage+0x111/0x1e0 [nfs] nfs_writepages_callback+0xf/0x30 [nfs] write_cache_pages+0x17f/0x380 ? nfs_pageio_init_write+0x50/0x50 [nfs] ? nfs_writepages+0x6d/0x210 [nfs] ? nfs_writepages+0x6d/0x210 [nfs] nfs_writepages+0x125/0x210 [nfs] do_writepages+0x67/0x220 ? generic_perform_write+0x14b/0x210 filemap_fdatawrite_wbc+0x5b/0x80 file_write_and_wait_range+0x6d/0xc0 nfs_file_fsync+0x81/0x170 [nfs] ? nfs_file_mmap+0x60/0x60 [nfs] __x64_sys_fsync+0x53/0x90 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0
Inspecting the core with drgn I was able to pull this
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog.crashed_thread().stack_trace()[0]
#0 at 0xffffffffa079657a (ff_layout_cancel_io+0x3a/0x84) in ff_layout_cancel_io at fs/nfs/flexfilelayout/flexfilelayout.c:2021:27
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog.crashed_thread().stack_trace()[0]['idx']
(u32)1
Quoted 1 line
Quoted 1 line
Quoted 1 line
prog.crashed_thread().stack_trace()[0]['flseg'].mirror_array[1].mirror_ds
(struct nfs4_ff_layout_ds *)0xffffffffffffffed
This is clear from the stack trace, we call nfs4_ff_layout_prepare_ds() which could error out initializing the mirror_ds, and then we go to clean it all up and our check is only for if (!mirror->mirror_ds). This is inconsistent with the rest of the users of mirror_ds, which have
if (IS_ERR_OR_NULL(mirror_ds))
to keep from tripping over this exact scenario. Fix this up in ff_layout_cancel_io() to make sure we don't panic when we get an error. I also spot checked all the other instances of checking mirror_ds and we appear to be doing the correct checks everywhere, only unconditionally dereferencing mirror_ds when we know it would be valid.
--- fs/nfs/flexfilelayout/flexfilelayout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -1
@@ -2016,7 +2016,7 @@ static void ff_layout_cancel_io(struct pnfs_layout_segment *lseg)for (idx =0 ; idx < flseg->mirror_array_cnt; idx++) { mirror = flseg->mirror_array[idx]; mirror_ds = mirror->mirror_ds; -if (!mirror_ds) +if (IS_ERR_OR_NULL (mirror_ds))continue ; ds = mirror->mirror_ds->ds;if (!ds)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 552/638 io_uring/net: correct the type of variable
In reply to Sasha LevinFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 86bcacc957fc2d0403aa0e652757eec59a5fd7ca ]
The namelen is of type int. It shouldn't be made size_t which is unsigned. The signed number is needed for error checking before use.
--- io_uring/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/net.c +1 -1
@@ -536,7 +536,7 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)static int io_recvmsg_mshot_prep (struct io_kiocb *req,struct io_async_msghdr *iomsg, -size_t namelen,size_t controllen) +int namelen,size_t controllen) {if ((req->flags & (REQ_F_APOLL_MULTISHOT |REQ_F_BUFFER_SELECT )) == (REQ_F_APOLL_MULTISHOT |REQ_F_BUFFER_SELECT )) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 553/638 comedi: comedi_test: Prevent timers rescheduling during deletion
In reply to Sasha LevinFrom: Ian Abbott <[email protected]>
commit f53641a6e849034a44bf80f50245a75d7a376025 upstream.
The comedi_test devices have a couple of timers (ai_timer and ao_timer) that can be started to simulate hardware interrupts. Their expiry functions normally reschedule the timer. The driver code calls either del_timer_sync() or del_timer() to delete the timers from the queue, but does not currently prevent the timers from rescheduling themselves so synchronized deletion may be ineffective.
Add a couple of boolean members (one for each timer: ai_timer_enable and ao_timer_enable) to the device private data structure to indicate whether the timers are allowed to reschedule themselves. Set the member to true when adding the timer to the queue, and to false when deleting the timer from the queue in the waveform_ai_cancel() and waveform_ao_cancel() functions.
The del_timer_sync() function is also called from the waveform_detach() function, but the timer enable members will already be set to false when that function is called, so no change is needed there.
--- drivers/comedi/drivers/comedi_test.c | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/comedi/drivers/comedi_test.c +26 -4
@@ -87,6 +87,8 @@ struct waveform_private {struct comedi_device *dev;/* parent comedi device */ u64 ao_last_scan_time;/* time of previous AO scan in usec */ unsigned int ao_scan_period;/* AO scan period in usec */ + bool ai_timer_enable:1; /* should AI timer be running? */ + bool ao_timer_enable:1; /* should AO timer be running? */unsigned short ao_loopbacks[N_CHANS ]; };
@@ -236,8 +238,12 @@ static void waveform_ai_timer(struct timer_list *t) time_increment = devpriv->ai_convert_time - now; else time_increment =1 ; -mod_timer (&devpriv->ai_timer, - jiffies +usecs_to_jiffies (time_increment)); +spin_lock (&dev->spinlock); +if (devpriv->ai_timer_enable) { +mod_timer (&devpriv->ai_timer, + jiffies +usecs_to_jiffies (time_increment)); + } +spin_unlock (&dev->spinlock); } overrun:
@@ -393,9 +399,12 @@ static int waveform_ai_cmd(struct comedi_device *dev,* Seem to need an extra jiffy here, otherwise timer expires slightly * early! */ +spin_lock_bh (&dev->spinlock); + devpriv->ai_timer_enable = true; devpriv->ai_timer.expires = jiffies +usecs_to_jiffies (devpriv->ai_convert_period) +1 ;add_timer (&devpriv->ai_timer); +spin_unlock_bh (&dev->spinlock);return 0 ; }
@@ -404,6 +413,9 @@ static int waveform_ai_cancel(struct comedi_device *dev, {struct waveform_private *devpriv = dev->private; +spin_lock_bh (&dev->spinlock); + devpriv->ai_timer_enable = false; +spin_unlock_bh (&dev->spinlock);if (in_softirq ()) {/* Assume we were called from the timer routine itself. */ del_timer (&devpriv->ai_timer);
@@ -495,8 +507,12 @@ static void waveform_ao_timer(struct timer_list *t)unsigned int time_inc = devpriv->ao_last_scan_time + devpriv->ao_scan_period - now; -mod_timer (&devpriv->ao_timer, - jiffies +usecs_to_jiffies (time_inc)); +spin_lock (&dev->spinlock); +if (devpriv->ao_timer_enable) { +mod_timer (&devpriv->ao_timer, + jiffies +usecs_to_jiffies (time_inc)); + } +spin_unlock (&dev->spinlock); } underrun:
@@ -517,9 +533,12 @@ static int waveform_ao_inttrig_start(struct comedi_device *dev, async->inttrig =NULL ; devpriv->ao_last_scan_time =ktime_to_us (ktime_get ()); +spin_lock_bh (&dev->spinlock); + devpriv->ao_timer_enable = true; devpriv->ao_timer.expires = jiffies +usecs_to_jiffies (devpriv->ao_scan_period);add_timer (&devpriv->ao_timer); +spin_unlock_bh (&dev->spinlock);return 1 ; }
@@ -604,6 +623,9 @@ static int waveform_ao_cancel(struct comedi_device *dev,struct waveform_private *devpriv = dev->private; s->async->inttrig =NULL ; +spin_lock_bh (&dev->spinlock); + devpriv->ao_timer_enable = false; +spin_unlock_bh (&dev->spinlock);if (in_softirq ()) {/* Assume we were called from the timer routine itself. */ del_timer (&devpriv->ao_timer);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 554/638 mei: gsc_proxy: match component when GSC is on different bus
In reply to Sasha LevinFrom: Alexander Usyskin <[email protected]>
commit a0776c214d47ea4f7aaef138095beaa41cff03ef upstream.
On Arrow Lake S systems, MEI is no longer strictly connected to bus 0, while graphics remain exclusively on bus 0. Adapt the component matching logic to accommodate this change:
Original behavior: Required both MEI and graphics to be on the same bus 0.
New behavior: Only enforces graphics to be on bus 0 (integrated), allowing MEI to reside on any bus.
This ensures compatibility with Arrow Lake S and maintains functionality for the legacy systems.
--- drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c +5 -3
@@ -96,7 +96,8 @@ static const struct component_master_ops mei_component_master_ops = {* * The function checks if the device is pci device and * Intel VGA adapter, the subcomponent is SW Proxy -* and the parent of MEI PCI and the parent of VGA are the same PCH device. +* and the VGA is on the bus 0 reserved for built-in devices +* to reject discrete GFX. * * @dev: master device * @subcomponent: subcomponent to match (I915_COMPONENT_SWPROXY)
@@ -123,7 +124,8 @@ static int mei_gsc_proxy_component_match(struct device *dev, int subcomponent,if (subcomponent !=I915_COMPONENT_GSC_PROXY )return 0 ; -return component_compare_dev (dev->parent, ((struct device *)data)->parent); +/* Only built-in GFX */ +return (pdev->bus->number ==0 ); } static int mei_gsc_proxy_probe(struct mei_cl_device *cldev,
@@ -146,7 +148,7 @@ static int mei_gsc_proxy_probe(struct mei_cl_device *cldev, }component_match_add_typed (&cldev->dev, &master_match, - mei_gsc_proxy_component_match, cldev->dev.parent); + mei_gsc_proxy_component_match,NULL );if (IS_ERR_OR_NULL (master_match)) { ret = -ENOMEM ; goto err_exit;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 555/638 remoteproc: stm32: Fix incorrect type in assignment for va
In reply to Sasha LevinFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit 32381bbccba4c21145c571701f8f7fb1d9b3a92e ]
The sparse tool complains about the attribute conversion between a _iomem void * and a void *:
stm32_rproc.c:122:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *va @@ got void [noderef] __iomem * @@
stm32_rproc.c:122:12: sparse: expected void *va
stm32_rproc.c:122:12: sparse: got void [noderef] __iomem *
Add '__force' to explicitly specify that the cast is intentional. This conversion is necessary to cast to virtual addresses pointer,used, by the remoteproc core.
--- drivers/remoteproc/stm32_rproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/stm32_rproc.c +2 -2
@@ -120,7 +120,7 @@ static int stm32_rproc_mem_alloc(struct rproc *rproc,void *va;dev_dbg (dev,"map memory: %pad+%zx\n" , &mem->dma, mem->len); - va =ioremap_wc (mem->dma, mem->len); + va = (__force void *)ioremap_wc (mem->dma, mem->len);if (IS_ERR_OR_NULL (va)) {dev_err (dev,"Unable to map memory region: %pad+0x%zx\n" , &mem->dma, mem->len);
@@ -137,7 +137,7 @@ static int stm32_rproc_mem_release(struct rproc *rproc, struct rproc_mem_entry *mem) {dev_dbg (rproc->dev.parent,"unmap memory: %pa\n" , &mem->dma); -iounmap (mem->va); +iounmap ((__force __iomem void *)mem->va);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 556/638 remoteproc: stm32: Fix incorrect type assignment returned by stm32_rproc_get_loaded_rsc_tablef
In reply to Sasha LevinFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit c77b35ce66af25bdd6fde60b62e35b9b316ea5c2 ]
The sparse tool complains about the remove of the _iomem attribute.
stm32_rproc.c:660:17: warning: cast removes address space '__iomem' of expression
Add '__force' to explicitly specify that the cast is intentional. This conversion is necessary to cast to addresses pointer, which are then managed by the remoteproc core as a pointer to a resource_table structure.
--- drivers/remoteproc/stm32_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/stm32_rproc.c +1 -1
@@ -657,7 +657,7 @@ stm32_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz)* entire area by overwriting it with the initial values stored in rproc->clean_table. */ *table_sz =RSC_TBL_SIZE ; -return (struct resource_table *)ddata->rsc_va; +return (__force struct resource_table *)ddata->rsc_va; }static const struct rproc_ops st_rproc_ops = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 557/638 iio: pressure: mprls0025pa fix off-by-one enum
In reply to Sasha LevinFrom: Petre Rodan <[email protected]>
[ Upstream commit 9e65506ca9c7ff716c8441a33417820ad61d3a16 ]
Fix off-by-one error in transfer-function property.
The honeywell,transfer-function property takes values between 1-3 so make sure the proper enum gets used.
--- drivers/iio/pressure/mprls0025pa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/pressure/mprls0025pa.c +3 -1
@@ -323,6 +323,7 @@ static int mpr_probe(struct i2c_client *client)struct iio_dev *indio_dev;struct device *dev = &client->dev;s64 scale, offset; +u32 func;if (!i2c_check_functionality (client->adapter,I2C_FUNC_SMBUS_READ_BYTE )) return dev_err_probe(dev, -EOPNOTSUPP,
@@ -362,10 +363,11 @@ static int mpr_probe(struct i2c_client *client)return dev_err_probe (dev, ret,"honeywell,pmax-pascal could not be read\n" ); ret =device_property_read_u32 (dev, -"honeywell,transfer-function" , &data->function); +"honeywell,transfer-function" , &func);if (ret)return dev_err_probe (dev, ret,"honeywell,transfer-function could not be read\n" ); + data->function = func -1 ;if (data->function >MPR_FUNCTION_C ) return dev_err_probe(dev, -EINVAL, "honeywell,transfer-function %d invalid\n",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 558/638 usb: phy: generic: Get the vbus supply
In reply to Sasha LevinFrom: Sean Anderson <[email protected]>
[ Upstream commit 75fd6485cccef269ac9eb3b71cf56753341195ef ]
While support for working with a vbus was added, the regulator was never actually gotten (despite what was documented). Fix this by actually getting the supply from the device tree.
--- drivers/usb/phy/phy-generic.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/phy/phy-generic.c +7 -0
@@ -268,6 +268,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)return dev_err_probe (dev,PTR_ERR (nop->vbus_draw),"could not get vbus regulator\n" ); + nop->vbus_draw =devm_regulator_get_exclusive (dev,"vbus" ); +if (PTR_ERR (nop->vbus_draw) == -ENODEV ) + nop->vbus_draw =NULL ; +if (IS_ERR (nop->vbus_draw)) +return dev_err_probe (dev,PTR_ERR (nop->vbus_draw), +"could not get vbus regulator\n" ); + nop->dev = dev; nop->phy.dev = nop->dev; nop->phy.label ="nop-xceiv" ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 559/638 tty: vt: fix 20 vs 0x20 typo in EScsiignore
In reply to Sasha LevinFrom: "Jiri Slaby (SUSE)" <[email protected]>
[ Upstream commit 0e6a92f67c8a94707f7bb27ac29e2bdf3e7c167d ]
The if (c >= 20 && c <= 0x3f) test added in commit 7a99565f8732 is wrong. 20 is DC4 in ascii and it makes no sense to consider that as the bottom limit. Instead, it should be 0x20 as in the other test in the commit above. This is supposed to NOT change anything as we handle interesting 20-0x20 asciis far before this if.
So for sakeness, change to 0x20 (which is SPACE).
--- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/vt/vt.c +1 -1
@@ -2469,7 +2469,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) }return ;case EScsiignore: -if (c >=20 && c <=0x3f ) +if (c >=0x20 && c <=0x3f )return ; vc->vc_state = ESnormal;return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 560/638 serial: max310x: fix syntax error in IRQ error message
In reply to Sasha LevinFrom: Hugo Villeneuve <[email protected]>
[ Upstream commit 8ede8c6f474255b2213cccd7997b993272a8e2f9 ]
Replace g with q.
Helpful when grepping thru source code or logs for "request" keyword.
--- drivers/tty/serial/max310x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/max310x.c +1 -1
@@ -1461,7 +1461,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtyif (!ret)return 0 ; -dev_err (dev,"Unable to reguest IRQ %i\n" , irq); +dev_err (dev,"Unable to request IRQ %i\n" , irq); out_uart:for (i =0 ; i < devtype->nr; i++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 561/638 tty: serial: samsung: fix tx_empty() to return TIOCSER_TEMT
In reply to Sasha LevinFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 314c2b399288f0058a8c5b6683292cbde5f1531b ]
The core expects for tx_empty() either TIOCSER_TEMT when the tx is empty or 0 otherwise. s3c24xx_serial_txempty_nofifo() might return 0x4, and at least uart_get_lsr_info() tries to clear exactly TIOCSER_TEMT (BIT(1)). Fix tx_empty() to return TIOCSER_TEMT.
--- drivers/tty/serial/samsung_tty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/samsung_tty.c +2 -3
@@ -990,11 +990,10 @@ static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)if ((ufstat & info->tx_fifomask) !=0 || (ufstat & info->tx_fifofull))return 0 ; - -return 1 ; +return TIOCSER_TEMT ; } -return s3c24xx_serial_txempty_nofifo (port); +return s3c24xx_serial_txempty_nofifo (port) ?TIOCSER_TEMT :0 ; }/* no modem control lines */
Signature · 1 line
2.43.0