6.6.44-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 289/568 nvmem: rockchip-otp: set add_legacy_fixed_of_cells config option
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 2933e79db3c00a8cdc56f6bb050a857fec1875ad ]
The Rockchip OTP describes its layout via devicetree subnodes, so set the appropriate property.
--- drivers/nvmem/rockchip-otp.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvmem/rockchip-otp.c +1 -0
@@ -255,6 +255,7 @@ static int rockchip_otp_read(void *context, unsigned int offset,static struct nvmem_config otp_config = { .name ="rockchip-otp" , .owner =THIS_MODULE , + .add_legacy_fixed_of_cells = true, .read_only = true, .stride =1 , .word_size =1 ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 290/568 crypto: qat - extend scope of lock in adf_cfg_add_key_value_param()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nivas Varadharajan Mugunthakumar <[email protected]>
[ Upstream commit 6424da7d8b938fe66e7e771eaa949bc7b6c29c00 ]
The function adf_cfg_add_key_value_param() attempts to access and modify the key value store of the driver without locking.
Extend the scope of cfg->lock to avoid a potential race condition.
--- drivers/crypto/intel/qat/qat_common/adf_cfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_cfg.c +4 -2
@@ -290,17 +290,19 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,* 3. if the key exists with the same value, then return without doing * anything (the newly created key_val is freed). */ +down_write (&cfg->lock);if (!adf_cfg_key_val_get (accel_dev, section_name, key, temp_val)) {if (strncmp (temp_val, key_val->val,sizeof (temp_val))) {adf_cfg_keyval_remove (key, section); }else {kfree (key_val); -return 0 ; + goto out; } } -down_write (&cfg->lock);adf_cfg_keyval_add (key_val, section); + +out:up_write (&cfg->lock);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 291/568 clk: qcom: kpss-xcc: Return of_clk_add_hw_provider to transfer the error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 9db4585eca22fcd0422a94ac792f87dcbf74b643 ]
Return of_clk_add_hw_provider() in order to transfer the error if it fails.
--- drivers/clk/qcom/kpss-xcc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clk/qcom/kpss-xcc.c +1 -3
@@ -63,9 +63,7 @@ static int kpss_xcc_driver_probe(struct platform_device *pdev)if (IS_ERR (hw))return PTR_ERR (hw); -of_clk_add_hw_provider (dev->of_node, of_clk_hw_simple_get, hw); - -return 0 ; +return of_clk_add_hw_provider (dev->of_node, of_clk_hw_simple_get, hw); }static struct platform_driver kpss_xcc_driver = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 292/568 clk: qcom: Park shared RCGs upon registration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
[ Upstream commit 01a0a6cc8cfd9952e72677d48d56cf6bc4e3a561 ]
There's two problems with shared RCGs.
The first problem is that they incorrectly report the parent after commit 703db1f5da1e ("clk: qcom: rcg2: Cache CFG register updates for parked RCGs"). That's because the cached CFG register value needs to be populated when the clk is registered. clk_rcg2_shared_enable() writes the cached CFG register value 'parked_cfg'. This value is initially zero due to static initializers. If a driver calls clk_enable() before setting a rate or parent, it will set the parent to '0' which is (almost?) always XO, and may not reflect the parent at registration. In the worst case, this switches the RCG from sourcing a fast PLL to the slow crystal speed.
The second problem is that the force enable bit isn't cleared. The force enable bit is only used during parking and unparking of shared RCGs. Otherwise it shouldn't be set because it keeps the RCG enabled even when all the branches on the output of the RCG are disabled (the hardware has a feedback mechanism so that any child branches keep the RCG enabled when the branch enable bit is set). This problem wastes power if the clk is unused, and is harmful in the case that the clk framework disables the parent of the force enabled RCG. In the latter case, the GDSC the shared RCG is associated with will get wedged if the RCG's source clk is disabled and the GDSC tries to enable the RCG to do "housekeeping" while powering on.
Both of these problems combined with incorrect runtime PM usage in the display driver lead to a black screen on Qualcomm sc7180 Trogdor chromebooks. What happens is that the bootloader leaves the 'disp_cc_mdss_rot_clk' enabled and the 'disp_cc_mdss_rot_clk_src' force enabled and parented to 'disp_cc_pll0'. The mdss driver probes and runtime suspends, disabling the mdss_gdsc which uses the 'disp_cc_mdss_rot_clk_src' for "housekeeping". The 'disp_cc_mdss_rot_clk' is disabled during late init because the clk is unused, but the parent 'disp_cc_mdss_rot_clk_src' is still force enabled because the force enable bit was never cleared. Then 'disp_cc_pll0' is disabled because it is also unused. That's because the clk framework believes the parent of the RCG is XO when it isn't. A child device of the mdss device (e.g. DSI) runtime resumes mdss which powers on the mdss_gdsc. This wedges the GDSC because 'disp_cc_mdss_rot_clk_src' is parented to 'disp_cc_pll0' and that PLL is off. With the GDSC wedged, mdss_runtime_resume() tries to enable 'disp_cc_mdss_mdp_clk' but it can't because the GDSC has wedged all the clks associated with the GDSC causing clks to stay stuck off.
This leads to the following warning seen at boot and a black screen because the display driver fails to probe.
disp_cc_mdss_mdp_clk status stuck at 'off'
WARNING: CPU: 1 PID: 81 at drivers/clk/qcom/clk-branch.c:87 clk_branch_toggle+0x114/0x168 Modules linked in: CPU: 1 PID: 81 Comm: kworker/u16:4 Not tainted 6.7.0-g0dd3ee311255 #1 f5757d475795053fd2ad52247a070cd50dd046f2 Hardware name: Google Lazor (rev1 - 2) with LTE (DT) Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : clk_branch_toggle+0x114/0x168 lr : clk_branch_toggle+0x110/0x168 sp : ffffffc08084b670 pmr_save: 00000060 x29: ffffffc08084b680 x28: ffffff808006de00 x27: 0000000000000001 x26: ffffff8080dbd4f4 x25: 0000000000000000 x24: 0000000000000000 x23: 0000000000000000 x22: ffffffd838461198 x21: ffffffd838007997 x20: ffffffd837541d5c x19: 0000000000000001 x18: 0000000000000004 x17: 0000000000000000 x16: 0000000000000010 x15: ffffffd837070fac x14: 0000000000000003 x13: 0000000000000004 x12: 0000000000000001 x11: c0000000ffffdfff x10: ffffffd838347aa0 x9 : 08dadf92e516c000 x8 : 08dadf92e516c000 x7 : 0000000000000000 x6 : 0000000000000027 x5 : ffffffd8385a61f2 x4 : 0000000000000000 x3 : ffffffc08084b398 x2 : ffffffc08084b3a0 x1 : 00000000ffffdfff x0 : 00000000fffffff0 Call trace: clk_branch_toggle+0x114/0x168 clk_branch2_enable+0x24/0x30 clk_core_enable+0x5c/0x1c8 clk_enable+0x38/0x58 clk_bulk_enable+0x40/0xb0 mdss_runtime_resume+0x68/0x258 pm_generic_runtime_resume+0x30/0x44 __genpd_runtime_resume+0x30/0x80 genpd_runtime_resume+0x124/0x214 __rpm_callback+0x7c/0x15c rpm_callback+0x30/0x88 rpm_resume+0x390/0x4d8 rpm_resume+0x43c/0x4d8 __pm_runtime_resume+0x54/0x98 __device_attach+0xe0/0x170 device_initial_probe+0x1c/0x28 bus_probe_device+0x48/0xa4 device_add+0x52c/0x6fc mipi_dsi_device_register_full+0x104/0x1a8 devm_mipi_dsi_device_register_full+0x28/0x78 ti_sn_bridge_probe+0x1dc/0x2bc auxiliary_bus_probe+0x4c/0x94 really_probe+0xf8/0x270 __driver_probe_device+0xa8/0x130 driver_probe_device+0x44/0x104 __device_attach_driver+0xa4/0xcc bus_for_each_drv+0x94/0xe8 __device_attach+0xf8/0x170 device_initial_probe+0x1c/0x28 bus_probe_device+0x48/0xa4 deferred_probe_work_func+0x9c/0xd8
Fix these problems by parking shared RCGs at boot. This will properly initialize the parked_cfg struct member so that the parent is reported properly and ensure that the clk won't get stuck on or off because the RCG is parented to the safe source (XO).
--- drivers/clk/qcom/clk-rcg2.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/clk/qcom/clk-rcg2.c +32 -0
@@ -1138,7 +1138,39 @@ clk_rcg2_shared_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)return clk_rcg2_recalc_rate (hw, parent_rate); } +static int clk_rcg2_shared_init (struct clk_hw *hw) +{ +/* +* This does a few things: +* +* 1. Sets rcg->parked_cfg to reflect the value at probe so that the +* proper parent is reported from clk_rcg2_shared_get_parent(). +* +* 2. Clears the force enable bit of the RCG because we rely on child +* clks (branches) to turn the RCG on/off with a hardware feedback +* mechanism and only set the force enable bit in the RCG when we +* want to make sure the clk stays on for parent switches or +* parking. +* +* 3. Parks shared RCGs on the safe source at registration because we +* can't be certain that the parent clk will stay on during boot, +* especially if the parent is shared. If this RCG is enabled at +* boot, and the parent is turned off, the RCG will get stuck on. A +* GDSC can wedge if is turned on and the RCG is stuck on because +* the GDSC's controller will hang waiting for the clk status to +* toggle on when it never does. +* +* The safest option here is to "park" the RCG at init so that the clk +* can never get stuck on or off. This ensures the GDSC can't get +* wedged. +*/ +clk_rcg2_shared_disable (hw); + +return 0 ; +} +const struct clk_ops clk_rcg2_shared_ops = { + .init = clk_rcg2_shared_init, .enable = clk_rcg2_shared_enable, .disable = clk_rcg2_shared_disable, .get_parent = clk_rcg2_shared_get_parent,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 293/568 clk: en7523: fix rate divider for slic and spi clocks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 58c53d43142f222221e5a76a7016c4d8f3b84b97 ]
Introduce div_offset field in en_clk_desc struct in order to fix rate divider estimation in en7523_get_div routine for slic and spi fixed rate clocks.
Moreover, fix base_shift for crypto clock.
--- drivers/clk/clk-en7523.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/clk/clk-en7523.c +7 -2
@@ -40,6 +40,7 @@ struct en_clk_desc {u8 div_shift;u16 div_val0;u8 div_step; +u8 div_offset; };struct en_clk_gate {
@@ -67,6 +68,7 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_EMI, .name = "emi",
@@ -80,6 +82,7 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_BUS, .name = "bus",
@@ -93,6 +96,7 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_SLIC, .name = "slic",
@@ -133,13 +137,14 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_CRYPTO, .name = "crypto", .base_reg = REG_CRYPTO_CLKSRC, .base_bits = 1, - .base_shift = 8, + .base_shift = 0, .base_values = emi_base, .n_base_values = ARRAY_SIZE(emi_base), }
@@ -184,7 +189,7 @@ static u32 en7523_get_div(void __iomem *base, int i)if (!val && desc->div_val0)return desc->div_val0; -return (val +1 ) * desc->div_step; +return (val + desc->div_offset) * desc->div_step; }static int en7523_pci_is_enabled (struct clk_hw *hw)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 294/568 MIPS: Octeron: remove source file executable bit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
[ Upstream commit 89c7f5078935872cf47a713a645affb5037be694 ]
This does not matter the least, but there is no other .[ch] file in the repo that is executable, so clean this up.
--- arch/mips/pci/pcie-octeon.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 arch/mips/pci/pcie-octeon.c
arch/mips/pci/pcie-octeon.c +0 -0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 295/568 PCI: qcom-ep: Disable resources unconditionally during PERST# assert
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 912315715d7b74f7abdb6f063ebace44ee288af9 ]
All EP specific resources are enabled during PERST# deassert. As a counter operation, all resources should be disabled during PERST# assert. There is no point in skipping that if the link was not enabled.
This will also result in enablement of the resources twice if PERST# got deasserted again. So remove the check from qcom_pcie_perst_assert() and disable all the resources unconditionally.
--- drivers/pci/controller/dwc/pcie-qcom-ep.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pci/controller/dwc/pcie-qcom-ep.c +0 -6
@@ -519,12 +519,6 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci)static void qcom_pcie_perst_assert (struct dw_pcie *pci) {struct qcom_pcie_ep *pcie_ep =to_pcie_ep (pci); -struct device *dev = pci->dev; - -if (pcie_ep->link_status ==QCOM_PCIE_EP_LINK_DISABLED ) { -dev_dbg (dev,"Link is already disabled\n" ); -return ; - }qcom_pcie_disable_resources (pcie_ep); pcie_ep->link_status =QCOM_PCIE_EP_LINK_DISABLED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 296/568 PCI: dwc: Fix index 0 incorrectly being interpreted as a free ATU slot
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit c2a57ee0f2f1ad8c970ff58b78a43e85abbdeb7f ]
When PERST# assert and deassert happens on the PERST# supported platforms, both iATU0 and iATU6 will map inbound window to BAR0. DMA will access the area that was previously allocated (iATU0) for BAR0, instead of the new area (iATU6) for BAR0.
Right now, this isn't an issue because both iATU0 and iATU6 should translate inbound accesses to BAR0 to the same allocated memory area. However, having two separate inbound mappings for the same BAR is a disaster waiting to happen.
The mappings between PCI BAR and iATU inbound window are maintained in the dw_pcie_ep::bar_to_atu[] array. While allocating a new inbound iATU map for a BAR, dw_pcie_ep_inbound_atu() API checks for the availability of the existing mapping in the array and if it is not found (i.e., value in the array indexed by the BAR is found to be 0), it allocates a new map value using find_first_zero_bit().
The issue is the existing logic failed to consider the fact that the map value '0' is a valid value for BAR0, so find_first_zero_bit() will return '0' as the map value for BAR0 (note that it returns the first zero bit position).
Due to this, when PERST# assert + deassert happens on the PERST# supported platforms, the inbound window allocation restarts from BAR0 and the existing logic to find the BAR mapping will return '6' for BAR0 instead of '0' due to the fact that it considers '0' as an invalid map value.
Fix this issue by always incrementing the map value before assigning to bar_to_atu[] array and then decrementing it while fetching. This will make sure that the map value '0' always represents the invalid mapping."
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +10 -3
@@ -163,7 +163,7 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,if (!ep->bar_to_atu[bar]) free_win =find_first_zero_bit (ep->ib_window_map, pci->num_ib_windows);else - free_win = ep->bar_to_atu[bar]; + free_win = ep->bar_to_atu[bar] -1 ;if (free_win >= pci->num_ib_windows) {dev_err (pci->dev,"No free inbound window\n" );
@@ -177,7 +177,11 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,return ret; } - ep->bar_to_atu[bar] = free_win; +/* +* Always increment free_win before assignment, since value 0 is used to identify +* unallocated mapping. +*/ + ep->bar_to_atu[bar] = free_win +1 ;set_bit (free_win, ep->ib_window_map);return 0 ;
@@ -214,7 +218,10 @@ static void dw_pcie_ep_clear_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,struct dw_pcie_ep *ep =epc_get_drvdata (epc);struct dw_pcie *pci =to_dw_pcie_from_ep (ep);enum pci_barno bar = epf_bar->barno; -u32 atu_index = ep->bar_to_atu[bar]; +u32 atu_index = ep->bar_to_atu[bar] -1 ; + +if (!ep->bar_to_atu[bar]) +return ;__dw_pcie_ep_reset_bar (pci, func_no, bar, epf_bar->flags);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 297/568 powerpc/xmon: Fix disassembly CPU feature checks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 14196e47c5ffe32af7ed5a51c9e421c5ea5bccce ]
In the xmon disassembly code there are several CPU feature checks to determine what dialects should be passed to the disassembler. The dialect controls which instructions the disassembler will recognise.
Unfortunately the checks are incorrect, because instead of passing a single CPU feature they are passing a mask of feature bits.
For example the code:
if (cpu_has_feature(CPU_FTRS_POWER5))
dialect |= PPC_OPCODE_POWER5;Is trying to check if the system is running on a Power5 CPU. But CPU_FTRS_POWER5 is a mask of *all* the feature bits that are enabled on a Power5.
In practice the test will always return true for any 64-bit CPU, because at least one bit in the mask will be present in the CPU_FTRS_ALWAYS mask.
Similarly for all the other checks against CPU_FTRS_xx masks.
Rather than trying to match the disassembly behaviour exactly to the current CPU, just differentiate between 32-bit and 64-bit, and Altivec, VSX and HTM.
That will cause some instructions to be shown in disassembly even on a CPU that doesn't support them, but that's OK, objdump -d output has the same behaviour, and if anything it's less confusing than some instructions not being disassembled.
--- arch/powerpc/xmon/ppc-dis.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-)
arch/powerpc/xmon/ppc-dis.c +11 -22
@@ -122,32 +122,21 @@ int print_insn_powerpc (unsigned long insn, unsigned long memaddr)bool insn_is_short;ppc_cpu_t dialect; - dialect =PPC_OPCODE_PPC |PPC_OPCODE_COMMON - |PPC_OPCODE_64 |PPC_OPCODE_POWER4 |PPC_OPCODE_ALTIVEC ; + dialect =PPC_OPCODE_PPC |PPC_OPCODE_COMMON ; -if (cpu_has_feature (CPU_FTRS_POWER5 )) - dialect |=PPC_OPCODE_POWER5 ; +if (IS_ENABLED (CONFIG_PPC64 )) + dialect |=PPC_OPCODE_64 |PPC_OPCODE_POWER4 |PPC_OPCODE_CELL | +PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 |PPC_OPCODE_POWER8 | +PPC_OPCODE_POWER9 ; -if (cpu_has_feature (CPU_FTRS_CELL )) - dialect |= (PPC_OPCODE_CELL |PPC_OPCODE_ALTIVEC ); +if (cpu_has_feature (CPU_FTR_TM )) + dialect |=PPC_OPCODE_HTM ; -if (cpu_has_feature (CPU_FTRS_POWER6 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_ALTIVEC ); +if (cpu_has_feature (CPU_FTR_ALTIVEC )) + dialect |=PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 ; -if (cpu_has_feature (CPU_FTRS_POWER7 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 - |PPC_OPCODE_ALTIVEC |PPC_OPCODE_VSX ); - -if (cpu_has_feature (CPU_FTRS_POWER8 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 - |PPC_OPCODE_POWER8 |PPC_OPCODE_HTM - |PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 |PPC_OPCODE_VSX ); - -if (cpu_has_feature (CPU_FTRS_POWER9 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 - |PPC_OPCODE_POWER8 |PPC_OPCODE_POWER9 |PPC_OPCODE_HTM - |PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 - |PPC_OPCODE_VSX |PPC_OPCODE_VSX3 ); +if (cpu_has_feature (CPU_FTR_VSX )) + dialect |=PPC_OPCODE_VSX |PPC_OPCODE_VSX3 ;/* Get the major opcode of the insn. */ opcode =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 298/568 macintosh/therm_windtunnel: fix module unload.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Bowler <[email protected]>
[ Upstream commit fd748e177194ebcbbaf98df75152a30e08230cc6 ]
The of_device_unregister call in therm_windtunnel's module_exit procedure does not fully reverse the effects of of_platform_device_create in the module_init prodedure. Once you unload this module, it is impossible to load it ever again since only the first of_platform_device_create call on the fan node succeeds.
This driver predates first git commit, and it turns out back then of_platform_device_create worked differently than it does today. So this is actually an old regression.
The appropriate function to undo of_platform_device_create now appears to be of_platform_device_destroy, and switching to use this makes it possible to unload and load the module as expected.
--- drivers/macintosh/therm_windtunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/therm_windtunnel.c +1 -1
@@ -551,7 +551,7 @@ g4fan_exit( void )platform_driver_unregister ( &therm_of_driver );if ( x.of_dev ) -of_device_unregister ( x.of_dev ); +of_platform_device_destroy (&x.of_dev->dev,NULL ); }module_init (g4fan_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 299/568 RDMA/hns: Check atomic wr length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 6afa2c0bfb8ef69f65715ae059e5bd5f9bbaf03b ]
8 bytes is the only supported length of atomic. Add this check in set_rc_wqe(). Besides, stop processing WQEs and return from set_rc_wqe() if there is any error.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 2 ++ drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +2 -0
@@ -90,6 +90,8 @@/* Configure to HW for PAGE_SIZE larger than 4KB */ #define PG_SHIFT_OFFSET (PAGE_SHIFT - 12) +#define ATOMIC_WR_LEN 8 +#define HNS_ROCE_IDX_QUE_ENTRY_SZ 4#define SRQ_DB_REG 0x230
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +7 -2
@@ -595,11 +595,16 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp, (wr->send_flags & IB_SEND_SIGNALED) ? 1 : 0);if (wr->opcode ==IB_WR_ATOMIC_CMP_AND_SWP || - wr->opcode ==IB_WR_ATOMIC_FETCH_AND_ADD ) + wr->opcode ==IB_WR_ATOMIC_FETCH_AND_ADD ) { +if (msg_len !=ATOMIC_WR_LEN ) +return -EINVAL ;set_atomic_seg (wr, rc_sq_wqe, valid_num_sge); -else if (wr->opcode !=IB_WR_REG_MR ) + }else if (wr->opcode !=IB_WR_REG_MR ) { ret =set_rwqe_data_seg (&qp->ibqp, wr, rc_sq_wqe, &curr_idx, valid_num_sge); +if (ret) +return ret; + }/* * The pipeline can sequentially post all valid WQEs into WQ buffer,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 300/568 RDMA/hns: Fix unmatch exception handling when init eq table fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 543fb987bd63ed27409b5dea3d3eec27b9c1eac9 ]
The hw ctx should be destroyed when init eq table fails.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +13 -12
@@ -6261,9 +6261,16 @@ static void hns_roce_v2_int_mask_enable(struct hns_roce_dev *hr_dev,roce_write (hr_dev,ROCEE_VF_ABN_INT_CFG_REG , enable_flag); } -static void hns_roce_v2_destroy_eqc (struct hns_roce_dev *hr_dev,u32 eqn) +static void free_eq_buf (struct hns_roce_dev *hr_dev,struct hns_roce_eq *eq) +{ +hns_roce_mtr_destroy (hr_dev, &eq->mtr); +} + +static void hns_roce_v2_destroy_eqc (struct hns_roce_dev *hr_dev, +struct hns_roce_eq *eq) {struct device *dev = hr_dev->dev; +int eqn = eq->eqn;int ret;u8 cmd;
@@ -6274,12 +6281,9 @@ static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn) ret =hns_roce_destroy_hw_ctx (hr_dev, cmd, eqn &HNS_ROCE_V2_EQN_M );if (ret) -dev_err (dev,"[mailbox cmd] destroy eqc(%u) failed.\n" , eqn); -} +dev_err (dev,"[mailbox cmd] destroy eqc(%d) failed.\n" , eqn); -static void free_eq_buf (struct hns_roce_dev *hr_dev,struct hns_roce_eq *eq) -{ -hns_roce_mtr_destroy (hr_dev, &eq->mtr); +free_eq_buf (hr_dev, eq); }static void init_eq_config (struct hns_roce_dev *hr_dev,struct hns_roce_eq *eq)
@@ -6585,7 +6589,7 @@ static int hns_roce_v2_init_eq_table(struct hns_roce_dev *hr_dev) err_create_eq_fail:for (i -=1 ; i >=0 ; i--) -free_eq_buf (hr_dev, &eq_table->eq[i]); +hns_roce_v2_destroy_eqc (hr_dev, &eq_table->eq[i]);kfree (eq_table->eq);return ret;
@@ -6605,11 +6609,8 @@ static void hns_roce_v2_cleanup_eq_table(struct hns_roce_dev *hr_dev)__hns_roce_free_irq (hr_dev);destroy_workqueue (hr_dev->irq_workq); -for (i =0 ; i < eq_num; i++) { -hns_roce_v2_destroy_eqc (hr_dev, i); - -free_eq_buf (hr_dev, &eq_table->eq[i]); - } +for (i =0 ; i < eq_num; i++) +hns_roce_v2_destroy_eqc (hr_dev, &eq_table->eq[i]);kfree (eq_table->eq); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 301/568 RDMA/hns: Fix missing pagesize and alignment check in FRMR
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit d387d4b54eb84208bd4ca13572e106851d0a0819 ]
The offset requires 128B alignment and the page size ranges from 4K to 128M.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 4 ++++ drivers/infiniband/hw/hns/hns_roce_mr.c | 5 +++++ 2 files changed, 9 insertions(+)
drivers/infiniband/hw/hns/hns_roce_device.h +4 -0
@@ -82,6 +82,7 @@#define MR_TYPE_DMA 0x03#define HNS_ROCE_FRMR_MAX_PA 512 +#define HNS_ROCE_FRMR_ALIGN_SIZE 128#define PKEY_ID 0xffff#define NODE_DESC_SIZE 64
@@ -183,6 +184,9 @@ enum {#define HNS_HW_PAGE_SHIFT 12#define HNS_HW_PAGE_SIZE (1 << HNS_HW_PAGE_SHIFT) +#define HNS_HW_MAX_PAGE_SHIFT 27 +#define HNS_HW_MAX_PAGE_SIZE (1 << HNS_HW_MAX_PAGE_SHIFT) +struct hns_roce_uar {u64 pfn;unsigned long index;
drivers/infiniband/hw/hns/hns_roce_mr.c +5 -0
@@ -423,6 +423,11 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,struct hns_roce_mtr *mtr = &mr->pbl_mtr;int ret, sg_num =0 ; +if (!IS_ALIGNED (*sg_offset,HNS_ROCE_FRMR_ALIGN_SIZE ) || + ibmr->page_size <HNS_HW_PAGE_SIZE || + ibmr->page_size >HNS_HW_MAX_PAGE_SIZE ) +return sg_num; + mr->npages =0 ; mr->page_list =kvcalloc (mr->pbl_mtr.hem_cfg.buf_pg_count,sizeof (dma_addr_t),GFP_KERNEL );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 302/568 RDMA/hns: Fix shift-out-bounds when max_inline_data is 0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 24c6291346d98c7ece4f4bfeb5733bec1d6c7b4f ]
A shift-out-bounds may occur, if the max_inline_data has not been set.
The related log:
UBSAN: shift-out-of-bounds in kernel/include/linux/log2.h:57:13 shift exponent 64 is too large for 64-bit type 'long unsigned int' Call trace: dump_backtrace+0xb0/0x118 show_stack+0x20/0x38 dump_stack_lvl+0xbc/0x120 dump_stack+0x1c/0x28 __ubsan_handle_shift_out_of_bounds+0x104/0x240 set_ext_sge_param+0x40c/0x420 [hns_roce_hw_v2] hns_roce_create_qp+0xf48/0x1c40 [hns_roce_hw_v2] create_qp.part.0+0x294/0x3c0 ib_create_qp_kernel+0x7c/0x150 create_mad_qp+0x11c/0x1e0 ib_mad_init_device+0x834/0xc88 add_client_context+0x248/0x318 enable_device_and_get+0x158/0x280 ib_register_device+0x4ac/0x610 hns_roce_init+0x890/0xf98 [hns_roce_hw_v2] __hns_roce_hw_v2_init_instance+0x398/0x720 [hns_roce_hw_v2] hns_roce_hw_v2_init_instance+0x108/0x1e0 [hns_roce_hw_v2] hclge_init_roce_client_instance+0x1a0/0x358 [hclge] hclge_init_client_instance+0xa0/0x508 [hclge] hnae3_register_client+0x18c/0x210 [hnae3] hns_roce_hw_v2_init+0x28/0xff8 [hns_roce_hw_v2] do_one_initcall+0xe0/0x510 do_init_module+0x110/0x370 load_module+0x2c6c/0x2f20 init_module_from_file+0xe0/0x140 idempotent_init_module+0x24c/0x350 __arm64_sys_finit_module+0x88/0xf8 invoke_syscall+0x68/0x1a0 el0_svc_common.constprop.0+0x11c/0x150 do_el0_svc+0x38/0x50 el0_svc+0x50/0xa0 el0t_64_sync_handler+0xc0/0xc8 el0t_64_sync+0x1a4/0x1a8
--- drivers/infiniband/hw/hns/hns_roce_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_qp.c +3 -1
@@ -531,13 +531,15 @@ static unsigned int get_sge_num_from_max_inl_data(bool is_ud_or_gsi, {unsigned int inline_sge; - inline_sge =roundup_pow_of_two (max_inline_data) /HNS_ROCE_SGE_SIZE ; +if (!max_inline_data) +return 0 ;/* * if max_inline_data less than * HNS_ROCE_SGE_IN_WQE * HNS_ROCE_SGE_SIZE, * In addition to ud's mode, no need to extend sge. */ + inline_sge =roundup_pow_of_two (max_inline_data) /HNS_ROCE_SGE_SIZE ;if (!is_ud_or_gsi && inline_sge <=HNS_ROCE_SGE_IN_WQE ) inline_sge =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 303/568 RDMA/hns: Fix undifined behavior caused by invalid max_sge
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 36397b907355e2fdb5a25a02a7921a937fd8ef4c ]
If max_sge has been set to 0, roundup_pow_of_two() in set_srq_basic_param() may have undefined behavior.
--- drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_srq.c +1 -1
@@ -296,7 +296,7 @@ static int set_srq_basic_param(struct hns_roce_srq *srq, max_sge =proc_srq_sge (hr_dev, srq, !!udata);if (attr->max_wr > hr_dev->caps.max_srq_wrs || - attr->max_sge > max_sge) { + attr->max_sge > max_sge || !attr->max_sge) {ibdev_err (&hr_dev->ib_dev,"invalid SRQ attr, depth = %u, sge = %u.\n" , attr->max_wr, attr->max_sge);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 304/568 RDMA/hns: Fix insufficient extend DB for VFs.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 0b8e658f70ffd5dc7cda3872fd524d657d4796b7 ]
VFs and its PF will share the memory of the extend DB. Currently, the number of extend DB allocated by driver is only enough for PF. This leads to a probability of DB loss and some other problems in scenarios where both PF and VFs use a large number of QPs.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -2
@@ -2448,14 +2448,16 @@ static int set_llm_cfg_to_hw(struct hns_roce_dev *hr_dev,static struct hns_roce_link_table *alloc_link_table_buf (struct hns_roce_dev *hr_dev) { +u16 total_sl = hr_dev->caps.sl_num * hr_dev->func_num;struct hns_roce_v2_priv *priv = hr_dev->priv;struct hns_roce_link_table *link_tbl;u32 pg_shift, size, min_size; link_tbl = &priv->ext_llm; pg_shift = hr_dev->caps.llm_buf_pg_sz +PAGE_SHIFT ; - size = hr_dev->caps.num_qps *HNS_ROCE_V2_EXT_LLM_ENTRY_SZ ; - min_size =HNS_ROCE_EXT_LLM_MIN_PAGES (hr_dev->caps.sl_num) << pg_shift; + size = hr_dev->caps.num_qps * hr_dev->func_num * +HNS_ROCE_V2_EXT_LLM_ENTRY_SZ ; + min_size =HNS_ROCE_EXT_LLM_MIN_PAGES (total_sl) << pg_shift;/* Alloc data table */ size =max (size, min_size);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 305/568 iommu/vt-d: Fix identity map bounds in si_domain_init()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Pan-Doh <[email protected]>
[ Upstream commit 31000732d56b43765d51e08cccb68818fbc0032c ]
Intel IOMMU operates on inclusive bounds (both generally aas well as iommu_domain_identity_map()). Meanwhile, for_each_mem_pfn_range() uses exclusive bounds for end_pfn. This creates an off-by-one error when switching between the two.
--- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +1 -1
@@ -2411,7 +2411,7 @@ static int __init si_domain_init(int hw)for_each_mem_pfn_range (i, nid, &start_pfn, &end_pfn,NULL ) { ret =iommu_domain_identity_map (si_domain,mm_to_dma_pfn_start (start_pfn), -mm_to_dma_pfn_end (end_pfn)); +mm_to_dma_pfn_end (end_pfn-1 ));if (ret)return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 306/568 RDMA/core: Remove NULL check before dev_{put, hold}
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jules Irenge <[email protected]>
[ Upstream commit 7a1c2abf9a2be7d969b25e8d65567933335ca88e ]
The call netdev_{put, hold} of dev_{put, hold} will check NULL, so there is no need to check before using dev_{put, hold}, remove it to silence the warning:
./drivers/infiniband/core/nldev.c:375:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed.
Stable-dep-of: 2043a14fb3de ("RDMA: Fix netdev tracker in ib_device_set_netdev")
--- drivers/infiniband/core/device.c | 10 +++------- drivers/infiniband/core/lag.c | 3 +-- drivers/infiniband/core/roce_gid_mgmt.c | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-)
drivers/infiniband/core/device.c +3 -7
@@ -2174,8 +2174,7 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,spin_unlock_irqrestore (&pdata->netdev_lock, flags);add_ndev_hash (pdata); -if (old_ndev) -__dev_put (old_ndev); +__dev_put (old_ndev);return 0 ; }
@@ -2235,8 +2234,7 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev,spin_lock (&pdata->netdev_lock); res =rcu_dereference_protected ( pdata->netdev,lockdep_is_held (&pdata->netdev_lock)); -if (res) -dev_hold (res); +dev_hold (res);spin_unlock (&pdata->netdev_lock); }
@@ -2311,9 +2309,7 @@ void ib_enum_roce_netdev(struct ib_device *ib_dev,if (filter (ib_dev, port, idev, filter_cookie))cb (ib_dev, port, idev, cookie); - -if (idev) -dev_put (idev); +dev_put (idev); } }
drivers/infiniband/core/lag.c +1 -2
@@ -93,8 +93,7 @@ static struct net_device *rdma_get_xmit_slave_udp(struct ib_device *device, slave =netdev_get_xmit_slave (master, skb, !!(device->lag_flags &RDMA_LAG_FLAGS_HASH_ALL_SLAVES )); -if (slave) -dev_hold (slave); +dev_hold (slave);rcu_read_unlock ();kfree_skb (skb);return slave;
drivers/infiniband/core/roce_gid_mgmt.c +1 -2
@@ -601,8 +601,7 @@ static void del_netdev_default_ips_join(struct ib_device *ib_dev, u32 port,rcu_read_lock (); master_ndev =netdev_master_upper_dev_get_rcu (rdma_ndev); -if (master_ndev) -dev_hold (master_ndev); +dev_hold (master_ndev);rcu_read_unlock ();if (master_ndev) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 307/568 RDMA: Fix netdev tracker in ib_device_set_netdev
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit 2043a14fb3de9d88440b21590f714306fcbbd55f ]
If a netdev has already been assigned, ib_device_set_netdev needs to release the reference on the older netdev but it is mistakenly being called for the new netdev. Fix it and in the process use netdev_put to be symmetrical with the netdev_hold.
--- drivers/infiniband/core/device.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/infiniband/core/device.c +2 -6
@@ -2166,16 +2166,12 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,return 0 ; } -if (old_ndev) -netdev_tracker_free (ndev, &pdata->netdev_tracker); -if (ndev) -netdev_hold (ndev, &pdata->netdev_tracker,GFP_ATOMIC );rcu_assign_pointer (pdata->netdev, ndev); +netdev_put (old_ndev, &pdata->netdev_tracker); +netdev_hold (ndev, &pdata->netdev_tracker,GFP_ATOMIC );spin_unlock_irqrestore (&pdata->netdev_lock, flags);add_ndev_hash (pdata); -__dev_put (old_ndev); -return 0 ; }EXPORT_SYMBOL (ib_device_set_netdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 308/568 bnxt_re: Fix imm_data endianness
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wang <[email protected]>
[ Upstream commit 95b087f87b780daafad1dbb2c84e81b729d5d33f ]
When map a device between servers with MLX and BCM RoCE nics, RTRS server complain about unknown imm type, and can't map the device,
After more debug, it seems bnxt_re wrongly handle the imm_data, this patch fixed the compat issue with MLX for us.
In off list discussion, Selvin confirmed HW is working in little endian format and all data needs to be converted to LE while providing.
This patch fix the endianness for imm_data
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 ++++---- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 -4
@@ -2467,7 +2467,7 @@ static int bnxt_re_build_send_wqe(struct bnxt_re_qp *qp,break ;case IB_WR_SEND_WITH_IMM : wqe->type =BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM ; - wqe->send.imm_data = wr->ex.imm_data; + wqe->send.imm_data =be32_to_cpu (wr->ex.imm_data);break ;case IB_WR_SEND_WITH_INV : wqe->type =BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV ;
@@ -2497,7 +2497,7 @@ static int bnxt_re_build_rdma_wqe(const struct ib_send_wr *wr,break ;case IB_WR_RDMA_WRITE_WITH_IMM : wqe->type =BNXT_QPLIB_SWQE_TYPE_RDMA_WRITE_WITH_IMM ; - wqe->rdma.imm_data = wr->ex.imm_data; + wqe->rdma.imm_data =be32_to_cpu (wr->ex.imm_data);break ;case IB_WR_RDMA_READ : wqe->type =BNXT_QPLIB_SWQE_TYPE_RDMA_READ ;
@@ -3545,7 +3545,7 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp, wc->byte_len = orig_cqe->length; wc->qp = &gsi_qp->ib_qp; - wc->ex.imm_data = orig_cqe->immdata; + wc->ex.imm_data =cpu_to_be32 (le32_to_cpu (orig_cqe->immdata)); wc->src_qp = orig_cqe->src_qp;memcpy (wc->smac, orig_cqe->smac,ETH_ALEN );if (bnxt_re_is_vlan_pkt (orig_cqe, &vlan_id, &sl)) {
@@ -3690,7 +3690,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) (unsigned long )(cqe->qp_handle), struct bnxt_re_qp, qplib_qp); wc->qp = &qp->ib_qp; - wc->ex.imm_data = cqe->immdata; + wc->ex.imm_data =cpu_to_be32 (le32_to_cpu (cqe->immdata)); wc->src_qp = cqe->src_qp;memcpy (wc->smac, cqe->smac,ETH_ALEN ); wc->port_num =1 ;
drivers/infiniband/hw/bnxt_re/qplib_fp.h +3 -3
@@ -164,7 +164,7 @@ struct bnxt_qplib_swqe {/* Send, with imm, inval key */ struct {union { -__be32 imm_data; +u32 imm_data;u32 inv_key; };u32 q_key;
@@ -182,7 +182,7 @@ struct bnxt_qplib_swqe {/* RDMA write, with imm, read */ struct {union { -__be32 imm_data; +u32 imm_data;u32 inv_key; };u64 remote_va;
@@ -389,7 +389,7 @@ struct bnxt_qplib_cqe {u16 cfa_meta;u64 wr_id;union { -__be32 immdata; +__le32 immdata;u32 invrkey; };u64 qp_handle;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 309/568 netfilter: ctnetlink: use helper function to calculate expect ID
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 782161895eb4ac45cf7cfa8db375bd4766cb8299 ]
Delete expectation path is missing a call to the nf_expect_get_id() helper function to calculate the expectation ID, otherwise LSB of the expectation object address is leaked to userspace.
--- net/netfilter/nf_conntrack_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_netlink.c +2 -1
@@ -3411,7 +3411,8 @@ static int ctnetlink_del_expect(struct sk_buff *skb,if (cda[CTA_EXPECT_ID ]) {__be32 id =nla_get_be32 (cda[CTA_EXPECT_ID ]); -if (ntohl (id) != (u32 )(unsigned long )exp) { + +if (id !=nf_expect_get_id (exp)) {nf_ct_expect_put (exp);return -ENOENT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 310/568 netfilter: nft_set_pipapo: constify lookup fn args where possible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit f04df573faf90bb828a2241b650598c02c074323 ]
Those get called from packet path, content must not be modified. No functional changes intended.
Stable-dep-of: 791a615b7ad2 ("netfilter: nf_set_pipapo: fix initial map fill")
--- net/netfilter/nft_set_pipapo.c | 18 +++++---- net/netfilter/nft_set_pipapo.h | 6 +-- net/netfilter/nft_set_pipapo_avx2.c | 59 +++++++++++++++++------------ 3 files changed, 48 insertions(+), 35 deletions(-)
net/netfilter/nft_set_pipapo.c +10 -8
@@ -360,7 +360,7 @@* Return: -1 on no match, bit position on 'match_only', 0 otherwise. */ int pipapo_refill (unsigned long *map,int len,int rules,unsigned long *dst, -union nft_pipapo_map_bucket *mt,bool match_only) +const union nft_pipapo_map_bucket *mt,bool match_only) {unsigned long bitset;int k, ret =-1 ;
@@ -412,9 +412,9 @@ bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set,struct nft_pipapo_scratch *scratch;unsigned long *res_map, *fill_map;u8 genmask =nft_genmask_cur (net); +const struct nft_pipapo_match *m; +const struct nft_pipapo_field *f;const u8 *rp = (const u8 *)key; -struct nft_pipapo_match *m; -struct nft_pipapo_field *f;bool map_index;int i;
@@ -517,11 +517,13 @@ static struct nft_pipapo_elem *pipapo_get(const struct net *net, {struct nft_pipapo_elem *ret =ERR_PTR (-ENOENT );struct nft_pipapo *priv =nft_set_priv (set); -struct nft_pipapo_match *m = priv->clone;unsigned long *res_map, *fill_map =NULL ; -struct nft_pipapo_field *f; +const struct nft_pipapo_match *m; +const struct nft_pipapo_field *f;int i; + m = priv->clone; + res_map =kmalloc_array (m->bsize_max,sizeof (*res_map),GFP_ATOMIC );if (!res_map) { ret =ERR_PTR (-ENOMEM );
@@ -1590,7 +1592,7 @@ static void pipapo_gc(const struct nft_set *_set, struct nft_pipapo_match *m)while ((rules_f0 =pipapo_rules_same_key (m->f, first_rule))) {union nft_pipapo_map_bucket rulemap[NFT_PIPAPO_MAX_FIELDS ]; -struct nft_pipapo_field *f; +const struct nft_pipapo_field *f;int i, start, rules_fx; start = first_rule;
@@ -2036,8 +2038,8 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set, {struct nft_pipapo *priv =nft_set_priv (set);struct net *net =read_pnet (&set->net); -struct nft_pipapo_match *m; -struct nft_pipapo_field *f; +const struct nft_pipapo_match *m; +const struct nft_pipapo_field *f;int i, r;rcu_read_lock ();
net/netfilter/nft_set_pipapo.h +3 -3
@@ -185,7 +185,7 @@ struct nft_pipapo_elem { };int pipapo_refill (unsigned long *map,int len,int rules,unsigned long *dst, -union nft_pipapo_map_bucket *mt,bool match_only); +const union nft_pipapo_map_bucket *mt,bool match_only);/** * pipapo_and_field_buckets_4bit() - Intersect 4-bit buckets
@@ -193,7 +193,7 @@ int pipapo_refill(unsigned long *map, int len, int rules, unsigned long *dst,* @dst: Area to store result * @data: Input data selecting table buckets */ -static inline void pipapo_and_field_buckets_4bit (struct nft_pipapo_field *f, +static inline void pipapo_and_field_buckets_4bit (const struct nft_pipapo_field *f,unsigned long *dst,const u8 *data) {
@@ -221,7 +221,7 @@ static inline void pipapo_and_field_buckets_4bit(struct nft_pipapo_field *f,* @dst: Area to store result * @data: Input data selecting table buckets */ -static inline void pipapo_and_field_buckets_8bit (struct nft_pipapo_field *f, +static inline void pipapo_and_field_buckets_8bit (const struct nft_pipapo_field *f,unsigned long *dst,const u8 *data) {
net/netfilter/nft_set_pipapo_avx2.c +35 -24
132 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 311/568 netfilter: nf_set_pipapo: fix initial map fill
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 791a615b7ad2258c560f91852be54b0480837c93 ]
The initial buffer has to be inited to all-ones, but it must restrict it to the size of the first field, not the total field size.
After each round in the map search step, the result and the fill map are swapped, so if we have a set where f->bsize of the first element is smaller than m->bsize_max, those one-bits are leaked into future rounds result map.
This makes pipapo find an incorrect matching results for sets where first field size is not the largest.
Followup patch adds a test case to nft_concat_range.sh selftest script.
Thanks to Stefano Brivio for pointing out that we need to zero out the remainder explicitly, only correcting memset() argument isn't enough.
--- net/netfilter/nft_set_pipapo.c | 4 ++-- net/netfilter/nft_set_pipapo.h | 21 +++++++++++++++++++++ net/netfilter/nft_set_pipapo_avx2.c | 10 ++++++---- 3 files changed, 29 insertions(+), 6 deletions(-)
net/netfilter/nft_set_pipapo.c +2 -2
@@ -432,7 +432,7 @@ bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set, res_map = scratch->map + (map_index ? m->bsize_max :0 ); fill_map = scratch->map + (map_index ?0 : m->bsize_max); -memset (res_map,0xff , m->bsize_max *sizeof (*res_map)); +pipapo_resmap_init (m, res_map);nft_pipapo_for_each_field (f, i, m) {bool last = i == m->field_count -1 ;
@@ -536,7 +536,7 @@ static struct nft_pipapo_elem *pipapo_get(const struct net *net, goto out; } -memset (res_map,0xff , m->bsize_max *sizeof (*res_map)); +pipapo_resmap_init (m, res_map);nft_pipapo_for_each_field (f, i, m) {bool last = i == m->field_count -1 ;
net/netfilter/nft_set_pipapo.h +21 -0
@@ -285,4 +285,25 @@ static u64 pipapo_estimate_size(const struct nft_set_desc *desc) return size; } +/** +* pipapo_resmap_init() - Initialise result map before first use +* @m: Matching data, including mapping table +* @res_map: Result map +* +* Initialize all bits covered by the first field to one, so that after +* the first step, only the matching bits of the first bit group remain. +* +* If other fields have a large bitmap, set remainder of res_map to 0. +*/ +static inline void pipapo_resmap_init (const struct nft_pipapo_match *m,unsigned long *res_map) +{ +const struct nft_pipapo_field *f = m->f; +int i; + +for (i =0 ; i < f->bsize; i++) + res_map[i] =ULONG_MAX ; + +for (i = f->bsize; i < m->bsize_max; i++) + res_map[i] =0ul ; +}#endif /* _NFT_SET_PIPAPO_H */
net/netfilter/nft_set_pipapo_avx2.c +6 -4
@@ -1036,6 +1036,7 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,/** * nft_pipapo_avx2_lookup_slow() - Fallback function for uncommon field sizes +* @mdata: Matching data, including mapping table * @map: Previous match result, used as initial bitmap * @fill: Destination bitmap to be filled with current match result * @f: Field, containing lookup and mapping tables
@@ -1051,7 +1052,8 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,* Return: -1 on no match, rule index of match if @last, otherwise first long * word index to be checked next (i.e. first filled word). */ -static int nft_pipapo_avx2_lookup_slow (unsigned long *map,unsigned long *fill, +static int nft_pipapo_avx2_lookup_slow (const struct nft_pipapo_match *mdata, +unsigned long *map,unsigned long *fill,const struct nft_pipapo_field *f,int offset,const u8 *pkt,bool first,bool last)
@@ -1060,7 +1062,7 @@ static int nft_pipapo_avx2_lookup_slow(unsigned long *map, unsigned long *fill,int i, ret =-1 , b;if (first) -memset (map,0xff , bsize *sizeof (*map)); +pipapo_resmap_init (mdata, map);for (i = offset; i < bsize; i++) {if (f->bb ==8 )
@@ -1186,7 +1188,7 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, }else if (f->groups ==16 ) {NFT_SET_PIPAPO_AVX2_LOOKUP (8 ,16 ); }else { - ret =nft_pipapo_avx2_lookup_slow (res, fill, f, + ret =nft_pipapo_avx2_lookup_slow (m, res, fill, f, ret, rp, first, last); }
@@ -1202,7 +1204,7 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, }else if (f->groups ==32 ) {NFT_SET_PIPAPO_AVX2_LOOKUP (4 ,32 ); }else { - ret =nft_pipapo_avx2_lookup_slow (res, fill, f, + ret =nft_pipapo_avx2_lookup_slow (m, res, fill, f, ret, rp, first, last); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 312/568 ipvs: properly dereference pe in ip_vs_add_service
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Hanxiao <[email protected]>
[ Upstream commit cbd070a4ae62f119058973f6d2c984e325bce6e7 ]
Use pe directly to resolve sparse warning:
net/netfilter/ipvs/ip_vs_ctl.c:1471:27: warning: dereference of noderef expression
--- net/netfilter/ipvs/ip_vs_ctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +5 -5
@@ -1459,18 +1459,18 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u,if (ret <0 ) goto out_err; -/* Bind the ct retriever */ -RCU_INIT_POINTER (svc->pe, pe); - pe =NULL ; -/* Update the virtual service counters */ if (svc->port ==FTPPORT )atomic_inc (&ipvs->ftpsvc_counter);else if (svc->port ==0 )atomic_inc (&ipvs->nullsvc_counter); -if (svc->pe && svc->pe->conn_out) +if (pe && pe->conn_out)atomic_inc (&ipvs->conn_out_counter); +/* Bind the ct retriever */ +RCU_INIT_POINTER (svc->pe, pe); + pe =NULL ; +/* Count only IPv4 services for old get/setsockopt interface */ if (svc->af ==AF_INET ) ipvs->num_services++;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 313/568 gve: Fix XDP TX completion handling when counters overflow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Washington <[email protected]>
[ Upstream commit 03b54bad26f3c78bb1f90410ec3e4e7fe197adc9 ]
In gve_clean_xdp_done, the driver processes the TX completions based on a 32-bit NIC counter and a 32-bit completion counter stored in the tx queue.
Fix the for loop so that the counter wraparound is handled correctly.
--- drivers/net/ethernet/google/gve/gve_tx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/google/gve/gve_tx.c +3 -2
@@ -158,15 +158,16 @@ static int gve_clean_xdp_done(struct gve_priv *priv, struct gve_tx_ring *tx, u32 to_do) {struct gve_tx_buffer_state *info; -u32 clean_end = tx->done + to_do;u64 pkts =0 , bytes =0 ;size_t space_freed =0 ;u32 xsk_complete =0 ;u32 idx; +int i; -for (; tx->done < clean_end; tx->done++) { +for (i =0 ; i < to_do; i++) { idx = tx->done & tx->mask; info = &tx->info[idx]; + tx->done++;if (unlikely (!info->xdp.size))continue ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 314/568 net: flow_dissector: use DEBUG_NET_WARN_ON_ONCE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 120f1c857a73e52132e473dee89b340440cb692b ]
The following splat is easy to reproduce upstream as well as in -stable kernels. Florian Westphal provided the following commit:
d1dab4f71d37 ("net: add and use __skb_get_hash_symmetric_net")
but this complementary fix has been also suggested by Willem de Bruijn and it can be easily backported to -stable kernel which consists in using DEBUG_NET_WARN_ON_ONCE instead to silence the following splat given __skb_get_hash() is used by the nftables tracing infrastructure to to identify packets in traces.
[69133.561393] ------------[ cut here ]------------ [69133.561404] WARNING: CPU: 0 PID: 43576 at net/core/flow_dissector.c:1104 __skb_flow_dissect+0x134f/ [...] [69133.561944] CPU: 0 PID: 43576 Comm: socat Not tainted 6.10.0-rc7+ #379 [69133.561959] RIP: 0010:__skb_flow_dissect+0x134f/0x2ad0 [69133.561970] Code: 83 f9 04 0f 84 b3 00 00 00 45 85 c9 0f 84 aa 00 00 00 41 83 f9 02 0f 84 81 fc ff ff 44 0f b7 b4 24 80 00 00 00 e9 8b f9 ff ff <0f> 0b e9 20 f3 ff ff 41 f6 c6 20 0f 84 e4 ef ff ff 48 8d 7b 12 e8 [69133.561979] RSP: 0018:ffffc90000006fc0 EFLAGS: 00010246 [69133.561988] RAX: 0000000000000000 RBX: ffffffff82f33e20 RCX: ffffffff81ab7e19 [69133.561994] RDX: dffffc0000000000 RSI: ffffc90000007388 RDI: ffff888103a1b418 [69133.562001] RBP: ffffc90000007310 R08: 0000000000000000 R09: 0000000000000000 [69133.562007] R10: ffffc90000007388 R11: ffffffff810cface R12: ffff888103a1b400 [69133.562013] R13: 0000000000000000 R14: ffffffff82f33e2a R15: ffffffff82f33e28 [69133.562020] FS: 00007f40f7131740(0000) GS:ffff888390800000(0000) knlGS:0000000000000000 [69133.562027] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [69133.562033] CR2: 00007f40f7346ee0 CR3: 000000015d200001 CR4: 00000000001706f0 [69133.562040] Call Trace: [69133.562044] <IRQ> [69133.562049] ? __warn+0x9f/0x1a0 [ 1211.841384] ? __skb_flow_dissect+0x107e/0x2860 [...] [ 1211.841496] ? bpf_flow_dissect+0x160/0x160 [ 1211.841753] __skb_get_hash+0x97/0x280 [ 1211.841765] ? __skb_get_hash_symmetric+0x230/0x230 [ 1211.841776] ? mod_find+0xbf/0xe0 [ 1211.841786] ? get_stack_info_noinstr+0x12/0xe0 [ 1211.841798] ? bpf_ksym_find+0x56/0xe0 [ 1211.841807] ? __rcu_read_unlock+0x2a/0x70 [ 1211.841819] nft_trace_init+0x1b9/0x1c0 [nf_tables] [ 1211.841895] ? nft_trace_notify+0x830/0x830 [nf_tables] [ 1211.841964] ? get_stack_info+0x2b/0x80 [ 1211.841975] ? nft_do_chain_arp+0x80/0x80 [nf_tables] [ 1211.842044] nft_do_chain+0x79c/0x850 [nf_tables]
--- net/core/flow_dissector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow_dissector.c +1 -1
@@ -1093,7 +1093,7 @@ bool __skb_flow_dissect(const struct net *net, } } -WARN_ON_ONCE (!net); +DEBUG_NET_WARN_ON_ONCE (!net);if (net) {enum netns_bpf_attach_type type =NETNS_BPF_FLOW_DISSECTOR ;struct bpf_prog_array *run_array;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 315/568 ipv4: Fix incorrect TOS in route get reply
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 338bb57e4c2a1c2c6fc92f9c0bd35be7587adca7 ]
The TOS value that is returned to user space in the route get reply is the one with which the lookup was performed ('fl4->flowi4_tos'). This is fine when the matched route is configured with a TOS as it would not match if its TOS value did not match the one with which the lookup was performed.
However, matching on TOS is only performed when the route's TOS is not zero. It is therefore possible to have the kernel incorrectly return a non-zero TOS:
# ip link add name dummy1 up type dummy
# ip address add 192.0.2.1/24 dev dummy1
# ip route get 192.0.2.2 tos 0xfc
192.0.2.2 tos 0x1c dev dummy1 src 192.0.2.1 uid 0
cacheFix by adding a DSCP field to the FIB result structure (inside an existing 4 bytes hole), populating it in the route lookup and using it when filling the route get reply.
Output after the patch:
# ip link add name dummy1 up type dummy
# ip address add 192.0.2.1/24 dev dummy1
# ip route get 192.0.2.2 tos 0xfc
192.0.2.2 dev dummy1 src 192.0.2.1 uid 0
cache--- include/net/ip_fib.h | 1 + net/ipv4/fib_trie.c | 1 + net/ipv4/route.c | 14 +++++++------- 3 files changed, 9 insertions(+), 7 deletions(-)
include/net/ip_fib.h +1 -0
@@ -173,6 +173,7 @@ struct fib_result {unsigned char type;unsigned char scope;u32 tclassid; +dscp_t dscp;struct fib_nh_common *nhc;struct fib_info *fi;struct fib_table *table;
net/ipv4/fib_trie.c +1 -0
@@ -1628,6 +1628,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, res->nhc = nhc; res->type = fa->fa_type; res->scope = fi->fib_scope; + res->dscp = fa->fa_dscp; res->fi = fi; res->table = tb; res->fa_head = &n->leaf;
net/ipv4/route.c +7 -7
@@ -2930,9 +2930,9 @@ EXPORT_SYMBOL_GPL(ip_route_output_tunnel);/* called with rcu_read_lock held */ static int rt_fill_info (struct net *net,__be32 dst,__be32 src, -struct rtable *rt,u32 table_id,struct flowi4 *fl4, -struct sk_buff *skb,u32 portid,u32 seq, -unsigned int flags) +struct rtable *rt,u32 table_id,dscp_t dscp, +struct flowi4 *fl4,struct sk_buff *skb,u32 portid, +u32 seq,unsigned int flags) {struct rtmsg *r;struct nlmsghdr *nlh;
@@ -2948,7 +2948,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, r->rtm_family =AF_INET ; r->rtm_dst_len =32 ; r->rtm_src_len =0 ; - r->rtm_tos = fl4 ? fl4->flowi4_tos :0 ; + r->rtm_tos =inet_dscp_to_dsfield (dscp); r->rtm_table = table_id <256 ? table_id :RT_TABLE_COMPAT ;if (nla_put_u32 (skb,RTA_TABLE , table_id)) goto nla_put_failure;
@@ -3098,7 +3098,7 @@ static int fnhe_dump_bucket(struct net *net, struct sk_buff *skb, goto next; err =rt_fill_info (net, fnhe->fnhe_daddr,0 , rt, - table_id,NULL , skb, + table_id,0 ,NULL , skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, flags);if (err)
@@ -3421,8 +3421,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, err =fib_dump_info (skb,NETLINK_CB (in_skb).portid, nlh->nlmsg_seq,RTM_NEWROUTE , &fri,0 ); }else { - err =rt_fill_info (net, dst, src, rt, table_id, &fl4, skb, -NETLINK_CB (in_skb).portid, + err =rt_fill_info (net, dst, src, rt, table_id, res.dscp, &fl4, + skb,NETLINK_CB (in_skb).portid, nlh->nlmsg_seq,0 ); }if (err <0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 316/568 ipv4: Fix incorrect TOS in fibmatch route get reply
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit f036e68212c11e5a7edbb59b5e25299341829485 ]
The TOS value that is returned to user space in the route get reply is the one with which the lookup was performed ('fl4->flowi4_tos'). This is fine when the matched route is configured with a TOS as it would not match if its TOS value did not match the one with which the lookup was performed.
However, matching on TOS is only performed when the route's TOS is not zero. It is therefore possible to have the kernel incorrectly return a non-zero TOS:
# ip link add name dummy1 up type dummy # ip address add 192.0.2.1/24 dev dummy1 # ip route get fibmatch 192.0.2.2 tos 0xfc 192.0.2.0/24 tos 0x1c dev dummy1 proto kernel scope link src 192.0.2.1
Fix by instead returning the DSCP field from the FIB result structure which was populated during the route lookup.
Output after the patch:
# ip link add name dummy1 up type dummy # ip address add 192.0.2.1/24 dev dummy1 # ip route get fibmatch 192.0.2.2 tos 0xfc 192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1
Extend the existing selftests to not only verify that the correct route is returned, but that it is also returned with correct "tos" value (or without it).
--- net/ipv4/route.c | 2 +- tools/testing/selftests/net/fib_tests.sh | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-)
net/ipv4/route.c +1 -1
@@ -3394,7 +3394,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, fri.tb_id = table_id; fri.dst = res.prefix; fri.dst_len = res.prefixlen; - fri.dscp =inet_dsfield_to_dscp (fl4.flowi4_tos); + fri.dscp = res.dscp; fri.type = rt->rt_type; fri.offload =0 ; fri.trap =0 ;
tools/testing/selftests/net/fib_tests.sh +12 -12
@@ -1643,53 +1643,53 @@ ipv4_rt_dsfield() # DSCP 0x10 should match the specific route, no matter the ECN bits $IP route get fibmatch 172.16.102.1 dsfield 0x10 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:Not-ECT" $IP route get fibmatch 172.16.102.1 dsfield 0x11 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:ECT(1)" $IP route get fibmatch 172.16.102.1 dsfield 0x12 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:ECT(0)" $IP route get fibmatch 172.16.102.1 dsfield 0x13 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:CE" # Unknown DSCP should match the generic route, no matter the ECN bits $IP route get fibmatch 172.16.102.1 dsfield 0x14 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:Not-ECT" $IP route get fibmatch 172.16.102.1 dsfield 0x15 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:ECT(1)" $IP route get fibmatch 172.16.102.1 dsfield 0x16 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:ECT(0)" $IP route get fibmatch 172.16.102.1 dsfield 0x17 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:CE" # Null DSCP should match the generic route, no matter the ECN bits $IP route get fibmatch 172.16.102.1 dsfield 0x00 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:Not-ECT" $IP route get fibmatch 172.16.102.1 dsfield 0x01 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:ECT(1)" $IP route get fibmatch 172.16.102.1 dsfield 0x02 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:ECT(0)" $IP route get fibmatch 172.16.102.1 dsfield 0x03 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:CE" }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 317/568 net: dsa: mv88e6xxx: Limit chip-wide frame size config to CPU ports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Willi <[email protected]>
[ Upstream commit 66b6095c264e1b4e0a441c6329861806504e06c6 ]
Marvell chips not supporting per-port jumbo frame size configurations use a chip-wide frame size configuration. In the commit referenced with the Fixes tag, the setting is applied just for the last port changing its MTU.
While configuring CPU ports accounts for tagger overhead, user ports do not. When setting the MTU for a user port, the chip-wide setting is reduced to not include the tagger overhead, resulting in an potentially insufficient maximum frame size for the CPU port. Specifically, sending full-size frames from the CPU port on a MV88E6097 having a user port MTU of 1500 bytes results in dropped frames.
As, by design, the CPU port MTU is adjusted for any user port change, apply the chip-wide setting only for CPU ports.
--- drivers/net/dsa/mv88e6xxx/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +2 -1
@@ -3490,7 +3490,8 @@ static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)mv88e6xxx_reg_lock (chip);if (chip->info->ops->port_set_jumbo_size) ret = chip->info->ops->port_set_jumbo_size (chip, port, new_mtu); -else if (chip->info->ops->set_max_frame_size) +else if (chip->info->ops->set_max_frame_size && +dsa_is_cpu_port (ds, port)) ret = chip->info->ops->set_max_frame_size (chip, new_mtu);mv88e6xxx_reg_unlock (chip);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 318/568 net: dsa: b53: Limit chip-wide jumbo frame config to CPU ports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Willi <[email protected]>
[ Upstream commit c5118072e228e7e4385fc5ac46b2e31cf6c4f2d3 ]
Broadcom switches supported by the b53 driver use a chip-wide jumbo frame configuration. In the commit referenced with the Fixes tag, the setting is applied just for the last port changing its MTU.
While configuring CPU ports accounts for tagger overhead, user ports do not. When setting the MTU for a user port, the chip-wide setting is reduced to not include the tagger overhead, resulting in an potentially insufficient chip-wide maximum frame size for the CPU port.
As, by design, the CPU port MTU is adjusted for any user port change, apply the chip-wide setting only for CPU ports. This aligns the driver to the behavior of other switch drivers.
--- drivers/net/dsa/b53/b53_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/dsa/b53/b53_common.c +3 -0
@@ -2265,6 +2265,9 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)if (is5325 (dev) ||is5365 (dev))return -EOPNOTSUPP ; +if (!dsa_is_cpu_port (ds, port)) +return 0 ; + enable_jumbo = (mtu >=JMS_MIN_SIZE ); allow_10_100 = (dev->chip_id ==BCM583XX_DEVICE_ID );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 319/568 fs/ntfs3: Merge synonym COMPRESSION_UNIT and NTFS_LZNT_CUNIT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 487f8d482a7e51a640b8f955a398f906a4f83951 ]
COMPRESSION_UNIT and NTFS_LZNT_CUNIT mean the same thing (1u<<NTFS_LZNT_CUNIT) determines the size for compression (in clusters).
COMPRESS_MAX_CLUSTER is not used in the code.
Stable-dep-of: 25610ff98d4a ("fs/ntfs3: Fix transform resident to nonresident for compressed files")
--- fs/ntfs3/attrib.c | 2 +- fs/ntfs3/frecord.c | 2 +- fs/ntfs3/fslog.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ntfs3/ntfs.h | 3 --- 5 files changed, 4 insertions(+), 7 deletions(-)
fs/ntfs3/attrib.c +1 -1
@@ -254,7 +254,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, align = sbi->cluster_size;if (is_attr_compressed (attr)) - align <<=COMPRESSION_UNIT ; + align <<=NTFS_LZNT_CUNIT ; len = (rsize + align -1 ) >> sbi->cluster_bits;run_init (run);
fs/ntfs3/frecord.c +1 -1
@@ -1501,7 +1501,7 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type,if (is_ext) {if (flags &ATTR_FLAG_COMPRESSED ) - attr->nres.c_unit =COMPRESSION_UNIT ; + attr->nres.c_unit =NTFS_LZNT_CUNIT ; attr->nres.total_size = attr->nres.alloc_size; }
fs/ntfs3/fslog.c +1 -1
@@ -2996,7 +2996,7 @@ static struct ATTRIB *attr_create_nonres_log(struct ntfs_sb_info *sbi,if (is_ext) { attr->name_off =SIZEOF_NONRESIDENT_EX_LE ;if (is_attr_compressed (attr)) - attr->nres.c_unit =COMPRESSION_UNIT ; + attr->nres.c_unit =NTFS_LZNT_CUNIT ; attr->nres.run_off =cpu_to_le16 (SIZEOF_NONRESIDENT_EX + name_size);
fs/ntfs3/inode.c +1 -1
@@ -1498,7 +1498,7 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, attr->size =cpu_to_le32 (SIZEOF_NONRESIDENT_EX +8 ); attr->name_off =SIZEOF_NONRESIDENT_EX_LE ; attr->flags =ATTR_FLAG_COMPRESSED ; - attr->nres.c_unit =COMPRESSION_UNIT ; + attr->nres.c_unit =NTFS_LZNT_CUNIT ; asize =SIZEOF_NONRESIDENT_EX +8 ; }else { attr->size =cpu_to_le32 (SIZEOF_NONRESIDENT +8 );
fs/ntfs3/ntfs.h +0 -3
@@ -82,9 +82,6 @@ typedef u32 CLST;#define RESIDENT_LCN ((CLST)-2)#define COMPRESSED_LCN ((CLST)-3) -#define COMPRESSION_UNIT 4 -#define COMPRESS_MAX_CLUSTER 0x1000 -enum RECORD_NUM {MFT_REC_MFT =0 ,MFT_REC_MIRR =1 ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 320/568 fs/ntfs3: Fix transform resident to nonresident for compressed files
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 25610ff98d4a34e6a85cbe4fd8671be6b0829f8f ]
Сorrected calculation of required space len (in clusters) for attribute data storage in case of compression.
--- fs/ntfs3/attrib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
fs/ntfs3/attrib.c +8 -5
@@ -231,7 +231,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,struct ntfs_sb_info *sbi;struct ATTRIB *attr_s;struct MFT_REC *rec; -u32 used, asize, rsize, aoff, align; +u32 used, asize, rsize, aoff;bool is_data;CLST len, alen;char *next;
@@ -252,10 +252,13 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, rsize =le32_to_cpu (attr->res.data_size); is_data = attr->type ==ATTR_DATA && !attr->name_len; - align = sbi->cluster_size; -if (is_attr_compressed (attr)) - align <<=NTFS_LZNT_CUNIT ; - len = (rsize + align -1 ) >> sbi->cluster_bits; +/* len - how many clusters required to store 'rsize' bytes */ +if (is_attr_compressed (attr)) { +u8 shift = sbi->cluster_bits +NTFS_LZNT_CUNIT ; + len = ((rsize + (1u << shift) -1 ) >> shift) <<NTFS_LZNT_CUNIT ; + }else { + len =bytes_to_cluster (sbi, rsize); + }run_init (run);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 321/568 fs/ntfs3: Deny getting attr data block in compressed frame
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 69943484b95267c94331cba41e9e64ba7b24f136 ]
Attempting to retrieve an attribute data block in a compressed frame is ignored.
--- fs/ntfs3/attrib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/ntfs3/attrib.c +13 -0
@@ -975,6 +975,19 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,if (err) goto out; +/* Check for compressed frame. */ + err =attr_is_frame_compressed (ni, attr, vcn >>NTFS_LZNT_CUNIT , &hint); +if (err) + goto out; + +if (hint) { +/* if frame is compressed - don't touch it. */ + *lcn =COMPRESSED_LCN ; + *len = hint; + err = -EOPNOTSUPP ; + goto out; + } +if (!*len) {if (run_lookup_entry (run, vcn, lcn, len,NULL )) {if (*lcn !=SPARSE_LCN || !new)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 322/568 fs/ntfs3: Missed NI_FLAG_UPDATE_PARENT setting
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 1c308ace1fd6de93bd0b7e1a5e8963ab27e2c016 ]
--- fs/ntfs3/attrib.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/attrib.c +1 -0
@@ -1738,6 +1738,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, attr_b->nres.total_size =cpu_to_le64 (total_size);inode_set_bytes (&ni->vfs_inode, total_size); + ni->ni_flags |=NI_FLAG_UPDATE_PARENT ; mi_b->dirty = true;mark_inode_dirty (&ni->vfs_inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 323/568 fs/ntfs3: Fix getting file type
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 24c5100aceedcd47af89aaa404d4c96cd2837523 ]
An additional condition causes the mft record to be read from disk and get the file type dt_type.
--- fs/ntfs3/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ntfs3/dir.c +2 -1
@@ -326,7 +326,8 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,* It does additional locks/reads just to get the type of name. * Should we use additional mount option to enable branch below? */ -if ((fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) && +if (((fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) || + fname->dup.ea_size) && ino != ni->mi.rno) {struct inode *inode =ntfs_iget5 (sbi->sb, &e->ref,NULL );if (!IS_ERR_OR_NULL (inode)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 324/568 fs/ntfs3: Add missing .dirty_folio in address_space_operations
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 0f9579d9e0331b6255132ac06bdf2c0a01cceb90 ]
After switching from pages to folio [1], it became evident that the initialization of .dirty_folio for page cache operations was missed for compressed files.
[1] https://lore.kernel.org/ntfs3/[email protected]
--- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/inode.c +1 -0
@@ -2117,5 +2117,6 @@ const struct address_space_operations ntfs_aops = {const struct address_space_operations ntfs_aops_cmpr = { .read_folio = ntfs_read_folio, .readahead = ntfs_readahead, + .dirty_folio = block_dirty_folio, };// clang-format on
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 325/568 pinctrl: rockchip: update rk3308 iomux routes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Yashin <[email protected]>
[ Upstream commit a8f2548548584549ea29d43431781d67c4afa42b ]
Some of the rk3308 iomux routes in rk3308_mux_route_data belong to the rk3308b SoC. Remove them and correct i2c3 routes.
--- drivers/pinctrl/pinctrl-rockchip.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +2 -15
@@ -915,9 +915,8 @@ static struct rockchip_mux_route_data rk3308_mux_route_data[] = {RK_MUXROUTE_SAME (0 ,RK_PC3 ,1 ,0x314 ,BIT (16 +0 ) |BIT (0 )),/* rtc_clk */ RK_MUXROUTE_SAME (1 ,RK_PC6 ,2 ,0x314 ,BIT (16 +2 ) |BIT (16 +3 )),/* uart2_rxm0 */ RK_MUXROUTE_SAME (4 ,RK_PD2 ,2 ,0x314 ,BIT (16 +2 ) |BIT (16 +3 ) |BIT (2 )),/* uart2_rxm1 */ -RK_MUXROUTE_SAME (0 ,RK_PB7 ,2 ,0x608 ,BIT (16 +8 ) |BIT (16 +9 )),/* i2c3_sdam0 */ -RK_MUXROUTE_SAME (3 ,RK_PB4 ,2 ,0x608 ,BIT (16 +8 ) |BIT (16 +9 ) |BIT (8 )),/* i2c3_sdam1 */ -RK_MUXROUTE_SAME (2 ,RK_PA0 ,3 ,0x608 ,BIT (16 +8 ) |BIT (16 +9 ) |BIT (9 )),/* i2c3_sdam2 */ +RK_MUXROUTE_SAME (0 ,RK_PB7 ,2 ,0x314 ,BIT (16 +4 )),/* i2c3_sdam0 */ +RK_MUXROUTE_SAME (3 ,RK_PB4 ,2 ,0x314 ,BIT (16 +4 ) |BIT (4 )),/* i2c3_sdam1 */ RK_MUXROUTE_SAME (1 ,RK_PA3 ,2 ,0x308 ,BIT (16 +3 )),/* i2s-8ch-1-sclktxm0 */ RK_MUXROUTE_SAME (1 ,RK_PA4 ,2 ,0x308 ,BIT (16 +3 )),/* i2s-8ch-1-sclkrxm0 */ RK_MUXROUTE_SAME(1, RK_PB5, 2, 0x308, BIT(16 + 3) | BIT(3)), /* i2s-8ch-1-sclktxm1 */
@@ -926,18 +925,6 @@ static struct rockchip_mux_route_data rk3308_mux_route_data[] = {RK_MUXROUTE_SAME (1 ,RK_PB6 ,4 ,0x308 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (12 )),/* pdm-clkm1 */ RK_MUXROUTE_SAME (2 ,RK_PA6 ,2 ,0x308 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (13 )),/* pdm-clkm2 */ RK_MUXROUTE_SAME(2, RK_PA4, 3, 0x600, BIT(16 + 2) | BIT(2)), /* pdm-clkm-m2 */ -RK_MUXROUTE_SAME (3 ,RK_PB2 ,3 ,0x314 ,BIT (16 +9 )),/* spi1_miso */ -RK_MUXROUTE_SAME (2 ,RK_PA4 ,2 ,0x314 ,BIT (16 +9 ) |BIT (9 )),/* spi1_miso_m1 */ -RK_MUXROUTE_SAME (0 ,RK_PB3 ,3 ,0x314 ,BIT (16 +10 ) |BIT (16 +11 )),/* owire_m0 */ -RK_MUXROUTE_SAME (1 ,RK_PC6 ,7 ,0x314 ,BIT (16 +10 ) |BIT (16 +11 ) |BIT (10 )),/* owire_m1 */ -RK_MUXROUTE_SAME (2 ,RK_PA2 ,5 ,0x314 ,BIT (16 +10 ) |BIT (16 +11 ) |BIT (11 )),/* owire_m2 */ -RK_MUXROUTE_SAME (0 ,RK_PB3 ,2 ,0x314 ,BIT (16 +12 ) |BIT (16 +13 )),/* can_rxd_m0 */ -RK_MUXROUTE_SAME (1 ,RK_PC6 ,5 ,0x314 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (12 )),/* can_rxd_m1 */ -RK_MUXROUTE_SAME (2 ,RK_PA2 ,4 ,0x314 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (13 )),/* can_rxd_m2 */ -RK_MUXROUTE_SAME (1 ,RK_PC4 ,3 ,0x314 ,BIT (16 +14 )),/* mac_rxd0_m0 */ -RK_MUXROUTE_SAME (4 ,RK_PA2 ,2 ,0x314 ,BIT (16 +14 ) |BIT (14 )),/* mac_rxd0_m1 */ -RK_MUXROUTE_SAME (3 ,RK_PB4 ,4 ,0x314 ,BIT (16 +15 )),/* uart3_rx */ - RK_MUXROUTE_SAME(0, RK_PC1, 3, 0x314, BIT(16 + 15) | BIT(15)), /* uart3_rx_m1 */ }; static struct rockchip_mux_route_data rk3328_mux_route_data[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 326/568 pinctrl: core: fix possible memory leak when pinctrl_enable() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit ae1cf4759972c5fe665ee4c5e0c29de66fe3cf4a ]
In devm_pinctrl_register(), if pinctrl_enable() fails in pinctrl_register(), the "pctldev" has not been added to dev resources, so devm_pinctrl_dev_release() can not be called, it leads memory leak.
Introduce pinctrl_uninit_controller(), call it in the error path to free memory.
--- drivers/pinctrl/core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/pinctrl/core.c +11 -1
@@ -2072,6 +2072,14 @@ pinctrl_init_controller(struct pinctrl_desc *pctldesc, struct device *dev,return ERR_PTR (ret); } +static void pinctrl_uninit_controller (struct pinctrl_dev *pctldev,struct pinctrl_desc *pctldesc) +{ +pinctrl_free_pindescs (pctldev, pctldesc->pins, + pctldesc->npins); +mutex_destroy (&pctldev->mutex); +kfree (pctldev); +} +static int pinctrl_claim_hogs (struct pinctrl_dev *pctldev) { pctldev->p =create_pinctrl (pctldev->dev, pctldev);
@@ -2152,8 +2160,10 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,return pctldev; error =pinctrl_enable (pctldev); -if (error) +if (error) { +pinctrl_uninit_controller (pctldev, pctldesc);return ERR_PTR (error); + }return pctldev; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 327/568 pinctrl: single: fix possible memory leak when pinctrl_enable() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 8f773bfbdd428819328a2d185976cfc6ae811cd3 ]
This driver calls pinctrl_register_and_init() which is not devm_ managed, it will leads memory leak if pinctrl_enable() fails. Replace it with devm_pinctrl_register_and_init(). And call pcs_free_resources() if pinctrl_enable() fails.
--- drivers/pinctrl/pinctrl-single.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +4 -3
@@ -1327,7 +1327,6 @@ static void pcs_irq_free(struct pcs_device *pcs)static void pcs_free_resources (struct pcs_device *pcs) {pcs_irq_free (pcs); -pinctrl_unregister (pcs->pctl);#if IS_BUILTIN (CONFIG_PINCTRL_SINGLE )if (pcs->missing_nr_pinctrl_cells)
@@ -1884,7 +1883,7 @@ static int pcs_probe(struct platform_device *pdev)if (ret <0 ) goto free; - ret =pinctrl_register_and_init (&pcs->desc, pcs->dev, pcs, &pcs->pctl); + ret =devm_pinctrl_register_and_init (pcs->dev, &pcs->desc, pcs, &pcs->pctl);if (ret) {dev_err (pcs->dev,"could not register single pinctrl driver\n" ); goto free;
@@ -1917,8 +1916,10 @@ static int pcs_probe(struct platform_device *pdev)dev_info (pcs->dev,"%i pins, size %u\n" , pcs->desc.npins, pcs->size); -return pinctrl_enable (pcs->pctl); +if (pinctrl_enable (pcs->pctl)) + goto free; +return 0 ; free:pcs_free_resources (pcs);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 328/568 pinctrl: ti: ti-iodelay: Drop if block with always false condition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 88b3f108502bc45e6ebd005702add46759f3f45a ]
ti_iodelay_remove() is only called after ti_iodelay_probe() completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so platform_get_drvdata() won't return NULL.
Simplify by removing the if block with the always false condition.
Stable-dep-of: 9b401f4a7170 ("pinctrl: ti: ti-iodelay: fix possible memory leak when pinctrl_enable() fails")
--- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 3 --- 1 file changed, 3 deletions(-)
drivers/pinctrl/ti/pinctrl-ti-iodelay.c +0 -3
@@ -903,9 +903,6 @@ static int ti_iodelay_remove(struct platform_device *pdev) {struct ti_iodelay_device *iod =platform_get_drvdata (pdev); -if (!iod) -return 0 ; -if (iod->pctl)pinctrl_unregister (iod->pctl);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 329/568 pinctrl: ti: ti-iodelay: fix possible memory leak when pinctrl_enable() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 9b401f4a7170125365160c9af267a41ff6b39001 ]
This driver calls pinctrl_register_and_init() which is not devm_ managed, it will leads memory leak if pinctrl_enable() fails. Replace it with devm_pinctrl_register_and_init(). And add missing of_node_put() in the error path.
--- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pinctrl/ti/pinctrl-ti-iodelay.c +6 -5
@@ -878,7 +878,7 @@ static int ti_iodelay_probe(struct platform_device *pdev) iod->desc.name =dev_name (dev); iod->desc.owner =THIS_MODULE ; - ret =pinctrl_register_and_init (&iod->desc, dev, iod, &iod->pctl); + ret =devm_pinctrl_register_and_init (dev, &iod->desc, iod, &iod->pctl);if (ret) {dev_err (dev,"Failed to register pinctrl\n" ); goto exit_out;
@@ -886,7 +886,11 @@ static int ti_iodelay_probe(struct platform_device *pdev)platform_set_drvdata (pdev, iod); -return pinctrl_enable (iod->pctl); + ret =pinctrl_enable (iod->pctl); +if (ret) + goto exit_out; + +return 0 ; exit_out:of_node_put (np);
@@ -903,9 +907,6 @@ static int ti_iodelay_remove(struct platform_device *pdev) {struct ti_iodelay_device *iod =platform_get_drvdata (pdev); -if (iod->pctl) -pinctrl_unregister (iod->pctl); -ti_iodelay_pinconf_deinit_dev (iod);/* Expect other allocations to be freed by devm */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 330/568 pinctrl: freescale: mxs: Fix refcount of child
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 7f500f2011c0bbb6e1cacab74b4c99222e60248e ]
of_get_next_child() will increase refcount of the returned node, need use of_node_put() on it when done.
Per current implementation, 'child' will be override by for_each_child_of_node(np, child), so use of_get_child_count to avoid refcount leakage.
--- drivers/pinctrl/freescale/pinctrl-mxs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/freescale/pinctrl-mxs.c +2 -2
@@ -408,8 +408,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,int ret;u32 val; - child =of_get_next_child (np,NULL ); -if (!child) { + val =of_get_child_count (np); +if (val ==0 ) {dev_err (&pdev->dev,"no group is defined\n" );return -ENOENT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 331/568 fs/ntfs3: Replace inode_trylock with inode_lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 69505fe98f198ee813898cbcaf6770949636430b ]
The issue was detected due to xfstest 465 failing.
--- fs/ntfs3/file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ntfs3/file.c +1 -4
@@ -299,10 +299,7 @@ static int ntfs_file_mmap(struct file *file, struct vm_area_struct *vma) }if (ni->i_valid < to) { -if (!inode_trylock (inode)) { - err = -EAGAIN ; - goto out; - } +inode_lock (inode); err =ntfs_extend_initialized_size (file, ni, ni->i_valid, to);inode_unlock (inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 332/568 fs/ntfs3: Correct undo if ntfs_create_inode failed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit f28d0866d8ff798aa497971f93d0cc58f442d946 ]
Clusters allocated for Extended Attributes, must be freed when rolling back inode creation.
--- fs/ntfs3/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/ntfs3/inode.c +9 -1
@@ -1652,7 +1652,9 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,* The packed size of extended attribute is stored in direntry too. * 'fname' here points to inside new_de. */ -ntfs_save_wsl_perm (inode, &fname->dup.ea_size); + err =ntfs_save_wsl_perm (inode, &fname->dup.ea_size); +if (err) + goto out6;/* * update ea_size in file_name attribute too.
@@ -1694,6 +1696,12 @@ struct inode *ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, goto out2; out6: + attr =ni_find_attr (ni,NULL ,NULL ,ATTR_EA ,NULL ,0 ,NULL ,NULL ); +if (attr && attr->non_res) { +/* Delete ATTR_EA, if non-resident. */ +attr_set_size (ni,ATTR_EA ,NULL ,0 ,NULL ,0 ,NULL , false,NULL ); + } +if (rp_inserted)ntfs_remove_reparse (sbi,IO_REPARSE_TAG_SYMLINK , &new_de->ref);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 333/568 fs/ntfs3: Drop stray \ (backslash) in formatting string
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit b366809dd151e8abb29decda02fd6a78b498831f ]
CHECK /home/andy/prj/linux-topic-uart/fs/ntfs3/super.cfs/ntfs3/super.c:471:23: warning: unknown escape sequence: '\%'
Drop stray '\' (backslash) in formatting string.
--- fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/super.c +1 -1
@@ -463,7 +463,7 @@ static int ntfs3_volinfo(struct seq_file *m, void *o)struct super_block *sb = m->private;struct ntfs_sb_info *sbi = sb->s_fs_info; - seq_printf(m, "ntfs%d.%d\n%u\n%zu\n\%zu\n%zu\n%s\n%s\n", + seq_printf(m, "ntfs%d.%d\n%u\n%zu\n%zu\n%zu\n%s\n%s\n", sbi->volume.major_ver, sbi->volume.minor_ver, sbi->cluster_size, sbi->used.bitmap.nbits, sbi->mft.bitmap.nbits,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 334/568 fs/ntfs3: Fix field-spanning write in INDEX_HDR
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 2f3e176fee66ac86ae387787bf06457b101d9f7a ]
Fields flags and res[3] replaced with one 4 byte flags.
--- fs/ntfs3/index.c | 4 ++-- fs/ntfs3/ntfs.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-)
fs/ntfs3/index.c +2 -2
@@ -978,7 +978,7 @@ static struct indx_node *indx_new(struct ntfs_index *indx, hdr->used =cpu_to_le32 (eo +sizeof (struct NTFS_DE ) +sizeof (u64));de_set_vbn_le (e, *sub_vbn); - hdr->flags =1 ; + hdr->flags =NTFS_INDEX_HDR_HAS_SUBNODES ; }else { e->size =cpu_to_le16 (sizeof (struct NTFS_DE )); hdr->used =cpu_to_le32 (eo +sizeof (struct NTFS_DE ));
@@ -1682,7 +1682,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, e->size =cpu_to_le16 (sizeof (struct NTFS_DE ) +sizeof (u64)); e->flags =NTFS_IE_HAS_SUBNODES |NTFS_IE_LAST ; - hdr->flags =1 ; + hdr->flags =NTFS_INDEX_HDR_HAS_SUBNODES ; hdr->used = hdr->total =cpu_to_le32 (new_root_size - offsetof(struct INDEX_ROOT , ihdr));
fs/ntfs3/ntfs.h +5 -4
@@ -693,14 +693,15 @@ static inline bool de_has_vcn_ex(const struct NTFS_DE *e) offsetof(struct ATTR_FILE_NAME, name) + \ NTFS_NAME_LEN * sizeof(short), 8) +#define NTFS_INDEX_HDR_HAS_SUBNODES cpu_to_le32(1) +struct INDEX_HDR {__le32 de_off;// 0x00: The offset from the start of this structure // to the first NTFS_DE. __le32 used;// 0x04: The size of this structure plus all // entries (quad-word aligned). __le32 total;// 0x08: The allocated size of for this structure plus all entries. -u8 flags;// 0x0C: 0x00 = Small directory, 0x01 = Large directory. -u8 res[3 ]; +__le32 flags;// 0x0C: 0x00 = Small directory, 0x01 = Large directory. // // de_off + used <= total
@@ -748,7 +749,7 @@ static inline struct NTFS_DE *hdr_next_de(const struct INDEX_HDR *hdr,static inline bool hdr_has_subnode (const struct INDEX_HDR *hdr) { -return hdr->flags &1 ; +return hdr->flags &NTFS_INDEX_HDR_HAS_SUBNODES ; }struct INDEX_BUFFER {
@@ -768,7 +769,7 @@ static inline bool ib_is_empty(const struct INDEX_BUFFER *ib)static inline bool ib_is_leaf (const struct INDEX_BUFFER *ib) { -return !(ib->ihdr.flags &1 ); +return !(ib->ihdr.flags &NTFS_INDEX_HDR_HAS_SUBNODES ); }/* Index root structure ( 0x90 ). */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 335/568 pinctrl: renesas: r8a779g0: Fix CANFD5 suffix
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 77fa9007ac31e80674beadc452d3f3614f283e18 ]
CAN-FD instance 5 has two alternate pin groups: "canfd5" and "canfd5_b". Rename the former to "canfd5_a" to increase uniformity.
While at it, remove the unneeded separator.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +11 -13
@@ -341,8 +341,8 @@/* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_7_4 FM(FXR_TXENA_N) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX_A) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX_A) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_23_20 FM(FXR_TXENB_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -896,11 +896,11 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_7_4 ,TPU0TO3_A ),PINMUX_IPSR_GPSR (IP0SR2_11_8 ,RXDA_EXTFXR ), -PINMUX_IPSR_GPSR (IP0SR2_11_8 ,CANFD5_TX ), +PINMUX_IPSR_GPSR (IP0SR2_11_8 ,CANFD5_TX_A ),PINMUX_IPSR_GPSR (IP0SR2_11_8 ,IRQ5 ),PINMUX_IPSR_GPSR (IP0SR2_15_12 ,CLK_EXTFXR ), -PINMUX_IPSR_GPSR (IP0SR2_15_12 ,CANFD5_RX ), +PINMUX_IPSR_GPSR (IP0SR2_15_12 ,CANFD5_RX_A ),PINMUX_IPSR_GPSR (IP0SR2_15_12 ,IRQ4_B ), PINMUX_IPSR_GPSR(IP0SR2_19_16, RXDB_EXTFXR),
@@ -1531,15 +1531,14 @@ static const unsigned int canfd4_data_mux[] = { };/* - CANFD5 ----------------------------------------------------------------- */ -static const unsigned int canfd5_data_pins[] = { -/* CANFD5_TX, CANFD5_RX */ +static const unsigned int canfd5_data_a_pins[] = { +/* CANFD5_TX_A, CANFD5_RX_A */ RCAR_GP_PIN (2 ,2 ),RCAR_GP_PIN (2 ,3 ), }; -static const unsigned int canfd5_data_mux[] = { -CANFD5_TX_MARK ,CANFD5_RX_MARK , +static const unsigned int canfd5_data_a_mux[] = { +CANFD5_TX_A_MARK ,CANFD5_RX_A_MARK , }; -/* - CANFD5_B ----------------------------------------------------------------- */ static const unsigned int canfd5_data_b_pins[] = {/* CANFD5_TX_B, CANFD5_RX_B */ RCAR_GP_PIN (1 ,8 ),RCAR_GP_PIN (1 ,9 ),
@@ -2578,8 +2577,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (canfd2_data),SH_PFC_PIN_GROUP (canfd3_data),SH_PFC_PIN_GROUP (canfd4_data), -SH_PFC_PIN_GROUP (canfd5_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (canfd5_data_b),/* suffix might be updated */ +SH_PFC_PIN_GROUP (canfd5_data_a), +SH_PFC_PIN_GROUP (canfd5_data_b),SH_PFC_PIN_GROUP (canfd6_data),SH_PFC_PIN_GROUP (canfd7_data), SH_PFC_PIN_GROUP(can_clk),
@@ -2788,8 +2787,7 @@ static const char * const canfd4_groups[] = { };static const char *const canfd5_groups[] = { -/* suffix might be updated */ -"canfd5_data" , +"canfd5_data_a" ,"canfd5_data_b" , };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 336/568 pinctrl: renesas: r8a779g0: Fix FXR_TXEN[AB] suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 4976d61ca39ce51f422e094de53b46e2e3ac5c0d ]
The Pin Multiplex attachment in Rev.1.10 of the R-Car V4H Series Hardware User's Manual still has two alternate pins named both "FXR_TXEN[AB]". To differentiate, the pin control driver uses "FXR_TXEN[AB]" and "FXR_TXEN[AB]_X", which were considered temporary names until the conflict was sorted out.
Fix this by adopting R-Car V4M naming:
- Rename "FXR_TXEN[AB]" to "FXR_TXEN[AB]_A",
- Rename "FXR_TXEN[AB]_X" to "FXR_TXEN[AB]_B".
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +10 -10
@@ -122,11 +122,11 @@#define GPSR2_8 F_(TPU0TO0, IP1SR2_3_0)#define GPSR2_7 F_(TPU0TO1, IP0SR2_31_28)#define GPSR2_6 F_(FXR_TXDB, IP0SR2_27_24) -#define GPSR2_5 F_(FXR_TXENB_N, IP0SR2_23_20) +#define GPSR2_5 F_(FXR_TXENB_N_A, IP0SR2_23_20)#define GPSR2_4 F_(RXDB_EXTFXR, IP0SR2_19_16)#define GPSR2_3 F_(CLK_EXTFXR, IP0SR2_15_12)#define GPSR2_2 F_(RXDA_EXTFXR, IP0SR2_11_8) -#define GPSR2_1 F_(FXR_TXENA_N, IP0SR2_7_4) +#define GPSR2_1 F_(FXR_TXENA_N_A, IP0SR2_7_4)#define GPSR2_0 F_(FXR_TXDA, IP0SR2_3_0)/* GPSR3 */
@@ -340,18 +340,18 @@/* SR2 */ /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_7_4 FM(FXR_TXENA_N) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_7_4 FM(FXR_TXENA_N_A) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX_A) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX_A) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_23_20 FM(FXR_TXENB_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_23_20 FM(FXR_TXENB_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -891,7 +891,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_3_0 ,CANFD1_TX ),PINMUX_IPSR_GPSR (IP0SR2_3_0 ,TPU0TO2_A ), -PINMUX_IPSR_GPSR (IP0SR2_7_4 ,FXR_TXENA_N ), +PINMUX_IPSR_GPSR (IP0SR2_7_4 ,FXR_TXENA_N_A ),PINMUX_IPSR_GPSR (IP0SR2_7_4 ,CANFD1_RX ), PINMUX_IPSR_GPSR(IP0SR2_7_4, TPU0TO3_A),
@@ -905,7 +905,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_19_16 ,RXDB_EXTFXR ), -PINMUX_IPSR_GPSR (IP0SR2_23_20 ,FXR_TXENB_N ), +PINMUX_IPSR_GPSR (IP0SR2_23_20 ,FXR_TXENB_N_A ), PINMUX_IPSR_GPSR(IP0SR2_27_24, FXR_TXDB),
@@ -919,10 +919,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TCLK1_A ),PINMUX_IPSR_GPSR (IP1SR2_7_4 ,CAN_CLK ), -PINMUX_IPSR_GPSR (IP1SR2_7_4 ,FXR_TXENA_N_X ), +PINMUX_IPSR_GPSR (IP1SR2_7_4 ,FXR_TXENA_N_B ),PINMUX_IPSR_GPSR (IP1SR2_11_8 ,CANFD0_TX ), -PINMUX_IPSR_GPSR (IP1SR2_11_8 ,FXR_TXENB_N_X ), +PINMUX_IPSR_GPSR (IP1SR2_11_8 ,FXR_TXENB_N_B ),PINMUX_IPSR_GPSR (IP1SR2_15_12 ,CANFD0_RX ), PINMUX_IPSR_GPSR(IP1SR2_15_12, STPWT_EXTFXR),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 337/568 pinctrl: renesas: r8a779g0: Fix (H)SCIF1 suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3cf834a1669ea433aeee4c82c642776899c87451 ]
The Pin Multiplex attachment in Rev.1.10 of the R-Car V4H Series Hardware User's Manual still has two alternate pin groups (GP0_14-18 and GP1_6-10) each named both HSCIF1 and SCIF1. To differentiate, the pin control driver uses "(h)scif1" and "(h)scif1_x", which were considered temporary names until the conflict was sorted out.
Fix this by adopting R-Car V4M naming:
- Rename "(h)scif1" to "(h)scif1_a",
- Rename "(h)scif1_x" to "(h)scif1_b".
Adopt the R-Car V4M naming "(h)scif1_a" and "(h)scif1_b" to increase uniformity.
While at it, remove unneeded separators.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 208 ++++++++++++------------- 1 file changed, 102 insertions(+), 106 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +102 -106
@@ -291,13 +291,13 @@#define IP1SR0_15_12 FM(MSIOF5_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_19_16 FM(MSIOF5_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1) FM(TX1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1) FM(RX1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP2SR0_3_0 FM(MSIOF2_TXD) FM(HCTS1_N) FM(CTS1_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR0_7_4 FM(MSIOF2_SCK) FM(HRTS1_N) FM(RTS1_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR0_11_8 FM(MSIOF2_RXD) FM(HSCK1) FM(SCK1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR0_3_0 FM(MSIOF2_TXD) FM(HCTS1_N_A) FM(CTS1_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR0_7_4 FM(MSIOF2_SCK) FM(HRTS1_N_A) FM(RTS1_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR0_11_8 FM(MSIOF2_RXD) FM(HSCK1_A) FM(SCK1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* SR1 */ /* IP0SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -307,13 +307,13 @@#define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_A) FM(CTS3_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_A) FM(SCK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_23_20 FM(MSIOF1_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_X) FM(TX1_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_X) FM(RX1_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_B) FM(TX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_B) FM(RX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP1SR1_3_0 FM(MSIOF0_SYNC) FM(HCTS1_N_X) FM(CTS1_N_X) FM(CANFD5_TX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_7_4 FM(MSIOF0_TXD) FM(HRTS1_N_X) FM(RTS1_N_X) FM(CANFD5_RX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_X) FM(SCK1_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_3_0 FM(MSIOF0_SYNC) FM(HCTS1_N_B) FM(CTS1_N_B) FM(CANFD5_TX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_7_4 FM(MSIOF0_TXD) FM(HRTS1_N_B) FM(RTS1_N_B) FM(CANFD5_RX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_B) FM(SCK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_15_12 FM(MSIOF0_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_19_16 FM(HTX0) FM(TX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_N) FM(PWM8_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -754,25 +754,25 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_A ),PINMUX_IPSR_GPSR (IP1SR0_27_24 ,MSIOF2_SS1 ), -PINMUX_IPSR_GPSR (IP1SR0_27_24 ,HTX1 ), -PINMUX_IPSR_GPSR (IP1SR0_27_24 ,TX1 ), +PINMUX_IPSR_GPSR (IP1SR0_27_24 ,HTX1_A ), +PINMUX_IPSR_GPSR (IP1SR0_27_24 ,TX1_A ),PINMUX_IPSR_GPSR (IP1SR0_31_28 ,MSIOF2_SYNC ), -PINMUX_IPSR_GPSR (IP1SR0_31_28 ,HRX1 ), -PINMUX_IPSR_GPSR (IP1SR0_31_28 ,RX1 ), +PINMUX_IPSR_GPSR (IP1SR0_31_28 ,HRX1_A ), +PINMUX_IPSR_GPSR (IP1SR0_31_28 ,RX1_A ),/* IP2SR0 */ PINMUX_IPSR_GPSR (IP2SR0_3_0 ,MSIOF2_TXD ), -PINMUX_IPSR_GPSR (IP2SR0_3_0 ,HCTS1_N ), -PINMUX_IPSR_GPSR (IP2SR0_3_0 ,CTS1_N ), +PINMUX_IPSR_GPSR (IP2SR0_3_0 ,HCTS1_N_A ), +PINMUX_IPSR_GPSR (IP2SR0_3_0 ,CTS1_N_A ),PINMUX_IPSR_GPSR (IP2SR0_7_4 ,MSIOF2_SCK ), -PINMUX_IPSR_GPSR (IP2SR0_7_4 ,HRTS1_N ), -PINMUX_IPSR_GPSR (IP2SR0_7_4 ,RTS1_N ), +PINMUX_IPSR_GPSR (IP2SR0_7_4 ,HRTS1_N_A ), +PINMUX_IPSR_GPSR (IP2SR0_7_4 ,RTS1_N_A ),PINMUX_IPSR_GPSR (IP2SR0_11_8 ,MSIOF2_RXD ), -PINMUX_IPSR_GPSR (IP2SR0_11_8 ,HSCK1 ), -PINMUX_IPSR_GPSR (IP2SR0_11_8 ,SCK1 ), +PINMUX_IPSR_GPSR (IP2SR0_11_8 ,HSCK1_A ), +PINMUX_IPSR_GPSR (IP2SR0_11_8 ,SCK1_A ),/* IP0SR1 */ PINMUX_IPSR_GPSR(IP0SR1_3_0, MSIOF1_SS2),
@@ -798,27 +798,27 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR1_23_20 ,MSIOF1_RXD ),PINMUX_IPSR_GPSR (IP0SR1_27_24 ,MSIOF0_SS2 ), -PINMUX_IPSR_GPSR (IP0SR1_27_24 ,HTX1_X ), -PINMUX_IPSR_GPSR (IP0SR1_27_24 ,TX1_X ), +PINMUX_IPSR_GPSR (IP0SR1_27_24 ,HTX1_B ), +PINMUX_IPSR_GPSR (IP0SR1_27_24 ,TX1_B ),PINMUX_IPSR_GPSR (IP0SR1_31_28 ,MSIOF0_SS1 ), -PINMUX_IPSR_GPSR (IP0SR1_31_28 ,HRX1_X ), -PINMUX_IPSR_GPSR (IP0SR1_31_28 ,RX1_X ), +PINMUX_IPSR_GPSR (IP0SR1_31_28 ,HRX1_B ), +PINMUX_IPSR_GPSR (IP0SR1_31_28 ,RX1_B ),/* IP1SR1 */ PINMUX_IPSR_GPSR (IP1SR1_3_0 ,MSIOF0_SYNC ), -PINMUX_IPSR_GPSR (IP1SR1_3_0 ,HCTS1_N_X ), -PINMUX_IPSR_GPSR (IP1SR1_3_0 ,CTS1_N_X ), +PINMUX_IPSR_GPSR (IP1SR1_3_0 ,HCTS1_N_B ), +PINMUX_IPSR_GPSR (IP1SR1_3_0 ,CTS1_N_B ),PINMUX_IPSR_GPSR (IP1SR1_3_0 ,CANFD5_TX_B ),PINMUX_IPSR_GPSR (IP1SR1_7_4 ,MSIOF0_TXD ), -PINMUX_IPSR_GPSR (IP1SR1_7_4 ,HRTS1_N_X ), -PINMUX_IPSR_GPSR (IP1SR1_7_4 ,RTS1_N_X ), +PINMUX_IPSR_GPSR (IP1SR1_7_4 ,HRTS1_N_B ), +PINMUX_IPSR_GPSR (IP1SR1_7_4 ,RTS1_N_B ),PINMUX_IPSR_GPSR (IP1SR1_7_4 ,CANFD5_RX_B ),PINMUX_IPSR_GPSR (IP1SR1_11_8 ,MSIOF0_SCK ), -PINMUX_IPSR_GPSR (IP1SR1_11_8 ,HSCK1_X ), -PINMUX_IPSR_GPSR (IP1SR1_11_8 ,SCK1_X ), +PINMUX_IPSR_GPSR (IP1SR1_11_8 ,HSCK1_B ), +PINMUX_IPSR_GPSR (IP1SR1_11_8 ,SCK1_B ), PINMUX_IPSR_GPSR(IP1SR1_15_12, MSIOF0_RXD),
@@ -1598,49 +1598,48 @@ static const unsigned int hscif0_ctrl_mux[] = { };/* - HSCIF1 ----------------------------------------------------------------- */ -static const unsigned int hscif1_data_pins[] = { -/* HRX1, HTX1 */ +static const unsigned int hscif1_data_a_pins[] = { +/* HRX1_A, HTX1_A */ RCAR_GP_PIN (0 ,15 ),RCAR_GP_PIN (0 ,14 ), }; -static const unsigned int hscif1_data_mux[] = { -HRX1_MARK ,HTX1_MARK , +static const unsigned int hscif1_data_a_mux[] = { +HRX1_A_MARK ,HTX1_A_MARK , }; -static const unsigned int hscif1_clk_pins[] = { -/* HSCK1 */ +static const unsigned int hscif1_clk_a_pins[] = { +/* HSCK1_A */ RCAR_GP_PIN (0 ,18 ), }; -static const unsigned int hscif1_clk_mux[] = { -HSCK1_MARK , +static const unsigned int hscif1_clk_a_mux[] = { +HSCK1_A_MARK , }; -static const unsigned int hscif1_ctrl_pins[] = { -/* HRTS1_N, HCTS1_N */ +static const unsigned int hscif1_ctrl_a_pins[] = { +/* HRTS1_N_A, HCTS1_N_A */ RCAR_GP_PIN (0 ,17 ),RCAR_GP_PIN (0 ,16 ), }; -static const unsigned int hscif1_ctrl_mux[] = { -HRTS1_N_MARK ,HCTS1_N_MARK , +static const unsigned int hscif1_ctrl_a_mux[] = { +HRTS1_N_A_MARK ,HCTS1_N_A_MARK , }; -/* - HSCIF1_X---------------------------------------------------------------- */ -static const unsigned int hscif1_data_x_pins[] = { -/* HRX1_X, HTX1_X */ +static const unsigned int hscif1_data_b_pins[] = { +/* HRX1_B, HTX1_B */ RCAR_GP_PIN (1 ,7 ),RCAR_GP_PIN (1 ,6 ), }; -static const unsigned int hscif1_data_x_mux[] = { -HRX1_X_MARK ,HTX1_X_MARK , +static const unsigned int hscif1_data_b_mux[] = { +HRX1_B_MARK ,HTX1_B_MARK , }; -static const unsigned int hscif1_clk_x_pins[] = { -/* HSCK1_X */ +static const unsigned int hscif1_clk_b_pins[] = { +/* HSCK1_B */ RCAR_GP_PIN (1 ,10 ), }; -static const unsigned int hscif1_clk_x_mux[] = { -HSCK1_X_MARK , +static const unsigned int hscif1_clk_b_mux[] = { +HSCK1_B_MARK , }; -static const unsigned int hscif1_ctrl_x_pins[] = { -/* HRTS1_N_X, HCTS1_N_X */ +static const unsigned int hscif1_ctrl_b_pins[] = { +/* HRTS1_N_B, HCTS1_N_B */ RCAR_GP_PIN (1 ,9 ),RCAR_GP_PIN (1 ,8 ), }; -static const unsigned int hscif1_ctrl_x_mux[] = { -HRTS1_N_X_MARK ,HCTS1_N_X_MARK , +static const unsigned int hscif1_ctrl_b_mux[] = { +HRTS1_N_B_MARK ,HCTS1_N_B_MARK , };/* - HSCIF2 ----------------------------------------------------------------- */
@@ -2260,49 +2259,48 @@ static const unsigned int scif0_ctrl_mux[] = { };/* - SCIF1 ------------------------------------------------------------------ */ -static const unsigned int scif1_data_pins[] = { -/* RX1, TX1 */ +static const unsigned int scif1_data_a_pins[] = { +/* RX1_A, TX1_A */ RCAR_GP_PIN (0 ,15 ),RCAR_GP_PIN (0 ,14 ), }; -static const unsigned int scif1_data_mux[] = { -RX1_MARK ,TX1_MARK , +static const unsigned int scif1_data_a_mux[] = { +RX1_A_MARK ,TX1_A_MARK , }; -static const unsigned int scif1_clk_pins[] = { -/* SCK1 */ +static const unsigned int scif1_clk_a_pins[] = { +/* SCK1_A */ RCAR_GP_PIN (0 ,18 ), }; -static const unsigned int scif1_clk_mux[] = { -SCK1_MARK , +static const unsigned int scif1_clk_a_mux[] = { +SCK1_A_MARK , }; -static const unsigned int scif1_ctrl_pins[] = { -/* RTS1_N, CTS1_N */ +static const unsigned int scif1_ctrl_a_pins[] = { +/* RTS1_N_A, CTS1_N_A */ RCAR_GP_PIN (0 ,17 ),RCAR_GP_PIN (0 ,16 ), }; -static const unsigned int scif1_ctrl_mux[] = { -RTS1_N_MARK ,CTS1_N_MARK , +static const unsigned int scif1_ctrl_a_mux[] = { +RTS1_N_A_MARK ,CTS1_N_A_MARK , }; -/* - SCIF1_X ------------------------------------------------------------------ */ -static const unsigned int scif1_data_x_pins[] = { -/* RX1_X, TX1_X */ +static const unsigned int scif1_data_b_pins[] = { +/* RX1_B, TX1_B */ RCAR_GP_PIN (1 ,7 ),RCAR_GP_PIN (1 ,6 ), }; -static const unsigned int scif1_data_x_mux[] = { -RX1_X_MARK ,TX1_X_MARK , +static const unsigned int scif1_data_b_mux[] = { +RX1_B_MARK ,TX1_B_MARK , }; -static const unsigned int scif1_clk_x_pins[] = { -/* SCK1_X */ +static const unsigned int scif1_clk_b_pins[] = { +/* SCK1_B */ RCAR_GP_PIN (1 ,10 ), }; -static const unsigned int scif1_clk_x_mux[] = { -SCK1_X_MARK , +static const unsigned int scif1_clk_b_mux[] = { +SCK1_B_MARK , }; -static const unsigned int scif1_ctrl_x_pins[] = { -/* RTS1_N_X, CTS1_N_X */ +static const unsigned int scif1_ctrl_b_pins[] = { +/* RTS1_N_B, CTS1_N_B */ RCAR_GP_PIN (1 ,9 ),RCAR_GP_PIN (1 ,8 ), }; -static const unsigned int scif1_ctrl_x_mux[] = { -RTS1_N_X_MARK ,CTS1_N_X_MARK , +static const unsigned int scif1_ctrl_b_mux[] = { +RTS1_N_B_MARK ,CTS1_N_B_MARK , };/* - SCIF3 ------------------------------------------------------------------ */
@@ -2586,12 +2584,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (hscif0_data),SH_PFC_PIN_GROUP (hscif0_clk),SH_PFC_PIN_GROUP (hscif0_ctrl), -SH_PFC_PIN_GROUP (hscif1_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_data_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_clk_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_ctrl_x),/* suffix might be updated */ +SH_PFC_PIN_GROUP (hscif1_data_a), +SH_PFC_PIN_GROUP (hscif1_clk_a), +SH_PFC_PIN_GROUP (hscif1_ctrl_a), +SH_PFC_PIN_GROUP (hscif1_data_b), +SH_PFC_PIN_GROUP (hscif1_clk_b), +SH_PFC_PIN_GROUP (hscif1_ctrl_b),SH_PFC_PIN_GROUP (hscif2_data),SH_PFC_PIN_GROUP (hscif2_clk), SH_PFC_PIN_GROUP(hscif2_ctrl),
@@ -2685,12 +2683,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif0_data),SH_PFC_PIN_GROUP (scif0_clk),SH_PFC_PIN_GROUP (scif0_ctrl), -SH_PFC_PIN_GROUP (scif1_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_data_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_clk_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_ctrl_x),/* suffix might be updated */ +SH_PFC_PIN_GROUP (scif1_data_a), +SH_PFC_PIN_GROUP (scif1_clk_a), +SH_PFC_PIN_GROUP (scif1_ctrl_a), +SH_PFC_PIN_GROUP (scif1_data_b), +SH_PFC_PIN_GROUP (scif1_clk_b), +SH_PFC_PIN_GROUP (scif1_ctrl_b),SH_PFC_PIN_GROUP (scif3_data),/* suffix might be updated */ SH_PFC_PIN_GROUP (scif3_clk),/* suffix might be updated */ SH_PFC_PIN_GROUP(scif3_ctrl), /* suffix might be updated */
@@ -2810,13 +2808,12 @@ static const char * const hscif0_groups[] = { };static const char *const hscif1_groups[] = { -/* suffix might be updated */ -"hscif1_data" , -"hscif1_clk" , -"hscif1_ctrl" , -"hscif1_data_x" , -"hscif1_clk_x" , -"hscif1_ctrl_x" , +"hscif1_data_a" , +"hscif1_clk_a" , +"hscif1_ctrl_a" , +"hscif1_data_b" , +"hscif1_clk_b" , +"hscif1_ctrl_b" , };static const char *const hscif2_groups[] = {
@@ -2993,13 +2990,12 @@ static const char * const scif0_groups[] = { };static const char *const scif1_groups[] = { -/* suffix might be updated */ -"scif1_data" , -"scif1_clk" , -"scif1_ctrl" , -"scif1_data_x" , -"scif1_clk_x" , -"scif1_ctrl_x" , +"scif1_data_a" , +"scif1_clk_a" , +"scif1_ctrl_a" , +"scif1_data_b" , +"scif1_clk_b" , +"scif1_ctrl_b" , };static const char *const scif3_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 338/568 pinctrl: renesas: r8a779g0: Fix (H)SCIF3 suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 5350f38150a171322b50c0a48efa671885f87050 ]
(H)SCIF instance 3 has two alternate pin groups: "hscif3" and "hscif3_a", resp. "scif3" and "scif3_a", but the actual meanings of the pins within the groups do not match.
Increase uniformity by adopting R-Car V4M naming:
- Rename "hscif3_a" to "hscif3_b",
- Rename "hscif3" to "hscif3_a",
- Rename "scif3" to "scif3_b".
While at it, remove unneeded separators.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 192 ++++++++++++------------- 1 file changed, 94 insertions(+), 98 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +94 -98
@@ -77,11 +77,11 @@#define GPSR0_0 F_(GP0_00, IP0SR0_3_0)/* GPSR1 */ -#define GPSR1_28 F_(HTX3, IP3SR1_19_16) -#define GPSR1_27 F_(HCTS3_N, IP3SR1_15_12) -#define GPSR1_26 F_(HRTS3_N, IP3SR1_11_8) -#define GPSR1_25 F_(HSCK3, IP3SR1_7_4) -#define GPSR1_24 F_(HRX3, IP3SR1_3_0) +#define GPSR1_28 F_(HTX3_A, IP3SR1_19_16) +#define GPSR1_27 F_(HCTS3_N_A, IP3SR1_15_12) +#define GPSR1_26 F_(HRTS3_N_A, IP3SR1_11_8) +#define GPSR1_25 F_(HSCK3_A, IP3SR1_7_4) +#define GPSR1_24 F_(HRX3_A, IP3SR1_3_0)#define GPSR1_23 F_(GP1_23, IP2SR1_31_28)#define GPSR1_22 F_(AUDIO_CLKIN, IP2SR1_27_24)#define GPSR1_21 F_(AUDIO_CLKOUT, IP2SR1_23_20)
@@ -301,11 +301,11 @@/* SR1 */ /* IP0SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP0SR1_3_0 FM(MSIOF1_SS2) FM(HTX3_A) FM(TX3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_7_4 FM(MSIOF1_SS1) FM(HCTS3_N_A) FM(RX3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_11_8 FM(MSIOF1_SYNC) FM(HRTS3_N_A) FM(RTS3_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_A) FM(CTS3_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_A) FM(SCK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_3_0 FM(MSIOF1_SS2) FM(HTX3_B) FM(TX3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_7_4 FM(MSIOF1_SS1) FM(HCTS3_N_B) FM(RX3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_11_8 FM(MSIOF1_SYNC) FM(HRTS3_N_B) FM(RTS3_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_B) FM(CTS3_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_B) FM(SCK3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_23_20 FM(MSIOF1_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_B) FM(TX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_B) FM(RX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -331,11 +331,11 @@#define IP2SR1_31_28 F_(0, 0) FM(TCLK2) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP3SR1_3_0 FM(HRX3) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_7_4 FM(HSCK3) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_11_8 FM(HRTS3_N) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_15_12 FM(HCTS3_N) FM(RX3_A) FM(MSIOF4_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_19_16 FM(HTX3) FM(TX3_A) FM(MSIOF4_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_15_12 FM(HCTS3_N_A) FM(RX3_A) FM(MSIOF4_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_19_16 FM(HTX3_A) FM(TX3_A) FM(MSIOF4_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* SR2 */ /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -776,24 +776,24 @@ static const u16 pinmux_data[] = {/* IP0SR1 */ PINMUX_IPSR_GPSR (IP0SR1_3_0 ,MSIOF1_SS2 ), -PINMUX_IPSR_GPSR (IP0SR1_3_0 ,HTX3_A ), -PINMUX_IPSR_GPSR (IP0SR1_3_0 ,TX3 ), +PINMUX_IPSR_GPSR (IP0SR1_3_0 ,HTX3_B ), +PINMUX_IPSR_GPSR (IP0SR1_3_0 ,TX3_B ),PINMUX_IPSR_GPSR (IP0SR1_7_4 ,MSIOF1_SS1 ), -PINMUX_IPSR_GPSR (IP0SR1_7_4 ,HCTS3_N_A ), -PINMUX_IPSR_GPSR (IP0SR1_7_4 ,RX3 ), +PINMUX_IPSR_GPSR (IP0SR1_7_4 ,HCTS3_N_B ), +PINMUX_IPSR_GPSR (IP0SR1_7_4 ,RX3_B ),PINMUX_IPSR_GPSR (IP0SR1_11_8 ,MSIOF1_SYNC ), -PINMUX_IPSR_GPSR (IP0SR1_11_8 ,HRTS3_N_A ), -PINMUX_IPSR_GPSR (IP0SR1_11_8 ,RTS3_N ), +PINMUX_IPSR_GPSR (IP0SR1_11_8 ,HRTS3_N_B ), +PINMUX_IPSR_GPSR (IP0SR1_11_8 ,RTS3_N_B ),PINMUX_IPSR_GPSR (IP0SR1_15_12 ,MSIOF1_SCK ), -PINMUX_IPSR_GPSR (IP0SR1_15_12 ,HSCK3_A ), -PINMUX_IPSR_GPSR (IP0SR1_15_12 ,CTS3_N ), +PINMUX_IPSR_GPSR (IP0SR1_15_12 ,HSCK3_B ), +PINMUX_IPSR_GPSR (IP0SR1_15_12 ,CTS3_N_B ),PINMUX_IPSR_GPSR (IP0SR1_19_16 ,MSIOF1_TXD ), -PINMUX_IPSR_GPSR (IP0SR1_19_16 ,HRX3_A ), -PINMUX_IPSR_GPSR (IP0SR1_19_16 ,SCK3 ), +PINMUX_IPSR_GPSR (IP0SR1_19_16 ,HRX3_B ), +PINMUX_IPSR_GPSR (IP0SR1_19_16 ,SCK3_B ), PINMUX_IPSR_GPSR(IP0SR1_23_20, MSIOF1_RXD),
@@ -864,25 +864,25 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_31_28 ,IRQ3_B ),/* IP3SR1 */ -PINMUX_IPSR_GPSR (IP3SR1_3_0 ,HRX3 ), +PINMUX_IPSR_GPSR (IP3SR1_3_0 ,HRX3_A ),PINMUX_IPSR_GPSR (IP3SR1_3_0 ,SCK3_A ),PINMUX_IPSR_GPSR (IP3SR1_3_0 ,MSIOF4_SS2 ), -PINMUX_IPSR_GPSR (IP3SR1_7_4 ,HSCK3 ), +PINMUX_IPSR_GPSR (IP3SR1_7_4 ,HSCK3_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,CTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,MSIOF4_SCK ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,TPU0TO0_A ), -PINMUX_IPSR_GPSR (IP3SR1_11_8 ,HRTS3_N ), +PINMUX_IPSR_GPSR (IP3SR1_11_8 ,HRTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,RTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,MSIOF4_TXD ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,TPU0TO1_A ), -PINMUX_IPSR_GPSR (IP3SR1_15_12 ,HCTS3_N ), +PINMUX_IPSR_GPSR (IP3SR1_15_12 ,HCTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_15_12 ,RX3_A ),PINMUX_IPSR_GPSR (IP3SR1_15_12 ,MSIOF4_RXD ), -PINMUX_IPSR_GPSR (IP3SR1_19_16 ,HTX3 ), +PINMUX_IPSR_GPSR (IP3SR1_19_16 ,HTX3_A ),PINMUX_IPSR_GPSR (IP3SR1_19_16 ,TX3_A ), PINMUX_IPSR_GPSR(IP3SR1_19_16, MSIOF4_SYNC),
@@ -1666,49 +1666,48 @@ static const unsigned int hscif2_ctrl_mux[] = { };/* - HSCIF3 ----------------------------------------------------------------- */ -static const unsigned int hscif3_data_pins[] = { -/* HRX3, HTX3 */ +static const unsigned int hscif3_data_a_pins[] = { +/* HRX3_A, HTX3_A */ RCAR_GP_PIN (1 ,24 ),RCAR_GP_PIN (1 ,28 ), }; -static const unsigned int hscif3_data_mux[] = { -HRX3_MARK ,HTX3_MARK , +static const unsigned int hscif3_data_a_mux[] = { +HRX3_A_MARK ,HTX3_A_MARK , }; -static const unsigned int hscif3_clk_pins[] = { -/* HSCK3 */ +static const unsigned int hscif3_clk_a_pins[] = { +/* HSCK3_A */ RCAR_GP_PIN (1 ,25 ), }; -static const unsigned int hscif3_clk_mux[] = { -HSCK3_MARK , +static const unsigned int hscif3_clk_a_mux[] = { +HSCK3_A_MARK , }; -static const unsigned int hscif3_ctrl_pins[] = { -/* HRTS3_N, HCTS3_N */ +static const unsigned int hscif3_ctrl_a_pins[] = { +/* HRTS3_N_A, HCTS3_N_A */ RCAR_GP_PIN (1 ,26 ),RCAR_GP_PIN (1 ,27 ), }; -static const unsigned int hscif3_ctrl_mux[] = { -HRTS3_N_MARK ,HCTS3_N_MARK , +static const unsigned int hscif3_ctrl_a_mux[] = { +HRTS3_N_A_MARK ,HCTS3_N_A_MARK , }; -/* - HSCIF3_A ----------------------------------------------------------------- */ -static const unsigned int hscif3_data_a_pins[] = { -/* HRX3_A, HTX3_A */ +static const unsigned int hscif3_data_b_pins[] = { +/* HRX3_B, HTX3_B */ RCAR_GP_PIN (1 ,4 ),RCAR_GP_PIN (1 ,0 ), }; -static const unsigned int hscif3_data_a_mux[] = { -HRX3_A_MARK ,HTX3_A_MARK , +static const unsigned int hscif3_data_b_mux[] = { +HRX3_B_MARK ,HTX3_B_MARK , }; -static const unsigned int hscif3_clk_a_pins[] = { -/* HSCK3_A */ +static const unsigned int hscif3_clk_b_pins[] = { +/* HSCK3_B */ RCAR_GP_PIN (1 ,3 ), }; -static const unsigned int hscif3_clk_a_mux[] = { -HSCK3_A_MARK , +static const unsigned int hscif3_clk_b_mux[] = { +HSCK3_B_MARK , }; -static const unsigned int hscif3_ctrl_a_pins[] = { -/* HRTS3_N_A, HCTS3_N_A */ +static const unsigned int hscif3_ctrl_b_pins[] = { +/* HRTS3_N_B, HCTS3_N_B */ RCAR_GP_PIN (1 ,2 ),RCAR_GP_PIN (1 ,1 ), }; -static const unsigned int hscif3_ctrl_a_mux[] = { -HRTS3_N_A_MARK ,HCTS3_N_A_MARK , +static const unsigned int hscif3_ctrl_b_mux[] = { +HRTS3_N_B_MARK ,HCTS3_N_B_MARK , };/* - I2C0 ------------------------------------------------------------------- */
@@ -2304,29 +2303,6 @@ static const unsigned int scif1_ctrl_b_mux[] = { };/* - SCIF3 ------------------------------------------------------------------ */ -static const unsigned int scif3_data_pins[] = { -/* RX3, TX3 */ -RCAR_GP_PIN (1 ,1 ),RCAR_GP_PIN (1 ,0 ), -}; -static const unsigned int scif3_data_mux[] = { -RX3_MARK ,TX3_MARK , -}; -static const unsigned int scif3_clk_pins[] = { -/* SCK3 */ -RCAR_GP_PIN (1 ,4 ), -}; -static const unsigned int scif3_clk_mux[] = { -SCK3_MARK , -}; -static const unsigned int scif3_ctrl_pins[] = { -/* RTS3_N, CTS3_N */ -RCAR_GP_PIN (1 ,2 ),RCAR_GP_PIN (1 ,3 ), -}; -static const unsigned int scif3_ctrl_mux[] = { -RTS3_N_MARK ,CTS3_N_MARK , -}; - -/* - SCIF3_A ------------------------------------------------------------------ */ static const unsigned int scif3_data_a_pins[] = {/* RX3_A, TX3_A */ RCAR_GP_PIN (1 ,27 ),RCAR_GP_PIN (1 ,28 ),
@@ -2349,6 +2325,28 @@ static const unsigned int scif3_ctrl_a_mux[] = { RTS3_N_A_MARK, CTS3_N_A_MARK, }; +static const unsigned int scif3_data_b_pins[] = { +/* RX3_B, TX3_B */ +RCAR_GP_PIN (1 ,1 ),RCAR_GP_PIN (1 ,0 ), +}; +static const unsigned int scif3_data_b_mux[] = { +RX3_B_MARK ,TX3_B_MARK , +}; +static const unsigned int scif3_clk_b_pins[] = { +/* SCK3_B */ +RCAR_GP_PIN (1 ,4 ), +}; +static const unsigned int scif3_clk_b_mux[] = { +SCK3_B_MARK , +}; +static const unsigned int scif3_ctrl_b_pins[] = { +/* RTS3_N_B, CTS3_N_B */ +RCAR_GP_PIN (1 ,2 ),RCAR_GP_PIN (1 ,3 ), +}; +static const unsigned int scif3_ctrl_b_mux[] = { +RTS3_N_B_MARK ,CTS3_N_B_MARK , +}; +/* - SCIF4 ------------------------------------------------------------------ */ static const unsigned int scif4_data_pins[] = {/* RX4, TX4 */
@@ -2593,12 +2591,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (hscif2_data),SH_PFC_PIN_GROUP (hscif2_clk),SH_PFC_PIN_GROUP (hscif2_ctrl), -SH_PFC_PIN_GROUP (hscif3_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_data_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_clk_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_ctrl_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (hscif3_data_a), +SH_PFC_PIN_GROUP (hscif3_clk_a), +SH_PFC_PIN_GROUP (hscif3_ctrl_a), +SH_PFC_PIN_GROUP (hscif3_data_b), +SH_PFC_PIN_GROUP (hscif3_clk_b), +SH_PFC_PIN_GROUP (hscif3_ctrl_b),SH_PFC_PIN_GROUP (i2c0), SH_PFC_PIN_GROUP(i2c1),
@@ -2689,12 +2687,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif1_data_b),SH_PFC_PIN_GROUP (scif1_clk_b),SH_PFC_PIN_GROUP (scif1_ctrl_b), -SH_PFC_PIN_GROUP (scif3_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_data_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_clk_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_ctrl_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (scif3_data_a), +SH_PFC_PIN_GROUP (scif3_clk_a), +SH_PFC_PIN_GROUP (scif3_ctrl_a), +SH_PFC_PIN_GROUP (scif3_data_b), +SH_PFC_PIN_GROUP (scif3_clk_b), +SH_PFC_PIN_GROUP (scif3_ctrl_b),SH_PFC_PIN_GROUP (scif4_data),SH_PFC_PIN_GROUP (scif4_clk), SH_PFC_PIN_GROUP(scif4_ctrl),
@@ -2823,13 +2821,12 @@ static const char * const hscif2_groups[] = { };static const char *const hscif3_groups[] = { -/* suffix might be updated */ -"hscif3_data" , -"hscif3_clk" , -"hscif3_ctrl" ,"hscif3_data_a" ,"hscif3_clk_a" ,"hscif3_ctrl_a" , +"hscif3_data_b" , +"hscif3_clk_b" , +"hscif3_ctrl_b" , };static const char *const i2c0_groups[] = {
@@ -2999,13 +2996,12 @@ static const char * const scif1_groups[] = { };static const char *const scif3_groups[] = { -/* suffix might be updated */ -"scif3_data" , -"scif3_clk" , -"scif3_ctrl" ,"scif3_data_a" ,"scif3_clk_a" ,"scif3_ctrl_a" , +"scif3_data_b" , +"scif3_clk_b" , +"scif3_ctrl_b" , };static const char *const scif4_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 339/568 pinctrl: renesas: r8a779g0: Fix IRQ suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit c391dcde3884dbbea37f57dd2625225d8661da97 ]
The suffixes of the IRQ identifiers for external interrupts 0-3 are inconsistent:
- "IRQ0" and "IRQ0_A",
- "IRQ1" and "IRQ1_A",
- "IRQ2" and "IRQ2_A",
- "IRQ3" and "IRQ3_B".
The suffixes for external interrupts 4 and 5 do follow conventional naming:
- "IRQ4A" and IRQ4_B",
- "IRQ5".
Fix this by adopting R-Car V4M naming:
- Rename "IRQ[0-2]_A" to "IRQ[0-2]_B",
- Rename "IRQ[0-3]" to "IRQ[0-3]_A".
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +18 -18
@@ -68,10 +68,10 @@#define GPSR0_9 F_(MSIOF5_SYNC, IP1SR0_7_4)#define GPSR0_8 F_(MSIOF5_SS1, IP1SR0_3_0)#define GPSR0_7 F_(MSIOF5_SS2, IP0SR0_31_28) -#define GPSR0_6 F_(IRQ0, IP0SR0_27_24) -#define GPSR0_5 F_(IRQ1, IP0SR0_23_20) -#define GPSR0_4 F_(IRQ2, IP0SR0_19_16) -#define GPSR0_3 F_(IRQ3, IP0SR0_15_12) +#define GPSR0_6 F_(IRQ0_A, IP0SR0_27_24) +#define GPSR0_5 F_(IRQ1_A, IP0SR0_23_20) +#define GPSR0_4 F_(IRQ2_A, IP0SR0_19_16) +#define GPSR0_3 F_(IRQ3_A, IP0SR0_15_12)#define GPSR0_2 F_(GP0_02, IP0SR0_11_8)#define GPSR0_1 F_(GP0_01, IP0SR0_7_4)#define GPSR0_0 F_(GP0_00, IP0SR0_3_0)
@@ -278,10 +278,10 @@#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_7_4 F_(0, 0) FM(MSIOF3_SS1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_11_8 F_(0, 0) FM(MSIOF3_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_15_12 FM(IRQ3) FM(MSIOF3_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_19_16 FM(IRQ2) FM(MSIOF3_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_23_20 FM(IRQ1) FM(MSIOF3_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_27_24 FM(IRQ0) FM(MSIOF3_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_15_12 FM(IRQ3_A) FM(MSIOF3_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_19_16 FM(IRQ2_A) FM(MSIOF3_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_23_20 FM(IRQ1_A) FM(MSIOF3_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_27_24 FM(IRQ0_A) FM(MSIOF3_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_31_28 FM(MSIOF5_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -290,7 +290,7 @@#define IP1SR0_11_8 FM(MSIOF5_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_15_12 FM(MSIOF5_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_19_16 FM(MSIOF5_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -325,8 +325,8 @@#define IP2SR1_7_4 FM(SCIF_CLK) FM(IRQ4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_27_24 FM(AUDIO_CLKIN) FM(PWM3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_31_28 F_(0, 0) FM(TCLK2) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -724,16 +724,16 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR0_11_8 ,MSIOF3_SS2 ), -PINMUX_IPSR_GPSR (IP0SR0_15_12 ,IRQ3 ), +PINMUX_IPSR_GPSR (IP0SR0_15_12 ,IRQ3_A ),PINMUX_IPSR_GPSR (IP0SR0_15_12 ,MSIOF3_SCK ), -PINMUX_IPSR_GPSR (IP0SR0_19_16 ,IRQ2 ), +PINMUX_IPSR_GPSR (IP0SR0_19_16 ,IRQ2_A ),PINMUX_IPSR_GPSR (IP0SR0_19_16 ,MSIOF3_TXD ), -PINMUX_IPSR_GPSR (IP0SR0_23_20 ,IRQ1 ), +PINMUX_IPSR_GPSR (IP0SR0_23_20 ,IRQ1_A ),PINMUX_IPSR_GPSR (IP0SR0_23_20 ,MSIOF3_RXD ), -PINMUX_IPSR_GPSR (IP0SR0_27_24 ,IRQ0 ), +PINMUX_IPSR_GPSR (IP0SR0_27_24 ,IRQ0_A ),PINMUX_IPSR_GPSR (IP0SR0_27_24 ,MSIOF3_SYNC ), PINMUX_IPSR_GPSR(IP0SR0_31_28, MSIOF5_SS2),
@@ -751,7 +751,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR0_23_20 ,MSIOF2_SS2 ),PINMUX_IPSR_GPSR (IP1SR0_23_20 ,TCLK1 ), -PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_A ), +PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_B ),PINMUX_IPSR_GPSR (IP1SR0_27_24 ,MSIOF2_SS1 ), PINMUX_IPSR_GPSR(IP1SR0_27_24, HTX1_A),
@@ -851,10 +851,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_15_12 ,TCLK4 ),PINMUX_IPSR_GPSR (IP2SR1_19_16 ,SSI_SD ), -PINMUX_IPSR_GPSR (IP2SR1_19_16 ,IRQ0_A ), +PINMUX_IPSR_GPSR (IP2SR1_19_16 ,IRQ0_B ),PINMUX_IPSR_GPSR (IP2SR1_23_20 ,AUDIO_CLKOUT ), -PINMUX_IPSR_GPSR (IP2SR1_23_20 ,IRQ1_A ), +PINMUX_IPSR_GPSR (IP2SR1_23_20 ,IRQ1_B ),PINMUX_IPSR_GPSR (IP2SR1_27_24 ,AUDIO_CLKIN ), PINMUX_IPSR_GPSR(IP2SR1_27_24, PWM3_A),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 340/568 pinctrl: renesas: r8a779g0: FIX PWM suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 0aabdc9a4d3644fd57d804b283b2ab0f9c28dc6c ]
PWM channels 0, 2, 8, and 9 do not have alternate pins. Remove their "_a" or "_b" suffixes to increase uniformity.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 76 ++++++++++++-------------- 1 file changed, 36 insertions(+), 40 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +36 -40
@@ -316,9 +316,9 @@#define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_B) FM(SCK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_15_12 FM(MSIOF0_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_19_16 FM(HTX0) FM(TX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_N) FM(PWM8_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_27_24 FM(HRTS0_N) FM(RTS0_N) FM(PWM9_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_31_28 FM(HSCK0) FM(SCK0) FM(PWM0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_N) FM(PWM8) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_27_24 FM(HRTS0_N) FM(RTS0_N) FM(PWM9) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_31_28 FM(HSCK0) FM(SCK0) FM(PWM0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP2SR1_3_0 FM(HRX0) FM(RX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -355,7 +355,7 @@#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -827,15 +827,15 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR1_23_20 ,HCTS0_N ),PINMUX_IPSR_GPSR (IP1SR1_23_20 ,CTS0_N ), -PINMUX_IPSR_GPSR (IP1SR1_23_20 ,PWM8_A ), +PINMUX_IPSR_GPSR (IP1SR1_23_20 ,PWM8 ),PINMUX_IPSR_GPSR (IP1SR1_27_24 ,HRTS0_N ),PINMUX_IPSR_GPSR (IP1SR1_27_24 ,RTS0_N ), -PINMUX_IPSR_GPSR (IP1SR1_27_24 ,PWM9_A ), +PINMUX_IPSR_GPSR (IP1SR1_27_24 ,PWM9 ),PINMUX_IPSR_GPSR (IP1SR1_31_28 ,HSCK0 ),PINMUX_IPSR_GPSR (IP1SR1_31_28 ,SCK0 ), -PINMUX_IPSR_GPSR (IP1SR1_31_28 ,PWM0_A ), +PINMUX_IPSR_GPSR (IP1SR1_31_28 ,PWM0 ),/* IP2SR1 */ PINMUX_IPSR_GPSR(IP2SR1_3_0, HRX0),
@@ -937,7 +937,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TCLK4_A ),PINMUX_IPSR_GPSR (IP1SR2_27_24 ,CANFD3_TX ), -PINMUX_IPSR_GPSR (IP1SR2_27_24 ,PWM2_B ), +PINMUX_IPSR_GPSR (IP1SR2_27_24 ,PWM2 ),PINMUX_IPSR_GPSR (IP1SR2_31_28 ,CANFD3_RX ), PINMUX_IPSR_GPSR(IP1SR2_31_28, PWM3_B),
@@ -2090,13 +2090,13 @@ static const unsigned int pcie1_clkreq_n_mux[] = { PCIE1_CLKREQ_N_MARK, }; -/* - PWM0_A ------------------------------------------------------------------- */ -static const unsigned int pwm0_a_pins[] = { -/* PWM0_A */ +/* - PWM0 ------------------------------------------------------------------- */ +static const unsigned int pwm0_pins[] = { +/* PWM0 */ RCAR_GP_PIN (1 ,15 ), }; -static const unsigned int pwm0_a_mux[] = { -PWM0_A_MARK , +static const unsigned int pwm0_mux[] = { +PWM0_MARK , };/* - PWM1_A ------------------------------------------------------------------- */
@@ -2117,13 +2117,13 @@ static const unsigned int pwm1_b_mux[] = { PWM1_B_MARK, }; -/* - PWM2_B ------------------------------------------------------------------- */ -static const unsigned int pwm2_b_pins[] = { -/* PWM2_B */ +/* - PWM2 ------------------------------------------------------------------- */ +static const unsigned int pwm2_pins[] = { +/* PWM2 */ RCAR_GP_PIN (2 ,14 ), }; -static const unsigned int pwm2_b_mux[] = { -PWM2_B_MARK , +static const unsigned int pwm2_mux[] = { +PWM2_MARK , };/* - PWM3_A ------------------------------------------------------------------- */
@@ -2180,22 +2180,22 @@ static const unsigned int pwm7_mux[] = { PWM7_MARK, }; -/* - PWM8_A ------------------------------------------------------------------- */ -static const unsigned int pwm8_a_pins[] = { -/* PWM8_A */ +/* - PWM8 ------------------------------------------------------------------- */ +static const unsigned int pwm8_pins[] = { +/* PWM8 */ RCAR_GP_PIN (1 ,13 ), }; -static const unsigned int pwm8_a_mux[] = { -PWM8_A_MARK , +static const unsigned int pwm8_mux[] = { +PWM8_MARK , }; -/* - PWM9_A ------------------------------------------------------------------- */ -static const unsigned int pwm9_a_pins[] = { -/* PWM9_A */ +/* - PWM9 ------------------------------------------------------------------- */ +static const unsigned int pwm9_pins[] = { +/* PWM9 */ RCAR_GP_PIN (1 ,14 ), }; -static const unsigned int pwm9_a_mux[] = { -PWM9_A_MARK , +static const unsigned int pwm9_mux[] = { +PWM9_MARK , };/* - QSPI0 ------------------------------------------------------------------ */
@@ -2658,18 +2658,18 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (pcie0_clkreq_n),SH_PFC_PIN_GROUP (pcie1_clkreq_n), -SH_PFC_PIN_GROUP (pwm0_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (pwm0),SH_PFC_PIN_GROUP (pwm1_a),SH_PFC_PIN_GROUP (pwm1_b), -SH_PFC_PIN_GROUP (pwm2_b),/* suffix might be updated */ +SH_PFC_PIN_GROUP (pwm2),SH_PFC_PIN_GROUP (pwm3_a),SH_PFC_PIN_GROUP (pwm3_b),SH_PFC_PIN_GROUP (pwm4),SH_PFC_PIN_GROUP (pwm5),SH_PFC_PIN_GROUP (pwm6),SH_PFC_PIN_GROUP (pwm7), -SH_PFC_PIN_GROUP (pwm8_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (pwm9_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (pwm8), +SH_PFC_PIN_GROUP (pwm9),SH_PFC_PIN_GROUP (qspi0_ctrl), BUS_DATA_PIN_GROUP(qspi0_data, 2),
@@ -2923,8 +2923,7 @@ static const char * const pcie_groups[] = { };static const char *const pwm0_groups[] = { -/* suffix might be updated */ -"pwm0_a" , +"pwm0" , };static const char *const pwm1_groups[] = {
@@ -2933,8 +2932,7 @@ static const char * const pwm1_groups[] = { };static const char *const pwm2_groups[] = { -/* suffix might be updated */ -"pwm2_b" , +"pwm2" , };static const char *const pwm3_groups[] = {
@@ -2959,13 +2957,11 @@ static const char * const pwm7_groups[] = { };static const char *const pwm8_groups[] = { -/* suffix might be updated */ -"pwm8_a" , +"pwm8" , };static const char *const pwm9_groups[] = { -/* suffix might be updated */ -"pwm9_a" , +"pwm9" , };static const char *const qspi0_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 341/568 pinctrl: renesas: r8a779g0: Fix TCLK suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit bfd2428f3a80647af681df4793e473258aa755da ]
The Pin Multiplex attachment in Rev.1.10 of the R-Car V4H Series Hardware User's Manual still has two alternate pins named both TCLK3 and TCLK4. To differentiate, the pin control driver uses "TCLK[34]" and "TCLK[34]_X". In addition, there are alternate pins without suffix, and with an "_A" or "_B" suffix.
Increase uniformity by adopting R-Car V4M naming:
- Rename "TCLK2_B" to "TCLK2_C",
- Rename "TCLK[12]_A" to "TCLK[12]_B",
- Rename "TCLK[12]" to "TCLK[12]_A",
- Rename "TCLK[34]_A" to "TCLK[34]_C",
- Rename "TCLK[34]_X" to "TCLK[34]_A",
- Rename "TCLK[34]" to "TCLK[34]_B".
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +22 -22
@@ -275,7 +275,7 @@/* SR0 */ /* IP0SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_7_4 F_(0, 0) FM(MSIOF3_SS1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_11_8 F_(0, 0) FM(MSIOF3_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_15_12 FM(IRQ3_A) FM(MSIOF3_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -290,7 +290,7 @@#define IP1SR0_11_8 FM(MSIOF5_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_15_12 FM(MSIOF5_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_19_16 FM(MSIOF5_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1_A) FM(IRQ2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -323,12 +323,12 @@/* IP2SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP2SR1_3_0 FM(HRX0) FM(RX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_7_4 FM(SCIF_CLK) FM(IRQ4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_27_24 FM(AUDIO_CLKIN) FM(PWM3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_31_28 F_(0, 0) FM(TCLK2) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_31_28 F_(0, 0) FM(TCLK2_A) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -346,15 +346,15 @@#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_23_20 FM(FXR_TXENB_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -381,8 +381,8 @@#define IP1SR3_11_8 FM(MMC_SD_CMD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR3_15_12 FM(SD_CD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR3_19_16 FM(SD_WP) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR3_23_20 FM(IPC_CLKIN) FM(IPC_CLKEN_IN) FM(PWM1_A) FM(TCLK3_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR3_27_24 FM(IPC_CLKOUT) FM(IPC_CLKEN_OUT) FM(ERROROUTC_N_A) FM(TCLK4_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR3_23_20 FM(IPC_CLKIN) FM(IPC_CLKEN_IN) FM(PWM1_A) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR3_27_24 FM(IPC_CLKOUT) FM(IPC_CLKEN_OUT) FM(ERROROUTC_N_A) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR3_31_28 FM(QSPI0_SSL) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR3 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -718,7 +718,7 @@ static const u16 pinmux_data[] = {/* IP0SR0 */ PINMUX_IPSR_GPSR (IP0SR0_3_0 ,ERROROUTC_N_B ), -PINMUX_IPSR_GPSR (IP0SR0_3_0 ,TCLK2_A ), +PINMUX_IPSR_GPSR (IP0SR0_3_0 ,TCLK2_B ), PINMUX_IPSR_GPSR(IP0SR0_7_4, MSIOF3_SS1),
@@ -750,7 +750,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR0_19_16 ,MSIOF5_RXD ),PINMUX_IPSR_GPSR (IP1SR0_23_20 ,MSIOF2_SS2 ), -PINMUX_IPSR_GPSR (IP1SR0_23_20 ,TCLK1 ), +PINMUX_IPSR_GPSR (IP1SR0_23_20 ,TCLK1_A ),PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_B ), PINMUX_IPSR_GPSR(IP1SR0_27_24, MSIOF2_SS1),
@@ -845,10 +845,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_7_4 ,IRQ4_A ),PINMUX_IPSR_GPSR (IP2SR1_11_8 ,SSI_SCK ), -PINMUX_IPSR_GPSR (IP2SR1_11_8 ,TCLK3 ), +PINMUX_IPSR_GPSR (IP2SR1_11_8 ,TCLK3_B ),PINMUX_IPSR_GPSR (IP2SR1_15_12 ,SSI_WS ), -PINMUX_IPSR_GPSR (IP2SR1_15_12 ,TCLK4 ), +PINMUX_IPSR_GPSR (IP2SR1_15_12 ,TCLK4_B ),PINMUX_IPSR_GPSR (IP2SR1_19_16 ,SSI_SD ), PINMUX_IPSR_GPSR(IP2SR1_19_16, IRQ0_B),
@@ -859,7 +859,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_27_24 ,AUDIO_CLKIN ),PINMUX_IPSR_GPSR (IP2SR1_27_24 ,PWM3_A ), -PINMUX_IPSR_GPSR (IP2SR1_31_28 ,TCLK2 ), +PINMUX_IPSR_GPSR (IP2SR1_31_28 ,TCLK2_A ),PINMUX_IPSR_GPSR (IP2SR1_31_28 ,MSIOF4_SS1 ), PINMUX_IPSR_GPSR(IP2SR1_31_28, IRQ3_B),
@@ -911,12 +911,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TPU0TO1 ),PINMUX_IPSR_GPSR (IP0SR2_31_28 ,CANFD6_TX ), -PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TCLK2_B ), +PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TCLK2_C ),/* IP1SR2 */ PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TPU0TO0 ),PINMUX_IPSR_GPSR (IP1SR2_3_0 ,CANFD6_RX ), -PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TCLK1_A ), +PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TCLK1_B ),PINMUX_IPSR_GPSR (IP1SR2_7_4 ,CAN_CLK ), PINMUX_IPSR_GPSR(IP1SR2_7_4, FXR_TXENA_N_B),
@@ -929,12 +929,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_19_16 ,CANFD2_TX ),PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TPU0TO2 ), -PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TCLK3_A ), +PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TCLK3_C ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,CANFD2_RX ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TPU0TO3 ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,PWM1_B ), -PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TCLK4_A ), +PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TCLK4_C ),PINMUX_IPSR_GPSR (IP1SR2_27_24 ,CANFD3_TX ), PINMUX_IPSR_GPSR(IP1SR2_27_24, PWM2),
@@ -979,12 +979,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR3_23_20 ,IPC_CLKIN ),PINMUX_IPSR_GPSR (IP1SR3_23_20 ,IPC_CLKEN_IN ),PINMUX_IPSR_GPSR (IP1SR3_23_20 ,PWM1_A ), -PINMUX_IPSR_GPSR (IP1SR3_23_20 ,TCLK3_X ), +PINMUX_IPSR_GPSR (IP1SR3_23_20 ,TCLK3_A ),PINMUX_IPSR_GPSR (IP1SR3_27_24 ,IPC_CLKOUT ),PINMUX_IPSR_GPSR (IP1SR3_27_24 ,IPC_CLKEN_OUT ),PINMUX_IPSR_GPSR (IP1SR3_27_24 ,ERROROUTC_N_A ), -PINMUX_IPSR_GPSR (IP1SR3_27_24 ,TCLK4_X ), +PINMUX_IPSR_GPSR (IP1SR3_27_24 ,TCLK4_A ), PINMUX_IPSR_GPSR(IP1SR3_31_28, QSPI0_SSL),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 342/568 pinctrl: renesas: r8a779g0: Fix TPU suffixes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3d144ef10a448f89065dcff39c40d90ac18e035e ]
The Timer Pulse Unit channels have two alternate pin groups:
"tpu_to[0-3]" and "tpu_to[0-3]_a".
Increase uniformity by adopting R-Car V4M naming:
- Rename "tpu_to[0-3]_a" to "tpu_to[0-3]_b",
- Rename "tpu_to[0-3]" to "tpu_to[0-3]_a",
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 128 ++++++++++++------------- 1 file changed, 63 insertions(+), 65 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +63 -65
@@ -119,8 +119,8 @@#define GPSR2_11 F_(CANFD0_RX, IP1SR2_15_12)#define GPSR2_10 F_(CANFD0_TX, IP1SR2_11_8)#define GPSR2_9 F_(CAN_CLK, IP1SR2_7_4) -#define GPSR2_8 F_(TPU0TO0, IP1SR2_3_0) -#define GPSR2_7 F_(TPU0TO1, IP0SR2_31_28) +#define GPSR2_8 F_(TPU0TO0_A, IP1SR2_3_0) +#define GPSR2_7 F_(TPU0TO1_A, IP0SR2_31_28)#define GPSR2_6 F_(FXR_TXDB, IP0SR2_27_24)#define GPSR2_5 F_(FXR_TXENB_N_A, IP0SR2_23_20)#define GPSR2_4 F_(RXDB_EXTFXR, IP0SR2_19_16)
@@ -332,29 +332,29 @@/* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP3SR1_15_12 FM(HCTS3_N_A) FM(RX3_A) FM(MSIOF4_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP3SR1_19_16 FM(HTX3_A) FM(TX3_A) FM(MSIOF4_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* SR2 */ /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_7_4 FM(FXR_TXENA_N_A) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_7_4 FM(FXR_TXENA_N_A) FM(CANFD1_RX) FM(TPU0TO3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX_A) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX_A) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_23_20 FM(FXR_TXENB_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_31_28 FM(TPU0TO1_A) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_3_0 FM(TPU0TO0_A) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2_A) F_(0, 0) FM(TCLK3_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3_A) FM(PWM1_B) FM(TCLK4_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -871,12 +871,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP3SR1_7_4 ,HSCK3_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,CTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,MSIOF4_SCK ), -PINMUX_IPSR_GPSR (IP3SR1_7_4 ,TPU0TO0_A ), +PINMUX_IPSR_GPSR (IP3SR1_7_4 ,TPU0TO0_B ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,HRTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,RTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,MSIOF4_TXD ), -PINMUX_IPSR_GPSR (IP3SR1_11_8 ,TPU0TO1_A ), +PINMUX_IPSR_GPSR (IP3SR1_11_8 ,TPU0TO1_B ),PINMUX_IPSR_GPSR (IP3SR1_15_12 ,HCTS3_N_A ), PINMUX_IPSR_GPSR(IP3SR1_15_12, RX3_A),
@@ -889,11 +889,11 @@ static const u16 pinmux_data[] = {/* IP0SR2 */ PINMUX_IPSR_GPSR (IP0SR2_3_0 ,FXR_TXDA ),PINMUX_IPSR_GPSR (IP0SR2_3_0 ,CANFD1_TX ), -PINMUX_IPSR_GPSR (IP0SR2_3_0 ,TPU0TO2_A ), +PINMUX_IPSR_GPSR (IP0SR2_3_0 ,TPU0TO2_B ),PINMUX_IPSR_GPSR (IP0SR2_7_4 ,FXR_TXENA_N_A ),PINMUX_IPSR_GPSR (IP0SR2_7_4 ,CANFD1_RX ), -PINMUX_IPSR_GPSR (IP0SR2_7_4 ,TPU0TO3_A ), +PINMUX_IPSR_GPSR (IP0SR2_7_4 ,TPU0TO3_B ),PINMUX_IPSR_GPSR (IP0SR2_11_8 ,RXDA_EXTFXR ), PINMUX_IPSR_GPSR(IP0SR2_11_8, CANFD5_TX_A),
@@ -909,12 +909,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_27_24 ,FXR_TXDB ), -PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TPU0TO1 ), +PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TPU0TO1_A ),PINMUX_IPSR_GPSR (IP0SR2_31_28 ,CANFD6_TX ),PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TCLK2_C ),/* IP1SR2 */ -PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TPU0TO0 ), +PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TPU0TO0_A ),PINMUX_IPSR_GPSR (IP1SR2_3_0 ,CANFD6_RX ), PINMUX_IPSR_GPSR(IP1SR2_3_0, TCLK1_B),
@@ -928,11 +928,11 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_15_12 ,STPWT_EXTFXR ),PINMUX_IPSR_GPSR (IP1SR2_19_16 ,CANFD2_TX ), -PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TPU0TO2 ), +PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TPU0TO2_A ),PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TCLK3_C ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,CANFD2_RX ), -PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TPU0TO3 ), +PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TPU0TO3_A ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,PWM1_B ), PINMUX_IPSR_GPSR(IP1SR2_23_20, TCLK4_C),
@@ -2403,64 +2403,63 @@ static const unsigned int ssi_ctrl_mux[] = { SSI_SCK_MARK, SSI_WS_MARK, }; -/* - TPU ------------------------------------------------------------------- */ -static const unsigned int tpu_to0_pins[] = { -/* TPU0TO0 */ +/* - TPU -------------------------------------------------------------------- */ +static const unsigned int tpu_to0_a_pins[] = { +/* TPU0TO0_A */ RCAR_GP_PIN (2 ,8 ), }; -static const unsigned int tpu_to0_mux[] = { -TPU0TO0_MARK , +static const unsigned int tpu_to0_a_mux[] = { +TPU0TO0_A_MARK , }; -static const unsigned int tpu_to1_pins[] = { -/* TPU0TO1 */ +static const unsigned int tpu_to1_a_pins[] = { +/* TPU0TO1_A */ RCAR_GP_PIN (2 ,7 ), }; -static const unsigned int tpu_to1_mux[] = { -TPU0TO1_MARK , +static const unsigned int tpu_to1_a_mux[] = { +TPU0TO1_A_MARK , }; -static const unsigned int tpu_to2_pins[] = { -/* TPU0TO2 */ +static const unsigned int tpu_to2_a_pins[] = { +/* TPU0TO2_A */ RCAR_GP_PIN (2 ,12 ), }; -static const unsigned int tpu_to2_mux[] = { -TPU0TO2_MARK , +static const unsigned int tpu_to2_a_mux[] = { +TPU0TO2_A_MARK , }; -static const unsigned int tpu_to3_pins[] = { -/* TPU0TO3 */ +static const unsigned int tpu_to3_a_pins[] = { +/* TPU0TO3_A */ RCAR_GP_PIN (2 ,13 ), }; -static const unsigned int tpu_to3_mux[] = { -TPU0TO3_MARK , +static const unsigned int tpu_to3_a_mux[] = { +TPU0TO3_A_MARK , }; -/* - TPU_A ------------------------------------------------------------------- */ -static const unsigned int tpu_to0_a_pins[] = { -/* TPU0TO0_A */ +static const unsigned int tpu_to0_b_pins[] = { +/* TPU0TO0_B */ RCAR_GP_PIN (1 ,25 ), }; -static const unsigned int tpu_to0_a_mux[] = { -TPU0TO0_A_MARK , +static const unsigned int tpu_to0_b_mux[] = { +TPU0TO0_B_MARK , }; -static const unsigned int tpu_to1_a_pins[] = { -/* TPU0TO1_A */ +static const unsigned int tpu_to1_b_pins[] = { +/* TPU0TO1_B */ RCAR_GP_PIN (1 ,26 ), }; -static const unsigned int tpu_to1_a_mux[] = { -TPU0TO1_A_MARK , +static const unsigned int tpu_to1_b_mux[] = { +TPU0TO1_B_MARK , }; -static const unsigned int tpu_to2_a_pins[] = { -/* TPU0TO2_A */ +static const unsigned int tpu_to2_b_pins[] = { +/* TPU0TO2_B */ RCAR_GP_PIN (2 ,0 ), }; -static const unsigned int tpu_to2_a_mux[] = { -TPU0TO2_A_MARK , +static const unsigned int tpu_to2_b_mux[] = { +TPU0TO2_B_MARK , }; -static const unsigned int tpu_to3_a_pins[] = { -/* TPU0TO3_A */ +static const unsigned int tpu_to3_b_pins[] = { +/* TPU0TO3_B */ RCAR_GP_PIN (2 ,1 ), }; -static const unsigned int tpu_to3_a_mux[] = { -TPU0TO3_A_MARK , +static const unsigned int tpu_to3_b_mux[] = { +TPU0TO3_B_MARK , };/* - TSN0 ------------------------------------------------ */
@@ -2702,14 +2701,14 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (ssi_data),SH_PFC_PIN_GROUP (ssi_ctrl), -SH_PFC_PIN_GROUP (tpu_to0),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to0_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to1),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to1_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to2),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to2_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to3),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to3_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (tpu_to0_a), +SH_PFC_PIN_GROUP (tpu_to0_b), +SH_PFC_PIN_GROUP (tpu_to1_a), +SH_PFC_PIN_GROUP (tpu_to1_b), +SH_PFC_PIN_GROUP (tpu_to2_a), +SH_PFC_PIN_GROUP (tpu_to2_b), +SH_PFC_PIN_GROUP (tpu_to3_a), +SH_PFC_PIN_GROUP (tpu_to3_b),SH_PFC_PIN_GROUP (tsn0_link), SH_PFC_PIN_GROUP(tsn0_phy_int),
@@ -3020,15 +3019,14 @@ static const char * const ssi_groups[] = { };static const char *const tpu_groups[] = { -/* suffix might be updated */ -"tpu_to0" ,"tpu_to0_a" , -"tpu_to1" , +"tpu_to0_b" ,"tpu_to1_a" , -"tpu_to2" , +"tpu_to1_b" ,"tpu_to2_a" , -"tpu_to3" , +"tpu_to2_b" ,"tpu_to3_a" , +"tpu_to3_b" , };static const char *const tsn0_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 343/568 fs/proc/task_mmu: indicate PM_FILE for PMD-mapped file THP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 3f9f022e975d930709848a86a1c79775b0585202 ]
Patch series "fs/proc: move page_mapcount() to fs/proc/internal.h".
With all other page_mapcount() users in the tree gone, move page_mapcount() to fs/proc/internal.h, rename it and extend the documentation to prevent future (ab)use.
... of course, I find some issues while working on that code that I sort first ;)
We'll now only end up calling page_mapcount() [now folio_precise_page_mapcount()] on pages mapped via present page table entries. Except for /proc/kpagecount, that still does questionable things, but we'll leave that legacy interface as is for now.
Did a quick sanity check. Likely we would want some better selfestest for /proc/$/pagemap + smaps. I'll see if I can find some time to write some more.
This patch (of 6):
Looks like we never taught pagemap_pmd_range() about the existence of PMD-mapped file THPs. Seems to date back to the times when we first added support for non-anon THPs in the form of shmem THP.
--- fs/proc/task_mmu.c | 2 ++ 1 file changed, 2 insertions(+)
fs/proc/task_mmu.c +2 -0
@@ -1519,6 +1519,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, }#endif +if (page && !PageAnon (page)) + flags |=PM_FILE ;if (page && !migration &&page_mapcount (page) ==1 ) flags |=PM_MMAP_EXCLUSIVE ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 344/568 fs/proc/task_mmu.c: add_to_pagemap: remove useless parameter addr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Zhu <[email protected]>
[ Upstream commit cabbb6d51e2af4fc2f3c763f58a12c628f228987 ]
Function parameter addr of add_to_pagemap() is useless. Remove it.
Stable-dep-of: 2c1f057e5be6 ("fs/proc/task_mmu: properly detect PM_MMAP_EXCLUSIVE per page of PMD-mapped THPs")
--- fs/proc/task_mmu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
fs/proc/task_mmu.c +6 -7
@@ -1358,8 +1358,7 @@ static inline pagemap_entry_t make_pme(u64 frame, u64 flags)return (pagemap_entry_t ) { .pme = (frame &PM_PFRAME_MASK ) | flags }; } -static int add_to_pagemap (unsigned long addr,pagemap_entry_t *pme, -struct pagemapread *pm) +static int add_to_pagemap (pagemap_entry_t *pme,struct pagemapread *pm) { pm->buffer[pm->pos++] = *pme;if (pm->pos >= pm->len)
@@ -1386,7 +1385,7 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end, hole_end = end;for (; addr < hole_end; addr +=PAGE_SIZE ) { - err =add_to_pagemap (addr, &pme, pm); + err =add_to_pagemap (&pme, pm);if (err) goto out; }
@@ -1398,7 +1397,7 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end,if (vma->vm_flags &VM_SOFTDIRTY ) pme =make_pme (0 ,PM_SOFT_DIRTY );for (; addr <min (end, vma->vm_end); addr +=PAGE_SIZE ) { - err =add_to_pagemap (addr, &pme, pm); + err =add_to_pagemap (&pme, pm);if (err) goto out; }
@@ -1527,7 +1526,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,for (; addr != end; addr +=PAGE_SIZE ) {pagemap_entry_t pme =make_pme (frame, flags); - err =add_to_pagemap (addr, &pme, pm); + err =add_to_pagemap (&pme, pm);if (err)break ;if (pm->show_pfn) {
@@ -1555,7 +1554,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,pagemap_entry_t pme; pme =pte_to_pagemap_entry (pm, vma, addr,ptep_get (pte)); - err =add_to_pagemap (addr, &pme, pm); + err =add_to_pagemap (&pme, pm);if (err)break ; }
@@ -1605,7 +1604,7 @@ static int pagemap_hugetlb_range(pte_t *ptep, unsigned long hmask,for (; addr != end; addr +=PAGE_SIZE ) {pagemap_entry_t pme =make_pme (frame, flags); - err =add_to_pagemap (addr, &pme, pm); + err =add_to_pagemap (&pme, pm);if (err)return err;if (pm->show_pfn && (flags &PM_PRESENT ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 345/568 fs/proc/task_mmu: dont indicate PM_MMAP_EXCLUSIVE without PM_PRESENT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit da7f31ed0f4df8f61e8195e527aa83dd54896ba3 ]
Relying on the mapcount for non-present PTEs that reference pages doesn't make any sense: they are not accounted in the mapcount, so page_mapcount() == 1 won't return the result we actually want to know.
While we don't check the mapcount for migration entries already, we could end up checking it for swap, hwpoison, device exclusive, ... entries, which we really shouldn't.
There is one exception: device private entries, which we consider fake-present (e.g., incremented the mapcount). But we won't care about that for now for PM_MMAP_EXCLUSIVE, because indicating PM_SWAP for them although they are fake-present already sounds suspiciously wrong.
Let's never indicate PM_MMAP_EXCLUSIVE without PM_PRESENT.
Stable-dep-of: 2c1f057e5be6 ("fs/proc/task_mmu: properly detect PM_MMAP_EXCLUSIVE per page of PMD-mapped THPs")
--- fs/proc/task_mmu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
fs/proc/task_mmu.c +2 -6
@@ -1411,7 +1411,6 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, {u64 frame =0 , flags =0 ;struct page *page =NULL ; -bool migration = false;if (pte_present (pte)) {if (pm->show_pfn)
@@ -1443,7 +1442,6 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, (offset <<MAX_SWAPFILES_SHIFT ); } flags |=PM_SWAP ; - migration =is_migration_entry (entry);if (is_pfn_swap_entry (entry)) page =pfn_swap_entry_to_page (entry);if (pte_marker_entry_uffd_wp (entry))
@@ -1452,7 +1450,7 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm,if (page && !PageAnon (page)) flags |=PM_FILE ; -if (page && !migration &&page_mapcount (page) ==1 ) +if (page && (flags &PM_PRESENT ) &&page_mapcount (page) ==1 ) flags |=PM_MMAP_EXCLUSIVE ;if (vma->vm_flags &VM_SOFTDIRTY ) flags |=PM_SOFT_DIRTY ;
@@ -1469,7 +1467,6 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,pte_t *pte, *orig_pte;int err =0 ;#ifdef CONFIG_TRANSPARENT_HUGEPAGE -bool migration = false; ptl =pmd_trans_huge_lock (pmdp, vma);if (ptl) {
@@ -1513,14 +1510,13 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,if (pmd_swp_uffd_wp (pmd)) flags |=PM_UFFD_WP ;VM_BUG_ON (!is_pmd_migration_entry (pmd)); - migration =is_migration_entry (entry); page = pfn_swap_entry_to_page(entry); }#endif if (page && !PageAnon (page)) flags |=PM_FILE ; -if (page && !migration &&page_mapcount (page) ==1 ) +if (page && (flags &PM_PRESENT ) &&page_mapcount (page) ==1 ) flags |=PM_MMAP_EXCLUSIVE ;for (; addr != end; addr +=PAGE_SIZE ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 346/568 fs/proc/task_mmu: properly detect PM_MMAP_EXCLUSIVE per page of PMD-mapped THPs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 2c1f057e5be63e890f2dd89e4c25ab5eef084a91 ]
We added PM_MMAP_EXCLUSIVE in 2015 via commit 77bb499bb60f ("pagemap: add mmap-exclusive bit for marking pages mapped only here"), when THPs could not be partially mapped and page_mapcount() returned something that was true for all pages of the THP.
In 2016, we added support for partially mapping THPs via commit 53f9263baba6 ("mm: rework mapcount accounting to enable 4k mapping of THPs") but missed to determine PM_MMAP_EXCLUSIVE as well per page.
Checking page_mapcount() on the head page does not tell the whole story.
We should check each individual page. In a future without per-page mapcounts it will be different, but we'll change that to be consistent with PTE-mapped THPs once we deal with that.
--- fs/proc/task_mmu.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
fs/proc/task_mmu.c +12 -10
@@ -1470,6 +1470,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, ptl =pmd_trans_huge_lock (pmdp, vma);if (ptl) { +unsigned int idx = (addr & ~PMD_MASK ) >>PAGE_SHIFT ;u64 flags =0 , frame =0 ;pmd_t pmd = *pmdp;struct page *page =NULL ;
@@ -1486,8 +1487,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,if (pmd_uffd_wp (pmd)) flags |=PM_UFFD_WP ;if (pm->show_pfn) - frame =pmd_pfn (pmd) + - ((addr & ~PMD_MASK ) >>PAGE_SHIFT ); + frame =pmd_pfn (pmd) + idx; }#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION else if (is_swap_pmd(pmd)) {
@@ -1496,11 +1496,9 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,if (pm->show_pfn) {if (is_pfn_swap_entry (entry)) - offset =swp_offset_pfn (entry); + offset =swp_offset_pfn (entry) + idx;else - offset =swp_offset (entry); - offset = offset + - ((addr & ~PMD_MASK ) >>PAGE_SHIFT ); + offset =swp_offset (entry) + idx; frame =swp_type (entry) | (offset <<MAX_SWAPFILES_SHIFT ); }
@@ -1516,12 +1514,16 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,if (page && !PageAnon (page)) flags |=PM_FILE ; -if (page && (flags &PM_PRESENT ) &&page_mapcount (page) ==1 ) - flags |=PM_MMAP_EXCLUSIVE ; -for (; addr != end; addr +=PAGE_SIZE ) { -pagemap_entry_t pme =make_pme (frame, flags); +for (; addr != end; addr +=PAGE_SIZE , idx++) { +unsigned long cur_flags = flags; +pagemap_entry_t pme; + +if (page && (flags &PM_PRESENT ) && +page_mapcount (page + idx) ==1 ) + cur_flags |=PM_MMAP_EXCLUSIVE ; + pme =make_pme (frame, cur_flags); err =add_to_pagemap (&pme, pm);if (err)break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 347/568 nilfs2: avoid undefined behavior in nilfs_cnt32_ge macro
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
[ Upstream commit 0f3819e8c483771a59cf9d3190cd68a7a990083c ]
According to the C standard 3.4.3p3, the result of signed integer overflow is undefined. The macro nilfs_cnt32_ge(), which compares two sequence numbers, uses signed integer subtraction that can overflow, and therefore the result of the calculation may differ from what is expected due to undefined behavior in different environments.
Similar to an earlier change to the jiffies-related comparison macros in commit 5a581b367b5d ("jiffies: Avoid undefined behavior from signed overflow"), avoid this potential issue by changing the definition of the macro to perform the subtraction as unsigned integers, then cast the result to a signed integer for comparison.
--- fs/nilfs2/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/segment.c +1 -1
@@ -136,7 +136,7 @@ static void nilfs_dispose_list(struct the_nilfs *, struct list_head *, int);#define nilfs_cnt32_ge (a, b) \ (typecheck(__u32, a) && typecheck(__u32, b) && \ - ((__s32)(a) - (__s32)(b) >= 0)) + ((__s32)((a) - (b)) >= 0))static int nilfs_prepare_segment_lock (struct super_block *sb,struct nilfs_transaction_info *ti)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 348/568 rtc: interface: Add RTC offset to alarm after fix-up
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
[ Upstream commit 463927a8902a9f22c3633960119410f57d4c8920 ]
rtc_add_offset() is called by __rtc_read_time() and __rtc_read_alarm() to add the RTC's offset to the raw read-outs from the device drivers. However, in the latter case, a fix-up algorithm is run if the RTC device does not report a full struct rtc_time alarm value. In that case, the offset was forgot to be added.
--- drivers/rtc/interface.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/rtc/interface.c +5 -4
@@ -274,10 +274,9 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)return err;/* full-function RTCs won't have such missing fields */ -if (rtc_valid_tm (&alarm->time) ==0 ) { -rtc_add_offset (rtc, &alarm->time); -return 0 ; - } + err =rtc_valid_tm (&alarm->time); +if (!err) + goto done;/* get the "after" timestamp, to detect wrapped fields */ err =rtc_read_time (rtc, &now);
@@ -379,6 +378,8 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)if (err && alarm->enabled)dev_warn (&rtc->dev,"invalid alarm value: %ptR\n" , &alarm->time); +else +rtc_add_offset (rtc, &alarm->time);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 349/568 fs/ntfs3: Fix the format of the "nocase" mount option
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit d392e85fd1e8d58e460c17ca7d0d5c157848d9c1 ]
The 'nocase' option was mistakenly added as fsparam_flag_no with the 'no' prefix, causing the case-insensitive mode to require the 'nonocase' option to be enabled.
--- fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/super.c +1 -1
@@ -276,7 +276,7 @@ static const struct fs_parameter_spec ntfs_fs_parameters[] = {fsparam_flag_no ("acl" , Opt_acl),fsparam_string ("iocharset" , Opt_iocharset),fsparam_flag_no ("prealloc" , Opt_prealloc), - fsparam_flag_no("nocase", Opt_nocase), + fsparam_flag_no("case", Opt_nocase), {} };// clang-format on
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 350/568 fs/ntfs3: Missed error return
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 2cbbd96820255fff4f0ad1533197370c9ccc570b ]
--- fs/ntfs3/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/bitmap.c +1 -1
@@ -1382,7 +1382,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) err =ntfs_vbo_to_lbo (sbi, &wnd->run, vbo, &lbo, &bytes);if (err) -break ; +return err; bh =ntfs_bread (sb, lbo >> sb->s_blocksize_bits);if (!bh)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 351/568 fs/ntfs3: Keep runs for $MFT::$ATTR_DATA and $MFT::$ATTR_BITMAP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit eb95678ee930d67d79fc83f0a700245ae7230455 ]
We skip the run_truncate_head call also for $MFT::$ATTR_BITMAP.
Otherwise wnd_map()/run_lookup_entry will not find the disk position for the bitmap parts.
--- fs/ntfs3/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ntfs3/attrib.c +2 -1
@@ -673,7 +673,8 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type, goto undo_2; } -if (!is_mft) +/* keep runs for $MFT::$ATTR_DATA and $MFT::$ATTR_BITMAP. */ +if (ni->mi.rno !=MFT_REC_MFT )run_truncate_head (run, evcn +1 ); svcn =le64_to_cpu (attr->nres.svcn);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 352/568 powerpc/8xx: fix size given to set_huge_pte_at()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 7ea981070fd9ec24bc0111636038193aebb0289c ]
set_huge_pte_at() expects the size of the hugepage as an int, not the psize which is the index of the page definition in table mmu_psize_defs[]
--- arch/powerpc/mm/nohash/8xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/mm/nohash/8xx.c +2 -1
@@ -92,7 +92,8 @@ static int __ref __early_map_kernel_hugepage(unsigned long va, phys_addr_t pa,return -EINVAL ;set_huge_pte_at (&init_mm, va, ptep, -pte_mkhuge (pfn_pte (pa >>PAGE_SHIFT , prot)), psize); +pte_mkhuge (pfn_pte (pa >>PAGE_SHIFT , prot)), +1UL <<mmu_psize_to_shift (psize));return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 353/568 s390/dasd: fix error checks in dasd_copy_pair_store()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos López <[email protected]>
[ Upstream commit 8e64d2356cbc800b4cd0e3e614797f76bcf0cdb8 ]
dasd_add_busid() can return an error via ERR_PTR() if an allocation fails. However, two callsites in dasd_copy_pair_store() do not check the result, potentially resulting in a NULL pointer dereference. Fix this by checking the result with IS_ERR() and returning the error up the stack.
--- drivers/s390/block/dasd_devmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/block/dasd_devmap.c +8 -2
@@ -2258,13 +2258,19 @@ static ssize_t dasd_copy_pair_store(struct device *dev,/* allocate primary devmap if needed */ prim_devmap =dasd_find_busid (prim_busid); -if (IS_ERR (prim_devmap)) +if (IS_ERR (prim_devmap)) { prim_devmap =dasd_add_busid (prim_busid,DASD_FEATURE_DEFAULT ); +if (IS_ERR (prim_devmap)) +return PTR_ERR (prim_devmap); + }/* allocate secondary devmap if needed */ sec_devmap =dasd_find_busid (sec_busid); -if (IS_ERR (sec_devmap)) +if (IS_ERR (sec_devmap)) { sec_devmap =dasd_add_busid (sec_busid,DASD_FEATURE_DEFAULT ); +if (IS_ERR (sec_devmap)) +return PTR_ERR (sec_devmap); + }/* setting copy relation is only allowed for offline secondary */ if (sec_devmap->device)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 354/568 sbitmap: use READ_ONCE to access map->word
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: linke li <[email protected]>
[ Upstream commit 6ad0d7e0f4b68f87a98ea2b239123b7d865df86b ]
In __sbitmap_queue_get_batch(), map->word is read several times, and update atomically using atomic_long_try_cmpxchg(). But the first two read of map->word is not protected.
This patch moves the statement val = READ_ONCE(map->word) forward, eliminating unprotected accesses to map->word within the function. It is aimed at reducing the number of benign races reported by KCSAN in order to focus future debugging effort on harmful races.
Stable-dep-of: 72d04bdcf3f7 ("sbitmap: fix io hung due to race on sbitmap_word::cleared")
--- lib/sbitmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/sbitmap.c +4 -4
@@ -499,18 +499,18 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,struct sbitmap_word *map = &sb->map[index];unsigned long get_mask;unsigned int map_depth =__map_depth (sb, index); +unsigned long val;sbitmap_deferred_clear (map); -if (map->word == (1UL << (map_depth -1 )) -1 ) + val =READ_ONCE (map->word); +if (val == (1UL << (map_depth -1 )) -1 ) goto next; - nr =find_first_zero_bit (&map->word, map_depth); + nr =find_first_zero_bit (&val, map_depth);if (nr + nr_tags <= map_depth) {atomic_long_t *ptr = (atomic_long_t *) &map->word; -unsigned long val; get_mask = ((1UL << nr_tags) -1 ) << nr; - val =READ_ONCE (map->word);while (!atomic_long_try_cmpxchg (ptr, &val, get_mask | val)) ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 355/568 sbitmap: fix io hung due to race on sbitmap_word::cleared
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yang <[email protected]>
[ Upstream commit 72d04bdcf3f7d7e07d82f9757946f68802a7270a ]
Configuration for sbq:
depth=64, wake_batch=6, shift=6, map_nr=1
1. There are 64 requests in progress:
map->word = 0xFFFFFFFFFFFFFFFF
2. After all the 64 requests complete, and no more requests come:
map->word = 0xFFFFFFFFFFFFFFFF, map->cleared = 0xFFFFFFFFFFFFFFFF
3. Now two tasks try to allocate requests:
T1: T2:
__blk_mq_get_tag .
__sbitmap_queue_get .
sbitmap_get .
sbitmap_find_bit .
sbitmap_find_bit_in_word .
__sbitmap_get_word -> nr=-1 __blk_mq_get_tag
sbitmap_deferred_clear __sbitmap_queue_get
/* map->cleared=0xFFFFFFFFFFFFFFFF */ sbitmap_find_bit
if (!READ_ONCE(map->cleared)) sbitmap_find_bit_in_word
return false; __sbitmap_get_word -> nr=-1
mask = xchg(&map->cleared, 0) sbitmap_deferred_clear
atomic_long_andnot() /* map->cleared=0 */
if (!(map->cleared))
return false;
/*
* map->cleared is cleared by T1
* T2 fail to acquire the tag
*/4. T2 is the sole tag waiter. When T1 puts the tag, T2 cannot be woken up due to the wake_batch being set at 6. If no more requests come, T1 will wait here indefinitely.
This patch achieves two purposes:
1. Check on ->cleared and update on both ->cleared and ->word need to be done atomically, and using spinlock could be the simplest solution.
2. Add extra check in sbitmap_deferred_clear(), to identify whether ->word has free bits.
--- include/linux/sbitmap.h | 5 +++++ lib/sbitmap.c | 36 +++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-)
include/linux/sbitmap.h +5 -0
@@ -36,6 +36,11 @@ struct sbitmap_word {* @cleared: word holding cleared bits */ unsigned long cleared____cacheline_aligned_in_smp ; + +/** +* @swap_lock: serializes simultaneous updates of ->word and ->cleared +*/ +spinlock_t swap_lock; }____cacheline_aligned_in_smp ;/**
lib/sbitmap.c +29 -7
@@ -60,12 +60,30 @@ static inline void update_alloc_hint_after_get(struct sbitmap *sb,/* * See if we have deferred clears that we can batch move */ -static inline bool sbitmap_deferred_clear (struct sbitmap_word *map) +static inline bool sbitmap_deferred_clear (struct sbitmap_word *map, +unsigned int depth,unsigned int alloc_hint,bool wrap) { -unsigned long mask; +unsigned long mask, word_mask; -if (!READ_ONCE (map->cleared)) -return false; +guard (spinlock_irqsave)(&map->swap_lock); + +if (!map->cleared) { +if (depth ==0 ) +return false; + + word_mask = (~0UL ) >> (BITS_PER_LONG - depth); +/* +* The current behavior is to always retry after moving +* ->cleared to word, and we change it to retry in case +* of any free bits. To avoid an infinite loop, we need +* to take wrap & alloc_hint into account, otherwise a +* soft lockup may occur. +*/ +if (!wrap && alloc_hint) + word_mask &= ~((1UL << alloc_hint) -1 ); + +return (READ_ONCE (map->word) & word_mask) != word_mask; + }/* * First get a stable cleared mask, setting the old mask to 0.
@@ -85,6 +103,7 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift, bool alloc_hint) {unsigned int bits_per_word; +int i;if (shift <0 ) shift =sbitmap_calculate_shift (depth);
@@ -116,6 +135,9 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,return -ENOMEM ; } +for (i =0 ; i < sb->map_nr; i++) +spin_lock_init (&sb->map[i].swap_lock); +return 0 ; }EXPORT_SYMBOL_GPL (sbitmap_init_node);
@@ -126,7 +148,7 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth)unsigned int i;for (i =0 ; i < sb->map_nr; i++) -sbitmap_deferred_clear (&sb->map[i]); +sbitmap_deferred_clear (&sb->map[i],0 ,0 ,0 ); sb->depth = depth; sb->map_nr =DIV_ROUND_UP (sb->depth, bits_per_word);
@@ -179,7 +201,7 @@ static int sbitmap_find_bit_in_word(struct sbitmap_word *map, alloc_hint, wrap);if (nr !=-1 )break ; -if (!sbitmap_deferred_clear (map)) +if (!sbitmap_deferred_clear (map, depth, alloc_hint, wrap))break ; }while (1 );
@@ -501,7 +523,7 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,unsigned int map_depth =__map_depth (sb, index);unsigned long val; -sbitmap_deferred_clear (map); +sbitmap_deferred_clear (map,0 ,0 ,0 ); val =READ_ONCE (map->word);if (val == (1UL << (map_depth -1 )) -1 ) goto next;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 356/568 LoongArch: Check TIF_LOAD_WATCH to enable user space watchpoint
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit 3892b11eac5aaaeefbf717f1953288b77759d9e2 ]
Currently, there are some places to set CSR.PRMD.PWE, the first one is in hw_breakpoint_thread_switch() to enable user space singlestep via checking TIF_SINGLESTEP, the second one is in hw_breakpoint_control() to enable user space watchpoint. For the latter case, it should also check TIF_LOAD_WATCH to make the logic correct and clear.
--- arch/loongarch/kernel/hw_breakpoint.c | 2 +- arch/loongarch/kernel/ptrace.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/loongarch/kernel/hw_breakpoint.c +1 -1
@@ -221,7 +221,7 @@ static int hw_breakpoint_control(struct perf_event *bp, } enable =csr_read64 (LOONGARCH_CSR_CRMD );csr_write64 (CSR_CRMD_WE | enable,LOONGARCH_CSR_CRMD ); -if (bp->hw.target) +if (bp->hw.target &&test_tsk_thread_flag (bp->hw.target,TIF_LOAD_WATCH )) regs->csr_prmd |=CSR_PRMD_PWE ;break ;case HW_BREAKPOINT_UNINSTALL :
arch/loongarch/kernel/ptrace.c +3 -0
@@ -589,6 +589,7 @@ static int ptrace_hbp_set_ctrl(unsigned int note_type,struct perf_event *bp;struct perf_event_attr attr;struct arch_hw_breakpoint_ctrl ctrl; +struct thread_info *ti =task_thread_info (tsk); bp =ptrace_hbp_get_initialised_bp (note_type, tsk, idx);if (IS_ERR (bp))
@@ -613,8 +614,10 @@ static int ptrace_hbp_set_ctrl(unsigned int note_type,if (err)return err; attr.disabled =0 ; +set_ti_thread_flag (ti,TIF_LOAD_WATCH ); }else { attr.disabled =1 ; +clear_ti_thread_flag (ti,TIF_LOAD_WATCH ); }return modify_user_hw_breakpoint (bp, &attr);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 357/568 landlock: Dont lose track of restrictions on cred_transfer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 39705a6c29f8a2b93cf5b99528a55366c50014d1 upstream.
When a process' cred struct is replaced, this _almost_ always invokes the cred_prepare LSM hook; but in one special case (when KEYCTL_SESSION_TO_PARENT updates the parent's credentials), the cred_transfer LSM hook is used instead. Landlock only implements the cred_prepare hook, not cred_transfer, so KEYCTL_SESSION_TO_PARENT causes all information on Landlock restrictions to be lost.
This basically means that a process with the ability to use the fork() and keyctl() syscalls can get rid of all Landlock restrictions on itself.
Fix it by adding a cred_transfer hook that does the same thing as the existing cred_prepare hook. (Implemented by having hook_cred_prepare() call hook_cred_transfer() so that the two functions are less likely to accidentally diverge in the future.)
--- security/landlock/cred.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
security/landlock/cred.c +9 -2
@@ -14,8 +14,8 @@#include "ruleset.h" #include "setup.h" -static int hook_cred_prepare (struct cred *const new, -const struct cred *const old,const gfp_t gfp) +static void hook_cred_transfer (struct cred *const new, +const struct cred *const old) {struct landlock_ruleset *const old_dom =landlock_cred (old)->domain;
@@ -23,6 +23,12 @@ static int hook_cred_prepare(struct credlandlock_get_ruleset (old_dom);landlock_cred (new)->domain = old_dom; } +} + +static int hook_cred_prepare (struct cred *const new, +const struct cred *const old,const gfp_t gfp) +{ +hook_cred_transfer (new, old);return 0 ; }
@@ -36,6 +42,7 @@ static void hook_cred_free(struct cred *static struct security_hook_list landlock_hooks[]__ro_after_init = {LSM_HOOK_INIT (cred_prepare, hook_cred_prepare), +LSM_HOOK_INIT (cred_transfer, hook_cred_transfer),LSM_HOOK_INIT (cred_free, hook_cred_free), };
Greg Kroah-Hartman
maintainerPATCH 358/568 hugetlb: force allocating surplus hugepages on mempolicy allowed nodes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aristeu Rozanski <[email protected]>
commit 003af997c8a945493859dd1a2d015cc9387ff27a upstream.
When trying to allocate a hugepage with no reserved ones free, it may be allowed in case a number of overcommit hugepages was configured (using /proc/sys/vm/nr_overcommit_hugepages) and that number wasn't reached. This allows for a behavior of having extra hugepages allocated dynamically, if there're resources for it. Some sysadmins even prefer not reserving any hugepages and setting a big number of overcommit hugepages.
But while attempting to allocate overcommit hugepages in a multi node system (either NUMA or mempolicy/cpuset) said allocations might randomly fail even when there're resources available for the allocation.
This happens due to allowed_mems_nr() only accounting for the number of free hugepages in the nodes the current process belongs to and the surplus hugepage allocation is done so it can be allocated in any node. In case one or more of the requested surplus hugepages are allocated in a different node, the whole allocation will fail due allowed_mems_nr() returning a lower value.
So allocate surplus hugepages in one of the nodes the current process belongs to.
Easy way to reproduce this issue is to use a 2+ NUMA nodes system:
# echo 0 >/proc/sys/vm/nr_hugepages # echo 1 >/proc/sys/vm/nr_overcommit_hugepages # numactl -m0 ./tools/testing/selftests/mm/map_hugetlb 2
Repeating the execution of map_hugetlb test application will eventually fail when the hugepage ends up allocated in a different node.
--- mm/hugetlb.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-)
mm/hugetlb.c +28 -19
@@ -2518,6 +2518,23 @@ struct folio *alloc_hugetlb_folio_vma(streturn folio; } +static nodemask_t *policy_mbind_nodemask (gfp_t gfp) +{ +#ifdef CONFIG_NUMA +struct mempolicy *mpol =get_task_policy (current); + +/* +* Only enforce MPOL_BIND policy which overlaps with cpuset policy +* (from policy_nodemask) specifically for hugetlb case +*/ +if (mpol->mode ==MPOL_BIND && + (apply_policy_zone (mpol,gfp_zone (gfp)) && +cpuset_nodemask_valid_mems_allowed (&mpol->nodes))) +return &mpol->nodes; +#endif +return NULL ; +} +/* * Increase the hugetlb pool such that it can accommodate a reservation * of size 'delta'.
@@ -2531,6 +2548,8 @@ static int gather_surplus_pages(struct hlong i;long needed, allocated;bool alloc_ok = true; +int node; +nodemask_t *mbind_nodemask =policy_mbind_nodemask (htlb_alloc_mask (h));lockdep_assert_held (&hugetlb_lock); needed = (h->resv_huge_pages + delta) - h->free_huge_pages;
@@ -2545,8 +2564,15 @@ static int gather_surplus_pages(struct h retry:spin_unlock_irq (&hugetlb_lock);for (i =0 ; i < needed; i++) { - folio =alloc_surplus_hugetlb_folio (h,htlb_alloc_mask (h), -NUMA_NO_NODE ,NULL ); + folio =NULL ; +for_each_node_mask (node, cpuset_current_mems_allowed) { +if (!mbind_nodemask ||node_isset (node, *mbind_nodemask)) { + folio =alloc_surplus_hugetlb_folio (h,htlb_alloc_mask (h), + node,NULL ); +if (folio) +break ; + } + }if (!folio) { alloc_ok = false;break ;
@@ -4531,23 +4557,6 @@ static int __init default_hugepagesz_set }__setup ("default_hugepagesz=" , default_hugepagesz_setup); -static nodemask_t *policy_mbind_nodemask (gfp_t gfp) -{ -#ifdef CONFIG_NUMA -struct mempolicy *mpol =get_task_policy (current); - -/* -* Only enforce MPOL_BIND policy which overlaps with cpuset policy -* (from policy_nodemask) specifically for hugetlb case -*/ -if (mpol->mode ==MPOL_BIND && - (apply_policy_zone (mpol,gfp_zone (gfp)) && -cpuset_nodemask_valid_mems_allowed (&mpol->nodes))) -return &mpol->nodes; -#endif -return NULL ; -} -static unsigned int allowed_mems_nr (struct hstate *h) {int node;
Greg Kroah-Hartman
maintainerPATCH 359/568 mm/hugetlb: fix possible recursive locking detected warning
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaohe Lin <[email protected]>
commit 667574e873b5f77a220b2a93329689f36fb56d5d upstream.
When tries to demote 1G hugetlb folios, a lockdep warning is observed:
============================================
WARNING: possible recursive locking detected 6.10.0-rc6-00452-ga4d0275fa660-dirty #79 Not tainted
--------------------------------------------
bash/710 is trying to acquire lock:ffffffff8f0a7850 (&h->resize_lock){+.+.}-{3:3}, at: demote_store+0x244/0x460
but task is already holding lock:ffffffff8f0a6f48 (&h->resize_lock){+.+.}-{3:3}, at: demote_store+0xae/0x460
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&h->resize_lock);
lock(&h->resize_lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by bash/710:
#0: ffff8f118439c3f0 (sb_writers#5){.+.+}-{0:0}, at: ksys_write+0x64/0xe0 #1: ffff8f11893b9e88 (&of->mutex#2){+.+.}-{3:3}, at: kernfs_fop_write_iter+0xf8/0x1d0 #2: ffff8f1183dc4428 (kn->active#98){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x100/0x1d0 #3: ffffffff8f0a6f48 (&h->resize_lock){+.+.}-{3:3}, at: demote_store+0xae/0x460
stack backtrace: CPU: 3 PID: 710 Comm: bash Not tainted 6.10.0-rc6-00452-ga4d0275fa660-dirty #79 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xa0 __lock_acquire+0x10f2/0x1ca0 lock_acquire+0xbe/0x2d0 __mutex_lock+0x6d/0x400 demote_store+0x244/0x460 kernfs_fop_write_iter+0x12c/0x1d0 vfs_write+0x380/0x540 ksys_write+0x64/0xe0 do_syscall_64+0xb9/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa61db14887 RSP: 002b:00007ffc56c48358 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fa61db14887 RDX: 0000000000000002 RSI: 000055a030050220 RDI: 0000000000000001 RBP: 000055a030050220 R08: 00007fa61dbd1460 R09: 000000007fffffff R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 R13: 00007fa61dc1b780 R14: 00007fa61dc17600 R15: 00007fa61dc16a00 </TASK>
Lockdep considers this an AA deadlock because the different resize_lock mutexes reside in the same lockdep class, but this is a false positive. Place them in distinct classes to avoid these warnings.
--- include/linux/hugetlb.h | 1 + mm/hugetlb.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/linux/hugetlb.h +1 -0
@@ -713,6 +713,7 @@ HPAGEFLAG(RawHwpUnreliable, raw_hwp_unre/* Defines one hugetlb page size */ struct hstate {struct mutex resize_lock; +struct lock_class_key resize_key;int next_nid_to_alloc;int next_nid_to_free;unsigned int order;
mm/hugetlb.c +1 -1
@@ -4334,7 +4334,7 @@ void __init hugetlb_add_hstate(unsignedBUG_ON (hugetlb_max_hstate >=HUGE_MAX_HSTATE );BUG_ON (order ==0 ); h = &hstates[hugetlb_max_hstate++]; -mutex_init (&h->resize_lock); +__mutex_init (&h->resize_lock,"resize mutex" , &h->resize_key); h->order = order; h->mask = ~(huge_page_size (h) -1 );for (i =0 ; i <MAX_NUMNODES ; ++i)
Greg Kroah-Hartman
maintainerPATCH 360/568 mm/mglru: fix div-by-zero in vmpressure_calc_level()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhao <[email protected]>
commit 8b671fe1a879923ecfb72dda6caf01460dd885ef upstream.
evict_folios() uses a second pass to reclaim folios that have gone through page writeback and become clean before it finishes the first pass, since folio_rotate_reclaimable() cannot handle those folios due to the isolation.
The second pass tries to avoid potential double counting by deducting scan_control->nr_scanned. However, this can result in underflow of nr_scanned, under a condition where shrink_folio_list() does not increment nr_scanned, i.e., when folio_trylock() fails.
The underflow can cause the divisor, i.e., scale=scanned+reclaimed in vmpressure_calc_level(), to become zero, resulting in the following crash:
[exception RIP: vmpressure_work_fn+101]
process_one_work at ffffffffa3313f2b
Since scan_control->nr_scanned has no established semantics, the potential double counting has minimal risks. Therefore, fix the problem by not deducting scan_control->nr_scanned in evict_folios().
--- mm/vmscan.c | 1 - 1 file changed, 1 deletion(-)
mm/vmscan.c +0 -1
@@ -5226,7 +5226,6 @@ retry:/* retry folios that may have missed folio_rotate_reclaimable() */ list_move (&folio->lru, &clean); - sc->nr_scanned -=folio_nr_pages (folio); }spin_lock_irq (&lruvec->lru_lock);
Greg Kroah-Hartman
maintainerPATCH 361/568 mm: mmap_lock: replace get_memcg_path_buf() with on-stack buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 7d6be67cfdd4a53cea7147313ca13c531e3a470f upstream.
Commit 2b5067a8143e ("mm: mmap_lock: add tracepoints around lock acquisition") introduced TRACE_MMAP_LOCK_EVENT() macro using preempt_disable() in order to let get_mm_memcg_path() return a percpu buffer exclusively used by normal, softirq, irq and NMI contexts respectively.
Commit 832b50725373 ("mm: mmap_lock: use local locks instead of disabling preemption") replaced preempt_disable() with local_lock(&memcg_paths.lock) based on an argument that preempt_disable() has to be avoided because get_mm_memcg_path() might sleep if PREEMPT_RT=y.
But syzbot started reporting
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
and
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
messages, for local_lock() does not disable IRQ.
We could replace local_lock() with local_lock_irqsave() in order to suppress these messages. But this patch instead replaces percpu buffers with on-stack buffer, for the size of each buffer returned by get_memcg_path_buf() is only 256 bytes which is tolerable for allocating from current thread's kernel stack memory.
--- mm/mmap_lock.c | 175 ++++++--------------------------------------------------- 1 file changed, 20 insertions(+), 155 deletions(-)
mm/mmap_lock.c +20 -155
@@ -19,14 +19,7 @@ EXPORT_TRACEPOINT_SYMBOL(mmap_lock_relea#ifdef CONFIG_MEMCG -/* -* Our various events all share the same buffer (because we don't want or need -* to allocate a set of buffers *per event type*), so we need to protect against -* concurrent _reg() and _unreg() calls, and count how many _reg() calls have -* been made. -*/ -static DEFINE_MUTEX (reg_lock); -static int reg_refcount;/* Protected by reg_lock. */ +static atomic_t reg_refcount;/* * Size of the buffer for memcg path names. Ignoring stack trace support,
@@ -34,136 +27,22 @@ static int reg_refcount; /* Protected by*/ #define MEMCG_PATH_BUF_SIZE MAX_FILTER_STR_VAL -/* -* How many contexts our trace events might be called in: normal, softirq, irq, -* and NMI. -*/ -#define CONTEXT_COUNT 4 - -struct memcg_path { -local_lock_t lock; -char __rcu *buf; -local_t buf_idx; -}; -static DEFINE_PER_CPU(struct memcg_path, memcg_paths) = { - .lock =INIT_LOCAL_LOCK (lock), - .buf_idx =LOCAL_INIT (0 ), -}; - -static char **tmp_bufs; - -/* Called with reg_lock held. */ -static void free_memcg_path_bufs (void ) -{ -struct memcg_path *memcg_path; -int cpu; -char **old = tmp_bufs; - -for_each_possible_cpu (cpu) { - memcg_path =per_cpu_ptr (&memcg_paths, cpu); - *(old++) =rcu_dereference_protected (memcg_path->buf, -lockdep_is_held (®_lock)); -rcu_assign_pointer (memcg_path->buf,NULL ); - } - -/* Wait for inflight memcg_path_buf users to finish. */ -synchronize_rcu (); - - old = tmp_bufs; -for_each_possible_cpu (cpu) { -kfree (*(old++)); - } - -kfree (tmp_bufs); - tmp_bufs =NULL ; -} -int trace_mmap_lock_reg (void ) { -int cpu; -char *new; - -mutex_lock (®_lock); - -/* If the refcount is going 0->1, proceed with allocating buffers. */ -if (reg_refcount++) - goto out; - - tmp_bufs =kmalloc_array (num_possible_cpus (),sizeof (*tmp_bufs), -GFP_KERNEL ); -if (tmp_bufs ==NULL ) - goto out_fail; - -for_each_possible_cpu (cpu) { - new =kmalloc (MEMCG_PATH_BUF_SIZE *CONTEXT_COUNT ,GFP_KERNEL ); -if (new ==NULL ) - goto out_fail_free; -rcu_assign_pointer (per_cpu_ptr (&memcg_paths, cpu)->buf, new); -/* Don't need to wait for inflights, they'd have gotten NULL. */ - } - -out: -mutex_unlock (®_lock); +atomic_inc (®_refcount);return 0 ; - -out_fail_free: -free_memcg_path_bufs (); -out_fail: -/* Since we failed, undo the earlier ref increment. */ - --reg_refcount; - -mutex_unlock (®_lock); -return -ENOMEM ; }void trace_mmap_lock_unreg (void ) { -mutex_lock (®_lock); - -/* If the refcount is going 1->0, proceed with freeing buffers. */ -if (--reg_refcount) - goto out; - -free_memcg_path_bufs (); - -out: -mutex_unlock (®_lock); -} - -static inline char *get_memcg_path_buf (void ) -{ -struct memcg_path *memcg_path =this_cpu_ptr (&memcg_paths); -char *buf; -int idx; - -rcu_read_lock (); - buf =rcu_dereference (memcg_path->buf); -if (buf ==NULL ) { -rcu_read_unlock (); -return NULL ; - } - idx =local_add_return (MEMCG_PATH_BUF_SIZE , &memcg_path->buf_idx) - -MEMCG_PATH_BUF_SIZE ; -return &buf[idx]; +atomic_dec (®_refcount); } -static inline void put_memcg_path_buf (void ) -{ -local_sub (MEMCG_PATH_BUF_SIZE , &this_cpu_ptr (&memcg_paths)->buf_idx); -rcu_read_unlock (); -} - -#define TRACE_MMAP_LOCK_EVENT (type, mm, ...) \ - do { \ - const char *memcg_path; \ - local_lock(&memcg_paths.lock); \ - memcg_path = get_mm_memcg_path(mm); \ - trace_mmap_lock_##type(mm, \ - memcg_path != NULL ? memcg_path : "", \ - ##__VA_ARGS__); \ - if (likely(memcg_path != NULL)) \ - put_memcg_path_buf(); \ - local_unlock(&memcg_paths.lock); \ +#define TRACE_MMAP_LOCK_EVENT (type, mm, ...) \ + do { \ + char buf[MEMCG_PATH_BUF_SIZE]; \ + get_mm_memcg_path(mm, buf, sizeof(buf)); \ + trace_mmap_lock_##type(mm, buf, ##__VA_ARGS__); \ } while (0)#else /* !CONFIG_MEMCG */
@@ -185,37 +64,23 @@ void trace_mmap_lock_unreg(void)#ifdef CONFIG_TRACING #ifdef CONFIG_MEMCG /* -* Write the given mm_struct's memcg path to a percpu buffer, and return a -* pointer to it. If the path cannot be determined, or no buffer was available -* (because the trace event is being unregistered), NULL is returned. -* -* Note: buffers are allocated per-cpu to avoid locking, so preemption must be -* disabled by the caller before calling us, and re-enabled only after the -* caller is done with the pointer. -* -* The caller must call put_memcg_path_buf() once the buffer is no longer -* needed. This must be done while preemption is still disabled. +* Write the given mm_struct's memcg path to a buffer. If the path cannot be +* determined or the trace event is being unregistered, empty string is written. */ -static const char *get_mm_memcg_path (struct mm_struct *mm) +static void get_mm_memcg_path (struct mm_struct *mm,char *buf,size_t buflen) { -char *buf =NULL ; -struct mem_cgroup *memcg =get_mem_cgroup_from_mm (mm); +struct mem_cgroup *memcg; + buf[0 ] ='\0' ; +/* No need to get path if no trace event is registered. */ +if (!atomic_read (®_refcount)) +return ; + memcg =get_mem_cgroup_from_mm (mm);if (memcg ==NULL ) - goto out; -if (unlikely (memcg->css.cgroup ==NULL )) - goto out_put; - - buf =get_memcg_path_buf (); -if (buf ==NULL ) - goto out_put; - -cgroup_path (memcg->css.cgroup, buf,MEMCG_PATH_BUF_SIZE ); - -out_put: +return ; +if (memcg->css.cgroup) +cgroup_path (memcg->css.cgroup, buf, buflen);css_put (&memcg->css); -out: -return buf; }#endif /* CONFIG_MEMCG */
Greg Kroah-Hartman
maintainerPATCH 362/568 mm/mglru: fix overshooting shrinker memory
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhao <[email protected]>
commit 3f74e6bd3b84a8b6bb3cc51609c89e5b9d58eed7 upstream.
set_initial_priority() tries to jump-start global reclaim by estimating the priority based on cold/hot LRU pages. The estimation does not account for shrinker objects, and it cannot do so because their sizes can be in different units other than page.
If shrinker objects are the majority, e.g., on TrueNAS SCALE 24.04.0 where ZFS ARC can use almost all system memory, set_initial_priority() can vastly underestimate how much memory ARC shrinker can evict and assign extreme low values to scan_control->priority, resulting in overshoots of shrinker objects.
To reproduce the problem, using TrueNAS SCALE 24.04.0 with 32GB DRAM, a test ZFS pool and the following commands:
fio --name=mglru.file --numjobs=36 --ioengine=io_uring \
--directory=/root/test-zfs-pool/ --size=1024m --buffered=1 \
--rw=randread --random_distribution=random \
--time_based --runtime=1h &
for ((i = 0; i < 20; i++))
do
sleep 120
fio --name=mglru.anon --numjobs=16 --ioengine=mmap \
--filename=/dev/zero --size=1024m --fadvise_hint=0 \
--rw=randrw --random_distribution=random \
--time_based --runtime=1m
doneTo fix the problem:
1. Cap scan_control->priority at or above DEF_PRIORITY/2, to prevent the jump-start from being overly aggressive.
2. Account for the progress from mm_account_reclaimed_pages(), to prevent kswapd_shrink_node() from raising the priority unnecessarily.
--- mm/vmscan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
mm/vmscan.c +8 -2
@@ -5585,7 +5585,11 @@ static void set_initial_priority(struct/* round down reclaimable and round up sc->nr_to_reclaim */ priority =fls_long (reclaimable) -1 -fls_long (sc->nr_to_reclaim -1 ); - sc->priority =clamp (priority,0 ,DEF_PRIORITY ); +/* +* The estimation is based on LRU pages only, so cap it to prevent +* overshoots of shrinker objects by large margins. +*/ + sc->priority =clamp (priority,DEF_PRIORITY /2 ,DEF_PRIORITY ); }static void lru_gen_shrink_node (struct pglist_data *pgdat,struct scan_control *sc)
@@ -7350,6 +7354,7 @@ static bool kswapd_shrink_node(pg_data_t {struct zone *zone;int z; +unsigned long nr_reclaimed = sc->nr_reclaimed;/* Reclaim a number of pages proportional to the number of zones */ sc->nr_to_reclaim =0 ;
@@ -7377,7 +7382,8 @@ static bool kswapd_shrink_node(pg_data_tif (sc->order && sc->nr_reclaimed >=compact_gap (sc->order)) sc->order =0 ; -return sc->nr_scanned >= sc->nr_to_reclaim; +/* account for progress from mm_account_reclaimed_pages() */ +return max (sc->nr_scanned, sc->nr_reclaimed - nr_reclaimed) >= sc->nr_to_reclaim; }/* Page allocator PCP high watermark is lowered if reclaim is active. */
Greg Kroah-Hartman
maintainerPATCH 363/568 x86/efistub: Avoid returning EFI_SUCCESS on error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit fb318ca0a522295edd6d796fb987e99ec41f0ee5 upstream.
The fail label is only used in a situation where the previous EFI API call succeeded, and so status will be set to EFI_SUCCESS. Fix this, by dropping the goto entirely, and call efi_exit() with the correct error code.
--- drivers/firmware/efi/libstub/x86-stub.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/firmware/efi/libstub/x86-stub.c +1 -4
@@ -501,16 +501,13 @@ efi_status_t __efiapi efi_pe_entry(efi_h/* Convert unicode cmdline to ascii */ cmdline_ptr =efi_convert_cmdline (image, &options_size);if (!cmdline_ptr) - goto fail; +efi_exit (handle,EFI_OUT_OF_RESOURCES );efi_set_u64_split ((unsigned long )cmdline_ptr, &hdr->cmd_line_ptr, &boot_params.ext_cmd_line_ptr);efi_stub_entry (handle, sys_table_arg, &boot_params);/* not reached */ - -fail: -efi_exit (handle, status); } static void add_e820ext(struct boot_params *params,
Greg Kroah-Hartman
maintainerPATCH 364/568 x86/efistub: Revert to heap allocated boot_params for PE entrypoint
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit ae835a96d72cd025421910edb0e8faf706998727 upstream.
This is a partial revert of commit
8117961d98f ("x86/efi: Disregard setup header of loaded image")
which triggers boot issues on older Dell laptops. As it turns out, switching back to a heap allocation for the struct boot_params constructed by the EFI stub works around this, even though it is unclear why.
--- drivers/firmware/efi/libstub/x86-stub.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/firmware/efi/libstub/x86-stub.c +15 -5
@@ -469,11 +469,12 @@ void __noreturn efi_stub_entry(efi_handl efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,efi_system_table_t *sys_table_arg) { - static struct boot_params boot_params __page_aligned_bss; -struct setup_header *hdr = &boot_params.hdr;efi_guid_t proto =LOADED_IMAGE_PROTOCOL_GUID ; +struct boot_params *boot_params; +struct setup_header *hdr;int options_size =0 ;efi_status_t status; +unsigned long alloc;char *cmdline_ptr;if (efi_is_native ())
@@ -491,6 +492,13 @@ efi_status_t __efiapi efi_pe_entry(efi_hefi_exit (handle, status); } + status =efi_allocate_pages (PARAM_SIZE , &alloc,ULONG_MAX ); +if (status !=EFI_SUCCESS ) +efi_exit (handle, status); + + boot_params =memset ((void *)alloc,0x0 ,PARAM_SIZE ); + hdr = &boot_params->hdr; +/* Assign the setup_header fields that the kernel actually cares about */ hdr->root_flags =1 ; hdr->vid_mode =0xffff ;
@@ -500,13 +508,15 @@ efi_status_t __efiapi efi_pe_entry(efi_h/* Convert unicode cmdline to ascii */ cmdline_ptr =efi_convert_cmdline (image, &options_size); -if (!cmdline_ptr) +if (!cmdline_ptr) { +efi_free (PARAM_SIZE , alloc);efi_exit (handle,EFI_OUT_OF_RESOURCES ); + }efi_set_u64_split ((unsigned long )cmdline_ptr, &hdr->cmd_line_ptr, - &boot_params.ext_cmd_line_ptr); + &boot_params->ext_cmd_line_ptr); -efi_stub_entry (handle, sys_table_arg, &boot_params); +efi_stub_entry (handle, sys_table_arg, boot_params);/* not reached */ }
Greg Kroah-Hartman
maintainerPATCH 365/568 exfat: fix potential deadlock on __exfat_get_dentry_set
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sungjong Seo <[email protected]>
commit 89fc548767a2155231128cb98726d6d2ea1256c9 upstream.
When accessing a file with more entries than ES_MAX_ENTRY_NUM, the bh-array is allocated in __exfat_get_entry_set. The problem is that the bh-array is allocated with GFP_KERNEL. It does not make sense. In the following cases, a deadlock for sbi->s_lock between the two processes may occur.
CPU0 CPU1
---- ----
kswapd
balance_pgdat
lock(fs_reclaim)
exfat_iterate
lock(&sbi->s_lock)
exfat_readdir
exfat_get_uniname_from_ext_entry
exfat_get_dentry_set
__exfat_get_dentry_set
kmalloc_array
...
lock(fs_reclaim)
...
evict
exfat_evict_inode
lock(&sbi->s_lock)To fix this, let's allocate bh-array with GFP_NOFS.
--- fs/exfat/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exfat/dir.c +1 -1
@@ -890,7 +890,7 @@ int exfat_get_dentry_set(struct exfat_en num_bh =EXFAT_B_TO_BLK_ROUND_UP (off + num_entries *DENTRY_SIZE , sb);if (num_bh >ARRAY_SIZE (es->__bh)) { - es->bh =kmalloc_array (num_bh,sizeof (*es->bh),GFP_KERNEL ); + es->bh =kmalloc_array (num_bh,sizeof (*es->bh),GFP_NOFS );if (!es->bh) {brelse (bh);return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 366/568 dt-bindings: thermal: correct thermal zone node name limit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 97e32381d0fc6c2602a767b0c46e15eb2b75971d upstream.
Linux kernel uses thermal zone node name during registering thermal zones and has a hard-coded limit of 20 characters, including terminating NUL byte. The bindings expect node names to finish with '-thermal' which is eight bytes long, thus we have only 11 characters for the reset of the node name (thus 10 for the pattern after leading fixed character).
--- Documentation/devicetree/bindings/thermal/thermal-zones.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/thermal/thermal-zones.yaml +4 -1
@@ -49,7 +49,10 @@ properties: to take when the temperature crosses those thresholds. patternProperties: - "^[a-zA-Z][a-zA-Z0-9\\-]{1,12}-thermal$": + # Node name is limited in size due to Linux kernel requirements - 19 + # characters in total (see THERMAL_NAME_LENGTH, including terminating NUL + # byte): + "^[a-zA-Z][a-zA-Z0-9\\-]{1,10}-thermal$": type: object description: Each thermal zone node contains information about how frequently it
Greg Kroah-Hartman
maintainerPATCH 367/568 tick/broadcast: Make takeover of broadcast hrtimer reliable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Liao <[email protected]>
commit f7d43dd206e7e18c182f200e67a8db8c209907fa upstream.
Running the LTP hotplug stress test on a aarch64 machine results in rcu_sched stall warnings when the broadcast hrtimer was owned by the un-plugged CPU. The issue is the following:
CPU1 (owns the broadcast hrtimer) CPU2
tick_broadcast_enter() // shutdown local timer device broadcast_shutdown_local() ... tick_broadcast_exit() clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT) // timer device is not programmed cpumask_set_cpu(cpu, tick_broadcast_force_mask) initiates offlining of CPU1
take_cpu_down()
/*
* CPU1 shuts down and does not
* send broadcast IPI anymore
*/
takedown_cpu() hotplug_cpu__broadcast_tick_pull() // move broadcast hrtimer to this CPU clockevents_program_event() bc_set_next() hrtimer_start() /* * timer device is not programmed * because only the first expiring * timer will trigger clockevent * device reprogramming */
What happens is that CPU2 exits broadcast mode with force bit set, then the local timer device is not reprogrammed and CPU2 expects to receive the expired event by the broadcast IPI. But this does not happen because CPU1 is offlined by CPU2. CPU switches the clockevent device to ONESHOT state, but does not reprogram the device.
The subsequent reprogramming of the hrtimer broadcast device does not program the clockevent device of CPU2 either because the pending expiry time is already in the past and the CPU expects the event to be delivered. As a consequence all CPUs which wait for a broadcast event to be delivered are stuck forever.
Fix this issue by reprogramming the local timer device if the broadcast force bit of the CPU is set so that the broadcast hrtimer is delivered.
[ tglx: Massage comment and change log. Add Fixes tag ]
--- kernel/time/tick-broadcast.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
kernel/time/tick-broadcast.c +23 -0
@@ -1141,6 +1141,7 @@ void tick_broadcast_switch_to_oneshot(vo#ifdef CONFIG_HOTPLUG_CPU void hotplug_cpu__broadcast_tick_pull (int deadcpu) { +struct tick_device *td =this_cpu_ptr (&tick_cpu_device);struct clock_event_device *bc;unsigned long flags;
@@ -1148,6 +1149,28 @@ void hotplug_cpu__broadcast_tick_pull(in bc = tick_broadcast_device.evtdev;if (bc &&broadcast_needs_cpu (bc, deadcpu)) { +/* +* If the broadcast force bit of the current CPU is set, +* then the current CPU has not yet reprogrammed the local +* timer device to avoid a ping-pong race. See +* ___tick_broadcast_oneshot_control(). +* +* If the broadcast device is hrtimer based then +* programming the broadcast event below does not have any +* effect because the local clockevent device is not +* running and not programmed because the broadcast event +* is not earlier than the pending event of the local clock +* event device. As a consequence all CPUs waiting for a +* broadcast event are stuck forever. +* +* Detect this condition and reprogram the cpu local timer +* device to avoid the starvation. +*/ +if (tick_check_broadcast_expired ()) { +cpumask_clear_cpu (smp_processor_id (), tick_broadcast_force_mask); +tick_program_event (td->evtdev->next_event,1 ); + } +/* This moves the broadcast assignment to this CPU: */ clockevents_program_event (bc, bc->next_event,1 ); }
Greg Kroah-Hartman
maintainerPATCH 368/568 net: netconsole: Disable target before netpoll cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
commit 97d9fba9a812cada5484667a46e14a4c976ca330 upstream.
Currently, netconsole cleans up the netpoll structure before disabling the target. This approach can lead to race conditions, as message senders (write_ext_msg() and write_msg()) check if the target is enabled before using netpoll. The sender can validate that the target is enabled, but, the netpoll might be de-allocated already, causing undesired behaviours.
This patch reverses the order of operations:
1. Disable the target
2. Clean up the netpoll structure
This change eliminates the potential race condition, ensuring that no messages are sent through a partially cleaned-up netpoll structure.
--- drivers/net/netconsole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/netconsole.c +1 -1
@@ -770,6 +770,7 @@ restart:/* rtnl_lock already held * we might sleep in __netpoll_cleanup() */ + nt->enabled = false;spin_unlock_irqrestore (&target_list_lock, flags);__netpoll_cleanup (&nt->np);
@@ -777,7 +778,6 @@ restart:spin_lock_irqsave (&target_list_lock, flags);netdev_put (nt->np.dev, &nt->np.dev_tracker); nt->np.dev =NULL ; - nt->enabled = false; stopped = true;netconsole_target_put (nt); goto restart;
Greg Kroah-Hartman
maintainerPATCH 369/568 af_packet: Handle outgoing VLAN packets without hardware offloading
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengen Du <[email protected]>
commit 79eecf631c14e7f4057186570ac20e2cfac3802e upstream.
The issue initially stems from libpcap. The ethertype will be overwritten as the VLAN TPID if the network interface lacks hardware VLAN offloading. In the outbound packet path, if hardware VLAN offloading is unavailable, the VLAN tag is inserted into the payload but then cleared from the sk_buff struct. Consequently, this can lead to a false negative when checking for the presence of a VLAN tag, causing the packet sniffing outcome to lack VLAN tag information (i.e., TCI-TPID). As a result, the packet capturing tool may be unable to parse packets as expected.
The TCI-TPID is missing because the prb_fill_vlan_info() function does not modify the tp_vlan_tci/tp_vlan_tpid values, as the information is in the payload and not in the sk_buff struct. The skb_vlan_tag_present() function only checks vlan_all in the sk_buff struct. In cooked mode, the L2 header is stripped, preventing the packet capturing tool from determining the correct TCI-TPID value. Additionally, the protocol in SLL is incorrect, which means the packet capturing tool cannot parse the L3 header correctly.
--- net/packet/af_packet.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 2 deletions(-)
net/packet/af_packet.c +84 -2
@@ -538,6 +538,61 @@ static void *packet_current_frame(structreturn packet_lookup_frame (po, rb, rb->head, status); } +static u16 vlan_get_tci (struct sk_buff *skb,struct net_device *dev) +{ +u8 *skb_orig_data = skb->data; +int skb_orig_len = skb->len; +struct vlan_hdr vhdr, *vh; +unsigned int header_len; + +if (!dev) +return 0 ; + +/* In the SOCK_DGRAM scenario, skb data starts at the network +* protocol, which is after the VLAN headers. The outer VLAN +* header is at the hard_header_len offset in non-variable +* length link layer headers. If it's a VLAN device, the +* min_header_len should be used to exclude the VLAN header +* size. +*/ +if (dev->min_header_len == dev->hard_header_len) + header_len = dev->hard_header_len; +else if (is_vlan_dev (dev)) + header_len = dev->min_header_len; +else +return 0 ; + +skb_push (skb, skb->data -skb_mac_header (skb)); + vh =skb_header_pointer (skb, header_len,sizeof (vhdr), &vhdr); +if (skb_orig_data != skb->data) { + skb->data = skb_orig_data; + skb->len = skb_orig_len; + } +if (unlikely (!vh)) +return 0 ; + +return ntohs (vh->h_vlan_TCI); +} + +static __be16 vlan_get_protocol_dgram (struct sk_buff *skb) +{ +__be16 proto = skb->protocol; + +if (unlikely (eth_type_vlan (proto))) { +u8 *skb_orig_data = skb->data; +int skb_orig_len = skb->len; + +skb_push (skb, skb->data -skb_mac_header (skb)); + proto =__vlan_get_protocol (skb, proto,NULL ); +if (skb_orig_data != skb->data) { + skb->data = skb_orig_data; + skb->len = skb_orig_len; + } + } + +return proto; +} +static void prb_del_retire_blk_timer (struct tpacket_kbdq_core *pkc) {del_timer_sync (&pkc->retire_blk_timer);
@@ -1007,10 +1062,16 @@ static void prb_clear_rxhash(struct tpacstatic void prb_fill_vlan_info (struct tpacket_kbdq_core *pkc,struct tpacket3_hdr *ppd) { + struct packet_sock *po = container_of(pkc, struct packet_sock, rx_ring.prb_bdqc); +if (skb_vlan_tag_present (pkc->skb)) { ppd->hv1.tp_vlan_tci =skb_vlan_tag_get (pkc->skb); ppd->hv1.tp_vlan_tpid =ntohs (pkc->skb->vlan_proto); ppd->tp_status =TP_STATUS_VLAN_VALID |TP_STATUS_VLAN_TPID_VALID ; + }else if (unlikely (po->sk.sk_type ==SOCK_DGRAM &ð_type_vlan (pkc->skb->protocol))) { + ppd->hv1.tp_vlan_tci =vlan_get_tci (pkc->skb, pkc->skb->dev); + ppd->hv1.tp_vlan_tpid =ntohs (pkc->skb->protocol); + ppd->tp_status =TP_STATUS_VLAN_VALID |TP_STATUS_VLAN_TPID_VALID ; }else { ppd->hv1.tp_vlan_tci =0 ; ppd->hv1.tp_vlan_tpid =0 ;
@@ -2431,6 +2492,10 @@ static int tpacket_rcv(struct sk_buff *s h.h2->tp_vlan_tci =skb_vlan_tag_get (skb); h.h2->tp_vlan_tpid =ntohs (skb->vlan_proto); status |=TP_STATUS_VLAN_VALID |TP_STATUS_VLAN_TPID_VALID ; + }else if (unlikely (sk->sk_type ==SOCK_DGRAM &ð_type_vlan (skb->protocol))) { + h.h2->tp_vlan_tci =vlan_get_tci (skb, skb->dev); + h.h2->tp_vlan_tpid =ntohs (skb->protocol); + status |=TP_STATUS_VLAN_VALID |TP_STATUS_VLAN_TPID_VALID ; }else { h.h2->tp_vlan_tci =0 ; h.h2->tp_vlan_tpid =0 ;
@@ -2460,7 +2525,8 @@ static int tpacket_rcv(struct sk_buff *s sll->sll_halen =dev_parse_header (skb, sll->sll_addr); sll->sll_family =AF_PACKET ; sll->sll_hatype = dev->type; - sll->sll_protocol = skb->protocol; + sll->sll_protocol = (sk->sk_type ==SOCK_DGRAM ) ? +vlan_get_protocol_dgram (skb) : skb->protocol; sll->sll_pkttype = skb->pkt_type;if (unlikely (packet_sock_flag (po,PACKET_SOCK_ORIGDEV ))) sll->sll_ifindex = orig_dev->ifindex;
@@ -3488,7 +3554,8 @@ static int packet_recvmsg(struct socket/* Original length was stored in sockaddr_ll fields */ origlen =PACKET_SKB_CB (skb)->sa.origlen; sll->sll_family =AF_PACKET ; - sll->sll_protocol = skb->protocol; + sll->sll_protocol = (sock->type ==SOCK_DGRAM ) ? +vlan_get_protocol_dgram (skb) : skb->protocol; }sock_recv_cmsgs (msg, sk, skb);
@@ -3545,6 +3612,21 @@ static int packet_recvmsg(struct socket aux.tp_vlan_tci =skb_vlan_tag_get (skb); aux.tp_vlan_tpid =ntohs (skb->vlan_proto); aux.tp_status |=TP_STATUS_VLAN_VALID |TP_STATUS_VLAN_TPID_VALID ; + }else if (unlikely (sock->type ==SOCK_DGRAM &ð_type_vlan (skb->protocol))) { +struct sockaddr_ll *sll = &PACKET_SKB_CB (skb)->sa.ll; +struct net_device *dev; + +rcu_read_lock (); + dev =dev_get_by_index_rcu (sock_net (sk), sll->sll_ifindex); +if (dev) { + aux.tp_vlan_tci =vlan_get_tci (skb, dev); + aux.tp_vlan_tpid =ntohs (skb->protocol); + aux.tp_status |=TP_STATUS_VLAN_VALID |TP_STATUS_VLAN_TPID_VALID ; + }else { + aux.tp_vlan_tci =0 ; + aux.tp_vlan_tpid =0 ; + } +rcu_read_unlock (); }else { aux.tp_vlan_tci =0 ; aux.tp_vlan_tpid =0 ;
Greg Kroah-Hartman
maintainerPATCH 370/568 btrfs: fix extent map use-after-free when adding pages to compressed bio
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 8e7860543a94784d744c7ce34b78a2e11beefa5c upstream.
At add_ra_bio_pages() we are accessing the extent map to calculate 'add_size' after we dropped our reference on the extent map, resulting in a use-after-free. Fix this by computing 'add_size' before dropping our extent map reference.
--- fs/btrfs/compression.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/compression.c +1 -1
@@ -420,6 +420,7 @@ static noinline int add_ra_bio_pages(strput_page (page);break ; } + add_size =min (em->start + em->len, page_end +1 ) - cur;free_extent_map (em);if (page->index == end_index) {
@@ -432,7 +433,6 @@ static noinline int add_ra_bio_pages(str } } - add_size =min (em->start + em->len, page_end +1 ) - cur; ret =bio_add_page (orig_bio, page, add_size,offset_in_page (cur));if (ret != add_size) {unlock_extent (tree, cur, page_end,NULL );
Greg Kroah-Hartman
maintainerPATCH 371/568 kernel: rerun task_work while freezing in get_signal()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 943ad0b62e3c21f324c4884caa6cb4a871bca05c upstream.
io_uring can asynchronously add a task_work while the task is getting freezed. TIF_NOTIFY_SIGNAL will prevent the task from sleeping in do_freezer_trap(), and since the get_signal()'s relock loop doesn't retry task_work, the task will spin there not being able to sleep until the freezing is cancelled / the task is killed / etc.
Run task_works in the freezer path. Keep the patch small and simple so it can be easily back ported, but we might need to do some cleaning after and look if there are other places with similar problems.
--- kernel/signal.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/signal.c +8 -0
@@ -2587,6 +2587,14 @@ static void do_freezer_trap(void)spin_unlock_irq (¤t->sighand->siglock);cgroup_enter_frozen ();schedule (); + +/* +* We could've been woken by task_work, run it to clear +* TIF_NOTIFY_SIGNAL. The caller will retry if necessary. +*/ +clear_notify_signal (); +if (unlikely (task_work_pending (current))) +task_work_run (); }static int ptrace_signal (int signr,kernel_siginfo_t *info,enum pid_type type)
Greg Kroah-Hartman
maintainerPATCH 372/568 ipv4: fix source address selection with route leak
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit 6807352353561187a718e87204458999dbcbba1b upstream.
By default, an address assigned to the output interface is selected when the source address is not specified. This is problematic when a route, configured in a vrf, uses an interface from another vrf (aka route leak). The original vrf does not own the selected source address.
Let's add a check against the output interface and call the appropriate function to select the source address.
--- net/ipv4/fib_semantics.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/ipv4/fib_semantics.c +11 -2
@@ -2270,6 +2270,15 @@ void fib_select_path(struct net *net, stfib_select_default (fl4, res); check_saddr: -if (!fl4->saddr) - fl4->saddr =fib_result_prefsrc (net, res); +if (!fl4->saddr) { +struct net_device *l3mdev; + + l3mdev =dev_get_by_index_rcu (net, fl4->flowi4_l3mdev); + +if (!l3mdev || +l3mdev_master_dev_rcu (FIB_RES_DEV (*res)) == l3mdev) + fl4->saddr =fib_result_prefsrc (net, res); +else + fl4->saddr =inet_select_addr (l3mdev,0 ,RT_SCOPE_LINK ); + } }
Greg Kroah-Hartman
maintainerPATCH 373/568 ipv6: take care of scope when choosing the src addr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit abb9a68d2c64dd9b128ae1f2e635e4d805e7ce64 upstream.
When the source address is selected, the scope must be checked. For example, if a loopback address is assigned to the vrf device, it must not be chosen for packets sent outside.
--- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +2 -1
@@ -1839,7 +1839,8 @@ int ipv6_dev_get_saddr(struct net *net, master, &dst, scores, hiscore_idx); -if (scores[hiscore_idx].ifa) +if (scores[hiscore_idx].ifa && + scores[hiscore_idx].scopedist >=0 ) goto out; }
Greg Kroah-Hartman
maintainerPATCH 374/568 NFSD: Support write delegations in LAYOUTGET
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit abc02e5602f7bf9bbae1e8999570a2ad5114578c upstream.
I noticed LAYOUTGET(LAYOUTIOMODE4_RW) returning NFS4ERR_ACCESS unexpectedly. The NFS client had created a file with mode 0444, and the server had returned a write delegation on the OPEN(CREATE). The client was requesting a RW layout using the write delegation stateid so that it could flush file modifications.
Creating a read-only file does not seem to be problematic for NFSv4.1 without pNFS, so I began looking at NFSD's implementation of LAYOUTGET.
The failure was because fh_verify() was doing a permission check as part of verifying the FH presented during the LAYOUTGET. It uses the loga_iomode value to specify the @accmode argument to fh_verify(). fh_verify(MAY_WRITE) on a file whose mode is 0444 fails with -EACCES.
To permit LAYOUT* operations in this case, add OWNER_OVERRIDE when checking the access permission of the incoming file handle for LAYOUTGET and LAYOUTCOMMIT.
Cc: Christoph Hellwig <[email protected]>
Cc: [email protected] # v6.6+
Message-Id: [email protected]
--- fs/nfsd/nfs4proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +3 -2
@@ -2218,7 +2218,7 @@ nfsd4_layoutget(struct svc_rqst *rqstp,const struct nfsd4_layout_ops *ops;struct nfs4_layout_stateid *ls;__be32 nfserr; -int accmode =NFSD_MAY_READ_IF_EXEC ; +int accmode =NFSD_MAY_READ_IF_EXEC |NFSD_MAY_OWNER_OVERRIDE ;switch (lgp->lg_seg.iomode) {case IOMODE_READ :
@@ -2308,7 +2308,8 @@ nfsd4_layoutcommit(struct svc_rqst *rqststruct nfs4_layout_stateid *ls;__be32 nfserr; - nfserr =fh_verify (rqstp, current_fh,0 ,NFSD_MAY_WRITE ); + nfserr =fh_verify (rqstp, current_fh,0 , +NFSD_MAY_WRITE |NFSD_MAY_OWNER_OVERRIDE );if (nfserr) goto out;
Greg Kroah-Hartman
maintainerPATCH 375/568 sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit d329605287020c3d1c3b0dadc63d8208e7251382 upstream.
When a task's weight is being changed, set_load_weight() is called with @update_load set. As weight changes aren't trivial for the fair class, set_load_weight() calls fair.c::reweight_task() for fair class tasks.
However, set_load_weight() first tests task_has_idle_policy() on entry and skips calling reweight_task() for SCHED_IDLE tasks. This is buggy as SCHED_IDLE tasks are just fair tasks with a very low weight and they would incorrectly skip load, vlag and position updates.
Fix it by updating reweight_task() to take struct load_weight as idle weight can't be expressed with prio and making set_load_weight() call reweight_task() for SCHED_IDLE tasks too when @update_load is set.
--- kernel/sched/core.c | 23 ++++++++++------------- kernel/sched/fair.c | 7 +++---- kernel/sched/sched.h | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-)
kernel/sched/core.c +10 -13
@@ -1304,27 +1304,24 @@ int tg_nop(struct task_group *tg, void *static void set_load_weight (struct task_struct *p,bool update_load) {int prio = p->static_prio -MAX_RT_PRIO ; -struct load_weight *load = &p->se.load; +struct load_weight lw; -/* -* SCHED_IDLE tasks get minimal weight: -*/ if (task_has_idle_policy (p)) { - load->weight =scale_load (WEIGHT_IDLEPRIO ); - load->inv_weight =WMULT_IDLEPRIO ; -return ; + lw.weight =scale_load (WEIGHT_IDLEPRIO ); + lw.inv_weight =WMULT_IDLEPRIO ; + }else { + lw.weight =scale_load (sched_prio_to_weight[prio]); + lw.inv_weight = sched_prio_to_wmult[prio]; }/* * SCHED_OTHER tasks have to update their load when changing their * weight */ -if (update_load && p->sched_class == &fair_sched_class) { -reweight_task (p, prio); - }else { - load->weight =scale_load (sched_prio_to_weight[prio]); - load->inv_weight = sched_prio_to_wmult[prio]; - } +if (update_load && p->sched_class == &fair_sched_class) +reweight_task (p, &lw); +else + p->se.load = lw; }#ifdef CONFIG_UCLAMP_TASK
kernel/sched/fair.c +3 -4
@@ -3791,15 +3791,14 @@ static void reweight_entity(struct cfs_r } } -void reweight_task (struct task_struct *p,int prio) +void reweight_task (struct task_struct *p,const struct load_weight *lw) {struct sched_entity *se = &p->se;struct cfs_rq *cfs_rq =cfs_rq_of (se);struct load_weight *load = &se->load; -unsigned long weight =scale_load (sched_prio_to_weight[prio]); -reweight_entity (cfs_rq, se, weight); - load->inv_weight = sched_prio_to_wmult[prio]; +reweight_entity (cfs_rq, se, lw->weight); + load->inv_weight = lw->inv_weight; }static inline int throttled_hierarchy (struct cfs_rq *cfs_rq);
kernel/sched/sched.h +1 -1
@@ -2435,7 +2435,7 @@ extern void init_sched_dl_class(void);extern void init_sched_rt_class (void );extern void init_sched_fair_class (void ); -extern void reweight_task (struct task_struct *p,int prio); +extern void reweight_task (struct task_struct *p,const struct load_weight *lw);extern void resched_curr (struct rq *rq);extern void resched_cpu (int cpu);
Greg Kroah-Hartman
maintainerPATCH 376/568 fuse: verify {g,u}id mount options correctly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 525bd65aa759ec320af1dc06e114ed69733e9e23 upstream.
As was done in0200679fc795 ("tmpfs: verify {g,u}id mount options correctly") we need to validate that the requested uid and/or gid is representable in the filesystem's idmapping.
Cribbing from the above commit log,
The contract for {g,u}id mount options and {g,u}id values in general set from userspace has always been that they are translated according to the caller's idmapping. In so far, fuse has been doing the correct thing. But since fuse is mountable in unprivileged contexts it is also necessary to verify that the resulting {k,g}uid is representable in the namespace of the superblock.
--- fs/fuse/inode.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
fs/fuse/inode.c +20 -4
@@ -751,6 +751,8 @@ static int fuse_parse_param(struct fs_costruct fs_parse_result result;struct fuse_fs_context *ctx = fsc->fs_private;int opt; +kuid_t kuid; +kgid_t kgid;if (fsc->purpose ==FS_CONTEXT_FOR_RECONFIGURE ) {/*
@@ -795,16 +797,30 @@ static int fuse_parse_param(struct fs_cobreak ;case OPT_USER_ID : - ctx->user_id =make_kuid (fsc->user_ns, result.uint_32); -if (!uid_valid (ctx->user_id)) + kuid =make_kuid (fsc->user_ns, result.uint_32); +if (!uid_valid (kuid))return invalfc (fsc,"Invalid user_id" ); +/* +* The requested uid must be representable in the +* filesystem's idmapping. +*/ +if (!kuid_has_mapping (fsc->user_ns, kuid)) +return invalfc (fsc,"Invalid user_id" ); + ctx->user_id = kuid; ctx->user_id_present = true;break ;case OPT_GROUP_ID : - ctx->group_id =make_kgid (fsc->user_ns, result.uint_32); -if (!gid_valid (ctx->group_id)) + kgid =make_kgid (fsc->user_ns, result.uint_32);; +if (!gid_valid (kgid)) +return invalfc (fsc,"Invalid group_id" ); +/* +* The requested gid must be representable in the +* filesystem's idmapping. +*/ +if (!kgid_has_mapping (fsc->user_ns, kgid))return invalfc (fsc,"Invalid group_id" ); + ctx->group_id = kgid; ctx->group_id_present = true;break ;
Greg Kroah-Hartman
maintainerPATCH 377/568 ata: libata-scsi: Fix offsets for the fixed format sense data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
commit 38dab832c3f4154968f95b267a3bb789e87554b0 upstream.
Correct the ATA PASS-THROUGH fixed format sense data offsets to conform to SPC-6 and SAT-5 specifications. Additionally, set the VALID bit to indicate that the INFORMATION field contains valid information.
INFORMATION
===========
SAT-5 Table 212 — "Fixed format sense data INFORMATION field for the ATA PASS-THROUGH commands" defines the following format:
+------+------------+ | Byte | Field | +------+------------+ | 0 | ERROR | | 1 | STATUS | | 2 | DEVICE | | 3 | COUNT(7:0) | +------+------------+
SPC-6 Table 48 - "Fixed format sense data" specifies that the INFORMATION field starts at byte 3 in sense buffer resulting in the following offsets for the ATA PASS-THROUGH commands:
+------------+-------------------------+ | Field | Offset in sense buffer | +------------+-------------------------+ | ERROR | 3 | | STATUS | 4 | | DEVICE | 5 | | COUNT(7:0) | 6 | +------------+-------------------------+
COMMAND-SPECIFIC INFORMATION
============================
SAT-5 Table 213 - "Fixed format sense data COMMAND-SPECIFIC INFORMATION field for ATA PASS-THROUGH" defines the following format:
+------+-------------------+ | Byte | Field | +------+-------------------+ | 0 | FLAGS | LOG INDEX | | 1 | LBA (7:0) | | 2 | LBA (15:8) | | 3 | LBA (23:16) | +------+-------------------+
SPC-6 Table 48 - "Fixed format sense data" specifies that the COMMAND-SPECIFIC-INFORMATION field starts at byte 8 in sense buffer resulting in the following offsets for the ATA PASS-THROUGH commands:
Offsets of these fields in the fixed sense format are as follows:
+-------------------+-------------------------+ | Field | Offset in sense buffer | +-------------------+-------------------------+ | FLAGS | LOG INDEX | 8 | | LBA (7:0) | 9 | | LBA (15:8) | 10 | | LBA (23:16) | 11 | +-------------------+-------------------------+
--- drivers/ata/libata-scsi.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/ata/libata-scsi.c +13 -13
@@ -855,7 +855,6 @@ static void ata_gen_passthru_sense(strucstruct scsi_cmnd *cmd = qc->scsicmd;struct ata_taskfile *tf = &qc->result_tf;unsigned char *sb = cmd->sense_buffer; -unsigned char *desc = sb +8 ;u8 sense_key, asc, ascq;memset (sb,0 ,SCSI_SENSE_BUFFERSIZE );
@@ -877,7 +876,8 @@ static void ata_gen_passthru_sense(strucscsi_build_sense (cmd,1 ,RECOVERED_ERROR ,0 ,0x1D ); } -if ((cmd->sense_buffer[0 ] &0x7f ) >=0x72 ) { +if ((sb[0 ] &0x7f ) >=0x72 ) { +unsigned char *desc;u8 len;/* descriptor format */
@@ -916,21 +916,21 @@ static void ata_gen_passthru_sense(struc } }else {/* Fixed sense format */ - desc[0 ] = tf->error; - desc[1 ] = tf->status; - desc[2 ] = tf->device; - desc[3 ] = tf->nsect; - desc[7 ] =0 ; + sb[0 ] |=0x80 ; + sb[3 ] = tf->error; + sb[4 ] = tf->status; + sb[5 ] = tf->device; + sb[6 ] = tf->nsect;if (tf->flags &ATA_TFLAG_LBA48 ) { - desc[8 ] |=0x80 ; + sb[8 ] |=0x80 ;if (tf->hob_nsect) - desc[8 ] |=0x40 ; + sb[8 ] |=0x40 ;if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah) - desc[8 ] |=0x20 ; + sb[8 ] |=0x20 ; } - desc[9 ] = tf->lbal; - desc[10 ] = tf->lbam; - desc[11 ] = tf->lbah; + sb[9 ] = tf->lbal; + sb[10 ] = tf->lbam; + sb[11 ] = tf->lbah; } }
Greg Kroah-Hartman
maintainerPATCH 378/568 char: tpm: Fix possible memory leak in tpm_bios_measurements_open()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
commit 5d8e2971e817bb64225fc0b6327a78752f58a9aa upstream.
In tpm_bios_measurements_open(), get_device() is called on the device embedded in struct tpm_chip. In the error path, however, put_device() is not called. This results in a reference count leak, which prevents the device from being properly released. This commit makes sure to call put_device() when the seq_open() call fails.
--- drivers/char/tpm/eventlog/common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/char/tpm/eventlog/common.c +2 -0
@@ -47,6 +47,8 @@ static int tpm_bios_measurements_open(stif (!err) { seq = file->private_data; seq->private = chip; + }else { +put_device (&chip->dev); }return err;
Greg Kroah-Hartman
maintainerPATCH 379/568 media: venus: fix use after free in vdec_close
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit a0157b5aa34eb43ec4c5510f9c260bbb03be937e upstream.
There appears to be a possible use after free with vdec_close(). The firmware will add buffer release work to the work queue through HFI callbacks as a normal part of decoding. Randomly closing the decoder device from userspace during normal decoding can incur a read after free for inst.
Fix it by cancelling the work in vdec_close.
--- drivers/media/platform/qcom/venus/vdec.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/qcom/venus/vdec.c +1 -0
@@ -1747,6 +1747,7 @@ static int vdec_close(struct file *file)vdec_pm_get (inst); +cancel_work_sync (&inst->delayed_process_work);v4l2_m2m_ctx_release (inst->m2m_ctx);v4l2_m2m_release (inst->m2m_dev);vdec_ctrl_deinit (inst);
Greg Kroah-Hartman
maintainerPATCH 380/568 ata: libata-scsi: Do not overwrite valid sense data when CK_COND=1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
commit 97981926224afe17ba3e22e0c2b7dd8b516ee574 upstream.
Current ata_gen_passthru_sense() code performs two actions:
1. Generates sense data based on the ATA 'status' and ATA 'error' fields.
2. Populates "ATA Status Return sense data descriptor" / "Fixed format sense data" with ATA taskfile fields.
The problem is that #1 generates sense data even when a valid sense data is already present (ATA_QCFLAG_SENSE_VALID is set). Factoring out #2 into a separate function allows us to generate sense data only when there is no valid sense data (ATA_QCFLAG_SENSE_VALID is not set).
As a bonus, we can now delete a FIXME comment in atapi_qc_complete() which states that we don't want to translate taskfile registers into sense descriptors for ATAPI.
Additionally, always set SAM_STAT_CHECK_CONDITION when CK_COND=1 because SAT specification mandates that SATL shall return CHECK CONDITION if the CK_COND bit is set.
The ATA PASS-THROUGH handling logic in ata_scsi_qc_complete() is hard to read/understand. Improve the readability of the code by moving checks into self-explanatory boolean variables.
--- drivers/ata/libata-scsi.c | 169 +++++++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 77 deletions(-)
drivers/ata/libata-scsi.c +92 -77
@@ -230,6 +230,80 @@ void ata_scsi_set_sense_information(stru SCSI_SENSE_BUFFERSIZE, information); } +/** +* ata_scsi_set_passthru_sense_fields - Set ATA fields in sense buffer +* @qc: ATA PASS-THROUGH command. +* +* Populates "ATA Status Return sense data descriptor" / "Fixed format +* sense data" with ATA taskfile fields. +* +* LOCKING: +* None. +*/ +static void ata_scsi_set_passthru_sense_fields (struct ata_queued_cmd *qc) +{ +struct scsi_cmnd *cmd = qc->scsicmd; +struct ata_taskfile *tf = &qc->result_tf; +unsigned char *sb = cmd->sense_buffer; + +if ((sb[0 ] &0x7f ) >=0x72 ) { +unsigned char *desc; +u8 len; + +/* descriptor format */ + len = sb[7 ]; + desc = (char *)scsi_sense_desc_find (sb, len +8 ,9 ); +if (!desc) { +if (SCSI_SENSE_BUFFERSIZE < len +14 ) +return ; + sb[7 ] = len +14 ; + desc = sb +8 + len; + } + desc[0 ] =9 ; + desc[1 ] =12 ; +/* +* Copy registers into sense buffer. +*/ + desc[2 ] =0x00 ; + desc[3 ] = tf->error; + desc[5 ] = tf->nsect; + desc[7 ] = tf->lbal; + desc[9 ] = tf->lbam; + desc[11 ] = tf->lbah; + desc[12 ] = tf->device; + desc[13 ] = tf->status; + +/* +* Fill in Extend bit, and the high order bytes +* if applicable. +*/ +if (tf->flags &ATA_TFLAG_LBA48 ) { + desc[2 ] |=0x01 ; + desc[4 ] = tf->hob_nsect; + desc[6 ] = tf->hob_lbal; + desc[8 ] = tf->hob_lbam; + desc[10 ] = tf->hob_lbah; + } + }else { +/* Fixed sense format */ + sb[0 ] |=0x80 ; + sb[3 ] = tf->error; + sb[4 ] = tf->status; + sb[5 ] = tf->device; + sb[6 ] = tf->nsect; +if (tf->flags &ATA_TFLAG_LBA48 ) { + sb[8 ] |=0x80 ; +if (tf->hob_nsect) + sb[8 ] |=0x40 ; +if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah) + sb[8 ] |=0x20 ; + } + sb[9 ] = tf->lbal; + sb[10 ] = tf->lbam; + sb[11 ] = tf->lbah; + } +} +static void ata_scsi_set_invalid_field (struct ata_device *dev,struct scsi_cmnd *cmd,u16 field,u8 bit) {
@@ -837,10 +911,8 @@ static void ata_to_sense_error(unsigned* ata_gen_passthru_sense - Generate check condition sense block. * @qc: Command that completed. * -* This function is specific to the ATA descriptor format sense -* block specified for the ATA pass through commands. Regardless -* of whether the command errored or not, return a sense -* block. Copy all controller registers into the sense +* This function is specific to the ATA pass through commands. +* Regardless of whether the command errored or not, return a sense * block. If there was no error, we get the request from an ATA * passthrough command, so we use the following sense data: * sk = RECOVERED ERROR
@@ -875,63 +947,6 @@ static void ata_gen_passthru_sense(struc*/ scsi_build_sense (cmd,1 ,RECOVERED_ERROR ,0 ,0x1D ); } - -if ((sb[0 ] &0x7f ) >=0x72 ) { -unsigned char *desc; -u8 len; - -/* descriptor format */ - len = sb[7 ]; - desc = (char *)scsi_sense_desc_find (sb, len +8 ,9 ); -if (!desc) { -if (SCSI_SENSE_BUFFERSIZE < len +14 ) -return ; - sb[7 ] = len +14 ; - desc = sb +8 + len; - } - desc[0 ] =9 ; - desc[1 ] =12 ; -/* -* Copy registers into sense buffer. -*/ - desc[2 ] =0x00 ; - desc[3 ] = tf->error; - desc[5 ] = tf->nsect; - desc[7 ] = tf->lbal; - desc[9 ] = tf->lbam; - desc[11 ] = tf->lbah; - desc[12 ] = tf->device; - desc[13 ] = tf->status; - -/* -* Fill in Extend bit, and the high order bytes -* if applicable. -*/ -if (tf->flags &ATA_TFLAG_LBA48 ) { - desc[2 ] |=0x01 ; - desc[4 ] = tf->hob_nsect; - desc[6 ] = tf->hob_lbal; - desc[8 ] = tf->hob_lbam; - desc[10 ] = tf->hob_lbah; - } - }else { -/* Fixed sense format */ - sb[0 ] |=0x80 ; - sb[3 ] = tf->error; - sb[4 ] = tf->status; - sb[5 ] = tf->device; - sb[6 ] = tf->nsect; -if (tf->flags &ATA_TFLAG_LBA48 ) { - sb[8 ] |=0x80 ; -if (tf->hob_nsect) - sb[8 ] |=0x40 ; -if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah) - sb[8 ] |=0x20 ; - } - sb[9 ] = tf->lbal; - sb[10 ] = tf->lbam; - sb[11 ] = tf->lbah; - } }/**
@@ -1664,26 +1679,32 @@ static void ata_scsi_qc_complete(struct {struct scsi_cmnd *cmd = qc->scsicmd;u8 *cdb = cmd->cmnd; -int need_sense = (qc->err_mask !=0 ) && - !(qc->flags &ATA_QCFLAG_SENSE_VALID ); +bool have_sense = qc->flags &ATA_QCFLAG_SENSE_VALID ; +bool is_ata_passthru = cdb[0 ] ==ATA_16 || cdb[0 ] ==ATA_12 ; +bool is_ck_cond_request = cdb[2 ] &0x20 ; +bool is_error = qc->err_mask !=0 ;/* For ATA pass thru (SAT) commands, generate a sense block if * user mandated it or if there's an error. Note that if we -* generate because the user forced us to [CK_COND =1], a check +* generate because the user forced us to [CK_COND=1], a check * condition is generated and the ATA register values are returned * whether the command completed successfully or not. If there -* was no error, we use the following sense data: +* was no error, and CK_COND=1, we use the following sense data: * sk = RECOVERED ERROR * asc,ascq = ATA PASS-THROUGH INFORMATION AVAILABLE */ -if (((cdb[0 ] ==ATA_16 ) || (cdb[0 ] ==ATA_12 )) && - ((cdb[2 ] &0x20 ) || need_sense)) -ata_gen_passthru_sense (qc); -else if (need_sense) +if (is_ata_passthru && (is_ck_cond_request || is_error || have_sense)) { +if (!have_sense) +ata_gen_passthru_sense (qc); +ata_scsi_set_passthru_sense_fields (qc); +if (is_ck_cond_request) +set_status_byte (qc->scsicmd,SAM_STAT_CHECK_CONDITION ); + }else if (is_error && !have_sense) {ata_gen_ata_sense (qc); -else + }else {/* Keep the SCSI ML and status byte, clear host byte. */ cmd->result &=0x0000ffff ; + }ata_qc_done (qc); }
@@ -2622,14 +2643,8 @@ static void atapi_qc_complete(struct ata/* handle completion from EH */ if (unlikely (err_mask || qc->flags &ATA_QCFLAG_SENSE_VALID )) { -if (!(qc->flags &ATA_QCFLAG_SENSE_VALID )) { -/* FIXME: not quite right; we don't want the -* translation of taskfile registers into a -* sense descriptors, since that's only -* correct for ATA, not ATAPI -*/ +if (!(qc->flags &ATA_QCFLAG_SENSE_VALID ))ata_gen_passthru_sense (qc); - }/* SCSI EH automatically locks door if sdev->locked is * set. Sometimes door lock request continues to
Greg Kroah-Hartman
maintainerPATCH 381/568 ata: libata-scsi: Honor the D_SENSE bit for CK_COND=1 and no error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
commit 28ab9769117ca944cb6eb537af5599aa436287a4 upstream.
SAT-5 revision 8 specification removed the text about the ANSI INCITS 431-2007 compliance which was requiring SCSI/ATA Translation (SAT) to return descriptor format sense data for the ATA PASS-THROUGH commands regardless of the setting of the D_SENSE bit.
Let's honor the D_SENSE bit for ATA PASS-THROUGH commands while generating the "ATA PASS-THROUGH INFORMATION AVAILABLE" sense data.
SAT-5 revision 7
================
12.2.2.8 Fixed format sense data
Table 212 shows the fields returned in the fixed format sense data (see SPC-5) for ATA PASS-THROUGH commands. SATLs compliant with ANSI INCITS 431-2007, SCSI/ATA Translation (SAT) return descriptor format sense data for the ATA PASS-THROUGH commands regardless of the setting of the D_SENSE bit.
SAT-5 revision 8
================
12.2.2.8 Fixed format sense data
Table 211 shows the fields returned in the fixed format sense data (see SPC-5) for ATA PASS-THROUGH commands.
--- drivers/ata/libata-scsi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/ata/libata-scsi.c +2 -5
@@ -941,11 +941,8 @@ static void ata_gen_passthru_sense(struc &sense_key, &asc, &ascq);ata_scsi_set_sense (qc->dev, cmd, sense_key, asc, ascq); }else { -/* -* ATA PASS-THROUGH INFORMATION AVAILABLE -* Always in descriptor format sense. -*/ -scsi_build_sense (cmd,1 ,RECOVERED_ERROR ,0 ,0x1D ); +/* ATA PASS-THROUGH INFORMATION AVAILABLE */ +ata_scsi_set_sense (qc->dev, cmd,RECOVERED_ERROR ,0 ,0x1D ); } }
Greg Kroah-Hartman
maintainerPATCH 382/568 hfs: fix to initialize fields of hfs_inode_info after hfs_alloc_inode()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 26a2ed107929a855155429b11e1293b83e6b2a8b upstream.
Syzbot reports uninitialized value access issue as below:
loop0: detected capacity change from 0 to 64
=====================================================
BUG: KMSAN: uninit-value in hfs_revalidate_dentry+0x307/0x3f0 fs/hfs/sysdep.c:30 hfs_revalidate_dentry+0x307/0x3f0 fs/hfs/sysdep.c:30 d_revalidate fs/namei.c:862 [inline] lookup_fast+0x89e/0x8e0 fs/namei.c:1649 walk_component fs/namei.c:2001 [inline] link_path_walk+0x817/0x1480 fs/namei.c:2332 path_lookupat+0xd9/0x6f0 fs/namei.c:2485 filename_lookup+0x22e/0x740 fs/namei.c:2515 user_path_at_empty+0x8b/0x390 fs/namei.c:2924 user_path_at include/linux/namei.h:57 [inline] do_mount fs/namespace.c:3689 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount+0x66b/0x810 fs/namespace.c:3875 __x64_sys_mount+0xe4/0x140 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b BUG: KMSAN: uninit-value in hfs_ext_read_extent fs/hfs/extent.c:196 [inline] BUG: KMSAN: uninit-value in hfs_get_block+0x92d/0x1620 fs/hfs/extent.c:366 hfs_ext_read_extent fs/hfs/extent.c:196 [inline] hfs_get_block+0x92d/0x1620 fs/hfs/extent.c:366 block_read_full_folio+0x4ff/0x11b0 fs/buffer.c:2271 hfs_read_folio+0x55/0x60 fs/hfs/inode.c:39 filemap_read_folio+0x148/0x4f0 mm/filemap.c:2426 do_read_cache_folio+0x7c8/0xd90 mm/filemap.c:3553 do_read_cache_page mm/filemap.c:3595 [inline] read_cache_page+0xfb/0x2f0 mm/filemap.c:3604 read_mapping_page include/linux/pagemap.h:755 [inline] hfs_btree_open+0x928/0x1ae0 fs/hfs/btree.c:78 hfs_mdb_get+0x260c/0x3000 fs/hfs/mdb.c:204 hfs_fill_super+0x1fb1/0x2790 fs/hfs/super.c:406 mount_bdev+0x628/0x920 fs/super.c:1359 hfs_mount+0xcd/0xe0 fs/hfs/super.c:456 legacy_get_tree+0x167/0x2e0 fs/fs_context.c:610 vfs_get_tree+0xdc/0x5d0 fs/super.c:1489 do_new_mount+0x7a9/0x16f0 fs/namespace.c:3145 path_mount+0xf98/0x26a0 fs/namespace.c:3475 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount+0x919/0x9e0 fs/namespace.c:3674 __ia32_sys_mount+0x15b/0x1b0 fs/namespace.c:3674 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178 do_fast_syscall_32+0x37/0x80 arch/x86/entry/common.c:203 do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:246 entry_SYSENTER_compat_after_hwframe+0x70/0x82
Uninit was created at:
__alloc_pages+0x9a6/0xe00 mm/page_alloc.c:4590 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2190 [inline] allocate_slab mm/slub.c:2354 [inline] new_slab+0x2d7/0x1400 mm/slub.c:2407 ___slab_alloc+0x16b5/0x3970 mm/slub.c:3540 __slab_alloc mm/slub.c:3625 [inline] __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmem_cache_alloc_lru+0x64d/0xb30 mm/slub.c:3879 alloc_inode_sb include/linux/fs.h:3018 [inline] hfs_alloc_inode+0x5a/0xc0 fs/hfs/super.c:165 alloc_inode+0x83/0x440 fs/inode.c:260 new_inode_pseudo fs/inode.c:1005 [inline] new_inode+0x38/0x4f0 fs/inode.c:1031 hfs_new_inode+0x61/0x1010 fs/hfs/inode.c:186 hfs_mkdir+0x54/0x250 fs/hfs/dir.c:228 vfs_mkdir+0x49a/0x700 fs/namei.c:4126 do_mkdirat+0x529/0x810 fs/namei.c:4149 __do_sys_mkdirat fs/namei.c:4164 [inline] __se_sys_mkdirat fs/namei.c:4162 [inline] __x64_sys_mkdirat+0xc8/0x120 fs/namei.c:4162 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
It missed to initialize .tz_secondswest, .cached_start and .cached_blocks fields in struct hfs_inode_info after hfs_alloc_inode(), fix it.
--- fs/hfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/hfs/inode.c +3 -0
@@ -204,6 +204,7 @@ struct inode *hfs_new_inode(struct inodeHFS_I (inode)->flags =0 ;HFS_I (inode)->rsrc_inode =NULL ;HFS_I (inode)->fs_blocks =0 ; +HFS_I (inode)->tz_secondswest = sys_tz.tz_minuteswest *60 ;if (S_ISDIR (mode)) { inode->i_size =2 ;HFS_SB (sb)->folder_count++;
@@ -279,6 +280,8 @@ void hfs_inode_read_fork(struct inode *ifor (count =0 , i =0 ; i <3 ; i++) count +=be16_to_cpu (ext[i].count);HFS_I (inode)->first_blocks = count; +HFS_I (inode)->cached_start =0 ; +HFS_I (inode)->cached_blocks =0 ; inode->i_size =HFS_I (inode)->phys_size = log_size;HFS_I (inode)->fs_blocks = (log_size + sb->s_blocksize -1 ) >> sb->s_blocksize_bits;
Greg Kroah-Hartman
maintainerPATCH 383/568 ext2: Verify bitmap and itable block numbers before using them
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 322a6aff03937aa1ece33b4e46c298eafaf9ac41 upstream.
Verify bitmap block numbers and inode table blocks are sane before using them for checking bits in the block bitmap.
--- fs/ext2/balloc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ext2/balloc.c +9 -2
@@ -77,26 +77,33 @@ static int ext2_valid_block_bitmap(strucext2_grpblk_t next_zero_bit;ext2_fsblk_t bitmap_blk;ext2_fsblk_t group_first_block; +ext2_grpblk_t max_bit; group_first_block =ext2_group_first_block_no (sb, block_group); + max_bit =ext2_group_last_block_no (sb, block_group) - group_first_block;/* check whether block bitmap block number is set */ bitmap_blk =le32_to_cpu (desc->bg_block_bitmap); offset = bitmap_blk - group_first_block; -if (!ext2_test_bit (offset, bh->b_data)) +if (offset <0 || offset > max_bit || + !ext2_test_bit (offset, bh->b_data))/* bad block bitmap */ goto err_out;/* check whether the inode bitmap block number is set */ bitmap_blk =le32_to_cpu (desc->bg_inode_bitmap); offset = bitmap_blk - group_first_block; -if (!ext2_test_bit (offset, bh->b_data)) +if (offset <0 || offset > max_bit || + !ext2_test_bit (offset, bh->b_data))/* bad block bitmap */ goto err_out;/* check whether the inode table block number is set */ bitmap_blk =le32_to_cpu (desc->bg_inode_table); offset = bitmap_blk - group_first_block; +if (offset <0 || offset > max_bit || + offset +EXT2_SB (sb)->s_itb_per_group -1 > max_bit) + goto err_out; next_zero_bit =ext2_find_next_zero_bit (bh->b_data, offset +EXT2_SB (sb)->s_itb_per_group, offset);
Greg Kroah-Hartman
maintainerPATCH 384/568 io_uring/io-wq: limit retrying worker initialisation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 0453aad676ff99787124b9b3af4a5f59fbe808e2 upstream.
If io-wq worker creation fails, we retry it by queueing up a task_work. tasK_work is needed because it should be done from the user process context. The problem is that retries are not limited, and if queueing a task_work is the reason for the failure, we might get into an infinite loop.
It doesn't seem to happen now but it would with the following patch executing task_work in the freezer's loop. For now, arbitrarily limit the number of attempts to create a worker.
--- io_uring/io-wq.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
io_uring/io-wq.c +7 -3
@@ -23,6 +23,7 @@#include "io_uring.h" #define WORKER_IDLE_TIMEOUT (5 * HZ) +#define WORKER_INIT_LIMIT 3enum {IO_WORKER_F_UP =0 ,/* up and active */
@@ -59,6 +60,7 @@ struct io_worker {unsigned long create_state;struct callback_head create_work; +int init_retries;union {struct rcu_head rcu;
@@ -746,7 +748,7 @@ static bool io_wq_work_match_all(structreturn true; } -static inline bool io_should_retry_thread (long err) +static inline bool io_should_retry_thread (struct io_worker *worker,long err) {/* * Prevent perpetual task_work retry, if the task (or its group) is
@@ -754,6 +756,8 @@ static inline bool io_should_retry_threa*/ if (fatal_signal_pending (current))return false; +if (worker->init_retries++ >=WORKER_INIT_LIMIT ) +return false;switch (err) {case -EAGAIN :
@@ -780,7 +784,7 @@ static void create_worker_cont(struct caio_init_new_worker (wq, worker, tsk);io_worker_release (worker);return ; - }else if (!io_should_retry_thread (PTR_ERR (tsk))) { + }else if (!io_should_retry_thread (worker,PTR_ERR (tsk))) {struct io_wq_acct *acct =io_wq_get_acct (worker);atomic_dec (&acct->nr_running);
@@ -847,7 +851,7 @@ fail: tsk =create_io_thread (io_wq_worker, worker,NUMA_NO_NODE );if (!IS_ERR (tsk)) {io_init_new_worker (wq, worker, tsk); - }else if (!io_should_retry_thread (PTR_ERR (tsk))) { + }else if (!io_should_retry_thread (worker,PTR_ERR (tsk))) {kfree (worker); goto fail; }else {
Greg Kroah-Hartman
maintainerPATCH 385/568 drm/gma500: fix null pointer dereference in cdv_intel_lvds_get_modes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit cb520c3f366c77e8d69e4e2e2781a8ce48d98e79 upstream.
In cdv_intel_lvds_get_modes(), the return value of drm_mode_duplicate() is assigned to mode, which will lead to a NULL pointer dereference on failure of drm_mode_duplicate(). Add a check to avoid npd.
--- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/gma500/cdv_intel_lvds.c +3 -0
@@ -311,6 +311,9 @@ static int cdv_intel_lvds_get_modes(struif (mode_dev->panel_fixed_mode !=NULL ) {struct drm_display_mode *mode =drm_mode_duplicate (dev, mode_dev->panel_fixed_mode); +if (!mode) +return 0 ; +drm_mode_probed_add (connector, mode);return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 386/568 drm/gma500: fix null pointer dereference in psb_intel_lvds_get_modes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit 2df7aac81070987b0f052985856aa325a38debf6 upstream.
In psb_intel_lvds_get_modes(), the return value of drm_mode_duplicate() is assigned to mode, which will lead to a possible NULL pointer dereference on failure of drm_mode_duplicate(). Add a check to avoid npd.
--- drivers/gpu/drm/gma500/psb_intel_lvds.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/gma500/psb_intel_lvds.c +3 -0
@@ -504,6 +504,9 @@ static int psb_intel_lvds_get_modes(struif (mode_dev->panel_fixed_mode !=NULL ) {struct drm_display_mode *mode =drm_mode_duplicate (dev, mode_dev->panel_fixed_mode); +if (!mode) +return 0 ; +drm_mode_probed_add (connector, mode);return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 387/568 scsi: qla2xxx: Fix optrom version displayed in FDMI
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shreyas Deodhar <[email protected]>
commit 348744f27a35e087acc9378bf53537fbfb072775 upstream.
Bios version was popluated for FDMI response. Systems with EFI would show optrom version as 0. EFI version is populated here and BIOS version is already displayed under FDMI_HBA_BOOT_BIOS_NAME.
--- drivers/scsi/qla2xxx/qla_gs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_gs.c +1 -1
@@ -1710,7 +1710,7 @@ qla2x00_hba_attributes(scsi_qla_host_t * eiter->type =cpu_to_be16 (FDMI_HBA_OPTION_ROM_VERSION ); alen =scnprintf ( eiter->a.orom_version,sizeof (eiter->a.orom_version), -"%d.%02d" , ha->bios_revision[1 ], ha->bios_revision[0 ]); +"%d.%02d" , ha->efi_revision[1 ], ha->efi_revision[0 ]); alen +=FDMI_ATTR_ALIGNMENT (alen); alen +=FDMI_ATTR_TYPELEN (eiter); eiter->len =cpu_to_be16 (alen);
Greg Kroah-Hartman
maintainerPATCH 388/568 drm/amd/display: Check for NULL pointer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sung Joon Kim <[email protected]>
commit 4ab68e168ae1695f7c04fae98930740aaf7c50fa upstream.
[why & how]
Need to make sure plane_state is initialized
before accessing its members.
--- drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +2 -1
@@ -154,7 +154,8 @@ const struct dc_plane_status *dc_plane_gif (pipe_ctx->plane_state != plane_state)continue ; - pipe_ctx->plane_state->status.is_flip_pending = false; +if (pipe_ctx->plane_state) + pipe_ctx->plane_state->status.is_flip_pending = false;break ; }
Greg Kroah-Hartman
maintainerPATCH 389/568 apparmor: use kvfree_sensitive to free data->data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 2bc73505a5cd2a18a7a542022722f136c19e3b87 upstream.
Inside unpack_profile() data->data is allocated using kvmemdup() so it should be freed with the corresponding kvfree_sensitive().
Also add missing data->data release for rhashtable insertion failure path in unpack_profile().
Found by Linux Verification Center (linuxtesting.org).
--- security/apparmor/policy.c | 2 +- security/apparmor/policy_unpack.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
security/apparmor/policy.c +1 -1
@@ -188,7 +188,7 @@ static void aa_free_data(void *ptr, void {struct aa_data *data = ptr; -kfree_sensitive (data->data); +kvfree_sensitive (data->data, data->size);kfree_sensitive (data->key);kfree_sensitive (data); }
security/apparmor/policy_unpack.c +1 -0
@@ -1081,6 +1081,7 @@ static struct aa_profile *unpack_profileif (rhashtable_insert_fast (profile->data, &data->head, profile->data->p)) { +kvfree_sensitive (data->data, data->size);kfree_sensitive (data->key);kfree_sensitive (data); info ="failed to insert data to table" ;
Greg Kroah-Hartman
maintainerPATCH 390/568 cifs: fix potential null pointer use in destroy_workqueue in init_cifs error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 193cc89ea0ca1da311877d2b4bb5e9f03bcc82a2 upstream.
Dan Carpenter reported a Smack static checker warning:
fs/smb/client/cifsfs.c:1981 init_cifs()
error: we previously assumed 'serverclose_wq' could be null (see line 1895)
The patch which introduced the serverclose workqueue used the wrong oredering in error paths in init_cifs() for freeing it on errors.
--- fs/smb/client/cifsfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/smb/client/cifsfs.c +4 -4
@@ -1885,12 +1885,12 @@ init_cifs(void) WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);if (!serverclose_wq) { rc = -ENOMEM ; - goto out_destroy_serverclose_wq; + goto out_destroy_deferredclose_wq; } rc =cifs_init_inodecache ();if (rc) - goto out_destroy_deferredclose_wq; + goto out_destroy_serverclose_wq; rc =init_mids ();if (rc)
@@ -1952,6 +1952,8 @@ out_destroy_mids:destroy_mids (); out_destroy_inodecache:cifs_destroy_inodecache (); +out_destroy_serverclose_wq: +destroy_workqueue (serverclose_wq); out_destroy_deferredclose_wq:destroy_workqueue (deferredclose_wq); out_destroy_cifsoplockd_wq:
@@ -1962,8 +1964,6 @@ out_destroy_decrypt_wq:destroy_workqueue (decrypt_wq); out_destroy_cifsiod_wq:destroy_workqueue (cifsiod_wq); -out_destroy_serverclose_wq: -destroy_workqueue (serverclose_wq); out_clean_proc:cifs_proc_clean ();return rc;
Greg Kroah-Hartman
maintainerPATCH 391/568 cifs: fix reconnect with SMB1 UNIX Extensions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit a214384ce26b6111ea8c8d58fa82a1ca63996c38 upstream.
When mounting with the SMB1 Unix Extensions (e.g. mounts to Samba with vers=1.0), reconnects no longer reset the Unix Extensions (SetFSInfo SET_FILE_UNIX_BASIC) after tcon so most operations (e.g. stat, ls, open, statfs) will fail continuously with:
"Operation not supported"
if the connection ever resets (e.g. due to brief network disconnect)
--- fs/smb/client/connect.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/smb/client/connect.c +16 -1
@@ -3686,6 +3686,7 @@ error: }#endif +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY /* * Issue a TREE_CONNECT request. */
@@ -3807,11 +3808,25 @@ CIFSTCon(const unsigned int xid, struct else tcon->Flags = 0;cifs_dbg (FYI ,"Tcon flags: 0x%x\n" , tcon->Flags); - } +/* +* reset_cifs_unix_caps calls QFSInfo which requires +* need_reconnect to be false, but we would not need to call +* reset_caps if this were not a reconnect case so must check +* need_reconnect flag here. The caller will also clear +* need_reconnect when tcon was successful but needed to be +* cleared earlier in the case of unix extensions reconnect +*/ +if (tcon->need_reconnect && tcon->unix_ext) { +cifs_dbg (FYI ,"resetting caps for %s\n" , tcon->tree_name); + tcon->need_reconnect = false; +reset_cifs_unix_caps (xid, tcon,NULL ,NULL ); + } + }cifs_buf_release (smb_buffer);return rc; } +#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ static void delayed_free (struct rcu_head *p) {
Greg Kroah-Hartman
maintainerPATCH 392/568 cifs: mount with "unix" mount option for SMB1 incorrectly handled
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 0e314e452687ce0ec5874e42cdb993a34325d3d2 upstream.
Although by default we negotiate CIFS Unix Extensions for SMB1 mounts to Samba (and they work if the user does not specify "unix" or "posix" or "linux" on mount), and we do properly handle when a user turns them off with "nounix" mount parm. But with the changes to the mount API we broke cases where the user explicitly specifies the "unix" option (or equivalently "linux" or "posix") on mount with vers=1.0 to Samba or other servers which support the CIFS Unix Extensions.
"mount error(95): Operation not supported"
and logged:
"CIFS: VFS: Check vers= mount option. SMB3.11 disabled but required for POSIX extensions"
even though CIFS Unix Extensions are supported for vers=1.0 This patch fixes the case where the user specifies both "unix" (or equivalently "posix" or "linux") and "vers=1.0" on mount to a server which supports the CIFS Unix Extensions.
--- fs/smb/client/connect.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/smb/client/connect.c +7 -0
@@ -2614,6 +2614,13 @@ cifs_get_tcon(struct cifs_ses *ses, strucifs_dbg (VFS ,"Server does not support mounting with posix SMB3.11 extensions\n" ); rc = -EOPNOTSUPP ; goto out_fail; + }else if (ses->server->vals->protocol_id ==SMB10_PROT_ID ) +if (cap_unix (ses)) +cifs_dbg (FYI ,"Unix Extensions requested on SMB1 mount\n" ); +else { +cifs_dbg (VFS ,"SMB1 Unix Extensions not supported by server\n" ); + rc = -EOPNOTSUPP ; + goto out_fail; }else {cifs_dbg (VFS ,"Check vers= mount option. SMB3.11 disabled but required for POSIX extensions\n" );
Greg Kroah-Hartman
maintainerPATCH 393/568 task_work: s/task_work_cancel()/task_work_cancel_func()/
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 68cbd415dd4b9c5b9df69f0f091879e56bf5907a upstream.
A proper task_work_cancel() API that actually cancels a callback and not *any* callback pointing to a given function is going to be needed for perf events event freeing. Do the appropriate rename to prepare for that.
--- include/linux/task_work.h | 2 +- kernel/irq/manage.c | 2 +- kernel/task_work.c | 10 +++++----- security/keys/keyctl.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
include/linux/task_work.h +1 -1
@@ -30,7 +30,7 @@ int task_work_add(struct task_struct *tastruct callback_head *task_work_cancel_match (struct task_struct *task,bool (*match)(struct callback_head *,void *data),void *data); -struct callback_head *task_work_cancel (struct task_struct *,task_work_func_t ); +struct callback_head *task_work_cancel_func (struct task_struct *,task_work_func_t );void task_work_run (void );static inline void exit_task_work (struct task_struct *task)
kernel/irq/manage.c +1 -1
@@ -1332,7 +1332,7 @@ static int irq_thread(void *data)* synchronize_hardirq(). So neither IRQTF_RUNTHREAD nor the * oneshot mask bit can be set. */ -task_work_cancel (current, irq_thread_dtor); +task_work_cancel_func (current, irq_thread_dtor);return 0 ; }
kernel/task_work.c +5 -5
@@ -120,9 +120,9 @@ static bool task_work_func_match(struct }/** -* task_work_cancel - cancel a pending work added by task_work_add() -* @task: the task which should execute the work -* @func: identifies the work to remove +* task_work_cancel_func - cancel a pending work matching a function added by task_work_add() +* @task: the task which should execute the func's work +* @func: identifies the func to match with a work to remove * * Find the last queued pending work with ->func == @func and remove * it from queue.
@@ -131,7 +131,7 @@ static bool task_work_func_match(struct* The found work or NULL if not found. */ struct callback_head * -task_work_cancel (struct task_struct *task,task_work_func_t func) +task_work_cancel_func (struct task_struct *task,task_work_func_t func) {return task_work_cancel_match (task, task_work_func_match, func); }
@@ -168,7 +168,7 @@ void task_work_run(void)if (!work)break ;/* -* Synchronize with task_work_cancel(). It can not remove +* Synchronize with task_work_cancel_match(). It can not remove * the first entry == work, cmpxchg(task_works) must fail. * But it can remove another entry from the ->next list. */
security/keys/keyctl.c +1 -1
@@ -1694,7 +1694,7 @@ long keyctl_session_to_parent(void) goto unlock;/* cancel an already pending keyring replacement */ - oldwork =task_work_cancel (parent, key_change_session_keyring); + oldwork =task_work_cancel_func (parent, key_change_session_keyring);/* the replacement session keyring is applied just prior to userspace * restarting */
Greg Kroah-Hartman
maintainerPATCH 394/568 task_work: Introduce task_work_cancel() again
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit f409530e4db9dd11b88cb7703c97c8f326ff6566 upstream.
Re-introduce task_work_cancel(), this time to cancel an actual callback and not *any* callback pointing to a given function. This is going to be needed for perf events event freeing.
--- include/linux/task_work.h | 1 + kernel/task_work.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
include/linux/task_work.h +1 -0
@@ -31,6 +31,7 @@ int task_work_add(struct task_struct *tastruct callback_head *task_work_cancel_match (struct task_struct *task,bool (*match)(struct callback_head *,void *data),void *data);struct callback_head *task_work_cancel_func (struct task_struct *,task_work_func_t ); +bool task_work_cancel (struct task_struct *task,struct callback_head *cb);void task_work_run (void );static inline void exit_task_work (struct task_struct *task)
kernel/task_work.c +24 -0
@@ -136,6 +136,30 @@ task_work_cancel_func(struct task_structreturn task_work_cancel_match (task, task_work_func_match, func); } +static bool task_work_match (struct callback_head *cb,void *data) +{ +return cb == data; +} + +/** +* task_work_cancel - cancel a pending work added by task_work_add() +* @task: the task which should execute the work +* @cb: the callback to remove if queued +* +* Remove a callback from a task's queue if queued. +* +* RETURNS: +* True if the callback was queued and got cancelled, false otherwise. +*/ +bool task_work_cancel (struct task_struct *task,struct callback_head *cb) +{ +struct callback_head *ret; + + ret =task_work_cancel_match (task, task_work_match, cb); + +return ret == cb; +} +/** * task_work_run - execute the works added by task_work_add() *
Greg Kroah-Hartman
maintainerPATCH 395/568 udf: Avoid using corrupted block bitmap buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit a90d4471146de21745980cba51ce88e7926bcc4f upstream.
When the filesystem block bitmap is corrupted, we detect the corruption while loading the bitmap and fail the allocation with error. However the next allocation from the same bitmap will notice the bitmap buffer is already loaded and tries to allocate from the bitmap with mixed results (depending on the exact nature of the bitmap corruption). Fix the problem by using BH_verified bit to indicate whether the bitmap is valid or not.
--- fs/udf/balloc.c | 15 +++++++++++++-- fs/udf/super.c | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-)
fs/udf/balloc.c +13 -2
@@ -64,8 +64,12 @@ static int read_block_bitmap(struct supe }for (i =0 ; i < count; i++) -if (udf_test_bit (i + off, bh->b_data)) +if (udf_test_bit (i + off, bh->b_data)) { + bitmap->s_block_bitmap[bitmap_nr] = +ERR_PTR (-EFSCORRUPTED ); +brelse (bh);return -EFSCORRUPTED ; + }return 0 ; }
@@ -81,8 +85,15 @@ static int __load_block_bitmap(struct su block_group, nr_groups); } -if (bitmap->s_block_bitmap[block_group]) +if (bitmap->s_block_bitmap[block_group]) { +/* +* The bitmap failed verification in the past. No point in +* trying again. +*/ +if (IS_ERR (bitmap->s_block_bitmap[block_group])) +return PTR_ERR (bitmap->s_block_bitmap[block_group]);return block_group; + } retval =read_block_bitmap (sb, bitmap, block_group, block_group);if (retval <0 )
fs/udf/super.c +2 -1
@@ -269,7 +269,8 @@ static void udf_sb_free_bitmap(struct udint nr_groups = bitmap->s_nr_groups;for (i =0 ; i < nr_groups; i++) -brelse (bitmap->s_block_bitmap[i]); +if (!IS_ERR_OR_NULL (bitmap->s_block_bitmap[i])) +brelse (bitmap->s_block_bitmap[i]);kvfree (bitmap); }
Greg Kroah-Hartman
maintainerPATCH 396/568 m68k: amiga: Turn off Warp1260 interrupts during boot
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Pisati <[email protected]>
commit 1d8491d3e726984343dd8c3cdbe2f2b47cfdd928 upstream.
On an Amiga 1200 equipped with a Warp1260 accelerator, an interrupt storm coming from the accelerator board causes the machine to crash in local_irq_enable() or auto_irq_enable(). Disabling interrupts for the Warp1260 in amiga_parse_bootinfo() fixes the problem.
--- arch/m68k/amiga/config.c | 9 +++++++++ include/uapi/linux/zorro_ids.h | 3 +++ 2 files changed, 12 insertions(+)
arch/m68k/amiga/config.c +9 -0
@@ -180,6 +180,15 @@ int __init amiga_parse_bootinfo(const st dev->slotsize =be16_to_cpu (cd->cd_SlotSize); dev->boardaddr =be32_to_cpu (cd->cd_BoardAddr); dev->boardsize =be32_to_cpu (cd->cd_BoardSize); + +/* CS-LAB Warp 1260 workaround */ +if (be16_to_cpu (dev->rom.er_Manufacturer) ==ZORRO_MANUF (ZORRO_PROD_CSLAB_WARP_1260 ) && + dev->rom.er_Product ==ZORRO_PROD (ZORRO_PROD_CSLAB_WARP_1260 )) { + +/* turn off all interrupts */ +pr_info ("Warp 1260 card detected: applying interrupt storm workaround\n" ); + *(uint32_t *)(dev->boardaddr +0x1000 ) =0xfff ; + } }else pr_warn ("amiga_parse_bootinfo: too many AutoConfig devices\n" );#endif /* CONFIG_ZORRO */
include/uapi/linux/zorro_ids.h +3 -0
@@ -449,6 +449,9 @@#define ZORRO_PROD_VMC_ISDN_BLASTER_Z2 ZORRO_ID(VMC, 0x01, 0)#define ZORRO_PROD_VMC_HYPERCOM_4 ZORRO_ID(VMC, 0x02, 0) +#define ZORRO_MANUF_CSLAB 0x1400 +#define ZORRO_PROD_CSLAB_WARP_1260 ZORRO_ID(CSLAB, 0x65, 0) +#define ZORRO_MANUF_INFORMATION 0x157C#define ZORRO_PROD_INFORMATION_ISDN_ENGINE_I ZORRO_ID(INFORMATION, 0x64, 0)
Greg Kroah-Hartman
maintainerPATCH 397/568 ext4: check dot and dotdot of dx_root before making dir indexed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit 50ea741def587a64e08879ce6c6a30131f7111e7 upstream.
Syzbot reports a issue as follows:
============================================
BUG: unable to handle page fault for address: ffffed11022e24fe PGD 23ffee067 P4D 23ffee067 PUD 0 Oops: Oops: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 0 PID: 5079 Comm: syz-executor306 Not tainted 6.10.0-rc5-g55027e689933 #0 Call Trace: <TASK> make_indexed_dir+0xdaf/0x13c0 fs/ext4/namei.c:2341 ext4_add_entry+0x222a/0x25d0 fs/ext4/namei.c:2451 ext4_rename fs/ext4/namei.c:3936 [inline] ext4_rename2+0x26e5/0x4370 fs/ext4/namei.c:4214
[...]
============================================
The immediate cause of this problem is that there is only one valid dentry for the block to be split during do_split, so split==0 results in out of bounds accesses to the map triggering the issue.
do_split
unsigned split
dx_make_map
count = 1
split = count/2 = 0;
continued = hash2 == map[split - 1].hash;
---> map[4294967295]The maximum length of a filename is 255 and the minimum block size is 1024, so it is always guaranteed that the number of entries is greater than or equal to 2 when do_split() is called.
But syzbot's crafted image has no dot and dotdot in dir, and the dentry distribution in dirblock is as follows:
bus dentry1 hole dentry2 free
|xx--|xx-------------|...............|xx-------------|...............| 0 12 (8+248)=256 268 256 524 (8+256)=264 788 236 1024
So when renaming dentry1 increases its name_len length by 1, neither hole nor free is sufficient to hold the new dentry, and make_indexed_dir() is called.
In make_indexed_dir() it is assumed that the first two entries of the dirblock must be dot and dotdot, so bus and dentry1 are left in dx_root because they are treated as dot and dotdot, and only dentry2 is moved to the new leaf block. That's why count is equal to 1.
Therefore add the ext4_check_dx_root() helper function to add more sanity checks to dot and dotdot before starting the conversion to avoid the above issue.
--- fs/ext4/namei.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-)
fs/ext4/namei.c +51 -5
@@ -2218,6 +2218,52 @@ static int add_dirent_to_buf(handle_t *hreturn err ? err : err2; } +static bool ext4_check_dx_root (struct inode *dir,struct dx_root *root) +{ +struct fake_dirent *fde; +const char *error_msg; +unsigned int rlen; +unsigned int blocksize = dir->i_sb->s_blocksize; +char *blockend = (char *)root + dir->i_sb->s_blocksize; + + fde = &root->dot; +if (unlikely (fde->name_len !=1 )) { + error_msg ="invalid name_len for '.'" ; + goto corrupted; + } +if (unlikely (strncmp (root->dot_name,"." , fde->name_len))) { + error_msg ="invalid name for '.'" ; + goto corrupted; + } + rlen =ext4_rec_len_from_disk (fde->rec_len, blocksize); +if (unlikely ((char *)fde + rlen >= blockend)) { + error_msg ="invalid rec_len for '.'" ; + goto corrupted; + } + + fde = &root->dotdot; +if (unlikely (fde->name_len !=2 )) { + error_msg ="invalid name_len for '..'" ; + goto corrupted; + } +if (unlikely (strncmp (root->dotdot_name,".." , fde->name_len))) { + error_msg ="invalid name for '..'" ; + goto corrupted; + } + rlen =ext4_rec_len_from_disk (fde->rec_len, blocksize); +if (unlikely ((char *)fde + rlen >= blockend)) { + error_msg ="invalid rec_len for '..'" ; + goto corrupted; + } + +return true; + +corrupted: +EXT4_ERROR_INODE (dir,"Corrupt dir, %s, running e2fsck is recommended" , + error_msg); +return false; +} +/* * This converts a one block unindexed directory to a 3 block indexed * directory, and adds the dentry to the indexed directory.
@@ -2252,17 +2298,17 @@ static int make_indexed_dir(handle_t *habrelse (bh);return retval; } + root = (struct dx_root *) bh->b_data; +if (!ext4_check_dx_root (dir, root)) { +brelse (bh); +return -EFSCORRUPTED ; + }/* The 0th block becomes the root, move the dirents out */ fde = &root->dotdot; de = (struct ext4_dir_entry_2 *)((char *)fde +ext4_rec_len_from_disk (fde->rec_len, blocksize)); -if ((char *) de >= (((char *) root) + blocksize)) { -EXT4_ERROR_INODE (dir,"invalid rec_len for '..'" ); -brelse (bh); -return -EFSCORRUPTED ; - } len = ((char *) root) + (blocksize - csum_size) - (char *) de;/* Allocate new block for the 0th block's dirents */
Greg Kroah-Hartman
maintainerPATCH 398/568 ext4: make sure the first directory block is not a hole
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit f9ca51596bbfd0f9c386dd1c613c394c78d9e5e6 upstream.
The syzbot constructs a directory that has no dirblock but is non-inline, i.e. the first directory block is a hole. And no errors are reported when creating files in this directory in the following flow.
ext4_mknod
...
ext4_add_entry
// Read block 0
ext4_read_dirblock(dir, block, DIRENT)
bh = ext4_bread(NULL, inode, block, 0)
if (!bh && (type == INDEX || type == DIRENT_HTREE))
// The first directory block is a hole
// But type == DIRENT, so no error is reported.After that, we get a directory block without '.' and '..' but with a valid dentry. This may cause some code that relies on dot or dotdot (such as make_indexed_dir()) to crash.
Therefore when ext4_read_dirblock() finds that the first directory block is a hole report that the filesystem is corrupted and return an error to avoid loading corrupted data from disk causing something bad.
--- fs/ext4/namei.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
fs/ext4/namei.c +6 -11
@@ -151,10 +151,11 @@ static struct buffer_head *__ext4_read_dreturn bh; } -if (!bh && (type ==INDEX || type ==DIRENT_HTREE )) { +/* The first directory block must not be a hole. */ +if (!bh && (type ==INDEX || type ==DIRENT_HTREE || block ==0 )) {ext4_error_inode (inode, func, line, block, -"Directory hole found for htree %s block" , - (type ==INDEX ) ?"index" :"leaf" ); +"Directory hole found for htree %s block %u" , + (type ==INDEX ) ?"index" :"leaf" , block);return ERR_PTR (-EFSCORRUPTED ); }if (!bh)
@@ -3133,10 +3134,7 @@ bool ext4_empty_dir(struct inode *inode)EXT4_ERROR_INODE (inode,"invalid size" );return false; } -/* The first directory block must not be a hole, -* so treat it as DIRENT_HTREE -*/ - bh =ext4_read_dirblock (inode,0 ,DIRENT_HTREE ); + bh =ext4_read_dirblock (inode,0 ,EITHER );if (IS_ERR (bh))return false;
@@ -3581,10 +3579,7 @@ static struct buffer_head *ext4_get_firsstruct ext4_dir_entry_2 *de;unsigned int offset; -/* The first directory block must not be a hole, so -* treat it as DIRENT_HTREE -*/ - bh =ext4_read_dirblock (inode,0 ,DIRENT_HTREE ); + bh =ext4_read_dirblock (inode,0 ,EITHER );if (IS_ERR (bh)) { *retval =PTR_ERR (bh);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 399/568 io_uring: tighten task exit cancellations
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit f8b632e89a101dae349a7b212c1771d7925f441b upstream.
io_uring_cancel_generic() should retry if any state changes like a request is completed, however in case of a task exit it only goes for another loop and avoids schedule() if any tracked (i.e. REQ_F_INFLIGHT) request got completed.
Let's assume we have a non-tracked request executing in iowq and a tracked request linked to it. Let's also assume io_uring_cancel_generic() fails to find and cancel the request, i.e. via io_run_local_work(), which may happen as io-wq has gaps. Next, the request logically completes, io-wq still hold a ref but queues it for completion via tw, which happens in io_uring_try_cancel_requests(). After, right before prepare_to_wait() io-wq puts the request, grabs the linked one and tries executes it, e.g. arms polling. Finally the cancellation loop calls prepare_to_wait(), there are no tw to run, no tracked request was completed, so the tctx_inflight() check passes and the task is put to indefinite sleep.
--- io_uring/io_uring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
io_uring/io_uring.c +4 -1
@@ -3350,8 +3350,11 @@ __cold void io_uring_cancel_generic(boolbool loop = false;io_uring_drop_tctx_refs (current); +if (!tctx_inflight (tctx, !cancel_all)) +break ; +/* read completions before cancelations */ - inflight =tctx_inflight (tctx, !cancel_all); + inflight =tctx_inflight (tctx, false);if (!inflight)break ;
Greg Kroah-Hartman
maintainerPATCH 400/568 trace/pid_list: Change gfp flags in pid_list_fill_irq()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: levi.yun <[email protected]>
commit 7dc836187f7c6f70a82b4521503e9f9f96194581 upstream.
pid_list_fill_irq() runs via irq_work.
When CONFIG_PREEMPT_RT is disabled, it would run in irq_context. so it shouldn't sleep while memory allocation.
Change gfp flags from GFP_KERNEL to GFP_NOWAIT to prevent sleep in irq_work.
This change wouldn't impact functionality in practice because the worst-size is 2K.
--- kernel/trace/pid_list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/pid_list.c +2 -2
@@ -354,7 +354,7 @@ static void pid_list_refill_irq(struct iwhile (upper_count-- >0 ) {union upper_chunk *chunk; - chunk =kzalloc (sizeof (*chunk),GFP_KERNEL ); + chunk =kzalloc (sizeof (*chunk),GFP_NOWAIT );if (!chunk)break ; *upper_next = chunk;
@@ -365,7 +365,7 @@ static void pid_list_refill_irq(struct iwhile (lower_count-- >0 ) {union lower_chunk *chunk; - chunk =kzalloc (sizeof (*chunk),GFP_KERNEL ); + chunk =kzalloc (sizeof (*chunk),GFP_NOWAIT );if (!chunk)break ; *lower_next = chunk;
Greg Kroah-Hartman
maintainerPATCH 401/568 selftests/landlock: Add cred_transfer test
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
commit cc374782b6ca0fd634482391da977542443d3368 upstream.
Check that keyctl(KEYCTL_SESSION_TO_PARENT) preserves the parent's restrictions.
--- tools/testing/selftests/landlock/base_test.c | 74 +++++++++++++++++++++++++++ tools/testing/selftests/landlock/config | 1 2 files changed, 75 insertions(+)
tools/testing/selftests/landlock/base_test.c +74 -0
@@ -9,6 +9,7 @@#define _GNU_SOURCE#include <errno.h> #include <fcntl.h> +#include <linux/keyctl.h> #include <linux/landlock.h> #include <string.h> #include <sys/prctl.h>
@@ -326,4 +327,77 @@ TEST(ruleset_fd_transfer)ASSERT_EQ (EXIT_SUCCESS ,WEXITSTATUS (status)); } +TEST (cred_transfer) +{ +struct landlock_ruleset_attr ruleset_attr = { + .handled_access_fs =LANDLOCK_ACCESS_FS_READ_DIR , + }; +int ruleset_fd, dir_fd; +pid_t child; +int status; + +drop_caps (_metadata); + + dir_fd =open ("/" ,O_RDONLY |O_DIRECTORY |O_CLOEXEC ); +EXPECT_LE (0 , dir_fd); +EXPECT_EQ (0 ,close (dir_fd)); + +/* Denies opening directories. */ + ruleset_fd = +landlock_create_ruleset (&ruleset_attr,sizeof (ruleset_attr),0 ); +ASSERT_LE (0 , ruleset_fd); +EXPECT_EQ (0 ,prctl (PR_SET_NO_NEW_PRIVS ,1 ,0 ,0 ,0 )); +ASSERT_EQ (0 ,landlock_restrict_self (ruleset_fd,0 )); +EXPECT_EQ (0 ,close (ruleset_fd)); + +/* Checks ruleset enforcement. */ +EXPECT_EQ (-1 ,open ("/" ,O_RDONLY |O_DIRECTORY |O_CLOEXEC )); +EXPECT_EQ (EACCES , errno); + +/* Needed for KEYCTL_SESSION_TO_PARENT permission checks */ +EXPECT_NE (-1 ,syscall (__NR_keyctl,KEYCTL_JOIN_SESSION_KEYRING ,NULL ,0 , + 0, 0)) + { +TH_LOG ("Failed to join session keyring: %s" ,strerror (errno)); + } + + child =fork (); +ASSERT_LE (0 , child); +if (child ==0 ) { +/* Checks ruleset enforcement. */ +EXPECT_EQ (-1 ,open ("/" ,O_RDONLY |O_DIRECTORY |O_CLOEXEC )); +EXPECT_EQ (EACCES , errno); + +/* +* KEYCTL_SESSION_TO_PARENT is a no-op unless we have a +* different session keyring in the child, so make that happen. +*/ +EXPECT_NE (-1 ,syscall (__NR_keyctl,KEYCTL_JOIN_SESSION_KEYRING , +NULL ,0 ,0 ,0 )); + +/* +* KEYCTL_SESSION_TO_PARENT installs credentials on the parent +* that never go through the cred_prepare hook, this path uses +* cred_transfer instead. +*/ +EXPECT_EQ (0 ,syscall (__NR_keyctl,KEYCTL_SESSION_TO_PARENT ,0 , +0 ,0 ,0 )); + +/* Re-checks ruleset enforcement. */ +EXPECT_EQ (-1 ,open ("/" ,O_RDONLY |O_DIRECTORY |O_CLOEXEC )); +EXPECT_EQ (EACCES , errno); + +_exit (_metadata->passed ?EXIT_SUCCESS :EXIT_FAILURE ); +return ; + } + +EXPECT_EQ (child,waitpid (child, &status,0 )); +EXPECT_EQ (1 ,WIFEXITED (status)); +EXPECT_EQ (EXIT_SUCCESS ,WEXITSTATUS (status)); + +/* Re-checks ruleset enforcement. */ +EXPECT_EQ (-1 ,open ("/" ,O_RDONLY |O_DIRECTORY |O_CLOEXEC )); +EXPECT_EQ (EACCES , errno); +} +TEST_HARNESS_MAIN
tools/testing/selftests/landlock/config +1 -0
@@ -1,5 +1,6 @@ CONFIG_CGROUPS=y CONFIG_CGROUP_SCHED=y +CONFIG_KEYS=y CONFIG_OVERLAY_FS=y CONFIG_PROC_FS=y CONFIG_SECURITY=y
Greg Kroah-Hartman
maintainerPATCH 402/568 wifi: mwifiex: Fix interface type change
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael Beims <[email protected]>
commit a17b9f590f6ec2b9f1b12b1db3bf1d181de6b272 upstream.
When changing the interface type we also need to update the bss_num, the driver private data is searched based on a unique (bss_type, bss_num) tuple, therefore every time bss_type changes, bss_num must also change.
This fixes for example an issue in which, after the mode changed, a wireless scan on the changed interface would not finish, leading to repeated -EBUSY messages to userspace when other scan requests were sent.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
@@ -926,6 +926,8 @@ mwifiex_init_new_priv_params(struct mwifreturn -EOPNOTSUPP ; } + priv->bss_num =mwifiex_get_unused_bss_num (adapter, priv->bss_type); +spin_lock_irqsave (&adapter->main_proc_lock, flags); adapter->main_locked = false;spin_unlock_irqrestore (&adapter->main_proc_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 403/568 wifi: rtw88: usb: Fix disconnection after beacon loss
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
commit 28818b4d871bc93cc4f5c7c7d7c526a6a096c09c upstream.
When there is beacon loss, for example due to unrelated Bluetooth devices transmitting music nearby, the wifi connection dies soon after the first beacon loss message:
Apr 28 20:47:14 ideapad2 wpa_supplicant[1161]: wlp3s0f3u4: CTRL-EVENT-BEACON-LOSS Apr 28 20:47:15 ideapad2 wpa_supplicant[1161]: wlp3s0f3u4: CTRL-EVENT-DISCONNECTED bssid=... reason=4 locally_generated=1
Apr 28 20:47:24 ideapad2 wpa_supplicant[1161]: wlp3s0f3u4: CTRL-EVENT-BEACON-LOSS Apr 28 20:47:25 ideapad2 wpa_supplicant[1161]: wlp3s0f3u4: CTRL-EVENT-DISCONNECTED bssid=... reason=4 locally_generated=1
Apr 28 20:47:34 ideapad2 wpa_supplicant[1161]: wlp3s0f3u4: CTRL-EVENT-BEACON-LOSS Apr 28 20:47:35 ideapad2 wpa_supplicant[1161]: wlp3s0f3u4: CTRL-EVENT-DISCONNECTED bssid=... reason=4 locally_generated=1
When the beacon loss happens, mac80211 makes rtw88 transmit a QOS NULL frame and asks to confirm the ACK status. Even though rtw88 confirms to mac80211 that the QOS NULL was transmitted successfully, the connection still dies. This is because rtw88 is handing the QOS NULL back to mac80211 with skb->data pointing to the headroom (the TX descriptor) instead of ieee80211_hdr.
Fix the disconnection by moving skb->data to the correct position before ieee80211_tx_status_irqsafe().
The problem was observed with RTL8811AU (TP-Link Archer T2U Nano) and the potential future rtw88_8821au driver. Also tested with RTL8811CU (Tenda U9).
--- drivers/net/wireless/realtek/rtw88/usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/usb.c +2 -0
@@ -273,6 +273,8 @@ static void rtw_usb_write_port_tx_comple info =IEEE80211_SKB_CB (skb); tx_data =rtw_usb_get_tx_data (skb); +skb_pull (skb, rtwdev->chip->tx_pkt_desc_sz); +/* enqueue to wait for tx report */ if (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS ) {rtw_tx_report_enqueue (rtwdev, skb, tx_data->sn);
Greg Kroah-Hartman
maintainerPATCH 404/568 drivers: soc: xilinx: check return status of get_api_version()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Buddhabhatti <[email protected]>
commit 9b003e14801cf85a8cebeddc87bc9fc77100fdce upstream.
Currently return status is not getting checked for get_api_version and because of that for x86 arch we are getting below smatch error.
CC drivers/soc/xilinx/zynqmp_power.odrivers/soc/xilinx/zynqmp_power.c: In function 'zynqmp_pm_probe':drivers/soc/xilinx/zynqmp_power.c:295:12: warning: 'pm_api_version' is used uninitialized [-Wuninitialized]
295 | if (pm_api_version < ZYNQMP_PM_VERSION)
| ^
CHECK drivers/soc/xilinx/zynqmp_power.cdrivers/soc/xilinx/zynqmp_power.c:295 zynqmp_pm_probe() error:
uninitialized symbol 'pm_api_version'.
So, check return status of pm_get_api_version and return error in case of failure to avoid checking uninitialized pm_api_version variable.
--- drivers/soc/xilinx/zynqmp_power.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/soc/xilinx/zynqmp_power.c +3 -1
@@ -188,7 +188,9 @@ static int zynqmp_pm_probe(struct platfou32 pm_api_version;struct mbox_client *client; -zynqmp_pm_get_api_version (&pm_api_version); + ret =zynqmp_pm_get_api_version (&pm_api_version); +if (ret) +return ret;/* Check PM API version number */ if (pm_api_version <ZYNQMP_PM_VERSION )
Greg Kroah-Hartman
maintainerPATCH 405/568 leds: ss4200: Convert PCIBIOS_* return codes to errnos
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
commit ce068e83976140badb19c7f1307926b4b562fac4 upstream.
ich7_lpc_probe() uses pci_read_config_dword() that returns PCIBIOS_* codes. The error handling code assumes incorrectly it's a normal errno and checks for < 0. The return code is returned from the probe function as is but probe functions should return normal errnos.
Remove < 0 from the check and convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal errno before returning it.
--- drivers/leds/leds-ss4200.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/leds/leds-ss4200.c +5 -2
@@ -356,8 +356,10 @@ static int ich7_lpc_probe(struct pci_dev nas_gpio_pci_dev = dev; status =pci_read_config_dword (dev,PMBASE , &g_pm_io_base); -if (status) +if (status) { + status =pcibios_err_to_errno (status); goto out; + } g_pm_io_base &=0x00000ff80 ; status =pci_read_config_dword (dev,GPIO_CTRL , &gc);
@@ -369,8 +371,9 @@ static int ich7_lpc_probe(struct pci_dev } status =pci_read_config_dword (dev,GPIO_BASE , &nas_gpio_io_base); -if (0 > status) { +if (status) {dev_info (&dev->dev,"Unable to read GPIOBASE.\n" ); + status =pcibios_err_to_errno (status); goto out; }dev_dbg (&dev->dev,": GPIOBASE = 0x%08x\n" , nas_gpio_io_base);
Greg Kroah-Hartman
maintainerPATCH 406/568 md/md-bitmap: fix writing non bitmap pages
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ofir Gal <[email protected]>
commit ab99a87542f194f28e2364a42afbf9fb48b1c724 upstream.
__write_sb_page() rounds up the io size to the optimal io size if it doesn't exceed the data offset, but it doesn't check the final size exceeds the bitmap length.
For example:
page count - 1 page size - 4K data offset - 1M
optimal io size - 256K
The final io size would be 256K (64 pages) but md_bitmap_storage_alloc() allocated 1 page, the IO would write 1 valid page and 63 pages that happens to be allocated afterwards. This leaks memory to the raid device superblock.
This issue caused a data transfer failure in nvme-tcp. The network drivers checks the first page of an IO with sendpage_ok(), it returns true if the page isn't a slabpage and refcount >= 1. If the page !sendpage_ok() the network driver disables MSG_SPLICE_PAGES.
As of now the network layer assumes all the pages of the IO are sendpage_ok() when MSG_SPLICE_PAGES is on.
The bitmap pages aren't slab pages, the first page of the IO is sendpage_ok(), but the additional pages that happens to be allocated after the bitmap pages might be !sendpage_ok(). That cause skb_splice_from_iter() to stop the data transfer, in the case below it hangs 'mdadm --create'.
The bug is reproducible, in order to reproduce we need nvme-over-tcp controllers with optimal IO size bigger than PAGE_SIZE. Creating a raid with bitmap over those devices reproduces the bug.
In order to simulate large optimal IO size you can use dm-stripe with a single device.
Script to reproduce the issue on top of brd devices using dm-stripe is attached below (will be added to blktest).
I have added some logs to test the theory:
...
md: created bitmap (1 pages) for device md127__write_sb_page before md_super_write offset: 16, size: 262144. pfn: 0x53ee === __write_sb_page before md_super_write. logging pages ===
pfn: 0x53ee, slab: 0 <-- the only page that allocated for the bitmap
pfn: 0x53ef, slab: 1
pfn: 0x53f0, slab: 0
pfn: 0x53f1, slab: 0
pfn: 0x53f2, slab: 0
pfn: 0x53f3, slab: 1
...nvme_tcp: sendpage_ok - pfn: 0x53ee, len: 262144, offset: 0
skbuff: before sendpage_ok() - pfn: 0x53ee
skbuff: before sendpage_ok() - pfn: 0x53ef
WARNING at net/core/skbuff.c:6848 skb_splice_from_iter+0x142/0x450
skbuff: !sendpage_ok - pfn: 0x53ef. is_slab: 1, page_count: 1
...
--- drivers/md/md-bitmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/md-bitmap.c +3 -3
@@ -227,6 +227,8 @@ static int __write_sb_page(struct md_rdestruct block_device *bdev;struct mddev *mddev = bitmap->mddev;struct bitmap_storage *store = &bitmap->storage; +unsigned int bitmap_limit = (bitmap->storage.file_pages - pg_index) << +PAGE_SHIFT ;loff_t sboff, offset = mddev->bitmap_info.offset;sector_t ps = pg_index *PAGE_SIZE /SECTOR_SIZE ;unsigned int size =PAGE_SIZE ;
@@ -269,11 +271,9 @@ static int __write_sb_page(struct md_rdeif (size ==0 )/* bitmap runs in to data */ return -EINVAL ; - }else { -/* DATA METADATA BITMAP - no problems */ } -md_super_write (mddev, rdev, sboff + ps, (int ) size, page); +md_super_write (mddev, rdev, sboff + ps, (int )min (size, bitmap_limit), page);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 407/568 leds: mt6360: Fix memory leak in mt6360_init_isnk_properties()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit e41d574b359ccd8d99be65c6f11502efa2b83136 upstream.
The fwnode_for_each_child_node() loop requires manual intervention to decrement the child refcount in case of an early return.
Add the missing calls to fwnode_handle_put(child) to avoid memory leaks in the error paths.
--- drivers/leds/flash/leds-mt6360.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/leds/flash/leds-mt6360.c +4 -1
@@ -633,14 +633,17 @@ static int mt6360_init_isnk_properties(s ret =fwnode_property_read_u32 (child,"reg" , ®);if (ret || reg >MT6360_LED_ISNK3 || - priv->leds_active &BIT (reg)) + priv->leds_active &BIT (reg)) { +fwnode_handle_put (child);return -EINVAL ; + } ret =fwnode_property_read_u32 (child,"color" , &color);if (ret) {dev_err (priv->dev,"led %d, no color specified\n" , led->led_no); +fwnode_handle_put (child);return ret; }
Greg Kroah-Hartman
maintainerPATCH 408/568 media: ivsc: csi: add separate lock for v4l2 control handler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentong Wu <[email protected]>
commit c6be6471004e0e4d10d0514146d8c41550823d63 upstream.
There're possibilities that privacy status change notification happens in the middle of the ongoing mei command which already takes the command lock, but v4l2_ctrl_s_ctrl() would also need the same lock prior to this patch, so this may results in circular locking problem. This patch adds one dedicated lock for v4l2 control handler to avoid described issue.
--- drivers/media/pci/intel/ivsc/mei_csi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ivsc/mei_csi.c +7 -1
@@ -124,6 +124,8 @@ struct mei_csi {struct v4l2_ctrl_handler ctrl_handler;struct v4l2_ctrl *freq_ctrl;struct v4l2_ctrl *privacy_ctrl; +/* lock for v4l2 controls */ +struct mutex ctrl_lock;unsigned int remote_pad;/* start streaming or not */ int streaming;
@@ -609,11 +611,13 @@ static int mei_csi_init_controls(structu32 max;int ret; +mutex_init (&csi->ctrl_lock); + ret =v4l2_ctrl_handler_init (&csi->ctrl_handler,2 );if (ret)return ret; - csi->ctrl_handler.lock = &csi->lock; + csi->ctrl_handler.lock = &csi->ctrl_lock; max =ARRAY_SIZE (link_freq_menu_items) -1 ; csi->freq_ctrl = v4l2_ctrl_new_int_menu(&csi->ctrl_handler,
@@ -772,6 +776,7 @@ err_entity: err_ctrl_handler:v4l2_ctrl_handler_free (&csi->ctrl_handler); +mutex_destroy (&csi->ctrl_lock);v4l2_async_nf_unregister (&csi->notifier);v4l2_async_nf_cleanup (&csi->notifier);
@@ -791,6 +796,7 @@ static void mei_csi_remove(struct mei_clv4l2_async_nf_unregister (&csi->notifier);v4l2_async_nf_cleanup (&csi->notifier);v4l2_ctrl_handler_free (&csi->ctrl_handler); +mutex_destroy (&csi->ctrl_lock);v4l2_async_unregister_subdev (&csi->subdev);v4l2_subdev_cleanup (&csi->subdev);media_entity_cleanup (&csi->subdev.entity);
Greg Kroah-Hartman
maintainerPATCH 409/568 media: imx-pxp: Fix ERR_PTR dereference in pxp_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshit Mogalapalli <[email protected]>
commit 57e9ce68ae98551da9c161aaab12b41fe8601856 upstream.
devm_regmap_init_mmio() can fail, add a check and bail out in case of error.
--- drivers/media/platform/nxp/imx-pxp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/nxp/imx-pxp.c +3 -0
@@ -1805,6 +1805,9 @@ static int pxp_probe(struct platform_devreturn PTR_ERR (mmio); dev->regmap =devm_regmap_init_mmio (&pdev->dev, mmio, &pxp_regmap_config); +if (IS_ERR (dev->regmap)) +return dev_err_probe (&pdev->dev,PTR_ERR (dev->regmap), +"Failed to init regmap\n" ); irq =platform_get_irq (pdev,0 );if (irq <0 )
Greg Kroah-Hartman
maintainerPATCH 410/568 jbd2: make jbd2_journal_get_max_txn_bufs() internal
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 4aa99c71e42ad60178c1154ec24e3df9c684fb67 upstream.
There's no reason to have jbd2_journal_get_max_txn_bufs() public function. Currently all users are internal and can use journal->j_max_transaction_buffers instead. This saves some unnecessary recomputations of the limit as a bonus which becomes important as this function gets more complex in the following patch.
--- fs/jbd2/commit.c | 2 +- fs/jbd2/journal.c | 5 +++++ include/linux/jbd2.h | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-)
fs/jbd2/commit.c +1 -1
@@ -767,7 +767,7 @@ start_journal_io:if (first_block < journal->j_tail) freed += journal->j_last - journal->j_first;/* Update tail only if we free significant amount of space */ -if (freed <jbd2_journal_get_max_txn_bufs (journal)) +if (freed < journal->j_max_transaction_buffers) update_tail =0 ; }J_ASSERT (commit_transaction->t_state ==T_COMMIT );
fs/jbd2/journal.c +5 -0
@@ -1690,6 +1690,11 @@ journal_t *jbd2_journal_init_inode(strucreturn journal; } +static int jbd2_journal_get_max_txn_bufs (journal_t *journal) +{ +return (journal->j_total_len - journal->j_fc_wbufsize) /4 ; +} +/* * Given a journal_t structure, initialise the various fields for * startup of a new journaling session. We use this both when creating
include/linux/jbd2.h +0 -5
@@ -1666,11 +1666,6 @@ int jbd2_wait_inode_data(journal_t *jourint jbd2_fc_wait_bufs (journal_t *journal,int num_blks);int jbd2_fc_release_bufs (journal_t *journal); -static inline int jbd2_journal_get_max_txn_bufs (journal_t *journal) -{ -return (journal->j_total_len - journal->j_fc_wbufsize) /4 ; -} -/* * is_journal_abort *
Greg Kroah-Hartman
maintainerPATCH 411/568 jbd2: precompute number of transaction descriptor blocks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit e3a00a23781c1f2fcda98a7aecaac515558e7a35 upstream.
Instead of computing the number of descriptor blocks a transaction can have each time we need it (which is currently when starting each transaction but will become more frequent later) precompute the number once during journal initialization together with maximum transaction size. We perform the precomputation whenever journal feature set is updated similarly as for computation of journal->j_revoke_records_per_block.
--- fs/jbd2/journal.c | 61 +++++++++++++++++++++++++++++++++++++------------- fs/jbd2/transaction.c | 24 ------------------- include/linux/jbd2.h | 7 +++++ 3 files changed, 54 insertions(+), 38 deletions(-)
fs/jbd2/journal.c +46 -15
@@ -1451,6 +1451,48 @@ static int journal_revoke_records_per_blreturn space / record_size; } +static int jbd2_journal_get_max_txn_bufs (journal_t *journal) +{ +return (journal->j_total_len - journal->j_fc_wbufsize) /4 ; +} + +/* +* Base amount of descriptor blocks we reserve for each transaction. +*/ +static int jbd2_descriptor_blocks_per_trans (journal_t *journal) +{ +int tag_space = journal->j_blocksize -sizeof (journal_header_t); +int tags_per_block; + +/* Subtract UUID */ + tag_space -=16 ; +if (jbd2_journal_has_csum_v2or3 (journal)) + tag_space -=sizeof (struct jbd2_journal_block_tail ); +/* Commit code leaves a slack space of 16 bytes at the end of block */ + tags_per_block = (tag_space -16 ) /journal_tag_bytes (journal); +/* +* Revoke descriptors are accounted separately so we need to reserve +* space for commit block and normal transaction descriptor blocks. +*/ +return 1 +DIV_ROUND_UP (jbd2_journal_get_max_txn_bufs (journal), + tags_per_block); +} + +/* +* Initialize number of blocks each transaction reserves for its bookkeeping +* and maximum number of blocks a transaction can use. This needs to be called +* after the journal size and the fastcommit area size are initialized. +*/ +static void jbd2_journal_init_transaction_limits (journal_t *journal) +{ + journal->j_revoke_records_per_block = +journal_revoke_records_per_block (journal); + journal->j_transaction_overhead_buffers = +jbd2_descriptor_blocks_per_trans (journal); + journal->j_max_transaction_buffers = +jbd2_journal_get_max_txn_bufs (journal); +} +/* * Load the on-disk journal superblock and read the key fields into the * journal_t.
@@ -1492,8 +1534,8 @@ static int journal_load_superblock(journif (jbd2_journal_has_csum_v2or3 (journal)) journal->j_csum_seed =jbd2_chksum (journal, ~0 , sb->s_uuid,sizeof (sb->s_uuid)); - journal->j_revoke_records_per_block = -journal_revoke_records_per_block (journal); +/* After journal features are set, we can compute transaction limits */ +jbd2_journal_init_transaction_limits (journal);if (jbd2_has_feature_fast_commit (journal)) { journal->j_fc_last =be32_to_cpu (sb->s_maxlen);
@@ -1690,11 +1732,6 @@ journal_t *jbd2_journal_init_inode(strucreturn journal; } -static int jbd2_journal_get_max_txn_bufs (journal_t *journal) -{ -return (journal->j_total_len - journal->j_fc_wbufsize) /4 ; -} -/* * Given a journal_t structure, initialise the various fields for * startup of a new journaling session. We use this both when creating
@@ -1740,8 +1777,6 @@ static int journal_reset(journal_t *jour journal->j_commit_sequence = journal->j_transaction_sequence -1 ; journal->j_commit_request = journal->j_commit_sequence; - journal->j_max_transaction_buffers =jbd2_journal_get_max_txn_bufs (journal); -/* * Now that journal recovery is done, turn fast commits off here. This * way, if fast commit was enabled before the crash but if now FS has
@@ -2282,8 +2317,6 @@ jbd2_journal_initialize_fast_commit(jour journal->j_fc_first = journal->j_last +1 ; journal->j_fc_off =0 ; journal->j_free = journal->j_last - journal->j_first; - journal->j_max_transaction_buffers = -jbd2_journal_get_max_txn_bufs (journal);return 0 ; }
@@ -2371,8 +2404,7 @@ int jbd2_journal_set_features(journal_t sb->s_feature_ro_compat |=cpu_to_be32 (ro); sb->s_feature_incompat |=cpu_to_be32 (incompat);unlock_buffer (journal->j_sb_buffer); - journal->j_revoke_records_per_block = -journal_revoke_records_per_block (journal); +jbd2_journal_init_transaction_limits (journal);return 1 ;#undef COMPAT_FEATURE_ON
@@ -2403,8 +2435,7 @@ void jbd2_journal_clear_features(journal sb->s_feature_compat &= ~cpu_to_be32 (compat); sb->s_feature_ro_compat &= ~cpu_to_be32 (ro); sb->s_feature_incompat &= ~cpu_to_be32 (incompat); - journal->j_revoke_records_per_block = -journal_revoke_records_per_block (journal); +jbd2_journal_init_transaction_limits (journal); }EXPORT_SYMBOL (jbd2_journal_clear_features);
fs/jbd2/transaction.c +1 -23
@@ -63,28 +63,6 @@ void jbd2_journal_free_transaction(trans }/* -* Base amount of descriptor blocks we reserve for each transaction. -*/ -static int jbd2_descriptor_blocks_per_trans (journal_t *journal) -{ -int tag_space = journal->j_blocksize -sizeof (journal_header_t); -int tags_per_block; - -/* Subtract UUID */ - tag_space -=16 ; -if (jbd2_journal_has_csum_v2or3 (journal)) - tag_space -=sizeof (struct jbd2_journal_block_tail ); -/* Commit code leaves a slack space of 16 bytes at the end of block */ - tags_per_block = (tag_space -16 ) /journal_tag_bytes (journal); -/* -* Revoke descriptors are accounted separately so we need to reserve -* space for commit block and normal transaction descriptor blocks. -*/ -return 1 +DIV_ROUND_UP (journal->j_max_transaction_buffers, - tags_per_block); -} - -/* * jbd2_get_transaction: obtain a new transaction_t object. * * Simply initialise a new transaction. Initialize it in
@@ -109,7 +87,7 @@ static void jbd2_get_transaction(journal transaction->t_expires = jiffies + journal->j_commit_interval;atomic_set (&transaction->t_updates,0 );atomic_set (&transaction->t_outstanding_credits, -jbd2_descriptor_blocks_per_trans (journal) + + journal->j_transaction_overhead_buffers +atomic_read (&journal->j_reserved_credits));atomic_set (&transaction->t_outstanding_revokes,0 );atomic_set (&transaction->t_handle_count,0 );
include/linux/jbd2.h +7 -0
@@ -1084,6 +1084,13 @@ struct journal_sint j_revoke_records_per_block;/** +* @j_transaction_overhead: +* +* Number of blocks each transaction needs for its own bookkeeping +*/ +int j_transaction_overhead_buffers; + +/** * @j_commit_interval: * * What is the maximum transaction lifetime before we begin a commit?
Greg Kroah-Hartman
maintainerPATCH 412/568 jbd2: avoid infinite transaction commit loop
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 27ba5b67312a944576addc4df44ac3b709aabede upstream.
Commit 9f356e5a4f12 ("jbd2: Account descriptor blocks into t_outstanding_credits") started to account descriptor blocks into transactions outstanding credits. However it didn't appropriately decrease the maximum amount of credits available to userspace. Thus if the filesystem requests a transaction smaller than j_max_transaction_buffers but large enough that when descriptor blocks are added the size exceeds j_max_transaction_buffers, we confuse add_transaction_credits() into thinking previous handles have grown the transaction too much and enter infinite journal commit loop in start_this_handle() -> add_transaction_credits() trying to create transaction with enough credits available.
Fix the problem by properly accounting for transaction space reserved for descriptor blocks when verifying requested transaction handle size.
--- fs/jbd2/transaction.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
fs/jbd2/transaction.c +14 -7
@@ -191,6 +191,13 @@ static void sub_reserved_credits(journalwake_up (&journal->j_wait_reserved); } +/* Maximum number of blocks for user transaction payload */ +static int jbd2_max_user_trans_buffers (journal_t *journal) +{ +return journal->j_max_transaction_buffers - + journal->j_transaction_overhead_buffers; +} +/* * Wait until we can add credits for handle to the running transaction. Called * with j_state_lock held for reading. Returns 0 if handle joined the running
@@ -240,12 +247,12 @@ __must_hold(&journal->j_state_lock)* big to fit this handle? Wait until reserved credits are freed. */ if (atomic_read (&journal->j_reserved_credits) + total > - journal->j_max_transaction_buffers) { +jbd2_max_user_trans_buffers (journal)) {read_unlock (&journal->j_state_lock);jbd2_might_wait_for_commit (journal);wait_event (journal->j_wait_reserved,atomic_read (&journal->j_reserved_credits) + total <= - journal->j_max_transaction_buffers); +jbd2_max_user_trans_buffers (journal));__acquire (&journal->j_state_lock);/* fake out sparse */ return 1 ; }
@@ -285,14 +292,14 @@ __must_hold(&journal->j_state_lock) needed =atomic_add_return (rsv_blocks, &journal->j_reserved_credits);/* We allow at most half of a transaction to be reserved */ -if (needed > journal->j_max_transaction_buffers /2 ) { +if (needed >jbd2_max_user_trans_buffers (journal) /2 ) {sub_reserved_credits (journal, rsv_blocks);atomic_sub (total, &t->t_outstanding_credits);read_unlock (&journal->j_state_lock);jbd2_might_wait_for_commit (journal);wait_event (journal->j_wait_reserved,atomic_read (&journal->j_reserved_credits) + rsv_blocks - <= journal->j_max_transaction_buffers /2 ); + <=jbd2_max_user_trans_buffers (journal) /2 );__acquire (&journal->j_state_lock);/* fake out sparse */ return 1 ; }
@@ -322,12 +329,12 @@ static int start_this_handle(journal_t ** size and limit the number of total credits to not exceed maximum * transaction size per operation. */ -if ((rsv_blocks > journal->j_max_transaction_buffers /2 ) || - (rsv_blocks + blocks > journal->j_max_transaction_buffers)) { +if (rsv_blocks >jbd2_max_user_trans_buffers (journal) /2 || + rsv_blocks + blocks >jbd2_max_user_trans_buffers (journal)) {printk (KERN_ERR "JBD2: %s wants too many credits " "credits:%d rsv_credits:%d max:%d\n" , current->comm, blocks, rsv_blocks, - journal->j_max_transaction_buffers); +jbd2_max_user_trans_buffers (journal));WARN_ON (1 );return -ENOSPC ; }
Greg Kroah-Hartman
maintainerPATCH 413/568 media: uvcvideo: Fix integer overflow calculating timestamp
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 8676a5e796fa18f55897ca36a94b2adf7f73ebd1 upstream.
The function uvc_video_clock_update() supports a single SOF overflow. Or in other words, the maximum difference between the first ant the last timestamp can be 4096 ticks or 4.096 seconds.
This results in a maximum value for y2 of: 0x12FBECA00, that overflows 32bits.
y2 = (u32)ktime_to_ns(ktime_sub(last->host_time, first->host_time)) + y1;
Extend the size of y2 to u64 to support all its values.
Without this patch:
# yavta -s 1920x1080 -f YUYV -t 1/5 -c /dev/video0 Device /dev/v4l/by-id/usb-Shine-Optics_Integrated_Camera_0001-video-index0 opened. Device `Integrated Camera: Integrated C' on `usb-0000:00:14.0-6' (driver 'uvcvideo') supports video, capture, without mplanes. Video format set: YUYV (56595559) 1920x1080 (stride 3840) field none buffer size 4147200 Video format: YUYV (56595559) 1920x1080 (stride 3840) field none buffer size 4147200 Current frame rate: 1/5 Setting frame rate to: 1/5 Frame rate set: 1/5 8 buffers requested. length: 4147200 offset: 0 timestamp type/source: mono/SoE Buffer 0/0 mapped at address 0x7947ea94c000. length: 4147200 offset: 4149248 timestamp type/source: mono/SoE Buffer 1/0 mapped at address 0x7947ea557000. length: 4147200 offset: 8298496 timestamp type/source: mono/SoE Buffer 2/0 mapped at address 0x7947ea162000. length: 4147200 offset: 12447744 timestamp type/source: mono/SoE Buffer 3/0 mapped at address 0x7947e9d6d000. length: 4147200 offset: 16596992 timestamp type/source: mono/SoE Buffer 4/0 mapped at address 0x7947e9978000. length: 4147200 offset: 20746240 timestamp type/source: mono/SoE Buffer 5/0 mapped at address 0x7947e9583000. length: 4147200 offset: 24895488 timestamp type/source: mono/SoE Buffer 6/0 mapped at address 0x7947e918e000. length: 4147200 offset: 29044736 timestamp type/source: mono/SoE Buffer 7/0 mapped at address 0x7947e8d99000. 0 (0) [-] none 0 4147200 B 507.554210 508.874282 242.836 fps ts mono/SoE 1 (1) [-] none 2 4147200 B 508.886298 509.074289 0.751 fps ts mono/SoE 2 (2) [-] none 3 4147200 B 509.076362 509.274307 5.261 fps ts mono/SoE 3 (3) [-] none 4 4147200 B 509.276371 509.474336 5.000 fps ts mono/SoE 4 (4) [-] none 5 4147200 B 509.476394 509.674394 4.999 fps ts mono/SoE 5 (5) [-] none 6 4147200 B 509.676506 509.874345 4.997 fps ts mono/SoE 6 (6) [-] none 7 4147200 B 509.876430 510.074370 5.002 fps ts mono/SoE 7 (7) [-] none 8 4147200 B 510.076434 510.274365 5.000 fps ts mono/SoE 8 (0) [-] none 9 4147200 B 510.276421 510.474333 5.000 fps ts mono/SoE 9 (1) [-] none 10 4147200 B 510.476391 510.674429 5.001 fps ts mono/SoE 10 (2) [-] none 11 4147200 B 510.676434 510.874283 4.999 fps ts mono/SoE 11 (3) [-] none 12 4147200 B 510.886264 511.074349 4.766 fps ts mono/SoE 12 (4) [-] none 13 4147200 B 511.070577 511.274304 5.426 fps ts mono/SoE 13 (5) [-] none 14 4147200 B 511.286249 511.474301 4.637 fps ts mono/SoE 14 (6) [-] none 15 4147200 B 511.470542 511.674251 5.426 fps ts mono/SoE 15 (7) [-] none 16 4147200 B 511.672651 511.874337 4.948 fps ts mono/SoE 16 (0) [-] none 17 4147200 B 511.873988 512.074462 4.967 fps ts mono/SoE 17 (1) [-] none 18 4147200 B 512.075982 512.278296 4.951 fps ts mono/SoE 18 (2) [-] none 19 4147200 B 512.282631 512.482423 4.839 fps ts mono/SoE 19 (3) [-] none 20 4147200 B 518.986637 512.686333 0.149 fps ts mono/SoE 20 (4) [-] none 21 4147200 B 518.342709 512.886386 -1.553 fps ts mono/SoE 21 (5) [-] none 22 4147200 B 517.909812 513.090360 -2.310 fps ts mono/SoE 22 (6) [-] none 23 4147200 B 517.590775 513.294454 -3.134 fps ts mono/SoE 23 (7) [-] none 24 4147200 B 513.298465 513.494335 -0.233 fps ts mono/SoE 24 (0) [-] none 25 4147200 B 513.510273 513.698375 4.721 fps ts mono/SoE 25 (1) [-] none 26 4147200 B 513.698904 513.902327 5.301 fps ts mono/SoE 26 (2) [-] none 27 4147200 B 513.895971 514.102348 5.074 fps ts mono/SoE 27 (3) [-] none 28 4147200 B 514.099091 514.306337 4.923 fps ts mono/SoE 28 (4) [-] none 29 4147200 B 514.310348 514.510567 4.734 fps ts mono/SoE 29 (5) [-] none 30 4147200 B 514.509295 514.710367 5.026 fps ts mono/SoE 30 (6) [-] none 31 4147200 B 521.532513 514.914398 0.142 fps ts mono/SoE 31 (7) [-] none 32 4147200 B 520.885277 515.118385 -1.545 fps ts mono/SoE 32 (0) [-] none 33 4147200 B 520.411140 515.318336 -2.109 fps ts mono/SoE 33 (1) [-] none 34 4147200 B 515.325425 515.522278 -0.197 fps ts mono/SoE 34 (2) [-] none 35 4147200 B 515.538276 515.726423 4.698 fps ts mono/SoE 35 (3) [-] none 36 4147200 B 515.720767 515.930373 5.480 fps ts mono/SoE
--- drivers/media/usb/uvc/uvc_video.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/usb/uvc/uvc_video.c +5 -5
@@ -720,11 +720,11 @@ void uvc_video_clock_update(struct uvc_sunsigned long flags;u64 timestamp;u32 delta_stc; -u32 y1, y2; +u32 y1;u32 x1, x2;u32 mean;u32 sof; -u64 y; +u64 y, y2;if (!uvc_hw_timestamps_param)return ;
@@ -764,7 +764,7 @@ void uvc_video_clock_update(struct uvc_s sof = y; uvc_dbg(stream->dev, CLOCK, - "%s: PTS %u y %llu.%06llu SOF %u.%06llu (x1 %u x2 %u y1 %u y2 %u SOF offset %u)\n", + "%s: PTS %u y %llu.%06llu SOF %u.%06llu (x1 %u x2 %u y1 %u y2 %llu SOF offset %u)\n", stream->dev->name, buf->pts, y >> 16, div_u64((y & 0xffff) * 1000000, 65536), sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536),
@@ -779,7 +779,7 @@ void uvc_video_clock_update(struct uvc_s goto done; y1 =NSEC_PER_SEC ; - y2 = (u32 )ktime_to_ns (ktime_sub (last->host_time, first->host_time)) + y1; + y2 =ktime_to_ns (ktime_sub (last->host_time, first->host_time)) + y1;/* * Interpolated and host SOF timestamps can wrap around at slightly
@@ -800,7 +800,7 @@ void uvc_video_clock_update(struct uvc_s timestamp =ktime_to_ns (first->host_time) + y - y1; uvc_dbg(stream->dev, CLOCK, - "%s: SOF %u.%06llu y %llu ts %llu buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %u)\n", + "%s: SOF %u.%06llu y %llu ts %llu buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %llu)\n", stream->dev->name, sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536), y, timestamp, vbuf->vb2_buf.timestamp,
Greg Kroah-Hartman
maintainerPATCH 414/568 media: ivsc: csi: dont count privacy on as error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentong Wu <[email protected]>
commit a813f168336ec4ef725b836e598cd9dc14f76dd7 upstream.
Prior to the ongoing command privacy is on, it would return -1 to indicate the current privacy status, and the ongoing command would be well executed by firmware as well, so this is not error. This patch changes its behavior to notify privacy on directly by V4L2 privacy control instead of reporting error.
--- drivers/media/pci/intel/ivsc/mei_csi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ivsc/mei_csi.c +5 -1
@@ -191,7 +191,11 @@ static int mei_csi_send(struct mei_csi */* command response status */ ret = csi->cmd_response.status; -if (ret) { +if (ret ==-1 ) { +/* notify privacy on instead of reporting error */ + ret =0 ; +v4l2_ctrl_s_ctrl (csi->privacy_ctrl,1 ); + }else if (ret) { ret = -EINVAL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 415/568 KVM: VMX: Split out the non-virtualization part of vmx_interrupt_blocked()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 322a569c4b4188a0da2812f9e952780ce09b74ba upstream.
Move the non-VMX chunk of the "interrupt blocked" checks to a separate helper so that KVM can reuse the code to detect if interrupts are blocked for L2, e.g. to determine if a virtual interrupt _for L2_ is a valid wake event. If L1 disables HLT-exiting for L2, nested APICv is enabled, and L2 HLTs, then L2 virtual interrupts are valid wake events, but if and only if interrupts are unblocked for L2.
--- arch/x86/kvm/vmx/vmx.c | 11 ++++++++--- arch/x86/kvm/vmx/vmx.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx/vmx.c +8 -3
@@ -5048,14 +5048,19 @@ static int vmx_nmi_allowed(struct kvm_vcreturn !vmx_nmi_blocked (vcpu); } +bool __vmx_interrupt_blocked (struct kvm_vcpu *vcpu) +{ +return !(vmx_get_rflags (vcpu) &X86_EFLAGS_IF ) || + (vmcs_read32 (GUEST_INTERRUPTIBILITY_INFO ) & + (GUEST_INTR_STATE_STI |GUEST_INTR_STATE_MOV_SS )); +} +bool vmx_interrupt_blocked (struct kvm_vcpu *vcpu) {if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu))return false; -return !(vmx_get_rflags (vcpu) &X86_EFLAGS_IF ) || - (vmcs_read32 (GUEST_INTERRUPTIBILITY_INFO ) & - (GUEST_INTR_STATE_STI |GUEST_INTR_STATE_MOV_SS )); +return __vmx_interrupt_blocked (vcpu); }static int vmx_interrupt_allowed (struct kvm_vcpu *vcpu,bool for_injection)
arch/x86/kvm/vmx/vmx.h +1 -0
@@ -400,6 +400,7 @@ u64 construct_eptp(struct kvm_vcpu *vcpubool vmx_guest_inject_ac (struct kvm_vcpu *vcpu);void vmx_update_exception_bitmap (struct kvm_vcpu *vcpu);bool vmx_nmi_blocked (struct kvm_vcpu *vcpu); +bool __vmx_interrupt_blocked (struct kvm_vcpu *vcpu);bool vmx_interrupt_blocked (struct kvm_vcpu *vcpu);bool vmx_get_nmi_mask (struct kvm_vcpu *vcpu);void vmx_set_nmi_mask (struct kvm_vcpu *vcpu,bool masked);
Greg Kroah-Hartman
maintainerPATCH 416/568 KVM: nVMX: Request immediate exit iff pending nested event needs injection
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 32f55e475ce2c4b8b124d335fcfaf1152ba977a1 upstream.
When requesting an immediate exit from L2 in order to inject a pending event, do so only if the pending event actually requires manual injection, i.e. if and only if KVM actually needs to regain control in order to deliver the event.
Avoiding the "immediate exit" isn't simply an optimization, it's necessary to make forward progress, as the "already expired" VMX preemption timer trick that KVM uses to force a VM-Exit has higher priority than events that aren't directly injected.
At present time, this is a glorified nop as all events processed by vmx_has_nested_events() require injection, but that will not hold true in the future, e.g. if there's a pending virtual interrupt in vmcs02.RVI. I.e. if KVM is trying to deliver a virtual interrupt to L2, the expired VMX preemption timer will trigger VM-Exit before the virtual interrupt is delivered, and KVM will effectively hang the vCPU in an endless loop of forced immediate VM-Exits (because the pending virtual interrupt never goes away).
--- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/x86.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -1758,7 +1758,7 @@ struct kvm_x86_nested_ops {bool (*is_exception_vmexit)(struct kvm_vcpu *vcpu,u8 vector,u32 error_code);int (*check_events)(struct kvm_vcpu *vcpu); -bool (*has_events)(struct kvm_vcpu *vcpu); +bool (*has_events)(struct kvm_vcpu *vcpu,bool for_injection);void (*triple_fault)(struct kvm_vcpu *vcpu); int (*get_state)(struct kvm_vcpu *vcpu, struct kvm_nested_state __user *user_kvm_nested_state,
arch/x86/kvm/vmx/nested.c +1 -1
@@ -3962,7 +3962,7 @@ static bool nested_vmx_preemption_timer_to_vmx (vcpu)->nested.preemption_timer_expired; } -static bool vmx_has_nested_events (struct kvm_vcpu *vcpu) +static bool vmx_has_nested_events (struct kvm_vcpu *vcpu,bool for_injection) {return nested_vmx_preemption_timer_pending (vcpu) ||to_vmx (vcpu)->nested.mtf_pending;
arch/x86/kvm/x86.c +2 -2
@@ -10254,7 +10254,7 @@ static int kvm_check_and_inject_events(sif (is_guest_mode (vcpu) && kvm_x86_ops.nested_ops->has_events && - kvm_x86_ops.nested_ops->has_events (vcpu)) + kvm_x86_ops.nested_ops->has_events (vcpu, true)) *req_immediate_exit = true;/*
@@ -12882,7 +12882,7 @@ static inline bool kvm_vcpu_has_events(sif (is_guest_mode (vcpu) && kvm_x86_ops.nested_ops->has_events && - kvm_x86_ops.nested_ops->has_events (vcpu)) + kvm_x86_ops.nested_ops->has_events (vcpu, false))return true;if (kvm_xen_has_pending_events (vcpu))
Greg Kroah-Hartman
maintainerPATCH 417/568 ALSA: ump: Dont update FB name for static blocks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 9a4ab167cfb1dea1df0c0c948205a62c7eb3b85b upstream.
When a device tries to update the FB name string even if its Endpoint is declared as static, we should skip it, just already done for the FB info update reply.
--- sound/core/ump.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/core/ump.c +7 -0
@@ -806,6 +806,13 @@ static int ump_handle_fb_name_msg(struct snd_ump_endpoint *ump,if (!fb)return -ENODEV ; +if (ump->parsed && + (ump->info.flags &SNDRV_UMP_EP_INFO_STATIC_BLOCKS )) { +ump_dbg (ump,"Skipping static FB name update (blk#%d)\n" , + fb->info.block_id); +return 0 ; + } + ret =ump_append_string (ump, fb->info.name,sizeof (fb->info.name), buf->raw,3 );/* notify the FB name update to sequencer, too */
Signature · 1 line
2.45.2
Greg Kroah-Hartman
maintainerPATCH 418/568 ALSA: ump: Force 1 Group for MIDI1 FBs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ac29d8ae05b770ed3f52d7a60908ab9b126f69d7 upstream.
When a Function Block declares it being a legacy MIDI1 device, it has to be only with a single UMP Group. Correct the attribute when a device declares it wrongly.
--- sound/core/ump.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/core/ump.c +6 -0
@@ -733,6 +733,12 @@ static void fill_fb_info(struct snd_ump_endpoint *ump, info->block_id, info->direction, info->active, info->first_group, info->num_groups, info->midi_ci_version, info->sysex8_streams, info->flags); + +if ((info->flags &SNDRV_UMP_BLOCK_IS_MIDI1 ) && info->num_groups !=1 ) { + info->num_groups =1 ; +ump_dbg (ump,"FB %d: corrected groups to 1 for MIDI1\n" , + info->block_id); + } }/* check whether the FB info gets updated by the current message */
Signature · 1 line
2.45.2
Greg Kroah-Hartman
maintainerPATCH 419/568 ALSA: usb-audio: Fix microphone sound on HD webcam.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
commit 74dba240881820b46b9b1c62ef4de3bfff47fbd4 upstream.
I own an external usb Webcam, HD webcam, which had low mic volume and inconsistent sound quality. Video works as expected.
(snip)
[ 95.473820][ 1] [ T73] usb 5-2.2: new high-speed USB device number 7 using xhci_hcd [ 95.773974][ 1] [ T73] usb 5-2.2: New USB device found, idVendor=1bcf, idProduct=2281, bcdDevice= 0.05 [ 95.783445][ 1] [ T73] usb 5-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 95.791872][ 1] [ T73] usb 5-2.2: Product: HD webcam [ 95.797001][ 1] [ T73] usb 5-2.2: Manufacturer: Sunplus IT Co [ 95.802996][ 1] [ T73] usb 5-2.2: SerialNumber: 20200513 [ 96.092610][ 2] [ T3680] usb 5-2.2: Warning! Unlikely big volume range (=4096), cval->res is probably wrong. [ 96.102436][ 2] [ T3680] usb 5-2.2: [5] FU [Mic Capture Volume] ch = 1, val = 0/4096/1
Set up quirk cval->res to 16 for 256 levels,
Set GET_SAMPLE_RATE quirk flag to stop trying to get the sample rate. Confirmed that happened anyway later due to the backoff mechanism, After 3 failures.
All audio stream on device interfaces share the same values, apart from wMaxPacketSize and tSamFreq :
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 4
bNumEndpoints 1
bInterfaceClass 1 AudioInterface Descriptor:
bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 4 bNumEndpoints 1 bInterfaceClass 1 Audio bInterfaceSubClass 2 Streaming bInterfaceProtocol 0 iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 3
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0064 1x 100 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0x0000
(snip)
Testing patch provides consistent good sound recording quality and volume range.
(snip)
[ 95.473820][ 1] [ T73] usb 5-2.2: new high-speed USB device number 7 using xhci_hcd [ 95.773974][ 1] [ T73] usb 5-2.2: New USB device found, idVendor=1bcf, idProduct=2281, bcdDevice= 0.05 [ 95.783445][ 1] [ T73] usb 5-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 95.791872][ 1] [ T73] usb 5-2.2: Product: HD webcam [ 95.797001][ 1] [ T73] usb 5-2.2: Manufacturer: Sunplus IT Co [ 95.802996][ 1] [ T73] usb 5-2.2: SerialNumber: 20200513 [ 96.110630][ 3] [ T3680] usbcore: registered new interface driver snd-usb-audio [ 96.114329][ 7] [ T3677] usb 5-2.2: Found UVC 1.00 device HD webcam (1bcf:2281) [ 96.167555][ 7] [ T3677] usbcore: registered new interface driver uvcvideo
--- sound/usb/mixer.c | 7 +++++++ sound/usb/quirks.c | 2 ++ 2 files changed, 9 insertions(+)
sound/usb/mixer.c +7 -0
@@ -1211,6 +1211,13 @@ static void volume_control_quirks(struct cval->res =16 ; }break ; +case USB_ID (0x1bcf ,0x2281 ):/* HD Webcam */ +if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { +usb_audio_info (chip, +"set resolution quirk: cval->res = 16\n" ); + cval->res =16 ; + } +break ; } }
sound/usb/quirks.c +2 -0
@@ -2185,6 +2185,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER),DEVICE_FLG (0x534d ,0x2109 ,/* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER ), +DEVICE_FLG (0x1bcf ,0x2281 ,/* HD Webcam */ +QUIRK_FLAG_GET_SAMPLE_RATE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
Greg Kroah-Hartman
maintainerPATCH 420/568 ALSA: usb-audio: Move HD Webcam quirk to the right place
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 7010d9464f7ca3ee2d75095ea2e642a9009a41ff upstream.
The quirk_flags_table[] is sorted in the USB ID order, while the last fix was put at a wrong position. Adjust the entry at the right position.
--- sound/usb/quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/quirks.c +2 -2
@@ -2127,6 +2127,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_GET_SAMPLE_RATE),DEVICE_FLG (0x19f7 ,0x0035 ,/* RODE NT-USB+ */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x1bcf ,0x2281 ,/* HD Webcam */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x2040, 0x7200, /* Hauppauge HVR-950Q */
@@ -2185,8 +2187,6 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER),DEVICE_FLG (0x534d ,0x2109 ,/* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER ), -DEVICE_FLG (0x1bcf ,0x2281 ,/* HD Webcam */ -QUIRK_FLAG_GET_SAMPLE_RATE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
Greg Kroah-Hartman
maintainerPATCH 421/568 ALSA: usb-audio: Add a quirk for Sonix HD USB Camera
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
commit 21451dfd853e7d8e6e3fbd7ef1fbdb2f2ead12f5 upstream.
Sonix HD USB Camera does not support reading the sample rate which leads to many lines of "cannot get freq at ep 0x84".
This patch adds the USB ID to quirks.c and avoids those error messages.
(snip)
[1.789698] usb 3-3: new high-speed USB device number 2 using xhci_hcd [1.984121] usb 3-3: New USB device found, idVendor=0c45, idProduct=6340, bcdDevice= 0.00 [1.984124] usb 3-3: New USB device strings: Mfr=2, Product=1, SerialNumber=0 [1.984127] usb 3-3: Product: USB 2.0 Camera [1.984128] usb 3-3: Manufacturer: Sonix Technology Co., Ltd. [5.440957] usb 3-3: 3:1: cannot get freq at ep 0x84 [12.130679] usb 3-3: 3:1: cannot get freq at ep 0x84 [12.175065] usb 3-3: 3:1: cannot get freq at ep 0x84
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2085,6 +2085,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x0b0e ,0x0349 ,/* Jabra 550a */ QUIRK_FLAG_CTL_MSG_DELAY_1M ), +DEVICE_FLG (0x0c45 ,0x6340 ,/* Sonix HD USB Camera */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ QUIRK_FLAG_FIXED_RATE ), DEVICE_FLG(0x0ecb, 0x2069, /* JBL Quantum810 Wireless */
Greg Kroah-Hartman
maintainerPATCH 422/568 tools/memory-model: Fix bug in lock.cat
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 4c830eef806679dc243e191f962c488dd9d00708 upstream.
Andrea reported that the following innocuous litmus test:
C T
{}
P0(spinlock_t *x)
{
int r0;
spin_lock(x);
spin_unlock(x);
r0 = spin_is_locked(x);
}gives rise to a nonsensical empty result with no executions:
$ herd7 -conf linux-kernel.cfg T.litmus Test T Required States 0 Ok Witnesses Positive: 0 Negative: 0 Condition forall (true) Observation T Never 0 0 Time T 0.00 Hash=6fa204e139ddddf2cb6fa963bad117c0
The problem is caused by a bug in the lock.cat part of the LKMM. Its computation of the rf relation for RU (read-unlocked) events is faulty; it implicitly assumes that every RU event must read from either a UL (unlock) event in another thread or from the lock's initial state. Neither is true in the litmus test above, so the computation yields no possible executions.
The lock.cat code tries to make up for this deficiency by allowing RU events outside of critical sections to read from the last po-previous UL event. But it does this incorrectly, trying to keep these rfi links separate from the rfe links that might also be needed, and passing only the latter to herd7's cross() macro.
The problem is fixed by merging the two sets of possible rf links for RU events and using them all in the call to cross().
--- tools/memory-model/lock.cat | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tools/memory-model/lock.cat +10 -10
@@ -102,19 +102,19 @@ let rf-lf = rfe-lf | rfi-lf * within one of the lock's critical sections returns False. *) -(* rfi for RU events: an RU may read from the last po-previous UL *) -let rfi-ru = ([UL] ; po-loc ; [RU]) \ ([UL] ; po-loc ; [LKW] ; po-loc) - -(* rfe for RU events: an RU may read from an external UL or the initial write *) -let all-possible-rfe-ru = - let possible-rfe-ru r = +(* + * rf for RU events: an RU may read from an external UL or the initial write, + * or from the last po-previous UL + *) +let all-possible-rf-ru = + let possible-rf-ru r = let pair-to-relation p = p ++ 0 - in map pair-to-relation (((UL | IW) * {r}) & loc & ext) - in map possible-rfe-ru RU + in map pair-to-relation ((((UL | IW) * {r}) & loc & ext) | + (((UL * {r}) & po-loc) \ ([UL] ; po-loc ; [LKW] ; po-loc))) + in map possible-rf-ru RU (* Generate all rf relations for RU events *) -with rfe-ru from cross(all-possible-rfe-ru) -let rf-ru = rfe-ru | rfi-ru +with rf-ru from cross(all-possible-rf-ru) (* Final rf relation *) let rf = rf | rf-lf | rf-ru