kconfig: merge_config: use an empty file as initfile
Subsystems (59)
Sasha Levin
maintainerPATCH 162/212 kunit: tool: Use qboot on QEMU x86_64
In reply to Sasha LevinFrom: Brendan Jackman <[email protected]>
[ Upstream commit 08fafac4c9f289a9d9a22d838921e4b3eb22c664 ]
As noted in [0], SeaBIOS (QEMU default) makes a mess of the terminal, qboot does not.
It turns out this is actually useful with kunit.py, since the user is exposed to this issue if they set --raw_output=all.
qboot is also faster than SeaBIOS, but it's is marginal for this usecase.
[0] https://lore.kernel.org/all/CA+i-1C0wYb-gZ8Mwh3WSVpbk-LF-Uo+njVbASJPe1WXDURoV7A@mail.gmail.com/
Both SeaBIOS and qboot are x86-specific.
--- tools/testing/kunit/qemu_configs/x86_64.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/kunit/qemu_configs/x86_64.py +3 -1
@@ -7,4 +7,6 @@ CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='x86_64', kernel_path='arch/x86/boot/bzImage', kernel_command_line='console=ttyS0', - extra_qemu_params=[]) + # qboot is faster than SeaBIOS and doesn't mess up + # the terminal. + extra_qemu_params=['-bios', 'qboot.rom'])
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 163/212 kernfs: Don't re-lock kernfs_root::kernfs_rwsem in kernfs_fop_readdir().
In reply to Sasha LevinFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 9aab10a0249eab4ec77c6a5e4f66442610c12a09 ]
The readdir operation iterates over all entries and invokes dir_emit() for every entry passing kernfs_node::name as argument.
Since the name argument can change, and become invalid, the kernfs_root::kernfs_rwsem lock should not be dropped to prevent renames during the operation.
The lock drop around dir_emit() has been initially introduced in commit
1e5289c97bba2 ("sysfs: Cache the last sysfs_dirent to improve readdir scalability v2")
to avoid holding a global lock during a page fault. The lock drop is wrong since the support of renames and not a big burden since the lock is no longer global.
Don't re-acquire kernfs_root::kernfs_rwsem while copying the name to the userpace buffer.
--- fs/kernfs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/kernfs/dir.c +3 -3
@@ -1846,10 +1846,10 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx) file->private_data = pos;kernfs_get (pos); -up_read (&root->kernfs_rwsem); -if (!dir_emit (ctx, name, len, ino, type)) +if (!dir_emit (ctx, name, len, ino, type)) { +up_read (&root->kernfs_rwsem);return 0 ; -down_read (&root->kernfs_rwsem); + } }up_read (&root->kernfs_rwsem); file->private_data =NULL ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 164/212 kernfs: Acquire kernfs_rwsem in kernfs_get_parent_dentry().
In reply to Sasha LevinFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 122ab92dee80582c39740609a627198dd5b6b595 ]
kernfs_get_parent_dentry() passes kernfs_node::parent to kernfs_get_inode().
Acquire kernfs_root::kernfs_rwsem to ensure kernfs_node::parent isn't replaced during the operation.
--- fs/kernfs/mount.c | 2 ++ 1 file changed, 2 insertions(+)
fs/kernfs/mount.c +2 -0
@@ -138,7 +138,9 @@ static struct dentry *kernfs_fh_to_parent(struct super_block *sb,static struct dentry *kernfs_get_parent_dentry (struct dentry *child) {struct kernfs_node *kn =kernfs_dentry_node (child); +struct kernfs_root *root =kernfs_root (kn); +guard (rwsem_read)(&root->kernfs_rwsem);return d_obtain_alias (kernfs_get_inode (child->d_sb, kn->parent)); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 165/212 libbpf: fix LDX/STX/ST CO-RE relocation size adjustment logic
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 06096d19ee3897a7e70922580159607fe315da7a ]
Libbpf has a somewhat obscure feature of automatically adjusting the "size" of LDX/STX/ST instruction (memory store and load instructions), based on originally recorded access size (u8, u16, u32, or u64) and the actual size of the field on target kernel. This is meant to facilitate using BPF CO-RE on 32-bit architectures (pointers are always 64-bit in BPF, but host kernel's BTF will have it as 32-bit type), as well as generally supporting safe type changes (unsigned integer type changes can be transparently "relocated").
One issue that surfaced only now, 5 years after this logic was implemented, is how this all works when dealing with fields that are arrays. This isn't all that easy and straightforward to hit (see selftests that reproduce this condition), but one of sched_ext BPF programs did hit it with innocent looking loop.
Long story short, libbpf used to calculate entire array size, instead of making sure to only calculate array's element size. But it's the element that is loaded by LDX/STX/ST instructions (1, 2, 4, or 8 bytes), so that's what libbpf should check. This patch adjusts the logic for arrays and fixed the issue.
--- tools/lib/bpf/relo_core.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
tools/lib/bpf/relo_core.c +20 -4
@@ -683,7 +683,7 @@ static int bpf_core_calc_field_relo(const char *prog_name, {const struct bpf_core_accessor *acc;const struct btf_type *t; -__u32 byte_off, byte_sz, bit_off, bit_sz, field_type_id; +__u32 byte_off, byte_sz, bit_off, bit_sz, field_type_id, elem_id;const struct btf_member *m;const struct btf_type *mt;bool bitfield;
@@ -706,8 +706,14 @@ static int bpf_core_calc_field_relo(const char *prog_name,if (!acc->name) {if (relo->kind ==BPF_CORE_FIELD_BYTE_OFFSET ) { *val = spec->bit_offset /8 ; -/* remember field size for load/store mem size */ - sz =btf__resolve_size (spec->btf, acc->type_id); +/* remember field size for load/store mem size; +* note, for arrays we care about individual element +* sizes, not the overall array size +*/ + t =skip_mods_and_typedefs (spec->btf, acc->type_id, &elem_id); +while (btf_is_array (t)) + t =skip_mods_and_typedefs (spec->btf,btf_array (t)->type, &elem_id); + sz =btf__resolve_size (spec->btf, elem_id);if (sz <0 )return -EINVAL ; *field_sz = sz;
@@ -767,7 +773,17 @@ static int bpf_core_calc_field_relo(const char *prog_name,case BPF_CORE_FIELD_BYTE_OFFSET : *val = byte_off;if (!bitfield) { - *field_sz = byte_sz; +/* remember field size for load/store mem size; +* note, for arrays we care about individual element +* sizes, not the overall array size +*/ + t =skip_mods_and_typedefs (spec->btf, field_type_id, &elem_id); +while (btf_is_array (t)) + t =skip_mods_and_typedefs (spec->btf,btf_array (t)->type, &elem_id); + sz =btf__resolve_size (spec->btf, elem_id); +if (sz <0 ) +return -EINVAL ; + *field_sz = sz; *type_id = field_type_id; }break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 166/212 net/mlx4_core: Avoid impossible mlx4_db_alloc() order value
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 4a6f18f28627e121bd1f74b5fcc9f945d6dbeb1e ]
GCC can see that the value range for "order" is capped, but this leads it to consider that it might be negative, leading to a false positive warning (with GCC 15 with -Warray-bounds -fdiagnostics-details):
../drivers/net/ethernet/mellanox/mlx4/alloc.c:691:47: error: array subscript -1 is below array bounds of 'long unsigned int *[2]' [-Werror=array-bounds=]
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o);
| ~~~~~~~~~~~^~~
'mlx4_alloc_db_from_pgdir': events 1-2
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | | | (2) out of array bounds here
| (1) when the condition is evaluated to true In file included from ../drivers/net/ethernet/mellanox/mlx4/mlx4.h:53,
from ../drivers/net/ethernet/mellanox/mlx4/alloc.c:42:../include/linux/mlx4/device.h:664:33: note: while referencing 'bits'
664 | unsigned long *bits[2];
| ^~~~
Switch the argument to unsigned int, which removes the compiler needing to consider negative values.
--- drivers/net/ethernet/mellanox/mlx4/alloc.c | 6 +++--- include/linux/mlx4/device.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/alloc.c +3 -3
@@ -682,9 +682,9 @@ static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device) }static int mlx4_alloc_db_from_pgdir (struct mlx4_db_pgdir *pgdir, -struct mlx4_db *db,int order) +struct mlx4_db *db,unsigned int order) { -int o; +unsigned int o;int i;for (o = order; o <=1 ; ++o) {
@@ -712,7 +712,7 @@ static int mlx4_alloc_db_from_pgdir(struct mlx4_db_pgdir *pgdir,return 0 ; } -int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,int order) +int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,unsigned int order) {struct mlx4_priv *priv =mlx4_priv (dev);struct mlx4_db_pgdir *pgdir;
include/linux/mlx4/device.h +1 -1
@@ -1115,7 +1115,7 @@ int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,int mlx4_buf_write_mtt (struct mlx4_dev *dev,struct mlx4_mtt *mtt,struct mlx4_buf *buf); -int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,int order); +int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,unsigned int order);void mlx4_db_free (struct mlx4_dev *dev,struct mlx4_db *db); int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 167/212 clk: qcom: clk-alpha-pll: Do not use random stack value for recalc rate
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7a243e1b814a02ab40793026ef64223155d86395 ]
If regmap_read() fails, random stack value was used in calculating new frequency in recalc_rate() callbacks. Such failure is really not expected as these are all MMIO reads, however code should be here correct and bail out. This also avoids possible warning on uninitialized value.
--- drivers/clk/qcom/clk-alpha-pll.c | 52 ++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 16 deletions(-)
drivers/clk/qcom/clk-alpha-pll.c +36 -16
@@ -561,14 +561,19 @@ clk_alpha_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 alpha_width =pll_alpha_width (pll); -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl)) +return 0 ; -regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl);if (ctl &PLL_ALPHA_EN ) { -regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &low); +if (regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &low)) +return 0 ;if (alpha_width >32 ) { -regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL_U (pll), - &high); +if (regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL_U (pll), + &high)) +return 0 ; a = (u64 )high <<32 | low; }else { a = low &GENMASK (alpha_width -1 ,0 );
@@ -760,8 +765,11 @@ alpha_pll_huayra_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l, alpha =0 , ctl, alpha_m, alpha_n; -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); -regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl)) +return 0 ;if (ctl &PLL_ALPHA_EN ) {regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &alpha);
@@ -955,8 +963,11 @@ clk_trion_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l, frac, alpha_width =pll_alpha_width (pll); -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); -regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &frac); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_ALPHA_VAL (pll), &frac)) +return 0 ;return alpha_pll_calc_rate (parent_rate, l, frac, alpha_width); }
@@ -1014,7 +1025,8 @@ clk_alpha_pll_postdiv_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct clk_alpha_pll_postdiv *pll =to_clk_alpha_pll_postdiv (hw);u32 ctl; -regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl); +if (regmap_read (pll->clkr.regmap,PLL_USER_CTL (pll), &ctl)) +return 0 ; ctl >>=PLL_POST_DIV_SHIFT ; ctl &=PLL_POST_DIV_MASK (pll);
@@ -1230,8 +1242,11 @@ static unsigned long alpha_pll_fabia_recalc_rate(struct clk_hw *hw,struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l, frac, alpha_width =pll_alpha_width (pll); -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); -regmap_read (pll->clkr.regmap,PLL_FRAC (pll), &frac); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ; + +if (regmap_read (pll->clkr.regmap,PLL_FRAC (pll), &frac)) +return 0 ;return alpha_pll_calc_rate (parent_rate, l, frac, alpha_width); }
@@ -1381,7 +1396,8 @@ clk_trion_pll_postdiv_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)struct regmap *regmap = pll->clkr.regmap;u32 i, div =1 , val; -regmap_read (regmap,PLL_USER_CTL (pll), &val); +if (regmap_read (regmap,PLL_USER_CTL (pll), &val)) +return 0 ; val >>= pll->post_div_shift; val &=PLL_POST_DIV_MASK (pll);
@@ -2254,9 +2270,12 @@ static unsigned long alpha_pll_lucid_evo_recalc_rate(struct clk_hw *hw,struct regmap *regmap = pll->clkr.regmap;u32 l, frac; -regmap_read (regmap,PLL_L_VAL (pll), &l); +if (regmap_read (regmap,PLL_L_VAL (pll), &l)) +return 0 ; l &=LUCID_EVO_PLL_L_VAL_MASK ; -regmap_read (regmap,PLL_ALPHA_VAL (pll), &frac); + +if (regmap_read (regmap,PLL_ALPHA_VAL (pll), &frac)) +return 0 ;return alpha_pll_calc_rate (parent_rate, l, frac,pll_alpha_width (pll)); }
@@ -2331,7 +2350,8 @@ static unsigned long clk_rivian_evo_pll_recalc_rate(struct clk_hw *hw,struct clk_alpha_pll *pll =to_clk_alpha_pll (hw);u32 l; -regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l); +if (regmap_read (pll->clkr.regmap,PLL_L_VAL (pll), &l)) +return 0 ;return parent_rate * l; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 168/212 serial: sh-sci: Update the suspend/resume support
In reply to Sasha LevinFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 22a6984c5b5df8eab864d7f3e8b94d5a554d31ab ]
The Renesas RZ/G3S supports a power saving mode where power to most of the SoC components is turned off. When returning from this power saving mode, SoC components need to be re-configured.
The SCIFs on the Renesas RZ/G3S need to be re-configured as well when returning from this power saving mode. The sh-sci code already configures the SCIF clocks, power domain and registers by calling uart_resume_port() in sci_resume(). On suspend path the SCIF UART ports are suspended accordingly (by calling uart_suspend_port() in sci_suspend()). The only missing setting is the reset signal. For this assert/de-assert the reset signal on driver suspend/resume.
In case the no_console_suspend is specified by the user, the registers need to be saved on suspend path and restore on resume path. To do this the sci_console_save()/sci_console_restore() functions were added. There is no need to cache/restore the status or FIFO registers. Only the control registers. The registers that will be saved/restored on suspend/resume are specified by the struct sci_suspend_regs data structure.
--- drivers/tty/serial/sh-sci.c | 71 +++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-)
drivers/tty/serial/sh-sci.c +69 -2
@@ -105,6 +105,15 @@ struct plat_sci_reg {u8 offset, size; }; +struct sci_suspend_regs { +u16 scsmr; +u16 scscr; +u16 scfcr; +u16 scsptr; +u8 scbrr; +u8 semr; +}; +struct sci_port_params {const struct plat_sci_reg regs[SCIx_NR_REGS];unsigned int fifosize;
@@ -135,6 +144,8 @@ struct sci_port {struct dma_chan *chan_tx;struct dma_chan *chan_rx; +struct reset_control *rstc; +#ifdef CONFIG_SERIAL_SH_SCI_DMA struct dma_chan *chan_tx_saved;struct dma_chan *chan_rx_saved;
@@ -154,6 +165,7 @@ struct sci_port {int rx_trigger;struct timer_list rx_fifo_timer;int rx_fifo_timeout; +struct sci_suspend_regs suspend_regs;u16 hscif_tot;bool has_rtscts;
@@ -3252,6 +3264,7 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev, } sp = &sci_ports[id]; + sp->rstc = rstc; *dev_id = id; p->type =SCI_OF_TYPE (data);
@@ -3400,13 +3413,57 @@ static int sci_probe(struct platform_device *dev)return 0 ; } +static void sci_console_save (struct sci_port *s) +{ +struct sci_suspend_regs *regs = &s->suspend_regs; +struct uart_port *port = &s->port; + +if (sci_getreg (port,SCSMR )->size) + regs->scsmr =sci_serial_in (port,SCSMR ); +if (sci_getreg (port,SCSCR )->size) + regs->scscr =sci_serial_in (port,SCSCR ); +if (sci_getreg (port,SCFCR )->size) + regs->scfcr =sci_serial_in (port,SCFCR ); +if (sci_getreg (port,SCSPTR )->size) + regs->scsptr =sci_serial_in (port,SCSPTR ); +if (sci_getreg (port,SCBRR )->size) + regs->scbrr =sci_serial_in (port,SCBRR ); +if (sci_getreg (port,SEMR )->size) + regs->semr =sci_serial_in (port,SEMR ); +} + +static void sci_console_restore (struct sci_port *s) +{ +struct sci_suspend_regs *regs = &s->suspend_regs; +struct uart_port *port = &s->port; + +if (sci_getreg (port,SCSMR )->size) +sci_serial_out (port,SCSMR , regs->scsmr); +if (sci_getreg (port,SCSCR )->size) +sci_serial_out (port,SCSCR , regs->scscr); +if (sci_getreg (port,SCFCR )->size) +sci_serial_out (port,SCFCR , regs->scfcr); +if (sci_getreg (port,SCSPTR )->size) +sci_serial_out (port,SCSPTR , regs->scsptr); +if (sci_getreg (port,SCBRR )->size) +sci_serial_out (port,SCBRR , regs->scbrr); +if (sci_getreg (port,SEMR )->size) +sci_serial_out (port,SEMR , regs->semr); +} +static __maybe_unused int sci_suspend (struct device *dev) {struct sci_port *sport =dev_get_drvdata (dev); -if (sport) +if (sport) {uart_suspend_port (&sci_uart_driver, &sport->port); +if (!console_suspend_enabled &&uart_console (&sport->port)) +sci_console_save (sport); +else +return reset_control_assert (sport->rstc); + } +return 0 ; }
@@ -3414,8 +3471,18 @@ static __maybe_unused int sci_resume(struct device *dev) {struct sci_port *sport =dev_get_drvdata (dev); -if (sport) +if (sport) { +if (!console_suspend_enabled &&uart_console (&sport->port)) { +sci_console_restore (sport); + }else { +int ret =reset_control_deassert (sport->rstc); + +if (ret) +return ret; + } +uart_resume_port (&sci_uart_driver, &sport->port); + }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 169/212 phy: core: don't require set_mode() callback for phy_get_mode() to work
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d58c04e305afbaa9dda7969151f06c4efe2c98b0 ]
As reported by Damon Ding, the phy_get_mode() call doesn't work as expected unless the PHY driver has a .set_mode() call. This prompts PHY drivers to have empty stubs for .set_mode() for the sake of being able to get the mode.
Make .set_mode() callback truly optional and update PHY's mode even if it there is none.
--- drivers/phy/phy-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/phy/phy-core.c +4 -3
@@ -398,13 +398,14 @@ EXPORT_SYMBOL_GPL(phy_power_off);int phy_set_mode_ext (struct phy *phy,enum phy_mode mode,int submode) { -int ret; +int ret =0 ; -if (!phy || !phy->ops->set_mode) +if (!phy)return 0 ;mutex_lock (&phy->mutex); - ret = phy->ops->set_mode (phy, mode, submode); +if (phy->ops->set_mode) + ret = phy->ops->set_mode (phy, mode, submode);if (!ret) phy->attrs.mode = mode;mutex_unlock (&phy->mutex);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 170/212 drm/amdgpu: reset psp->cmd to NULL after releasing the buffer
In reply to Sasha LevinFrom: Jiang Liu <[email protected]>
[ Upstream commit e92f3f94cad24154fd3baae30c6dfb918492278d ]
Reset psp->cmd to NULL after releasing the buffer in function psp_sw_fini().
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -3
@@ -484,7 +484,6 @@ static int psp_sw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct psp_context *psp = &adev->psp; -struct psp_gfx_cmd_resp *cmd = psp->cmd;psp_memory_training_fini (psp);if (psp->sos_fw) {
@@ -511,8 +510,8 @@ static int psp_sw_fini(void *handle) adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))psp_sysfs_fini (adev); -kfree (cmd); - cmd =NULL ; +kfree (psp->cmd); + psp->cmd =NULL ;psp_free_shared_bufs (psp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 171/212 drm/amd/display: Initial psr_version with correct setting
In reply to Sasha LevinFrom: Tom Chung <[email protected]>
[ Upstream commit d8c782cac5007e68e7484d420168f12d3490def6 ]
[Why & How]
The initial setting for psr_version is not correct while create a virtual link.
The default psr_version should be DC_PSR_VERSION_UNSUPPORTED.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -0
@@ -267,6 +267,7 @@ static bool create_links( link->link_id.type =OBJECT_TYPE_CONNECTOR ; link->link_id.id =CONNECTOR_ID_VIRTUAL ; link->link_id.enum_id =ENUM_ID_1 ; + link->psr_settings.psr_version =DC_PSR_VERSION_UNSUPPORTED ; link->link_enc =kzalloc (sizeof (*link->link_enc),GFP_KERNEL );if (!link->link_enc) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 172/212 drm/amdgpu: enlarge the VBIOS binary size limit
In reply to Sasha LevinFrom: Shiwu Zhang <[email protected]>
[ Upstream commit 667b96134c9e206aebe40985650bf478935cbe04 ]
Some chips have a larger VBIOS file so raise the size limit to support the flashing tool.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
@@ -43,7 +43,7 @@#include "amdgpu_securedisplay.h" #include "amdgpu_atomfirmware.h" -#define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*3) +#define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*16)static int psp_sysfs_init (struct amdgpu_device *adev);static void psp_sysfs_fini (struct amdgpu_device *adev);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 173/212 drm/amd/display/dm: drop hw_support check in amdgpu_dm_i2c_xfer()
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 33da70bd1e115d7d73f45fb1c09f5ecc448f3f13 ]
DC supports SW i2c as well. Drop the check.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -7281,7 +7281,7 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,int i;int result = -EIO ; -if (!ddc_service->ddc_pin || !ddc_service->ddc_pin->hw_info.hw_supported) +if (!ddc_service->ddc_pin)return result; cmd.payloads =kcalloc (num,sizeof (struct i2c_payload ),GFP_KERNEL );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 174/212 net/mlx5: Extend Ethtool loopback selftest to support non-linear SKB
In reply to Sasha LevinFrom: Alexei Lazar <[email protected]>
[ Upstream commit 95b9606b15bb3ce1198d28d2393dd0e1f0a5f3e9 ]
Current loopback test validation ignores non-linear SKB case in the SKB access, which can lead to failures in scenarios such as when HW GRO is enabled.
Linearize the SKB so both cases will be handled.
--- drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +3 -0
@@ -165,6 +165,9 @@ mlx5e_test_loopback_validate(struct sk_buff *skb,struct udphdr *udph;struct iphdr *iph; +if (skb_linearize (skb)) + goto out; +/* We are only going to peek, no need to clone the SKB */ if (MLX5E_TEST_PKT_SIZE -ETH_HLEN >skb_headlen (skb)) goto out;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 175/212 net/mlx5e: set the tx_queue_len for pfifo_fast
In reply to Sasha LevinFrom: William Tu <[email protected]>
[ Upstream commit a38cc5706fb9f7dc4ee3a443f61de13ce1e410ed ]
By default, the mq netdev creates a pfifo_fast qdisc. On a system with 16 core, the pfifo_fast with 3 bands consumes 16 * 3 * 8 (size of pointer) * 1024 (default tx queue len) = 393KB. The patch sets the tx qlen to representor default value, 128 (1<<MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE), which consumes 16 * 3 * 8 * 128 = 49KB, saving 344KB for each representor at ECPF.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 -0
@@ -726,6 +726,8 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; netdev->watchdog_timeo =15 *HZ ; +if (mlx5_core_is_ecpf (mdev)) + netdev->tx_queue_len =1 <<MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE ;#if IS_ENABLED (CONFIG_MLX5_CLS_ACT ) netdev->hw_features |=NETIF_F_HW_TC ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 176/212 net/mlx5e: reduce rep rxq depth to 256 for ECPF
In reply to Sasha LevinFrom: William Tu <[email protected]>
[ Upstream commit b9cc8f9d700867aaa77aedddfea85e53d5e5d584 ]
By experiments, a single queue representor netdev consumes kernel memory around 2.8MB, and 1.8MB out of the 2.8MB is due to page pool for the RXQ. Scaling to a thousand representors consumes 2.8GB, which becomes a memory pressure issue for embedded devices such as BlueField-2 16GB / BlueField-3 32GB memory.
Since representor netdevs mostly handles miss traffic, and ideally, most of the traffic will be offloaded, reduce the default non-uplink rep netdev's RXQ default depth from 1024 to 256 if mdev is ecpf eswitch manager. This saves around 1MB of memory per regular RQ, (1024 - 256) * 2KB, allocated from page pool.
With rxq depth of 256, the netlink page pool tool reports $./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump page-pool-get
{'id': 277,
'ifindex': 9,
'inflight': 128,
'inflight-mem': 786432,
'napi-id': 775}]
This is due to mtu 1500 + headroom consumes half pages, so 256 rxq entries consumes around 128 pages (thus create a page pool with size 128), shown above at inflight.
Note that each netdev has multiple types of RQs, including Regular RQ, XSK, PTP, Drop, Trap RQ. Since non-uplink representor only supports regular rq, this patch only changes the regular RQ's default depth.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -0
@@ -61,6 +61,7 @@#define MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE \ max(0x7, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)#define MLX5E_REP_PARAMS_DEF_NUM_CHANNELS 1 +#define MLX5E_REP_PARAMS_DEF_LOG_RQ_SIZE 0x8static const char mlx5e_rep_driver_name[] ="mlx5e_rep" ;
@@ -705,6 +706,8 @@ static void mlx5e_build_rep_params(struct net_device *netdev)/* RQ */ mlx5e_build_rq_params (mdev, params); +if (!mlx5e_is_uplink_rep (priv) &&mlx5_core_is_ecpf (mdev)) + params->log_rq_mtu_frames =MLX5E_REP_PARAMS_DEF_LOG_RQ_SIZE ;/* CQ moderation params */ params->rx_dim_enabled =MLX5_CAP_GEN (mdev, cq_moderation);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 177/212 wifi: mac80211: don't unconditionally call drv_mgd_complete_tx()
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 1798271b3604b902d45033ec569f2bf77e94ecc2 ]
We might not have called drv_mgd_prepare_tx(), so only call drv_mgd_complete_tx() under the same conditions.
--- net/mac80211/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +2 -1
@@ -2896,7 +2896,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,if (tx)ieee80211_flush_queues (local, sdata, false); -drv_mgd_complete_tx (sdata->local, sdata, &info); +if (tx || frame_buf) +drv_mgd_complete_tx (sdata->local, sdata, &info);/* clear AP addr only after building the needed mgmt frames */ eth_zero_addr (sdata->deflink.u.mgd.bssid);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 178/212 wifi: mac80211: remove misplaced drv_mgd_complete_tx() call
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit f4995cdc4d02d0abc8e9fcccad5c71ce676c1e3f ]
In the original commit 15fae3410f1d ("mac80211: notify driver on mgd TX completion") I evidently made a mistake and placed the call in the "associated" if, rather than the "assoc_data". Later I noticed the missing call and placed it in commit c042600c17d8 ("wifi: mac80211: adding missing drv_mgd_complete_tx() call"), but didn't remove the wrong one. Remove it now.
--- net/mac80211/mlme.c | 1 - 1 file changed, 1 deletion(-)
net/mac80211/mlme.c +0 -1
@@ -7312,7 +7312,6 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,ieee80211_report_disconnect (sdata, frame_buf,sizeof (frame_buf), true, req->reason_code, false); -drv_mgd_complete_tx (sdata->local, sdata, &info);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 179/212 arch/powerpc/perf: Check the instruction type before creating sample with perf_mem_data_src
In reply to Sasha LevinFrom: Athira Rajeev <[email protected]>
[ Upstream commit 2ffb26afa64261139e608bf087a0c1fe24d76d4d ]
perf mem report aborts as below sometimes (during some corner case) in powerpc:
# ./perf mem report 1>out *** stack smashing detected ***: terminated Aborted (core dumped)
The backtrace is as below:
__pthread_kill_implementation ()
raise ()
abort ()
__libc_message
__fortify_fail
__stack_chk_fail
hist_entry.lvl_snprintf
__sort__hpp_entry
__hist_entry__snprintf
hists.fprintf
cmd_report
cmd_mem
Snippet of code which triggers the issue
from tools/perf/util/sort.c
static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
char out[64]; perf_mem__lvl_scnprintf(out, sizeof(out), he->mem_info);
return repsep_snprintf(bf, size, "%-*s", width, out);}
The value of "out" is filled from perf_mem_data_src value. Debugging this further showed that for some corner cases, the value of "data_src" was pointing to wrong value. This resulted in bigger size of string and causing stack check fail.
The perf mem data source values are captured in the sample via isa207_get_mem_data_src function. The initial check is to fetch the type of sampled instruction. If the type of instruction is not valid (not a load/store instruction), the function returns.
Since 'commit e16fd7f2cb1a ("perf: Use sample_flags for data_src")', data_src field is not initialized by the perf_sample_data_init() function. If the PMU driver doesn't set the data_src value to zero if type is not valid, this will result in uninitailised value for data_src. The uninitailised value of data_src resulted in stack check fail followed by abort for "perf mem report".
When requesting for data source information in the sample, the instruction type is expected to be load or store instruction. In ISA v3.0, due to hardware limitation, there are corner cases where the instruction type other than load or store is observed. In ISA v3.0 and before values "0" and "7" are considered reserved. In ISA v3.1, value "7" has been used to indicate "larx/stcx". Drop the sample if instruction type has reserved values for this field with a ISA version check. Initialize data_src to zero in isa207_get_mem_data_src if the instruction type is not load/store.
--- arch/powerpc/perf/core-book3s.c | 20 ++++++++++++++++++++ arch/powerpc/perf/isa207-common.c | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +20 -0
@@ -2229,6 +2229,10 @@ static struct pmu power_pmu = {#define PERF_SAMPLE_ADDR_TYPE (PERF_SAMPLE_ADDR | \ PERF_SAMPLE_PHYS_ADDR | \ PERF_SAMPLE_DATA_PAGE_SIZE) + +#define SIER_TYPE_SHIFT 15 +#define SIER_TYPE_MASK (0x7ull << SIER_TYPE_SHIFT) +/* * A counter has overflowed; update its count and record * things if requested. Note that interrupts are hard-disabled
@@ -2297,6 +2301,22 @@ static void record_and_restart(struct perf_event *event, unsigned long val, is_kernel_addr(mfspr(SPRN_SIAR))) record =0 ; +/* +* SIER[46-48] presents instruction type of the sampled instruction. +* In ISA v3.0 and before values "0" and "7" are considered reserved. +* In ISA v3.1, value "7" has been used to indicate "larx/stcx". +* Drop the sample if "type" has reserved values for this field with a +* ISA version check. +*/ +if (event->attr.sample_type &PERF_SAMPLE_DATA_SRC && + ppmu->get_mem_data_src) { + val = (regs->dar &SIER_TYPE_MASK ) >>SIER_TYPE_SHIFT ; +if (val ==0 || (val ==7 && !cpu_has_feature (CPU_FTR_ARCH_31 ))) { + record =0 ; +atomic64_inc (&event->lost_samples); + } + } +/* * Finally record data if requested. */
arch/powerpc/perf/isa207-common.c +3 -1
@@ -321,8 +321,10 @@ void isa207_get_mem_data_src(union perf_mem_data_src *dsrc, u32 flags, sier =mfspr (SPRN_SIER ); val = (sier &ISA207_SIER_TYPE_MASK ) >>ISA207_SIER_TYPE_SHIFT ; -if (val !=1 && val !=2 && !(val ==7 &&cpu_has_feature (CPU_FTR_ARCH_31 ))) +if (val !=1 && val !=2 && !(val ==7 &&cpu_has_feature (CPU_FTR_ARCH_31 ))) { + dsrc->val =0 ;return ; + } idx = (sier &ISA207_SIER_LDST_MASK ) >>ISA207_SIER_LDST_SHIFT ; sub_idx = (sier &ISA207_SIER_DATA_SRC_MASK ) >>ISA207_SIER_DATA_SRC_SHIFT ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 180/212 ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure().
In reply to Sasha LevinFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d ]
The following patch will not set skb->sk from VRF path.
Let's fetch net from fib_rule->fr_net instead of sock_net(skb->sk) in fib[46]_rule_configure().
--- net/ipv4/fib_rules.c | 4 ++-- net/ipv6/fib6_rules.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/fib_rules.c +2 -2
@@ -222,9 +222,9 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { - struct net *net = sock_net(skb->sk); + struct fib4_rule *rule4 = (struct fib4_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct fib4_rule *rule4 = (struct fib4_rule *) rule;if (!inet_validate_dscp (frh->tos)) { NL_SET_ERR_MSG(extack,
net/ipv6/fib6_rules.c +2 -2
@@ -350,9 +350,9 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { + struct fib6_rule *rule6 = (struct fib6_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct net *net =sock_net (skb->sk); -struct fib6_rule *rule6 = (struct fib6_rule *) rule;if (!inet_validate_dscp (frh->tos)) { NL_SET_ERR_MSG(extack,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 181/212 r8152: add vendor/device ID pair for Dell Alienware AW1022z
In reply to Sasha LevinFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 848b09d53d923b4caee5491f57a5c5b22d81febc ]
The Dell AW1022z is an RTL8156B based 2.5G Ethernet controller.
Add the vendor and product ID values to the driver. This makes Ethernet work with the adapter.
--- drivers/net/usb/r8152.c | 1 + include/linux/usb/r8152.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/usb/r8152.c +1 -0
@@ -9880,6 +9880,7 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) }, { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) }, + { USB_DEVICE(VENDOR_ID_DELL, 0xb097) }, { USB_DEVICE(VENDOR_ID_ASUS, 0x1976) }, {} };
include/linux/usb/r8152.h +1 -0
@@ -30,6 +30,7 @@#define VENDOR_ID_NVIDIA 0x0955#define VENDOR_ID_TPLINK 0x2357#define VENDOR_ID_DLINK 0x2001 +#define VENDOR_ID_DELL 0x413c#define VENDOR_ID_ASUS 0x0b05#if IS_REACHABLE (CONFIG_USB_RTL8152 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 182/212 wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 9e8243025cc06abc975c876dffda052073207ab3 ]
After the firmware is uploaded, download_firmware_validate() checks some bits in REG_MCUFW_CTRL to see if everything went okay. The RTL8814AU power on sequence sets bits 13 and 12 to 2, which this function does not expect, so it thinks the firmware upload failed.
Make download_firmware_validate() ignore bits 13 and 12.
--- drivers/net/wireless/realtek/rtw88/reg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/reg.h +2 -1
@@ -107,6 +107,7 @@#define BIT_SHIFT_ROM_PGE 16#define BIT_FW_INIT_RDY BIT(15)#define BIT_FW_DW_RDY BIT(14) +#define BIT_CPU_CLK_SEL (BIT(12) | BIT(13))#define BIT_RPWM_TOGGLE BIT(7)#define BIT_RAM_DL_SEL BIT(7)/* legacy only */ #define BIT_DMEM_CHKSUM_OK BIT(6)
@@ -124,7 +125,7 @@ BIT_CHECK_SUM_OK)#define FW_READY_LEGACY (BIT_MCUFWDL_RDY | BIT_FWDL_CHK_RPT | \ BIT_WINTINI_RDY | BIT_RAM_DL_SEL) -#define FW_READY_MASK 0xffff +#define FW_READY_MASK (0xffff & ~BIT_CPU_CLK_SEL)#define REG_MCU_TST_CFG 0x84#define VAL_FW_TRIGGER 0x1
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 183/212 clk: qcom: camcc-sm8250: Use clk_rcg2_shared_ops for some RCGs
In reply to Sasha LevinFrom: Jordan Crouse <[email protected]>
[ Upstream commit 52b10b591f83dc6d9a1d6c2dc89433470a787ecd ]
Update some RCGs on the sm8250 camera clock controller to use clk_rcg2_shared_ops. The shared_ops ensure the RCGs get parked to the XO during clock disable to prevent the clocks from locking up when the GDSC is enabled. These mirror similar fixes for other controllers such as commit e5c359f70e4b ("clk: qcom: camcc: Update the clock ops for the SC7180").
--- drivers/clk/qcom/camcc-sm8250.c | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/clk/qcom/camcc-sm8250.c +28 -28
@@ -411,7 +411,7 @@ static struct clk_rcg2 cam_cc_bps_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -433,7 +433,7 @@ static struct clk_rcg2 cam_cc_camnoc_axi_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -454,7 +454,7 @@ static struct clk_rcg2 cam_cc_cci_0_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -469,7 +469,7 @@ static struct clk_rcg2 cam_cc_cci_1_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -490,7 +490,7 @@ static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -511,7 +511,7 @@ static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -526,7 +526,7 @@ static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -556,7 +556,7 @@ static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -571,7 +571,7 @@ static struct clk_rcg2 cam_cc_csi4phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -586,7 +586,7 @@ static struct clk_rcg2 cam_cc_csi5phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -611,7 +611,7 @@ static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -634,7 +634,7 @@ static struct clk_rcg2 cam_cc_fd_core_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -649,7 +649,7 @@ static struct clk_rcg2 cam_cc_icp_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -673,7 +673,7 @@ static struct clk_rcg2 cam_cc_ife_0_clk_src = { .parent_data = cam_cc_parent_data_2, .num_parents = ARRAY_SIZE(cam_cc_parent_data_2), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -710,7 +710,7 @@ static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -734,7 +734,7 @@ static struct clk_rcg2 cam_cc_ife_1_clk_src = { .parent_data = cam_cc_parent_data_3, .num_parents = ARRAY_SIZE(cam_cc_parent_data_3), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -749,7 +749,7 @@ static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -771,7 +771,7 @@ static struct clk_rcg2 cam_cc_ife_lite_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -786,7 +786,7 @@ static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -810,7 +810,7 @@ static struct clk_rcg2 cam_cc_ipe_0_clk_src = { .parent_data = cam_cc_parent_data_4, .num_parents = ARRAY_SIZE(cam_cc_parent_data_4), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -825,7 +825,7 @@ static struct clk_rcg2 cam_cc_jpeg_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -847,7 +847,7 @@ static struct clk_rcg2 cam_cc_mclk0_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -862,7 +862,7 @@ static struct clk_rcg2 cam_cc_mclk1_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -877,7 +877,7 @@ static struct clk_rcg2 cam_cc_mclk2_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -892,7 +892,7 @@ static struct clk_rcg2 cam_cc_mclk3_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -907,7 +907,7 @@ static struct clk_rcg2 cam_cc_mclk4_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -922,7 +922,7 @@ static struct clk_rcg2 cam_cc_mclk5_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -993,7 +993,7 @@ static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 184/212 exit: change the release_task() paths to call flush_sigqueue() lockless
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit fb3bbcfe344e64a46574a638b051ffd78762c12d ]
A task can block a signal, accumulate up to RLIMIT_SIGPENDING sigqueues, and exit. In this case __exit_signal()->flush_sigqueue() called with irqs disabled can trigger a hard lockup, see
https://lore.kernel.org/all/[email protected]/
Fortunately, after the recent posixtimer changes sys_timer_delete() paths no longer try to clear SIGQUEUE_PREALLOC and/or free tmr->sigq, and after the exiting task passes __exit_signal() lock_task_sighand() can't succeed and pid_task(tmr->it_pid) will return NULL.
This means that after __exit_signal(tsk) nobody can play with tsk->pending or (if group_dead) with tsk->signal->shared_pending, so release_task() can safely call flush_sigqueue() after write_unlock_irq(&tasklist_lock).
TODO:
- we can probably shift posix_cpu_timers_exit() as well
- do_sigaction() can hit the similar problem
--- kernel/exit.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
kernel/exit.c +11 -8
@@ -198,20 +198,13 @@ static void __exit_signal(struct task_struct *tsk)__unhash_process (tsk, group_dead);write_sequnlock (&sig->stats_lock); -/* -* Do this under ->siglock, we can race with another thread -* doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. -*/ -flush_sigqueue (&tsk->pending); tsk->sighand =NULL ;spin_unlock (&sighand->siglock);__cleanup_sighand (sighand);clear_tsk_thread_flag (tsk,TIF_SIGPENDING ); -if (group_dead) { -flush_sigqueue (&sig->shared_pending); +if (group_dead)tty_kref_put (tty); - } }static void delayed_put_task_struct (struct rcu_head *rhp)
@@ -281,6 +274,16 @@ void release_task(struct task_struct *p)proc_flush_pid (thread_pid);put_pid (thread_pid);release_thread (p); +/* +* This task was already removed from the process/thread/pid lists +* and lock_task_sighand(p) can't succeed. Nobody else can touch +* ->pending or, if group dead, signal->shared_pending. We can call +* flush_sigqueue() lockless. +*/ +flush_sigqueue (&p->pending); +if (thread_group_leader (p)) +flush_sigqueue (&p->signal->shared_pending); +put_task_struct_rcu_user (p); p = leader;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 185/212 hwmon: (xgene-hwmon) use appropriate type for the latency value
In reply to Sasha LevinFrom: Andrey Vatoropin <[email protected]>
[ Upstream commit 8df0f002827e18632dcd986f7546c1abf1953a6f ]
The expression PCC_NUM_RETRIES * pcc_chan->latency is currently being evaluated using 32-bit arithmetic.
Since a value of type 'u64' is used to store the eventual result, and this result is later sent to the function usecs_to_jiffies with input parameter unsigned int, the current data type is too wide to store the value of ctx->usecs_lat.
Change the data type of "usecs_lat" to a more suitable (narrower) type.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/xgene-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/xgene-hwmon.c +1 -1
@@ -111,7 +111,7 @@ struct xgene_hwmon_dev {phys_addr_t comm_base_addr;void *pcc_comm_addr; -u64 usecs_lat; +unsigned int usecs_lat; };/*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 186/212 media: qcom: camss: csid: Only add TPG v4l2 ctrl if TPG hardware is available
In reply to Sasha LevinFrom: Depeng Shao <[email protected]>
[ Upstream commit 2f1361f862a68063f37362f1beb400e78e289581 ]
There is no CSID TPG on some SoCs, so the v4l2 ctrl in CSID driver shouldn't be registered. Checking the supported TPG modes to indicate if the TPG hardware exists or not and only registering v4l2 ctrl for CSID only when the TPG hardware is present.
--- .../media/platform/qcom/camss/camss-csid.c | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-)
drivers/media/platform/qcom/camss/camss-csid.c +35 -25
@@ -239,11 +239,13 @@ static int csid_set_stream(struct v4l2_subdev *sd, int enable)int ret;if (enable) { - ret =v4l2_ctrl_handler_setup (&csid->ctrls); -if (ret <0 ) { -dev_err (csid->camss->dev, -"could not sync v4l2 controls: %d\n" , ret); -return ret; +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) { + ret =v4l2_ctrl_handler_setup (&csid->ctrls); +if (ret <0 ) { +dev_err (csid->camss->dev, +"could not sync v4l2 controls: %d\n" , ret); +return ret; + } } if (!csid->testgen.enabled &&
@@ -318,7 +320,8 @@ static void csid_try_format(struct csid_device *csid,break ;case MSM_CSID_PAD_SRC : -if (csid->testgen_mode->cur.val ==0 ) { +if (csid->testgen.nmodes ==CSID_PAYLOAD_MODE_DISABLED || + csid->testgen_mode->cur.val ==0 ) {/* Test generator is disabled, */ /* keep pad formats in sync */ u32 code = fmt->code;
@@ -368,7 +371,8 @@ static int csid_enum_mbus_code(struct v4l2_subdev *sd, code->code = csid->formats[code->index].code; }else { -if (csid->testgen_mode->cur.val ==0 ) { +if (csid->testgen.nmodes ==CSID_PAYLOAD_MODE_DISABLED || + csid->testgen_mode->cur.val ==0 ) {struct v4l2_mbus_framefmt *sink_fmt; sink_fmt = __csid_get_format(csid, sd_state,
@@ -750,7 +754,8 @@ static int csid_link_setup(struct media_entity *entity,/* If test generator is enabled */ /* do not allow a link from CSIPHY to CSID */ -if (csid->testgen_mode->cur.val !=0 ) +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED && + csid->testgen_mode->cur.val !=0 )return -EBUSY ; sd =media_entity_to_v4l2_subdev (remote->entity);
@@ -843,24 +848,27 @@ int msm_csid_register_entity(struct csid_device *csid, MSM_CSID_NAME, csid->id);v4l2_set_subdevdata (sd, csid); - ret =v4l2_ctrl_handler_init (&csid->ctrls,1 ); -if (ret <0 ) { -dev_err (dev,"Failed to init ctrl handler: %d\n" , ret); -return ret; - } +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) { + ret =v4l2_ctrl_handler_init (&csid->ctrls,1 ); +if (ret <0 ) { +dev_err (dev,"Failed to init ctrl handler: %d\n" , ret); +return ret; + } - csid->testgen_mode =v4l2_ctrl_new_std_menu_items (&csid->ctrls, - &csid_ctrl_ops,V4L2_CID_TEST_PATTERN , - csid->testgen.nmodes,0 ,0 , - csid->testgen.modes); + csid->testgen_mode = +v4l2_ctrl_new_std_menu_items (&csid->ctrls, + &csid_ctrl_ops,V4L2_CID_TEST_PATTERN , + csid->testgen.nmodes,0 ,0 , + csid->testgen.modes); -if (csid->ctrls.error) { -dev_err (dev,"Failed to init ctrl: %d\n" , csid->ctrls.error); - ret = csid->ctrls.error; - goto free_ctrl; - } +if (csid->ctrls.error) { +dev_err (dev,"Failed to init ctrl: %d\n" , csid->ctrls.error); + ret = csid->ctrls.error; + goto free_ctrl; + } - csid->subdev.ctrl_handler = &csid->ctrls; + csid->subdev.ctrl_handler = &csid->ctrls; + } ret =csid_init_formats (sd,NULL );if (ret <0 ) {
@@ -891,7 +899,8 @@ int msm_csid_register_entity(struct csid_device *csid, media_cleanup:media_entity_cleanup (&sd->entity); free_ctrl: -v4l2_ctrl_handler_free (&csid->ctrls); +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) +v4l2_ctrl_handler_free (&csid->ctrls);return ret; }
@@ -904,5 +913,6 @@ void msm_csid_unregister_entity(struct csid_device *csid) {v4l2_device_unregister_subdev (&csid->subdev);media_entity_cleanup (&csid->subdev.entity); -v4l2_ctrl_handler_free (&csid->ctrls); +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) +v4l2_ctrl_handler_free (&csid->ctrls); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 187/212 vxlan: Annotate FDB data races
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit f6205f8215f12a96518ac9469ff76294ae7bd612 ]
The 'used' and 'updated' fields in the FDB entry structure can be accessed concurrently by multiple threads, leading to reports such as [1]. Can be reproduced using [2].
Suppress these reports by annotating these accesses using READ_ONCE() / WRITE_ONCE().
[1]
BUG: KCSAN: data-race in vxlan_xmit / vxlan_xmit
write to 0xffff942604d263a8 of 8 bytes by task 286 on cpu 0:
vxlan_xmit+0xb29/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
read to 0xffff942604d263a8 of 8 bytes by task 287 on cpu 2:
vxlan_xmit+0xadf/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
value changed: 0x00000000fffbac6e -> 0x00000000fffbac6f
Reported by Kernel Concurrency Sanitizer on:
CPU: 2 UID: 0 PID: 287 Comm: mausezahn Not tainted 6.13.0-rc7-01544-gb4b270f11a02 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
[2]
#!/bin/bash
set +H
echo whitelist > /sys/kernel/debug/kcsan
echo !vxlan_xmit > /sys/kernel/debug/kcsan
ip link add name vx0 up type vxlan id 10010 dstport 4789 local 192.0.2.1 bridge fdb add 00:11:22:33:44:55 dev vx0 self static dst 198.51.100.1 taskset -c 0 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q & taskset -c 2 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q &
--- drivers/net/vxlan/vxlan_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/vxlan/vxlan_core.c +9 -9
@@ -274,9 +274,9 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, be32_to_cpu(fdb->vni))) goto nla_put_failure; - ci.ndm_used =jiffies_to_clock_t (now - fdb->used); + ci.ndm_used =jiffies_to_clock_t (now -READ_ONCE (fdb->used)); ci.ndm_confirmed =0 ; - ci.ndm_updated =jiffies_to_clock_t (now - fdb->updated); + ci.ndm_updated =jiffies_to_clock_t (now -READ_ONCE (fdb->updated)); ci.ndm_refcnt =0 ;if (nla_put (skb,NDA_CACHEINFO ,sizeof (ci), &ci))
@@ -482,8 +482,8 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,struct vxlan_fdb *f; f =__vxlan_find_mac (vxlan, mac, vni); -if (f && f->used != jiffies) - f->used = jiffies; +if (f &&READ_ONCE (f->used) != jiffies) +WRITE_ONCE (f->used, jiffies);return f; }
@@ -1057,12 +1057,12 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, !(f->flags & NTF_VXLAN_ADDED_BY_USER)) {if (f->state != state) { f->state = state; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; }if (f->flags != fdb_flags) { f->flags = fdb_flags; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; } }
@@ -1096,7 +1096,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, }if (ndm_flags &NTF_USE ) - f->used = jiffies; +WRITE_ONCE (f->used, jiffies);if (notify) {if (rd ==NULL )
@@ -1525,7 +1525,7 @@ static bool vxlan_snoop(struct net_device *dev, src_mac, &rdst->remote_ip.sa, &src_ip->sa); rdst->remote_ip = *src_ip; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies);vxlan_fdb_notify (vxlan, f, rdst,RTM_NEWNEIGH , true,NULL ); }else {u32 hash_index =fdb_head_index (vxlan, src_mac, vni);
@@ -2936,7 +2936,7 @@ static void vxlan_cleanup(struct timer_list *t)if (f->flags &NTF_EXT_LEARNED )continue ; - timeout = f->used + vxlan->cfg.age_interval *HZ ; + timeout =READ_ONCE (f->used) + vxlan->cfg.age_interval *HZ ;if (time_before_eq (timeout, jiffies)) { netdev_dbg(vxlan->dev, "garbage collect %pM\n",
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 188/212 r8169: don't scan PHY addresses > 0
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit faac69a4ae5abb49e62c79c66b51bb905c9aa5ec ]
The PHY address is a dummy, because r8169 PHY access registers don't support a PHY address. Therefore scan address 0 only.
--- drivers/net/ethernet/realtek/r8169_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/realtek/r8169_main.c +1 -0
@@ -5156,6 +5156,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->priv = tp; new_bus->parent = &pdev->dev; new_bus->irq[0 ] =PHY_MAC_INTERRUPT ; + new_bus->phy_mask =GENMASK (31 ,1 );snprintf (new_bus->id,MII_BUS_ID_SIZE ,"r8169-%x-%x" ,pci_domain_nr (pdev->bus),pci_dev_id (pdev));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 189/212 net-sysfs: prevent uncleared queues from being re-added
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit 7e54f85c60828842be27e0149f3533357225090e ]
With the (upcoming) removal of the rtnl_trylock/restart_syscall logic and because of how Tx/Rx queues are implemented (and their requirements), it might happen that a queue is re-added before having the chance to be cleared. In such rare case, do not complete the queue addition operation.
--- net/core/net-sysfs.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
net/core/net-sysfs.c +32 -0
@@ -1052,6 +1052,22 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)struct kobject *kobj = &queue->kobj;int error =0 ; +/* Rx queues are cleared in rx_queue_release to allow later +* re-registration. This is triggered when their kobj refcount is +* dropped. +* +* If a queue is removed while both a read (or write) operation and a +* the re-addition of the same queue are pending (waiting on rntl_lock) +* it might happen that the re-addition will execute before the read, +* making the initial removal to never happen (queue's kobj refcount +* won't drop enough because of the pending read). In such rare case, +* return to allow the removal operation to complete. +*/ +if (unlikely (kobj->state_initialized)) { +netdev_warn_once (dev,"Cannot re-add rx queues before their removal completed" ); +return -EAGAIN ; + } +/* Kobject_put later will trigger rx_queue_release call which * decreases dev refcount: Take that reference here */
@@ -1655,6 +1671,22 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)struct kobject *kobj = &queue->kobj;int error =0 ; +/* Tx queues are cleared in netdev_queue_release to allow later +* re-registration. This is triggered when their kobj refcount is +* dropped. +* +* If a queue is removed while both a read (or write) operation and a +* the re-addition of the same queue are pending (waiting on rntl_lock) +* it might happen that the re-addition will execute before the read, +* making the initial removal to never happen (queue's kobj refcount +* won't drop enough because of the pending read). In such rare case, +* return to allow the removal operation to complete. +*/ +if (unlikely (kobj->state_initialized)) { +netdev_warn_once (dev,"Cannot re-add tx queues before their removal completed" ); +return -EAGAIN ; + } +/* Kobject_put later will trigger netdev_queue_release call * which decreases dev refcount: Take that reference here */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 190/212 rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit 83b28cfe796464ebbde1cf7916c126da6d572685 ]
With PREEMPT_RCU=n, cond_resched() provides urgently needed quiescent states for read-side critical sections via rcu_all_qs(). One reason why this was needed: lacking preempt-count, the tick handler has no way of knowing whether it is executing in a read-side critical section or not.
With (PREEMPT_LAZY=y, PREEMPT_DYNAMIC=n), we get (PREEMPT_COUNT=y, PREEMPT_RCU=n). In this configuration cond_resched() is a stub and does not provide quiescent states via rcu_all_qs(). (PREEMPT_RCU=y provides this information via rcu_read_unlock() and its nesting counter.)
So, use the availability of preempt_count() to report quiescent states in rcu_flavor_sched_clock_irq().
--- kernel/rcu/tree_plugin.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +7 -4
@@ -963,13 +963,16 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)*/ static void rcu_flavor_sched_clock_irq (int user) { -if (user ||rcu_is_cpu_rrupt_from_idle ()) { +if (user ||rcu_is_cpu_rrupt_from_idle () || + (IS_ENABLED (CONFIG_PREEMPT_COUNT ) && + (preempt_count () ==HARDIRQ_OFFSET ))) {/* * Get here if this CPU took its interrupt from user -* mode or from the idle loop, and if this is not a -* nested interrupt. In this case, the CPU is in -* a quiescent state, so note it. +* mode, from the idle loop without this being a nested +* interrupt, or while not holding the task preempt count +* (with PREEMPT_COUNT=y). In this case, the CPU is in a +* quiescent state, so note it. * * No memory barrier is required here because rcu_qs() * references only CPU-local variables that other CPUs
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 191/212 rcu: handle unstable rdp in rcu_read_unlock_strict()
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit fcf0e25ad4c8d14d2faab4d9a17040f31efce205 ]
rcu_read_unlock_strict() can be called with preemption enabled which can make for an unstable rdp and a racy norm value.
Fix this by dropping the preempt-count in __rcu_read_unlock() after the call to rcu_read_unlock_strict(), adjusting the preempt-count check appropriately.
--- include/linux/rcupdate.h | 2 +- kernel/rcu/tree_plugin.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
include/linux/rcupdate.h +1 -1
@@ -97,9 +97,9 @@ static inline void __rcu_read_lock(void)static inline void __rcu_read_unlock (void ) { -preempt_enable ();if (IS_ENABLED (CONFIG_RCU_STRICT_GRACE_PERIOD ))rcu_read_unlock_strict (); +preempt_enable (); }static inline int rcu_preempt_depth (void )
kernel/rcu/tree_plugin.h +10 -1
@@ -821,8 +821,17 @@ void rcu_read_unlock_strict(void) {struct rcu_data *rdp; -if (irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread) +if (irqs_disabled () ||in_atomic_preempt_off () || !rcu_state.gp_kthread)return ; + +/* +* rcu_report_qs_rdp() can only be invoked with a stable rdp and +* from the local CPU. +* +* The in_atomic_preempt_off() check ensures that we come here holding +* the last preempt_count (which will get dropped once we return to +* __rcu_read_unlock(). +*/ rdp =this_cpu_ptr (&rcu_data); rdp->cpu_no_qs.b.norm = false;rcu_report_qs_rdp (rdp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 192/212 rcu: fix header guard for rcu_all_qs()
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit ad6b5b73ff565e88aca7a7d1286788d80c97ba71 ]
rcu_all_qs() is defined for !CONFIG_PREEMPT_RCU but the declaration is conditioned on CONFIG_PREEMPTION.
With CONFIG_PREEMPT_LAZY, CONFIG_PREEMPTION=y does not imply CONFIG_PREEMPT_RCU=y.
Decouple the two.
--- include/linux/rcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcutree.h +1 -1
@@ -105,7 +105,7 @@ extern int rcu_scheduler_active;void rcu_end_inkernel_boot (void );bool rcu_inkernel_boot_has_ended (void );bool rcu_is_watching (void ); -#ifndef CONFIG_PREEMPTION +#ifndef CONFIG_PREEMPT_RCU void rcu_all_qs (void );#endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 193/212 perf: Avoid the read if the count is already updated
In reply to Sasha LevinFrom: "Peter Zijlstra (Intel)" <[email protected]>
[ Upstream commit 8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a ]
The event may have been updated in the PMU-specific implementation, e.g., Intel PEBS counters snapshotting. The common code should not read and overwrite the value.
The PERF_SAMPLE_READ in the data->sample_type can be used to detect whether the PMU-specific value is available. If yes, avoid the pmu->read() in the common code. Add a new flag, skip_read, to track the case.
Factor out a perf_pmu_read() to clean up the code.
--- include/linux/perf_event.h | 8 +++++++- kernel/events/core.c | 33 ++++++++++++++++----------------- kernel/events/ring_buffer.c | 1 + 3 files changed, 24 insertions(+), 18 deletions(-)
include/linux/perf_event.h +7 -1
@@ -935,7 +935,13 @@ struct perf_output_handle {struct perf_buffer *rb;unsigned long wakeup;unsigned long size; -u64 aux_flags; +union { +u64 flags;/* perf_output*() */ +u64 aux_flags;/* perf_aux_output*() */ +struct { +u64 skip_read :1 ; + }; + };union {void *addr;unsigned long head;
kernel/events/core.c +16 -17
@@ -1180,6 +1180,12 @@ static void perf_event_ctx_deactivate(struct perf_event_context *ctx)list_del_init (&ctx->active_ctx_list); } +static inline void perf_pmu_read (struct perf_event *event) +{ +if (event->state ==PERF_EVENT_STATE_ACTIVE ) + event->pmu->read (event); +} +static void get_ctx (struct perf_event_context *ctx) {refcount_inc (&ctx->refcount);
@@ -3389,8 +3395,7 @@ static void __perf_event_sync_stat(struct perf_event *event,* we know the event must be on the current CPU, therefore we * don't need to use it. */ -if (event->state ==PERF_EVENT_STATE_ACTIVE ) - event->pmu->read (event); +perf_pmu_read (event);perf_event_update_time (event);
@@ -4444,15 +4449,8 @@ static void __perf_event_read(void *info) pmu->read (event); -for_each_sibling_event (sub, event) { -if (sub->state ==PERF_EVENT_STATE_ACTIVE ) { -/* -* Use sibling's PMU rather than @event's since -* sibling could be on different (eg: software) PMU. -*/ - sub->pmu->read (sub); - } - } +for_each_sibling_event (sub, event) +perf_pmu_read (sub); data->ret = pmu->commit_txn (pmu);
@@ -7101,9 +7099,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; -if ((leader != event) && - (leader->state ==PERF_EVENT_STATE_ACTIVE )) - leader->pmu->read (leader); +if ((leader != event) && !handle->skip_read) +perf_pmu_read (leader); values[n++] =perf_event_count (leader);if (read_format &PERF_FORMAT_ID )
@@ -7116,9 +7113,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,for_each_sibling_event (sub, leader) { n =0 ; -if ((sub != event) && - (sub->state ==PERF_EVENT_STATE_ACTIVE )) - sub->pmu->read (sub); +if ((sub != event) && !handle->skip_read) +perf_pmu_read (sub); values[n++] =perf_event_count (sub);if (read_format &PERF_FORMAT_ID )
@@ -7173,6 +7169,9 @@ void perf_output_sample(struct perf_output_handle *handle, {u64 sample_type = data->type; +if (data->sample_flags &PERF_SAMPLE_READ ) + handle->skip_read =1 ; +perf_output_put (handle, *header);if (sample_type &PERF_SAMPLE_IDENTIFIER )
kernel/events/ring_buffer.c +1 -0
@@ -181,6 +181,7 @@ __perf_output_begin(struct perf_output_handle *handle, handle->rb = rb; handle->event = event; + handle->flags =0 ; have_lost =local_read (&rb->lost);if (unlikely (have_lost)) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 194/212 ice: count combined queues using Rx/Tx count
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit c3a392bdd31adc474f1009ee85c13fdd01fe800d ]
Previous implementation assumes that there is 1:1 matching between vectors and queues. It isn't always true.
Get minimum value from Rx/Tx queues to determine combined queues number.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -2
@@ -3373,8 +3373,7 @@ static u32 ice_get_combined_cnt(struct ice_vsi *vsi)ice_for_each_q_vector (vsi, q_idx) {struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; -if (q_vector->rx.rx_ring && q_vector->tx.tx_ring) - combined++; + combined +=min (q_vector->num_ring_tx, q_vector->num_ring_rx); }return combined;
Signature · 1 line
2.39.5
RE: [Intel-wired-lan] [PATCH AUTOSEL 6.1 194/212] ice: count combined queues using Rx/Tx count
Quoted 25 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Sasha Levin
Sent: Tuesday, May 6, 2025 1:06 AM
To: [email protected]; [email protected]
Cc: Michal Swiatkowski <[email protected]>; Keller, Jacob E <[email protected]>; Pucha Himasekhar Reddy <[email protected]>; Nguyen, Anthony L <[email protected]>; Sasha Levin <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [Intel-wired-lan] [PATCH AUTOSEL 6.1 194/212] ice: count combined queues using Rx/Tx countFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit
c3a392bdd31adc474f1009ee85c13fdd01fe800d]Previous implementation assumes that there is 1:1 matching between vectors and queues. It isn't always true.
Quoted 8 lines
Get minimum value from Rx/Tx queues to determine combined queues number.
Reviewed-by Jacob Keller <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>Signed-off-by Tony Nguyen <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 23 lines
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/ethernet/intel/ice/ice_ethtool.c +1
-2@@ -3373,8 +3373,7 @@ static u32 ice_get_combined_cnt(struct ice_vsi *vsi)ice_for_each_q_vector (vsi, q_idx) {struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; -if (q_vector->rx.rx_ring && q_vector->tx.tx_ring) - combined++; + combined +=min (q_vector->num_ring_tx, q_vector- >num_ring_rx); }return combined;
--
2.39.5
Sasha Levin
maintainerPATCH 195/212 net/mana: fix warning in the writer of client oob
In reply to Sasha LevinFrom: Konstantin Taranov <[email protected]>
[ Upstream commit 5ec7e1c86c441c46a374577bccd9488abea30037 ]
Do not warn on missing pad_data when oob is in sgl.
--- drivers/net/ethernet/microsoft/mana/gdma_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microsoft/mana/gdma_main.c +1 -1
@@ -995,7 +995,7 @@ static u32 mana_gd_write_client_oob(const struct gdma_wqe_request *wqe_req, header->inline_oob_size_div4 = client_oob_size /sizeof (u32);if (oob_in_sgl) { -WARN_ON_ONCE (!pad_data || wqe_req->num_sge <2 ); +WARN_ON_ONCE (wqe_req->num_sge <2 ); header->client_oob_in_sgl =1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 196/212 scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit 56c3d809b7b450379162d0b8a70bbe71ab8db706 ]
After a port swap between separate fabrics, there may be multiple nodes in the vport's fc_nodes list with the same fabric well known address. Duplication is temporary and eventually resolves itself after dev_loss_tmo expires, but nameserver queries may still occur before dev_loss_tmo. This possibly results in returning stale fabric ndlp objects. Fix by adding an nlp_state check to ensure the ndlp search routine returns the correct newer allocated ndlp fabric object.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -5
@@ -5619,6 +5619,7 @@ static struct lpfc_nodelist * __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) {struct lpfc_nodelist *ndlp; +struct lpfc_nodelist *np =NULL ;uint32_t data1;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {
@@ -5633,14 +5634,20 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) ndlp, ndlp->nlp_DID, ndlp->nlp_flag, data1, ndlp->nlp_rpi, ndlp->active_rrqs_xri_bitmap); -return ndlp; + +/* Check for new or potentially stale node */ +if (ndlp->nlp_state !=NLP_STE_UNUSED_NODE ) +return ndlp; + np = ndlp; } } -/* FIND node did <did> NOT FOUND */ -lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , -"0932 FIND node did x%x NOT FOUND.\n" , did); -return NULL ; +if (!np) +/* FIND node did <did> NOT FOUND */ +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , +"0932 FIND node did x%x NOT FOUND.\n" , did); + +return np; } struct lpfc_nodelist *
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 197/212 scsi: lpfc: Free phba irq in lpfc_sli4_enable_msi() when pci_irq_vector() fails
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit f0842902b383982d1f72c490996aa8fc29a7aa0d ]
Fix smatch warning regarding missed calls to free_irq(). Free the phba IRQ in the failed pci_irq_vector cases.
lpfc_init.c: lpfc_sli4_enable_msi() warn: 'phba->pcidev->irq' from
request_irq() not released.
--- drivers/scsi/lpfc/lpfc_init.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_init.c +2 -0
@@ -13204,6 +13204,7 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba) eqhdl =lpfc_get_eq_hdl (0 ); rc =pci_irq_vector (phba->pcidev,0 );if (rc <0 ) { +free_irq (phba->pcidev->irq, phba);pci_free_irq_vectors (phba->pcidev);lpfc_printf_log (phba,KERN_WARNING ,LOG_INIT ,"0496 MSI pci_irq_vec failed (%d)\n" , rc);
@@ -13284,6 +13285,7 @@ lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) eqhdl =lpfc_get_eq_hdl (0 ); retval =pci_irq_vector (phba->pcidev,0 );if (retval <0 ) { +free_irq (phba->pcidev->irq, phba);lpfc_printf_log (phba,KERN_WARNING ,LOG_INIT ,"0502 INTR pci_irq_vec failed (%d)\n" , retval);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 198/212 scsi: st: Restore some drive settings after reset
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit 7081dc75df79696d8322d01821c28e53416c932c ]
Some of the allowed operations put the tape into a known position to continue operation assuming only the tape position has changed. But reset sets partition, density and block size to drive default values. These should be restored to the values before reset.
Normally the current block size and density are stored by the drive. If the settings have been changed, the changed values have to be saved by the driver across reset.
--- drivers/scsi/st.c | 24 +++++++++++++++++++++--- drivers/scsi/st.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-)
drivers/scsi/st.c +21 -3
@@ -950,7 +950,6 @@ static void reset_state(struct scsi_tape *STp) STp->partition =find_partition (STp);if (STp->partition <0 ) STp->partition =0 ; - STp->new_partition = STp->partition; } }
@@ -2919,14 +2918,17 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lonif (cmd_in ==MTSETDENSITY ) { (STp->buffer)->b_data[4 ] = arg; STp->density_changed =1 ;/* At least we tried ;-) */ + STp->changed_density = arg; }else if (cmd_in ==SET_DENS_AND_BLK ) (STp->buffer)->b_data[4 ] = arg >>24 ;else (STp->buffer)->b_data[4 ] = STp->density;if (cmd_in ==MTSETBLK || cmd_in ==SET_DENS_AND_BLK ) { ltmp = arg &MT_ST_BLKSIZE_MASK ; -if (cmd_in ==MTSETBLK ) +if (cmd_in ==MTSETBLK ) { STp->blksize_changed =1 ;/* At least we tried ;-) */ + STp->changed_blksize = arg; + } }else ltmp = STp->block_size; (STp->buffer)->b_data[9 ] = (ltmp >>16 );
@@ -3627,9 +3629,25 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) retval = (-EIO ); goto out; } -reset_state (STp); +reset_state (STp);/* Clears pos_unknown */ /* remove this when the midlevel properly clears was_reset */ STp->device->was_reset =0 ; + +/* Fix the device settings after reset, ignore errors */ +if (mtc.mt_op ==MTREW || mtc.mt_op ==MTSEEK || + mtc.mt_op ==MTEOM ) { +if (STp->can_partitions) { +/* STp->new_partition contains the +* latest partition set +*/ + STp->partition =0 ; +switch_partition (STp); + } +if (STp->density_changed) +st_int_ioctl (STp,MTSETDENSITY , STp->changed_density); +if (STp->blksize_changed) +st_int_ioctl (STp,MTSETBLK , STp->changed_blksize); + } } if (mtc.mt_op != MTNOP && mtc.mt_op != MTSETBLK &&
drivers/scsi/st.h +2 -0
@@ -165,12 +165,14 @@ struct scsi_tape {unsigned char compression_changed;unsigned char drv_buffer;unsigned char density; +unsigned char changed_density;unsigned char door_locked;unsigned char autorew_dev;/* auto-rewind device */ unsigned char rew_at_close;/* rewind necessary at close */ unsigned char inited;unsigned char cleaning_req;/* cleaning requested? */ int block_size; +int changed_blksize;int min_block;int max_block;int recover_count;/* From tape opening */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 199/212 HID: usbkbd: Fix the bit shift number for LED_KANA
In reply to Sasha LevinFrom: junan <[email protected]>
[ Upstream commit d73a4bfa2881a6859b384b75a414c33d4898b055 ]
Since "LED_KANA" was defined as "0x04", the shift number should be "4".
--- drivers/hid/usbhid/usbkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/usbkbd.c +1 -1
@@ -160,7 +160,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type,return -1 ;spin_lock_irqsave (&kbd->leds_lock, flags); - kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<3 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | + kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<4 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | (!!test_bit (LED_SCROLLL , dev->led) <<2 ) | (!!test_bit (LED_CAPSL , dev->led) <<1 ) | (!!test_bit (LED_NUML , dev->led));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 200/212 ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode
In reply to Sasha LevinFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 7d92a38d67e5d937b64b20aa4fd14451ee1772f3 ]
As per codec device specification, 24-bit is allowed in provider mode. Update the code to reflect that.
--- sound/soc/codecs/pcm3168a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/pcm3168a.c +3 -3
@@ -494,9 +494,9 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, }break ;case 24 : -if (provider_mode || (format ==SND_SOC_DAIFMT_DSP_A ) || - (format ==SND_SOC_DAIFMT_DSP_B )) { -dev_err (component->dev,"24-bit slots not supported in provider mode, or consumer mode using DSP\n" ); +if (!provider_mode && ((format ==SND_SOC_DAIFMT_DSP_A ) || + (format ==SND_SOC_DAIFMT_DSP_B ))) { +dev_err (component->dev,"24-bit slots not supported in consumer mode using DSP\n" );return -EINVAL ; }break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 201/212 drm/ast: Find VBIOS mode from regular display size
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit c81202906b5cd56db403e95db3d29c9dfc8c74c1 ]
The ast driver looks up supplied display modes from an internal list of display modes supported by the VBIOS.
Do not use the crtc_-prefixed display values from struct drm_display_mode for looking up the VBIOS mode. The fields contain raw values that the driver programs to hardware. They are affected by display settings like double-scan or interlace.
Instead use the regular vdisplay and hdisplay fields for lookup. As the programmed values can now differ from the values used for lookup, set struct drm_display_mode.crtc_vdisplay and .crtc_hdisplay from the VBIOS mode.
--- drivers/gpu/drm/ast/ast_mode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +6 -4
@@ -103,7 +103,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format,return false; } -switch (mode->crtc_hdisplay) { +switch (mode->hdisplay) {case 640 : vbios_mode->enh_table = &res_640x480[refresh_rate_index];break ;
@@ -117,7 +117,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1152x864[refresh_rate_index];break ;case 1280 : -if (mode->crtc_vdisplay ==800 ) +if (mode->vdisplay ==800 ) vbios_mode->enh_table = &res_1280x800[refresh_rate_index];else vbios_mode->enh_table = &res_1280x1024[refresh_rate_index];
@@ -129,7 +129,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1440x900[refresh_rate_index];break ;case 1600 : -if (mode->crtc_vdisplay ==900 ) +if (mode->vdisplay ==900 ) vbios_mode->enh_table = &res_1600x900[refresh_rate_index];else vbios_mode->enh_table = &res_1600x1200[refresh_rate_index];
@@ -138,7 +138,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1680x1050[refresh_rate_index];break ;case 1920 : -if (mode->crtc_vdisplay ==1080 ) +if (mode->vdisplay ==1080 ) vbios_mode->enh_table = &res_1920x1080[refresh_rate_index];else vbios_mode->enh_table = &res_1920x1200[refresh_rate_index];
@@ -182,6 +182,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, hborder = (vbios_mode->enh_table->flags & HBorder) ?8 :0 ; vborder = (vbios_mode->enh_table->flags & VBorder) ?8 :0 ; + adjusted_mode->crtc_hdisplay = vbios_mode->enh_table->hde; adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht; adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder; adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
@@ -191,6 +192,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table->hfp + vbios_mode->enh_table->hsync); + adjusted_mode->crtc_vdisplay = vbios_mode->enh_table->vde; adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt; adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder; adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 202/212 bpftool: Fix readlink usage in get_fd_type
In reply to Sasha LevinFrom: Viktor Malik <[email protected]>
[ Upstream commit 0053f7d39d491b6138d7c526876d13885cbb65f1 ]
The readlink(path, buf, sizeof(buf)) call reads at most sizeof(buf) bytes and *does not* append null-terminator to buf. With respect to that, fix two pieces in get_fd_type:
1. Change the truncation check to contain sizeof(buf) rather than sizeof(path).
2. Append null-terminator to buf.
Reported by Coverity.
--- tools/bpf/bpftool/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/bpf/bpftool/common.c +2 -1
@@ -384,10 +384,11 @@ int get_fd_type(int fd)p_err ("can't read link type: %s" ,strerror (errno));return -1 ; } -if (n ==sizeof (path)) { +if (n ==sizeof (buf)) {p_err ("can't read link type: path too long!" );return -1 ; } + buf[n] ='\0' ;if (strstr (buf,"bpf-map" ))return BPF_OBJ_MAP ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 203/212 perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 46dcf85566170d4528b842bf83ffc350d71771fa ]
IBS Op uses two counters: MaxCnt and CurCnt. MaxCnt is programmed with the desired sample period. IBS hw generates sample when CurCnt reaches to MaxCnt. The size of these counter used to be 20 bits but later they were extended to 27 bits. The 7 bit extension is indicated by CPUID Fn8000_001B_EAX[6 / OpCntExt].
perf_ibs->cnt_mask variable contains bit masks for MaxCnt and CurCnt. But IBS driver does not set upper 7 bits of CurCnt in cnt_mask even when OpCntExt CPUID bit is set. Fix this.
IBS driver uses cnt_mask[CurCnt] bits only while disabling an event. Fortunately, CurCnt bits are not read from MSR while re-enabling the event, instead MaxCnt is programmed with desired period and CurCnt is set to 0. Hence, we did not see any issues so far.
--- arch/x86/events/amd/ibs.c | 3 ++- arch/x86/include/asm/perf_event.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/amd/ibs.c +2 -1
@@ -1216,7 +1216,8 @@ static __init int perf_ibs_op_init(void)if (ibs_caps &IBS_CAPS_OPCNTEXT ) { perf_ibs_op.max_period |=IBS_OP_MAX_CNT_EXT_MASK ; perf_ibs_op.config_mask |=IBS_OP_MAX_CNT_EXT_MASK ; - perf_ibs_op.cnt_mask |=IBS_OP_MAX_CNT_EXT_MASK ; + perf_ibs_op.cnt_mask |= (IBS_OP_MAX_CNT_EXT_MASK | +IBS_OP_CUR_CNT_EXT_MASK ); }if (ibs_caps &IBS_CAPS_ZEN4 )
arch/x86/include/asm/perf_event.h +1 -0
@@ -456,6 +456,7 @@ struct pebs_xmm {*/ #define IBS_OP_CUR_CNT (0xFFF80ULL<<32)#define IBS_OP_CUR_CNT_RAND (0x0007FULL<<32) +#define IBS_OP_CUR_CNT_EXT_MASK (0x7FULL<<52)#define IBS_OP_CNT_CTL (1ULL<<19)#define IBS_OP_VAL (1ULL<<18)#define IBS_OP_ENABLE (1ULL<<17)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 204/212 wifi: rtl8xxxu: retry firmware download on error
In reply to Sasha LevinFrom: Soeren Moch <[email protected]>
[ Upstream commit 3d3e28feca7ac8c6cf2a390dbbe1f97e3feb7f36 ]
Occasionally there is an EPROTO error during firmware download. This error is converted to EAGAIN in the download function. But nobody tries again and so device probe fails.
Implement download retry to fix this.
This error was observed (and fix tested) on a tbs2910 board [1] with an embedded RTL8188EU (0bda:8179) device behind a USB hub.
[1] arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
--- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +12 -5
@@ -798,9 +798,10 @@ rtl8xxxu_writeN(struct rtl8xxxu_priv *priv, u16 addr, u8 *buf, u16 len)return len; write_error: -dev_info (&udev->dev, -"%s: Failed to write block at addr: %04x size: %04x\n" , - __func__, addr, blocksize); +if (rtl8xxxu_debug &RTL8XXXU_DEBUG_REG_WRITE ) +dev_info (&udev->dev, +"%s: Failed to write block at addr: %04x size: %04x\n" , + __func__, addr, blocksize);return -EAGAIN ; }
@@ -3920,8 +3921,14 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)*/ rtl8xxxu_write16 (priv,REG_TRXFF_BNDY +2 , fops->trxff_boundary); - ret =rtl8xxxu_download_firmware (priv); -dev_dbg (dev,"%s: download_firmware %i\n" , __func__, ret); +for (int retry =5 ; retry >=0 ; retry--) { + ret =rtl8xxxu_download_firmware (priv); +dev_dbg (dev,"%s: download_firmware %i\n" , __func__, ret); +if (ret != -EAGAIN ) +break ; +if (retry) +dev_dbg (dev,"%s: retry firmware download\n" , __func__); + }if (ret) goto exit; ret =rtl8xxxu_start_firmware (priv);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 205/212 wifi: rtw88: Don't use static local variable in rtw8822b_set_tx_power_index_by_rate
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 00451eb3bec763f708e7e58326468c1e575e5a66 ]
Some users want to plug two identical USB devices at the same time. This static variable could theoretically cause them to use incorrect TX power values.
Move the variable to the caller and pass a pointer to it to rtw8822b_set_tx_power_index_by_rate().
--- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822b.c +8 -6
@@ -957,11 +957,11 @@ static void rtw8822b_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, }static void -rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path,u8 rs) +rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path, +u8 rs,u32 *phy_pwr_idx) {struct rtw_hal *hal = &rtwdev->hal;static const u32 offset_txagc[2 ] = {0x1d00 ,0x1d80 }; -static u32 phy_pwr_idx;u8 rate, rate_idx, pwr_index, shift;int j;
@@ -969,12 +969,12 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs) rate = rtw_rate_section[rs][j]; pwr_index = hal->tx_pwr_tbl[path][rate]; shift = rate &0x3 ; - phy_pwr_idx |= ((u32 )pwr_index << (shift *8 )); + *phy_pwr_idx |= ((u32 )pwr_index << (shift *8 ));if (shift ==0x3 ) { rate_idx = rate &0xfc ;rtw_write32 (rtwdev, offset_txagc[path] + rate_idx, - phy_pwr_idx); - phy_pwr_idx =0 ; + *phy_pwr_idx); + *phy_pwr_idx =0 ; } } }
@@ -982,11 +982,13 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs)static void rtw8822b_set_tx_power_index (struct rtw_dev *rtwdev) {struct rtw_hal *hal = &rtwdev->hal; +u32 phy_pwr_idx =0 ;int rs, path;for (path =0 ; path < hal->rf_path_num; path++) {for (rs =0 ; rs <RTW_RATE_SECTION_MAX ; rs++) -rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs); +rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs, + &phy_pwr_idx); } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 206/212 wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit ebfc9199df05d37b67f4d1b7ee997193f3d2e7c8 ]
To ensure where are protected by driver mutex can also be protected by wiphy_lock(), so afterward we can remove driver mutex safely.
--- drivers/net/wireless/realtek/rtw89/regd.c | 2 ++ drivers/net/wireless/realtek/rtw89/ser.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/net/wireless/realtek/rtw89/regd.c +2 -0
@@ -334,6 +334,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requeststruct ieee80211_hw *hw =wiphy_to_ieee80211_hw (wiphy);struct rtw89_dev *rtwdev = hw->priv; +wiphy_lock (wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_ps_mode (rtwdev);
@@ -350,4 +351,5 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request exit:mutex_unlock (&rtwdev->mutex); +wiphy_unlock (wiphy); }
drivers/net/wireless/realtek/rtw89/ser.c +4 -0
@@ -153,9 +153,11 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt)rtw89_debug (rtwdev,RTW89_DBG_SER ,"ser: %s receive %s\n" ,ser_st_name (ser),ser_ev_name (ser, evt)); +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_lps (rtwdev);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy); ser->st_tbl[ser->state].st_func (ser, evt); }
@@ -624,9 +626,11 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)switch (evt) {case SER_EV_STATE_IN : +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);ser_l2_reset_st_pre_hdl (ser);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy);ieee80211_restart_hw (rtwdev->hw);ser_set_alarm (ser,SER_RECFG_TIMEOUT ,SER_EV_L2_RECFG_TIMEOUT );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 207/212 spi: zynqmp-gqspi: Always acknowledge interrupts
In reply to Sasha LevinFrom: Sean Anderson <[email protected]>
[ Upstream commit 89785306453ce6d949e783f6936821a0b7649ee2 ]
RXEMPTY can cause an IRQ, even though we may not do anything about it (such as if we are waiting for more received data). We must still handle these IRQs because we can tell they were caused by the device.
--- drivers/spi/spi-zynqmp-gqspi.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/spi/spi-zynqmp-gqspi.c +8 -12
@@ -698,7 +698,6 @@ static void zynqmp_process_dma_irq(struct zynqmp_qspi *xqspi)static irqreturn_t zynqmp_qspi_irq (int irq,void *dev_id) {struct zynqmp_qspi *xqspi = (struct zynqmp_qspi *)dev_id; -irqreturn_t ret =IRQ_NONE ;u32 status, mask, dma_status =0 ; status =zynqmp_gqspi_read (xqspi,GQSPI_ISR_OFST );
@@ -713,27 +712,24 @@ static irqreturn_t zynqmp_qspi_irq(int irq, void *dev_id) dma_status); } -if (mask &GQSPI_ISR_TXNOT_FULL_MASK ) { +if (!mask && !dma_status) +return IRQ_NONE ; + +if (mask &GQSPI_ISR_TXNOT_FULL_MASK )zynqmp_qspi_filltxfifo (xqspi,GQSPI_TX_FIFO_FILL ); - ret =IRQ_HANDLED ; - } -if (dma_status &GQSPI_QSPIDMA_DST_I_STS_DONE_MASK ) { +if (dma_status &GQSPI_QSPIDMA_DST_I_STS_DONE_MASK )zynqmp_process_dma_irq (xqspi); - ret =IRQ_HANDLED ; - }else if (!(mask &GQSPI_IER_RXEMPTY_MASK ) && - (mask &GQSPI_IER_GENFIFOEMPTY_MASK )) { +else if (!(mask &GQSPI_IER_RXEMPTY_MASK ) && + (mask &GQSPI_IER_GENFIFOEMPTY_MASK ))zynqmp_qspi_readrxfifo (xqspi,GQSPI_RX_FIFO_FILL ); - ret =IRQ_HANDLED ; - }if (xqspi->bytes_to_receive ==0 && xqspi->bytes_to_transfer ==0 && ((status &GQSPI_IRQ_MASK ) ==GQSPI_IRQ_MASK )) {zynqmp_gqspi_write (xqspi,GQSPI_IDR_OFST ,GQSPI_ISR_IDR_MASK );complete (&xqspi->data_completion); - ret =IRQ_HANDLED ; } -return ret; +return IRQ_HANDLED ; }/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 208/212 regulator: ad5398: Add device tree support
In reply to Sasha LevinFrom: Isaac Scott <[email protected]>
[ Upstream commit 5a6a461079decea452fdcae955bccecf92e07e97 ]
Previously, the ad5398 driver used only platform_data, which is deprecated in favour of device tree. This caused the AD5398 to fail to probe as it could not load its init_data. If the AD5398 has a device tree node, pull the init_data from there using of_get_regulator_init_data.
--- drivers/regulator/ad5398.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/regulator/ad5398.c +9 -3
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <linux/regulator/of_regulator.h> #define AD5398_CURRENT_EN_MASK 0x8000
@@ -221,15 +222,20 @@ static int ad5398_probe(struct i2c_client *client,const struct ad5398_current_data_format *df = (struct ad5398_current_data_format *)id->driver_data; -if (!init_data) -return -EINVAL ; - chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ; config.dev = &client->dev; +if (client->dev.of_node) + init_data =of_get_regulator_init_data (&client->dev, + client->dev.of_node, + &ad5398_reg); +if (!init_data) +return -EINVAL ; + config.init_data = init_data; + config.of_node = client->dev.of_node; config.driver_data = chip; chip->client = client;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 209/212 wifi: ath9k: return by of_get_mac_address
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit dfffb317519f88534bb82797f055f0a2fd867e7b ]
When using nvmem, ath9k could potentially be loaded before nvmem, which loads after mtd. This is an issue if DT contains an nvmem mac address.
If nvmem is not ready in time for ath9k, -EPROBE_DEFER is returned. Pass it to _probe so that ath9k can properly grab a potentially present MAC address.
--- drivers/net/wireless/ath/ath9k/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/init.c +3 -1
@@ -691,7 +691,9 @@ static int ath9k_of_init(struct ath_softc *sc) ah->ah_flags |=AH_NO_EEP_SWAP ; } -of_get_mac_address (np, common->macaddr); + ret =of_get_mac_address (np, common->macaddr); +if (ret == -EPROBE_DEFER ) +return ret;return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 210/212 drm/atomic: clarify the rules around drm_atomic_state->allow_modeset
In reply to Sasha LevinFrom: Simona Vetter <[email protected]>
[ Upstream commit c5e3306a424b52e38ad2c28c7f3399fcd03e383d ]
msm is automagically upgrading normal commits to full modesets, and that's a big no-no:
- for one this results in full on->off->on transitions on all these crtc, at least if you're using the usual helpers. Which seems to be the case, and is breaking uapi
- further even if the ctm change itself would not result in flicker, this can hide modesets for other reasons. Which again breaks the uapi
v2: I forgot the case of adding unrelated crtc state. Add that case and link to the existing kerneldoc explainers. This has come up in an irc discussion with Manasi and Ville about intel's bigjoiner mode. Also cc everyone involved in the msm irc discussion, more people joined after I sent out v1.
v3: Wording polish from Pekka and Thomas
--- include/drm/drm_atomic.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
include/drm/drm_atomic.h +21 -2
@@ -372,8 +372,27 @@ struct drm_atomic_state {* * Allow full modeset. This is used by the ATOMIC IOCTL handler to * implement the DRM_MODE_ATOMIC_ALLOW_MODESET flag. Drivers should -* never consult this flag, instead looking at the output of -* drm_atomic_crtc_needs_modeset(). +* generally not consult this flag, but instead look at the output of +* drm_atomic_crtc_needs_modeset(). The detailed rules are: +* +* - Drivers must not consult @allow_modeset in the atomic commit path. +* Use drm_atomic_crtc_needs_modeset() instead. +* +* - Drivers must consult @allow_modeset before adding unrelated struct +* drm_crtc_state to this commit by calling +* drm_atomic_get_crtc_state(). See also the warning in the +* documentation for that function. +* +* - Drivers must never change this flag, it is under the exclusive +* control of userspace. +* +* - Drivers may consult @allow_modeset in the atomic check path, if +* they have the choice between an optimal hardware configuration +* which requires a modeset, and a less optimal configuration which +* can be committed without a modeset. An example would be suboptimal +* scanout FIFO allocation resulting in increased idle power +* consumption. This allows userspace to avoid flickering and delays +* for the normal composition loop at reasonable cost. */ bool allow_modeset : 1;/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 211/212 drm/panel-edp: Add Starry 116KHD024006
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 749b5b279e5636cdcef51e15d67b77162cca6caa ]
We have a few reports of sc7180-trogdor-pompom devices that have a panel in them that IDs as STA 0x0004 and has the following raw EDID:
00 ff ff ff ff ff ff 00 4e 81 04 00 00 00 00 00 10 20 01 04 a5 1a 0e 78 0a dc dd 96 5b 5b 91 28 1f 52 54 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 8e 1c 56 a0 50 00 1e 30 28 20 55 00 00 90 10 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fe 00 31 31 36 4b 48 44 30 32 34 30 30 36 0a 00 e6
We've been unable to locate a datasheet for this panel and our partner has not been responsive, but all Starry eDP datasheets that we can find agree on the same timing (delay_100_500_e200) so it should be safe to use that here instead of the super conservative timings. We'll still go a little extra conservative and allow hpd_absent of 200 instead of 100 because that won't add any real-world delay in most cases.
We'll associate the string from the EDID ("116KHD024006") with this panel. Given that the ID is the suspicious value of 0x0004 it seems likely that Starry doesn't always update their IDs but the string will still work to differentiate if we ever need to in the future.
--- drivers/gpu/drm/panel/panel-edp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-edp.c +1 -0
@@ -1944,6 +1944,7 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('S' ,'H' ,'P' ,0x1523 , &sharp_lq140m1jw46.delay,"LQ140M1JW46" ),EDP_PANEL_ENTRY ('S' ,'H' ,'P' ,0x154c , &delay_200_500_p2e100,"LQ116M1JW10" ), +EDP_PANEL_ENTRY ('S' ,'T' ,'A' ,0x0004 , &delay_200_500_e200,"116KHD024006" ), EDP_PANEL_ENTRY('S', 'T', 'A', 0x0100, &delay_100_500_e200, "2081116HHD028001-51D"), { /* sentinal */ }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 212/212 drm: Add valid clones check
In reply to Sasha LevinFrom: Jessica Zhang <[email protected]>
[ Upstream commit 41b4b11da02157c7474caf41d56baae0e941d01a ]
Check that all encoders attached to a given CRTC are valid possible_clones of each other.
--- drivers/gpu/drm/drm_atomic_helper.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +28 -0
@@ -573,6 +573,30 @@ mode_valid(struct drm_atomic_state *state)return 0 ; } +static int drm_atomic_check_valid_clones (struct drm_atomic_state *state, +struct drm_crtc *crtc) +{ +struct drm_encoder *drm_enc; +struct drm_crtc_state *crtc_state =drm_atomic_get_new_crtc_state (state, + crtc); + +drm_for_each_encoder_mask (drm_enc, crtc->dev, crtc_state->encoder_mask) { +if (!drm_enc->possible_clones) { +DRM_DEBUG ("enc%d possible_clones is 0\n" , drm_enc->base.id); +continue ; + } + +if ((crtc_state->encoder_mask & drm_enc->possible_clones) != + crtc_state->encoder_mask) { +DRM_DEBUG ("crtc%d failed valid clone check for mask 0x%x\n" , + crtc->base.id, crtc_state->encoder_mask); +return -EINVAL ; + } + } + +return 0 ; +} +/** * drm_atomic_helper_check_modeset - validate state object for modeset changes * @dev: DRM device
@@ -744,6 +768,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, ret =drm_atomic_add_affected_planes (state, crtc);if (ret !=0 )return ret; + + ret =drm_atomic_check_valid_clones (state, crtc); +if (ret !=0 ) +return ret; }/*
Signature · 1 line
2.39.5