6.1.63-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 133/379 drm/bridge: tc358768: Clean up clock period code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit b3aa7b34924a9ed64cf96899cac4d8ea08cd829e ]
The driver defines TC358768_PRECISION as 1000, and uses "nsk" to refer to clock periods. The original author does not remember where all this came from. Effectively the driver is using picoseconds as the unit for clock periods, yet referring to them by "nsk".
Clean this up by just saying the periods are in picoseconds.
Stable-dep-of: f1dabbe64506 ("drm/bridge: tc358768: Fix tc358768_ns_to_cnt()")
--- drivers/gpu/drm/bridge/tc358768.c | 60 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 31 deletions(-)
drivers/gpu/drm/bridge/tc358768.c +29 -31
@@ -15,6 +15,7 @@#include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> +#include <linux/units.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h>
@@ -628,15 +629,14 @@ static int tc358768_setup_pll(struct tc358768_priv *priv,return tc358768_clear_error (priv); } -#define TC358768_PRECISION 1000 -static u32 tc358768_ns_to_cnt (u32 ns,u32 period_nsk) +static u32 tc358768_ns_to_cnt (u32 ns,u32 period_ps) { -return (ns *TC358768_PRECISION + period_nsk) / period_nsk; +return (ns *1000 + period_ps) / period_ps; } -static u32 tc358768_to_ns (u32 nsk) +static u32 tc358768_ps_to_ns (u32 ps) { -return (nsk /TC358768_PRECISION ); +return ps /1000 ; }static void tc358768_bridge_pre_enable (struct drm_bridge *bridge)
@@ -647,7 +647,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)u32 val, val2, lptxcnt, hact, data_type;s32 raw_val;const struct drm_display_mode *mode; -u32 hsbyteclk_nsk, dsiclk_nsk, ui_nsk; +u32 hsbyteclk_ps, dsiclk_ps, ui_ps;u32 dsiclk, hsbyteclk, video_start;const u32 internal_delay =40 ;int ret, i;
@@ -731,67 +731,65 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)tc358768_write (priv,TC358768_D0W_CNTRL + i *4 ,0x0000 );/* DSI Timings */ - hsbyteclk_nsk = (u32 )div_u64 ((u64 )1000000000 *TC358768_PRECISION , - hsbyteclk); - dsiclk_nsk = (u32 )div_u64 ((u64 )1000000000 *TC358768_PRECISION , dsiclk); - ui_nsk = dsiclk_nsk /2 ; -dev_dbg (dev,"dsiclk_nsk: %u\n" , dsiclk_nsk); -dev_dbg (dev,"ui_nsk: %u\n" , ui_nsk); -dev_dbg (dev,"hsbyteclk_nsk: %u\n" , hsbyteclk_nsk); + hsbyteclk_ps = (u32 )div_u64 (PICO , hsbyteclk); + dsiclk_ps = (u32 )div_u64 (PICO , dsiclk); + ui_ps = dsiclk_ps /2 ; +dev_dbg (dev,"dsiclk: %u ps, ui %u ps, hsbyteclk %u ps\n" , dsiclk_ps, + ui_ps, hsbyteclk_ps);/* LP11 > 100us for D-PHY Rx Init */ - val =tc358768_ns_to_cnt (100 *1000 , hsbyteclk_nsk) -1 ; + val =tc358768_ns_to_cnt (100 *1000 , hsbyteclk_ps) -1 ;dev_dbg (dev,"LINEINITCNT: %u\n" , val);tc358768_write (priv,TC358768_LINEINITCNT , val);/* LPTimeCnt > 50ns */ - val =tc358768_ns_to_cnt (50 , hsbyteclk_nsk) -1 ; + val =tc358768_ns_to_cnt (50 , hsbyteclk_ps) -1 ; lptxcnt = val;dev_dbg (dev,"LPTXTIMECNT: %u\n" , val);tc358768_write (priv,TC358768_LPTXTIMECNT , val);/* 38ns < TCLK_PREPARE < 95ns */ - val =tc358768_ns_to_cnt (65 , hsbyteclk_nsk) -1 ; + val =tc358768_ns_to_cnt (65 , hsbyteclk_ps) -1 ;dev_dbg (dev,"TCLK_PREPARECNT %u\n" , val);/* TCLK_PREPARE + TCLK_ZERO > 300ns */ - val2 =tc358768_ns_to_cnt (300 -tc358768_to_ns (2 * ui_nsk), - hsbyteclk_nsk) -2 ; + val2 =tc358768_ns_to_cnt (300 -tc358768_ps_to_ns (2 * ui_ps), + hsbyteclk_ps) -2 ;dev_dbg (dev,"TCLK_ZEROCNT %u\n" , val2); val |= val2 <<8 ;tc358768_write (priv,TC358768_TCLK_HEADERCNT , val);/* TCLK_TRAIL > 60ns AND TEOT <= 105 ns + 12*UI */ - raw_val =tc358768_ns_to_cnt (60 +tc358768_to_ns (2 * ui_nsk), hsbyteclk_nsk) -5 ; + raw_val =tc358768_ns_to_cnt (60 +tc358768_ps_to_ns (2 * ui_ps), hsbyteclk_ps) -5 ; val =clamp (raw_val,0 ,127 );dev_dbg (dev,"TCLK_TRAILCNT: %u\n" , val);tc358768_write (priv,TC358768_TCLK_TRAILCNT , val);/* 40ns + 4*UI < THS_PREPARE < 85ns + 6*UI */ - val =50 +tc358768_to_ns (4 * ui_nsk); - val =tc358768_ns_to_cnt (val, hsbyteclk_nsk) -1 ; + val =50 +tc358768_ps_to_ns (4 * ui_ps); + val =tc358768_ns_to_cnt (val, hsbyteclk_ps) -1 ;dev_dbg (dev,"THS_PREPARECNT %u\n" , val);/* THS_PREPARE + THS_ZERO > 145ns + 10*UI */ - raw_val =tc358768_ns_to_cnt (145 -tc358768_to_ns (3 * ui_nsk), hsbyteclk_nsk) -10 ; + raw_val =tc358768_ns_to_cnt (145 -tc358768_ps_to_ns (3 * ui_ps), hsbyteclk_ps) -10 ; val2 =clamp (raw_val,0 ,127 );dev_dbg (dev,"THS_ZEROCNT %u\n" , val2); val |= val2 <<8 ;tc358768_write (priv,TC358768_THS_HEADERCNT , val);/* TWAKEUP > 1ms in lptxcnt steps */ - val =tc358768_ns_to_cnt (1020000 , hsbyteclk_nsk); + val =tc358768_ns_to_cnt (1020000 , hsbyteclk_ps); val = val / (lptxcnt +1 ) -1 ;dev_dbg (dev,"TWAKEUP: %u\n" , val);tc358768_write (priv,TC358768_TWAKEUP , val);/* TCLK_POSTCNT > 60ns + 52*UI */ - val =tc358768_ns_to_cnt (60 +tc358768_to_ns (52 * ui_nsk), - hsbyteclk_nsk) -3 ; + val =tc358768_ns_to_cnt (60 +tc358768_ps_to_ns (52 * ui_ps), + hsbyteclk_ps) -3 ;dev_dbg (dev,"TCLK_POSTCNT: %u\n" , val);tc358768_write (priv,TC358768_TCLK_POSTCNT , val);/* max(60ns + 4*UI, 8*UI) < THS_TRAILCNT < 105ns + 12*UI */ - raw_val =tc358768_ns_to_cnt (60 +tc358768_to_ns (18 * ui_nsk), - hsbyteclk_nsk) -4 ; + raw_val =tc358768_ns_to_cnt (60 +tc358768_ps_to_ns (18 * ui_ps), + hsbyteclk_ps) -4 ; val =clamp (raw_val,0 ,15 );dev_dbg (dev,"THS_TRAILCNT: %u\n" , val);tc358768_write (priv,TC358768_THS_TRAILCNT , val);
@@ -805,11 +803,11 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) (mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) ? 0 : BIT(0));/* TXTAGOCNT[26:16] RXTASURECNT[10:0] */ - val =tc358768_to_ns ((lptxcnt +1 ) * hsbyteclk_nsk *4 ); - val =tc358768_ns_to_cnt (val, hsbyteclk_nsk) /4 -1 ; + val =tc358768_ps_to_ns ((lptxcnt +1 ) * hsbyteclk_ps *4 ); + val =tc358768_ns_to_cnt (val, hsbyteclk_ps) /4 -1 ;dev_dbg (dev,"TXTAGOCNT: %u\n" , val); - val2 =tc358768_ns_to_cnt (tc358768_to_ns ((lptxcnt +1 ) * hsbyteclk_nsk), - hsbyteclk_nsk) -2 ; + val2 =tc358768_ns_to_cnt (tc358768_ps_to_ns ((lptxcnt +1 ) * hsbyteclk_ps), + hsbyteclk_ps) -2 ;dev_dbg (dev,"RXTASURECNT: %u\n" , val2); val = val <<16 | val2;tc358768_write (priv,TC358768_BTACNTRL1 , val);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 134/379 drm/bridge: tc358768: Fix tc358768_ns_to_cnt()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit f1dabbe645065d20ca863c8d446c74c59ca1ca9d ]
The tc358768_ns_to_cnt() is, most likely, supposed to do a div-round-up operation, but it misses subtracting one from the dividend.
Fix this by just using DIV_ROUND_UP().
--- drivers/gpu/drm/bridge/tc358768.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358768.c +1 -1
@@ -631,7 +631,7 @@ static int tc358768_setup_pll(struct tc358768_priv *priv,static u32 tc358768_ns_to_cnt (u32 ns,u32 period_ps) { -return (ns *1000 + period_ps) / period_ps; +return DIV_ROUND_UP (ns *1000 , period_ps); }static u32 tc358768_ps_to_ns (u32 ps)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 135/379 drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaogang Chen <[email protected]>
[ Upstream commit 7bfaa160caed8192f8262c4638f552cad94bcf5a ]
This patch fixes:
1: ref number of prange's svm_bo got decreased by an async call from hmm. When wait svm_bo of prange got released we shoul also wait prang->svm_bo become NULL, otherwise prange->svm_bo may be set to null after allocate new vram buffer.
2: During waiting svm_bo of prange got released in a while loop should reschedule current task to give other tasks oppotunity to run, specially the the workque task that handles svm_bo ref release, otherwise we may enter to softlock.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +4 -4
@@ -487,11 +487,11 @@ svm_range_validate_svm_bo(struct amdgpu_device *adev, struct svm_range *prange)/* We need a new svm_bo. Spin-loop to wait for concurrent * svm_range_bo_release to finish removing this range from -* its range list. After this, it is safe to reuse the -* svm_bo pointer and svm_bo_list head. +* its range list and set prange->svm_bo to null. After this, +* it is safe to reuse the svm_bo pointer and svm_bo_list head. */ -while (!list_empty_careful (&prange->svm_bo_list)) - ; +while (!list_empty_careful (&prange->svm_bo_list) || prange->svm_bo) +cond_resched ();return false; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 136/379 drm/amd/display: Check all enabled planes in dm_check_crtc_cursor
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
[ Upstream commit 003048ddf44b1a6cfa57afa5a0cf40673e13f1ba ]
It was only checking planes which had any state changes in the same commit. However, it also needs to check other enabled planes.
Not doing this meant that a commit might spuriously "succeed", resulting in the cursor plane displaying with incorrect scaling. See
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177#note_1824263
for an example.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -2
@@ -9643,14 +9643,24 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,* blending properties match the underlying planes'. */ - new_cursor_state =drm_atomic_get_new_plane_state (state, cursor); -if (!new_cursor_state || !new_cursor_state->fb) + new_cursor_state =drm_atomic_get_plane_state (state, cursor); +if (IS_ERR (new_cursor_state)) +return PTR_ERR (new_cursor_state); + +if (!new_cursor_state->fb)return 0 ;dm_get_oriented_plane_size (new_cursor_state, &cursor_src_w, &cursor_src_h); cursor_scale_w = new_cursor_state->crtc_w *1000 / cursor_src_w; cursor_scale_h = new_cursor_state->crtc_h *1000 / cursor_src_h; +/* Need to check all enabled planes, even if this commit doesn't change +* their state +*/ + i =drm_atomic_add_affected_planes (state, crtc); +if (i) +return i; +for_each_new_plane_in_state_reverse (state, underlying, new_underlying_state, i) {/* Narrow down to non-cursor planes on the same CRTC as the cursor */ if (new_underlying_state->crtc != crtc || underlying == crtc->cursor)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 137/379 drm/amd/display: Refactor dm_get_plane_scale helper
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
[ Upstream commit ec4d770bbb155674c2497f255f4199bdc42287a9 ]
Cleanup, no functional change intended.
Stable-dep-of: bc0b79ce2050 ("drm/amd/display: Bail from dm_check_crtc_cursor if no relevant change")
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +14 -9
@@ -9626,6 +9626,17 @@ static void dm_get_oriented_plane_size(struct drm_plane_state *plane_state, } } +static void +dm_get_plane_scale (struct drm_plane_state *plane_state, +int *out_plane_scale_w,int *out_plane_scale_h) +{ +int plane_src_w, plane_src_h; + +dm_get_oriented_plane_size (plane_state, &plane_src_w, &plane_src_h); + *out_plane_scale_w = plane_state->crtc_w *1000 / plane_src_w; + *out_plane_scale_h = plane_state->crtc_h *1000 / plane_src_h; +} +static int dm_check_crtc_cursor (struct drm_atomic_state *state,struct drm_crtc *crtc,struct drm_crtc_state *new_crtc_state)
@@ -9634,8 +9645,6 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,struct drm_plane_state *new_cursor_state, *new_underlying_state;int i;int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_h; -int cursor_src_w, cursor_src_h; -int underlying_src_w, underlying_src_h;/* On DCE and DCN there is no dedicated hardware cursor plane. We get a * cursor per pipe but it's going to inherit the scaling and
@@ -9650,9 +9659,7 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,if (!new_cursor_state->fb)return 0 ; -dm_get_oriented_plane_size (new_cursor_state, &cursor_src_w, &cursor_src_h); - cursor_scale_w = new_cursor_state->crtc_w *1000 / cursor_src_w; - cursor_scale_h = new_cursor_state->crtc_h *1000 / cursor_src_h; +dm_get_plane_scale (new_cursor_state, &cursor_scale_w, &cursor_scale_h);/* Need to check all enabled planes, even if this commit doesn't change * their state
@@ -9670,10 +9677,8 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,if (!new_underlying_state->fb)continue ; -dm_get_oriented_plane_size (new_underlying_state, - &underlying_src_w, &underlying_src_h); - underlying_scale_w = new_underlying_state->crtc_w *1000 / underlying_src_w; - underlying_scale_h = new_underlying_state->crtc_h *1000 / underlying_src_h; +dm_get_plane_scale (new_underlying_state, + &underlying_scale_w, &underlying_scale_h);if (cursor_scale_w != underlying_scale_w || cursor_scale_h != underlying_scale_h) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 138/379 drm/amd/display: Bail from dm_check_crtc_cursor if no relevant change
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
[ Upstream commit bc0b79ce2050aa523c38c96b6d26340a96bfbdca ]
If no plane was newly enabled or changed scaling, there can be no new scaling mismatch with the cursor plane.
By not pulling non-cursor plane states into all atomic commits while the cursor plane is enabled, this avoids synchronizing all cursor plane changes to vertical blank, which caused the following IGT tests to fail:
kms_cursor_legacy@cursor-vs-flip.*
kms_cursor_legacy@flip-vs-cursor.*
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +32 -1
@@ -9641,10 +9641,12 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,struct drm_crtc *crtc, struct drm_crtc_state *new_crtc_state) { - struct drm_plane *cursor = crtc->cursor, *underlying; + struct drm_plane *cursor = crtc->cursor, *plane, *underlying; +struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_plane_state *new_cursor_state, *new_underlying_state;int i;int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_h; +bool any_relevant_change = false;/* On DCE and DCN there is no dedicated hardware cursor plane. We get a * cursor per pipe but it's going to inherit the scaling and
@@ -9652,6 +9654,35 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,* blending properties match the underlying planes'. */ +/* If no plane was enabled or changed scaling, no need to check again */ +for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) { +int new_scale_w, new_scale_h, old_scale_w, old_scale_h; + +if (!new_plane_state || !new_plane_state->fb || new_plane_state->crtc != crtc) +continue ; + +if (!old_plane_state || !old_plane_state->fb || old_plane_state->crtc != crtc) { + any_relevant_change = true; +break ; + } + +if (new_plane_state->fb == old_plane_state->fb && + new_plane_state->crtc_w == old_plane_state->crtc_w && + new_plane_state->crtc_h == old_plane_state->crtc_h) +continue ; + +dm_get_plane_scale (new_plane_state, &new_scale_w, &new_scale_h); +dm_get_plane_scale (old_plane_state, &old_scale_w, &old_scale_h); + +if (new_scale_w != old_scale_w || new_scale_h != old_scale_h) { + any_relevant_change = true; +break ; + } + } + +if (!any_relevant_change) +return 0 ; + new_cursor_state =drm_atomic_get_plane_state (state, cursor);if (IS_ERR (new_cursor_state))return PTR_ERR (new_cursor_state);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 139/379 io_uring/kbuf: Fix check of BID wrapping in provided buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Krisman Bertazi <[email protected]>
[ Upstream commit ab69838e7c75b0edb699c1a8f42752b30333c46f ]
Commit 3851d25c75ed0 ("io_uring: check for rollover of buffer ID when providing buffers") introduced a check to prevent wrapping the BID counter when sqe->off is provided, but it's off-by-one too restrictive, rejecting the last possible BID (65534).
i.e., the following fails with -EINVAL.
io_uring_prep_provide_buffers(sqe, addr, size, 0xFFFF, 0, 0);
--- io_uring/kbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/kbuf.c +1 -1
@@ -347,7 +347,7 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe tmp =READ_ONCE (sqe->off);if (tmp >USHRT_MAX )return -E2BIG ; -if (tmp + p->nbufs >=USHRT_MAX ) +if (tmp + p->nbufs >USHRT_MAX )return -EINVAL ; p->bid = tmp;return 0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 140/379 io_uring/kbuf: Allow the full buffer id space for provided buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Krisman Bertazi <[email protected]>
[ Upstream commit f74c746e476b9dad51448b9a9421aae72b60e25f ]
nbufs tracks the number of buffers and not the last bgid. In 16-bit, we have 2^16 valid buffers, but the check mistakenly rejects the last bid. Let's fix it to make the interface consistent with the documentation.
--- io_uring/kbuf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
io_uring/kbuf.c +7 -4
@@ -19,12 +19,15 @@#define BGID_ARRAY 64 +/* BIDs are addressed by a 16-bit field in a CQE */ +#define MAX_BIDS_PER_BGID (1 << 16) +struct io_provide_buf {struct file *file;__u64 addr;__u32 len;__u32 bgid; -__u16 nbufs; +__u32 nbufs;__u16 bid; };
@@ -281,7 +284,7 @@ int io_remove_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)return -EINVAL ; tmp =READ_ONCE (sqe->fd); -if (!tmp || tmp >USHRT_MAX ) +if (!tmp || tmp >MAX_BIDS_PER_BGID )return -EINVAL ;memset (p,0 ,sizeof (*p));
@@ -327,7 +330,7 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqereturn -EINVAL ; tmp =READ_ONCE (sqe->fd); -if (!tmp || tmp >USHRT_MAX ) +if (!tmp || tmp >MAX_BIDS_PER_BGID )return -E2BIG ; p->nbufs = tmp; p->addr =READ_ONCE (sqe->addr);
@@ -347,7 +350,7 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe tmp =READ_ONCE (sqe->off);if (tmp >USHRT_MAX )return -E2BIG ; -if (tmp + p->nbufs >USHRT_MAX ) +if (tmp + p->nbufs >MAX_BIDS_PER_BGID )return -EINVAL ; p->bid = tmp;return 0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 141/379 drm/mediatek: Fix iommu fault by swapping FBs after updating plane state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason-JH.Lin <[email protected]>
[ Upstream commit 3ec71e05ae6e7f46512e568ed81c92be589003dd ]
According to the comment in drm_atomic_helper_async_commit(), we should make sure FBs have been swapped, so that cleanups in the new_state performs a cleanup in the old FB.
So we should move swapping FBs after calling mtk_plane_update_new_state(), to avoid using the old FB which could be freed.
--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
@@ -157,9 +157,9 @@ static void mtk_plane_atomic_async_update(struct drm_plane *plane, plane->state->src_y = new_state->src_y; plane->state->src_h = new_state->src_h; plane->state->src_w = new_state->src_w; -swap (plane->state->fb, new_state->fb);mtk_plane_update_new_state (new_state, new_plane_state); +swap (plane->state->fb, new_state->fb);wmb ();/* Make sure the above parameters are set before update */ new_plane_state->pending.async_dirty = true;mtk_drm_crtc_async_update (new_state->crtc, plane, state);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 142/379 drm/mediatek: Fix iommu fault during crtc enabling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason-JH.Lin <[email protected]>
[ Upstream commit 53412dc2905401207f264dc30890f6b9e41524a6 ]
The difference between drm_atomic_helper_commit_tail() and drm_atomic_helper_commit_tail_rpm() is drm_atomic_helper_commit_tail() will commit plane first and then enable crtc, drm_atomic_helper_commit_tail_rpm() will enable crtc first and then commit plane.
Before mediatek-drm enables crtc, the power and clk required by OVL have not been turned on, so the commit plane cannot be committed before crtc is enabled. That means OVL layer should not be enabled before crtc is enabled.
Therefore, the atomic_commit_tail of mediatek-drm is hooked with drm_atomic_helper_commit_tail_rpm().
Another reason is that the plane_state of drm_atomic_state is not synchronized with the plane_state stored in mtk_crtc during crtc enablng, so just set all planes to disabled.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3 -0
@@ -402,6 +402,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)unsigned int local_layer; plane_state =to_mtk_plane_state (plane->state); + +/* should not enable layer before crtc enabled */ + plane_state->pending.enable = false; comp =mtk_drm_ddp_comp_for_plane (crtc, plane, &local_layer);if (comp) mtk_ddp_comp_layer_config(comp, local_layer,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 143/379 drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 44b968d0d0868b7a9b7a5c64464ada464ff4d532 ]
cdn_dp_audio_codec_init() can fail. So add some error handling.
If component_add() fails, the previous cdn_dp_audio_codec_init() call should be undone, as already done in the remove function.
--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/cdn-dp-core.c +13 -2
@@ -1178,6 +1178,7 @@ static int cdn_dp_probe(struct platform_device *pdev)struct cdn_dp_device *dp;struct extcon_dev *extcon;struct phy *phy; +int ret;int i; dp =devm_kzalloc (dev,sizeof (*dp),GFP_KERNEL );
@@ -1218,9 +1219,19 @@ static int cdn_dp_probe(struct platform_device *pdev)mutex_init (&dp->lock);dev_set_drvdata (dev, dp); -cdn_dp_audio_codec_init (dp, dev); + ret =cdn_dp_audio_codec_init (dp, dev); +if (ret) +return ret; + + ret =component_add (dev, &cdn_dp_component_ops); +if (ret) + goto err_audio_deinit; -return component_add (dev, &cdn_dp_component_ops); +return 0 ; + +err_audio_deinit: +platform_device_unregister (dp->audio_pdev); +return ret; }static int cdn_dp_remove (struct platform_device *pdev)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 144/379 gpu: host1x: Correct allocated size for contexts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johnny Liu <[email protected]>
[ Upstream commit e889a311f74f4ae8bd40755a2c58d02e1c684fef ]
Original implementation over allocates the memory size for the contexts list. The size of memory for the contexts list is based on the number of iommu groups specified in the device tree.
--- drivers/gpu/host1x/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/host1x/context.c +2 -2
@@ -34,10 +34,10 @@ int host1x_memory_context_list_init(struct host1x *host1x)if (err <0 )return 0 ; - cdl->devs =kcalloc (err,sizeof (*cdl->devs),GFP_KERNEL ); + cdl->len = err /4 ; + cdl->devs =kcalloc (cdl->len,sizeof (*cdl->devs),GFP_KERNEL );if (!cdl->devs)return -ENOMEM ; - cdl->len = err /4 ;for (i =0 ; i < cdl->len; i++) {struct iommu_fwspec *fwspec;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 145/379 drm/bridge: lt9611uxc: fix the race in the error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 15fe53be46eaf4f6339cd433972ecc90513e3076 ]
If DSI host attachment fails, the LT9611UXC driver will remove the bridge without ensuring that there is no outstanding HPD work being done. In rare cases this can result in the warnings regarding the mutex being incorrect. Fix this by forcebly freing IRQ and flushing the work.
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: CPU: 0 PID: 10 at kernel/locking/mutex.c:582 __mutex_lock+0x468/0x77c Modules linked in: CPU: 0 PID: 10 Comm: kworker/0:1 Tainted: G U 6.6.0-rc5-next-20231011-gd81f81c2b682-dirty #1206 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) Workqueue: events lt9611uxc_hpd_work pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __mutex_lock+0x468/0x77c lr : __mutex_lock+0x468/0x77c
sp : ffff8000800a3c70
x29: ffff8000800a3c70 x28: 0000000000000000 x27: ffffd595fe333000
x26: ffff7c2f0002c005 x25: ffffd595ff1b3000 x24: ffffd595fccda5a0
x23: 0000000000000000 x22: 0000000000000002 x21: ffff7c2f056d91c8
x20: 0000000000000000 x19: ffff7c2f056d91c8 x18: fffffffffffe8db0
x17: 000000040044ffff x16: 005000f2b5503510 x15: 0000000000000000
x14: 000000000006efb8 x13: 0000000000000000 x12: 0000000000000037
x11: 0000000000000001 x10: 0000000000001470 x9 : ffff8000800a3ae0 x8 : ffff7c2f0027f8d0 x7 : ffff7c2f0027e400 x6 : ffffd595fc702b54 x5 : 0000000000000000 x4 : ffff8000800a0000 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff7c2f0027e400
Call trace: __mutex_lock+0x468/0x77c mutex_lock_nested+0x24/0x30 drm_bridge_hpd_notify+0x2c/0x5c lt9611uxc_hpd_work+0x6c/0x80 process_one_work+0x1ec/0x51c worker_thread+0x1ec/0x3e4 kthread+0x120/0x124 ret_from_fork+0x10/0x20 irq event stamp: 15799 hardirqs last enabled at (15799): [<ffffd595fc702ba4>] finish_task_switch.isra.0+0xa8/0x278 hardirqs last disabled at (15798): [<ffffd595fd5a1580>] __schedule+0x7b8/0xbd8 softirqs last enabled at (15794): [<ffffd595fc690698>] __do_softirq+0x498/0x4e0 softirqs last disabled at (15771): [<ffffd595fc69615c>] ____do_softirq+0x10/0x1c
--- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611uxc.c +6 -4
@@ -928,9 +928,9 @@ static int lt9611uxc_probe(struct i2c_client *client,init_waitqueue_head (<9611uxc->wq);INIT_WORK (<9611uxc->work, lt9611uxc_hpd_work); - ret =devm_request_threaded_irq (dev, client->irq,NULL , - lt9611uxc_irq_thread_handler, -IRQF_ONESHOT ,"lt9611uxc" , lt9611uxc); + ret =request_threaded_irq (client->irq,NULL , + lt9611uxc_irq_thread_handler, +IRQF_ONESHOT ,"lt9611uxc" , lt9611uxc);if (ret) {dev_err (dev,"failed to request irq\n" ); goto err_disable_regulators;
@@ -966,6 +966,8 @@ static int lt9611uxc_probe(struct i2c_client *client,return lt9611uxc_audio_init (dev, lt9611uxc); err_remove_bridge: +free_irq (client->irq, lt9611uxc); +cancel_work_sync (<9611uxc->work);drm_bridge_remove (<9611uxc->bridge); err_disable_regulators:
@@ -982,7 +984,7 @@ static void lt9611uxc_remove(struct i2c_client *client) {struct lt9611uxc *lt9611uxc =i2c_get_clientdata (client); -disable_irq (client->irq); +free_irq (client->irq, lt9611uxc);cancel_work_sync (<9611uxc->work);lt9611uxc_audio_exit (lt9611uxc);drm_bridge_remove (<9611uxc->bridge);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 146/379 arm64/arm: xen: enlighten: Fix KPTI checks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
[ Upstream commit 20f3b8eafe0ba5d3c69d5011a9b07739e9645132 ]
When KPTI is in use, we cannot register a runstate region as XEN requires that this is always a valid VA, which we cannot guarantee. Due to this, xen_starting_cpu() must avoid registering each CPU's runstate region, and xen_guest_init() must avoid setting up features that depend upon it.
We tried to ensure that in commit:
f88af7229f6f22ce (" xen/arm: do not setup the runstate info page if kpti is enabled")
... where we added checks for xen_kernel_unmapped_at_usr(), which wraps arm64_kernel_unmapped_at_el0() on arm64 and is always false on 32-bit arm.
Unfortunately, as xen_guest_init() is an early_initcall, this happens before secondary CPUs are booted and arm64 has finalized the ARM64_UNMAP_KERNEL_AT_EL0 cpucap which backs arm64_kernel_unmapped_at_el0(), and so this can subsequently be set as secondary CPUs are onlined. On a big.LITTLE system where the boot CPU does not require KPTI but some secondary CPUs do, this will result in xen_guest_init() intializing features that depend on the runstate region, and xen_starting_cpu() registering the runstate region on some CPUs before KPTI is subsequent enabled, resulting the the problems the aforementioned commit tried to avoid.
Handle this more robsutly by deferring the initialization of the runstate region until secondary CPUs have been initialized and the ARM64_UNMAP_KERNEL_AT_EL0 cpucap has been finalized. The per-cpu work is moved into a new hotplug starting function which is registered later when we're certain that KPTI will not be used.
--- arch/arm/xen/enlighten.c | 25 ++++++++++++++++--------- include/linux/cpuhotplug.h | 1 + 2 files changed, 17 insertions(+), 9 deletions(-)
arch/arm/xen/enlighten.c +16 -9
@@ -164,9 +164,6 @@ static int xen_starting_cpu(unsigned int cpu)BUG_ON (err);per_cpu (xen_vcpu, cpu) = vcpup; -if (!xen_kernel_unmapped_at_usr ()) -xen_setup_runstate_info (cpu); - after_register_vcpu_info:enable_percpu_irq (xen_events_irq,0 );return 0 ;
@@ -523,9 +520,6 @@ static int __init xen_guest_init(void)return -EINVAL ; } -if (!xen_kernel_unmapped_at_usr ()) -xen_time_setup_guest (); -if (xen_initial_domain ())pvclock_gtod_register_notifier (&xen_pvclock_gtod_notifier);
@@ -535,7 +529,13 @@ static int __init xen_guest_init(void) }early_initcall (xen_guest_init); -static int __init xen_pm_init (void ) +static int xen_starting_runstate_cpu (unsigned int cpu) +{ +xen_setup_runstate_info (cpu); +return 0 ; +} + +static int __init xen_late_init (void ) {if (!xen_domain ())return -ENODEV ;
@@ -548,9 +548,16 @@ static int __init xen_pm_init(void)do_settimeofday64 (&ts); } -return 0 ; +if (xen_kernel_unmapped_at_usr ()) +return 0 ; + +xen_time_setup_guest (); + +return cpuhp_setup_state (CPUHP_AP_ARM_XEN_RUNSTATE_STARTING , +"arm/xen_runstate:starting" , + xen_starting_runstate_cpu,NULL ); } -late_initcall (xen_pm_init); +late_initcall (xen_late_init);/* empty stubs */
include/linux/cpuhotplug.h +1 -0
@@ -191,6 +191,7 @@ enum cpuhp_state {/* Must be the last timer callback */ CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_ARM_XEN_STARTING , +CPUHP_AP_ARM_XEN_RUNSTATE_STARTING ,CPUHP_AP_ARM_CORESIGHT_STARTING ,CPUHP_AP_ARM_CORESIGHT_CTI_STARTING , CPUHP_AP_ARM64_ISNDEP_STARTING,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 147/379 drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 6471da5ee311d53ef46eebcb7725bc94266cc0cf ]
The "ret" variable is declared as ssize_t and it can hold negative error codes but the "rk_obj->base.size" variable is type size_t. This means that when we compare them, they are both type promoted to size_t and the negative error code becomes a high unsigned value and is treated as success. Add a cast to fix this.
--- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +1 -1
@@ -39,7 +39,7 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj) ret =iommu_map_sgtable (private->domain, rk_obj->dma_addr, rk_obj->sgt, prot); -if (ret < rk_obj->base.size) { +if (ret < (ssize_t )rk_obj->base.size) {DRM_ERROR ("failed to map buffer: size=%zd request_size=%zd\n" , ret, rk_obj->base.size); ret = -ENOMEM ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 148/379 xenbus: fix error exit in xenbus_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 44961b81a9e9059b5c0443643915386db7035227 ]
In case an error occurs in xenbus_init(), xen_store_domain_type should be set to XS_UNKNOWN.
Fix one instance where this action is missing.
--- drivers/xen/xenbus/xenbus_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_probe.c +1 -1
@@ -1025,7 +1025,7 @@ static int __init xenbus_init(void)if (err <0 ) {pr_err ("xenstore_late_init couldn't bind irq err=%d\n" , err); -return err; + goto out_error; } xs_init_irq = err;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 149/379 xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Marczykowski-Górecki <[email protected]>
[ Upstream commit 2c269f42d0f382743ab230308b836ffe5ae9b2ae ]
Linux enables MSI-X before disabling INTx, but keeps MSI-X masked until the table is filled. Then it disables INTx just before clearing MASKALL bit. Currently this approach is rejected by xen-pciback. According to the PCIe spec, device cannot use INTx when MSI/MSI-X is enabled (in other words: enabling MSI/MSI-X implicitly disables INTx).
Change the logic to consider INTx disabled if MSI/MSI-X is enabled. This applies to three places:
- checking currently enabled interrupts type,
- transition to MSI/MSI-X - where INTx would be implicitly disabled,
- clearing INTx disable bit - which can be allowed even if MSI/MSI-X is enabled, as device should consider INTx disabled anyway in that case
--- drivers/xen/xen-pciback/conf_space.c | 19 +++++++++++------ .../xen/xen-pciback/conf_space_capability.c | 8 ++++++- drivers/xen/xen-pciback/conf_space_header.c | 21 +++---------------- 3 files changed, 23 insertions(+), 25 deletions(-)
drivers/xen/xen-pciback/conf_space.c +13 -6
@@ -288,12 +288,6 @@ int xen_pcibk_get_interrupt_type(struct pci_dev *dev)u16 val;int ret =0 ; - err =pci_read_config_word (dev,PCI_COMMAND , &val); -if (err) -return err; -if (!(val &PCI_COMMAND_INTX_DISABLE )) - ret |=INTERRUPT_TYPE_INTX ; -/* * Do not trust dev->msi(x)_enabled here, as enabling could be done * bypassing the pci_*msi* functions, by the qemu.
@@ -316,6 +310,19 @@ int xen_pcibk_get_interrupt_type(struct pci_dev *dev)if (val &PCI_MSIX_FLAGS_ENABLE ) ret |=INTERRUPT_TYPE_MSIX ; } + +/* +* PCIe spec says device cannot use INTx if MSI/MSI-X is enabled, +* so check for INTx only when both are disabled. +*/ +if (!ret) { + err =pci_read_config_word (dev,PCI_COMMAND , &val); +if (err) +return err; +if (!(val &PCI_COMMAND_INTX_DISABLE )) + ret |=INTERRUPT_TYPE_INTX ; + } +return ret ?:INTERRUPT_TYPE_NONE ; }
drivers/xen/xen-pciback/conf_space_capability.c +7 -1
@@ -236,10 +236,16 @@ static int msi_msix_flags_write(struct pci_dev *dev, int offset, u16 new_value,return PCIBIOS_SET_FAILED ;if (new_value & field_config->enable_bit) { -/* don't allow enabling together with other interrupt types */ +/* +* Don't allow enabling together with other interrupt type, but do +* allow enabling MSI(-X) while INTx is still active to please Linuxes +* MSI(-X) startup sequence. It is safe to do, as according to PCI +* spec, device with enabled MSI(-X) shouldn't use INTx. +*/ int int_type =xen_pcibk_get_interrupt_type (dev);if (int_type ==INTERRUPT_TYPE_NONE || + int_type ==INTERRUPT_TYPE_INTX || int_type == field_config->int_type) goto write;return PCIBIOS_SET_FAILED ;
drivers/xen/xen-pciback/conf_space_header.c +3 -18
@@ -104,24 +104,9 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)pci_clear_mwi (dev); } -if (dev_data && dev_data->allow_interrupt_control) { -if ((cmd->val ^ value) &PCI_COMMAND_INTX_DISABLE ) { -if (value &PCI_COMMAND_INTX_DISABLE ) { -pci_intx (dev,0 ); - }else { -/* Do not allow enabling INTx together with MSI or MSI-X. */ -switch (xen_pcibk_get_interrupt_type (dev)) { -case INTERRUPT_TYPE_NONE : -pci_intx (dev,1 ); -break ; -case INTERRUPT_TYPE_INTX : -break ; -default : -return PCIBIOS_SET_FAILED ; - } - } - } - } +if (dev_data && dev_data->allow_interrupt_control && + ((cmd->val ^ value) &PCI_COMMAND_INTX_DISABLE )) +pci_intx (dev, !(value &PCI_COMMAND_INTX_DISABLE )); cmd->val = value;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 150/379 drm/msm/dsi: use msm_gem_kernel_put to free TX buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 69b321b2c3df4f7e51a9de587e41f324b0b717b0 ]
Use exiting function to free the allocated GEM object instead of open-coding it. This has a bonus of internally calling msm_gem_put_vaddr() to compensate for msm_gem_get_vaddr() in msm_get_kernel_new().
Patchwork: https://patchwork.freedesktop.org/patch/562239/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -2
@@ -1173,8 +1173,7 @@ static void dsi_tx_buf_free(struct msm_dsi_host *msm_host) priv = dev->dev_private;if (msm_host->tx_gem_obj) { -msm_gem_unpin_iova (msm_host->tx_gem_obj, priv->kms->aspace); -drm_gem_object_put (msm_host->tx_gem_obj); +msm_gem_kernel_put (msm_host->tx_gem_obj, priv->kms->aspace); msm_host->tx_gem_obj =NULL ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 151/379 drm/msm/dsi: free TX buffer in unbind
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 5e05be78264594634860087953649487f486ffcc ]
If the drm/msm init code gets an error during output modeset initialisation, the kernel will report an error regarding DRM memory manager not being clean during shutdown. This is because msm_dsi_modeset_init() allocates a piece of GEM memory for the TX buffer, but destruction of the buffer happens only at msm_dsi_host_destroy(), which is called during DSI driver's remove() time, much later than the DRM MM shutdown.
To solve this issue, move the TX buffer destruction to dsi_unbind(), so that the buffer is destructed at the correct time. Note, we also have to store a reference to the address space, because priv->kms->aspace is cleared before components are unbound.
Patchwork: https://patchwork.freedesktop.org/patch/562238/
--- drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi.h | 1 + drivers/gpu/drm/msm/dsi/dsi_host.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.c +1 -0
@@ -127,6 +127,7 @@ static void dsi_unbind(struct device *dev, struct device *master,struct msm_drm_private *priv =dev_get_drvdata (master);struct msm_dsi *msm_dsi =dev_get_drvdata (dev); +msm_dsi_tx_buf_free (msm_dsi->host); priv->dsi[msm_dsi->id] =NULL ; }
drivers/gpu/drm/msm/dsi/dsi.h +1 -0
@@ -123,6 +123,7 @@ int dsi_tx_buf_alloc_v2(struct msm_dsi_host *msm_host, int size);void *dsi_tx_buf_get_6g (struct msm_dsi_host *msm_host);void *dsi_tx_buf_get_v2 (struct msm_dsi_host *msm_host);void dsi_tx_buf_put_6g (struct msm_dsi_host *msm_host); +void msm_dsi_tx_buf_free (struct mipi_dsi_host *mipi_host);int dsi_dma_base_get_6g (struct msm_dsi_host *msm_host,uint64_t *iova);int dsi_dma_base_get_v2 (struct msm_dsi_host *msm_host,uint64_t *iova);int dsi_clk_init_v2 (struct msm_dsi_host *msm_host);
drivers/gpu/drm/msm/dsi/dsi_host.c +9 -6
@@ -149,6 +149,7 @@ struct msm_dsi_host {/* DSI 6G TX buffer*/ struct drm_gem_object *tx_gem_obj; +struct msm_gem_address_space *aspace;/* DSI v2 TX buffer */ void *tx_buf;
@@ -1127,8 +1128,10 @@ int dsi_tx_buf_alloc_6g(struct msm_dsi_host *msm_host, int size)uint64_t iova;u8 *data; + msm_host->aspace =msm_gem_address_space_get (priv->kms->aspace); + data =msm_gem_kernel_new (dev, size,MSM_BO_WC , - priv->kms->aspace, + msm_host->aspace, &msm_host->tx_gem_obj, &iova);if (IS_ERR (data)) {
@@ -1157,10 +1160,10 @@ int dsi_tx_buf_alloc_v2(struct msm_dsi_host *msm_host, int size)return 0 ; } -static void dsi_tx_buf_free (struct msm_dsi_host *msm_host) +void msm_dsi_tx_buf_free (struct mipi_dsi_host *host) { +struct msm_dsi_host *msm_host =to_msm_dsi_host (host);struct drm_device *dev = msm_host->dev; -struct msm_drm_private *priv;/* * This is possible if we're tearing down before we've had a chance to
@@ -1171,10 +1174,11 @@ static void dsi_tx_buf_free(struct msm_dsi_host *msm_host)if (!dev)return ; - priv = dev->dev_private;if (msm_host->tx_gem_obj) { -msm_gem_kernel_put (msm_host->tx_gem_obj, priv->kms->aspace); +msm_gem_kernel_put (msm_host->tx_gem_obj, msm_host->aspace); +msm_gem_address_space_put (msm_host->aspace); msm_host->tx_gem_obj =NULL ; + msm_host->aspace =NULL ; }if (msm_host->tx_buf)
@@ -2013,7 +2017,6 @@ void msm_dsi_host_destroy(struct mipi_dsi_host *host)struct msm_dsi_host *msm_host =to_msm_dsi_host (host);DBG ("" ); -dsi_tx_buf_free (msm_host);if (msm_host->workqueue) {destroy_workqueue (msm_host->workqueue); msm_host->workqueue =NULL ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 152/379 clocksource/drivers/arm_arch_timer: limit XGene-1 workaround
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Przywara <[email protected]>
[ Upstream commit 851354cbd12bb9500909733c3d4054306f61df87 ]
The AppliedMicro XGene-1 CPU has an erratum where the timer condition would only consider TVAL, not CVAL. We currently apply a workaround when seeing the PartNum field of MIDR_EL1 being 0x000, under the assumption that this would match only the XGene-1 CPU model.
However even the Ampere eMAG (aka XGene-3) uses that same part number, and only differs in the "Variant" and "Revision" fields: XGene-1's MIDR is 0x500f0000, our eMAG reports 0x503f0002. Experiments show the latter doesn't show the faulty behaviour.
Increase the specificity of the check to only consider partnum 0x000 and variant 0x00, to exclude the Ampere eMAG.
--- arch/arm64/include/asm/cputype.h | 3 ++- arch/arm64/kvm/guest.c | 2 +- drivers/clocksource/arm_arch_timer.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-)
arch/arm64/include/asm/cputype.h +2 -1
@@ -85,7 +85,8 @@#define ARM_CPU_PART_NEOVERSE_N2 0xD49#define ARM_CPU_PART_CORTEX_A78C 0xD4B -#define APM_CPU_PART_POTENZA 0x000 +#define APM_CPU_PART_XGENE 0x000 +#define APM_CPU_VAR_POTENZA 0x00#define CAVIUM_CPU_PART_THUNDERX 0x0A1#define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2
arch/arm64/kvm/guest.c +1 -1
@@ -863,7 +863,7 @@ u32 __attribute_const__ kvm_target_cpu(void)break ;case ARM_CPU_IMP_APM :switch (part_number) { -case APM_CPU_PART_POTENZA : +case APM_CPU_PART_XGENE :return KVM_ARM_TARGET_XGENE_POTENZA ; }break ;
drivers/clocksource/arm_arch_timer.c +3 -2
@@ -817,8 +817,9 @@ static u64 __arch_timer_check_delta(void)* Note that TVAL is signed, thus has only 31 of its * 32 bits to express magnitude. */ - MIDR_ALL_VERSIONS(MIDR_CPU_MODEL(ARM_CPU_IMP_APM, - APM_CPU_PART_POTENZA)), +MIDR_REV_RANGE (MIDR_CPU_MODEL (ARM_CPU_IMP_APM , +APM_CPU_PART_XGENE ), + APM_CPU_VAR_POTENZA, 0x0, 0xf), {}, };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 153/379 drm: mediatek: mtk_dsi: Fix NO_EOT_PACKET settings/handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 5855d422a6f250f3518f43b49092c8e87a5e42be ]
Due to the initial confusion about MIPI_DSI_MODE_EOT_PACKET, properly renamed to MIPI_DSI_MODE_NO_EOT_PACKET, reflecting its actual meaning, both the DSI_TXRX_CON register setting for bit (HSTX_)DIS_EOT and the later calculation for horizontal sync-active (HSA), back (HBP) and front (HFP) porches got incorrect due to the logic being inverted.
This means that a number of settings were wrong because....:
- DSI_TXRX_CON register setting: bit (HSTX_)DIS_EOT should be set in order to disable the End of Transmission packet;
- Horizontal Sync and Back/Front porches: The delta used to calculate all of HSA, HBP and HFP should account for the additional EOT packet.
Before this change...
- Bit (HSTX_)DIS_EOT was being set when EOT packet was enabled;
- For HSA/HBP/HFP delta... all three were wrong, as words were added when EOT disabled, instead of when EOT packet enabled!
Invert the logic around flag MIPI_DSI_MODE_NO_EOT_PACKET in the MediaTek DSI driver to fix the aforementioned issues.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +2 -2
@@ -406,7 +406,7 @@ static void mtk_dsi_rxtx_control(struct mtk_dsi *dsi)if (dsi->mode_flags &MIPI_DSI_CLOCK_NON_CONTINUOUS ) tmp_reg |=HSTX_CKLP_EN ; -if (!(dsi->mode_flags &MIPI_DSI_MODE_NO_EOT_PACKET )) +if (dsi->mode_flags &MIPI_DSI_MODE_NO_EOT_PACKET ) tmp_reg |=DIS_EOT ;writel (tmp_reg, dsi->regs +DSI_TXRX_CTRL );
@@ -483,7 +483,7 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi) timing->da_hs_zero + timing->da_hs_exit +3 ; delta = dsi->mode_flags &MIPI_DSI_MODE_VIDEO_BURST ?18 :12 ; - delta += dsi->mode_flags &MIPI_DSI_MODE_NO_EOT_PACKET ?2 :0 ; + delta += dsi->mode_flags &MIPI_DSI_MODE_NO_EOT_PACKET ?0 :2 ; horizontal_frontporch_byte = vm->hfront_porch * dsi_tmp_buf_bpp; horizontal_front_back_byte = horizontal_frontporch_byte + horizontal_backporch_byte;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 154/379 drivers/perf: hisi: use cpuhp_state_remove_instance_nocalls() for hisi_hns3_pmu uninit process
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Chen <[email protected]>
[ Upstream commit 50b560783f7f71790bcf70e9e9855155fb0af8c1 ]
When tearing down a 'hisi_hns3' PMU, we mistakenly run the CPU hotplug callbacks after the device has been unregistered, leading to fireworks when we try to execute empty function callbacks within the driver:
| Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 | CPU: 0 PID: 15 Comm: cpuhp/0 Tainted: G W O 5.12.0-rc4+ #1 | Hardware name: , BIOS KpxxxFPGA 1P B600 V143 04/22/2021 | pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) | pc : perf_pmu_migrate_context+0x98/0x38c | lr : perf_pmu_migrate_context+0x94/0x38c | | Call trace: | perf_pmu_migrate_context+0x98/0x38c | hisi_hns3_pmu_offline_cpu+0x104/0x12c [hisi_hns3_pmu]
Use cpuhp_state_remove_instance_nocalls() instead of cpuhp_state_remove_instance() so that the notifiers don't execute after the PMU device has been unregistered.
--- drivers/perf/hisilicon/hns3_pmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/perf/hisilicon/hns3_pmu.c +4 -4
@@ -1556,8 +1556,8 @@ static int hns3_pmu_init_pmu(struct pci_dev *pdev, struct hns3_pmu *hns3_pmu) ret =perf_pmu_register (&hns3_pmu->pmu, hns3_pmu->pmu.name,-1 );if (ret) {pci_err (pdev,"failed to register perf PMU, ret = %d.\n" , ret); -cpuhp_state_remove_instance (CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE , - &hns3_pmu->node); +cpuhp_state_remove_instance_nocalls (CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE , + &hns3_pmu->node); }return ret;
@@ -1568,8 +1568,8 @@ static void hns3_pmu_uninit_pmu(struct pci_dev *pdev)struct hns3_pmu *hns3_pmu =pci_get_drvdata (pdev);perf_pmu_unregister (&hns3_pmu->pmu); -cpuhp_state_remove_instance (CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE , - &hns3_pmu->node); +cpuhp_state_remove_instance_nocalls (CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE , + &hns3_pmu->node); }static int hns3_pmu_init_dev (struct pci_dev *pdev)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 155/379 perf/arm-cmn: Revamp model detection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
[ Upstream commit 7819e05a0dceac20c5ff78ec9b252faf3b76b824 ]
CMN implements a set of CoreSight-format peripheral ID registers which in principle we should be able to use to identify the hardware. However so far we have avoided trying to use the part number field since the TRMs have all described it as "configuration dependent". It turns out, though, that this is a quirk of the documentation generation process, and in fact the part number should always be a stable well-defined field which we can trust.
To that end, revamp our model detection to rely less on ACPI/DT, and pave the way towards further using the hardware information as an identifier for userspace jevent metrics. This includes renaming the revision constants to maximise readability.
Stable-dep-of: e3e73f511c49 ("perf/arm-cmn: Fix DTC domain detection")
--- drivers/perf/arm-cmn.c | 145 ++++++++++++++++++++++++++--------------- 1 file changed, 93 insertions(+), 52 deletions(-)
drivers/perf/arm-cmn.c +93 -52
@@ -44,8 +44,11 @@#define CMN_MAX_DTMS (CMN_MAX_XPS + (CMN_MAX_DIMENSION - 1) * 4)/* The CFG node has various info besides the discovery tree */ -#define CMN_CFGM_PERIPH_ID_2 0x0010 -#define CMN_CFGM_PID2_REVISION GENMASK(7, 4) +#define CMN_CFGM_PERIPH_ID_01 0x0008 +#define CMN_CFGM_PID0_PART_0 GENMASK_ULL(7, 0) +#define CMN_CFGM_PID1_PART_1 GENMASK_ULL(35, 32) +#define CMN_CFGM_PERIPH_ID_23 0x0010 +#define CMN_CFGM_PID2_REVISION GENMASK_ULL(7, 4)#define CMN_CFGM_INFO_GLOBAL 0x900#define CMN_INFO_MULTIPLE_DTM_EN BIT_ULL(63)
@@ -186,6 +189,7 @@#define CMN_WP_DOWN 2 +/* Internal values for encoding event support */ enum cmn_model {CMN600 =1 ,CMN650 =2 ,
@@ -197,26 +201,34 @@ enum cmn_model { CMN_650ON = CMN650 | CMN700, }; +/* Actual part numbers and revision IDs defined by the hardware */ +enum cmn_part { +PART_CMN600 =0x434 , +PART_CMN650 =0x436 , +PART_CMN700 =0x43c , +PART_CI700 =0x43a , +}; +/* CMN-600 r0px shouldn't exist in silicon, thankfully */ enum cmn_revision { -CMN600_R1P0 , -CMN600_R1P1 , -CMN600_R1P2 , -CMN600_R1P3 , -CMN600_R2P0 , -CMN600_R3P0 , -CMN600_R3P1 , -CMN650_R0P0 =0 , -CMN650_R1P0 , -CMN650_R1P1 , -CMN650_R2P0 , -CMN650_R1P2 , -CMN700_R0P0 =0 , -CMN700_R1P0 , -CMN700_R2P0 , -CI700_R0P0 =0 , -CI700_R1P0 , -CI700_R2P0 , +REV_CMN600_R1P0 , +REV_CMN600_R1P1 , +REV_CMN600_R1P2 , +REV_CMN600_R1P3 , +REV_CMN600_R2P0 , +REV_CMN600_R3P0 , +REV_CMN600_R3P1 , +REV_CMN650_R0P0 =0 , +REV_CMN650_R1P0 , +REV_CMN650_R1P1 , +REV_CMN650_R2P0 , +REV_CMN650_R1P2 , +REV_CMN700_R0P0 =0 , +REV_CMN700_R1P0 , +REV_CMN700_R2P0 , +REV_CI700_R0P0 =0 , +REV_CI700_R1P0 , +REV_CI700_R2P0 , };enum cmn_node_type {
@@ -306,7 +318,7 @@ struct arm_cmn {unsigned int state;enum cmn_revision rev; -enum cmn_model model; +enum cmn_part part;u8 mesh_x;u8 mesh_y;u16 num_xps;
@@ -394,19 +406,35 @@ static struct arm_cmn_node *arm_cmn_node(const struct arm_cmn *cmn,return NULL ; } +static enum cmn_model arm_cmn_model (const struct arm_cmn *cmn) +{ +switch (cmn->part) { +case PART_CMN600 : +return CMN600 ; +case PART_CMN650 : +return CMN650 ; +case PART_CMN700 : +return CMN700 ; +case PART_CI700 : +return CI700 ; +default : +return 0 ; + }; +} +static u32 arm_cmn_device_connect_info (const struct arm_cmn *cmn,const struct arm_cmn_node *xp,int port) {int offset =CMN_MXP__CONNECT_INFO (port);if (port >=2 ) { -if (cmn->model & (CMN600 |CMN650 )) +if (cmn->part ==PART_CMN600 || cmn->part ==PART_CMN650 )return 0 ;/* * CI-700 may have extra ports, but still has the * mesh_port_connect_info registers in the way. */ -if (cmn->model ==CI700 ) +if (cmn->part ==PART_CI700 ) offset +=CI700_CONNECT_INFO_P2_5_OFFSET ; }
@@ -640,7 +668,7 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj, eattr =container_of (attr,typeof (*eattr), attr.attr); -if (!(eattr->model & cmn->model)) +if (!(eattr->model &arm_cmn_model (cmn)))return 0 ; type = eattr->type;
@@ -658,7 +686,7 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj,if ((intf &4 ) && !(cmn->ports_used &BIT (intf &3 )))return 0 ; -if (chan ==4 && cmn->model ==CMN600 ) +if (chan ==4 && cmn->part ==PART_CMN600 )return 0 ; if ((chan == 5 && cmn->rsp_vc_num < 2) ||
@@ -669,19 +697,19 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj, }/* Revision-specific differences */ -if (cmn->model ==CMN600 ) { -if (cmn->rev <CMN600_R1P3 ) { +if (cmn->part ==PART_CMN600 ) { +if (cmn->rev <REV_CMN600_R1P3 ) {if (type ==CMN_TYPE_CXRA && eventid >0x10 )return 0 ; } -if (cmn->rev <CMN600_R1P2 ) { +if (cmn->rev <REV_CMN600_R1P2 ) {if (type ==CMN_TYPE_HNF && eventid ==0x1b )return 0 ;if (type ==CMN_TYPE_CXRA || type ==CMN_TYPE_CXHA )return 0 ; } - }else if (cmn->model ==CMN650 ) { -if (cmn->rev <CMN650_R2P0 || cmn->rev ==CMN650_R1P2 ) { + }else if (cmn->part ==PART_CMN650 ) { +if (cmn->rev <REV_CMN650_R2P0 || cmn->rev ==REV_CMN650_R1P2 ) {if (type ==CMN_TYPE_HNF && eventid >0x22 )return 0 ;if (type ==CMN_TYPE_SBSX && eventid ==0x17 )
@@ -689,8 +717,8 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj,if (type ==CMN_TYPE_RNI && eventid >0x10 )return 0 ; } - }else if (cmn->model ==CMN700 ) { -if (cmn->rev <CMN700_R2P0 ) { + }else if (cmn->part ==PART_CMN700 ) { +if (cmn->rev <REV_CMN700_R2P0 ) {if (type ==CMN_TYPE_HNF && eventid >0x2c )return 0 ;if (type ==CMN_TYPE_CCHA && eventid >0x74 )
@@ -698,7 +726,7 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj,if (type ==CMN_TYPE_CCLA && eventid >0x27 )return 0 ; } -if (cmn->rev <CMN700_R1P0 ) { +if (cmn->rev <REV_CMN700_R1P0 ) {if (type ==CMN_TYPE_HNF && eventid >0x2b )return 0 ; }
@@ -1200,7 +1228,7 @@ static u32 arm_cmn_wp_config(struct perf_event *event)u32 grp =CMN_EVENT_WP_GRP (event);u32 exc =CMN_EVENT_WP_EXCLUSIVE (event);u32 combine =CMN_EVENT_WP_COMBINE (event); -bool is_cmn600 =to_cmn (event->pmu)->model ==CMN600 ; +bool is_cmn600 =to_cmn (event->pmu)->part ==PART_CMN600 ; config =FIELD_PREP (CMN_DTM_WPn_CONFIG_WP_DEV_SEL, dev) | FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_CHN_SEL, chn) |
@@ -1520,14 +1548,14 @@ static int arm_cmn_validate_group(struct arm_cmn *cmn, struct perf_event *event)return ret; } -static enum cmn_filter_select arm_cmn_filter_sel (enum cmn_model model, +static enum cmn_filter_select arm_cmn_filter_sel (const struct arm_cmn *cmn,enum cmn_node_type type,unsigned int eventid) {struct arm_cmn_event_attr *e; -int i; +enum cmn_model model =arm_cmn_model (cmn); -for (i =0 ; i <ARRAY_SIZE (arm_cmn_event_attrs) -1 ; i++) { +for (int i =0 ; i <ARRAY_SIZE (arm_cmn_event_attrs) -1 ; i++) { e =container_of (arm_cmn_event_attrs[i],typeof (*e), attr.attr);if (e->model & model && e->type == type && e->eventid == eventid)return e->fsel;
@@ -1570,12 +1598,12 @@ static int arm_cmn_event_init(struct perf_event *event)/* ...but the DTM may depend on which port we're watching */ if (cmn->multi_dtm) hw->dtm_offset =CMN_EVENT_WP_DEV_SEL (event) /2 ; - }else if (type ==CMN_TYPE_XP && cmn->model ==CMN700 ) { + }else if (type ==CMN_TYPE_XP && cmn->part ==PART_CMN700 ) { hw->wide_sel = true; }/* This is sufficiently annoying to recalculate, so cache it */ - hw->filter_sel =arm_cmn_filter_sel (cmn->model, type, eventid); + hw->filter_sel =arm_cmn_filter_sel (cmn, type, eventid); bynodeid =CMN_EVENT_BYNODEID (event); nodeid =CMN_EVENT_NODEID (event);
@@ -2006,6 +2034,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)void __iomem *cfg_region;struct arm_cmn_node cfg, *dn;struct arm_cmn_dtm *dtm; +enum cmn_part part;u16 child_count, child_poff;u32 xp_offset[CMN_MAX_XPS ];u64 reg;
@@ -2017,7 +2046,19 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)return -ENODEV ; cfg_region = cmn->base + rgn_offset; - reg =readl_relaxed (cfg_region +CMN_CFGM_PERIPH_ID_2 ); + + reg =readq_relaxed (cfg_region +CMN_CFGM_PERIPH_ID_01 ); + part =FIELD_GET (CMN_CFGM_PID0_PART_0 , reg); + part |=FIELD_GET (CMN_CFGM_PID1_PART_1 , reg) <<8 ; +if (cmn->part && cmn->part != part) +dev_warn (cmn->dev, +"Firmware binding mismatch: expected part number 0x%x, found 0x%x\n" , + cmn->part, part); + cmn->part = part; +if (!arm_cmn_model (cmn)) +dev_warn (cmn->dev,"Unknown part number: 0x%x\n" , part); + + reg =readl_relaxed (cfg_region +CMN_CFGM_PERIPH_ID_23 ); cmn->rev =FIELD_GET (CMN_CFGM_PID2_REVISION , reg); reg =readq_relaxed (cfg_region +CMN_CFGM_INFO_GLOBAL );
@@ -2081,7 +2122,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)if (xp->id == (1 <<3 )) cmn->mesh_x = xp->logid; -if (cmn->model ==CMN600 ) +if (cmn->part ==PART_CMN600 ) xp->dtc =0xf ;else xp->dtc =1 <<readl_relaxed (xp_region +CMN_DTM_UNIT_INFO );
@@ -2201,7 +2242,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)if (cmn->num_xps ==1 )dev_warn (cmn->dev,"1x1 config not fully supported, translate XP events manually\n" ); -dev_dbg (cmn->dev,"model %d, periph_id_2 revision %d\n" , cmn->model, cmn->rev); +dev_dbg (cmn->dev,"periph_id part 0x%03x revision %d\n" , cmn->part, cmn->rev); reg = cmn->ports_used; dev_dbg(cmn->dev, "mesh %dx%d, ID width %d, ports %6pbl%s\n", cmn->mesh_x, cmn->mesh_y, arm_cmn_xyidbits(cmn), ®,
@@ -2256,17 +2297,17 @@ static int arm_cmn_probe(struct platform_device *pdev)return -ENOMEM ; cmn->dev = &pdev->dev; - cmn->model = (unsigned long )device_get_match_data (cmn->dev); + cmn->part = (unsigned long )device_get_match_data (cmn->dev);platform_set_drvdata (pdev, cmn); -if (cmn->model ==CMN600 &&has_acpi_companion (cmn->dev)) { +if (cmn->part ==PART_CMN600 &&has_acpi_companion (cmn->dev)) { rootnode =arm_cmn600_acpi_probe (pdev, cmn); }else { rootnode =0 ; cmn->base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (cmn->base))return PTR_ERR (cmn->base); -if (cmn->model ==CMN600 ) +if (cmn->part ==PART_CMN600 ) rootnode =arm_cmn600_of_probe (pdev->dev.of_node); }if (rootnode <0 )
@@ -2335,10 +2376,10 @@ static int arm_cmn_remove(struct platform_device *pdev)#ifdef CONFIG_OF static const struct of_device_id arm_cmn_of_match[] = { - { .compatible ="arm,cmn-600" , .data = (void *)CMN600 }, - { .compatible ="arm,cmn-650" , .data = (void *)CMN650 }, - { .compatible ="arm,cmn-700" , .data = (void *)CMN700 }, - { .compatible ="arm,ci-700" , .data = (void *)CI700 }, + { .compatible ="arm,cmn-600" , .data = (void *)PART_CMN600 }, + { .compatible ="arm,cmn-650" }, + { .compatible ="arm,cmn-700" }, + { .compatible ="arm,ci-700" }, {} };MODULE_DEVICE_TABLE (of, arm_cmn_of_match);
@@ -2346,9 +2387,9 @@ MODULE_DEVICE_TABLE(of, arm_cmn_of_match);#ifdef CONFIG_ACPI static const struct acpi_device_id arm_cmn_acpi_match[] = { - {"ARMHC600" ,CMN600 }, - {"ARMHC650" ,CMN650 }, - {"ARMHC700" ,CMN700 }, + {"ARMHC600" ,PART_CMN600 }, + {"ARMHC650" }, + {"ARMHC700" }, {} };MODULE_DEVICE_TABLE (acpi, arm_cmn_acpi_match);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 156/379 perf/arm-cmn: Fix DTC domain detection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
[ Upstream commit e3e73f511c49c741f6309862c2248958ad77bbaa ]
It transpires that dtm_unit_info is another register which got shuffled in CMN-700 without me noticing. Fix that in a way which also proactively fixes the fragile laziness of its consumer, just in case any further fields ever get added alongside dtc_domain.
--- drivers/perf/arm-cmn.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/perf/arm-cmn.c +14 -2
@@ -110,7 +110,9 @@#define CMN_DTM_PMEVCNTSR 0x240 -#define CMN_DTM_UNIT_INFO 0x0910 +#define CMN650_DTM_UNIT_INFO 0x0910 +#define CMN_DTM_UNIT_INFO 0x0960 +#define CMN_DTM_UNIT_INFO_DTC_DOMAIN GENMASK_ULL(1, 0)#define CMN_DTM_NUM_COUNTERS 4/* Want more local counters? Why not replicate the whole DTM! Ugh... */
@@ -1994,6 +1996,16 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn)return 0 ; } +static unsigned int arm_cmn_dtc_domain (struct arm_cmn *cmn,void __iomem *xp_region) +{ +int offset =CMN_DTM_UNIT_INFO ; + +if (cmn->part ==PART_CMN650 || cmn->part ==PART_CI700 ) + offset =CMN650_DTM_UNIT_INFO ; + +return FIELD_GET (CMN_DTM_UNIT_INFO_DTC_DOMAIN ,readl_relaxed (xp_region + offset)); +} +static void arm_cmn_init_node_info (struct arm_cmn *cmn,u32 offset,struct arm_cmn_node *node) {int level;
@@ -2125,7 +2137,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)if (cmn->part ==PART_CMN600 ) xp->dtc =0xf ;else - xp->dtc =1 <<readl_relaxed (xp_region +CMN_DTM_UNIT_INFO ); + xp->dtc =1 <<arm_cmn_dtc_domain (cmn, xp_region); xp->dtm = dtm - cmn->dtms;arm_cmn_init_dtm (dtm++, xp,0 );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 157/379 drivers/perf: hisi_pcie: Check the type first in pmu::event_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yicong Yang <[email protected]>
[ Upstream commit 6d7d51e88e21c0af1ca96a3617afef334bfeffcf ]
Check whether the event type matches the PMU type firstly in pmu::event_init() before touching the event. Otherwise we'll change the events of others and lead to incorrect results. Since in perf_init_event() we may call every pmu's event_init() in a certain case, we should not modify the event if it's not ours.
--- drivers/perf/hisilicon/hisi_pcie_pmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/perf/hisilicon/hisi_pcie_pmu.c +4 -3
@@ -342,6 +342,10 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event)struct hisi_pcie_pmu *pcie_pmu =to_pcie_pmu (event->pmu);struct hw_perf_event *hwc = &event->hw; +/* Check the type first before going on, otherwise it's not our event */ +if (event->attr.type != event->pmu->type) +return -ENOENT ; + event->cpu = pcie_pmu->on_cpu;if (EXT_COUNTER_IS_USED (hisi_pcie_get_event (event)))
@@ -349,9 +353,6 @@ static int hisi_pcie_pmu_event_init(struct perf_event *event)else hwc->event_base =HISI_PCIE_CNT ; -if (event->attr.type != event->pmu->type) -return -ENOENT ; -/* Sampling is not supported. */ if (is_sampling_event (event) || event->attach_state &PERF_ATTACH_TASK )return -EOPNOTSUPP ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 158/379 perf: hisi: Fix use-after-free when register pmu fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junhao He <[email protected]>
[ Upstream commit b805cafc604bfdb671fae7347a57f51154afa735 ]
When we fail to register the uncore pmu, the pmu context may not been allocated. The error handing will call cpuhp_state_remove_instance() to call uncore pmu offline callback, which migrate the pmu context. Since that's liable to lead to some kind of use-after-free.
Use cpuhp_state_remove_instance_nocalls() instead of cpuhp_state_remove_instance() so that the notifiers don't execute after the PMU device has been failed to register.
--- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 4 ++-- drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +2 -2
@@ -416,8 +416,8 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev) ret =perf_pmu_register (&pa_pmu->pmu, name,-1 );if (ret) {dev_err (pa_pmu->dev,"PMU register failed, ret = %d\n" , ret); -cpuhp_state_remove_instance (CPUHP_AP_PERF_ARM_HISI_PA_ONLINE , - &pa_pmu->node); +cpuhp_state_remove_instance_nocalls (CPUHP_AP_PERF_ARM_HISI_PA_ONLINE , + &pa_pmu->node);return ret; }
drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c +2 -2
@@ -450,8 +450,8 @@ static int hisi_sllc_pmu_probe(struct platform_device *pdev) ret =perf_pmu_register (&sllc_pmu->pmu, name,-1 );if (ret) {dev_err (sllc_pmu->dev,"PMU register failed, ret = %d\n" , ret); -cpuhp_state_remove_instance (CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE , - &sllc_pmu->node); +cpuhp_state_remove_instance_nocalls (CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE , + &sllc_pmu->node);return ret; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 159/379 ARM: dts: renesas: blanche: Fix typo in GP_11_2 pin name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit edc6ef026fe69154bb6b70dd6e7f278cfd7d6919 ]
On blanche, the GPIO keyboard fails to probe with:
sh-pfc e6060000.pinctrl: could not map pin config for "GP_11_02"
Fix this by correcting the name for this pin to "GP_11_2".
--- arch/arm/boot/dts/r8a7792-blanche.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7792-blanche.dts +1 -1
@@ -239,7 +239,7 @@ du1_pins: du1 { }; keyboard_pins: keyboard { - pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_02"; + pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_2"; bias-pull-up; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 160/379 arm64: dts: qcom: sdm845: cheza doesnt support LMh node
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Heidelberg <[email protected]>
[ Upstream commit 197ae69d1caedb3203e0b189a39efb820675fd5c ]
Cheza firmware doesn't allow controlling LMh from the operating system.
--- arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +12 -0
@@ -145,6 +145,10 @@ panel_in_edp: endpoint { }; }; +&cpufreq_hw { + /delete-property/ interrupts-extended; /* reference to lmh_cluster[01] */ +}; + &psci { /delete-node/ cpu0; /delete-node/ cpu1;
@@ -277,6 +281,14 @@ &BIG_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; }; +&lmh_cluster0 { + status = "disabled"; +}; + +&lmh_cluster1 { + status = "disabled"; +}; + /* * Reserved memory changes *
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 161/379 arm64: dts: qcom: sc7280: link usb3_phy_wrapper_gcc_usb30_pipe_clk
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 70c4a1ca13b333b00e01266d299605fa1041b0d5 ]
Use usb_1_ssphy's clock as gcc's usb3_phy_wrapper_gcc_usb30_pipe_clk clock source.
--- arch/arm64/boot/dts/qcom/sc7280.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7280.dtsi +2 -1
@@ -820,7 +820,8 @@ gcc: clock-controller@100000 { clocks = <&rpmhcc RPMH_CXO_CLK>, <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, <0>, <&pcie1_lane>, - <0>, <0>, <0>, <0>; + <0>, <0>, <0>, + <&usb_1_ssphy>; clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk", "pcie_0_pipe_clk", "pcie_1_pipe_clk", "ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk",
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 162/379 arm64: dts: qcom: msm8916: Fix iommu local address range
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Kohli <[email protected]>
[ Upstream commit 2de8ee9f58fa51f707c71f8fbcd8470ab0078102 ]
Fix the apps iommu local address space range as per data sheet.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
@@ -1257,7 +1257,7 @@ apps_iommu: iommu@1ef0000 { #size-cells = <1>; #iommu-cells = <1>; compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; - ranges = <0 0x01e20000 0x40000>; + ranges = <0 0x01e20000 0x20000>; reg = <0x01ef0000 0x3000>; clocks = <&gcc GCC_SMMU_CFG_CLK>, <&gcc GCC_APSS_TCU_CLK>;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 163/379 arm64: dts: qcom: msm8992-libra: drop duplicated reserved memory
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f32096602c19e68fb9bf04b494d13f1190602554 ]
There are two entries for similar reserved memory: qseecom@cb400000 and audio@cb400000. Keep the qseecom as it is longer.
Warning (unique_unit_address_if_enabled): /reserved-memory/audio@cb400000: duplicate unit-address (also used in node /reserved-memory/qseecom@cb400000)
--- arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts | 5 ----- 1 file changed, 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts +0 -5
@@ -109,11 +109,6 @@ rmtfs_mem: rmtfs@ca100000 { qcom,client-id = <1>; }; - audio_mem: audio@cb400000 { - reg = <0 0xcb000000 0 0x400000>; - no-mem; - }; - qseecom_mem: qseecom@cb400000 { reg = <0 0xcb400000 0 0x1c00000>; no-mem;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 164/379 arm64: dts: qcom: sc7280: Add missing LMH interrupts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 3f93d119c9d6e1744d55cd48af764160a1a3aca3 ]
Hook up the interrupts that signal the Limits Management Hardware has started some sort of throttling action.
--- arch/arm64/boot/dts/qcom/sc7280.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/sc7280.dtsi +8 -0
@@ -5338,6 +5338,14 @@ cpufreq_hw: cpufreq@18591000 { reg = <0 0x18591000 0 0x1000>, <0 0x18592000 0 0x1000>, <0 0x18593000 0 0x1000>; + + interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "dcvsh-irq-0", + "dcvsh-irq-1", + "dcvsh-irq-2"; + clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_GPLL0>; clock-names = "xo", "alternate"; #freq-domain-cells = <1>;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 165/379 arm64: dts: qcom: sm8150: add ref clock to PCIe PHYs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit c204b3709409279ac019f3d374e444bb0b1424f0 ]
Follow the rest of the platforms and add "ref" clocks to both PCIe PHYs found on the Qualcomm SM8150 platform.
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +10 -2
@@ -1839,8 +1839,12 @@ pcie0_phy: phy@1c06000 { ranges; clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>, <&gcc GCC_PCIE_0_CFG_AHB_CLK>, + <&gcc GCC_PCIE_0_CLKREF_CLK>, <&gcc GCC_PCIE0_PHY_REFGEN_CLK>; - clock-names = "aux", "cfg_ahb", "refgen"; + clock-names = "aux", + "cfg_ahb", + "ref", + "refgen"; resets = <&gcc GCC_PCIE_0_PHY_BCR>; reset-names = "phy";
@@ -1938,8 +1942,12 @@ pcie1_phy: phy@1c0e000 { ranges; clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>, <&gcc GCC_PCIE_1_CFG_AHB_CLK>, + <&gcc GCC_PCIE_1_CLKREF_CLK>, <&gcc GCC_PCIE1_PHY_REFGEN_CLK>; - clock-names = "aux", "cfg_ahb", "refgen"; + clock-names = "aux", + "cfg_ahb", + "ref", + "refgen"; resets = <&gcc GCC_PCIE_1_PHY_BCR>; reset-names = "phy";
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 166/379 arm64: dts: qcom: sm8350: fix pinctrl for UART18
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit c1efa960114f743924b884da098298512a7e9983 ]
On sm8350 QUP18 uses GPIO 68/69, not 58/59. Fix correponding UART18 pinconf configuraion.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +1 -1
@@ -1778,7 +1778,7 @@ qup_uart6_default: qup-uart6-default-state { }; qup_uart18_default: qup-uart18-default-state { - pins = "gpio58", "gpio59"; + pins = "gpio68", "gpio69"; function = "qup18"; drive-strength = <2>; bias-disable;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 167/379 arm64: dts: qcom: sdm845-mtp: fix WiFi configuration
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit b33868a52f342d9b1f20aa5bffe40cbd69bd0a4b ]
Enable the host-cap-8bit quirk on this device. It is required for the WiFi to function properly.
--- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-mtp.dts +2 -0
@@ -714,6 +714,8 @@ &wifi { vdd-1.8-xo-supply = <&vreg_l7a_1p8>; vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; + + qcom,snoc-host-cap-8bit-quirk; }; /* PINCTRL - additions to nodes defined in sdm845.dtsi */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 168/379 ARM64: dts: marvell: cn9310: Use appropriate label for spi1 pins
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Packham <[email protected]>
[ Upstream commit 0878fd86f554ab98aa493996c7e0c72dff58437f ]
Both the CN9130-CRB and CN9130-DB use the SPI1 interface but had the pinctrl node labelled as "cp0_spi0_pins". Use the label "cp0_spi1_pins" and update the node name to "cp0-spi-pins-1" to avoid confusion with the pinctrl options for SPI0.
--- arch/arm64/boot/dts/marvell/cn9130-crb.dtsi | 4 ++-- arch/arm64/boot/dts/marvell/cn9130-db.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/marvell/cn9130-crb.dtsi +2 -2
@@ -120,7 +120,7 @@ cp0_sdhci_pins: cp0-sdhi-pins-0 { "mpp59", "mpp60", "mpp61"; marvell,function = "sdio"; }; - cp0_spi0_pins: cp0-spi-pins-0 { + cp0_spi1_pins: cp0-spi-pins-1 { marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16"; marvell,function = "spi1"; };
@@ -170,7 +170,7 @@ &cp0_sdhci0 { &cp0_spi1 { pinctrl-names = "default"; - pinctrl-0 = <&cp0_spi0_pins>; + pinctrl-0 = <&cp0_spi1_pins>; reg = <0x700680 0x50>, /* control */ <0x2000000 0x1000000>; /* CS0 */ status = "okay";
arch/arm64/boot/dts/marvell/cn9130-db.dtsi +2 -2
@@ -307,7 +307,7 @@ &cp0_sdhci0 { &cp0_spi1 { status = "disabled"; pinctrl-names = "default"; - pinctrl-0 = <&cp0_spi0_pins>; + pinctrl-0 = <&cp0_spi1_pins>; reg = <0x700680 0x50>; flash@0 {
@@ -371,7 +371,7 @@ cp0_sdhci_pins: cp0-sdhi-pins-0 { "mpp59", "mpp60", "mpp61"; marvell,function = "sdio"; }; - cp0_spi0_pins: cp0-spi-pins-0 { + cp0_spi1_pins: cp0-spi-pins-1 { marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16"; marvell,function = "spi1"; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 169/379 arm64: dts: qcom: apq8016-sbc: Add missing ADV7533 regulators
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
[ Upstream commit 33e9032a1875bb1aee3c68a4540f5a577ff44130 ]
Add the missing regulator supplies to the ADV7533 HDMI bridge to fix the following dtbs_check warnings. They are all also supplied by pm8916_l6 so there is no functional difference.
apq8016-sbc.dtb: bridge@39: 'dvdd-supply' is a required property apq8016-sbc.dtb: bridge@39: 'pvdd-supply' is a required property apq8016-sbc.dtb: bridge@39: 'a2vdd-supply' is a required property
from schema display/bridge/adi,adv7533.yaml
--- arch/arm64/boot/dts/qcom/apq8016-sbc.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/apq8016-sbc.dts +3 -0
@@ -200,6 +200,9 @@ adv_bridge: bridge@39 { pd-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>; avdd-supply = <&pm8916_l6>; + a2vdd-supply = <&pm8916_l6>; + dvdd-supply = <&pm8916_l6>; + pvdd-supply = <&pm8916_l6>; v1p2-supply = <&pm8916_l6>; v3p3-supply = <&pm8916_l17>;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 170/379 ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 09f8ee81b6da5f76de8b83c8bfc4475b54e101e0 ]
Fixed regulator put under "regulators" node will not be populated, unless simple-bus or something similar is used. Drop the "regulators" wrapper node to fix this.
--- arch/arm/boot/dts/qcom-mdm9615.dtsi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
arch/arm/boot/dts/qcom-mdm9615.dtsi +6 -8
@@ -82,14 +82,12 @@ cxo_board { }; }; - regulators { - vsdcc_fixed: vsdcc-regulator { - compatible = "regulator-fixed"; - regulator-name = "SDCC Power"; - regulator-min-microvolt = <2700000>; - regulator-max-microvolt = <2700000>; - regulator-always-on; - }; + vsdcc_fixed: vsdcc-regulator { + compatible = "regulator-fixed"; + regulator-name = "SDCC Power"; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <2700000>; + regulator-always-on; }; soc: soc {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 171/379 soc: qcom: llcc: Handle a second device without data corruption
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit f1a1bc8775b26345aba2be278118999e7f661d3d ]
Usually there is only one llcc device. But if there were a second, even a failed probe call would modify the global drv_data pointer. So check if drv_data is valid before overwriting it.
--- drivers/soc/qcom/llcc-qcom.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/soc/qcom/llcc-qcom.c +3 -0
@@ -778,6 +778,9 @@ static int qcom_llcc_probe(struct platform_device *pdev)u32 version;struct regmap *regmap; +if (!IS_ERR (drv_data)) +return -EBUSY ; + drv_data =devm_kzalloc (dev,sizeof (*drv_data),GFP_KERNEL );if (!drv_data) { ret = -ENOMEM ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 172/379 kunit: Fix missed memory release in kunit_free_suite_set()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit a6074cf0126b0bee51ab77a15930dc24a4d5db90 ]
modprobe cpumask_kunit and rmmod cpumask_kunit, kmemleak detect a suspected memory leak as below.
If kunit_filter_suites() in kunit_module_init() succeeds, the suite_set.start will not be NULL and the kunit_free_suite_set() in kunit_module_exit() should free all the memory which has not been freed. However the test_cases in suites is left out.
unreferenced object 0xffff54ac47e83200 (size 512):
comm "modprobe", pid 592, jiffies 4294913238 (age 1367.612s) hex dump (first 32 bytes):
84 13 1a f0 d3 b6 ff ff 30 68 1a f0 d3 b6 ff ff ........0h......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000008dec63a2>] slab_post_alloc_hook+0xb8/0x368
[<00000000ec280d8e>] __kmem_cache_alloc_node+0x174/0x290
[<00000000896c7740>] __kmalloc+0x60/0x2c0
[<000000007a50fa06>] kunit_filter_suites+0x254/0x5b8
[<0000000078cc98e2>] kunit_module_notify+0xf4/0x240
[<0000000033cea952>] notifier_call_chain+0x98/0x17c
[<00000000973d05cc>] notifier_call_chain_robust+0x4c/0xa4
[<000000005f95895f>] blocking_notifier_call_chain_robust+0x4c/0x74
[<0000000048e36fa7>] load_module+0x1a2c/0x1c40
[<0000000004eb8a91>] init_module_from_file+0x94/0xcc
[<0000000037dbba28>] idempotent_init_module+0x184/0x278
[<00000000161b75cb>] __arm64_sys_finit_module+0x68/0xa8
[<000000006dc1669b>] invoke_syscall+0x44/0x100
[<00000000fa87e304>] el0_svc_common.constprop.1+0x68/0xe0
[<000000009d8ad866>] do_el0_svc+0x1c/0x28
[<000000005b83c607>] el0_svc+0x3c/0xc4--- lib/kunit/executor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/kunit/executor.c +3 -1
@@ -102,8 +102,10 @@ static void kunit_free_suite_set(struct suite_set suite_set) {struct kunit_suite *const *suites; -for (suites = suite_set.start; suites < suite_set.end; suites++) +for (suites = suite_set.start; suites < suite_set.end; suites++) { +kfree ((*suites)->test_cases);kfree (*suites); + }kfree (suite_set.start); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 173/379 firmware: ti_sci: Mark driver as non removable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhruva Gole <[email protected]>
[ Upstream commit 7b7a224b1ba1703583b25a3641ad9798f34d832a ]
The TI-SCI message protocol provides a way to communicate between various compute processors with a central system controller entity. It provides the fundamental device management capability and clock control in the SOCs that it's used in.
The remove function failed to do all the necessary cleanup if there are registered users. Some things are freed however which likely results in an oops later on.
Ensure that the driver isn't unbound by suppressing its bind and unbind sysfs attributes. As the driver is built-in there is no way to remove device once bound.
We can also remove the ti_sci_remove call along with the ti_sci_debugfs_destroy as there are no callers for it any longer.
--- drivers/firmware/ti_sci.c | 46 +-------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-)
drivers/firmware/ti_sci.c +1 -45
@@ -190,19 +190,6 @@ static int ti_sci_debugfs_create(struct platform_device *pdev, return 0; } -/** -* ti_sci_debugfs_destroy() - clean up log debug file -* @pdev: platform device pointer -* @info: Pointer to SCI entity information -*/ -static void ti_sci_debugfs_destroy (struct platform_device *pdev, -struct ti_sci_info *info) -{ -if (IS_ERR (info->debug_region)) -return ; - -debugfs_remove (info->d); -}#else /* CONFIG_DEBUG_FS */ static inline int ti_sci_debugfs_create (struct platform_device *dev,struct ti_sci_info *info)
@@ -3451,43 +3438,12 @@ static int ti_sci_probe(struct platform_device *pdev)return ret; } -static int ti_sci_remove (struct platform_device *pdev) -{ -struct ti_sci_info *info; -struct device *dev = &pdev->dev; -int ret =0 ; - -of_platform_depopulate (dev); - - info =platform_get_drvdata (pdev); - -if (info->nb.notifier_call) -unregister_restart_handler (&info->nb); - -mutex_lock (&ti_sci_list_mutex); -if (info->users) - ret = -EBUSY ; -else -list_del (&info->node); -mutex_unlock (&ti_sci_list_mutex); - -if (!ret) { -ti_sci_debugfs_destroy (pdev, info); - -/* Safe to free channels since no more users */ -mbox_free_channel (info->chan_tx); -mbox_free_channel (info->chan_rx); - } - -return ret; -} -static struct platform_driver ti_sci_driver = { .probe = ti_sci_probe, - .remove = ti_sci_remove, .driver = { .name ="ti-sci" , .of_match_table =of_match_ptr (ti_sci_of_match), + .suppress_bind_attrs = true, }, };module_platform_driver (ti_sci_driver);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 174/379 arm64: dts: ti: k3-am62a7-sk: Drop i2c-1 to 100Khz
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jai Luthra <[email protected]>
[ Upstream commit 63e5aa69b821472a3203a29e17c025329c1b151f ]
The TLV320AIC3106 audio codec is interfaced on the i2c-1 bus. With the default rate of 400Khz the i2c register writes fail to sync:
[ 36.026387] tlv320aic3x 1-001b: Unable to sync registers 0x16-0x16. -110 [ 38.101130] omap_i2c 20010000.i2c: controller timed out
Dropping the rate to 100Khz fixes the issue.
--- arch/arm64/boot/dts/ti/k3-am62a7-sk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62a7-sk.dts +1 -1
@@ -172,7 +172,7 @@ &main_i2c1 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&main_i2c1_pins_default>; - clock-frequency = <400000>; + clock-frequency = <100000>; exp1: gpio@22 { compatible = "ti,tca6424";
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 175/379 firmware: arm_ffa: Assign the missing IDR allocation ID to the FFA device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 7d0bc6360f17ea323ab25939a34857123d7d87e5 ]
Commit 19b8766459c4 ("firmware: arm_ffa: Fix FFA device names for logical partitions") added an ID to the FFA device using ida_alloc() and append the same to "arm-ffa" to make up a unique device name. However it missed to stash the id value in ffa_dev to help freeing the ID later when the device is destroyed.
Due to the missing/unassigned ID in FFA device, we get the following warning when the FF-A device is unregistered.
| ida_free called for id=0 which is not allocated. | WARNING: CPU: 7 PID: 1 at lib/idr.c:525 ida_free+0x114/0x164 | CPU: 7 PID: 1 Comm: swapper/0 Not tainted 6.6.0-rc4 #209 | pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) | pc : ida_free+0x114/0x164 | lr : ida_free+0x114/0x164 | Call trace: | ida_free+0x114/0x164 | ffa_release_device+0x24/0x3c | device_release+0x34/0x8c | kobject_put+0x94/0xf8 | put_device+0x18/0x24 | klist_devices_put+0x14/0x20 | klist_next+0xc8/0x114 | bus_for_each_dev+0xd8/0x144 | arm_ffa_bus_exit+0x30/0x54 | ffa_init+0x68/0x330 | do_one_initcall+0xdc/0x250 | do_initcall_level+0x8c/0xac | do_initcalls+0x54/0x94 | do_basic_setup+0x1c/0x28 | kernel_init_freeable+0x104/0x170 | kernel_init+0x20/0x1a0 | ret_from_fork+0x10/0x20
Fix the same by actually assigning the ID in the FFA device this time for real.
--- drivers/firmware/arm_ffa/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/arm_ffa/bus.c +1 -0
@@ -193,6 +193,7 @@ struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id, dev->release = ffa_release_device;dev_set_name (&ffa_dev->dev,"arm-ffa-%d" , id); + ffa_dev->id = id; ffa_dev->vm_id = vm_id; ffa_dev->ops = ops;uuid_copy (&ffa_dev->uuid, uuid);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 176/379 firmware: arm_ffa: Allow the FF-A drivers to use 32bit mode of messaging
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 2d698e8b4fd22374dac0a2d5150ab24d57a222ab ]
An FF-A ABI could support both the SMC32 and SMC64 conventions. A callee that runs in the AArch64 execution state and implements such an ABI must implement both SMC32 and SMC64 conventions of the ABI.
So the FF-A drivers will need the option to choose the mode irrespective of FF-A version and the partition execution mode flag in the partition information.
Let us remove the check on the FF-A version for allowing the selection of 32bit mode of messaging. The driver will continue to set the 32-bit mode if the partition execution mode flag specified that the partition supports only 32-bit execution.
--- drivers/firmware/arm_ffa/driver.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/firmware/arm_ffa/driver.c +2 -10
@@ -668,17 +668,9 @@ static int ffa_partition_info_get(const char *uuid_str,return 0 ; } -static void _ffa_mode_32bit_set (struct ffa_device *dev) -{ - dev->mode_32bit = true; -} -static void ffa_mode_32bit_set (struct ffa_device *dev) { -if (drv_info->version >FFA_VERSION_1_0 ) -return ; - -_ffa_mode_32bit_set (dev); + dev->mode_32bit = true; } static int ffa_sync_send_receive(struct ffa_device *dev,
@@ -787,7 +779,7 @@ static void ffa_setup_partitions(void)if (drv_info->version >FFA_VERSION_1_0 && !(tpbuf->properties &FFA_PARTITION_AARCH64_EXEC )) -_ffa_mode_32bit_set (ffa_dev); +ffa_mode_32bit_set (ffa_dev); }kfree (pbuf); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 177/379 ARM: dts: am3517-evm: Fix LED3/4 pinmux
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit 2ab6b437c65233f06bdd2988fd5913baeca5f159 ]
The pinmux for LED3 and LED4 are incorrectly attached to the omap3_pmx_core when they should be connected to the omap3_pmx_wkup pin mux. This was likely masked by the fact that the bootloader used to do all the pinmuxing.
Message-ID: <[email protected]>
--- arch/arm/boot/dts/am3517-evm.dts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/arm/boot/dts/am3517-evm.dts +9 -7
@@ -271,13 +271,6 @@ >; }; - leds_pins: pinmux_leds_pins { - pinctrl-single,pins = < - OMAP3_WKUP_IOPAD(0x2a24, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu0.gpio_11 */ - OMAP3_WKUP_IOPAD(0x2a26, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu1.gpio_31 */ - >; - }; - mmc1_pins: pinmux_mmc1_pins { pinctrl-single,pins = < OMAP3_CORE1_IOPAD(0x2144, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
@@ -355,3 +348,12 @@ >; }; }; + +&omap3_pmx_wkup { + leds_pins: pinmux_leds_pins { + pinctrl-single,pins = < + OMAP3_WKUP_IOPAD(0x2a24, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu0.gpio_11 */ + OMAP3_WKUP_IOPAD(0x2a26, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu1.gpio_31 */ + >; + }; +};
Greg Kroah-Hartman
maintainerPATCH 178/379 clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <[email protected]>
[ Upstream commit 3537a75e73f3420614a358d0c8b390ea483cc87d ]
Add the missing devm_kfree() when we skip the clocks with invalid or missing information from the firmware.
--- drivers/clk/clk-scmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk-scmi.c +1 -0
@@ -213,6 +213,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev) sclk->info = scmi_proto_clk_ops->info_get (ph, idx);if (!sclk->info) {dev_dbg (dev,"invalid clock info for idx %d\n" , idx); +devm_kfree (dev, sclk);continue ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 179/379 arm64: dts: imx8qm-ss-img: Fix jpegenc compatible entry
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit 1d33cd614d89b0ec024d25ec45acf4632211b5a7 ]
The first compatible entry for the jpegenc should be 'nxp,imx8qm-jpgenc'.
Change it accordingly to fix the following schema warning:
imx8qm-apalis-eval.dtb: jpegenc@58450000: compatible: 'oneOf' conditional failed, one must be fixed:
'nxp,imx8qm-jpgdec' is not one of ['nxp,imx8qxp-jpgdec', 'nxp,imx8qxp-jpgenc'] 'nxp,imx8qm-jpgenc' was expected
'nxp,imx8qxp-jpgdec' was expected
--- arch/arm64/boot/dts/freescale/imx8qm-ss-img.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8qm-ss-img.dtsi +1 -1
@@ -8,5 +8,5 @@ &jpegdec { }; &jpegenc { - compatible = "nxp,imx8qm-jpgdec", "nxp,imx8qxp-jpgenc"; + compatible = "nxp,imx8qm-jpgenc", "nxp,imx8qxp-jpgenc"; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 180/379 arm64: dts: imx8mm: Add sound-dai-cells to micfil node
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit 0e6cc2b8bb7d67733f4a47720787eff1ce2666f2 ]
Per the DT bindings, the micfil node should have a sound-dai-cells entry.
--- arch/arm64/boot/dts/freescale/imx8mm.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mm.dtsi +1 -0
@@ -398,6 +398,7 @@ micfil: audio-controller@30080000 { "pll8k", "pll11k", "clkext3"; dmas = <&sdma2 24 25 0x80000000>; dma-names = "rx"; + #sound-dai-cells = <0>; status = "disabled"; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 181/379 arm64: dts: imx8mn: Add sound-dai-cells to micfil node
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Ford <[email protected]>
[ Upstream commit db1925454a2e7cadcac8756442ca7c3198332336 ]
Per the DT bindings, the micfil node should have a sound-dai-cells entry.
--- arch/arm64/boot/dts/freescale/imx8mn.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mn.dtsi +1 -0
@@ -370,6 +370,7 @@ micfil: audio-controller@30080000 { "pll8k", "pll11k", "clkext3"; dmas = <&sdma2 24 25 0x80000000>; dma-names = "rx"; + #sound-dai-cells = <0>; status = "disabled"; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 182/379 arm64: tegra: Use correct interrupts for Tegra234 TKE
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thierry Reding <[email protected]>
[ Upstream commit c0b80988eb78d6423249ab530bfbc6b238790a26 ]
The shared interrupts 0-9 of the TKE are mapped to interrupts 0-9, but shared interrupts 10-15 are mapped to 256-261. Correct the mapping for the final 6 interrupts. This prevents the TKE from requesting the RTC interrupt (along with several GTE and watchdog interrupts).
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +6 -6
@@ -532,12 +532,12 @@ timer@2080000 { <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 260 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>; status = "okay"; };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 183/379 selftests/pidfd: Fix ksft print formats
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Wieczor-Retman <[email protected]>
[ Upstream commit 4d7f4e8158b62f63031510cdc24acc520956c091 ]
Compiling pidfd selftest after adding a __printf() attribute to ksft_print_msg() and ksft_test_result_pass() exposes -Wformat warnings in error_report(), test_pidfd_poll_exec_thread(), child_poll_exec_test(), test_pidfd_poll_leader_exit_thread(), child_poll_leader_exit_test().
The ksft_test_result_pass() in error_report() expects a string but doesn't provide any argument after the format string. All the other calls to ksft_print_msg() in the functions mentioned above have format strings that don't match with other passed arguments.
Fix format specifiers so they match the passed variables.
Add a missing variable to ksft_test_result_pass() inside error_report() so it matches other cases in the switch statement.
--- tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 2 +- tools/testing/selftests/pidfd/pidfd_test.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/pidfd/pidfd_fdinfo_test.c +1 -1
@@ -62,7 +62,7 @@ static void error_report(struct error *err, const char *test_name)break ;case PIDFD_PASS : -ksft_test_result_pass ("%s test: Passed\n" ); +ksft_test_result_pass ("%s test: Passed\n" , test_name);break ;default :
tools/testing/selftests/pidfd/pidfd_test.c +6 -6
@@ -380,13 +380,13 @@ static int test_pidfd_send_signal_syscall_support(void)static void *test_pidfd_poll_exec_thread (void *priv) { -ksft_print_msg ("Child Thread: starting. pid %d tid %d ; and sleeping\n" , +ksft_print_msg ("Child Thread: starting. pid %d tid %ld ; and sleeping\n" ,getpid (),syscall (SYS_gettid));ksft_print_msg ("Child Thread: doing exec of sleep\n" );execl ("/bin/sleep" ,"sleep" ,str (CHILD_THREAD_MIN_WAIT ), (char *)NULL ); -ksft_print_msg ("Child Thread: DONE. pid %d tid %d\n" , +ksft_print_msg ("Child Thread: DONE. pid %d tid %ld\n" ,getpid (),syscall (SYS_gettid));return NULL ; }
@@ -426,7 +426,7 @@ static int child_poll_exec_test(void *args) {pthread_t t1; -ksft_print_msg ("Child (pidfd): starting. pid %d tid %d\n" ,getpid (), +ksft_print_msg ("Child (pidfd): starting. pid %d tid %ld\n" ,getpid (),syscall (SYS_gettid));pthread_create (&t1,NULL , test_pidfd_poll_exec_thread,NULL );/*
@@ -479,10 +479,10 @@ static void test_pidfd_poll_exec(int use_waitpid)static void *test_pidfd_poll_leader_exit_thread (void *priv) { -ksft_print_msg ("Child Thread: starting. pid %d tid %d ; and sleeping\n" , +ksft_print_msg ("Child Thread: starting. pid %d tid %ld ; and sleeping\n" ,getpid (),syscall (SYS_gettid));sleep (CHILD_THREAD_MIN_WAIT ); -ksft_print_msg ("Child Thread: DONE. pid %d tid %d\n" ,getpid (),syscall (SYS_gettid)); +ksft_print_msg ("Child Thread: DONE. pid %d tid %ld\n" ,getpid (),syscall (SYS_gettid));return NULL ; }
@@ -491,7 +491,7 @@ static int child_poll_leader_exit_test(void *args) {pthread_t t1, t2; -ksft_print_msg ("Child: starting. pid %d tid %d\n" ,getpid (),syscall (SYS_gettid)); +ksft_print_msg ("Child: starting. pid %d tid %ld\n" ,getpid (),syscall (SYS_gettid));pthread_create (&t1,NULL , test_pidfd_poll_leader_exit_thread,NULL );pthread_create (&t2,NULL , test_pidfd_poll_leader_exit_thread,NULL );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 184/379 selftests/resctrl: Ensure the benchmark commands fits to its array
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 4a28c7665c2a1ac0400864eabb0c641e135f61aa ]
Benchmark command is copied into an array in the stack. The array is BENCHMARK_ARGS items long but the command line could try to provide a longer command. Argument size is also fixed by BENCHMARK_ARG_SIZE (63 bytes of space after fitting the terminating \0 character) and user could have inputted argument longer than that.
Return error in case the benchmark command does not fit to the space allocated for it.
--- tools/testing/selftests/resctrl/resctrl_tests.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/selftests/resctrl/resctrl_tests.c +5 -0
@@ -228,9 +228,14 @@ int main(int argc, char **argv)return ksft_exit_skip ("Not running as root. Skipping...\n" );if (has_ben) { +if (argc - ben_ind >=BENCHMARK_ARGS ) +ksft_exit_fail_msg ("Too long benchmark command.\n" ); +/* Extract benchmark command from command line. */ for (i = ben_ind; i < argc; i++) { benchmark_cmd[i - ben_ind] = benchmark_cmd_area[i]; +if (strlen (argv[i]) >=BENCHMARK_ARG_SIZE ) +ksft_exit_fail_msg ("Too long benchmark command argument.\n" );sprintf (benchmark_cmd[i - ben_ind],"%s" , argv[i]); } benchmark_cmd[ben_count] =NULL ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 185/379 module/decompress: use vmalloc() for gzip decompression workspace
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <[email protected]>
[ Upstream commit 3737df782c740b944912ed93420c57344b1cf864 ]
Use a similar approach as commit a419beac4a07 ("module/decompress: use vmalloc() for zstd decompression workspace") and replace kmalloc() with vmalloc() also for the gzip module decompression workspace.
In this case the workspace is represented by struct inflate_workspace that can be fairly large for kmalloc() and it can potentially lead to allocation errors on certain systems:
$ pahole inflate_workspace
struct inflate_workspace {
struct inflate_state inflate_state; /* 0 9544 */
/* --- cacheline 149 boundary (9536 bytes) was 8 bytes ago --- */
unsigned char working_window[32768]; /* 9544 32768 *//* size: 42312, cachelines: 662, members: 2 */ /* last cacheline: 8 bytes */ };
Considering that there is no need to use continuous physical memory, simply switch to vmalloc() to provide a more reliable in-kernel module decompression.
--- kernel/module/decompress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module/decompress.c +2 -2
@@ -100,7 +100,7 @@ static ssize_t module_gzip_decompress(struct load_info *info, s.next_in = buf + gzip_hdr_len; s.avail_in = size - gzip_hdr_len; - s.workspace =kmalloc (zlib_inflate_workspacesize (),GFP_KERNEL ); + s.workspace =vmalloc (zlib_inflate_workspacesize ());if (!s.workspace)return -ENOMEM ;
@@ -138,7 +138,7 @@ static ssize_t module_gzip_decompress(struct load_info *info, out_inflate_end:zlib_inflateEnd (&s); out: -kfree (s.workspace); +vfree (s.workspace); return retval; }#elif CONFIG_MODULE_COMPRESS_XZ
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 186/379 ASoC: cs35l41: Verify PM runtime resume errors in IRQ handler
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 9f8948db9849d202dee3570507d3a0642f92d632 ]
The interrupt handler invokes pm_runtime_get_sync() without checking the returned error code.
Add a proper verification and switch to pm_runtime_resume_and_get(), to avoid the need to call pm_runtime_put_noidle() for decrementing the PM usage counter before returning from the error condition.
--- sound/soc/codecs/cs35l41.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
sound/soc/codecs/cs35l41.c +10 -2
@@ -374,10 +374,18 @@ static irqreturn_t cs35l41_irq(int irq, void *data)struct cs35l41_private *cs35l41 = data;unsigned int status[4 ] = {0 ,0 ,0 ,0 };unsigned int masks[4 ] = {0 ,0 ,0 ,0 }; -int ret =IRQ_NONE ;unsigned int i; +int ret; -pm_runtime_get_sync (cs35l41->dev); + ret =pm_runtime_resume_and_get (cs35l41->dev); +if (ret <0 ) { +dev_err (cs35l41->dev, +"pm_runtime_resume_and_get failed in %s: %d\n" , + __func__, ret); +return IRQ_NONE ; + } + + ret =IRQ_NONE ;for (i =0 ; i <ARRAY_SIZE (status); i++) { regmap_read(cs35l41->regmap,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 187/379 ASoC: cs35l41: Undo runtime PM changes at driver exit time
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 2d5661e6008ae1a1cd6df7cc844908fb8b982c58 ]
According to the documentation, drivers are responsible for undoing at removal time all runtime PM changes done during probing.
Hence, add the missing calls to pm_runtime_dont_use_autosuspend(), which are necessary for undoing pm_runtime_use_autosuspend().
Note this would have been handled implicitly by devm_pm_runtime_enable(), but there is a need to continue using pm_runtime_enable()/pm_runtime_disable() in order to ensure the runtime PM is disabled as soon as the remove() callback is entered.
--- sound/soc/codecs/cs35l41.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/cs35l41.c +2 -0
@@ -1338,6 +1338,7 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *return 0 ; err_pm: +pm_runtime_dont_use_autosuspend (cs35l41->dev);pm_runtime_disable (cs35l41->dev);pm_runtime_put_noidle (cs35l41->dev);
@@ -1354,6 +1355,7 @@ EXPORT_SYMBOL_GPL(cs35l41_probe);void cs35l41_remove (struct cs35l41_private *cs35l41) {pm_runtime_get_sync (cs35l41->dev); +pm_runtime_dont_use_autosuspend (cs35l41->dev);pm_runtime_disable (cs35l41->dev);regmap_write (cs35l41->regmap,CS35L41_IRQ1_MASK1 ,0xFFFFFFFF );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 188/379 ALSA: hda: cs35l41: Fix unbalanced pm_runtime_get()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 486465508f8a5fe441939a7d97607f4460a60891 ]
If component_add() fails, probe() returns without calling pm_runtime_put(), which leaves the runtime PM usage counter incremented.
Fix the issue by jumping to err_pm label and drop the now unnecessary pm_runtime_disable() call.
--- sound/pci/hda/cs35l41_hda.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/hda/cs35l41_hda.c +1 -2
@@ -1501,8 +1501,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i ret =component_add (cs35l41->dev, &cs35l41_hda_comp_ops);if (ret) {dev_err (cs35l41->dev,"Register component failed: %d\n" , ret); -pm_runtime_disable (cs35l41->dev); - goto err; + goto err_pm; }dev_info (cs35l41->dev,"Cirrus Logic CS35L41 (%x), Revision: %02X\n" , regid, reg_revid);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 189/379 ALSA: hda: cs35l41: Undo runtime PM changes at driver exit time
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 85a1bf86fac0c195929768b4e92c78cad107523b ]
According to the documentation, drivers are responsible for undoing at removal time all runtime PM changes done during probing.
Hence, add the missing calls to pm_runtime_dont_use_autosuspend(), which are necessary for undoing pm_runtime_use_autosuspend().
--- sound/pci/hda/cs35l41_hda.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/cs35l41_hda.c +2 -0
@@ -1509,6 +1509,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int ireturn 0 ; err_pm: +pm_runtime_dont_use_autosuspend (cs35l41->dev);pm_runtime_disable (cs35l41->dev);pm_runtime_put_noidle (cs35l41->dev);
@@ -1527,6 +1528,7 @@ void cs35l41_hda_remove(struct device *dev)struct cs35l41_hda *cs35l41 =dev_get_drvdata (dev);pm_runtime_get_sync (cs35l41->dev); +pm_runtime_dont_use_autosuspend (cs35l41->dev);pm_runtime_disable (cs35l41->dev);if (cs35l41->halo_initialized)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 190/379 KEYS: Include linux/errno.h in linux/verification.h
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 0a596b0682a7ce37e26c36629816f105c6459d06 ]
Add inclusion of linux/errno.h as otherwise the reference to EINVAL may be invalid.
--- include/linux/verification.h | 1 + 1 file changed, 1 insertion(+)
include/linux/verification.h +1 -0
@@ -8,6 +8,7 @@#ifndef _LINUX_VERIFICATION_H#define _LINUX_VERIFICATION_H +#include <linux/errno.h> #include <linux/types.h> /*
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 191/379 crypto: hisilicon/hpre - Fix a erroneous check after snprintf()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit c977950146720abff14e46d8c53f5638b06a9182 ]
This error handling looks really strange.
Check if the string has been truncated instead.
--- drivers/crypto/hisilicon/hpre/hpre_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/hpre/hpre_main.c +1 -1
@@ -1031,7 +1031,7 @@ static int hpre_cluster_debugfs_init(struct hisi_qm *qm)for (i =0 ; i < clusters_num; i++) { ret =snprintf (buf,HPRE_DBGFS_VAL_MAX_LEN ,"cluster%d" , i); -if (ret <0 ) +if (ret >=HPRE_DBGFS_VAL_MAX_LEN )return -EINVAL ; tmp_d =debugfs_create_dir (buf, qm->debug.debug_root);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 192/379 hwrng: bcm2835 - Fix hwrng throughput regression
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit b58a36008bfa1aadf55f516bcbfae40c779eb54b ]
The last RCU stall fix caused a massive throughput regression of the hwrng on Raspberry Pi 0 - 3. hwrng_msleep doesn't sleep precisely enough and usleep_range doesn't allow scheduling. So try to restore the best possible throughput by introducing hwrng_yield which interruptable sleeps for one jiffy.
Some performance measurements on Raspberry Pi 3B+ (arm64/defconfig):
sudo dd if=/dev/hwrng of=/dev/null count=1 bs=10000
cpu_relax ~138025 Bytes / sechwrng_msleep(1000) ~13 Bytes / sechwrng_yield ~2510 Bytes / sec
--- drivers/char/hw_random/bcm2835-rng.c | 2 +- drivers/char/hw_random/core.c | 6 ++++++ include/linux/hw_random.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/char/hw_random/bcm2835-rng.c +1 -1
@@ -71,7 +71,7 @@ static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,while ((rng_readl (priv,RNG_STATUS ) >>24 ) ==0 ) {if (!wait)return 0 ; -hwrng_msleep (rng,1000 ); +hwrng_yield (rng); } num_words =rng_readl (priv,RNG_STATUS ) >>24 ;
drivers/char/hw_random/core.c +6 -0
@@ -680,6 +680,12 @@ long hwrng_msleep(struct hwrng *rng, unsigned int msecs) }EXPORT_SYMBOL_GPL (hwrng_msleep); +long hwrng_yield (struct hwrng *rng) +{ +return wait_for_completion_interruptible_timeout (&rng->dying,1 ); +} +EXPORT_SYMBOL_GPL (hwrng_yield); +static int __init hwrng_modinit (void ) {int ret;
include/linux/hw_random.h +1 -0
@@ -63,5 +63,6 @@ extern void hwrng_unregister(struct hwrng *rng);extern void devm_hwrng_unregister (struct device *dve,struct hwrng *rng);extern long hwrng_msleep (struct hwrng *rng,unsigned int msecs); +extern long hwrng_yield (struct hwrng *rng);#endif /* LINUX_HWRANDOM_H_ */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 193/379 hwrng: geode - fix accessing registers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 464bd8ec2f06707f3773676a1bd2c64832a3c805 ]
When the membase and pci_dev pointer were moved to a new struct in priv, the actual membase users were left untouched, and they started reading out arbitrary memory behind the struct instead of registers. This unfortunately turned the RNG into a constant number generator, depending on the content of what was at that offset.
To fix this, update geode_rng_data_{read,present}() to also get the membase via amd_geode_priv, and properly read from the right addresses again.
--- drivers/char/hw_random/geode-rng.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/hw_random/geode-rng.c +4 -2
@@ -58,7 +58,8 @@ struct amd_geode_priv {static int geode_rng_data_read (struct hwrng *rng,u32 *data) { -void __iomem *mem = (void __iomem *)rng->priv; +struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; +void __iomem *mem = priv->membase; *data =readl (mem +GEODE_RNG_DATA_REG );
@@ -67,7 +68,8 @@ static int geode_rng_data_read(struct hwrng *rng, u32 *data)static int geode_rng_data_present (struct hwrng *rng,int wait) { -void __iomem *mem = (void __iomem *)rng->priv; +struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; +void __iomem *mem = priv->membase;int data, i;for (i =0 ; i <20 ; i++) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 194/379 RDMA/core: Use size_{add,sub,mul}() in calls to struct_size()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 81760bedc65194ff38e1e4faefd5f9f0c95c19a4 ]
If, for any reason, the open-coded arithmetic causes a wraparound, the protection that struct_size() provides against potential integer overflows is defeated. Fix this by hardening calls to struct_size() with size_add(), size_sub() and size_mul().
--- drivers/infiniband/core/device.c | 2 +- drivers/infiniband/core/sa_query.c | 4 +++- drivers/infiniband/core/sysfs.c | 10 +++++----- drivers/infiniband/core/user_mad.c | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-)
drivers/infiniband/core/device.c +1 -1
@@ -804,7 +804,7 @@ static int alloc_port_data(struct ib_device *device)* empty slots at the beginning. */ pdata_rcu =kzalloc (struct_size (pdata_rcu, pdata, -rdma_end_port (device) +1 ), +size_add (rdma_end_port (device),1 )),GFP_KERNEL );if (!pdata_rcu)return -ENOMEM ;
drivers/infiniband/core/sa_query.c +3 -1
@@ -2220,7 +2220,9 @@ static int ib_sa_add_one(struct ib_device *device) s =rdma_start_port (device); e =rdma_end_port (device); - sa_dev =kzalloc (struct_size (sa_dev, port, e - s +1 ),GFP_KERNEL ); + sa_dev =kzalloc (struct_size (sa_dev, port, +size_add (size_sub (e, s),1 )), +GFP_KERNEL );if (!sa_dev)return -ENOMEM ;
drivers/infiniband/core/sysfs.c +5 -5
@@ -903,7 +903,7 @@ alloc_hw_stats_device(struct ib_device *ibdev)* Two extra attribue elements here, one for the lifespan entry and * one to NULL terminate the list for the sysfs core code */ - data =kzalloc (struct_size (data, attrs, stats->num_counters +1 ), + data =kzalloc (struct_size (data, attrs,size_add (stats->num_counters,1 )),GFP_KERNEL );if (!data) goto err_free_stats;
@@ -1009,7 +1009,7 @@ alloc_hw_stats_port(struct ib_port *port, struct attribute_group *group)* Two extra attribue elements here, one for the lifespan entry and * one to NULL terminate the list for the sysfs core code */ - data =kzalloc (struct_size (data, attrs, stats->num_counters +1 ), + data =kzalloc (struct_size (data, attrs,size_add (stats->num_counters,1 )),GFP_KERNEL );if (!data) goto err_free_stats;
@@ -1140,7 +1140,7 @@ static int setup_gid_attrs(struct ib_port *port,int ret; gid_attr_group =kzalloc (struct_size (gid_attr_group, attrs_list, - attr->gid_tbl_len *2 ), +size_mul (attr->gid_tbl_len,2 )),GFP_KERNEL );if (!gid_attr_group)return -ENOMEM ;
@@ -1205,8 +1205,8 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num,int ret; p =kvzalloc (struct_size (p, attrs_list, - attr->gid_tbl_len + attr->pkey_tbl_len), -GFP_KERNEL ); +size_add (attr->gid_tbl_len, attr->pkey_tbl_len)), +GFP_KERNEL );if (!p)return ERR_PTR (-ENOMEM ); p->ibdev = device;
drivers/infiniband/core/user_mad.c +3 -1
@@ -1373,7 +1373,9 @@ static int ib_umad_add_one(struct ib_device *device) s =rdma_start_port (device); e =rdma_end_port (device); - umad_dev =kzalloc (struct_size (umad_dev, ports, e - s +1 ),GFP_KERNEL ); + umad_dev =kzalloc (struct_size (umad_dev, ports, +size_add (size_sub (e, s),1 )), +GFP_KERNEL );if (!umad_dev)return -ENOMEM ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 195/379 crypto: qat - ignore subsequent state up commands
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 9c20cb8b1847dedddec3d5163079290542bf00bf ]
If the device is already in the up state, a subsequent write of up to the sysfs attribute /sys/bus/pci/devices/<BDF>/qat/state brings the device down.
Fix this behaviour by ignoring subsequent up commands if the device is already in the up state.
--- drivers/crypto/qat/qat_common/adf_sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_sysfs.c +3 -1
@@ -61,7 +61,9 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,dev_info (dev,"Starting device qat_dev%d\n" , accel_id); ret =adf_dev_up (accel_dev, true); -if (ret <0 ) { +if (ret == -EALREADY ) { +break ; + }else if (ret) {dev_err (dev,"Failed to start device qat_dev%d\n" , accel_id);adf_dev_down (accel_dev, true);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 196/379 crypto: qat - relocate bufferlist logic
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit e9612987e437b7ada686f472c7596686fabecb2b ]
Move the logic that maps, unmaps and converts scatterlists into QAT bufferlists from qat_algs.c to a new module, qat_bl.
This is to allow reuse of the logic by the data compression service.
This commit does not implement any functional change.
Stable-dep-of: 9b2f33a1bfcd ("crypto: qat - fix unregistration of crypto algorithms")
--- drivers/crypto/qat/qat_common/Makefile | 3 +- drivers/crypto/qat/qat_common/qat_algs.c | 184 +-------------------- drivers/crypto/qat/qat_common/qat_bl.c | 194 +++++++++++++++++++++++ drivers/crypto/qat/qat_common/qat_bl.h | 17 ++ 4 files changed, 214 insertions(+), 184 deletions(-) create mode 100644 drivers/crypto/qat/qat_common/qat_bl.c create mode 100644 drivers/crypto/qat/qat_common/qat_bl.h
drivers/crypto/qat/qat_common/Makefile +2 -1
@@ -19,7 +19,8 @@ intel_qat-objs := adf_cfg.o \ qat_asym_algs.o \ qat_algs_send.o \ qat_uclo.o \ - qat_hal.o + qat_hal.o \ + qat_bl.o intel_qat-$(CONFIG_DEBUG_FS) += adf_transport_debug.o intel_qat-$(CONFIG_PCI_IOV) += adf_sriov.o adf_vf_isr.o adf_pfvf_utils.o \
drivers/crypto/qat/qat_common/qat_algs.c +1 -183
196 lines not on this page · raw message
drivers/crypto/qat/qat_common/qat_bl.c new file +194 -0
194 lines not on this page · raw message
drivers/crypto/qat/qat_common/qat_bl.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright(c) 2014 - 2022 Intel Corporation */ +#ifndef QAT_BL_H +#define QAT_BL_H +#include <linux/scatterlist.h> +#include <linux/types.h> +#include "qat_crypto.h" + +void qat_alg_free_bufl (struct qat_crypto_instance *inst, +struct qat_crypto_request *qat_req); +int qat_alg_sgl_to_bufl (struct qat_crypto_instance *inst, +struct scatterlist *sgl, +struct scatterlist *sglout, +struct qat_crypto_request *qat_req, +gfp_t flags); + +#endif
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 197/379 crypto: qat - rename bufferlist functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit b0cd997f35598c4fc01bf22061e1eb88fc10afad ]
Rename the functions qat_alg_sgl_to_bufl() and qat_alg_free_bufl() as qat_bl_sgl_to_bufl() and qat_bl_free_bufl() after their relocation into the qat_bl module.
This commit does not implement any functional change.
Stable-dep-of: 9b2f33a1bfcd ("crypto: qat - fix unregistration of crypto algorithms")
--- drivers/crypto/qat/qat_common/qat_algs.c | 20 ++++++++++---------- drivers/crypto/qat/qat_common/qat_bl.c | 14 +++++++------- drivers/crypto/qat/qat_common/qat_bl.h | 14 +++++++------- 3 files changed, 24 insertions(+), 24 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +10 -10
@@ -673,7 +673,7 @@ static void qat_aead_alg_callback(struct icp_qat_fw_la_resp *qat_resp,u8 stat_filed = qat_resp->comn_resp.comn_status;int res =0 , qat_res =ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET (stat_filed); -qat_alg_free_bufl (inst, qat_req); +qat_bl_free_bufl (inst, qat_req);if (unlikely (qat_res !=ICP_QAT_FW_COMN_STATUS_FLAG_OK )) res = -EBADMSG ; areq->base.complete (&areq->base, res);
@@ -743,7 +743,7 @@ static void qat_skcipher_alg_callback(struct icp_qat_fw_la_resp *qat_resp,u8 stat_filed = qat_resp->comn_resp.comn_status;int res =0 , qat_res =ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET (stat_filed); -qat_alg_free_bufl (inst, qat_req); +qat_bl_free_bufl (inst, qat_req);if (unlikely (qat_res !=ICP_QAT_FW_COMN_STATUS_FLAG_OK )) res = -EINVAL ;
@@ -799,7 +799,7 @@ static int qat_alg_aead_dec(struct aead_request *areq)if (cipher_len %AES_BLOCK_SIZE !=0 )return -EINVAL ; - ret =qat_alg_sgl_to_bufl (ctx->inst, areq->src, areq->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst, areq->src, areq->dst, qat_req, f);if (unlikely (ret))return ret;
@@ -821,7 +821,7 @@ static int qat_alg_aead_dec(struct aead_request *areq) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &areq->base);if (ret == -ENOSPC ) -qat_alg_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst, qat_req);return ret; }
@@ -842,7 +842,7 @@ static int qat_alg_aead_enc(struct aead_request *areq)if (areq->cryptlen %AES_BLOCK_SIZE !=0 )return -EINVAL ; - ret =qat_alg_sgl_to_bufl (ctx->inst, areq->src, areq->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst, areq->src, areq->dst, qat_req, f);if (unlikely (ret))return ret;
@@ -866,7 +866,7 @@ static int qat_alg_aead_enc(struct aead_request *areq) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &areq->base);if (ret == -ENOSPC ) -qat_alg_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst, qat_req);return ret; }
@@ -1027,7 +1027,7 @@ static int qat_alg_skcipher_encrypt(struct skcipher_request *req)if (req->cryptlen ==0 )return 0 ; - ret =qat_alg_sgl_to_bufl (ctx->inst, req->src, req->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst, req->src, req->dst, qat_req, f);if (unlikely (ret))return ret;
@@ -1048,7 +1048,7 @@ static int qat_alg_skcipher_encrypt(struct skcipher_request *req) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &req->base);if (ret == -ENOSPC ) -qat_alg_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst, qat_req);return ret; }
@@ -1093,7 +1093,7 @@ static int qat_alg_skcipher_decrypt(struct skcipher_request *req)if (req->cryptlen ==0 )return 0 ; - ret =qat_alg_sgl_to_bufl (ctx->inst, req->src, req->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst, req->src, req->dst, qat_req, f);if (unlikely (ret))return ret;
@@ -1115,7 +1115,7 @@ static int qat_alg_skcipher_decrypt(struct skcipher_request *req) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &req->base);if (ret == -ENOSPC ) -qat_alg_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst, qat_req);return ret; }
drivers/crypto/qat/qat_common/qat_bl.c +7 -7
@@ -10,8 +10,8 @@#include "qat_bl.h" #include "qat_crypto.h" -void qat_alg_free_bufl (struct qat_crypto_instance *inst, -struct qat_crypto_request *qat_req) +void qat_bl_free_bufl (struct qat_crypto_instance *inst, +struct qat_crypto_request *qat_req) {struct device *dev = &GET_DEV (inst->accel_dev);struct qat_alg_buf_list *bl = qat_req->buf.bl;
@@ -50,11 +50,11 @@ void qat_alg_free_bufl(struct qat_crypto_instance *inst, } } -int qat_alg_sgl_to_bufl (struct qat_crypto_instance *inst, -struct scatterlist *sgl, -struct scatterlist *sglout, -struct qat_crypto_request *qat_req, -gfp_t flags) +int qat_bl_sgl_to_bufl (struct qat_crypto_instance *inst, +struct scatterlist *sgl, +struct scatterlist *sglout, +struct qat_crypto_request *qat_req, +gfp_t flags) {struct device *dev = &GET_DEV (inst->accel_dev);int i, sg_nctr =0 ;
drivers/crypto/qat/qat_common/qat_bl.h +7 -7
@@ -6,12 +6,12 @@#include <linux/types.h> #include "qat_crypto.h" -void qat_alg_free_bufl (struct qat_crypto_instance *inst, -struct qat_crypto_request *qat_req); -int qat_alg_sgl_to_bufl (struct qat_crypto_instance *inst, -struct scatterlist *sgl, -struct scatterlist *sglout, -struct qat_crypto_request *qat_req, -gfp_t flags); +void qat_bl_free_bufl (struct qat_crypto_instance *inst, +struct qat_crypto_request *qat_req); +int qat_bl_sgl_to_bufl (struct qat_crypto_instance *inst, +struct scatterlist *sgl, +struct scatterlist *sglout, +struct qat_crypto_request *qat_req, +gfp_t flags);#endif
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 198/379 crypto: qat - change bufferlist logic interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 3ed330d0dba61d2e08a0eed7aa3d5def3f0c749b ]
The functions qat_alg_sgl_to_bufl() and qat_alg_free_bufl() take as argument a qat_crypto_instance and a qat_crypto_request structure. These two structures are used only to get a reference to the adf_accel_dev and qat_crypto_request_buffs.
In order to reuse these functions for the compression service, change the signature so that they take adf_accel_dev and qat_crypto_request_buffs.
Stable-dep-of: 9b2f33a1bfcd ("crypto: qat - fix unregistration of crypto algorithms")
--- drivers/crypto/qat/qat_common/qat_algs.c | 24 +++++---- drivers/crypto/qat/qat_common/qat_bl.c | 62 ++++++++++++------------ drivers/crypto/qat/qat_common/qat_bl.h | 8 +-- 3 files changed, 49 insertions(+), 45 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +14 -10
@@ -673,7 +673,7 @@ static void qat_aead_alg_callback(struct icp_qat_fw_la_resp *qat_resp,u8 stat_filed = qat_resp->comn_resp.comn_status;int res =0 , qat_res =ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET (stat_filed); -qat_bl_free_bufl (inst, qat_req); +qat_bl_free_bufl (inst->accel_dev, &qat_req->buf);if (unlikely (qat_res !=ICP_QAT_FW_COMN_STATUS_FLAG_OK )) res = -EBADMSG ; areq->base.complete (&areq->base, res);
@@ -743,7 +743,7 @@ static void qat_skcipher_alg_callback(struct icp_qat_fw_la_resp *qat_resp,u8 stat_filed = qat_resp->comn_resp.comn_status;int res =0 , qat_res =ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET (stat_filed); -qat_bl_free_bufl (inst, qat_req); +qat_bl_free_bufl (inst->accel_dev, &qat_req->buf);if (unlikely (qat_res !=ICP_QAT_FW_COMN_STATUS_FLAG_OK )) res = -EINVAL ;
@@ -799,7 +799,8 @@ static int qat_alg_aead_dec(struct aead_request *areq)if (cipher_len %AES_BLOCK_SIZE !=0 )return -EINVAL ; - ret =qat_bl_sgl_to_bufl (ctx->inst, areq->src, areq->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, areq->src, areq->dst, + &qat_req->buf, f);if (unlikely (ret))return ret;
@@ -821,7 +822,7 @@ static int qat_alg_aead_dec(struct aead_request *areq) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &areq->base);if (ret == -ENOSPC ) -qat_bl_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst->accel_dev, &qat_req->buf);return ret; }
@@ -842,7 +843,8 @@ static int qat_alg_aead_enc(struct aead_request *areq)if (areq->cryptlen %AES_BLOCK_SIZE !=0 )return -EINVAL ; - ret =qat_bl_sgl_to_bufl (ctx->inst, areq->src, areq->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, areq->src, areq->dst, + &qat_req->buf, f);if (unlikely (ret))return ret;
@@ -866,7 +868,7 @@ static int qat_alg_aead_enc(struct aead_request *areq) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &areq->base);if (ret == -ENOSPC ) -qat_bl_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst->accel_dev, &qat_req->buf);return ret; }
@@ -1027,7 +1029,8 @@ static int qat_alg_skcipher_encrypt(struct skcipher_request *req)if (req->cryptlen ==0 )return 0 ; - ret =qat_bl_sgl_to_bufl (ctx->inst, req->src, req->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, req->src, req->dst, + &qat_req->buf, f);if (unlikely (ret))return ret;
@@ -1048,7 +1051,7 @@ static int qat_alg_skcipher_encrypt(struct skcipher_request *req) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &req->base);if (ret == -ENOSPC ) -qat_bl_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst->accel_dev, &qat_req->buf);return ret; }
@@ -1093,7 +1096,8 @@ static int qat_alg_skcipher_decrypt(struct skcipher_request *req)if (req->cryptlen ==0 )return 0 ; - ret =qat_bl_sgl_to_bufl (ctx->inst, req->src, req->dst, qat_req, f); + ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, req->src, req->dst, + &qat_req->buf, f);if (unlikely (ret))return ret;
@@ -1115,7 +1119,7 @@ static int qat_alg_skcipher_decrypt(struct skcipher_request *req) ret =qat_alg_send_sym_message (qat_req, ctx->inst, &req->base);if (ret == -ENOSPC ) -qat_bl_free_bufl (ctx->inst, qat_req); +qat_bl_free_bufl (ctx->inst->accel_dev, &qat_req->buf);return ret; }
drivers/crypto/qat/qat_common/qat_bl.c +31 -31
140 lines not on this page · raw message
drivers/crypto/qat/qat_common/qat_bl.h +4 -4
@@ -6,12 +6,12 @@#include <linux/types.h> #include "qat_crypto.h" -void qat_bl_free_bufl (struct qat_crypto_instance *inst, -struct qat_crypto_request *qat_req); -int qat_bl_sgl_to_bufl (struct qat_crypto_instance *inst, +void qat_bl_free_bufl (struct adf_accel_dev *accel_dev, +struct qat_crypto_request_buffs *buf); +int qat_bl_sgl_to_bufl (struct adf_accel_dev *accel_dev,struct scatterlist *sgl,struct scatterlist *sglout, -struct qat_crypto_request *qat_req, +struct qat_crypto_request_buffs *buf,gfp_t flags);#endif
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 199/379 crypto: qat - generalize crypto request buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 36ebc7472afeb58f1eb1d4c1f0546b9e98acea46 ]
The structure qat_crypto_request_buffs which contains the source and destination buffer lists and correspondent sizes and dma addresses is also required for the compression service.
Rename it as qat_request_buffs and move it to qat_bl.h.
Stable-dep-of: 9b2f33a1bfcd ("crypto: qat - fix unregistration of crypto algorithms")
--- drivers/crypto/qat/qat_common/qat_bl.c | 4 +-- drivers/crypto/qat/qat_common/qat_bl.h | 38 ++++++++++++++++++++-- drivers/crypto/qat/qat_common/qat_crypto.h | 36 ++------------------ 3 files changed, 39 insertions(+), 39 deletions(-)
drivers/crypto/qat/qat_common/qat_bl.c +2 -2
@@ -11,7 +11,7 @@#include "qat_crypto.h" void qat_bl_free_bufl (struct adf_accel_dev *accel_dev, -struct qat_crypto_request_buffs *buf) +struct qat_request_buffs *buf) {struct device *dev = &GET_DEV (accel_dev);struct qat_alg_buf_list *bl = buf->bl;
@@ -53,7 +53,7 @@ void qat_bl_free_bufl(struct adf_accel_dev *accel_dev,int qat_bl_sgl_to_bufl (struct adf_accel_dev *accel_dev,struct scatterlist *sgl,struct scatterlist *sglout, -struct qat_crypto_request_buffs *buf, +struct qat_request_buffs *buf,gfp_t flags) {struct device *dev = &GET_DEV (accel_dev);
drivers/crypto/qat/qat_common/qat_bl.h +35 -3
@@ -4,14 +4,46 @@#define QAT_BL_H #include <linux/scatterlist.h> #include <linux/types.h> -#include "qat_crypto.h" + +#define QAT_MAX_BUFF_DESC 4 + +struct qat_alg_buf { +u32 len; +u32 resrvd; +u64 addr; +} __packed; + +struct qat_alg_buf_list { +u64 resrvd; +u32 num_bufs; +u32 num_mapped_bufs; +struct qat_alg_buf bufers[]; +} __packed; + +struct qat_alg_fixed_buf_list { +struct qat_alg_buf_list sgl_hdr; +struct qat_alg_buf descriptors[QAT_MAX_BUFF_DESC ]; +} __packed__aligned(64) ; + +struct qat_request_buffs { +struct qat_alg_buf_list *bl; +dma_addr_t blp; +struct qat_alg_buf_list *blout; +dma_addr_t bloutp; +size_t sz; +size_t sz_out; +bool sgl_src_valid; +bool sgl_dst_valid; +struct qat_alg_fixed_buf_list sgl_src; +struct qat_alg_fixed_buf_list sgl_dst; +};void qat_bl_free_bufl (struct adf_accel_dev *accel_dev, -struct qat_crypto_request_buffs *buf); +struct qat_request_buffs *buf);int qat_bl_sgl_to_bufl (struct adf_accel_dev *accel_dev,struct scatterlist *sgl,struct scatterlist *sglout, -struct qat_crypto_request_buffs *buf, +struct qat_request_buffs *buf,gfp_t flags);#endif
drivers/crypto/qat/qat_common/qat_crypto.h +2 -34
@@ -8,6 +8,7 @@#include <linux/slab.h> #include "adf_accel_devices.h" #include "icp_qat_fw_la.h" +#include "qat_bl.h" struct qat_instance_backlog {struct list_head list;
@@ -35,39 +36,6 @@ struct qat_crypto_instance {struct qat_instance_backlog backlog; }; -#define QAT_MAX_BUFF_DESC 4 - -struct qat_alg_buf { -u32 len; -u32 resrvd; -u64 addr; -} __packed; - -struct qat_alg_buf_list { -u64 resrvd; -u32 num_bufs; -u32 num_mapped_bufs; -struct qat_alg_buf bufers[]; -} __packed; - -struct qat_alg_fixed_buf_list { -struct qat_alg_buf_list sgl_hdr; -struct qat_alg_buf descriptors[QAT_MAX_BUFF_DESC ]; -} __packed__aligned(64) ; - -struct qat_crypto_request_buffs { -struct qat_alg_buf_list *bl; -dma_addr_t blp; -struct qat_alg_buf_list *blout; -dma_addr_t bloutp; -size_t sz; -size_t sz_out; -bool sgl_src_valid; -bool sgl_dst_valid; -struct qat_alg_fixed_buf_list sgl_src; -struct qat_alg_fixed_buf_list sgl_dst; -}; -struct qat_crypto_request ;struct qat_crypto_request {
@@ -80,7 +48,7 @@ struct qat_crypto_request {struct aead_request *aead_req;struct skcipher_request *skcipher_req; }; -struct qat_crypto_request_buffs buf; +struct qat_request_buffs buf;void (*cb)(struct icp_qat_fw_la_resp *resp,struct qat_crypto_request *req);union {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 200/379 crypto: qat - extend buffer list interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit cf692906bd61af2eec06a32a83d2a8ec3acf3548 ]
The compression service requires an additional pre-allocated buffer for each destination scatter list.
Extend the function qat_alg_sgl_to_bufl() to take an additional structure that contains the dma address and the size of the extra buffer which will be appended in the destination FW SGL.
The logic that unmaps buffers in qat_alg_free_bufl() has been changed to start unmapping from buffer 0 instead of skipping the initial buffers num_buff - num_mapped_bufs as that functionality was not used in the code.
Stable-dep-of: 9b2f33a1bfcd ("crypto: qat - fix unregistration of crypto algorithms")
--- drivers/crypto/qat/qat_common/qat_algs.c | 8 ++-- drivers/crypto/qat/qat_common/qat_bl.c | 58 ++++++++++++++++++------ drivers/crypto/qat/qat_common/qat_bl.h | 6 +++ 3 files changed, 54 insertions(+), 18 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +4 -4
@@ -800,7 +800,7 @@ static int qat_alg_aead_dec(struct aead_request *areq)return -EINVAL ; ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, areq->src, areq->dst, - &qat_req->buf, f); + &qat_req->buf,NULL , f);if (unlikely (ret))return ret;
@@ -844,7 +844,7 @@ static int qat_alg_aead_enc(struct aead_request *areq)return -EINVAL ; ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, areq->src, areq->dst, - &qat_req->buf, f); + &qat_req->buf,NULL , f);if (unlikely (ret))return ret;
@@ -1030,7 +1030,7 @@ static int qat_alg_skcipher_encrypt(struct skcipher_request *req)return 0 ; ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, req->src, req->dst, - &qat_req->buf, f); + &qat_req->buf,NULL , f);if (unlikely (ret))return ret;
@@ -1097,7 +1097,7 @@ static int qat_alg_skcipher_decrypt(struct skcipher_request *req)return 0 ; ret =qat_bl_sgl_to_bufl (ctx->inst->accel_dev, req->src, req->dst, - &qat_req->buf, f); + &qat_req->buf,NULL , f);if (unlikely (ret))return ret;
drivers/crypto/qat/qat_common/qat_bl.c +44 -14
111 lines not on this page · raw message
drivers/crypto/qat/qat_common/qat_bl.h +6 -0
@@ -38,12 +38,18 @@ struct qat_request_buffs { struct qat_alg_fixed_buf_list sgl_dst; }; +struct qat_sgl_to_bufl_params { +dma_addr_t extra_dst_buff; +size_t sz_extra_dst_buff; +}; +void qat_bl_free_bufl (struct adf_accel_dev *accel_dev,struct qat_request_buffs *buf);int qat_bl_sgl_to_bufl (struct adf_accel_dev *accel_dev,struct scatterlist *sgl,struct scatterlist *sglout,struct qat_request_buffs *buf, +struct qat_sgl_to_bufl_params *params,gfp_t flags);#endif
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 201/379 crypto: qat - fix unregistration of crypto algorithms
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 9b2f33a1bfcda90b857431a764c9c8f9a412bbe5 ]
The function adf_dev_init(), through the subsystem qat_crypto, populates the list of list of crypto instances accel_dev->crypto_list. If the list of instances is not empty, the function adf_dev_start() will then call qat_algs_registers() and qat_asym_algs_register() to register the crypto algorithms into the crypto framework.
If any of the functions in adf_dev_start() fail, the caller of such function, in the error path calls adf_dev_down() which in turn call adf_dev_stop() and adf_dev_shutdown(), see for example the function state_store in adf_sriov.c.
However, if the registration of crypto algorithms is not done, adf_dev_stop() will try to unregister the algorithms regardless. This might cause the counter active_devs in qat_algs.c and qat_asym_algs.c to get to a negative value.
Add a new state, ADF_STATUS_CRYPTO_ALGS_REGISTERED, which tracks if the crypto algorithms are registered into the crypto framework. Then use this to unregister the algorithms if such flag is set. This ensures that the crypto algorithms are only unregistered if previously registered.
--- drivers/crypto/qat/qat_common/adf_common_drv.h | 1 + drivers/crypto/qat/qat_common/adf_init.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_common_drv.h +1 -0
@@ -25,6 +25,7 @@#define ADF_STATUS_AE_STARTED 6#define ADF_STATUS_PF_RUNNING 7#define ADF_STATUS_IRQ_ALLOCATED 8 +#define ADF_STATUS_CRYPTO_ALGS_REGISTERED 9enum adf_dev_reset_mode {ADF_DEV_RESET_ASYNC =0 ,
drivers/crypto/qat/qat_common/adf_init.c +5 -1
@@ -209,6 +209,8 @@ int adf_dev_start(struct adf_accel_dev *accel_dev)clear_bit (ADF_STATUS_STARTED , &accel_dev->status);return -EFAULT ; } +set_bit (ADF_STATUS_CRYPTO_ALGS_REGISTERED , &accel_dev->status); +return 0 ; }EXPORT_SYMBOL_GPL (adf_dev_start);
@@ -237,10 +239,12 @@ void adf_dev_stop(struct adf_accel_dev *accel_dev)clear_bit (ADF_STATUS_STARTING , &accel_dev->status);clear_bit (ADF_STATUS_STARTED , &accel_dev->status); -if (!list_empty (&accel_dev->crypto_list)) { +if (!list_empty (&accel_dev->crypto_list) && +test_bit (ADF_STATUS_CRYPTO_ALGS_REGISTERED , &accel_dev->status)) {qat_algs_unregister ();qat_asym_algs_unregister (); } +clear_bit (ADF_STATUS_CRYPTO_ALGS_REGISTERED , &accel_dev->status);list_for_each (list_itr, &service_table) { service = list_entry(list_itr, struct service_hndl, list);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 202/379 scsi: ibmvfc: Fix erroneous use of rtas_busy_delay with hcall return code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyrel Datwyler <[email protected]>
[ Upstream commit 670106eb4c8b23475f8c2b3416005a312afa622f ]
Commit 0217a272fe13 ("scsi: ibmvfc: Store return code of H_FREE_SUB_CRQ during cleanup") wrongly changed the busy loop check to use rtas_busy_delay() instead of H_BUSY and H_IS_LONG_BUSY(). The busy return codes for RTAS and hypercalls are not the same.
Fix this issue by restoring the use of H_BUSY and H_IS_LONG_BUSY().
--- drivers/scsi/ibmvscsi/ibmvfc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +1 -2
@@ -22,7 +22,6 @@#include <linux/bsg-lib.h> #include <asm/firmware.h> #include <asm/irq.h> -#include <asm/rtas.h> #include <asm/vio.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h>
@@ -5804,7 +5803,7 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, irq_failed:do { rc =plpar_hcall_norets (H_FREE_SUB_CRQ , vdev->unit_address, scrq->cookie); - }while (rtas_busy_delay (rc)); + }while (rc ==H_BUSY ||H_IS_LONG_BUSY (rc)); reg_failed:LEAVE ;return rc;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 203/379 libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 6fd4ebfc4d61e3097b595ab2725d513e3bbd6739 ]
Use devm_kstrdup() instead of kstrdup() and check its return value to avoid memory leak.
--- drivers/nvdimm/of_pmem.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/nvdimm/of_pmem.c +7 -1
@@ -30,7 +30,13 @@ static int of_pmem_region_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; - priv->bus_desc.provider_name =kstrdup (pdev->name,GFP_KERNEL ); + priv->bus_desc.provider_name =devm_kstrdup (&pdev->dev, pdev->name, +GFP_KERNEL ); +if (!priv->bus_desc.provider_name) { +kfree (priv); +return -ENOMEM ; + } + priv->bus_desc.module =THIS_MODULE ; priv->bus_desc.of_node = np;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 204/379 nd_btt: Make BTT lanes preemptible
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
[ Upstream commit 36c75ce3bd299878fd9b238e9803d3817ddafbf3 ]
nd_region_acquire_lane uses get_cpu, which disables preemption. This is an issue on PREEMPT_RT kernels, since btt_write_pg and also nd_region_acquire_lane itself take a spin lock, resulting in BUG:
sleeping function called from invalid context.
Fix the issue by replacing get_cpu with smp_process_id and migrate_disable when needed. This makes BTT operations preemptible, thus permitting the use of spin_lock.
BUG example occurring when running ndctl tests on PREEMPT_RT kernel:
BUG: sleeping function called from invalid context at
kernel/locking/spinlock_rt.c:48in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 4903, name:
libndctlpreempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
Preemption disabled at:
[<ffffffffc1313db5>] nd_region_acquire_lane+0x15/0x90 [libnvdimm] Call Trace: <TASK> dump_stack_lvl+0x8e/0xb0 __might_resched+0x19b/0x250 rt_spin_lock+0x4c/0x100 ? btt_write_pg+0x2d7/0x500 [nd_btt] btt_write_pg+0x2d7/0x500 [nd_btt] ? local_clock_noinstr+0x9/0xc0 btt_submit_bio+0x16d/0x270 [nd_btt] __submit_bio+0x48/0x80 __submit_bio_noacct+0x7e/0x1e0 submit_bio_wait+0x58/0xb0 __blkdev_direct_IO_simple+0x107/0x240 ? inode_set_ctime_current+0x51/0x110 ? __pfx_submit_bio_wait_endio+0x10/0x10 blkdev_write_iter+0x1d8/0x290 vfs_write+0x237/0x330 ... </TASK>
--- drivers/nvdimm/region_devs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvdimm/region_devs.c +4 -4
@@ -892,7 +892,8 @@ unsigned int nd_region_acquire_lane(struct nd_region *nd_region) {unsigned int cpu, lane; - cpu =get_cpu (); +migrate_disable (); + cpu =smp_processor_id ();if (nd_region->num_lanes < nr_cpu_ids) {struct nd_percpu_lane *ndl_lock, *ndl_count;
@@ -911,16 +912,15 @@ EXPORT_SYMBOL(nd_region_acquire_lane);void nd_region_release_lane (struct nd_region *nd_region,unsigned int lane) {if (nd_region->num_lanes < nr_cpu_ids) { -unsigned int cpu =get_cpu (); +unsigned int cpu =smp_processor_id ();struct nd_percpu_lane *ndl_lock, *ndl_count; ndl_count =per_cpu_ptr (nd_region->lane, cpu); ndl_lock =per_cpu_ptr (nd_region->lane, lane);if (--ndl_count->count ==0 )spin_unlock (&ndl_lock->lock); -put_cpu (); } -put_cpu (); +migrate_enable (); }EXPORT_SYMBOL (nd_region_release_lane);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 205/379 crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Jain <[email protected]>
[ Upstream commit 7b8c6aee0d5b864e70c0da82583f9862e374eaf3 ]
key buffer is not copied in chachapoly_setkey function, results in wrong output for encryption/decryption operation.
fix this by memcpy the key in caam_ctx key arrary
--- drivers/crypto/caam/caamalg_qi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/caam/caamalg_qi2.c +2 -1
@@ -639,7 +639,8 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,if (keylen !=CHACHA_KEY_SIZE + saltlen)return -EINVAL ; - ctx->cdata.key_virt = key; +memcpy (ctx->key, key, keylen); + ctx->cdata.key_virt = ctx->key; ctx->cdata.keylen = keylen - saltlen;return chachapoly_set_sh_desc (aead);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 206/379 crypto: caam/jr - fix Chacha20 + Poly1305 self test failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Jain <[email protected]>
[ Upstream commit a8d3cdcc092fb2f2882acb6c20473a1be0ef4484 ]
key buffer is not copied in chachapoly_setkey function, results in wrong output for encryption/decryption operation.
fix this by memcpy the key in caam_ctx key arrary
--- drivers/crypto/caam/caamalg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/caam/caamalg.c +2 -1
@@ -566,7 +566,8 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,if (keylen !=CHACHA_KEY_SIZE + saltlen)return -EINVAL ; - ctx->cdata.key_virt = key; +memcpy (ctx->key, key, keylen); + ctx->cdata.key_virt = ctx->key; ctx->cdata.keylen = keylen - saltlen;return chachapoly_set_sh_desc (aead);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 207/379 crypto: qat - increase size of buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 4e4e2ed22d505c5bacf65c6a39bfb6d120d24785 ]
Increase the size of the buffers used for composing the names used for the transport debugfs entries and the vector name to avoid a potential truncation.
This resolves the following errors when compiling the driver with W=1 and KCFLAGS=-Werror on GCC 12.3.1:
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c: In function ‘adf_ring_debugfs_add’:
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c:100:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] drivers/crypto/intel/qat/qat_common/adf_isr.c: In function ‘adf_isr_resource_alloc’:
drivers/crypto/intel/qat/qat_common/adf_isr.c:197:47: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 5 [-Werror=format-truncation=]
--- drivers/crypto/qat/qat_common/adf_accel_devices.h | 2 +- drivers/crypto/qat/qat_common/adf_transport_debug.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -1
@@ -27,7 +27,7 @@#define ADF_PCI_MAX_BARS 3#define ADF_DEVICE_NAME_LENGTH 32#define ADF_ETR_MAX_RINGS_PER_BANK 16 -#define ADF_MAX_MSIX_VECTOR_NAME 16 +#define ADF_MAX_MSIX_VECTOR_NAME 48#define ADF_DEVICE_NAME_PREFIX "qat_"enum adf_accel_capabilities {
drivers/crypto/qat/qat_common/adf_transport_debug.c +2 -2
@@ -90,7 +90,7 @@ DEFINE_SEQ_ATTRIBUTE(adf_ring_debug);int adf_ring_debugfs_add (struct adf_etr_ring_data *ring,const char *name) {struct adf_etr_ring_debug_entry *ring_debug; -char entry_name[8 ]; +char entry_name[16 ]; ring_debug =kzalloc (sizeof (*ring_debug),GFP_KERNEL );if (!ring_debug)
@@ -192,7 +192,7 @@ int adf_bank_debugfs_add(struct adf_etr_bank_data *bank) {struct adf_accel_dev *accel_dev = bank->accel_dev;struct dentry *parent = accel_dev->transport->debug; -char name[8 ]; +char name[16 ];snprintf (name,sizeof (name),"bank_%02d" , bank->bank_number); bank->bank_debug_dir =debugfs_create_dir (name, parent);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 208/379 PCI: vmd: Correct PCI Header Type Registers multi-function check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 5827e17d0555b566c32044b0632b46f9f95054fa ]
vmd_domain_reset() attempts to find whether the device may contain multiple functions by checking 0x80 (Multi-Function Device), however, the hdr_type variable has already been masked with PCI_HEADER_TYPE_MASK so the check can never true.
To fix the issue, don't mask the read with PCI_HEADER_TYPE_MASK.
--- drivers/pci/controller/vmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pci/controller/vmd.c +1 -2
@@ -510,8 +510,7 @@ static void vmd_domain_reset(struct vmd_dev *vmd) base = vmd->cfgbar +PCIE_ECAM_OFFSET (bus,PCI_DEVFN (dev,0 ),0 ); - hdr_type =readb (base +PCI_HEADER_TYPE ) & -PCI_HEADER_TYPE_MASK ; + hdr_type =readb (base +PCI_HEADER_TYPE ); functions = (hdr_type &0x80 ) ?8 :1 ;for (fn =0 ; fn < functions; fn++) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 209/379 hid: cp2112: Fix duplicate workqueue initialization
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danny Kaehn <[email protected]>
[ Upstream commit e3c2d2d144c082dd71596953193adf9891491f42 ]
Previously the cp2112 driver called INIT_DELAYED_WORK within cp2112_gpio_irq_startup, resulting in duplicate initilizations of the workqueue on subsequent IRQ startups following an initial request. This resulted in a warning in set_work_data in workqueue.c, as well as a rare NULL dereference within process_one_work in workqueue.c.
Initialize the workqueue within _probe instead.
--- drivers/hid/hid-cp2112.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-cp2112.c +2 -2
@@ -1159,8 +1159,6 @@ static unsigned int cp2112_gpio_irq_startup(struct irq_data *d)struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct cp2112_device *dev =gpiochip_get_data (gc); -INIT_DELAYED_WORK (&dev->gpio_poll_worker, cp2112_gpio_poll_callback); -if (!dev->gpio_poll) { dev->gpio_poll = true;schedule_delayed_work (&dev->gpio_poll_worker,0 );
@@ -1356,6 +1354,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) girq->handler = handle_simple_irq; girq->threaded = true; +INIT_DELAYED_WORK (&dev->gpio_poll_worker, cp2112_gpio_poll_callback); + ret =gpiochip_add_data (&dev->gc, dev);if (ret <0 ) {hid_err (hdev,"error registering gpio chip\n" );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 210/379 crypto: hisilicon/qm - delete redundant null assignment operations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Ye <[email protected]>
[ Upstream commit 7bbbc9d81be588ae4fb28b5b202e4421dbfef197 ]
There is no security data in the pointer. It is only a value transferred as a structure. It makes no sense to zero a variable that is on the stack. So not need to set the pointer to null.
Stable-dep-of: 5831fc1fd4a5 ("crypto: hisilicon/qm - fix PF queue parameter issue")
--- drivers/crypto/hisilicon/qm.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/hisilicon/qm.c +0 -1
@@ -1773,7 +1773,6 @@ static void dfx_regs_uninit(struct hisi_qm *qm, dregs[i].regs =NULL ; }kfree (dregs); - dregs =NULL ; }/**
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 211/379 crypto: hisilicon/qm - modify the process of regs dfx
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Ye <[email protected]>
[ Upstream commit b40b62ed7b0ffe8eb2e6fe8bcfb47027c9a93e93 ]
The last register logic and different register logic are combined. Use "u32" instead of 'int' in the regs function input parameter to simplify some checks.
Stable-dep-of: 5831fc1fd4a5 ("crypto: hisilicon/qm - fix PF queue parameter issue")
--- drivers/crypto/hisilicon/hpre/hpre_main.c | 7 +- drivers/crypto/hisilicon/qm.c | 151 ++++++++++++---------- drivers/crypto/hisilicon/sec2/sec_main.c | 7 +- drivers/crypto/hisilicon/zip/zip_main.c | 7 +- include/linux/hisi_acc_qm.h | 8 +- 5 files changed, 99 insertions(+), 81 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_main.c +3 -4
@@ -1101,8 +1101,7 @@ static int hpre_debugfs_init(struct hisi_qm *qm) qm->debug.sqe_mask_offset =HPRE_SQE_MASK_OFFSET ; qm->debug.sqe_mask_len =HPRE_SQE_MASK_LEN ; - ret =hisi_qm_diff_regs_init (qm, hpre_diff_regs, -ARRAY_SIZE (hpre_diff_regs)); + ret =hisi_qm_regs_debugfs_init (qm, hpre_diff_regs,ARRAY_SIZE (hpre_diff_regs));if (ret) {dev_warn (dev,"Failed to init HPRE diff regs!\n" ); goto debugfs_remove;
@@ -1121,7 +1120,7 @@ static int hpre_debugfs_init(struct hisi_qm *qm)return 0 ; failed_to_create: -hisi_qm_diff_regs_uninit (qm,ARRAY_SIZE (hpre_diff_regs)); +hisi_qm_regs_debugfs_uninit (qm,ARRAY_SIZE (hpre_diff_regs)); debugfs_remove:debugfs_remove_recursive (qm->debug.debug_root);return ret;
@@ -1129,7 +1128,7 @@ static int hpre_debugfs_init(struct hisi_qm *qm)static void hpre_debugfs_exit (struct hisi_qm *qm) { -hisi_qm_diff_regs_uninit (qm,ARRAY_SIZE (hpre_diff_regs)); +hisi_qm_regs_debugfs_uninit (qm,ARRAY_SIZE (hpre_diff_regs));debugfs_remove_recursive (qm->debug.debug_root); }
drivers/crypto/hisilicon/qm.c +86 -65
229 lines not on this page · raw message
drivers/crypto/hisilicon/sec2/sec_main.c +3 -4
@@ -899,8 +899,7 @@ static int sec_debugfs_init(struct hisi_qm *qm) qm->debug.sqe_mask_offset =SEC_SQE_MASK_OFFSET ; qm->debug.sqe_mask_len =SEC_SQE_MASK_LEN ; - ret =hisi_qm_diff_regs_init (qm, sec_diff_regs, -ARRAY_SIZE (sec_diff_regs)); + ret =hisi_qm_regs_debugfs_init (qm, sec_diff_regs,ARRAY_SIZE (sec_diff_regs));if (ret) {dev_warn (dev,"Failed to init SEC diff regs!\n" ); goto debugfs_remove;
@@ -915,7 +914,7 @@ static int sec_debugfs_init(struct hisi_qm *qm)return 0 ; failed_to_create: -hisi_qm_diff_regs_uninit (qm,ARRAY_SIZE (sec_diff_regs)); +hisi_qm_regs_debugfs_uninit (qm,ARRAY_SIZE (sec_diff_regs)); debugfs_remove:debugfs_remove_recursive (sec_debugfs_root);return ret;
@@ -923,7 +922,7 @@ static int sec_debugfs_init(struct hisi_qm *qm)static void sec_debugfs_exit (struct hisi_qm *qm) { -hisi_qm_diff_regs_uninit (qm,ARRAY_SIZE (sec_diff_regs)); +hisi_qm_regs_debugfs_uninit (qm,ARRAY_SIZE (sec_diff_regs));debugfs_remove_recursive (qm->debug.debug_root); }
drivers/crypto/hisilicon/zip/zip_main.c +3 -4
@@ -849,8 +849,7 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm) qm->debug.sqe_mask_offset =HZIP_SQE_MASK_OFFSET ; qm->debug.sqe_mask_len =HZIP_SQE_MASK_LEN ; qm->debug.debug_root = dev_d; - ret =hisi_qm_diff_regs_init (qm, hzip_diff_regs, -ARRAY_SIZE (hzip_diff_regs)); + ret =hisi_qm_regs_debugfs_init (qm, hzip_diff_regs,ARRAY_SIZE (hzip_diff_regs));if (ret) {dev_warn (dev,"Failed to init ZIP diff regs!\n" ); goto debugfs_remove;
@@ -869,7 +868,7 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm)return 0 ; failed_to_create: -hisi_qm_diff_regs_uninit (qm,ARRAY_SIZE (hzip_diff_regs)); +hisi_qm_regs_debugfs_uninit (qm,ARRAY_SIZE (hzip_diff_regs)); debugfs_remove:debugfs_remove_recursive (hzip_debugfs_root);return ret;
@@ -895,7 +894,7 @@ static void hisi_zip_debug_regs_clear(struct hisi_qm *qm)static void hisi_zip_debugfs_exit (struct hisi_qm *qm) { -hisi_qm_diff_regs_uninit (qm,ARRAY_SIZE (hzip_diff_regs)); +hisi_qm_regs_debugfs_uninit (qm,ARRAY_SIZE (hzip_diff_regs));debugfs_remove_recursive (qm->debug.debug_root);
include/linux/hisi_acc_qm.h +4 -4
@@ -471,11 +471,11 @@ int hisi_qm_sriov_disable(struct pci_dev *pdev, bool is_frozen);int hisi_qm_sriov_configure (struct pci_dev *pdev,int num_vfs);void hisi_qm_dev_err_init (struct hisi_qm *qm);void hisi_qm_dev_err_uninit (struct hisi_qm *qm); -int hisi_qm_diff_regs_init (struct hisi_qm *qm, -struct dfx_diff_registers *dregs,int reg_len); -void hisi_qm_diff_regs_uninit (struct hisi_qm *qm,int reg_len); +int hisi_qm_regs_debugfs_init (struct hisi_qm *qm, +struct dfx_diff_registers *dregs,u32 reg_len); +void hisi_qm_regs_debugfs_uninit (struct hisi_qm *qm,u32 reg_len);void hisi_qm_acc_diff_regs_dump (struct hisi_qm *qm,struct seq_file *s, -struct dfx_diff_registers *dregs,int regs_len); +struct dfx_diff_registers *dregs,u32 regs_len);pci_ers_result_t hisi_qm_dev_err_detected (struct pci_dev *pdev,pci_channel_state_t state);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 212/379 crypto: hisilicon/qm - split a debugfs.c from qm
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Ye <[email protected]>
[ Upstream commit 94476b2b6d60bc926a585ae62e1bf69bd22c1dff ]
Considering that the qm feature and debugfs feature are independent. The code related to debugfs is getting larger and larger. It should be separate as a debugfs file. So move some debugfs code to new file from qm file. The qm code logic is not modified. And maintainability is enhanced.
Stable-dep-of: 5831fc1fd4a5 ("crypto: hisilicon/qm - fix PF queue parameter issue")
--- drivers/crypto/hisilicon/Makefile | 2 +- drivers/crypto/hisilicon/debugfs.c | 1097 +++++++++++++++++++++ drivers/crypto/hisilicon/qm.c | 1348 ++------------------------ drivers/crypto/hisilicon/qm_common.h | 87 ++ 4 files changed, 1277 insertions(+), 1257 deletions(-) create mode 100644 drivers/crypto/hisilicon/debugfs.c create mode 100644 drivers/crypto/hisilicon/qm_common.h
drivers/crypto/hisilicon/Makefile +1 -1
@@ -3,6 +3,6 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_HPRE) += hpre/ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC) += sec/ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC2) += sec2/ obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o -hisi_qm-objs = qm.o sgl.o +hisi_qm-objs = qm.o sgl.o debugfs.o obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/ obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += trng/
drivers/crypto/hisilicon/debugfs.c new file +1097 -0
1,097 lines not on this page · raw message
drivers/crypto/hisilicon/qm.c +92 -1256
1,516 lines not on this page · raw message
drivers/crypto/hisilicon/qm_common.h new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 213/379 crypto: hisilicon/qm - fix PF queue parameter issue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longfang Liu <[email protected]>
[ Upstream commit 5831fc1fd4a578232fea708b82de0c666ed17153 ]
If the queue isolation feature is enabled, the number of queues supported by the device changes. When PF is enabled using the current default number of queues, the default number of queues may be greater than the number supported by the device. As a result, the PF fails to be bound to the driver.
After modification, if queue isolation feature is enabled, when the default queue parameter is greater than the number supported by the device, the number of enabled queues will be changed to the number supported by the device, so that the PF and driver can be properly bound.
--- drivers/crypto/hisilicon/hpre/hpre_main.c | 5 +++++ drivers/crypto/hisilicon/qm.c | 18 ++++++++++++------ drivers/crypto/hisilicon/qm_common.h | 1 - drivers/crypto/hisilicon/sec2/sec_main.c | 5 +++++ drivers/crypto/hisilicon/zip/zip_main.c | 5 +++++ include/linux/hisi_acc_qm.h | 7 +++++++ 6 files changed, 34 insertions(+), 7 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_main.c +5 -0
@@ -431,8 +431,11 @@ static u32 uacce_mode = UACCE_MODE_NOUACCE;module_param_cb (uacce_mode, &hpre_uacce_mode_ops, &uacce_mode,0444 );MODULE_PARM_DESC (uacce_mode,UACCE_MODE_DESC ); +static bool pf_q_num_flag;static int pf_q_num_set (const char *val,const struct kernel_param *kp) { + pf_q_num_flag = true; +return q_num_set (val, kp,PCI_DEVICE_ID_HUAWEI_HPRE_PF ); }
@@ -1155,6 +1158,8 @@ static int hpre_qm_init(struct hisi_qm *qm, struct pci_dev *pdev) qm->qp_num = pf_q_num; qm->debug.curr_qm_qp_num = pf_q_num; qm->qm_list = &hpre_devices; +if (pf_q_num_flag) +set_bit (QM_MODULE_PARAM , &qm->misc_ctl); } ret =hisi_qm_init (qm);
drivers/crypto/hisilicon/qm.c +12 -6
@@ -209,8 +209,6 @@#define WAIT_PERIOD 20#define REMOVE_WAIT_DELAY 10 -#define QM_DRIVER_REMOVING 0 -#define QM_RST_SCHED 1#define QM_QOS_PARAM_NUM 2#define QM_QOS_VAL_NUM 1#define QM_QOS_BDF_PARAM_NUM 4
@@ -2689,7 +2687,6 @@ static void hisi_qm_pre_init(struct hisi_qm *qm)mutex_init (&qm->mailbox_lock);init_rwsem (&qm->qps_lock); qm->qp_in_used =0 ; - qm->misc_ctl = false;if (test_bit (QM_SUPPORT_RPM , &qm->caps)) {if (!acpi_device_power_manageable (ACPI_COMPANION (&pdev->dev)))dev_info (&pdev->dev,"_PS0 and _PR0 are not defined" );
@@ -4969,6 +4966,7 @@ static int qm_irqs_register(struct hisi_qm *qm)static int qm_get_qp_num (struct hisi_qm *qm) { +struct device *dev = &qm->pdev->dev;bool is_db_isolation;/* VF's qp_num assigned by PF in v2, and VF can get qp_num by vft. */
@@ -4985,13 +4983,21 @@ static int qm_get_qp_num(struct hisi_qm *qm) qm->max_qp_num =hisi_qm_get_hw_info (qm, qm_basic_info,QM_FUNC_MAX_QP_CAP , is_db_isolation); -/* check if qp number is valid */ -if (qm->qp_num > qm->max_qp_num) { -dev_err (&qm->pdev->dev,"qp num(%u) is more than max qp num(%u)!\n" , +if (qm->qp_num <= qm->max_qp_num) +return 0 ; + +if (test_bit (QM_MODULE_PARAM , &qm->misc_ctl)) { +/* Check whether the set qp number is valid */ +dev_err (dev,"qp num(%u) is more than max qp num(%u)!\n" , qm->qp_num, qm->max_qp_num);return -EINVAL ; } +dev_info (dev,"Default qp num(%u) is too big, reset it to Function's max qp num(%u)!\n" , + qm->qp_num, qm->max_qp_num); + qm->qp_num = qm->max_qp_num; + qm->debug.curr_qm_qp_num = qm->qp_num; +return 0 ; }
drivers/crypto/hisilicon/qm_common.h +0 -1
@@ -4,7 +4,6 @@#define QM_COMMON_H #define QM_DBG_READ_LEN 256 -#define QM_RESETTING 2struct qm_cqe {__le32 rsvd0;
drivers/crypto/hisilicon/sec2/sec_main.c +5 -0
@@ -312,8 +312,11 @@ static int sec_diff_regs_show(struct seq_file *s, void *unused) }DEFINE_SHOW_ATTRIBUTE (sec_diff_regs); +static bool pf_q_num_flag;static int sec_pf_q_num_set (const char *val,const struct kernel_param *kp) { + pf_q_num_flag = true; +return q_num_set (val, kp,PCI_DEVICE_ID_HUAWEI_SEC_PF ); }
@@ -1122,6 +1125,8 @@ static int sec_qm_init(struct hisi_qm *qm, struct pci_dev *pdev) qm->qp_num = pf_q_num; qm->debug.curr_qm_qp_num = pf_q_num; qm->qm_list = &sec_devices; +if (pf_q_num_flag) +set_bit (QM_MODULE_PARAM , &qm->misc_ctl); }else if (qm->fun_type ==QM_HW_VF && qm->ver ==QM_HW_V1 ) {/* * have no way to get qm configure in VM in v1 hardware,
drivers/crypto/hisilicon/zip/zip_main.c +5 -0
@@ -365,8 +365,11 @@ static u32 uacce_mode = UACCE_MODE_NOUACCE;module_param_cb (uacce_mode, &zip_uacce_mode_ops, &uacce_mode,0444 );MODULE_PARM_DESC (uacce_mode,UACCE_MODE_DESC ); +static bool pf_q_num_flag;static int pf_q_num_set (const char *val,const struct kernel_param *kp) { + pf_q_num_flag = true; +return q_num_set (val, kp,PCI_DEVICE_ID_HUAWEI_ZIP_PF ); }
@@ -1140,6 +1143,8 @@ static int hisi_zip_qm_init(struct hisi_qm *qm, struct pci_dev *pdev) qm->qp_num = pf_q_num; qm->debug.curr_qm_qp_num = pf_q_num; qm->qm_list = &zip_devices; +if (pf_q_num_flag) +set_bit (QM_MODULE_PARAM , &qm->misc_ctl); }else if (qm->fun_type ==QM_HW_VF && qm->ver ==QM_HW_V1 ) {/* * have no way to get qm configure in VM in v1 hardware,
include/linux/hisi_acc_qm.h +7 -0
@@ -145,6 +145,13 @@ enum qm_vf_state { QM_NOT_READY, }; +enum qm_misc_ctl_bits { +QM_DRIVER_REMOVING =0x0 , +QM_RST_SCHED , +QM_RESETTING , +QM_MODULE_PARAM , +}; +enum qm_cap_bits {QM_SUPPORT_DB_ISOLATION =0x0 ,QM_SUPPORT_FUNC_QOS ,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 214/379 ARM: 9321/1: memset: cast the constant byte to unsigned char
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kursad Oney <[email protected]>
[ Upstream commit c0e824661f443b8cab3897006c1bbc69fd0e7bc4 ]
memset() description in ISO/IEC 9899:1999 (and elsewhere) says:
The memset function copies the value of c (converted to an unsigned char) into each of the first n characters of the object pointed to by s.
The kernel's arm32 memset does not cast c to unsigned char. This results in the following code to produce erroneous output:
char a[128]; memset(a, -128, sizeof(a));
This is because gcc will generally emit the following code before it calls memset() :
mov r0, r7 mvn r1, #127 ; 0x7f bl 00000000 <memset>
r1 ends up with 0xffffff80 before being used by memset() and the 'a' array will have -128 once in every four bytes while the other bytes will be set incorrectly to -1 like this (printing the first 8 bytes) :
test_module: -128 -1 -1 -1 test_module: -1 -1 -1 -128
The change here is to 'and' r1 with 255 before it is used.
--- arch/arm/lib/memset.S | 1 + 1 file changed, 1 insertion(+)
arch/arm/lib/memset.S +1 -0
@@ -17,6 +17,7 @@ ENTRY(__memset) ENTRY(mmioset) WEAK(memset) UNWIND( .fnstart ) + and r1, r1, #255 @ cast to unsigned char ands r3, r0, #3 @ 1 unaligned? mov ip, r0 @ preserve r0 as return value bne 6f @ 1
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 215/379 ext4: move ix sanity check to corrent position
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gou Hao <[email protected]>
[ Upstream commit af90a8f4a09ec4a3de20142e37f37205d4687f28 ]
Check 'ix' before it is used.
--- fs/ext4/extents.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/ext4/extents.c +5 -5
@@ -1010,6 +1010,11 @@ static int ext4_ext_insert_index(handle_t *handle, struct inode *inode, ix = curp->p_idx; } +if (unlikely (ix >EXT_MAX_INDEX (curp->p_hdr))) { +EXT4_ERROR_INODE (inode,"ix > EXT_MAX_INDEX!" ); +return -EFSCORRUPTED ; + } + len =EXT_LAST_INDEX (curp->p_hdr) - ix +1 ;BUG_ON (len <0 );if (len >0 ) {
@@ -1019,11 +1024,6 @@ static int ext4_ext_insert_index(handle_t *handle, struct inode *inode,memmove (ix +1 , ix, len *sizeof (struct ext4_extent_idx )); } -if (unlikely (ix >EXT_MAX_INDEX (curp->p_hdr))) { -EXT4_ERROR_INODE (inode,"ix > EXT_MAX_INDEX!" ); -return -EFSCORRUPTED ; - } - ix->ei_block =cpu_to_le32 (logical);ext4_idx_store_pblock (ix, ptr);le16_add_cpu (&curp->p_hdr->eh_entries,1 );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 216/379 ASoC: fsl: mpc5200_dma.c: Fix warning of Function parameter or member not described
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
[ Upstream commit 4a221b2e3340f4a3c2b414c46c846a26c6caf820 ]
This patch fixes the warnings of "Function parameter or member 'xxx' not described".
Quoted 1 line
Quoted 1 line
sound/soc/fsl/mpc5200_dma.c:116: warning: Function parameter or member 'component' not described in 'psc_dma_trigger'
sound/soc/fsl/mpc5200_dma.c:116: warning: Function parameter or member 'substream' not described in 'psc_dma_trigger' sound/soc/fsl/mpc5200_dma.c:116: warning: Function parameter or member 'cmd' not described in 'psc_dma_trigger'
--- sound/soc/fsl/mpc5200_dma.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/fsl/mpc5200_dma.c +3 -0
@@ -100,6 +100,9 @@ static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream)/** * psc_dma_trigger: start and stop the DMA transfer. +* @component: triggered component +* @substream: triggered substream +* @cmd: triggered command * * This function is called by ALSA to start, stop, pause, and resume the DMA * transfer of data.
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 217/379 IB/mlx5: Fix rdma counter binding for RAW QP
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit c1336bb4aa5e809a622a87d74311275514086596 ]
Previously when we had a RAW QP, we bound a counter to it when it moved to INIT state, using the counter context inside RQC.
But when we try to modify that counter later in RTS state we used modify QP which tries to change the counter inside QPC instead of RQC.
Now we correctly modify the counter set_id inside of RQC instead of QPC for the RAW QP.
--- drivers/infiniband/hw/mlx5/qp.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/infiniband/hw/mlx5/qp.c +27 -0
@@ -3960,6 +3960,30 @@ static unsigned int get_tx_affinity(struct ib_qp *qp,return tx_affinity; } +static int __mlx5_ib_qp_set_raw_qp_counter (struct mlx5_ib_qp *qp,u32 set_id, +struct mlx5_core_dev *mdev) +{ +struct mlx5_ib_raw_packet_qp *raw_packet_qp = &qp->raw_packet_qp; +struct mlx5_ib_rq *rq = &raw_packet_qp->rq; +u32 in[MLX5_ST_SZ_DW (modify_rq_in)] = {}; +void *rqc; + +if (!qp->rq.wqe_cnt) +return 0 ; + +MLX5_SET (modify_rq_in, in, rq_state, rq->state); +MLX5_SET (modify_rq_in, in, uid,to_mpd (qp->ibqp.pd)->uid); + + rqc =MLX5_ADDR_OF (modify_rq_in, in, ctx); +MLX5_SET (rqc, rqc, state,MLX5_RQC_STATE_RDY ); + +MLX5_SET64 (modify_rq_in, in, modify_bitmask, +MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID ); +MLX5_SET (rqc, rqc, counter_set_id, set_id); + +return mlx5_core_modify_rq (mdev, rq->base.mqp.qpn, in); +} +static int __mlx5_ib_qp_set_counter (struct ib_qp *qp,struct rdma_counter *counter) {
@@ -3975,6 +3999,9 @@ static int __mlx5_ib_qp_set_counter(struct ib_qp *qp,else set_id =mlx5_ib_get_counters_id (dev, mqp->port -1 ); +if (mqp->type ==IB_QPT_RAW_PACKET ) +return __mlx5_ib_qp_set_raw_qp_counter (mqp, set_id, dev->mdev); + base = &mqp->trans_qp.base;MLX5_SET (rts2rts_qp_in, in, opcode,MLX5_CMD_OP_RTS2RTS_QP );MLX5_SET (rts2rts_qp_in, in, qpn, base->mqp.qpn);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 218/379 RDMA/hns: Fix printing level of asynchronous events
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 9faef73ef4f6666b97e04d99734ac09251098185 ]
The current driver will print all asynchronous events. Some of the print levels are set improperly, e.g. SRQ limit reach and SRQ last wqe reach, which may also occur during normal operation of the software. Currently, the information of these event is printed as a warning, which causes a large amount of printing even during normal use of the application. As a result, the service performance deteriorates.
This patch fixes the printing storms by modifying the print level.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -3
@@ -5961,7 +5961,7 @@ static void hns_roce_irq_work_handle(struct work_struct *work)case HNS_ROCE_EVENT_TYPE_COMM_EST :break ;case HNS_ROCE_EVENT_TYPE_SQ_DRAINED : -ibdev_warn (ibdev,"send queue drained.\n" ); +ibdev_dbg (ibdev,"send queue drained.\n" );break ;case HNS_ROCE_EVENT_TYPE_WQ_CATAS_ERROR : ibdev_err(ibdev, "local work queue 0x%x catast error, sub_event type is: %d\n",
@@ -5976,10 +5976,10 @@ static void hns_roce_irq_work_handle(struct work_struct *work) irq_work->queue_num, irq_work->sub_type);break ;case HNS_ROCE_EVENT_TYPE_SRQ_LIMIT_REACH : -ibdev_warn (ibdev,"SRQ limit reach.\n" ); +ibdev_dbg (ibdev,"SRQ limit reach.\n" );break ;case HNS_ROCE_EVENT_TYPE_SRQ_LAST_WQE_REACH : -ibdev_warn (ibdev,"SRQ last wqe reach.\n" ); +ibdev_dbg (ibdev,"SRQ last wqe reach.\n" );break ;case HNS_ROCE_EVENT_TYPE_SRQ_CATAS_ERROR :ibdev_err (ibdev,"SRQ catas error.\n" );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 219/379 RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit c64e9710f9241e38a1c761ed1c1a30854784da66 ]
ucmd in hns_roce_create_qp_common() are not initialized. But it works fine until new member sdb_addr is added to struct hns_roce_ib_create_qp.
If the user-mode driver uses an old version ABI, then the value of the new member will be undefined after ib_copy_from_udata().
This patch fixes it by initialize this variable to 0. And the default value of the new member sdb_addr will be 0 which is invalid.
--- drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_qp.c +1 -1
@@ -1128,7 +1128,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, {struct hns_roce_ib_create_qp_resp resp = {};struct ib_device *ibdev = &hr_dev->ib_dev; -struct hns_roce_ib_create_qp ucmd; +struct hns_roce_ib_create_qp ucmd = {};int ret;mutex_init (&hr_qp->mutex);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 220/379 RDMA/hns: Fix signed-unsigned mixed comparisons
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit b5f9efff101b06fd06a5e280a2b00b1335f5f476 ]
The ib_mtu_enum_to_int() and uverbs_attr_get_len() may returns a negative value. In this case, mixed comparisons of signed and unsigned types will throw wrong results.
This patch adds judgement for this situation.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -1
@@ -270,7 +270,7 @@ static bool check_inl_data_len(struct hns_roce_qp *qp, unsigned int len)struct hns_roce_dev *hr_dev =to_hr_dev (qp->ibqp.device);int mtu =ib_mtu_enum_to_int (qp->path_mtu); -if (len > qp->max_inline_data || len > mtu) { +if (mtu <0 || len > qp->max_inline_data || len > mtu) {ibdev_err (&hr_dev->ib_dev,"invalid length of data, data len = %u, max inline len = %u, path mtu = %d.\n" , len, qp->max_inline_data, mtu);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 221/379 RDMA/hns: Add check for SL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luoyouming <[email protected]>
[ Upstream commit 5e617c18b1f34ec57ad5dce44f09de603cf6bd6c ]
SL set by users may exceed the capability of devices. So add check for this situation.
--- drivers/infiniband/hw/hns/hns_roce_ah.c | 13 +++++++++++- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 23 ++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-)
drivers/infiniband/hw/hns/hns_roce_ah.c +12 -1
@@ -33,7 +33,9 @@#include <linux/pci.h> #include <rdma/ib_addr.h> #include <rdma/ib_cache.h> +#include "hnae3.h" #include "hns_roce_device.h" +#include "hns_roce_hw_v2.h" static inline u16 get_ah_udp_sport (const struct rdma_ah_attr *ah_attr) {
@@ -58,6 +60,7 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,struct hns_roce_dev *hr_dev =to_hr_dev (ibah->device);struct hns_roce_ah *ah =to_hr_ah (ibah);int ret =0 ; +u32 max_sl;if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 && udata)return -EOPNOTSUPP ;
@@ -71,9 +74,17 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, ah->av.hop_limit = grh->hop_limit; ah->av.flowlabel = grh->flow_label; ah->av.udp_sport =get_ah_udp_sport (ah_attr); - ah->av.sl =rdma_ah_get_sl (ah_attr); ah->av.tclass =get_tclass (grh); + ah->av.sl =rdma_ah_get_sl (ah_attr); + max_sl =min_t (u32,MAX_SERVICE_LEVEL , hr_dev->caps.sl_num -1 ); +if (unlikely (ah->av.sl > max_sl)) { +ibdev_err_ratelimited (&hr_dev->ib_dev, +"failed to set sl, sl (%u) shouldn't be larger than %u.\n" , + ah->av.sl, max_sl); +return -EINVAL ; + } +memcpy (ah->av.dgid, grh->dgid.raw,HNS_ROCE_GID_SIZE );memcpy (ah->av.mac, ah_attr->roce.dmac,ETH_ALEN );
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +13 -10
@@ -4979,22 +4979,32 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp,struct hns_roce_qp *hr_qp =to_hr_qp (ibqp);struct ib_device *ibdev = &hr_dev->ib_dev;const struct ib_gid_attr *gid_attr =NULL ; +u8 sl =rdma_ah_get_sl (&attr->ah_attr);int is_roce_protocol;u16 vlan_id =0xffff ;bool is_udp = false; +u32 max_sl;u8 ib_port;u8 hr_port;int ret; + max_sl =min_t (u32,MAX_SERVICE_LEVEL , hr_dev->caps.sl_num -1 ); +if (unlikely (sl > max_sl)) { +ibdev_err_ratelimited (ibdev, +"failed to fill QPC, sl (%u) shouldn't be larger than %u.\n" , + sl, max_sl); +return -EINVAL ; + } +/* * If free_mr_en of qp is set, it means that this qp comes from * free mr. This qp will perform the loopback operation. * In the loopback scenario, only sl needs to be set. */ if (hr_qp->free_mr_en) { -hr_reg_write (context,QPC_SL ,rdma_ah_get_sl (&attr->ah_attr)); +hr_reg_write (context,QPC_SL , sl);hr_reg_clear (qpc_mask,QPC_SL ); - hr_qp->sl =rdma_ah_get_sl (&attr->ah_attr); + hr_qp->sl = sl;return 0 ; }
@@ -5061,14 +5071,7 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp,memcpy (context->dgid, grh->dgid.raw,sizeof (grh->dgid.raw));memset (qpc_mask->dgid,0 ,sizeof (grh->dgid.raw)); - hr_qp->sl =rdma_ah_get_sl (&attr->ah_attr); -if (unlikely (hr_qp->sl >MAX_SERVICE_LEVEL )) { -ibdev_err (ibdev, -"failed to fill QPC, sl (%u) shouldn't be larger than %d.\n" , - hr_qp->sl,MAX_SERVICE_LEVEL ); -return -EINVAL ; - } - + hr_qp->sl = sl;hr_reg_write (context,QPC_SL , hr_qp->sl);hr_reg_clear (qpc_mask,QPC_SL );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 222/379 RDMA/hns: The UD mode can only be configured with DCQCN
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luoyouming <[email protected]>
[ Upstream commit 27c5fd271d8b8730fc0bb1b6cae953ad7808a874 ]
Due to hardware limitations, only DCQCN is supported for UD. Therefore, the default algorithm for UD is set to DCQCN.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -0
@@ -4883,6 +4883,9 @@ static int check_cong_type(struct ib_qp *ibqp, {struct hns_roce_dev *hr_dev =to_hr_dev (ibqp->device); +if (ibqp->qp_type ==IB_QPT_UD ) + hr_dev->caps.cong_type =CONG_TYPE_DCQCN ; +/* different congestion types match different configurations */ switch (hr_dev->caps.cong_type) {case CONG_TYPE_DCQCN :
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 223/379 ASoC: SOF: core: Ensure sof_ops_free() is still called when probe never ran.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
[ Upstream commit f549a82aff57865c47b5abd17336b23cd9bb2d2c ]
In an effort to not call sof_ops_free twice, we stopped running it when probe was aborted.
Check the result of cancel_work_sync to see if this was the case.
--- sound/soc/sof/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/sof/core.c +5 -1
@@ -434,9 +434,10 @@ int snd_sof_device_remove(struct device *dev)struct snd_sof_dev *sdev =dev_get_drvdata (dev);struct snd_sof_pdata *pdata = sdev->pdata;int ret; +bool aborted = false;if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )) -cancel_work_sync (&sdev->probe_work); + aborted =cancel_work_sync (&sdev->probe_work);/* * Unregister any registered client device first before IPC and debugfs
@@ -462,6 +463,9 @@ int snd_sof_device_remove(struct device *dev)snd_sof_free_debug (sdev);snd_sof_remove (sdev);sof_ops_free (sdev); + }else if (aborted) { +/* probe_work never ran */ +sof_ops_free (sdev); }/* release firmware */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 224/379 ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <[email protected]>
[ Upstream commit 9e630efb5a4af56fdb15aa10405f5cfd3f5f5b83 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by calling pm_runtime_disable when error returns.
--- sound/soc/fsl/fsl_easrc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_easrc.c +6 -2
@@ -1966,17 +1966,21 @@ static int fsl_easrc_probe(struct platform_device *pdev) &fsl_easrc_dai, 1);if (ret) {dev_err (dev,"failed to register ASoC DAI\n" ); -return ret; + goto err_pm_disable; } ret =devm_snd_soc_register_component (dev, &fsl_asrc_component,NULL ,0 );if (ret) {dev_err (&pdev->dev,"failed to register ASoC platform\n" ); -return ret; + goto err_pm_disable; }return 0 ; + +err_pm_disable: +pm_runtime_disable (&pdev->dev); +return ret; }static int fsl_easrc_remove (struct platform_device *pdev)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 225/379 scsi: ufs: core: Leave space for \0 in utf8 desc string
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mentz <[email protected]>
[ Upstream commit a75a16c62a2540f11eeae4f2b50e95deefb652ea ]
utf16s_to_utf8s does not NULL terminate the output string. For us to be able to add a NULL character when utf16s_to_utf8s returns, we need to make sure that there is space for such NULL character at the end of the output buffer. We can achieve this by passing an output buffer size to utf16s_to_utf8s that is one character less than what we allocated.
Other call sites of utf16s_to_utf8s appear to be using the same technique where they artificially reduce the buffer size by one to leave space for a NULL character or line feed character.
--- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
@@ -3579,7 +3579,7 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,*/ ret =utf16s_to_utf8s (uc_str->uc, uc_str->len -QUERY_DESC_HDR_SIZE , -UTF16_BIG_ENDIAN , str, ascii_len); +UTF16_BIG_ENDIAN , str, ascii_len -1 );/* replace non-printable or non-ASCII characters with spaces */ for (i =0 ; i < ret; i++)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 226/379 RDMA/hfi1: Workaround truncation compilation error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit d4b2d165714c0ce8777d5131f6e0aad617b7adc4 ]
Increase name array to be large enough to overcome the following compilation error.
drivers/infiniband/hw/hfi1/efivar.c: In function ‘read_hfi1_efi_var’:drivers/infiniband/hw/hfi1/efivar.c:124:44: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
124 | snprintf(name, sizeof(name), "%s-%s", prefix_name, kind);
| ^drivers/infiniband/hw/hfi1/efivar.c:124:9: note: ‘snprintf’ output 2 or more bytes (assuming 65) into a destination of size 64
124 | snprintf(name, sizeof(name), "%s-%s", prefix_name, kind);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/infiniband/hw/hfi1/efivar.c:133:52: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
133 | snprintf(name, sizeof(name), "%s-%s", prefix_name, kind);
| ^drivers/infiniband/hw/hfi1/efivar.c:133:17: note: ‘snprintf’ output 2 or more bytes (assuming 65) into a destination of size 64
133 | snprintf(name, sizeof(name), "%s-%s", prefix_name, kind);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:243: drivers/infiniband/hw/hfi1/efivar.o] Error 1
--- drivers/infiniband/hw/hfi1/efivar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/efivar.c +1 -1
@@ -112,7 +112,7 @@ int read_hfi1_efi_var(struct hfi1_devdata *dd, const char *kind, unsigned long *size, void **return_data) { char prefix_name[64]; -char name[64 ]; +char name[128 ];int result;/* create a common prefix */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 227/379 HID: cp2112: Make irq_chip immutable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 3e2977c425ad2789ca18084fff913cceacae75a2 ]
Since recently, the kernel is nagging about mutable irq_chips:
"not an immutable chip, please consider fixing it!"
Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new helper functions and call the appropriate gpiolib functions.
Stable-dep-of: dc3115e6c5d9 ("hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip")
--- drivers/hid/hid-cp2112.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)
drivers/hid/hid-cp2112.c +20 -13
@@ -163,7 +163,6 @@ struct cp2112_device {atomic_t read_avail;atomic_t xfer_avail;struct gpio_chip gc; -struct irq_chip irq;u8 *in_out_buffer;struct mutex lock;
@@ -1080,16 +1079,20 @@ static void cp2112_gpio_irq_mask(struct irq_data *d) {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct cp2112_device *dev =gpiochip_get_data (gc); +irq_hw_number_t hwirq =irqd_to_hwirq (d); -__clear_bit (d->hwirq, &dev->irq_mask); +__clear_bit (hwirq, &dev->irq_mask); +gpiochip_disable_irq (gc, hwirq); }static void cp2112_gpio_irq_unmask (struct irq_data *d) {struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct cp2112_device *dev =gpiochip_get_data (gc); +irq_hw_number_t hwirq =irqd_to_hwirq (d); -__set_bit (d->hwirq, &dev->irq_mask); +gpiochip_enable_irq (gc, hwirq); +__set_bit (hwirq, &dev->irq_mask); }static void cp2112_gpio_poll_callback (struct work_struct *work)
@@ -1173,6 +1176,7 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d)struct gpio_chip *gc =irq_data_get_irq_chip_data (d);struct cp2112_device *dev =gpiochip_get_data (gc); +cp2112_gpio_irq_mask (d);cancel_delayed_work_sync (&dev->gpio_poll_worker); }
@@ -1226,6 +1230,18 @@ static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev,return ret; } +static const struct irq_chip cp2112_gpio_irqchip = { + .name ="cp2112-gpio" , + .irq_startup = cp2112_gpio_irq_startup, + .irq_shutdown = cp2112_gpio_irq_shutdown, + .irq_ack = cp2112_gpio_irq_ack, + .irq_mask = cp2112_gpio_irq_mask, + .irq_unmask = cp2112_gpio_irq_unmask, + .irq_set_type = cp2112_gpio_irq_type, + .flags =IRQCHIP_MASK_ON_SUSPEND |IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , +}; +static int cp2112_probe (struct hid_device *hdev,const struct hid_device_id *id) {struct cp2112_device *dev;
@@ -1335,17 +1351,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) dev->gc.can_sleep =1 ; dev->gc.parent = &hdev->dev; - dev->irq.name ="cp2112-gpio" ; - dev->irq.irq_startup = cp2112_gpio_irq_startup; - dev->irq.irq_shutdown = cp2112_gpio_irq_shutdown; - dev->irq.irq_ack = cp2112_gpio_irq_ack; - dev->irq.irq_mask = cp2112_gpio_irq_mask; - dev->irq.irq_unmask = cp2112_gpio_irq_unmask; - dev->irq.irq_set_type = cp2112_gpio_irq_type; - dev->irq.flags =IRQCHIP_MASK_ON_SUSPEND ; - girq = &dev->gc.irq; - girq->chip = &dev->irq; +gpio_irq_chip_set_chip (girq, &cp2112_gpio_irqchip);/* The event comes from the outside so no parent handler */ girq->parent_handler =NULL ; girq->num_parents =0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 228/379 hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danny Kaehn <[email protected]>
[ Upstream commit dc3115e6c5d9863ec1a9ff1acf004ede93c34361 ]
Previously cp2112_gpio_irq_shutdown() always cancelled the gpio_poll_worker, even if other IRQs were still active, and did not set the gpio_poll flag to false. This resulted in any call to _shutdown() resulting in interrupts no longer functioning on the chip until a _remove() occurred (a.e. the cp2112 is unplugged or system rebooted).
Only cancel polling if all IRQs are disabled/masked, and correctly set the gpio_poll flag, allowing polling to restart when an interrupt is next enabled.
--- drivers/hid/hid-cp2112.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hid/hid-cp2112.c +5 -1
@@ -1177,7 +1177,11 @@ static void cp2112_gpio_irq_shutdown(struct irq_data *d)struct cp2112_device *dev =gpiochip_get_data (gc);cp2112_gpio_irq_mask (d); -cancel_delayed_work_sync (&dev->gpio_poll_worker); + +if (!dev->irq_mask) { + dev->gpio_poll = false; +cancel_delayed_work_sync (&dev->gpio_poll_worker); + } }static int cp2112_gpio_irq_type (struct irq_data *d,unsigned int type)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 229/379 sh: bios: Revive earlyprintk support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 553f7ac78fbb41b2c93ab9b9d78e42274d27daa9 ]
The SuperH BIOS earlyprintk code is protected by CONFIG_EARLY_PRINTK. However, when this protection was added, it was missed that SuperH no longer defines an EARLY_PRINTK config symbol since commit e76fe57447e88916 ("sh: Remove old early serial console code V2"), so BIOS earlyprintk can no longer be used.
Fix this by reviving the EARLY_PRINTK config symbol.
--- arch/sh/Kconfig.debug | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/sh/Kconfig.debug +11 -0
@@ -22,6 +22,17 @@ config STACK_DEBUG every function call and will therefore incur a major performance hit. Most users should say N. +config EARLY_PRINTK + bool "Early printk" + depends on SH_STANDARD_BIOS + help + Say Y here to redirect kernel printk messages to the serial port + used by the SH-IPL bootloader, starting very early in the boot + process and ending when the kernel's serial console is initialised. + This option is only useful while porting the kernel to a new machine, + when the kernel may crash or hang before the serial console is + initialised. If unsure, say N. + config 4KSTACKS bool "Use 4Kb for kernel stacks instead of 8Kb" depends on DEBUG_KERNEL && (MMU || BROKEN) && !PAGE_SIZE_64KB
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 230/379 Revert "HID: logitech-hidpp: add a module parameter to keep firmware gestures"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bastien Nocera <[email protected]>
[ Upstream commit cae253d6033da885e71c29c1591b22838a52de76 ]
Now that we're in 2022, and the majority of desktop environments can and should support touchpad gestures through libinput, remove the legacy module parameter that made it possible to use gestures implemented in firmware.
This will eventually allow simplifying the driver's initialisation code.
This reverts commit 9188dbaed68a4b23dc96eba165265c08caa7dc2a.
Stable-dep-of: 11ca0322a419 ("HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only")
--- drivers/hid/hid-logitech-hidpp.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/hid/hid-logitech-hidpp.c +0 -10
@@ -31,11 +31,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Benjamin Tissoires <[email protected]>" );MODULE_AUTHOR ("Nestor Lopez Casado <[email protected]>" ); -static bool disable_raw_mode; -module_param (disable_raw_mode, bool,0644 ); -MODULE_PARM_DESC (disable_raw_mode, -"Disable Raw mode reporting for touchpads and keep firmware gestures." ); -static bool disable_tap_to_click;module_param (disable_tap_to_click, bool,0644 ); MODULE_PARM_DESC(disable_tap_to_click,
@@ -4190,11 +4185,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) hidpp_application_equals(hdev, HID_GD_KEYBOARD)) hidpp->quirks |= HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS; -if (disable_raw_mode) { - hidpp->quirks &= ~HIDPP_QUIRK_CLASS_WTP ; - hidpp->quirks &= ~HIDPP_QUIRK_NO_HIDINPUT ; - } -if (hidpp->quirks &HIDPP_QUIRK_CLASS_WTP ) { ret =wtp_allocate (hdev, id);if (ret)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 231/379 HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bastien Nocera <[email protected]>
[ Upstream commit d83956c8855c6c2ed4bd16cec4a5083d63df17e4 ]
HIDPP_QUIRK_NO_HIDINPUT isn't used by any devices but still happens to work as HIDPP_QUIRK_DELAYED_INIT is defined to the same value. Remove HIDPP_QUIRK_NO_HIDINPUT and use HIDPP_QUIRK_DELAYED_INIT everywhere instead.
Tested on a T650 which requires that quirk, and a number of unifying and Bluetooth devices that don't.
Stable-dep-of: 11ca0322a419 ("HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only")
--- drivers/hid/hid-logitech-hidpp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hid/hid-logitech-hidpp.c +3 -5
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(disable_tap_to_click,/* bits 2..20 are reserved for classes */ /* #define HIDPP_QUIRK_CONNECT_EVENTS BIT(21) disabled */ #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) -#define HIDPP_QUIRK_NO_HIDINPUT BIT(23) +#define HIDPP_QUIRK_DELAYED_INIT BIT(23)#define HIDPP_QUIRK_FORCE_OUTPUT_REPORTS BIT(24)#define HIDPP_QUIRK_UNIFYING BIT(25)#define HIDPP_QUIRK_HIDPP_WHEELS BIT(26)
@@ -83,8 +83,6 @@ MODULE_PARM_DESC(disable_tap_to_click, HIDPP_CAPABILITY_HIDPP20_HI_RES_SCROLL | \ HIDPP_CAPABILITY_HIDPP20_HI_RES_WHEEL) -#define HIDPP_QUIRK_DELAYED_INIT HIDPP_QUIRK_NO_HIDINPUT -#define HIDPP_CAPABILITY_HIDPP10_BATTERY BIT(0)#define HIDPP_CAPABILITY_HIDPP20_BATTERY BIT(1)#define HIDPP_CAPABILITY_BATTERY_MILEAGE BIT(2)
@@ -4039,7 +4037,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)if (hidpp->capabilities &HIDPP_CAPABILITY_HI_RES_SCROLL )hi_res_scroll_enable (hidpp); -if (!(hidpp->quirks &HIDPP_QUIRK_NO_HIDINPUT ) || hidpp->delayed_input) +if (!(hidpp->quirks &HIDPP_QUIRK_DELAYED_INIT ) || hidpp->delayed_input)/* if the input nodes are already created, we can stop now */ return ;
@@ -4274,7 +4272,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)hid_hw_close (hdev);hid_hw_stop (hdev); -if (hidpp->quirks &HIDPP_QUIRK_NO_HIDINPUT ) +if (hidpp->quirks &HIDPP_QUIRK_DELAYED_INIT ) connect_mask &= ~HID_CONNECT_HIDINPUT ;/* Now export the actual inputs and hidraw nodes to the world */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 232/379 HID: logitech-hidpp: Dont restart IO, instead defer hid_connect() only
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 11ca0322a41920df2b462d2e45b0731e47ff475b ]
Restarting IO causes 2 problems:
1. Some devices do not like IO being restarted this was addressed in commit 498ba2069035 ("HID: logitech-hidpp: Don't restart communication if not necessary"), but that change has issues of its own and needs to be reverted.
2. Restarting IO and specifically calling hid_device_io_stop() causes received packets to be missed, which may cause connect-events to get missed.
Restarting IO was introduced in commit 91cf9a98ae41 ("HID: logitech-hidpp:
make .probe usbhid capable") to allow to retrieve the device's name and serial number and store these in hdev->name and hdev->uniq before connecting any hid subdrivers (hid-input, hidraw) exporting this info to userspace.
But this does not require restarting IO, this merely requires deferring calling hid_connect(). Calling hid_hw_start() with a connect-mask of 0 makes it skip calling hid_connect(), so hidpp_probe() can simply call hid_connect() later without needing to restart IO.
Remove the stop + restart of IO and instead just call hid_connect() later to avoid the issues caused by restarting IO.
Now that IO is no longer stopped, hid_hw_close() must be called at the end of probe() to balance the hid_hw_open() done at the beginning probe().
This series has been tested on the following devices:
Logitech Bluetooth Laser Travel Mouse (bluetooth, HID++ 1.0) Logitech M720 Triathlon (bluetooth, HID++ 4.5)
Logitech M720 Triathlon (unifying, HID++ 4.5)
Logitech K400 Pro (unifying, HID++ 4.1)
Logitech K270 (eQUAD nano Lite, HID++ 2.0)
Logitech M185 (eQUAD nano Lite, HID++ 4.5)
Logitech LX501 keyboard (27 Mhz, HID++ builtin scroll-wheel, HID++ 1.0) Logitech M-RAZ105 mouse (27 Mhz, HID++ extra mouse buttons, HID++ 1.0)
And by bentiss:
Logitech Touchpad T650 (unifying)
Logitech Touchpad T651 (bluetooth)
Logitech MX Master 3B (BLE)
Logitech G403 (plain USB / Gaming receiver)
--- drivers/hid/hid-logitech-hidpp.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/hid/hid-logitech-hidpp.c +12 -10
@@ -4208,8 +4208,10 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) hdev->name);/* -* Plain USB connections need to actually call start and open -* on the transport driver to allow incoming data. +* First call hid_hw_start(hdev, 0) to allow IO without connecting any +* hid subdrivers (hid-input, hidraw). This allows retrieving the dev's +* name and serial number and store these in hdev->name and hdev->uniq, +* before the hid-input and hidraw drivers expose these to userspace. */ ret =hid_hw_start (hdev, will_restart ?0 : connect_mask);if (ret) {
@@ -4267,19 +4269,14 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)flush_work (&hidpp->work);if (will_restart) { -/* Reset the HID node state */ -hid_device_io_stop (hdev); -hid_hw_close (hdev); -hid_hw_stop (hdev); -if (hidpp->quirks &HIDPP_QUIRK_DELAYED_INIT ) connect_mask &= ~HID_CONNECT_HIDINPUT ;/* Now export the actual inputs and hidraw nodes to the world */ - ret =hid_hw_start (hdev, connect_mask); + ret =hid_connect (hdev, connect_mask);if (ret) { -hid_err (hdev,"%s:hid_hw_start returned error\n" , __func__); - goto hid_hw_start_fail; +hid_err (hdev,"%s:hid_connect returned error %d\n" , __func__, ret); + goto hid_hw_init_fail; } }
@@ -4291,6 +4288,11 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) ret); } +/* +* This relies on logi_dj_ll_close() being a no-op so that DJ connection +* events will still be received. +*/ +hid_hw_close (hdev);return ret; hid_hw_init_fail:
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 233/379 HID: logitech-hidpp: Revert "Dont restart communication if not necessary"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 55bf70362ffc4ddd7c8745e2fe880edac00e4aff ]
Commit 91cf9a98ae41 ("HID: logitech-hidpp: make .probe usbhid capable") makes hidpp_probe() first call hid_hw_start(hdev, 0) to allow IO without connecting any hid subdrivers (hid-input, hidraw).
This is done to allow to retrieve the device's name and serial number and store these in hdev->name and hdev->uniq.
Then later on IO was stopped and started again with hid_hw_start(hdev, HID_CONNECT_DEFAULT) connecting hid-input and hidraw after the name and serial number have been setup.
Commit 498ba2069035 ("HID: logitech-hidpp: Don't restart communication if not necessary") changed the probe() code to only do the start with a 0 connect-mask + restart later for unifying devices.
But for non unifying devices hdev->name and hdev->uniq are updated too. So this change re-introduces the problem for which the start with a 0 connect-mask + restart later behavior was introduced.
The previous patch in this series changes the unifying path to instead of restarting IO only call hid_connect() later. This avoids possible issues with restarting IO seen on non unifying devices.
Revert the change to limit the restart behavior to unifying devices to fix hdev->name changing after userspace facing devices have already been registered.
This series has been tested on the following devices:
Logitech Bluetooth Laser Travel Mouse (bluetooth, HID++ 1.0) Logitech M720 Triathlon (bluetooth, HID++ 4.5)
Logitech M720 Triathlon (unifying, HID++ 4.5)
Logitech K400 Pro (unifying, HID++ 4.1)
Logitech K270 (eQUAD nano Lite, HID++ 2.0)
Logitech M185 (eQUAD nano Lite, HID++ 4.5)
Logitech LX501 keyboard (27 Mhz, HID++ builtin scroll-wheel, HID++ 1.0) Logitech M-RAZ105 mouse (27 Mhz, HID++ extra mouse buttons, HID++ 1.0)
And by bentiss:
Logitech Touchpad T650 (unifying)
Logitech Touchpad T651 (bluetooth)
Logitech MX Master 3B (BLE)
Logitech G403 (plain USB / Gaming receiver)
--- drivers/hid/hid-logitech-hidpp.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/hid/hid-logitech-hidpp.c +8 -16
@@ -4142,7 +4142,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)bool connected;unsigned int connect_mask =HID_CONNECT_DEFAULT ;struct hidpp_ff_private_data data; -bool will_restart = false;/* report_fixup needs drvdata to be set before we call hid_parse */ hidpp =devm_kzalloc (&hdev->dev,sizeof (*hidpp),GFP_KERNEL );
@@ -4193,10 +4192,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)return ret; } -if (hidpp->quirks &HIDPP_QUIRK_DELAYED_INIT || - hidpp->quirks &HIDPP_QUIRK_UNIFYING ) - will_restart = true; -INIT_WORK (&hidpp->work, delayed_work_cb);mutex_init (&hidpp->send_mutex);init_waitqueue_head (&hidpp->wait);
@@ -4213,7 +4208,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)* name and serial number and store these in hdev->name and hdev->uniq, * before the hid-input and hidraw drivers expose these to userspace. */ - ret =hid_hw_start (hdev, will_restart ?0 : connect_mask); + ret =hid_hw_start (hdev,0 );if (ret) {hid_err (hdev,"hw start failed\n" ); goto hid_hw_start_fail;
@@ -4252,7 +4247,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) hidpp->wireless_feature_index =0 ; else if (ret) goto hid_hw_init_fail; - ret = 0; }if (connected && (hidpp->quirks &HIDPP_QUIRK_CLASS_WTP )) {
@@ -4268,16 +4262,14 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)schedule_work (&hidpp->work);flush_work (&hidpp->work); -if (will_restart) { -if (hidpp->quirks &HIDPP_QUIRK_DELAYED_INIT ) - connect_mask &= ~HID_CONNECT_HIDINPUT ; +if (hidpp->quirks &HIDPP_QUIRK_DELAYED_INIT ) + connect_mask &= ~HID_CONNECT_HIDINPUT ; -/* Now export the actual inputs and hidraw nodes to the world */ - ret =hid_connect (hdev, connect_mask); -if (ret) { -hid_err (hdev,"%s:hid_connect returned error %d\n" , __func__, ret); - goto hid_hw_init_fail; - } +/* Now export the actual inputs and hidraw nodes to the world */ + ret =hid_connect (hdev, connect_mask); +if (ret) { +hid_err (hdev,"%s:hid_connect returned error %d\n" , __func__, ret); + goto hid_hw_init_fail; }if (hidpp->quirks &HIDPP_QUIRK_CLASS_G920 ) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 234/379 HID: logitech-hidpp: Move get_wireless_feature_index() check to hidpp_connect_event()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit ba9de350509504fb748837b71e23d7e84c83d93c ]
Calling get_wireless_feature_index() from probe() causes the wireless_feature_index to only get set for unifying devices which are already connected at probe() time. It does not get set for devices which connect later.
Fix this by moving get_wireless_feature_index() to hidpp_connect_event(), this does not make a difference for devices connected at probe() since probe() will queue the hidpp_connect_event() for those at probe time.
This series has been tested on the following devices:
Logitech Bluetooth Laser Travel Mouse (bluetooth, HID++ 1.0) Logitech M720 Triathlon (bluetooth, HID++ 4.5)
Logitech M720 Triathlon (unifying, HID++ 4.5)
Logitech K400 Pro (unifying, HID++ 4.1)
Logitech K270 (eQUAD nano Lite, HID++ 2.0)
Logitech M185 (eQUAD nano Lite, HID++ 4.5)
Logitech LX501 keyboard (27 Mhz, HID++ builtin scroll-wheel, HID++ 1.0) Logitech M-RAZ105 mouse (27 Mhz, HID++ extra mouse buttons, HID++ 1.0)
And by bentiss:
Logitech Touchpad T650 (unifying)
Logitech Touchpad T651 (bluetooth)
Logitech MX Master 3B (BLE)
Logitech G403 (plain USB / Gaming receiver)
--- drivers/hid/hid-logitech-hidpp.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/hid/hid-logitech-hidpp.c +9 -11
@@ -1757,15 +1757,14 @@ static int hidpp_battery_get_property(struct power_supply *psy,/* -------------------------------------------------------------------------- */ #define HIDPP_PAGE_WIRELESS_DEVICE_STATUS 0x1d4b -static int hidpp_set_wireless_feature_index (struct hidpp_device *hidpp) +static int hidpp_get_wireless_feature_index (struct hidpp_device *hidpp,u8 *feature_index) {u8 feature_type;int ret; ret =hidpp_root_get_feature (hidpp,HIDPP_PAGE_WIRELESS_DEVICE_STATUS , - &hidpp->wireless_feature_index, - &feature_type); + feature_index, &feature_type);return ret; }
@@ -3999,6 +3998,13 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) } } +if (hidpp->protocol_major >=2 ) { +u8 feature_index; + +if (!hidpp_get_wireless_feature_index (hidpp, &feature_index)) + hidpp->wireless_feature_index = feature_index; + } +if (hidpp->name == hdev->name && hidpp->protocol_major >=2 ) { name =hidpp_get_device_name (hidpp);if (name) {
@@ -4241,14 +4247,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)hidpp_overwrite_name (hdev); } -if (connected && hidpp->protocol_major >=2 ) { - ret =hidpp_set_wireless_feature_index (hidpp); -if (ret == -ENOENT ) - hidpp->wireless_feature_index =0 ; -else if (ret) - goto hid_hw_init_fail; - } -if (connected && (hidpp->quirks &HIDPP_QUIRK_CLASS_WTP )) { ret =wtp_get_config (hidpp);if (ret)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 235/379 ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 168d97844a61db302dec76d44406e9d4d7106b8e ]
Error path in snd_skl_parse_uuids() shall free last allocated module if its instance_id allocation fails.
--- sound/soc/intel/skylake/skl-sst-utils.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-sst-utils.c +1 -0
@@ -299,6 +299,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw, module->instance_id =devm_kzalloc (ctx->dev, size,GFP_KERNEL );if (!module->instance_id) { ret = -ENOMEM ; +kfree (module); goto free_uuid_list; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 236/379 padata: Fix refcnt handling in padata_free_shell()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangJinchao <[email protected]>
[ Upstream commit 7ddc21e317b360c3444de3023bcc83b85fabae2f ]
In a high-load arm64 environment, the pcrypt_aead01 test in LTP can lead to system UAF (Use-After-Free) issues. Due to the lengthy analysis of the pcrypt_aead01 function call, I'll describe the problem scenario using a simplified model:
Suppose there's a user of padata named user_function that adheres to the padata requirement of calling padata_free_shell after serial() has been invoked, as demonstrated in the following code:
```c
struct request {
struct padata_priv padata;
struct completion *done;
};
void parallel(struct padata_priv *padata) {
do_something();
}
void serial(struct padata_priv *padata) {
struct request *request = container_of(padata,
struct request,
padata);
complete(request->done);
}
void user_function() {
DECLARE_COMPLETION(done)
padata->parallel = parallel;
padata->serial = serial;
padata_do_parallel();
wait_for_completion(&done);
padata_free_shell();
}
```In the corresponding padata.c file, there's the following code:
```c
static void padata_serial_worker(struct work_struct *serial_work) {
...
cnt = 0;
while (!list_empty(&local_list)) {
...
padata->serial(padata);
cnt++;
}
local_bh_enable();
if (refcount_sub_and_test(cnt, &pd->refcnt))
padata_free_pd(pd);
}
```Because of the high system load and the accumulation of unexecuted softirq at this moment, local_bh_enable() in padata takes longer to execute than usual. Subsequently, when accessing pd->refcnt, pd has already been released by padata_free_shell(), resulting in a UAF issue with pd->refcnt.
The fix is straightforward: add refcount_dec_and_test before calling padata_free_pd in padata_free_shell.
--- kernel/padata.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/padata.c +5 -1
@@ -1094,12 +1094,16 @@ EXPORT_SYMBOL(padata_alloc_shell);*/ void padata_free_shell (struct padata_shell *ps) { +struct parallel_data *pd; +if (!ps)return ;mutex_lock (&ps->pinst->lock);list_del (&ps->list); -padata_free_pd (rcu_dereference_protected (ps->pd,1 )); + pd =rcu_dereference_protected (ps->pd,1 ); +if (refcount_dec_and_test (&pd->refcnt)) +padata_free_pd (pd);mutex_unlock (&ps->pinst->lock);kfree (ps);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 237/379 crypto: qat - fix deadlock in backlog processing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 203b01001c4d741205b9c329acddc5193ed56fbd ]
If a request has the flag CRYPTO_TFM_REQ_MAY_BACKLOG set, the function qat_alg_send_message_maybacklog(), enqueues it in a backlog list if either (1) there is already at least one request in the backlog list, or
(2) the HW ring is nearly full or (3) the enqueue to the HW ring fails. If an interrupt occurs right before the lock in qat_alg_backlog_req() is taken and the backlog queue is being emptied, then there is no request in the HW queues that can trigger a subsequent interrupt that can clear the backlog queue. In addition subsequent requests are enqueued to the backlog list and not sent to the hardware.
Fix it by holding the lock while taking the decision if the request needs to be included in the backlog queue or not. This synchronizes the flow with the interrupt handler that drains the backlog queue.
For performance reasons, the logic has been changed to try to enqueue first without holding the lock.
--- drivers/crypto/qat/qat_common/qat_algs_send.c | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-)
drivers/crypto/qat/qat_common/qat_algs_send.c +25 -21
@@ -39,40 +39,44 @@ void qat_alg_send_backlog(struct qat_instance_backlog *backlog)spin_unlock_bh (&backlog->lock); } -static void qat_alg_backlog_req (struct qat_alg_req *req, -struct qat_instance_backlog *backlog) -{ -INIT_LIST_HEAD (&req->list); - -spin_lock_bh (&backlog->lock); -list_add_tail (&req->list, &backlog->list); -spin_unlock_bh (&backlog->lock); -} - -static int qat_alg_send_message_maybacklog (struct qat_alg_req *req) +static bool qat_alg_try_enqueue (struct qat_alg_req *req) {struct qat_instance_backlog *backlog = req->backlog;struct adf_etr_ring_data *tx_ring = req->tx_ring;u32 *fw_req = req->fw_req; -/* If any request is already backlogged, then add to backlog list */ +/* Check if any request is already backlogged */ if (!list_empty (&backlog->list)) - goto enqueue; +return false; -/* If ring is nearly full, then add to backlog list */ +/* Check if ring is nearly full */ if (adf_ring_nearly_full (tx_ring)) - goto enqueue; +return false; -/* If adding request to HW ring fails, then add to backlog list */ +/* Try to enqueue to HW ring */ if (adf_send_message (tx_ring, fw_req)) - goto enqueue; +return false; -return -EINPROGRESS ; +return true; +} -enqueue: -qat_alg_backlog_req (req, backlog); -return -EBUSY ; +static int qat_alg_send_message_maybacklog (struct qat_alg_req *req) +{ +struct qat_instance_backlog *backlog = req->backlog; +int ret = -EINPROGRESS ; + +if (qat_alg_try_enqueue (req)) +return ret; + +spin_lock_bh (&backlog->lock); +if (!qat_alg_try_enqueue (req)) { +list_add_tail (&req->list, &backlog->list); + ret = -EBUSY ; + } +spin_unlock_bh (&backlog->lock); + +return ret; }int qat_alg_send_message (struct qat_alg_req *req)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 238/379 ASoC: ams-delta.c: use component after check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
[ Upstream commit bd0f7498bc9084d8cccc5484cd004b40f314b763 ]
static void cx81801_close()
{
...
(A) struct snd_soc_dapm_context *dapm = &component->card->dapm;
...
(B) if (!component)
return;
}(A) uses component before NULL check (B). This patch moves it after (B).
--- sound/soc/ti/ams-delta.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/ti/ams-delta.c +3 -1
@@ -303,7 +303,7 @@ static int cx81801_open(struct tty_struct *tty)static void cx81801_close (struct tty_struct *tty) {struct snd_soc_component *component = tty->disc_data; -struct snd_soc_dapm_context *dapm = &component->card->dapm; +struct snd_soc_dapm_context *dapm;del_timer_sync (&cx81801_timer);
@@ -315,6 +315,8 @@ static void cx81801_close(struct tty_struct *tty) v253_ops.close (tty); + dapm = &component->card->dapm; +/* Revert back to default audio input/output constellation */ snd_soc_dapm_mutex_lock (dapm);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 239/379 IB/mlx5: Fix init stage error handling to avoid double free of same QP and UAF
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Kennedy <[email protected]>
[ Upstream commit 2ef422f063b74adcc4a4a9004b0a87bb55e0a836 ]
In the unlikely event that workqueue allocation fails and returns NULL in mlx5_mkey_cache_init(), delete the call to mlx5r_umr_resource_cleanup() (which frees the QP) in mlx5_ib_stage_post_ib_reg_umr_init(). This will avoid attempted double free of the same QP when __mlx5_ib_add() does its cleanup.
Resolves a splat:
Syzkaller reported a UAF in ib_destroy_qp_user
workqueue: Failed to create a rescuer kthread for wq "mkey_cache": -EINTR infiniband mlx5_0: mlx5_mkey_cache_init:981:(pid 1642):
failed to create work queue
infiniband mlx5_0: mlx5_ib_stage_post_ib_reg_umr_init:4075:(pid 1642):
mr cache init failed -12
==================================================================
BUG: KASAN: slab-use-after-free in ib_destroy_qp_user (drivers/infiniband/core/verbs.c:2073) Read of size 8 at addr ffff88810da310a8 by task repro_upstream/1642 Call Trace: <TASK> kasan_report (mm/kasan/report.c:590) ib_destroy_qp_user (drivers/infiniband/core/verbs.c:2073) mlx5r_umr_resource_cleanup (drivers/infiniband/hw/mlx5/umr.c:198) __mlx5_ib_add (drivers/infiniband/hw/mlx5/main.c:4178) mlx5r_probe (drivers/infiniband/hw/mlx5/main.c:4402) ... </TASK> Allocated by task 1642: __kmalloc (./include/linux/kasan.h:198 mm/slab_common.c:1026 mm/slab_common.c:1039) create_qp (./include/linux/slab.h:603 ./include/linux/slab.h:720 ./include/rdma/ib_verbs.h:2795 drivers/infiniband/core/verbs.c:1209) ib_create_qp_kernel (drivers/infiniband/core/verbs.c:1347) mlx5r_umr_resource_init (drivers/infiniband/hw/mlx5/umr.c:164) mlx5_ib_stage_post_ib_reg_umr_init (drivers/infiniband/hw/mlx5/main.c:4070) __mlx5_ib_add (drivers/infiniband/hw/mlx5/main.c:4168) mlx5r_probe (drivers/infiniband/hw/mlx5/main.c:4402) ... Freed by task 1642: __kmem_cache_free (mm/slub.c:1826 mm/slub.c:3809 mm/slub.c:3822) ib_destroy_qp_user (drivers/infiniband/core/verbs.c:2112) mlx5r_umr_resource_cleanup (drivers/infiniband/hw/mlx5/umr.c:198) mlx5_ib_stage_post_ib_reg_umr_init (drivers/infiniband/hw/mlx5/main.c:4076 drivers/infiniband/hw/mlx5/main.c:4065) __mlx5_ib_add (drivers/infiniband/hw/mlx5/main.c:4168) mlx5r_probe (drivers/infiniband/hw/mlx5/main.c:4402) ...
--- drivers/infiniband/hw/mlx5/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/mlx5/main.c +1 -3
@@ -4027,10 +4027,8 @@ static int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)return ret; ret =mlx5_mkey_cache_init (dev); -if (ret) { +if (ret)mlx5_ib_warn (dev,"mr cache init failed %d\n" , ret); -mlx5r_umr_resource_cleanup (dev); - }return ret; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 240/379 mfd: core: Un-constify mfd_cell.of_reg
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Mirosław <[email protected]>
[ Upstream commit 3c70342f1f0045dc827bb2f02d814ce31e0e0d05 ]
Enable dynamically filling in the whole mfd_cell structure. All other fields already allow that.
--- include/linux/mfd/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mfd/core.h +1 -1
@@ -92,7 +92,7 @@ struct mfd_cell {* (above) when matching OF nodes with devices that have identical * compatible strings */ -const u64 of_reg; +u64 of_reg;/* Set to 'true' to use 'of_reg' (above) - allows for of_reg=0 */ bool use_of_reg;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 241/379 mfd: core: Ensure disabled devices are skipped without aborting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herve Codina <[email protected]>
[ Upstream commit 7ba7bdef4d14e3722e2842da3b48cbadb73e52d6 ]
The loop searching for a matching device based on its compatible string is aborted when a matching disabled device is found. This abort prevents to add devices as soon as one disabled device is found.
Continue searching for an other device instead of aborting on the first disabled one fixes the issue.
--- drivers/mfd/mfd-core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/mfd/mfd-core.c +12 -5
@@ -176,6 +176,7 @@ static int mfd_add_device(struct device *parent, int id,struct platform_device *pdev;struct device_node *np =NULL ;struct mfd_of_node_entry *of_entry, *tmp; +bool disabled = false;int ret = -ENOMEM ;int platform_id;int r;
@@ -213,11 +214,10 @@ static int mfd_add_device(struct device *parent, int id,if (IS_ENABLED (CONFIG_OF ) && parent->of_node && cell->of_compatible) {for_each_child_of_node (parent->of_node, np) {if (of_device_is_compatible (np, cell->of_compatible)) { -/* Ignore 'disabled' devices error free */ +/* Skip 'disabled' devices */ if (!of_device_is_available (np)) { -of_node_put (np); - ret =0 ; - goto fail_alias; + disabled = true; +continue ; } ret =mfd_match_of_node_to_dev (pdev, np, cell);
@@ -227,10 +227,17 @@ static int mfd_add_device(struct device *parent, int id,if (ret) goto fail_alias; -break ; + goto match; } } +if (disabled) { +/* Ignore 'disabled' devices error free */ + ret =0 ; + goto fail_alias; + } + +match:if (!pdev->dev.of_node)pr_warn ("%s: Failed to locate of_node [id: %d]\n" , cell->name, platform_id);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 242/379 mfd: dln2: Fix double put in dln2_probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dinghao Liu <[email protected]>
[ Upstream commit 759c409bc5fc496cbc22cd0b392d3cbb0c0e23eb ]
The dln2_free() already contains usb_put_dev(). Therefore, the redundant usb_put_dev() before dln2_free() may lead to a double free.
--- drivers/mfd/dln2.c | 1 - 1 file changed, 1 deletion(-)
drivers/mfd/dln2.c +0 -1
@@ -827,7 +827,6 @@ static int dln2_probe(struct usb_interface *interface,dln2_stop_rx_urbs (dln2); out_free: -usb_put_dev (dln2->usb_dev);dln2_free (dln2);return ret;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 243/379 dt-bindings: mfd: mt6397: Add binding for MT6357
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabien Parent <[email protected]>
[ Upstream commit 118ee241c423636c03527eada8f672301514751e ]
Add binding documentation for the MT6357 PMIC.
Stable-dep-of: 61fdd1f1d2c1 ("dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC")
--- Documentation/devicetree/bindings/mfd/mt6397.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mfd/mt6397.txt +1 -0
@@ -21,6 +21,7 @@ Required properties: compatible: "mediatek,mt6323" for PMIC MT6323 "mediatek,mt6331" for PMIC MT6331 and MT6332 + "mediatek,mt6357" for PMIC MT6357 "mediatek,mt6358" for PMIC MT6358 and MT6366 "mediatek,mt6359" for PMIC MT6359 "mediatek,mt6397" for PMIC MT6397
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 244/379 dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 61fdd1f1d2c183ec256527d16d75e75c3582af82 ]
The MT6366 PMIC is mostly, but not fully, compatible with MT6358. It has a different set of regulators. Specifically, it lacks the camera related VCAM* LDOs and VLDO28, but has additional VM18, VMDDR, and VSRAM_CORE LDOs.
The PMICs contain a chip ID register that can be used to detect which exact model is preset, so it is possible to share a common base compatible string.
Add a separate compatible for the MT6366 PMIC, with a fallback to the MT6358 PMIC.
--- Documentation/devicetree/bindings/mfd/mt6397.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/mt6397.txt +3 -1
@@ -22,8 +22,9 @@ compatible: "mediatek,mt6323" for PMIC MT6323 "mediatek,mt6331" for PMIC MT6331 and MT6332 "mediatek,mt6357" for PMIC MT6357 - "mediatek,mt6358" for PMIC MT6358 and MT6366 + "mediatek,mt6358" for PMIC MT6358 "mediatek,mt6359" for PMIC MT6359 + "mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366 "mediatek,mt6397" for PMIC MT6397 Optional subnodes:
@@ -40,6 +41,7 @@ Optional subnodes: - compatible: "mediatek,mt6323-regulator" see ../regulator/mt6323-regulator.txt - compatible: "mediatek,mt6358-regulator" + - compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator" see ../regulator/mt6358-regulator.txt - compatible: "mediatek,mt6397-regulator" see ../regulator/mt6397-regulator.txt
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 245/379 mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 831d1af85133e1763d41e20414912d9a1058ea72 ]
Commit 9e86b2ad4c11 changed the channel used for HPDET detection (headphones vs lineout detection) from being hardcoded to ARIZONA_ACCDET_MODE_HPL (HP left channel) to it being configurable through arizona_pdata.hpdet_channel the DT/OF parsing added for filling arizona_pdata on devicetree platforms ensures that arizona_pdata.hpdet_channel gets set to ARIZONA_ACCDET_MODE_HPL when not specified in the devicetree-node.
But on ACPI platforms where arizona_pdata is filled by arizona_spi_acpi_probe() arizona_pdata.hpdet_channel was not getting set, causing it to default to 0 aka ARIZONA_ACCDET_MODE_MIC.
This causes headphones to get misdetected as line-out on some models. Fix this by setting hpdet_channel = ARIZONA_ACCDET_MODE_HPL.
--- drivers/mfd/arizona-spi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mfd/arizona-spi.c +3 -0
@@ -159,6 +159,9 @@ static int arizona_spi_acpi_probe(struct arizona *arizona) arizona->pdata.micd_ranges = arizona_micd_aosp_ranges; arizona->pdata.num_micd_ranges =ARRAY_SIZE (arizona_micd_aosp_ranges); +/* Use left headphone speaker for HP vs line-out detection */ + arizona->pdata.hpdet_channel =ARIZONA_ACCDET_MODE_HPL ; +return 0 ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 246/379 leds: turris-omnia: Drop unnecessary mutex locking
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 760b6b7925bf09491aafa4727eef74fc6bf738b0 ]
Do not lock driver mutex in the global LED panel brightness sysfs accessors brightness_show() and brightness_store().
The mutex locking is unnecessary here. The I2C transfers are guarded by I2C core locking mechanism, and the LED commands itself do not interfere with other commands.
Stable-dep-of: 6de283b96b31 ("leds: turris-omnia: Do not use SMBUS calls")
--- drivers/leds/leds-turris-omnia.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/leds/leds-turris-omnia.c +1 -10
@@ -156,12 +156,9 @@ static ssize_t brightness_show(struct device *dev, struct device_attribute *a, char *buf) {struct i2c_client *client =to_i2c_client (dev); -struct omnia_leds *leds =i2c_get_clientdata (client);int ret; -mutex_lock (&leds->lock); ret =i2c_smbus_read_byte_data (client,CMD_LED_GET_BRIGHTNESS ); -mutex_unlock (&leds->lock);if (ret <0 )return ret;
@@ -173,7 +170,6 @@ static ssize_t brightness_store(struct device *dev, struct device_attribute *a, const char *buf, size_t count) {struct i2c_client *client =to_i2c_client (dev); -struct omnia_leds *leds =i2c_get_clientdata (client);unsigned long brightness;int ret;
@@ -183,15 +179,10 @@ static ssize_t brightness_store(struct device *dev, struct device_attribute *a,if (brightness >100 )return -EINVAL ; -mutex_lock (&leds->lock); ret =i2c_smbus_write_byte_data (client,CMD_LED_SET_BRIGHTNESS , (u8 )brightness); -mutex_unlock (&leds->lock); - -if (ret <0 ) -return ret; -return count; +return ret <0 ? ret : count; }static DEVICE_ATTR_RW (brightness);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 247/379 leds: turris-omnia: Do not use SMBUS calls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 6de283b96b31b4890e3ee8c86caca2a3a30d1011 ]
The leds-turris-omnia driver uses three function for I2C access:
- i2c_smbus_write_byte_data() and i2c_smbus_read_byte_data(), which cause an emulated SMBUS transfer,
- i2c_master_send(), which causes an ordinary I2C transfer.
The Turris Omnia MCU LED controller is not semantically SMBUS, it operates as a simple I2C bus. It does not implement any of the SMBUS specific features, like PEC, or procedure calls, or anything. Moreover the I2C controller driver also does not implement SMBUS, and so the emulated SMBUS procedure from drivers/i2c/i2c-core-smbus.c is used for the SMBUS calls, which gives an unnecessary overhead.
When I first wrote the driver, I was unaware of these facts, and I simply used the first function that worked.
Drop the I2C SMBUS calls and instead use simple I2C transfers.
--- drivers/leds/leds-turris-omnia.c | 54 +++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 12 deletions(-)
drivers/leds/leds-turris-omnia.c +42 -12
@@ -2,7 +2,7 @@/* * CZ.NIC's Turris Omnia LEDs driver * -* 2020 by Marek Behún <[email protected]> +* 2020, 2023 by Marek Behún <[email protected]> */ #include <linux/i2c.h>
@@ -41,6 +41,37 @@ struct omnia_leds {struct omnia_led leds[]; }; +static int omnia_cmd_write_u8 (const struct i2c_client *client,u8 cmd,u8 val) +{ +u8 buf[2 ] = { cmd, val }; + +return i2c_master_send (client, buf,sizeof (buf)); +} + +static int omnia_cmd_read_u8 (const struct i2c_client *client,u8 cmd) +{ +struct i2c_msg msgs[2 ]; +u8 reply; +int ret; + + msgs[0 ].addr = client->addr; + msgs[0 ].flags =0 ; + msgs[0 ].len =1 ; + msgs[0 ].buf = &cmd; + msgs[1 ].addr = client->addr; + msgs[1 ].flags =I2C_M_RD ; + msgs[1 ].len =1 ; + msgs[1 ].buf = &reply; + + ret =i2c_transfer (client->adapter, msgs,ARRAY_SIZE (msgs)); +if (likely (ret ==ARRAY_SIZE (msgs))) +return reply; +else if (ret <0 ) +return ret; +else +return -EIO ; +} +static int omnia_led_brightness_set_blocking (struct led_classdev *cdev,enum led_brightness brightness) {
@@ -64,7 +95,7 @@ static int omnia_led_brightness_set_blocking(struct led_classdev *cdev,if (buf[2 ] || buf[3 ] || buf[4 ]) state |=CMD_LED_STATE_ON ; - ret =i2c_smbus_write_byte_data (leds->client,CMD_LED_STATE , state); + ret =omnia_cmd_write_u8 (leds->client,CMD_LED_STATE , state);if (ret >=0 && (state &CMD_LED_STATE_ON )) ret =i2c_master_send (leds->client, buf,5 );
@@ -114,9 +145,9 @@ static int omnia_led_register(struct i2c_client *client, struct omnia_led *led, cdev->brightness_set_blocking = omnia_led_brightness_set_blocking;/* put the LED into software mode */ - ret =i2c_smbus_write_byte_data (client,CMD_LED_MODE , -CMD_LED_MODE_LED (led->reg) | -CMD_LED_MODE_USER ); + ret =omnia_cmd_write_u8 (client,CMD_LED_MODE , +CMD_LED_MODE_LED (led->reg) | +CMD_LED_MODE_USER );if (ret <0 ) {dev_err (dev,"Cannot set LED %pOF to software mode: %i\n" , np, ret);
@@ -124,8 +155,8 @@ static int omnia_led_register(struct i2c_client *client, struct omnia_led *led, }/* disable the LED */ - ret =i2c_smbus_write_byte_data (client,CMD_LED_STATE , -CMD_LED_STATE_LED (led->reg)); + ret =omnia_cmd_write_u8 (client,CMD_LED_STATE , +CMD_LED_STATE_LED (led->reg));if (ret <0 ) {dev_err (dev,"Cannot set LED %pOF brightness: %i\n" , np, ret);return ret;
@@ -158,7 +189,7 @@ static ssize_t brightness_show(struct device *dev, struct device_attribute *a,struct i2c_client *client =to_i2c_client (dev);int ret; - ret =i2c_smbus_read_byte_data (client,CMD_LED_GET_BRIGHTNESS ); + ret =omnia_cmd_read_u8 (client,CMD_LED_GET_BRIGHTNESS );if (ret <0 )return ret;
@@ -179,8 +210,7 @@ static ssize_t brightness_store(struct device *dev, struct device_attribute *a,if (brightness >100 )return -EINVAL ; - ret =i2c_smbus_write_byte_data (client,CMD_LED_SET_BRIGHTNESS , - (u8 )brightness); + ret =omnia_cmd_write_u8 (client,CMD_LED_SET_BRIGHTNESS , brightness);return ret <0 ? ret : count; }
@@ -238,8 +268,8 @@ static void omnia_leds_remove(struct i2c_client *client)u8 buf[5 ];/* put all LEDs into default (HW triggered) mode */ -i2c_smbus_write_byte_data (client,CMD_LED_MODE , -CMD_LED_MODE_LED (OMNIA_BOARD_LEDS )); +omnia_cmd_write_u8 (client,CMD_LED_MODE , +CMD_LED_MODE_LED (OMNIA_BOARD_LEDS ));/* set all LEDs color to [255, 255, 255] */ buf[0 ] =CMD_LED_COLOR ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 248/379 leds: pwm: Dont disable the PWM when the LED should be off
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 76fe464c8e64e71b2e4af11edeef0e5d85eeb6aa ]
Disabling a PWM (i.e. calling pwm_apply_state with .enabled = false) gives no guarantees what the PWM output does. It might freeze where it currently is, or go in a High-Z state or drive the active or inactive state, it might even continue to toggle.
To ensure that the LED gets really disabled, don't disable the PWM even when .duty_cycle is zero.
This fixes disabling a leds-pwm LED on i.MX28. The PWM on this SoC is one of those that freezes its output on disable, so if you disable an LED that is full on, it stays on. If you disable a LED with half brightness it goes off in 50% of the cases and full on in the other 50%.
--- drivers/leds/leds-pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pwm.c +1 -1
@@ -53,7 +53,7 @@ static int led_pwm_set(struct led_classdev *led_cdev, duty = led_dat->pwmstate.period - duty; led_dat->pwmstate.duty_cycle = duty; - led_dat->pwmstate.enabled = duty >0 ; + led_dat->pwmstate.enabled = true;return pwm_apply_state (led_dat->pwm, &led_dat->pwmstate); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 249/379 leds: trigger: ledtrig-cpu:: Fix output may be truncated issue for cpu
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit ff50f53276131a3059e8307d11293af388ed2bcd ]
In order to teach the compiler that 'trig->name' will never be truncated, we need to tell it that 'cpu' is not negative.
When building with W=1, this fixes the following warnings:
drivers/leds/trigger/ledtrig-cpu.c: In function ‘ledtrig_cpu_init’:
drivers/leds/trigger/ledtrig-cpu.c:155:56: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 5 [-Werror=format-truncation=]
155 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
| ^~
drivers/leds/trigger/ledtrig-cpu.c:155:52: note: directive argument in the range [-2147483648, 7]
155 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
| ^~~~~~~
drivers/leds/trigger/ledtrig-cpu.c:155:17: note: ‘snprintf’ output between 5 and 15 bytes into a destination of size 8
155 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/leds/trigger/ledtrig-cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/trigger/ledtrig-cpu.c +2 -2
@@ -130,7 +130,7 @@ static int ledtrig_prepare_down_cpu(unsigned int cpu)static int __init ledtrig_cpu_init (void ) { -int cpu; +unsigned int cpu;int ret;/* Supports up to 9999 cpu cores */
@@ -152,7 +152,7 @@ static int __init ledtrig_cpu_init(void)if (cpu >=8 )continue ; -snprintf (trig->name,MAX_NAME_LEN ,"cpu%d" , cpu); +snprintf (trig->name,MAX_NAME_LEN ,"cpu%u" , cpu);led_trigger_register_simple (trig->name, &trig->_trig); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 250/379 kunit: add macro to allow conditionally exposing static symbols to tests
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rae Moar <[email protected]>
[ Upstream commit 9c988fae6f6ae3224a568ab985881b66bb50c9ec ]
Create two macros:
VISIBLE_IF_KUNIT - A macro that sets symbols to be static if CONFIG_KUNIT is not enabled. Otherwise if CONFIG_KUNIT is enabled there is no change to the symbol definition.
EXPORT_SYMBOL_IF_KUNIT(symbol) - Exports symbol into EXPORTED_FOR_KUNIT_TESTING namespace only if CONFIG_KUNIT is enabled. Must use MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING) in test file in order to use symbols.
Stable-dep-of: 8884ba07786c ("apparmor: fix invalid reference on profile->disconnected")
--- include/kunit/visibility.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/kunit/visibility.h
include/kunit/visibility.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* KUnit API to allow symbols to be conditionally visible during KUnit +* testing +* +* Copyright (C) 2022, Google LLC. +* Author: Rae Moar <[email protected]> +*/ + +#ifndef _KUNIT_VISIBILITY_H +#define _KUNIT_VISIBILITY_H + +#if IS_ENABLED (CONFIG_KUNIT ) +/** +* VISIBLE_IF_KUNIT - A macro that sets symbols to be static if +* CONFIG_KUNIT is not enabled. Otherwise if CONFIG_KUNIT is enabled +* there is no change to the symbol definition. +*/ +#define VISIBLE_IF_KUNIT +/** +* EXPORT_SYMBOL_IF_KUNIT(symbol) - Exports symbol into +* EXPORTED_FOR_KUNIT_TESTING namespace only if CONFIG_KUNIT is +* enabled. Must use MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING) +* in test file in order to use symbols. +*/ +#define EXPORT_SYMBOL_IF_KUNIT (symbol) EXPORT_SYMBOL_NS(symbol, \ + EXPORTED_FOR_KUNIT_TESTING) +#else +#define VISIBLE_IF_KUNIT static +#define EXPORT_SYMBOL_IF_KUNIT (symbol) +#endif + +#endif /* _KUNIT_VISIBILITY_H */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 251/379 apparmor: test: make static symbols visible during kunit testing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rae Moar <[email protected]>
[ Upstream commit b11e51dd70947107fa4076c6286dce301671afc1 ]
Use macros, VISIBLE_IF_KUNIT and EXPORT_SYMBOL_IF_KUNIT, to allow static symbols to be conditionally set to be visible during apparmor_policy_unpack_test, which removes the need to include the testing file in the implementation file.
Change the namespace of the symbols that are now conditionally visible (by adding the prefix aa_) to avoid confusion with symbols of the same name.
Allow the test to be built as a module and namespace the module name from policy_unpack_test to apparmor_policy_unpack_test to improve clarity of the module name.
Provide an example of how static symbols can be dealt with in testing.
Stable-dep-of: 8884ba07786c ("apparmor: fix invalid reference on profile->disconnected")
--- security/apparmor/Kconfig | 4 +- security/apparmor/Makefile | 3 + security/apparmor/include/policy_unpack.h | 50 +++++ security/apparmor/policy_unpack.c | 238 ++++++++++------------ security/apparmor/policy_unpack_test.c | 69 ++++--- 5 files changed, 196 insertions(+), 168 deletions(-)
security/apparmor/Kconfig +2 -2
@@ -106,8 +106,8 @@ config SECURITY_APPARMOR_PARANOID_LOAD Disabling the check will speed up policy loads. config SECURITY_APPARMOR_KUNIT_TEST - bool "Build KUnit tests for policy_unpack.c" if !KUNIT_ALL_TESTS - depends on KUNIT=y && SECURITY_APPARMOR + tristate "Build KUnit tests for policy_unpack.c" if !KUNIT_ALL_TESTS + depends on KUNIT && SECURITY_APPARMOR default KUNIT_ALL_TESTS help This builds the AppArmor KUnit tests.
security/apparmor/Makefile +3 -0
@@ -8,6 +8,9 @@ apparmor-y := apparmorfs.o audit.o capability.o task.o ipc.o lib.o match.o \ resource.o secid.o file.o policy_ns.o label.o mount.o net.o apparmor-$(CONFIG_SECURITY_APPARMOR_HASH) += crypto.o +obj-$(CONFIG_SECURITY_APPARMOR_KUNIT_TEST) += apparmor_policy_unpack_test.o +apparmor_policy_unpack_test-objs += policy_unpack_test.o + clean-files := capability_names.h rlim_names.h net_names.h # Build a lower case string table of address family names
security/apparmor/include/policy_unpack.h +50 -0
60 lines not on this page · raw message
security/apparmor/policy_unpack.c +104 -134
624 lines not on this page · raw message
security/apparmor/policy_unpack_test.c +37 -32
264 lines not on this page · raw message
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 252/379 apparmor: fix invalid reference on profile->disconnected
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georgia Garcia <[email protected]>
[ Upstream commit 8884ba07786c718771cf7b78cb3024924b27ec2b ]
profile->disconnected was storing an invalid reference to the disconnected path. Fix it by duplicating the string using aa_unpack_strdup and freeing accordingly.
--- security/apparmor/policy.c | 1 + security/apparmor/policy_unpack.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
security/apparmor/policy.c +1 -0
@@ -218,6 +218,7 @@ void aa_free_profile(struct aa_profile *profile)aa_put_ns (profile->ns);kfree_sensitive (profile->rename); +kfree_sensitive (profile->disconnected);aa_free_file_rules (&profile->file);aa_free_cap_rules (&profile->caps);
security/apparmor/policy_unpack.c +3 -2
@@ -656,7 +656,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)const char *info ="failed to unpack profile" ;size_t ns_len;struct rhashtable_params params = {0 }; -char *key =NULL ; +char *key =NULL , *disconnected =NULL ;struct aa_data *data;int i, error = -EPROTO ;kernel_cap_t tmpcap;
@@ -710,7 +710,8 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) }/* disconnected attachment string is optional */ - (void )aa_unpack_str (e, &profile->disconnected,"disconnected" ); + (void )aa_unpack_strdup (e, &disconnected,"disconnected" ); + profile->disconnected = disconnected;/* per profile debug flags (complain, audit) */ if (!aa_unpack_nameX (e,AA_STRUCT ,"flags" )) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 253/379 perf stat: Fix aggr mode initialization
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit a84fbf205609313594b86065c67e823f09ebe29b ]
Generating metrics llc_code_read_mpi_demand_plus_prefetch, llc_data_read_mpi_demand_plus_prefetch, llc_miss_local_memory_bandwidth_read, llc_miss_local_memory_bandwidth_write, nllc_miss_remote_memory_bandwidth_read, memory_bandwidth_read, memory_bandwidth_write, uncore_frequency, upi_data_transmit_bw, C2_Pkg_Residency, C3_Core_Residency, C3_Pkg_Residency, C6_Core_Residency, C6_Pkg_Residency, C7_Core_Residency, C7_Pkg_Residency, UNCORE_FREQ and tma_info_system_socket_clks would trigger an address sanitizer heap-buffer-overflows on a SkylakeX.
```
==2567752==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x5020003ed098 at pc 0x5621a816654e bp 0x7fffb55d4da0 sp 0x7fffb55d4d98
READ of size 4 at 0x5020003eee78 thread T0
#0 0x558265d6654d in aggr_cpu_id__is_empty tools/perf/util/cpumap.c:694:12
#1 0x558265c914da in perf_stat__get_aggr tools/perf/builtin-stat.c:1490:6
#2 0x558265c914da in perf_stat__get_global_cached tools/perf/builtin-stat.c:1530:9
#3 0x558265e53290 in should_skip_zero_counter tools/perf/util/stat-display.c:947:31
#4 0x558265e53290 in print_counter_aggrdata tools/perf/util/stat-display.c:985:18
#5 0x558265e51931 in print_counter tools/perf/util/stat-display.c:1110:3
#6 0x558265e51931 in evlist__print_counters tools/perf/util/stat-display.c:1571:5
#7 0x558265c8ec87 in print_counters tools/perf/builtin-stat.c:981:2
#8 0x558265c8cc71 in cmd_stat tools/perf/builtin-stat.c:2837:3
#9 0x558265bb9bd4 in run_builtin tools/perf/perf.c:323:11
#10 0x558265bb98eb in handle_internal_command tools/perf/perf.c:377:8
#11 0x558265bb9389 in run_argv tools/perf/perf.c:421:2
#12 0x558265bb9389 in main tools/perf/perf.c:537:3
```The issue was the use of testing a cpumap with NULL rather than using empty, as a map containing the dummy value isn't NULL and the -1 results in an empty aggr map being allocated which legitimately overflows when any member is accessed.
--- tools/perf/builtin-stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-stat.c +1 -1
@@ -1444,7 +1444,7 @@ static int perf_stat_init_aggr_mode(void)* taking the highest cpu number to be the size of * the aggregation translate cpumap. */ -if (evsel_list->core.user_requested_cpus) +if (!perf_cpu_map__empty (evsel_list->core.user_requested_cpus)) nr =perf_cpu_map__max (evsel_list->core.user_requested_cpus).cpu;else nr =0 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 254/379 iio: frequency: adf4350: Use device managed functions and fix power down issue.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 9979cc64853b598518a485c2e554657d5c7a00c8 ]
The devm_clk_get_enabled() helper:
- calls devm_clk_get()
- calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource.
Also replace devm_regulator_get() and regulator_enable() with devm_regulator_get_enable() helper and remove regulator_disable().
Replace iio_device_register() with devm_iio_device_register() and remove iio_device_unregister().
And st->reg is not used anymore, so remove it.
As Jonathan pointed out, couple of things that are wrong:
1) The device is powered down 'before' we unregister it with the subsystem and as such userspace interfaces are still exposed which probably won't do the right thing if the chip is powered down.
2) This isn't done in the error paths in probe.
To solve this problem, register a new callback adf4350_power_down() with devm_add_action_or_reset(), to enable software power down in both error and device detach path. So the remove function can be removed.
Remove spi_set_drvdata() from the probe function, since spi_get_drvdata() is not used anymore.
--- drivers/iio/frequency/adf4350.c | 75 ++++++++++----------------------- 1 file changed, 23 insertions(+), 52 deletions(-)
drivers/iio/frequency/adf4350.c +23 -52
@@ -33,7 +33,6 @@ enum {struct adf4350_state {struct spi_device *spi; -struct regulator *reg;struct gpio_desc *lock_detect_gpiod;struct adf4350_platform_data *pdata;struct clk *clk;
@@ -469,6 +468,15 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)return pdata; } +static void adf4350_power_down (void *data) +{ +struct iio_dev *indio_dev = data; +struct adf4350_state *st =iio_priv (indio_dev); + + st->regs[ADF4350_REG2 ] |=ADF4350_REG2_POWER_DOWN_EN ; +adf4350_sync_config (st); +} +static int adf4350_probe (struct spi_device *spi) {struct adf4350_platform_data *pdata;
@@ -491,31 +499,21 @@ static int adf4350_probe(struct spi_device *spi) }if (!pdata->clkin) { - clk =devm_clk_get (&spi->dev,"clkin" ); + clk =devm_clk_get_enabled (&spi->dev,"clkin" );if (IS_ERR (clk)) -return -EPROBE_DEFER ; - - ret =clk_prepare_enable (clk); -if (ret <0 ) -return ret; +return PTR_ERR (clk); } indio_dev =devm_iio_device_alloc (&spi->dev,sizeof (*st)); -if (indio_dev ==NULL ) { - ret = -ENOMEM ; - goto error_disable_clk; - } +if (indio_dev ==NULL ) +return -ENOMEM ; st =iio_priv (indio_dev); - st->reg =devm_regulator_get (&spi->dev,"vcc" ); -if (!IS_ERR (st->reg)) { - ret =regulator_enable (st->reg); -if (ret) - goto error_disable_clk; - } + ret =devm_regulator_get_enable (&spi->dev,"vcc" ); +if (ret) +return ret; -spi_set_drvdata (spi, indio_dev); st->spi = spi; st->pdata = pdata;
@@ -544,47 +542,21 @@ static int adf4350_probe(struct spi_device *spi) st->lock_detect_gpiod =devm_gpiod_get_optional (&spi->dev,NULL ,GPIOD_IN ); -if (IS_ERR (st->lock_detect_gpiod)) { - ret =PTR_ERR (st->lock_detect_gpiod); - goto error_disable_reg; - } +if (IS_ERR (st->lock_detect_gpiod)) +return PTR_ERR (st->lock_detect_gpiod);if (pdata->power_up_frequency) { ret =adf4350_set_freq (st, pdata->power_up_frequency);if (ret) - goto error_disable_reg; +return ret; } - ret =iio_device_register (indio_dev); + ret =devm_add_action_or_reset (&spi->dev, adf4350_power_down, indio_dev);if (ret) - goto error_disable_reg; - -return 0 ; - -error_disable_reg: -if (!IS_ERR (st->reg)) -regulator_disable (st->reg); -error_disable_clk: -clk_disable_unprepare (clk); - -return ret; -} - -static void adf4350_remove (struct spi_device *spi) -{ -struct iio_dev *indio_dev =spi_get_drvdata (spi); -struct adf4350_state *st =iio_priv (indio_dev); -struct regulator *reg = st->reg; - - st->regs[ADF4350_REG2 ] |=ADF4350_REG2_POWER_DOWN_EN ; -adf4350_sync_config (st); - -iio_device_unregister (indio_dev); - -clk_disable_unprepare (st->clk); +return dev_err_probe (&spi->dev, ret, +"Failed to add action to managed power down\n" ); -if (!IS_ERR (reg)) -regulator_disable (reg); +return devm_iio_device_register (&spi->dev, indio_dev); }static const struct of_device_id adf4350_of_match[] = {
@@ -607,7 +579,6 @@ static struct spi_driver adf4350_driver = { .of_match_table = adf4350_of_match, }, .probe = adf4350_probe, - .remove = adf4350_remove, .id_table = adf4350_id, };module_spi_driver (adf4350_driver);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 255/379 perf kwork: Fix incorrect and missing free atom in work_push_atom()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Jihong <[email protected]>
[ Upstream commit d39710088d82ef100b33cdf4a9de3546fb0bb5df ]
1. Atoms are managed in page mode and should be released using atom_free() instead of free().
2. When the event does not match, the atom needs to free.
--- tools/perf/builtin-kwork.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/builtin-kwork.c +4 -2
@@ -399,12 +399,14 @@ static int work_push_atom(struct perf_kwork *kwork, work =work_findnew (&class->work_root, &key, &kwork->cmp_id);if (work ==NULL ) { -free (atom); +atom_free (atom);return -1 ; } -if (!profile_event_match (kwork, work, sample)) +if (!profile_event_match (kwork, work, sample)) { +atom_free (atom);return 0 ; + }if (dst_type <KWORK_TRACE_MAX ) { dst_atom = list_last_entry_or_null(&work->atom_list[dst_type],
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 256/379 perf kwork: Add the supported subcommands to the document
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Jihong <[email protected]>
[ Upstream commit 76e0d8c821bbd952730799cc7af841f9de67b7f7 ]
Add missing report, latency and timehist subcommands to the document.
--- tools/perf/Documentation/perf-kwork.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Documentation/perf-kwork.txt +1 -1
@@ -8,7 +8,7 @@ perf-kwork - Tool to trace/measure kernel work properties (latencies) SYNOPSIS -------- [verse] -'perf kwork' {record} +'perf kwork' {record|report|latency|timehist} DESCRIPTION -----------
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 257/379 perf kwork: Set ordered_events to true in struct perf_tool
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Jihong <[email protected]>
[ Upstream commit 0c526579a4b2b6ecd540472f2e34c2850cf70f76 ]
'perf kwork' processes data based on timestamps and needs to sort events.
--- tools/perf/builtin-kwork.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/builtin-kwork.c +4 -3
@@ -1672,9 +1672,10 @@ int cmd_kwork(int argc, const char **argv)static struct perf_kwork kwork = { .class_list =LIST_HEAD_INIT (kwork.class_list), .tool = { - .mmap = perf_event__process_mmap, - .mmap2 = perf_event__process_mmap2, - .sample = perf_kwork__process_tracepoint_sample, + .mmap = perf_event__process_mmap, + .mmap2 = perf_event__process_mmap2, + .sample = perf_kwork__process_tracepoint_sample, + .ordered_events = true, }, .atom_page_list =LIST_HEAD_INIT (kwork.atom_page_list), .sort_list =LIST_HEAD_INIT (kwork.sort_list),
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 258/379 filemap: add filemap_get_folios_tag()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishal Moola (Oracle) <[email protected]>
[ Upstream commit 247f9e1feef4e57911510c8f82348efb4491ea0e ]
This is the equivalent of find_get_pages_range_tag(), except for folios instead of pages.
One noteable difference is filemap_get_folios_tag() does not take in a maximum pages argument. It instead tries to fill a folio batch and stops either once full (15 folios) or reaching the end of the search range.
The new function supports large folios, the initial function did not since all callers don't use large folios.
Stable-dep-of: c5d3f9b7649a ("f2fs: compress: fix deadloop in f2fs_write_cache_pages()")
--- include/linux/pagemap.h | 2 ++ mm/filemap.c | 54 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+)
include/linux/pagemap.h +2 -0
@@ -720,6 +720,8 @@ unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start, pgoff_t end, struct folio_batch *fbatch);unsigned filemap_get_folios_contig (struct address_space *mapping,pgoff_t *start,pgoff_t end,struct folio_batch *fbatch); +unsigned filemap_get_folios_tag (struct address_space *mapping,pgoff_t *start, +pgoff_t end,xa_mark_t tag,struct folio_batch *fbatch);unsigned find_get_pages_range_tag (struct address_space *mapping,pgoff_t *index,pgoff_t end,xa_mark_t tag,unsigned int nr_pages,struct page **pages);
mm/filemap.c +54 -0
60 lines not on this page · raw message
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 259/379 f2fs: convert f2fs_write_cache_pages() to use filemap_get_folios_tag()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishal Moola (Oracle) <[email protected]>
[ Upstream commit 1cd98ee747cff120ee9b93988ddb7315d8d8f8e7 ]
Convert the function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag().
Also modified f2fs_all_cluster_page_ready to take in a folio_batch instead of pagevec. This does NOT support large folios. The function currently only utilizes folios of size 1 so this shouldn't cause any issues right now.
This version of the patch limits the number of pages fetched to F2FS_ONSTACK_PAGES. If that ever happens, update the start index here since filemap_get_folios_tag() updates the index to be after the last found folio, not necessarily the last used page.
Stable-dep-of: c5d3f9b7649a ("f2fs: compress: fix deadloop in f2fs_write_cache_pages()")
--- fs/f2fs/data.c | 84 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 26 deletions(-)
fs/f2fs/data.c +58 -26
@@ -2951,6 +2951,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,int ret =0 ;int done =0 , retry =0 ;struct page *pages[F2FS_ONSTACK_PAGES ]; +struct folio_batch fbatch;struct f2fs_sb_info *sbi =F2FS_M_SB (mapping);struct bio *bio =NULL ;sector_t last_block;
@@ -2971,6 +2972,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, .private = NULL, };#endif +int nr_folios, p, idx;int nr_pages;pgoff_t index;pgoff_t end;/* Inclusive */
@@ -2981,6 +2983,8 @@ static int f2fs_write_cache_pages(struct address_space *mapping,int submitted =0 ;int i; +folio_batch_init (&fbatch); +if (get_dirty_pages (mapping->host) <=SM_I (F2FS_M_SB (mapping))->min_hot_blocks)set_inode_flag (mapping->host,FI_HOT_DATA );
@@ -3006,13 +3010,38 @@ static int f2fs_write_cache_pages(struct address_space *mapping,tag_pages_for_writeback (mapping, index, end); done_index = index;while (!done && !retry && (index <= end)) { - nr_pages =find_get_pages_range_tag (mapping, &index, end, - tag,F2FS_ONSTACK_PAGES , pages); -if (nr_pages ==0 ) + nr_pages =0 ; +again: + nr_folios =filemap_get_folios_tag (mapping, &index, end, + tag, &fbatch); +if (nr_folios ==0 ) { +if (nr_pages) + goto write;break ; + } +for (i =0 ; i < nr_folios; i++) { +struct folio *folio = fbatch.folios[i]; + + idx =0 ; + p =folio_nr_pages (folio); +add_more: + pages[nr_pages] =folio_page (folio, idx); +folio_get (folio); +if (++nr_pages ==F2FS_ONSTACK_PAGES ) { + index = folio->index + idx +1 ; +folio_batch_release (&fbatch); + goto write; + } +if (++idx < p) + goto add_more; + } +folio_batch_release (&fbatch); + goto again; +write:for (i =0 ; i < nr_pages; i++) {struct page *page = pages[i]; +struct folio *folio =page_folio (page);bool need_readd; readd: need_readd = false;
@@ -3029,7 +3058,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, }if (!f2fs_cluster_can_merge_page (&cc, - page->index)) { + folio->index)) { ret =f2fs_write_multi_pages (&cc, &submitted, wbc, io_type);if (!ret)
@@ -3038,27 +3067,28 @@ static int f2fs_write_cache_pages(struct address_space *mapping, }if (unlikely (f2fs_cp_error (sbi))) - goto lock_page; + goto lock_folio;if (!f2fs_cluster_is_empty (&cc)) - goto lock_page; + goto lock_folio;if (f2fs_all_cluster_page_ready (&cc, pages, i, nr_pages, true)) - goto lock_page; + goto lock_folio; ret2 =f2fs_prepare_compress_overwrite ( inode, &pagep, - page->index, &fsdata); + folio->index, &fsdata);if (ret2 <0 ) { ret = ret2; done =1 ;break ; }else if (ret2 && (!f2fs_compress_write_end (inode, - fsdata, page->index,1 ) || + fsdata, folio->index,1 ) || !f2fs_all_cluster_page_ready (&cc, - pages, i, nr_pages, false))) { + pages, i, nr_pages, + false))) { retry =1 ;break ; }
@@ -3071,46 +3101,47 @@ static int f2fs_write_cache_pages(struct address_space *mapping,break ; } #ifdef CONFIG_F2FS_FS_COMPRESSION -lock_page: +lock_folio: #endif - done_index = page->index; + done_index = folio->index; retry_write: - lock_page(page); + folio_lock(folio); - if (unlikely(page->mapping != mapping)) { + if (unlikely(folio->mapping != mapping)) { continue_unlock: - unlock_page(page); + folio_unlock(folio); continue; } - if (!PageDirty(page)) { + if (!folio_test_dirty(folio)) { /* someone wrote it for us */ goto continue_unlock; } - if (PageWriteback(page)) { + if (folio_test_writeback(folio)) { if (wbc->sync_mode != WB_SYNC_NONE) - f2fs_wait_on_page_writeback(page, + f2fs_wait_on_page_writeback( + &folio->page, DATA, true, true); else goto continue_unlock; } - if (!clear_page_dirty_for_io(page)) + if (!folio_clear_dirty_for_io(folio)) goto continue_unlock; #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { - get_page(page); - f2fs_compress_ctx_add_page(&cc, page); + folio_get(folio); + f2fs_compress_ctx_add_page(&cc, &folio->page); continue; } #endif - ret = f2fs_write_single_data_page(page, &submitted, - &bio, &last_block, wbc, io_type, - 0, true); + ret = f2fs_write_single_data_page(&folio->page, + &submitted, &bio, &last_block, + wbc, io_type, 0, true); if (ret == AOP_WRITEPAGE_ACTIVATE) - unlock_page(page); + folio_unlock(folio); #ifdef CONFIG_F2FS_FS_COMPRESSION result: #endif
@@ -3134,7 +3165,8 @@ static int f2fs_write_cache_pages(struct address_space *mapping, } goto next; } - done_index = page->index +1 ; + done_index = folio->index + +folio_nr_pages (folio); done =1 ;break ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 260/379 f2fs: compress: fix deadloop in f2fs_write_cache_pages()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit c5d3f9b7649abb20aa5ab3ebff9421a171eaeb22 ]
With below mount option and testcase, it hangs kernel.
1. mount -t f2fs -o compress_log_size=5 /dev/vdb /mnt/f2fs
2. touch /mnt/f2fs/file
3. chattr +c /mnt/f2fs/file
4. dd if=/dev/zero of=/mnt/f2fs/file bs=1MB count=1
5. sync
6. dd if=/dev/zero of=/mnt/f2fs/file bs=111 count=11 conv=notrunc
7. sync
INFO: task sync:4788 blocked for more than 120 seconds.
Not tainted 6.5.0-rc1+ #322
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:sync state:D stack:0 pid:4788 ppid:509 flags:0x00000002
Call Trace:
<TASK>
__schedule+0x335/0xf80
schedule+0x6f/0xf0
wb_wait_for_completion+0x5e/0x90
sync_inodes_sb+0xd8/0x2a0
sync_inodes_one_sb+0x1d/0x30
iterate_supers+0x99/0xf0
ksys_sync+0x46/0xb0
__do_sys_sync+0x12/0x20
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x6e/0xd8The reason is f2fs_all_cluster_page_ready() assumes that pages array should cover at least one cluster, otherwise, it will always return false, result in deadloop.
By default, pages array size is 16, and it can cover the case cluster_size is equal or less than 16, for the case cluster_size is larger than 16, let's allocate memory of pages array dynamically.
--- fs/f2fs/data.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/f2fs/data.c +18 -2
@@ -2950,7 +2950,8 @@ static int f2fs_write_cache_pages(struct address_space *mapping, {int ret =0 ;int done =0 , retry =0 ; -struct page *pages[F2FS_ONSTACK_PAGES ]; +struct page *pages_local[F2FS_ONSTACK_PAGES ]; +struct page **pages = pages_local;struct folio_batch fbatch;struct f2fs_sb_info *sbi =F2FS_M_SB (mapping);struct bio *bio =NULL ;
@@ -2974,6 +2975,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,#endif int nr_folios, p, idx;int nr_pages; +unsigned int max_pages =F2FS_ONSTACK_PAGES ;pgoff_t index;pgoff_t end;/* Inclusive */ pgoff_t done_index;
@@ -2983,6 +2985,15 @@ static int f2fs_write_cache_pages(struct address_space *mapping,int submitted =0 ;int i; +#ifdef CONFIG_F2FS_FS_COMPRESSION +if (f2fs_compressed_file (inode) && +1 << cc.log_cluster_size >F2FS_ONSTACK_PAGES ) { + pages =f2fs_kzalloc (sbi,sizeof (struct page *) << + cc.log_cluster_size,GFP_NOFS | __GFP_NOFAIL); + max_pages =1 << cc.log_cluster_size; + } +#endif +folio_batch_init (&fbatch); if (get_dirty_pages(mapping->host) <=
@@ -3028,7 +3039,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, add_more: pages[nr_pages] =folio_page (folio, idx);folio_get (folio); -if (++nr_pages ==F2FS_ONSTACK_PAGES ) { +if (++nr_pages == max_pages) { index = folio->index + idx +1 ;folio_batch_release (&fbatch); goto write;
@@ -3214,6 +3225,11 @@ static int f2fs_write_cache_pages(struct address_space *mapping,if (bio)f2fs_submit_merged_ipu_write (sbi, &bio,NULL ); +#ifdef CONFIG_F2FS_FS_COMPRESSION +if (pages != pages_local) +kfree (pages); +#endif +return ret; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 261/379 f2fs: compress: fix to avoid use-after-free on dic
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit b0327c84e91a0f4f0abced8cb83ec86a7083f086 ]
Call trace: __memcpy+0x128/0x250 f2fs_read_multi_pages+0x940/0xf7c f2fs_mpage_readpages+0x5a8/0x624 f2fs_readahead+0x5c/0x110 page_cache_ra_unbounded+0x1b8/0x590 do_sync_mmap_readahead+0x1dc/0x2e4 filemap_fault+0x254/0xa8c f2fs_filemap_fault+0x2c/0x104 __do_fault+0x7c/0x238 do_handle_mm_fault+0x11bc/0x2d14 do_mem_abort+0x3a8/0x1004 el0_da+0x3c/0xa0 el0t_64_sync_handler+0xc4/0xec el0t_64_sync+0x1b4/0x1b8
In f2fs_read_multi_pages(), once f2fs_decompress_cluster() was called if we hit cached page in compress_inode's cache, dic may be released, it needs break the loop rather than continuing it, in order to avoid accessing invalid dic pointer.
--- fs/f2fs/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/data.c +3 -1
@@ -2263,8 +2263,10 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,f2fs_wait_on_block_writeback (inode, blkaddr);if (f2fs_load_compressed_page (sbi, page, blkaddr)) { -if (atomic_dec_and_test (&dic->remaining_pages)) +if (atomic_dec_and_test (&dic->remaining_pages)) {f2fs_decompress_cluster (dic, true); +break ; + }continue ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 262/379 f2fs: compress: fix to avoid redundant compress extension
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 7e1b150fece033703a824df1bbc03df091ea53cc ]
With below script, redundant compress extension will be parsed and added by parse_options(), because parse_options() doesn't check whether the extension is existed or not, fix it.
1. mount -t f2fs -o compress_extension=so /dev/vdb /mnt/f2fs
2. mount -t f2fs -o remount,compress_extension=so /mnt/f2fs
3. mount|grep f2fs
/dev/vdb on /mnt/f2fs type f2fs (...,compress_extension=so,compress_extension=so,...)
--- fs/f2fs/super.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
fs/f2fs/super.c +33 -0
@@ -548,6 +548,29 @@ static int f2fs_set_test_dummy_encryption(struct super_block *sb, }#ifdef CONFIG_F2FS_FS_COMPRESSION +static bool is_compress_extension_exist (struct f2fs_sb_info *sbi, +const char *new_ext,bool is_ext) +{ +unsigned char (*ext)[F2FS_EXTENSION_LEN ]; +int ext_cnt; +int i; + +if (is_ext) { + ext =F2FS_OPTION (sbi).extensions; + ext_cnt =F2FS_OPTION (sbi).compress_ext_cnt; + }else { + ext =F2FS_OPTION (sbi).noextensions; + ext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt; + } + +for (i =0 ; i < ext_cnt; i++) { +if (!strcasecmp (new_ext, ext[i])) +return true; + } + +return false; +} +/* * 1. The same extension name cannot not appear in both compress and non-compress extension * at the same time.
@@ -1145,6 +1168,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)return -EINVAL ; } +if (is_compress_extension_exist (sbi, name, true)) { +kfree (name); +break ; + } +strcpy (ext[ext_cnt], name);F2FS_OPTION (sbi).compress_ext_cnt++;kfree (name);
@@ -1169,6 +1197,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)return -EINVAL ; } +if (is_compress_extension_exist (sbi, name, false)) { +kfree (name); +break ; + } +strcpy (noext[noext_cnt], name);F2FS_OPTION (sbi).nocompress_ext_cnt++;kfree (name);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 263/379 tty: tty_jobctrl: fix pid memleak in disassociate_ctty()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit 11e7f27b79757b6586645d87b95d5b78375ecdfc ]
There is a pid leakage:
------------------------------
unreferenced object 0xffff88810c181940 (size 224):
comm "sshd", pid 8191, jiffies 4294946950 (age 524.570s) hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N.. ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff ....kkkk........
backtrace:
[<ffffffff814774e6>] kmem_cache_alloc+0x5c6/0x9b0
[<ffffffff81177342>] alloc_pid+0x72/0x570
[<ffffffff81140ac4>] copy_process+0x1374/0x2470
[<ffffffff81141d77>] kernel_clone+0xb7/0x900
[<ffffffff81142645>] __se_sys_clone+0x85/0xb0
[<ffffffff8114269b>] __x64_sys_clone+0x2b/0x30
[<ffffffff83965a72>] do_syscall_64+0x32/0x80
[<ffffffff83a00085>] entry_SYSCALL_64_after_hwframe+0x61/0xc6It turns out that there is a race condition between disassociate_ctty() and tty_signal_session_leader(), which caused this leakage.
The pid memleak is triggered by the following race:
task[sshd] task[bash]
----------------------- -----------------------
disassociate_ctty();
spin_lock_irq(¤t->sighand->siglock);
put_pid(current->signal->tty_old_pgrp);
current->signal->tty_old_pgrp = NULL;
tty = tty_kref_get(current->signal->tty);
spin_unlock_irq(¤t->sighand->siglock);tty_vhangup();tty_lock(tty);
...tty_signal_session_leader(); spin_lock_irq(&p->sighand->siglock);
...
if (tty->ctrl.pgrp) //tty->ctrl.pgrp is not NULL p->signal->tty_old_pgrp = get_pid(tty->ctrl.pgrp); //An extra get spin_unlock_irq(&p->sighand->siglock);
...
tty_unlock(tty);
if (tty) {
tty_lock(tty);
...
put_pid(tty->ctrl.pgrp);
tty->ctrl.pgrp = NULL; //It's too late
...
tty_unlock(tty);
}The issue is believed to be introduced by commit c8bcd9c5be24 ("tty:
Fix ->session locking") who moves the unlock of siglock in disassociate_ctty() above "if (tty)", making a small window allowing tty_signal_session_leader() to kick in. It can be easily reproduced by adding a delay before "if (tty)" and at the entrance of tty_signal_session_leader().
To fix this issue, we move "put_pid(current->signal->tty_old_pgrp)" after "tty->ctrl.pgrp = NULL".
--- drivers/tty/tty_jobctrl.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/tty/tty_jobctrl.c +11 -6
@@ -300,12 +300,7 @@ void disassociate_ctty(int on_exit)return ; } -spin_lock_irq (¤t->sighand->siglock); -put_pid (current->signal->tty_old_pgrp); - current->signal->tty_old_pgrp =NULL ; - tty =tty_kref_get (current->signal->tty); -spin_unlock_irq (¤t->sighand->siglock); - + tty =get_current_tty ();if (tty) {unsigned long flags;
@@ -320,6 +315,16 @@ void disassociate_ctty(int on_exit)tty_kref_put (tty); } +/* If tty->ctrl.pgrp is not NULL, it may be assigned to +* current->signal->tty_old_pgrp in a race condition, and +* cause pid memleak. Release current->signal->tty_old_pgrp +* after tty->ctrl.pgrp set to NULL. +*/ +spin_lock_irq (¤t->sighand->siglock); +put_pid (current->signal->tty_old_pgrp); + current->signal->tty_old_pgrp =NULL ; +spin_unlock_irq (¤t->sighand->siglock); +/* Now clear signal->tty under the lock */ read_lock (&tasklist_lock);session_clear_tty (task_session (current));
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 264/379 livepatch: Fix missing newline character in klp_resolve_symbols()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit 67e18e132f0fd738f8c8cac3aa1420312073f795 ]
Without the newline character, the log may not be printed immediately after the error occurs.
--- kernel/livepatch/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/livepatch/core.c +1 -1
@@ -244,7 +244,7 @@ static int klp_resolve_symbols(Elf_Shdr *sechdrs, const char *strtab,* symbols are exported and normal relas can be used instead. */ if (!sec_vmlinux && sym_vmlinux) { -pr_err ("invalid access to vmlinux symbol '%s' from module-specific livepatch relocation section" , +pr_err ("invalid access to vmlinux symbol '%s' from module-specific livepatch relocation section\n" , sym_name);return -EINVAL ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 265/379 pinctrl: renesas: rzg2l: Make reverse order of enable() for disable()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit dd462cf53e4dff0f4eba5e6650e31ceddec74c6f ]
We usually do reverse order of enable() for disable(). Currently, the ordering of irq_chip_disable_parent() is not correct in rzg2l_gpio_irq_disable(). Fix the incorrect order.
--- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/pinctrl-rzg2l.c +2 -1
@@ -1173,6 +1173,8 @@ static void rzg2l_gpio_irq_disable(struct irq_data *d)u32 port;u8 bit; +irq_chip_disable_parent (d); + port =RZG2L_PIN_ID_TO_PORT (hwirq); bit =RZG2L_PIN_ID_TO_PIN (hwirq);
@@ -1187,7 +1189,6 @@ static void rzg2l_gpio_irq_disable(struct irq_data *d)spin_unlock_irqrestore (&pctrl->lock, flags);gpiochip_disable_irq (gc, hwirq); -irq_chip_disable_parent (d); }static void rzg2l_gpio_irq_enable (struct irq_data *d)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 266/379 perf record: Fix BTF type checks in the off-cpu profiling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 0e501a65d35bf72414379fed0e31a0b6b81ab57d ]
The BTF func proto for a tracepoint has one more argument than the actual tracepoint function since it has a context argument at the begining. So it should compare to 5 when the tracepoint has 4 arguments.
typedef void (*btf_trace_sched_switch)(void *, bool, struct task_struct *, struct task_struct *, unsigned int);
Also, recent change in the perf tool would use a hand-written minimal vmlinux.h to generate BTF in the skeleton. So it won't have the info of the tracepoint. Anyway it should use the kernel's vmlinux BTF to check the type in the kernel.
--- tools/perf/util/bpf_off_cpu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/bpf_off_cpu.c +3 -2
@@ -98,7 +98,7 @@ static void off_cpu_finish(void *arg __maybe_unused)/* v5.18 kernel added prev_state arg, so it needs to check the signature */ static void check_sched_switch_args (void ) { -const struct btf *btf =bpf_object__btf (skel->obj); +const struct btf *btf =btf__load_vmlinux_btf ();const struct btf_type *t1, *t2, *t3;u32 type_id;
@@ -116,7 +116,8 @@ static void check_sched_switch_args(void)return ; t3 =btf__type_by_id (btf, t2->type); -if (t3 &&btf_is_func_proto (t3) &&btf_vlen (t3) ==4 ) { +/* btf_trace func proto has one more argument for the context */ +if (t3 &&btf_is_func_proto (t3) &&btf_vlen (t3) ==5 ) {/* new format: pass prev_state as 4th arg */ skel->rodata->has_prev_state = true; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 267/379 dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
[ Upstream commit 88928addeec577386e8c83b48b5bc24d28ba97fd ]
idxd sub-drivers belong to bus dsa_bus_type. Thus, dsa_bus_type must be registered in dsa bus init before idxd drivers can be registered.
But the order is wrong when both idxd and idxd_bus are builtin drivers. In this case, idxd driver is compiled and linked before idxd_bus driver. Since the initcall order is determined by the link order, idxd sub-drivers are registered in idxd initcall before dsa_bus_type is registered in idxd_bus initcall. idxd initcall fails:
[ 21.562803] calling idxd_init_module+0x0/0x110 @ 1 [ 21.570761] Driver 'idxd' was unable to register with bus_type 'dsa' because the bus was not initialized. [ 21.586475] initcall idxd_init_module+0x0/0x110 returned -22 after 15717 usecs [ 21.597178] calling dsa_bus_init+0x0/0x20 @ 1
To fix the issue, compile and link idxd_bus driver before idxd driver to ensure the right registration order.
--- drivers/dma/idxd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/idxd/Makefile +3 -3
@@ -1,12 +1,12 @@ ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=IDXD +obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o +idxd_bus-y := bus.o + obj-$(CONFIG_INTEL_IDXD) += idxd.o idxd-y := init.o irq.o device.o sysfs.o submit.o dma.o cdev.o idxd-$(CONFIG_INTEL_IDXD_PERFMON) += perfmon.o -obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o -idxd_bus-y := bus.o - obj-$(CONFIG_INTEL_IDXD_COMPAT) += idxd_compat.o idxd_compat-y := compat.o
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 268/379 usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia-Ju Bai <[email protected]>
[ Upstream commit ef307bc6ef04e8c1ea843231db58e3afaafa9fa6 ]
In _dwc2_hcd_urb_enqueue(), "urb->hcpriv = NULL" is executed without holding the lock "hsotg->lock". In _dwc2_hcd_urb_dequeue():
spin_lock_irqsave(&hsotg->lock, flags);
...
if (!urb->hcpriv) {
dev_dbg(hsotg->dev, "## urb->hcpriv is NULL ##\n");
goto out;
}
rc = dwc2_hcd_urb_dequeue(hsotg, urb->hcpriv); // Use urb->hcpriv
...
out:
spin_unlock_irqrestore(&hsotg->lock, flags);When _dwc2_hcd_urb_enqueue() and _dwc2_hcd_urb_dequeue() are concurrently executed, the NULL check of "urb->hcpriv" can be executed before "urb->hcpriv = NULL". After urb->hcpriv is NULL, it can be used in the function call to dwc2_hcd_urb_dequeue(), which can cause a NULL pointer dereference.
This possible bug is found by an experimental static analysis tool developed by myself. This tool analyzes the locking APIs to extract function pairs that can be concurrently executed, and then analyzes the instructions in the paired functions to identify possible concurrency bugs including data races and atomicity violations. The above possible bug is reported, when my tool analyzes the source code of Linux 6.5.
To fix this possible bug, "urb->hcpriv = NULL" should be executed with holding the lock "hsotg->lock". After using this patch, my tool never reports the possible bug, with the kernelconfiguration allyesconfig for x86_64. Because I have no associated hardware, I cannot test the patch in runtime testing, and just verify it according to the code logic.
--- drivers/usb/dwc2/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +1 -1
@@ -4769,8 +4769,8 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,if (qh_allocated && qh->channel && qh->channel->qh == qh) qh->channel->qh =NULL ; fail2: -spin_unlock_irqrestore (&hsotg->lock, flags); urb->hcpriv =NULL ; +spin_unlock_irqrestore (&hsotg->lock, flags);kfree (qtd); fail1:if (qh_allocated) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 269/379 usb: chipidea: Fix DMA overwrite for Tegra
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Mirosław <[email protected]>
[ Upstream commit 7ab8716713c931ac79988f2592e1cf8b2e4fec1b ]
Tegra USB controllers seem to issue DMA in full 32-bit words only and thus may overwrite unevenly-sized buffers. One such occurrence is detected by SLUB when receiving a reply to a 1-byte buffer (below). Fix this by allocating a bounce buffer also for buffers with sizes not a multiple of 4.
=============================================================================
BUG kmalloc-64 (Tainted: G B ): kmalloc Redzone overwritten
-----------------------------------------------------------------------------
0x8555cd02-0x8555cd03 @offset=3330. First byte 0x0 instead of 0xcc Allocated in usb_get_status+0x2b/0xac age=1 cpu=3 pid=41
__kmem_cache_alloc_node+0x12f/0x1e4 __kmalloc+0x33/0x8c usb_get_status+0x2b/0xac hub_probe+0x5e9/0xcec usb_probe_interface+0xbf/0x21c really_probe+0xa5/0x2c4 __driver_probe_device+0x75/0x174 driver_probe_device+0x31/0x94 __device_attach_driver+0x65/0xc0 bus_for_each_drv+0x4b/0x74 __device_attach+0x69/0x120 bus_probe_device+0x65/0x6c device_add+0x48b/0x5f8 usb_set_configuration+0x37b/0x6b4 usb_generic_driver_probe+0x37/0x68 usb_probe_device+0x35/0xb4
Slab 0xbf622b80 objects=21 used=18 fp=0x8555cdc0 flags=0x800(slab|zone=0) Object 0x8555cd00 @offset=3328 fp=0x00000000
Redzone 8555ccc0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................ Redzone 8555ccd0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................ Redzone 8555cce0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................ Redzone 8555ccf0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................
Object 8555cd00: 01 00 00 00 cc cc cc cc cc cc cc cc cc cc cc cc ................
Object 8555cd10: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................
Object 8555cd20: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................
Object 8555cd30: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................
Redzone 8555cd40: cc cc cc cc ....
Padding 8555cd74: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZ
CPU: 3 PID: 41 Comm: kworker/3:1 Tainted: G B 6.6.0-rc1mq-00118-g59786f827ea1 #1115 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) Workqueue: usb_hub_wq hub_event [<8010ca28>] (unwind_backtrace) from [<801090a5>] (show_stack+0x11/0x14) [<801090a5>] (show_stack) from [<805da2fb>] (dump_stack_lvl+0x4d/0x7c) [<805da2fb>] (dump_stack_lvl) from [<8026464f>] (check_bytes_and_report+0xb3/0xe4) [<8026464f>] (check_bytes_and_report) from [<802648e1>] (check_object+0x261/0x290) [<802648e1>] (check_object) from [<802671b1>] (free_to_partial_list+0x105/0x3f8) [<802671b1>] (free_to_partial_list) from [<80268613>] (__kmem_cache_free+0x103/0x128) [<80268613>] (__kmem_cache_free) from [<80425a67>] (usb_get_status+0x73/0xac) [<80425a67>] (usb_get_status) from [<80421b31>] (hub_probe+0x5e9/0xcec) [<80421b31>] (hub_probe) from [<80428bbb>] (usb_probe_interface+0xbf/0x21c) [<80428bbb>] (usb_probe_interface) from [<803ee13d>] (really_probe+0xa5/0x2c4) [<803ee13d>] (really_probe) from [<803ee3d1>] (__driver_probe_device+0x75/0x174) [<803ee3d1>] (__driver_probe_device) from [<803ee501>] (driver_probe_device+0x31/0x94)
usb 1-1: device descriptor read/8, error -71
--- drivers/usb/chipidea/host.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/chipidea/host.c +4 -3
@@ -411,12 +411,13 @@ static int ci_hdrc_alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags)const unsigned int ci_hdrc_usb_dma_align =32 ;size_t kmalloc_size; -if (urb->num_sgs || urb->sg || urb->transfer_buffer_length ==0 || - !((uintptr_t )urb->transfer_buffer & (ci_hdrc_usb_dma_align -1 ))) +if (urb->num_sgs || urb->sg || urb->transfer_buffer_length ==0 ) +return 0 ; +if (!((uintptr_t )urb->transfer_buffer & (ci_hdrc_usb_dma_align -1 )) && !(urb->transfer_buffer_length &3 ))return 0 ;/* Allocate a buffer with enough padding for alignment */ - kmalloc_size = urb->transfer_buffer_length + + kmalloc_size =ALIGN (urb->transfer_buffer_length,4 ) +sizeof (struct ci_hdrc_dma_aligned_buffer ) + ci_hdrc_usb_dma_align -1 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 270/379 usb: chipidea: Simplify Tegra DMA alignment code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Mirosław <[email protected]>
[ Upstream commit 2ae61a2562c0d1720545b0845829a65fb6a9c2c6 ]
The USB host on Tegra3 works with 32-bit alignment. Previous code tried to align the buffer, but it did align the wrapper struct instead, so the buffer was at a constant offset of 8 bytes (two pointers) from expected alignment. Since kmalloc() guarantees at least 8-byte alignment already, the alignment-extending is removed.
--- drivers/usb/chipidea/host.c | 45 +++++++++++++++---------------------- 1 file changed, 18 insertions(+), 27 deletions(-)
drivers/usb/chipidea/host.c +18 -27
@@ -30,8 +30,7 @@ struct ehci_ci_priv { };struct ci_hdrc_dma_aligned_buffer { -void *kmalloc_ptr; -void *old_xfer_buffer; +void *original_buffer;u8 data[]; };
@@ -380,60 +379,52 @@ static int ci_ehci_bus_suspend(struct usb_hcd *hcd)return 0 ; } -static void ci_hdrc_free_dma_aligned_buffer (struct urb *urb) +static void ci_hdrc_free_dma_aligned_buffer (struct urb *urb,bool copy_back) {struct ci_hdrc_dma_aligned_buffer *temp; -size_t length;if (!(urb->transfer_flags &URB_ALIGNED_TEMP_BUFFER ))return ; + urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER ; temp =container_of (urb->transfer_buffer, struct ci_hdrc_dma_aligned_buffer, data); + urb->transfer_buffer = temp->original_buffer; + +if (copy_back &&usb_urb_dir_in (urb)) { +size_t length; -if (usb_urb_dir_in (urb)) {if (usb_pipeisoc (urb->pipe)) length = urb->transfer_buffer_length;else length = urb->actual_length; -memcpy (temp->old_xfer_buffer, temp->data, length); +memcpy (temp->original_buffer, temp->data, length); } - urb->transfer_buffer = temp->old_xfer_buffer; -kfree (temp->kmalloc_ptr); - urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER ; +kfree (temp); }static int ci_hdrc_alloc_dma_aligned_buffer (struct urb *urb,gfp_t mem_flags) { -struct ci_hdrc_dma_aligned_buffer *temp, *kmalloc_ptr; -const unsigned int ci_hdrc_usb_dma_align =32 ; -size_t kmalloc_size; +struct ci_hdrc_dma_aligned_buffer *temp;if (urb->num_sgs || urb->sg || urb->transfer_buffer_length ==0 )return 0 ; -if (!((uintptr_t )urb->transfer_buffer & (ci_hdrc_usb_dma_align -1 )) && !(urb->transfer_buffer_length &3 )) +if (IS_ALIGNED ((uintptr_t )urb->transfer_buffer,4 ) + &&IS_ALIGNED (urb->transfer_buffer_length,4 ))return 0 ; -/* Allocate a buffer with enough padding for alignment */ - kmalloc_size =ALIGN (urb->transfer_buffer_length,4 ) + -sizeof (struct ci_hdrc_dma_aligned_buffer ) + - ci_hdrc_usb_dma_align -1 ; - - kmalloc_ptr =kmalloc (kmalloc_size, mem_flags); -if (!kmalloc_ptr) + temp =kmalloc (sizeof (*temp) +ALIGN (urb->transfer_buffer_length,4 ), mem_flags); +if (!temp)return -ENOMEM ; -/* Position our struct dma_aligned_buffer such that data is aligned */ - temp =PTR_ALIGN (kmalloc_ptr +1 , ci_hdrc_usb_dma_align) -1 ; - temp->kmalloc_ptr = kmalloc_ptr; - temp->old_xfer_buffer = urb->transfer_buffer;if (usb_urb_dir_out (urb))memcpy (temp->data, urb->transfer_buffer, urb->transfer_buffer_length); - urb->transfer_buffer = temp->data; + temp->original_buffer = urb->transfer_buffer; + urb->transfer_buffer = temp->data; urb->transfer_flags |=URB_ALIGNED_TEMP_BUFFER ;return 0 ;
@@ -450,7 +441,7 @@ static int ci_hdrc_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, ret =usb_hcd_map_urb_for_dma (hcd, urb, mem_flags);if (ret) -ci_hdrc_free_dma_aligned_buffer (urb); +ci_hdrc_free_dma_aligned_buffer (urb, false);return ret; }
@@ -458,7 +449,7 @@ static int ci_hdrc_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,static void ci_hdrc_unmap_urb_for_dma (struct usb_hcd *hcd,struct urb *urb) {usb_hcd_unmap_urb_for_dma (hcd, urb); -ci_hdrc_free_dma_aligned_buffer (urb); +ci_hdrc_free_dma_aligned_buffer (urb, true); }int ci_hdrc_host_init (struct ci_hdrc *ci)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 271/379 dmaengine: ti: edma: handle irq_of_parse_and_map() errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 14f6d317913f634920a640e9047aa2e66f5bdcb7 ]
Zero is not a valid IRQ for in-kernel code and the irq_of_parse_and_map() function returns zero on error. So this check for valid IRQs should only accept values > 0.
--- drivers/dma/ti/edma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/edma.c +2 -2
@@ -2410,7 +2410,7 @@ static int edma_probe(struct platform_device *pdev)if (irq <0 && node) irq =irq_of_parse_and_map (node,0 ); -if (irq >=0 ) { +if (irq >0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccint" ,dev_name (dev)); ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name,
@@ -2426,7 +2426,7 @@ static int edma_probe(struct platform_device *pdev)if (irq <0 && node) irq =irq_of_parse_and_map (node,2 ); -if (irq >=0 ) { +if (irq >0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccerrint" ,dev_name (dev)); ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 272/379 misc: st_core: Do not call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 4d08c3d12b61022501989f9f071514d2d6f77c47 ]
It is not allowed to call kfree_skb() from hardware interrupt context or with hardware interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave(). Compile tested only.
--- drivers/misc/ti-st/st_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/misc/ti-st/st_core.c +4 -3
@@ -15,6 +15,7 @@#include <linux/skbuff.h> #include <linux/ti_wilink_st.h> +#include <linux/netdevice.h> extern void st_kim_recv (void *,const unsigned char *,long );void st_int_recv (void *,const unsigned char *,long );
@@ -435,7 +436,7 @@ static void st_int_enqueue(struct st_data_s *st_gdata, struct sk_buff *skb)case ST_LL_AWAKE_TO_ASLEEP :pr_err ("ST LL is illegal state(%ld)," "purging received skb." ,st_ll_getstate (st_gdata)); -kfree_skb (skb); +dev_kfree_skb_irq (skb);break ;case ST_LL_ASLEEP :skb_queue_tail (&st_gdata->tx_waitq, skb);
@@ -444,7 +445,7 @@ static void st_int_enqueue(struct st_data_s *st_gdata, struct sk_buff *skb)default :pr_err ("ST LL is illegal state(%ld)," "purging received skb." ,st_ll_getstate (st_gdata)); -kfree_skb (skb); +dev_kfree_skb_irq (skb);break ; }
@@ -498,7 +499,7 @@ void st_tx_wakeup(struct st_data_s *st_data)spin_unlock_irqrestore (&st_data->lock, flags);break ; } -kfree_skb (skb); +dev_kfree_skb_irq (skb);spin_unlock_irqrestore (&st_data->lock, flags); }/* if wake-up is set in another context- restart sending */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 273/379 tools: iio: iio_generic_buffer ensure alignment
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Vaittinen <[email protected]>
[ Upstream commit 2d3dff577dd0ea8fe9637a13822f7603c4a881c8 ]
The iio_generic_buffer can return garbage values when the total size of scan data is not a multiple of the largest element in the scan. This can be demonstrated by reading a scan, consisting, for example of one 4-byte and one 2-byte element, where the 4-byte element is first in the buffer.
The IIO generic buffer code does not take into account the last two padding bytes that are needed to ensure that the 4-byte data for next scan is correctly aligned.
Add the padding bytes required to align the next sample with the scan size.
--- tools/iio/iio_generic_buffer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tools/iio/iio_generic_buffer.c +12 -1
@@ -54,9 +54,12 @@ enum autochan {static unsigned int size_from_channelarray (struct iio_channel_info *channels,int num_channels) {unsigned int bytes =0 ; -int i =0 ; +int i =0 , max =0 ; +unsigned int misalignment;while (i < num_channels) { +if (channels[i].bytes > max) + max = channels[i].bytes;if (bytes % channels[i].bytes ==0 ) channels[i].location = bytes;else
@@ -66,6 +69,14 @@ static unsigned int size_from_channelarray(struct iio_channel_info *channels, in bytes = channels[i].location + channels[i].bytes; i++; } +/* +* We want the data in next sample to also be properly aligned so +* we'll add padding at the end if needed. Adding padding only +* works for channel data which size is 2^n bytes. +*/ + misalignment = bytes % max; +if (misalignment) + bytes += max - misalignment;return bytes; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 274/379 USB: usbip: fix stub_dev hub disconnect
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Blixt <[email protected]>
[ Upstream commit 97475763484245916735a1aa9a3310a01d46b008 ]
If a hub is disconnected that has device(s) that's attached to the usbip layer the disconnect function might fail because it tries to release the port on an already disconnected hub.
--- drivers/usb/usbip/stub_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/usbip/stub_dev.c +7 -2
@@ -462,8 +462,13 @@ static void stub_disconnect(struct usb_device *udev)/* release port */ rc =usb_hub_release_port (udev->parent, udev->portnum, (struct usb_dev_state *) udev); -if (rc) { -dev_dbg (&udev->dev,"unable to release port\n" ); +/* +* NOTE: If a HUB disconnect triggered disconnect of the down stream +* device usb_hub_release_port will return -ENODEV so we can safely ignore +* that error here. +*/ +if (rc && (rc != -ENODEV )) { +dev_dbg (&udev->dev,"unable to release port (%i)\n" , rc);return ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 275/379 dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 83c761f568733277ce1f7eb9dc9e890649c29a8c ]
If pxad_alloc_desc() fails on the first dma_pool_alloc() call, then sw_desc->nb_desc is zero.
In such a case pxad_free_desc() is called and it will BUG_ON().
Remove this erroneous BUG_ON().
It is also useless, because if "sw_desc->nb_desc == 0", then, on the first iteration of the for loop, i is -1 and the loop will not be executed. (both i and sw_desc->nb_desc are 'int')
--- drivers/dma/pxa_dma.c | 1 - 1 file changed, 1 deletion(-)
drivers/dma/pxa_dma.c +0 -1
@@ -722,7 +722,6 @@ static void pxad_free_desc(struct virt_dma_desc *vd)dma_addr_t dma;struct pxad_desc_sw *sw_desc =to_pxad_sw_desc (vd); -BUG_ON (sw_desc->nb_desc ==0 );for (i = sw_desc->nb_desc -1 ; i >=0 ; i--) {if (i >0 ) dma = sw_desc->hw_desc[i -1 ]->ddadr;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 276/379 f2fs: fix to initialize map.m_pblk in f2fs_precache_extents()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 8b07c1fb0f1ad139373c8253f2fad8bc43fab07d ]
Otherwise, it may print random physical block address in tracepoint of f2fs_map_blocks() as below:
f2fs_map_blocks: dev = (253,16), ino = 2297, file offset = 0, start blkaddr = 0xa356c421, len = 0x0, flags = 0
--- fs/f2fs/file.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/file.c +1 -0
@@ -3249,6 +3249,7 @@ int f2fs_precache_extents(struct inode *inode)return -EOPNOTSUPP ; map.m_lblk =0 ; + map.m_pblk =0 ; map.m_next_pgofs =NULL ; map.m_next_extent = &m_next_extent; map.m_seg_type =NO_CHECK_TYPE ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 277/379 interconnect: qcom: sc7180: Retire DEFINE_QBCM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit e451b2ea5a11fb3f6d83e1f834ae6a5f55a02bba ]
The struct definition macros are hard to read and compare, expand them.
Stable-dep-of: 1ad83c479272 ("interconnect: qcom: sc7180: Set ACV enable_mask")
--- drivers/interconnect/qcom/sc7180.c | 255 ++++++++++++++++++++++++++--- 1 file changed, 231 insertions(+), 24 deletions(-)
drivers/interconnect/qcom/sc7180.c +231 -24
@@ -153,30 +153,237 @@ DEFINE_QNODE(srvc_snoc, SC7180_SLAVE_SERVICE_SNOC, 1, 4);DEFINE_QNODE (xs_qdss_stm,SC7180_SLAVE_QDSS_STM ,1 ,4 );DEFINE_QNODE (xs_sys_tcu_cfg,SC7180_SLAVE_TCU ,1 ,8 ); -DEFINE_QBCM (bcm_acv,"ACV" , false, &ebi); -DEFINE_QBCM (bcm_mc0,"MC0" , true, &ebi); -DEFINE_QBCM (bcm_sh0,"SH0" , true, &qns_llcc); -DEFINE_QBCM (bcm_mm0,"MM0" , false, &qns_mem_noc_hf); -DEFINE_QBCM (bcm_ce0,"CE0" , false, &qxm_crypto); -DEFINE_QBCM (bcm_cn0,"CN0" , true, &qnm_snoc, &xm_qdss_dap, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_ahb2phy0, &qhs_aop, &qhs_aoss, &qhs_boot_rom, &qhs_camera_cfg, &qhs_camera_nrt_throttle_cfg, &qhs_camera_rt_throttle_cfg, &qhs_clk_ctl, &qhs_cpr_cx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_dcc_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_display_rt_throttle_cfg, &qhs_display_throttle_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_mss_cfg, &qhs_npu_cfg, &qhs_npu_dma_throttle_cfg, &qhs_npu_dsp_throttle_cfg, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qm_cfg, &qhs_qm_mpu_cfg, &qhs_qup0, &qhs_qup1, &qhs_security, &qhs_snoc_cfg, &qhs_tcsr, &qhs_tlmm_1, &qhs_tlmm_2, &qhs_tlmm_3, &qhs_ufs_mem_cfg, &qhs_usb3, &qhs_venus_cfg, &qhs_venus_throttle_cfg, &qhs_vsense_ctrl_cfg, &srvc_cnoc); -DEFINE_QBCM (bcm_mm1,"MM1" , false, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qhm_mnoc_cfg, &qxm_mdp0, &qxm_rot, &qxm_venus0, &qxm_venus_arm9); -DEFINE_QBCM (bcm_sh2,"SH2" , false, &acm_sys_tcu); -DEFINE_QBCM (bcm_mm2,"MM2" , false, &qns_mem_noc_sf); -DEFINE_QBCM (bcm_qup0,"QUP0" , false, &qup_core_master_1, &qup_core_master_2); -DEFINE_QBCM (bcm_sh3,"SH3" , false, &qnm_cmpnoc); -DEFINE_QBCM (bcm_sh4,"SH4" , false, &acm_apps0); -DEFINE_QBCM (bcm_sn0,"SN0" , true, &qns_gemnoc_sf); -DEFINE_QBCM (bcm_co0,"CO0" , false, &qns_cdsp_gemnoc); -DEFINE_QBCM (bcm_sn1,"SN1" , false, &qxs_imem); -DEFINE_QBCM (bcm_cn1,"CN1" , false, &qhm_qspi, &xm_sdc2, &xm_emmc, &qhs_ahb2phy2, &qhs_emmc_cfg, &qhs_pdm, &qhs_qspi, &qhs_sdc2); -DEFINE_QBCM (bcm_sn2,"SN2" , false, &qxm_pimem, &qns_gemnoc_gc); -DEFINE_QBCM (bcm_co2,"CO2" , false, &qnm_npu); -DEFINE_QBCM (bcm_sn3,"SN3" , false, &qxs_pimem); -DEFINE_QBCM (bcm_co3,"CO3" , false, &qxm_npu_dsp); -DEFINE_QBCM (bcm_sn4,"SN4" , false, &xs_qdss_stm); -DEFINE_QBCM (bcm_sn7,"SN7" , false, &qnm_aggre1_noc); -DEFINE_QBCM (bcm_sn9,"SN9" , false, &qnm_aggre2_noc); -DEFINE_QBCM (bcm_sn12,"SN12" , false, &qnm_gemnoc); +static struct qcom_icc_bcm bcm_acv = { + .name ="ACV" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_mc0 = { + .name ="MC0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_sh0 = { + .name ="SH0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_llcc }, +}; + +static struct qcom_icc_bcm bcm_mm0 = { + .name ="MM0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_hf }, +}; + +static struct qcom_icc_bcm bcm_ce0 = { + .name ="CE0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_crypto }, +}; + +static struct qcom_icc_bcm bcm_cn0 = { + .name ="CN0" , + .keepalive = true, + .num_nodes =48 , + .nodes = { &qnm_snoc, + &xm_qdss_dap, + &qhs_a1_noc_cfg, + &qhs_a2_noc_cfg, + &qhs_ahb2phy0, + &qhs_aop, + &qhs_aoss, + &qhs_boot_rom, + &qhs_camera_cfg, + &qhs_camera_nrt_throttle_cfg, + &qhs_camera_rt_throttle_cfg, + &qhs_clk_ctl, + &qhs_cpr_cx, + &qhs_cpr_mx, + &qhs_crypto0_cfg, + &qhs_dcc_cfg, + &qhs_ddrss_cfg, + &qhs_display_cfg, + &qhs_display_rt_throttle_cfg, + &qhs_display_throttle_cfg, + &qhs_glm, + &qhs_gpuss_cfg, + &qhs_imem_cfg, + &qhs_ipa, + &qhs_mnoc_cfg, + &qhs_mss_cfg, + &qhs_npu_cfg, + &qhs_npu_dma_throttle_cfg, + &qhs_npu_dsp_throttle_cfg, + &qhs_pimem_cfg, + &qhs_prng, + &qhs_qdss_cfg, + &qhs_qm_cfg, + &qhs_qm_mpu_cfg, + &qhs_qup0, + &qhs_qup1, + &qhs_security, + &qhs_snoc_cfg, + &qhs_tcsr, + &qhs_tlmm_1, + &qhs_tlmm_2, + &qhs_tlmm_3, + &qhs_ufs_mem_cfg, + &qhs_usb3, + &qhs_venus_cfg, + &qhs_venus_throttle_cfg, + &qhs_vsense_ctrl_cfg, + &srvc_cnoc + }, +}; + +static struct qcom_icc_bcm bcm_mm1 = { + .name ="MM1" , + .keepalive = false, + .num_nodes =8 , + .nodes = { &qxm_camnoc_hf0_uncomp, + &qxm_camnoc_hf1_uncomp, + &qxm_camnoc_sf_uncomp, + &qhm_mnoc_cfg, + &qxm_mdp0, + &qxm_rot, + &qxm_venus0, + &qxm_venus_arm9 + }, +}; + +static struct qcom_icc_bcm bcm_sh2 = { + .name ="SH2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &acm_sys_tcu }, +}; + +static struct qcom_icc_bcm bcm_mm2 = { + .name ="MM2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_sf }, +}; + +static struct qcom_icc_bcm bcm_qup0 = { + .name ="QUP0" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qup_core_master_1, &qup_core_master_2 }, +}; + +static struct qcom_icc_bcm bcm_sh3 = { + .name ="SH3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_cmpnoc }, +}; + +static struct qcom_icc_bcm bcm_sh4 = { + .name ="SH4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &acm_apps0 }, +}; + +static struct qcom_icc_bcm bcm_sn0 = { + .name ="SN0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_gemnoc_sf }, +}; + +static struct qcom_icc_bcm bcm_co0 = { + .name ="CO0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_cdsp_gemnoc }, +}; + +static struct qcom_icc_bcm bcm_sn1 = { + .name ="SN1" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_imem }, +}; + +static struct qcom_icc_bcm bcm_cn1 = { + .name ="CN1" , + .keepalive = false, + .num_nodes =8 , + .nodes = { &qhm_qspi, + &xm_sdc2, + &xm_emmc, + &qhs_ahb2phy2, + &qhs_emmc_cfg, + &qhs_pdm, + &qhs_qspi, + &qhs_sdc2 + }, +}; + +static struct qcom_icc_bcm bcm_sn2 = { + .name ="SN2" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qxm_pimem, &qns_gemnoc_gc }, +}; + +static struct qcom_icc_bcm bcm_co2 = { + .name ="CO2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_npu }, +}; + +static struct qcom_icc_bcm bcm_sn3 = { + .name ="SN3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_pimem }, +}; + +static struct qcom_icc_bcm bcm_co3 = { + .name ="CO3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_npu_dsp }, +}; + +static struct qcom_icc_bcm bcm_sn4 = { + .name ="SN4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xs_qdss_stm }, +}; + +static struct qcom_icc_bcm bcm_sn7 = { + .name ="SN7" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre1_noc }, +}; + +static struct qcom_icc_bcm bcm_sn9 = { + .name ="SN9" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre2_noc }, +}; + +static struct qcom_icc_bcm bcm_sn12 = { + .name ="SN12" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_gemnoc }, +};static struct qcom_icc_bcm *const aggre1_noc_bcms[] = { &bcm_cn1,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 278/379 interconnect: qcom: sc7180: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 1ad83c4792722fe134c1352591420702ff7b9091 ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sc7180.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sc7180.c +1 -0
@@ -155,6 +155,7 @@ DEFINE_QNODE(xs_sys_tcu_cfg, SC7180_SLAVE_TCU, 1, 8);static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .keepalive = false, .num_nodes =1 , .nodes = { &ebi },
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 279/379 interconnect: qcom: sc7280: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 437b8e7fcd5df792cb8b8095e9f6eccefec6c099 ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sc7280.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sc7280.c +1 -0
@@ -1284,6 +1284,7 @@ static struct qcom_icc_node srvc_snoc = {static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .num_nodes =1 , .nodes = { &ebi }, };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 280/379 interconnect: qcom: sc8180x: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 0fcaaed3ff4b99e5b688b799f48989f1e4bb8a8b ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sc8180x.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sc8180x.c +1 -0
@@ -1360,6 +1360,7 @@ static struct qcom_icc_node slv_qup_core_2 = {static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .num_nodes =1 , .nodes = { &slv_ebi } };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 281/379 interconnect: qcom: sc8280xp: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 688ffb3dcf85fc4b7ea82af842493013747a9e2c ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sc8280xp.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sc8280xp.c +1 -0
@@ -1727,6 +1727,7 @@ static struct qcom_icc_node srvc_snoc = {static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .num_nodes =1 , .nodes = { &ebi }, };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 282/379 interconnect: qcom: sdm845: Retire DEFINE_QBCM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 35f490c5e4e833e81be464d89404b26ee20740ef ]
The struct definition macros are hard to read and compare, expand them.
Stable-dep-of: f8fe97a9fd20 ("interconnect: qcom: sdm845: Set ACV enable_mask")
--- drivers/interconnect/qcom/sdm845.c | 277 ++++++++++++++++++++++++++--- 1 file changed, 249 insertions(+), 28 deletions(-)
drivers/interconnect/qcom/sdm845.c +249 -28
@@ -146,34 +146,255 @@ DEFINE_QNODE(srvc_snoc, SDM845_SLAVE_SERVICE_SNOC, 1, 4);DEFINE_QNODE (xs_qdss_stm,SDM845_SLAVE_QDSS_STM ,1 ,4 );DEFINE_QNODE (xs_sys_tcu_cfg,SDM845_SLAVE_TCU ,1 ,8 ); -DEFINE_QBCM (bcm_acv,"ACV" , false, &ebi); -DEFINE_QBCM (bcm_mc0,"MC0" , true, &ebi); -DEFINE_QBCM (bcm_sh0,"SH0" , true, &qns_llcc); -DEFINE_QBCM (bcm_mm0,"MM0" , false, &qns_mem_noc_hf); -DEFINE_QBCM (bcm_sh1,"SH1" , false, &qns_apps_io); -DEFINE_QBCM (bcm_mm1,"MM1" , true, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qxm_camnoc_hf0, &qxm_camnoc_hf1, &qxm_mdp0, &qxm_mdp1); -DEFINE_QBCM (bcm_sh2,"SH2" , false, &qns_memnoc_snoc); -DEFINE_QBCM (bcm_mm2,"MM2" , false, &qns2_mem_noc); -DEFINE_QBCM (bcm_sh3,"SH3" , false, &acm_tcu); -DEFINE_QBCM (bcm_mm3,"MM3" , false, &qxm_camnoc_sf, &qxm_rot, &qxm_venus0, &qxm_venus1, &qxm_venus_arm9); -DEFINE_QBCM (bcm_sh5,"SH5" , false, &qnm_apps); -DEFINE_QBCM (bcm_sn0,"SN0" , true, &qns_memnoc_sf); -DEFINE_QBCM (bcm_ce0,"CE0" , false, &qxm_crypto); -DEFINE_QBCM (bcm_cn0,"CN0" , false, &qhm_spdm, &qhm_tic, &qnm_snoc, &xm_qdss_dap, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_aop, &qhs_aoss, &qhs_camera_cfg, &qhs_clk_ctl, &qhs_compute_dsp_cfg, &qhs_cpr_cx, &qhs_crypto0_cfg, &qhs_dcc_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_pcie0_cfg, &qhs_pcie_gen3_cfg, &qhs_pdm, &qhs_phy_refgen_south, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qupv3_north, &qhs_qupv3_south, &qhs_sdc2, &qhs_sdc4, &qhs_snoc_cfg, &qhs_spdm, &qhs_spss_cfg, &qhs_tcsr, &qhs_tlmm_north, &qhs_tlmm_south, &qhs_tsif, &qhs_ufs_card_cfg, &qhs_ufs_mem_cfg, &qhs_usb3_0, &qhs_usb3_1, &qhs_venus_cfg, &qhs_vsense_ctrl_cfg, &qns_cnoc_a2noc, &srvc_cnoc); -DEFINE_QBCM (bcm_qup0,"QUP0" , false, &qhm_qup1, &qhm_qup2); -DEFINE_QBCM (bcm_sn1,"SN1" , false, &qxs_imem); -DEFINE_QBCM (bcm_sn2,"SN2" , false, &qns_memnoc_gc); -DEFINE_QBCM (bcm_sn3,"SN3" , false, &qns_cnoc); -DEFINE_QBCM (bcm_sn4,"SN4" , false, &qxm_pimem); -DEFINE_QBCM (bcm_sn5,"SN5" , false, &xs_qdss_stm); -DEFINE_QBCM (bcm_sn6,"SN6" , false, &qhs_apss, &srvc_snoc, &xs_sys_tcu_cfg); -DEFINE_QBCM (bcm_sn7,"SN7" , false, &qxs_pcie); -DEFINE_QBCM (bcm_sn8,"SN8" , false, &qxs_pcie_gen3); -DEFINE_QBCM (bcm_sn9,"SN9" , false, &srvc_aggre1_noc, &qnm_aggre1_noc); -DEFINE_QBCM (bcm_sn11,"SN11" , false, &srvc_aggre2_noc, &qnm_aggre2_noc); -DEFINE_QBCM (bcm_sn12,"SN12" , false, &qnm_gladiator_sodv, &xm_gic); -DEFINE_QBCM (bcm_sn14,"SN14" , false, &qnm_pcie_anoc); -DEFINE_QBCM (bcm_sn15,"SN15" , false, &qnm_memnoc); +static struct qcom_icc_bcm bcm_acv = { + .name ="ACV" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_mc0 = { + .name ="MC0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_sh0 = { + .name ="SH0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_llcc }, +}; + +static struct qcom_icc_bcm bcm_mm0 = { + .name ="MM0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_hf }, +}; + +static struct qcom_icc_bcm bcm_sh1 = { + .name ="SH1" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_apps_io }, +}; + +static struct qcom_icc_bcm bcm_mm1 = { + .name ="MM1" , + .keepalive = true, + .num_nodes =7 , + .nodes = { &qxm_camnoc_hf0_uncomp, + &qxm_camnoc_hf1_uncomp, + &qxm_camnoc_sf_uncomp, + &qxm_camnoc_hf0, + &qxm_camnoc_hf1, + &qxm_mdp0, + &qxm_mdp1 + }, +}; + +static struct qcom_icc_bcm bcm_sh2 = { + .name ="SH2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_memnoc_snoc }, +}; + +static struct qcom_icc_bcm bcm_mm2 = { + .name ="MM2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns2_mem_noc }, +}; + +static struct qcom_icc_bcm bcm_sh3 = { + .name ="SH3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &acm_tcu }, +}; + +static struct qcom_icc_bcm bcm_mm3 = { + .name ="MM3" , + .keepalive = false, + .num_nodes =5 , + .nodes = { &qxm_camnoc_sf, &qxm_rot, &qxm_venus0, &qxm_venus1, &qxm_venus_arm9 }, +}; + +static struct qcom_icc_bcm bcm_sh5 = { + .name ="SH5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_apps }, +}; + +static struct qcom_icc_bcm bcm_sn0 = { + .name ="SN0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_memnoc_sf }, +}; + +static struct qcom_icc_bcm bcm_ce0 = { + .name ="CE0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_crypto }, +}; + +static struct qcom_icc_bcm bcm_cn0 = { + .name ="CN0" , + .keepalive = false, + .num_nodes =47 , + .nodes = { &qhm_spdm, + &qhm_tic, + &qnm_snoc, + &xm_qdss_dap, + &qhs_a1_noc_cfg, + &qhs_a2_noc_cfg, + &qhs_aop, + &qhs_aoss, + &qhs_camera_cfg, + &qhs_clk_ctl, + &qhs_compute_dsp_cfg, + &qhs_cpr_cx, + &qhs_crypto0_cfg, + &qhs_dcc_cfg, + &qhs_ddrss_cfg, + &qhs_display_cfg, + &qhs_glm, + &qhs_gpuss_cfg, + &qhs_imem_cfg, + &qhs_ipa, + &qhs_mnoc_cfg, + &qhs_pcie0_cfg, + &qhs_pcie_gen3_cfg, + &qhs_pdm, + &qhs_phy_refgen_south, + &qhs_pimem_cfg, + &qhs_prng, + &qhs_qdss_cfg, + &qhs_qupv3_north, + &qhs_qupv3_south, + &qhs_sdc2, + &qhs_sdc4, + &qhs_snoc_cfg, + &qhs_spdm, + &qhs_spss_cfg, + &qhs_tcsr, + &qhs_tlmm_north, + &qhs_tlmm_south, + &qhs_tsif, + &qhs_ufs_card_cfg, + &qhs_ufs_mem_cfg, + &qhs_usb3_0, + &qhs_usb3_1, + &qhs_venus_cfg, + &qhs_vsense_ctrl_cfg, + &qns_cnoc_a2noc, + &srvc_cnoc + }, +}; + +static struct qcom_icc_bcm bcm_qup0 = { + .name ="QUP0" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qhm_qup1, &qhm_qup2 }, +}; + +static struct qcom_icc_bcm bcm_sn1 = { + .name ="SN1" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_imem }, +}; + +static struct qcom_icc_bcm bcm_sn2 = { + .name ="SN2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_memnoc_gc }, +}; + +static struct qcom_icc_bcm bcm_sn3 = { + .name ="SN3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_cnoc }, +}; + +static struct qcom_icc_bcm bcm_sn4 = { + .name ="SN4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_pimem }, +}; + +static struct qcom_icc_bcm bcm_sn5 = { + .name ="SN5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xs_qdss_stm }, +}; + +static struct qcom_icc_bcm bcm_sn6 = { + .name ="SN6" , + .keepalive = false, + .num_nodes =3 , + .nodes = { &qhs_apss, &srvc_snoc, &xs_sys_tcu_cfg }, +}; + +static struct qcom_icc_bcm bcm_sn7 = { + .name ="SN7" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_pcie }, +}; + +static struct qcom_icc_bcm bcm_sn8 = { + .name ="SN8" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_pcie_gen3 }, +}; + +static struct qcom_icc_bcm bcm_sn9 = { + .name ="SN9" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &srvc_aggre1_noc, &qnm_aggre1_noc }, +}; + +static struct qcom_icc_bcm bcm_sn11 = { + .name ="SN11" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &srvc_aggre2_noc, &qnm_aggre2_noc }, +}; + +static struct qcom_icc_bcm bcm_sn12 = { + .name ="SN12" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qnm_gladiator_sodv, &xm_gic }, +}; + +static struct qcom_icc_bcm bcm_sn14 = { + .name ="SN14" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_pcie_anoc }, +}; + +static struct qcom_icc_bcm bcm_sn15 = { + .name ="SN15" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_memnoc }, +};static struct qcom_icc_bcm *const aggre1_noc_bcms[] = { &bcm_sn9,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 283/379 interconnect: qcom: sdm845: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit f8fe97a9fd2098de0570387029065eef657d50ee ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sdm845.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sdm845.c +1 -0
@@ -148,6 +148,7 @@ DEFINE_QNODE(xs_sys_tcu_cfg, SDM845_SLAVE_TCU, 1, 8);static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .keepalive = false, .num_nodes =1 , .nodes = { &ebi },
Signature · 1 line
2.42.0