6.17.3-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 256/563 drm/dp: drm_edp_backlight_set_level: do not always send 3-byte commands
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 4aa8961b1b9c7498550b41168a91cf1558133dd3 ]
At least some panels using the LSB register are not happy with the unconditional increase of the command buffer to 3 bytes.
With the BOE NE14QDM in my Dell Latitude 7455, the recent patches for luminance based brightness have introduced a regression: the brightness range stopped being contiguous and became nonsensical (it probably was interpreting the last 2 bytes of the buffer and not the first 2).
Change from using a fixed sizeof() to a length variable that's only set to 3 when luminance is used. Let's leave the default as 2 even for the single-byte version, since that's how it worked before.
--- drivers/gpu/drm/display/drm_dp_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/display/drm_dp_helper.c +3 -1
@@ -3962,6 +3962,7 @@ int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_bacint ret;unsigned int offset =DP_EDP_BACKLIGHT_BRIGHTNESS_MSB ;u8 buf[3 ] = {0 }; +size_t len =2 ;/* The panel uses the PWM for controlling brightness levels */ if (!(bl->aux_set || bl->luminance_set))
@@ -3974,6 +3975,7 @@ int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_bac buf[1 ] = (level &0x00ff00 ) >>8 ; buf[2 ] = (level &0xff0000 ) >>16 ; offset =DP_EDP_PANEL_TARGET_LUMINANCE_VALUE ; + len =3 ; }else if (bl->lsb_reg_used) { buf[0 ] = (level &0xff00 ) >>8 ; buf[1 ] = (level &0x00ff );
@@ -3981,7 +3983,7 @@ int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_bac buf[0 ] = level; } - ret =drm_dp_dpcd_write_data (aux, offset, buf,sizeof (buf)); + ret =drm_dp_dpcd_write_data (aux, offset, buf, len);if (ret <0 ) { drm_err(aux->drm_dev, "%s: Failed to write aux backlight level: %d\n",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 257/563 crypto: octeontx2 - Call strscpy() with correct size argument
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit 361fa7f813e7056cecdb24f3582ab0ad4a088e4e ]
In otx2_cpt_dl_custom_egrp_create(), strscpy() is called with the length of the source string rather than the size of the destination buffer.
This is fine as long as the destination buffer is larger than the source string, but we should still use the destination buffer size instead to call strscpy() as intended. And since 'tmp_buf' is a fixed-size buffer, we can safely omit the size argument and let strscpy() infer it using sizeof().
--- drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +1 -1
@@ -1615,7 +1615,7 @@ int otx2_cpt_dl_custom_egrp_create(struct otx2_cptpf_dev *cptpf,return -EINVAL ; } err_msg ="Invalid engine group format" ; -strscpy (tmp_buf, ctx->val.vstr,strlen (ctx->val.vstr) +1 ); +strscpy (tmp_buf, ctx->val.vstr); start = tmp_buf; has_se = has_ie = has_ae = false;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 258/563 drm: re-allow no-op changes on non-primary planes in async flips
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xaver Hugl <[email protected]>
[ Upstream commit b065bd213caf6d35b57c5089d6507d7e8598a586 ]
Commit fd40a63c63a1 ("drm/atomic: Let drivers decide which planes to async flip") unintentionally disallowed no-op changes on non-primary planes that the driver doesn't allow async flips on. This broke async flips for compositors that disable the cursor plane in every async atomic commit. To fix that, change drm_atomic_set_property to again only run atomic_async_check if the plane would actually be changed by the atomic commit.
--- drivers/gpu/drm/drm_atomic_uapi.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +12 -11
@@ -1078,19 +1078,20 @@ int drm_atomic_set_property(struct drm_atomic_state *state, }if (async_flip) { -/* check if the prop does a nop change */ -if ((prop != config->prop_fb_id && - prop != config->prop_in_fence_fd && - prop != config->prop_fb_damage_clips)) { - ret =drm_atomic_plane_get_property (plane, plane_state, - prop, &old_val); - ret =drm_atomic_check_prop_changes (ret, old_val, prop_value, prop); - } +/* no-op changes are always allowed */ + ret =drm_atomic_plane_get_property (plane, plane_state, + prop, &old_val); + ret =drm_atomic_check_prop_changes (ret, old_val, prop_value, prop); -/* ask the driver if this non-primary plane is supported */ -if (plane->type !=DRM_PLANE_TYPE_PRIMARY ) { - ret = -EINVAL ; +/* fail everything that isn't no-op or a pure flip */ +if (ret && prop != config->prop_fb_id && + prop != config->prop_in_fence_fd && + prop != config->prop_fb_damage_clips) { +break ; + } +if (ret && plane->type !=DRM_PLANE_TYPE_PRIMARY ) { +/* ask the driver if this non-primary plane is supported */ if (plane_funcs && plane_funcs->atomic_async_check) ret = plane_funcs->atomic_async_check (plane, state, true);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 259/563 media: rj54n1cb0c: Fix memleak in rj54n1_probe()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <[email protected]>
[ Upstream commit fda55673ecdabf25f5ecc61b5ab17239257ac252 ]
rj54n1_probe() won't clean all the allocated resources in fail path, which may causes the memleaks. Add v4l2_ctrl_handler_free() to prevent memleak.
--- drivers/media/i2c/rj54n1cb0c.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/i2c/rj54n1cb0c.c +6 -3
@@ -1329,10 +1329,13 @@ static int rj54n1_probe(struct i2c_client *client) V4L2_CID_GAIN, 0, 127, 1, 66);v4l2_ctrl_new_std (&rj54n1->hdl, &rj54n1_ctrl_ops,V4L2_CID_AUTO_WHITE_BALANCE ,0 ,1 ,1 ,1 ); - rj54n1->subdev.ctrl_handler = &rj54n1->hdl; -if (rj54n1->hdl.error) -return rj54n1->hdl.error; +if (rj54n1->hdl.error) { + ret = rj54n1->hdl.error; + goto err_free_ctrl; + } + + rj54n1->subdev.ctrl_handler = &rj54n1->hdl; rj54n1->clk_div = clk_div; rj54n1->rect.left =RJ54N1_COLUMN_SKIP ; rj54n1->rect.top =RJ54N1_ROW_SKIP ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 260/563 media: staging/ipu7: convert to use pci_alloc_irq_vectors() API
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
[ Upstream commit 283f7638c26c0f36e4ef5e147884e241b24fbebd ]
pci_enable_msi() is a deprecated API, thus switch to use modern pci_alloc_irq_vectors().
--- drivers/staging/media/ipu7/ipu7.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/staging/media/ipu7/ipu7.c +9 -12
@@ -2248,20 +2248,13 @@ void ipu7_dump_fw_error_log(const struct ipu7_bus_device *adev) }EXPORT_SYMBOL_NS_GPL (ipu7_dump_fw_error_log,"INTEL_IPU7" ); -static int ipu7_pci_config_setup (struct pci_dev *dev) +static void ipu7_pci_config_setup (struct pci_dev *dev) {u16 pci_command; -int ret;pci_read_config_word (dev,PCI_COMMAND , &pci_command); pci_command |=PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER ;pci_write_config_word (dev,PCI_COMMAND , pci_command); - - ret =pci_enable_msi (dev); -if (ret) -dev_err (&dev->dev,"Failed to enable msi (%d)\n" , ret); - -return ret; } static int ipu7_map_fw_code_region(struct ipu7_bus_device *sys,
@@ -2510,13 +2503,15 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)dma_set_max_seg_size (dev,UINT_MAX ); - ret =ipu7_pci_config_setup (pdev); -if (ret) -return ret; +ipu7_pci_config_setup (pdev); + + ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES ); +if (ret <0 ) +return dev_err_probe (dev, ret,"Failed to alloc irq vector\n" ); ret =ipu_buttress_init (isp);if (ret) -return ret; + goto pci_irq_free;dev_info (dev,"firmware cpd file: %s\n" , isp->cpd_fw_name);
@@ -2632,6 +2627,8 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)release_firmware (isp->cpd_fw); buttress_exit:ipu_buttress_exit (isp); +pci_irq_free: +pci_free_irq_vectors (pdev);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 261/563 media: staging/ipu7: Dont set name for IPU7 PCI device
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
[ Upstream commit 8abb489f9aa181882ece7c24712ad39cbb9dab81 ]
Driver better not dev_set_name() to change the PCI device name, so remove it.
--- drivers/staging/media/ipu7/ipu7.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +0 -1
@@ -2428,7 +2428,6 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (!isp)return -ENOMEM ; -dev_set_name (dev,"intel-ipu7" ); isp->pdev = pdev;INIT_LIST_HEAD (&isp->devices);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 235/563 usb: misc: qcom_eud: Access EUD_MODE_MANAGER2 through secure calls
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Komal Bajaj <[email protected]>
[ Upstream commit c0485e864a2eaa1d5a84c71e573dd236d0e885ae ]
EUD_MODE_MANAGER2 register is mapped to a memory region that is marked as read-only for operating system running at EL1, enforcing access restrictions that prohibit direct memory-mapped writes via writel().
Attempts to write to this region from HLOS can result in silent failures or memory access violations, particularly when toggling EUD (Embedded USB Debugger) state. To ensure secure register access, modify the driver to use qcom_scm_io_writel(), which routes the write operation to Qualcomm Secure Channel Monitor (SCM). SCM has the necessary permissions to access protected memory regions, enabling reliable control over EUD state.
SC7280, the only user of EUD is also affected, indicating that this could never have worked on a properly fused device.
--- drivers/usb/misc/Kconfig | 1 + drivers/usb/misc/qcom_eud.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-)
drivers/usb/misc/Kconfig +1 -0
@@ -147,6 +147,7 @@ config USB_APPLEDISPLAY config USB_QCOM_EUD tristate "QCOM Embedded USB Debugger(EUD) Driver" depends on ARCH_QCOM || COMPILE_TEST + select QCOM_SCM select USB_ROLE_SWITCH help This module enables support for Qualcomm Technologies, Inc.
drivers/usb/misc/qcom_eud.c +24 -9
@@ -15,6 +15,7 @@#include <linux/slab.h> #include <linux/sysfs.h> #include <linux/usb/role.h> +#include <linux/firmware/qcom/qcom_scm.h> #define EUD_REG_INT1_EN_MASK 0x0024#define EUD_REG_INT_STATUS_1 0x0044
@@ -34,7 +35,7 @@ struct eud_chip {struct device *dev;struct usb_role_switch *role_sw;void __iomem *base; -void __iomem *mode_mgr; +phys_addr_t mode_mgr;unsigned int int_status;int irq;bool enabled;
@@ -43,18 +44,29 @@ struct eud_chip {static int enable_eud (struct eud_chip *priv) { +int ret; + + ret =qcom_scm_io_writel (priv->mode_mgr +EUD_REG_EUD_EN2 ,1 ); +if (ret) +return ret; +writel (EUD_ENABLE , priv->base +EUD_REG_CSR_EUD_EN );writel (EUD_INT_VBUS |EUD_INT_SAFE_MODE , priv->base +EUD_REG_INT1_EN_MASK ); -writel (1 , priv->mode_mgr +EUD_REG_EUD_EN2 );return usb_role_switch_set_role (priv->role_sw,USB_ROLE_DEVICE ); } -static void disable_eud (struct eud_chip *priv) +static int disable_eud (struct eud_chip *priv) { +int ret; + + ret =qcom_scm_io_writel (priv->mode_mgr +EUD_REG_EUD_EN2 ,0 ); +if (ret) +return ret; +writel (0 , priv->base +EUD_REG_CSR_EUD_EN ); -writel (0 , priv->mode_mgr +EUD_REG_EUD_EN2 ); +return 0 ; } static ssize_t enable_show(struct device *dev,
@@ -82,11 +94,12 @@ static ssize_t enable_store(struct device *dev, chip->enabled = enable; elsedisable_eud (chip ); + }else { -disable_eud (chip); + ret =disable_eud (chip); } -return count; +return ret <0 ? ret : count; }static DEVICE_ATTR_RW (enable);
@@ -178,6 +191,7 @@ static void eud_role_switch_release(void *data)static int eud_probe (struct platform_device *pdev) {struct eud_chip *chip; +struct resource *res;int ret; chip =devm_kzalloc (&pdev->dev,sizeof (*chip),GFP_KERNEL );
@@ -200,9 +214,10 @@ static int eud_probe(struct platform_device *pdev)if (IS_ERR (chip->base))return PTR_ERR (chip->base); - chip->mode_mgr =devm_platform_ioremap_resource (pdev,1 ); -if (IS_ERR (chip->mode_mgr)) -return PTR_ERR (chip->mode_mgr); + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (!res) +return -ENODEV ; + chip->mode_mgr = res->start; chip->irq =platform_get_irq (pdev,0 );if (chip->irq <0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 262/563 media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
[ Upstream commit 01a80b6649e69e4889b8521de022d3ee4bc5cb6f ]
IPU7 ISYS and PSYS auxiliary devices are released after ipu7_bus_del_devices(), so driver can not reference the MMU devices from ISYS and PSYS auxiliary devices, so move the MMUs cleanup before releasing the auxiliary devices.
--- drivers/staging/media/ipu7/ipu7.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/ipu7/ipu7.c +3 -3
@@ -2644,6 +2644,9 @@ static void ipu7_pci_remove(struct pci_dev *pdev)if (!IS_ERR_OR_NULL (isp->fw_code_region))vfree (isp->fw_code_region); +ipu7_mmu_cleanup (isp->isys->mmu); +ipu7_mmu_cleanup (isp->psys->mmu); +ipu7_bus_del_devices (pdev);pm_runtime_forbid (&pdev->dev);
@@ -2652,9 +2655,6 @@ static void ipu7_pci_remove(struct pci_dev *pdev)ipu_buttress_exit (isp);release_firmware (isp->cpd_fw); - -ipu7_mmu_cleanup (isp->psys->mmu); -ipu7_mmu_cleanup (isp->isys->mmu); }static void ipu7_pci_reset_prepare (struct pci_dev *pdev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 263/563 media: i2c: vd55g1: Fix duster register address
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Mugnier <[email protected]>
[ Upstream commit ba4b8886c22a3e8c3f41c6dd373b177d7d41bcf8 ]
The duster register needs to be disabled on test patterns. While the code is correctly doing so, the register address contained a typo, thus not disabling the duster correctly. Fix the typo.
--- drivers/media/i2c/vd55g1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/vd55g1.c +1 -1
@@ -66,7 +66,7 @@#define VD55G1_REG_READOUT_CTRL CCI_REG8(0x052e)#define VD55G1_READOUT_CTRL_BIN_MODE_NORMAL 0#define VD55G1_READOUT_CTRL_BIN_MODE_DIGITAL_X2 1 -#define VD55G1_REG_DUSTER_CTRL CCI_REG8(0x03ea) +#define VD55G1_REG_DUSTER_CTRL CCI_REG8(0x03ae)#define VD55G1_DUSTER_ENABLE BIT(0)#define VD55G1_DUSTER_DISABLE 0#define VD55G1_DUSTER_DYN_ENABLE BIT(1)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 264/563 drm/panel: Allow powering on panel follower after panel is enabled
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pin-yen Lin <[email protected]>
[ Upstream commit 2eb22214c132374e11e681c44d7879c91f67f614 ]
Some touch controllers have to be powered on after the panel's backlight is enabled. To support these controllers, introduce .panel_enabled() and .panel_disabling() to panel_follower_funcs and use them to power on the device after the panel and its backlight are enabled.
Stable-dep-of: cbdd16b818ee ("HID: i2c-hid: Make elan touch controllers power on after panel is enabled")
--- drivers/gpu/drm/drm_panel.c | 73 +++++++++++++++++++++++++++++++------ include/drm/drm_panel.h | 14 +++++++ 2 files changed, 76 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_panel.c +62 -11
@@ -134,6 +134,9 @@ void drm_panel_prepare(struct drm_panel *panel) panel->prepared = true;list_for_each_entry (follower, &panel->followers, list) { +if (!follower->funcs->panel_prepared) +continue ; + ret = follower->funcs->panel_prepared (follower);if (ret <0 ) dev_info(panel->dev, "%ps failed: %d\n",
@@ -179,6 +182,9 @@ void drm_panel_unprepare(struct drm_panel *panel)mutex_lock (&panel->follower_lock);list_for_each_entry (follower, &panel->followers, list) { +if (!follower->funcs->panel_unpreparing) +continue ; + ret = follower->funcs->panel_unpreparing (follower);if (ret <0 ) dev_info(panel->dev, "%ps failed: %d\n",
@@ -209,6 +215,7 @@ EXPORT_SYMBOL(drm_panel_unprepare);*/ void drm_panel_enable (struct drm_panel *panel) { +struct drm_panel_follower *follower;int ret;if (!panel)
@@ -219,10 +226,12 @@ void drm_panel_enable(struct drm_panel *panel)return ; } +mutex_lock (&panel->follower_lock); +if (panel->funcs && panel->funcs->enable) { ret = panel->funcs->enable (panel);if (ret <0 ) -return ; + goto exit; } panel->enabled = true;
@@ -230,6 +239,19 @@ void drm_panel_enable(struct drm_panel *panel)if (ret <0 )DRM_DEV_INFO (panel->dev,"failed to enable backlight: %d\n" , ret); + +list_for_each_entry (follower, &panel->followers, list) { +if (!follower->funcs->panel_enabled) +continue ; + + ret = follower->funcs->panel_enabled (follower); +if (ret <0 ) +dev_info (panel->dev,"%ps failed: %d\n" , + follower->funcs->panel_enabled, ret); + } + +exit: +mutex_unlock (&panel->follower_lock); }EXPORT_SYMBOL (drm_panel_enable);
@@ -243,6 +265,7 @@ EXPORT_SYMBOL(drm_panel_enable);*/ void drm_panel_disable (struct drm_panel *panel) { +struct drm_panel_follower *follower;int ret;if (!panel)
@@ -262,6 +285,18 @@ void drm_panel_disable(struct drm_panel *panel)return ; } +mutex_lock (&panel->follower_lock); + +list_for_each_entry (follower, &panel->followers, list) { +if (!follower->funcs->panel_disabling) +continue ; + + ret = follower->funcs->panel_disabling (follower); +if (ret <0 ) +dev_info (panel->dev,"%ps failed: %d\n" , + follower->funcs->panel_disabling, ret); + } + ret =backlight_disable (panel->backlight);if (ret <0 ) DRM_DEV_INFO(panel->dev, "failed to disable backlight: %d\n",
@@ -270,9 +305,12 @@ void drm_panel_disable(struct drm_panel *panel)if (panel->funcs && panel->funcs->disable) { ret = panel->funcs->disable (panel);if (ret <0 ) -return ; + goto exit; } panel->enabled = false; + +exit: +mutex_unlock (&panel->follower_lock); }EXPORT_SYMBOL (drm_panel_disable);
@@ -539,13 +577,13 @@ EXPORT_SYMBOL(drm_is_panel_follower);* @follower_dev: The 'struct device' for the follower. * @follower: The panel follower descriptor for the follower. * -* A panel follower is called right after preparing the panel and right before -* unpreparing the panel. It's primary intention is to power on an associated -* touchscreen, though it could be used for any similar devices. Multiple -* devices are allowed the follow the same panel. +* A panel follower is called right after preparing/enabling the panel and right +* before unpreparing/disabling the panel. It's primary intention is to power on +* an associated touchscreen, though it could be used for any similar devices. +* Multiple devices are allowed the follow the same panel. * -* If a follower is added to a panel that's already been turned on, the -* follower's prepare callback is called right away. +* If a follower is added to a panel that's already been prepared/enabled, the +* follower's prepared/enabled callback is called right away. * * The "panel" property of the follower points to the panel to be followed. *
@@ -569,12 +607,18 @@ int drm_panel_add_follower(struct device *follower_dev,mutex_lock (&panel->follower_lock);list_add_tail (&follower->list, &panel->followers); -if (panel->prepared) { +if (panel->prepared && follower->funcs->panel_prepared) { ret = follower->funcs->panel_prepared (follower);if (ret <0 )dev_info (panel->dev,"%ps failed: %d\n" , follower->funcs->panel_prepared, ret); } +if (panel->enabled && follower->funcs->panel_enabled) { + ret = follower->funcs->panel_enabled (follower); +if (ret <0 ) +dev_info (panel->dev,"%ps failed: %d\n" , + follower->funcs->panel_enabled, ret); + }mutex_unlock (&panel->follower_lock);
@@ -587,7 +631,8 @@ EXPORT_SYMBOL(drm_panel_add_follower);* @follower: The panel follower descriptor for the follower. * * Undo drm_panel_add_follower(). This includes calling the follower's -* unprepare function if we're removed from a panel that's currently prepared. +* unpreparing/disabling function if we're removed from a panel that's currently +* prepared/enabled. * * Return: 0 or an error code. */
@@ -598,7 +643,13 @@ void drm_panel_remove_follower(struct drm_panel_follower *follower)mutex_lock (&panel->follower_lock); -if (panel->prepared) { +if (panel->enabled && follower->funcs->panel_disabling) { + ret = follower->funcs->panel_disabling (follower); +if (ret <0 ) +dev_info (panel->dev,"%ps failed: %d\n" , + follower->funcs->panel_disabling, ret); + } +if (panel->prepared && follower->funcs->panel_unpreparing) { ret = follower->funcs->panel_unpreparing (follower);if (ret <0 ) dev_info(panel->dev, "%ps failed: %d\n",
include/drm/drm_panel.h +14 -0
@@ -160,6 +160,20 @@ struct drm_panel_follower_funcs {* Called before the panel is powered off. */ int (*panel_unpreparing)(struct drm_panel_follower *follower); + +/** +* @panel_enabled: +* +* Called after the panel and the backlight have been enabled. +*/ +int (*panel_enabled)(struct drm_panel_follower *follower); + +/** +* @panel_disabling: +* +* Called before the panel and the backlight are disabled. +*/ +int (*panel_disabling)(struct drm_panel_follower *follower); };struct drm_panel_follower {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 265/563 HID: i2c-hid: Make elan touch controllers power on after panel is enabled
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pin-yen Lin <[email protected]>
[ Upstream commit cbdd16b818eef876dd2de9d503fe7397a0666cbe ]
Introduce a new HID quirk to indicate that this device has to be enabled after the panel's backlight is enabled, and update the driver data for the elan devices to enable this quirk. This cannot be a I2C HID quirk because the kernel needs to acknowledge this before powering up the device and read the VID/PID. When this quirk is enabled, register .panel_enabled()/.panel_disabling() instead for the panel follower.
Also rename the *panel_prepare* functions into *panel_follower* because they could be called in other situations now.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 46 ++++++++++++++++----------- drivers/hid/i2c-hid/i2c-hid-of-elan.c | 11 ++++++- include/linux/hid.h | 2 ++ 3 files changed, 40 insertions(+), 19 deletions(-)
drivers/hid/i2c-hid/i2c-hid-core.c +28 -18
@@ -112,9 +112,9 @@ struct i2c_hid {struct i2chid_ops *ops;struct drm_panel_follower panel_follower; -struct work_struct panel_follower_prepare_work; +struct work_struct panel_follower_work;bool is_panel_follower; -bool prepare_work_finished; +bool panel_follower_work_finished; }; static const struct i2c_hid_quirks {
@@ -1110,10 +1110,10 @@ static int i2c_hid_core_probe_panel_follower(struct i2c_hid *ihid)return ret; } -static void ihid_core_panel_prepare_work (struct work_struct *work) +static void ihid_core_panel_follower_work (struct work_struct *work) { struct i2c_hid *ihid = container_of(work, struct i2c_hid, - panel_follower_prepare_work); + panel_follower_work);struct hid_device *hid = ihid->hid;int ret;
@@ -1130,7 +1130,7 @@ static void ihid_core_panel_prepare_work(struct work_struct *work)if (ret)dev_warn (&ihid->client->dev,"Power on failed: %d\n" , ret);else -WRITE_ONCE (ihid->prepare_work_finished, true); +WRITE_ONCE (ihid->panel_follower_work_finished, true);/* * The work APIs provide a number of memory ordering guarantees
@@ -1139,12 +1139,12 @@ static void ihid_core_panel_prepare_work(struct work_struct *work)* guarantee that a write that happened in the work is visible after * cancel_work_sync(). We'll add a write memory barrier here to match * with i2c_hid_core_panel_unpreparing() to ensure that our write to -* prepare_work_finished is visible there. +* panel_follower_work_finished is visible there. */ smp_wmb (); } -static int i2c_hid_core_panel_prepared (struct drm_panel_follower *follower) +static int i2c_hid_core_panel_follower_resume (struct drm_panel_follower *follower) { struct i2c_hid *ihid = container_of(follower, struct i2c_hid, panel_follower);
@@ -1152,29 +1152,36 @@ static int i2c_hid_core_panel_prepared(struct drm_panel_follower *follower)* Powering on a touchscreen can be a slow process. Queue the work to * the system workqueue so we don't block the panel's power up. */ -WRITE_ONCE (ihid->prepare_work_finished, false); -schedule_work (&ihid->panel_follower_prepare_work); +WRITE_ONCE (ihid->panel_follower_work_finished, false); +schedule_work (&ihid->panel_follower_work);return 0 ; } -static int i2c_hid_core_panel_unpreparing (struct drm_panel_follower *follower) +static int i2c_hid_core_panel_follower_suspend (struct drm_panel_follower *follower) { struct i2c_hid *ihid = container_of(follower, struct i2c_hid, panel_follower); -cancel_work_sync (&ihid->panel_follower_prepare_work); +cancel_work_sync (&ihid->panel_follower_work); -/* Match with ihid_core_panel_prepare_work() */ +/* Match with ihid_core_panel_follower_work() */ smp_rmb (); -if (!READ_ONCE (ihid->prepare_work_finished)) +if (!READ_ONCE (ihid->panel_follower_work_finished))return 0 ;return i2c_hid_core_suspend (ihid, true); } -static const struct drm_panel_follower_funcs i2c_hid_core_panel_follower_funcs = { - .panel_prepared = i2c_hid_core_panel_prepared, - .panel_unpreparing = i2c_hid_core_panel_unpreparing, +static const struct drm_panel_follower_funcs + i2c_hid_core_panel_follower_prepare_funcs = { + .panel_prepared = i2c_hid_core_panel_follower_resume, + .panel_unpreparing = i2c_hid_core_panel_follower_suspend, +}; + +static const struct drm_panel_follower_funcs + i2c_hid_core_panel_follower_enable_funcs = { + .panel_enabled = i2c_hid_core_panel_follower_resume, + .panel_disabling = i2c_hid_core_panel_follower_suspend, };static int i2c_hid_core_register_panel_follower (struct i2c_hid *ihid)
@@ -1182,7 +1189,10 @@ static int i2c_hid_core_register_panel_follower(struct i2c_hid *ihid)struct device *dev = &ihid->client->dev;int ret; - ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_funcs; +if (ihid->hid->initial_quirks |HID_QUIRK_POWER_ON_AFTER_BACKLIGHT ) + ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_enable_funcs; +else + ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_prepare_funcs;/* * If we're not in control of our own power up/power down then we can't
@@ -1237,7 +1247,7 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,init_waitqueue_head (&ihid->wait);mutex_init (&ihid->cmd_lock);mutex_init (&ihid->reset_lock); -INIT_WORK (&ihid->panel_follower_prepare_work, ihid_core_panel_prepare_work); +INIT_WORK (&ihid->panel_follower_work, ihid_core_panel_follower_work);/* we need to allocate the command buffer without knowing the maximum * size of the reports. Let's use HID_MIN_BUFFER_SIZE, then we do the
drivers/hid/i2c-hid/i2c-hid-of-elan.c +10 -1
@@ -8,6 +8,7 @@#include <linux/delay.h> #include <linux/device.h> #include <linux/gpio/consumer.h> +#include <linux/hid.h> #include <linux/i2c.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -23,6 +24,7 @@ struct elan_i2c_hid_chip_data {unsigned int post_power_delay_ms;u16 hid_descriptor_address;const char *main_supply_name; +bool power_after_backlight; };struct i2c_hid_of_elan {
@@ -97,6 +99,7 @@ static int i2c_hid_of_elan_probe(struct i2c_client *client) {struct i2c_hid_of_elan *ihid_elan;int ret; +u32 quirks =0 ; ihid_elan =devm_kzalloc (&client->dev,sizeof (*ihid_elan),GFP_KERNEL );if (!ihid_elan)
@@ -131,8 +134,12 @@ static int i2c_hid_of_elan_probe(struct i2c_client *client) } } +if (ihid_elan->chip_data->power_after_backlight) + quirks =HID_QUIRK_POWER_ON_AFTER_BACKLIGHT ; + ret =i2c_hid_core_probe (client, &ihid_elan->ops, - ihid_elan->chip_data->hid_descriptor_address,0 ); + ihid_elan->chip_data->hid_descriptor_address, + quirks);if (ret) goto err_deassert_reset;
@@ -150,6 +157,7 @@ static const struct elan_i2c_hid_chip_data elan_ekth6915_chip_data = { .post_gpio_reset_on_delay_ms = 300, .hid_descriptor_address = 0x0001, .main_supply_name = "vcc33", + .power_after_backlight = true, };static const struct elan_i2c_hid_chip_data elan_ekth6a12nay_chip_data = {
@@ -157,6 +165,7 @@ static const struct elan_i2c_hid_chip_data elan_ekth6a12nay_chip_data = { .post_gpio_reset_on_delay_ms = 300, .hid_descriptor_address = 0x0001, .main_supply_name = "vcc33", + .power_after_backlight = true, };static const struct elan_i2c_hid_chip_data ilitek_ili9882t_chip_data = {
include/linux/hid.h +2 -0
@@ -364,6 +364,7 @@ struct hid_item {* | @HID_QUIRK_HAVE_SPECIAL_DRIVER: * | @HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE: * | @HID_QUIRK_IGNORE_SPECIAL_DRIVER +* | @HID_QUIRK_POWER_ON_AFTER_BACKLIGHT * | @HID_QUIRK_FULLSPEED_INTERVAL: * | @HID_QUIRK_NO_INIT_REPORTS: * | @HID_QUIRK_NO_IGNORE:
@@ -391,6 +392,7 @@ struct hid_item {#define HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE BIT(20)#define HID_QUIRK_NOINVERT BIT(21)#define HID_QUIRK_IGNORE_SPECIAL_DRIVER BIT(22) +#define HID_QUIRK_POWER_ON_AFTER_BACKLIGHT BIT(23)#define HID_QUIRK_FULLSPEED_INTERVAL BIT(28)#define HID_QUIRK_NO_INIT_REPORTS BIT(29)#define HID_QUIRK_NO_IGNORE BIT(30)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 266/563 RDMA/mlx5: Better estimate max_qp_wr to reflect WQE count
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Har-Toov <[email protected]>
[ Upstream commit 1a7c18c485bf17ef408d5ebb7f83e1f8ef329585 ]
The mlx5 driver currently derives max_qp_wr directly from the log_max_qp_sz HCA capability:
props->max_qp_wr = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);
However, this value represents the number of WQEs in units of Basic Blocks (see MLX5_SEND_WQE_BB), not actual number of WQEs. Since the size of a WQE can vary depending on transport type and features (e.g., atomic operations, UMR, LSO), the actual number of WQEs can be significantly smaller than the WQEBB count suggests.
This patch introduces a conservative estimation of the worst-case WQE size — considering largest segments possible with 1 SGE and no inline data or special features. It uses this to derive a more accurate max_qp_wr value.
--- drivers/infiniband/hw/mlx5/main.c | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +47 -1
@@ -13,6 +13,7 @@#include <linux/dma-mapping.h> #include <linux/slab.h> #include <linux/bitmap.h> +#include <linux/log2.h> #include <linux/sched.h> #include <linux/sched/mm.h> #include <linux/sched/task.h>
@@ -883,6 +884,51 @@ static void fill_esw_mgr_reg_c0(struct mlx5_core_dev *mdev, resp->reg_c0.mask =mlx5_eswitch_get_vport_metadata_mask (); } +/* +* Calculate maximum SQ overhead across all QP types. +* Other QP types (REG_UMR, UC, RC, UD/SMI/GSI, XRC_TGT) +* have smaller overhead than the types calculated below, +* so they are implicitly included. +*/ +static u32 mlx5_ib_calc_max_sq_overhead (void ) +{ +u32 max_overhead_xrc, overhead_ud_lso, a, b; + +/* XRC_INI */ + max_overhead_xrc =sizeof (struct mlx5_wqe_xrc_seg ); + max_overhead_xrc +=sizeof (struct mlx5_wqe_ctrl_seg ); + a =sizeof (struct mlx5_wqe_atomic_seg ) + +sizeof (struct mlx5_wqe_raddr_seg ); + b =sizeof (struct mlx5_wqe_umr_ctrl_seg ) + +sizeof (struct mlx5_mkey_seg ) + +MLX5_IB_SQ_UMR_INLINE_THRESHOLD /MLX5_IB_UMR_OCTOWORD ; + max_overhead_xrc +=max (a, b); + +/* UD with LSO */ + overhead_ud_lso =sizeof (struct mlx5_wqe_ctrl_seg ); + overhead_ud_lso +=sizeof (struct mlx5_wqe_eth_pad ); + overhead_ud_lso +=sizeof (struct mlx5_wqe_eth_seg ); + overhead_ud_lso +=sizeof (struct mlx5_wqe_datagram_seg ); + +return max (max_overhead_xrc, overhead_ud_lso); +} + +static u32 mlx5_ib_calc_max_qp_wr (struct mlx5_ib_dev *dev) +{ +struct mlx5_core_dev *mdev = dev->mdev; +u32 max_wqe_bb_units =1 <<MLX5_CAP_GEN (mdev, log_max_qp_sz); +u32 max_wqe_size; +/* max QP overhead + 1 SGE, no inline, no special features */ + max_wqe_size =mlx5_ib_calc_max_sq_overhead () + +sizeof (struct mlx5_wqe_data_seg ); + + max_wqe_size =roundup_pow_of_two (max_wqe_size); + + max_wqe_size =ALIGN (max_wqe_size,MLX5_SEND_WQE_BB ); + +return (max_wqe_bb_units *MLX5_SEND_WQE_BB ) / max_wqe_size; +} +static int mlx5_ib_query_device (struct ib_device *ibdev,struct ib_device_attr *props,struct ib_udata *uhw)
@@ -1041,7 +1087,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, props->max_mr_size = ~0ull ; props->page_size_cap = ~(min_page_size -1 ); props->max_qp =1 <<MLX5_CAP_GEN (mdev, log_max_qp); - props->max_qp_wr =1 <<MLX5_CAP_GEN (mdev, log_max_qp_sz); + props->max_qp_wr =mlx5_ib_calc_max_qp_wr (dev); max_rq_sg =MLX5_CAP_GEN (mdev, max_wqe_sz_rq) /sizeof (struct mlx5_wqe_data_seg ); max_sq_desc =min_t (int,MLX5_CAP_GEN (mdev, max_wqe_sz_sq),512 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 236/563 PCI/pwrctrl: Fix double cleanup on devm_add_action_or_reset() failure
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit ab81f2f79c683c94bac622aafafbe8232e547159 ]
When devm_add_action_or_reset() fails, it calls the passed cleanup function. Hence the caller must not repeat that cleanup.
Replace the "goto err_regulator_free" by the actual freeing, as there will never be a need again for a second user of this label.
--- drivers/pci/pwrctrl/slot.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/pci/pwrctrl/slot.c +3 -9
@@ -49,13 +49,14 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev) ret =regulator_bulk_enable (slot->num_supplies, slot->supplies);if (ret <0 ) {dev_err_probe (dev, ret,"Failed to enable slot regulators\n" ); - goto err_regulator_free; +regulator_bulk_free (slot->num_supplies, slot->supplies); +return ret; } ret =devm_add_action_or_reset (dev, devm_pci_pwrctrl_slot_power_off, slot);if (ret) - goto err_regulator_disable; +return ret; clk =devm_clk_get_optional_enabled (dev,NULL );if (IS_ERR (clk)) {
@@ -70,13 +71,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)return dev_err_probe (dev, ret,"Failed to register pwrctrl driver\n" );return 0 ; - -err_regulator_disable: -regulator_bulk_disable (slot->num_supplies, slot->supplies); -err_regulator_free: -regulator_bulk_free (slot->num_supplies, slot->supplies); - -return ret; }static const struct of_device_id pci_pwrctrl_slot_of_match[] = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 237/563 misc: pci_endpoint_test: Fix array underflow in pci_endpoint_test_ioctl()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 1ad82f9db13d85667366044acdfb02009d576c5a ]
Commit eefb83790a0d ("misc: pci_endpoint_test: Add doorbell test case") added NO_BAR (-1) to the pci_barno enum which, in practical terms, changes the enum from an unsigned int to a signed int. If the user passes a negative number in pci_endpoint_test_ioctl() then it results in an array underflow in pci_endpoint_test_bar().
--- drivers/misc/pci_endpoint_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/pci_endpoint_test.c +1 -1
@@ -937,7 +937,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,switch (cmd) {case PCITEST_BAR : bar = arg; -if (bar >BAR_5 ) +if (bar <=NO_BAR || bar >BAR_5 ) goto ret;if (is_am654_pci_dev (pdev) && bar ==BAR_0 ) goto ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 238/563 serial: max310x: Add error checking in probe()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 672a37ba8af1f2ebcedeb94aea2cdd047f805f30 ]
Check if devm_i2c_new_dummy_device() fails.
--- drivers/tty/serial/max310x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/max310x.c +2 -0
@@ -1644,6 +1644,8 @@ static int max310x_i2c_probe(struct i2c_client *client) port_client =devm_i2c_new_dummy_device (&client->dev, client->adapter, port_addr); +if (IS_ERR (port_client)) +return PTR_ERR (port_client); regcfg_i2c.name =max310x_regmap_name (i); regmaps[i] =devm_regmap_init_i2c (port_client, ®cfg_i2c);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 239/563 drm/amd/display: Remove redundant semicolons
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Yuanhong <[email protected]>
[ Upstream commit 90b810dd859c0df9db2290da1ac5842e5f031267 ]
Remove unnecessary semicolons.
--- .../gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c +0 -1
@@ -139,7 +139,6 @@ void dml32_rq_dlg_get_rq_reg(display_rq_regs_st *rq_regs,if (dual_plane) {unsigned int p1_pte_row_height_linear =get_dpte_row_height_linear_c (mode_lib, e2e_pipe_param, num_pipes, pipe_idx); - ;if (src->sw_mode == dm_sw_linear)ASSERT (p1_pte_row_height_linear >=8 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 240/563 drm/amd/display: Add NULL pointer checks in dc_stream cursor attribute functions
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit bf4e4b97d0fdc66f04fc19d807e24dd8421b8f11 ]
The function dc_stream_set_cursor_attributes() currently dereferences the stream pointer and nested members stream->ctx->dc->current_state without checking for NULL.
All callers of these functions, such as in dcn30_apply_idle_power_optimizations() and amdgpu_dm_plane_handle_cursor_update(), already perform NULL checks before calling these functions.
Fixes below:drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:336 dc_stream_program_cursor_attributes()
error: we previously assumed 'stream' could be null (see line 334)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c
327 bool dc_stream_program_cursor_attributes(
328 struct dc_stream_state *stream,
329 const struct dc_cursor_attributes *attributes)
330 {
331 struct dc *dc;
332 bool reset_idle_optimizations = false;
333
334 dc = stream ? stream->ctx->dc : NULL;
^^^^^^The old code assumed stream could be NULL.
335
--> 336 if (dc_stream_set_cursor_attributes(stream, attributes)) {
^^^^^^The refactor added an unchecked dereference.
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c
313 bool dc_stream_set_cursor_attributes(
314 struct dc_stream_state *stream,
315 const struct dc_cursor_attributes *attributes)
316 {
317 bool result = false;
318
319 if (dc_stream_check_cursor_attributes(stream, stream->ctx->dc->current_state, attributes)) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here.This function used to check for if stream as NULL and return false at the start. Probably we should add that back.
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +7 -1
@@ -316,6 +316,9 @@ bool dc_stream_set_cursor_attributes( {bool result = false; +if (!stream) +return false; +if (dc_stream_check_cursor_attributes (stream, stream->ctx->dc->current_state, attributes)) { stream->cursor_attributes = *attributes; result = true;
@@ -331,7 +334,10 @@ bool dc_stream_program_cursor_attributes(struct dc *dc;bool reset_idle_optimizations = false; - dc = stream ? stream->ctx->dc :NULL ; +if (!stream) +return false; + + dc = stream->ctx->dc;if (dc_stream_set_cursor_attributes (stream, attributes)) {dc_z10_restore (dc);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 241/563 crypto: keembay - Add missing check after sg_nents_for_len()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 4e53be21dd0315c00eaf40cc8f8c0facd4d9a6b2 ]
sg_nents_for_len() returns an int which is negative in case of error.
--- drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c +4 -1
@@ -232,7 +232,7 @@ static int kmb_ocs_dma_prepare(struct ahash_request *req)struct device *dev = rctx->hcu_dev->dev;unsigned int remainder =0 ;unsigned int total; -size_t nents; +int nents;size_t count;int rc;int i;
@@ -253,6 +253,9 @@ static int kmb_ocs_dma_prepare(struct ahash_request *req)/* Determine the number of scatter gather list entries to process. */ nents =sg_nents_for_len (req->src, rctx->sg_data_total - remainder); +if (nents <0 ) +return nents; +/* If there are entries to process, map them. */ if (nents) { rctx->sg_dma_nents = dma_map_sg(dev, req->src, nents,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 232/563 phy: rockchip: naneng-combphy: Enable U3 OTG port for RK3568
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 7bb14b61b7d03db770b7e8871493f5b9b2be2b79 ]
The boot firmware may disable the U3 port early during boot and leave it up to the controller or PHY driver to re-enable U3 when needed.
The Rockchip USBDP PHY driver currently does this for RK3576 and RK3588, something the Rockchip Naneng Combo PHY driver never does for RK3568. This may result in USB 3.0 ports being limited to only using USB 2.0 or in special cases not working at all on RK3568.
Write to PIPE_GRF USB3OTGx_CON1 reg to ensure the U3 port is enabled when a PHY with PHY_TYPE_USB3 mode is used.
--- drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +12 -0
@@ -137,6 +137,8 @@ struct rockchip_combphy_grfcfg {struct combphy_reg pipe_xpcs_phy_ready;struct combphy_reg pipe_pcie1l0_sel;struct combphy_reg pipe_pcie1l1_sel; +struct combphy_reg u3otg0_port_en; +struct combphy_reg u3otg1_port_en; };struct rockchip_combphy_cfg {
@@ -594,6 +596,14 @@ static int rk3568_combphy_cfg(struct rockchip_combphy_priv *priv)rockchip_combphy_param_write (priv->phy_grf, &cfg->pipe_txcomp_sel, false);rockchip_combphy_param_write (priv->phy_grf, &cfg->pipe_txelec_sel, false);rockchip_combphy_param_write (priv->phy_grf, &cfg->usb_mode_set, true); +switch (priv->id) { +case 0 : +rockchip_combphy_param_write (priv->pipe_grf, &cfg->u3otg0_port_en, true); +break ; +case 1 : +rockchip_combphy_param_write (priv->pipe_grf, &cfg->u3otg1_port_en, true); +break ; + }break ;case PHY_TYPE_SATA :
@@ -737,6 +747,8 @@ static const struct rockchip_combphy_grfcfg rk3568_combphy_grfcfgs = {/* pipe-grf */ .pipe_con0_for_sata = { 0x0000, 15, 0, 0x00, 0x2220 }, .pipe_xpcs_phy_ready = { 0x0040, 2, 2, 0x00, 0x01 }, + .u3otg0_port_en = { 0x0104, 15, 0, 0x0181, 0x1100 }, + .u3otg1_port_en = { 0x0144, 15, 0, 0x0181, 0x1100 }, }; static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 268/563 wifi: rtw88: Use led->brightness_set_blocking for PCI too
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit fce6fee0817b8899e0ee38ab6b98f0d7e939ceed ]
Commit 26a8bf978ae9 ("wifi: rtw88: Lock rtwdev->mutex before setting the LED") made rtw_led_set() sleep, but that's not allowed. Fix it by using the brightness_set_blocking member of struct led_classdev for PCI devices too. This one is allowed to sleep.
bad: scheduling from the idle thread! nix kernel: CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Tainted: G W O 6.16.0 #1-NixOS PREEMPT(voluntary) nix kernel: Tainted: [W]=WARN, [O]=OOT_MODULE nix kernel: Hardware name: [REDACTED] nix kernel: Call Trace: nix kernel: <IRQ> nix kernel: dump_stack_lvl+0x63/0x90 nix kernel: dequeue_task_idle+0x2d/0x50 nix kernel: __schedule+0x191/0x1310 nix kernel: ? xas_load+0x11/0xd0 nix kernel: schedule+0x2b/0xe0 nix kernel: schedule_preempt_disabled+0x19/0x30 nix kernel: __mutex_lock.constprop.0+0x3fd/0x7d0 nix kernel: rtw_led_set+0x27/0x60 [rtw_core] nix kernel: led_blink_set_nosleep+0x56/0xb0 nix kernel: led_trigger_blink+0x49/0x80 nix kernel: ? __pfx_tpt_trig_timer+0x10/0x10 [mac80211] nix kernel: call_timer_fn+0x2f/0x140 nix kernel: ? __pfx_tpt_trig_timer+0x10/0x10 [mac80211] nix kernel: __run_timers+0x21a/0x2b0 nix kernel: run_timer_softirq+0x8e/0x100 nix kernel: handle_softirqs+0xea/0x2c0 nix kernel: ? srso_alias_return_thunk+0x5/0xfbef5 nix kernel: __irq_exit_rcu+0xdc/0x100 nix kernel: sysvec_apic_timer_interrupt+0x7c/0x90 nix kernel: </IRQ> nix kernel: <TASK> nix kernel: asm_sysvec_apic_timer_interrupt+0x1a/0x20 nix kernel: RIP: 0010:cpuidle_enter_state+0xcc/0x450 nix kernel: Code: 00 e8 08 7c 2e ff e8 d3 ee ff ff 49 89 c6 0f 1f 44 00 00 31 ff e8 c4 d1 2c ff 80 7d d7 00 0f 85 5d 02 00 00 fb 0f 1f 44 00 00 <45> 85 ff 0f 88 a0 01 00 00 49 63 f7 4c 89 f2 48 8d 0> nix kernel: RSP: 0018:ffffd579801c7e68 EFLAGS: 00000246 nix kernel: RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000000000 nix kernel: RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 nix kernel: RBP: ffffd579801c7ea0 R08: 0000000000000000 R09: 0000000000000000 nix kernel: R10: 0000000000000000 R11: 0000000000000000 R12: ffff8eab0462a400 nix kernel: R13: ffffffff9a7d7a20 R14: 00000003aebe751d R15: 0000000000000003 nix kernel: ? cpuidle_enter_state+0xbc/0x450 nix kernel: cpuidle_enter+0x32/0x50 nix kernel: do_idle+0x1b1/0x210 nix kernel: cpu_startup_entry+0x2d/0x30 nix kernel: start_secondary+0x118/0x140 nix kernel: common_startup_64+0x13e/0x141 nix kernel: </TASK>
--- drivers/net/wireless/realtek/rtw88/led.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/net/wireless/realtek/rtw88/led.c +3 -12
@@ -6,8 +6,8 @@#include "debug.h" #include "led.h" -static void rtw_led_set (struct led_classdev *led, -enum led_brightness brightness) +static int rtw_led_set (struct led_classdev *led, +enum led_brightness brightness) { struct rtw_dev *rtwdev = container_of(led, struct rtw_dev, led_cdev);
@@ -16,12 +16,6 @@ static void rtw_led_set(struct led_classdev *led, rtwdev->chip->ops->led_set (led, brightness);mutex_unlock (&rtwdev->mutex); -} - -static int rtw_led_set_blocking (struct led_classdev *led, -enum led_brightness brightness) -{ -rtw_led_set (led, brightness);return 0 ; }
@@ -46,10 +40,7 @@ void rtw_led_init(struct rtw_dev *rtwdev)if (!rtwdev->chip->ops->led_set)return ; -if (rtw_hci_type (rtwdev) ==RTW_HCI_TYPE_PCIE ) - led->brightness_set = rtw_led_set; -else - led->brightness_set_blocking = rtw_led_set_blocking; + led->brightness_set_blocking = rtw_led_set;snprintf (rtwdev->led_name,sizeof (rtwdev->led_name),"rtw88-%s" ,dev_name (rtwdev->dev));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 277/563 ALSA: lx_core: use int type to store negative error codes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qianfeng Rong <[email protected]>
[ Upstream commit 4ef353d546cda466fc39b7daca558d7bcec21c09 ]
Change the 'ret' variable from u16 to int to store negative error codes or zero returned by lx_message_send_atomic().
Storing the negative error codes in unsigned type, doesn't cause an issue at runtime but it's ugly as pants. Additionally, assigning negative error codes to unsigned type may trigger a GCC warning when the -Wsign-conversion flag is enabled.
No effect on runtime.
--- sound/pci/lx6464es/lx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/lx6464es/lx_core.c +2 -2
@@ -316,7 +316,7 @@ static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh)/* low-level dsp access */ int lx_dsp_get_version (struct lx6464es *chip,u32 *rdsp_version) { -u16 ret; +int ret;mutex_lock (&chip->msg_lock);
@@ -330,10 +330,10 @@ int lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version)int lx_dsp_get_clock_frequency (struct lx6464es *chip,u32 *rfreq) { -u16 ret =0 ;u32 freq_raw =0 ;u32 freq =0 ;u32 frequency =0 ; +int ret;mutex_lock (&chip->msg_lock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 278/563 media: st-delta: avoid excessive stack usage
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 5954ad7d1af92cb6244c5f31216e43af55febbb7 ]
Building with a reduced stack warning limit shows that delta_mjpeg_decode() copies a giant structure to the stack each time but only uses three of its members:
drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c: In function 'delta_mjpeg_decode':drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c:427:1: error: the frame size of 1296 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
Open-code the passing of the structure members that are actually used here.
--- .../platform/st/sti/delta/delta-mjpeg-dec.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c +11 -9
@@ -239,7 +239,7 @@ static int delta_mjpeg_ipc_open(struct delta_ctx *pctx)return 0 ; } -static int delta_mjpeg_ipc_decode (struct delta_ctx *pctx,struct delta_au *au) +static int delta_mjpeg_ipc_decode (struct delta_ctx *pctx,dma_addr_t pstart,dma_addr_t pend) {struct delta_dev *delta = pctx->dev;struct delta_mjpeg_ctx *ctx =to_ctx (pctx);
@@ -256,8 +256,8 @@ static int delta_mjpeg_ipc_decode(struct delta_ctx *pctx, struct delta_au *au)memset (params,0 ,sizeof (*params)); - params->picture_start_addr_p = (u32)(au->paddr); - params->picture_end_addr_p = (u32)(au->paddr + au->size -1 ); + params->picture_start_addr_p = pstart; + params->picture_end_addr_p = pend;/* * !WARNING!
@@ -374,12 +374,14 @@ static int delta_mjpeg_decode(struct delta_ctx *pctx, struct delta_au *pau)struct delta_dev *delta = pctx->dev;struct delta_mjpeg_ctx *ctx =to_ctx (pctx);int ret; -struct delta_au au = *pau; +void *au_vaddr = pau->vaddr; +dma_addr_t au_dma = pau->paddr; +size_t au_size = pau->size;unsigned int data_offset =0 ;struct mjpeg_header *header = &ctx->header_struct;if (!ctx->header) { - ret =delta_mjpeg_read_header (pctx, au.vaddr, au.size, + ret =delta_mjpeg_read_header (pctx, au_vaddr, au_size, header, &data_offset);if (ret) { pctx->stream_errors++;
@@ -405,17 +407,17 @@ static int delta_mjpeg_decode(struct delta_ctx *pctx, struct delta_au *pau) goto err; } - ret =delta_mjpeg_read_header (pctx, au.vaddr, au.size, + ret =delta_mjpeg_read_header (pctx, au_vaddr, au_size, ctx->header, &data_offset);if (ret) { pctx->stream_errors++; goto err; } - au.paddr += data_offset; - au.vaddr += data_offset; + au_dma += data_offset; + au_vaddr += data_offset; - ret =delta_mjpeg_ipc_decode (pctx, &au); + ret =delta_mjpeg_ipc_decode (pctx, au_dma, au_dma + au_size -1 );if (ret) goto err;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 279/563 drm/amdgpu/vcn: Add regdump helper functions
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sathishkumar S <[email protected]>
[ Upstream commit de55cbff5ce93c316b0113535752e43079761f2c ]
Add generic helper functions for vcn devcoredump support which can be re-used for all vcn versions.
Stable-dep-of: 9c0442286f84 ("drm/amdgpu: Check vcn state before profile switch")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 87 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 8 +++ 2 files changed, 95 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +87 -0
@@ -92,6 +92,7 @@ MODULE_FIRMWARE(FIRMWARE_VCN5_0_0);MODULE_FIRMWARE (FIRMWARE_VCN5_0_1 );static void amdgpu_vcn_idle_work_handler (struct work_struct *work); +static void amdgpu_vcn_reg_dump_fini (struct amdgpu_device *adev);int amdgpu_vcn_early_init (struct amdgpu_device *adev,int i) {
@@ -285,6 +286,10 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev, int i)amdgpu_ucode_release (&adev->vcn.inst[0 ].fw); adev->vcn.inst[i].fw =NULL ; } + +if (adev->vcn.reg_list) +amdgpu_vcn_reg_dump_fini (adev); +mutex_destroy (&adev->vcn.inst[i].vcn_pg_lock);mutex_destroy (&adev->vcn.inst[i].vcn1_jpeg1_workaround);
@@ -1527,3 +1532,85 @@ int amdgpu_vcn_ring_reset(struct amdgpu_ring *ring,return amdgpu_vcn_reset_engine (adev, ring->me); } + +int amdgpu_vcn_reg_dump_init (struct amdgpu_device *adev, +const struct amdgpu_hwip_reg_entry *reg,u32 count) +{ + adev->vcn.ip_dump =kcalloc (adev->vcn.num_vcn_inst * count, +sizeof (uint32_t ),GFP_KERNEL ); +if (!adev->vcn.ip_dump) +return -ENOMEM ; + adev->vcn.reg_list = reg; + adev->vcn.reg_count = count; + +return 0 ; +} + +static void amdgpu_vcn_reg_dump_fini (struct amdgpu_device *adev) +{ +kfree (adev->vcn.ip_dump); + adev->vcn.reg_list =NULL ; + adev->vcn.reg_count =0 ; +} + +void amdgpu_vcn_dump_ip_state (struct amdgpu_ip_block *ip_block) +{ +struct amdgpu_device *adev = ip_block->adev; +int i, j; +bool is_powered; +u32 inst_off; + +if (!adev->vcn.ip_dump) +return ; + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + inst_off = i * adev->vcn.reg_count; +/* mmUVD_POWER_STATUS is always readable and is the first in reg_list */ + adev->vcn.ip_dump[inst_off] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (adev->vcn.reg_list[0 ], i)); + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF ) != +UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF ; + +if (is_powered) +for (j =1 ; j < adev->vcn.reg_count; j++) + adev->vcn.ip_dump[inst_off + j] = +RREG32 (SOC15_REG_ENTRY_OFFSET_INST (adev->vcn.reg_list[j], i)); + } +} + +void amdgpu_vcn_print_ip_state (struct amdgpu_ip_block *ip_block,struct drm_printer *p) +{ +struct amdgpu_device *adev = ip_block->adev; +int i, j; +bool is_powered; +u32 inst_off; + +if (!adev->vcn.ip_dump) +return ; + +drm_printf (p,"num_instances:%d\n" , adev->vcn.num_vcn_inst); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) { +drm_printf (p,"\nHarvested Instance:VCN%d Skipping dump\n" , i); +continue ; + } + + inst_off = i * adev->vcn.reg_count; + is_powered = (adev->vcn.ip_dump[inst_off] & +UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF ) != +UVD_POWER_STATUS__UVD_POWER_STATUS_TILES_OFF ; + +if (is_powered) { +drm_printf (p,"\nActive Instance:VCN%d\n" , i); +for (j =0 ; j < adev->vcn.reg_count; j++) +drm_printf (p,"%-50s \t 0x%08x\n" , adev->vcn.reg_list[j].reg_name, + adev->vcn.ip_dump[inst_off + j]); + }else { +drm_printf (p,"\nInactive Instance:VCN%d\n" , i); + } + } +}
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +8 -0
@@ -237,6 +237,8 @@#define AMDGPU_DRM_KEY_INJECT_WORKAROUND_VCNFW_ASD_HANDSHAKING 2 +struct amdgpu_hwip_reg_entry ; +enum amdgpu_vcn_caps {AMDGPU_VCN_RRMT_ENABLED , };
@@ -362,6 +364,8 @@ struct amdgpu_vcn {bool workload_profile_active;struct mutex workload_profile_mutex; +u32 reg_count; +const struct amdgpu_hwip_reg_entry *reg_list; };struct amdgpu_fw_shared_rb_ptrs_struct {
@@ -557,4 +561,8 @@ int vcn_set_powergating_state(struct amdgpu_ip_block *ip_block,int amdgpu_vcn_ring_reset (struct amdgpu_ring *ring,unsigned int vmid,struct amdgpu_fence *guilty_fence); +int amdgpu_vcn_reg_dump_init (struct amdgpu_device *adev, +const struct amdgpu_hwip_reg_entry *reg,u32 count); +void amdgpu_vcn_dump_ip_state (struct amdgpu_ip_block *ip_block); +void amdgpu_vcn_print_ip_state (struct amdgpu_ip_block *ip_block,struct drm_printer *p);#endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 280/563 drm/amdgpu/vcn: Hold pg_lock before vcn power off
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sathishkumar S <[email protected]>
[ Upstream commit 111821e4b5a3105c42c7c99f4abd4d8af9f64248 ]
Acquire vcn_pg_lock before changes to vcn power state and release it after power off in idle work handler.
Stable-dep-of: 9c0442286f84 ("drm/amdgpu: Check vcn state before profile switch")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -0
@@ -443,7 +443,9 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work) fences += fence[i];if (!fences && !atomic_read (&vcn_inst->total_submission_cnt)) { +mutex_lock (&vcn_inst->vcn_pg_lock); vcn_inst->set_pg_state (vcn_inst,AMD_PG_STATE_GATE ); +mutex_unlock (&vcn_inst->vcn_pg_lock);mutex_lock (&adev->vcn.workload_profile_mutex);if (adev->vcn.workload_profile_active) { r = amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 281/563 drm/amdgpu: Check vcn state before profile switch
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 9c0442286f84a5036958b3d8eb00bf0bb070dbd1 ]
The patch uses power state of VCN instances for requesting video profile.
In idle worker of a vcn instance, when there is no outstanding submisssion or fence, the instance is put to power gated state. When all instances are powered off that means video profile is no longer required. A request is made to turn off video profile.
A job submission starts with begin_use of ring, and at that time vcn instance state is changed to power on. Subsequently a check is made for active video profile, and if not active, a request is made.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 80 ++++++++++++++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 + drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 27 +-------- 3 files changed, 56 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +51 -29
@@ -410,6 +410,54 @@ int amdgpu_vcn_resume(struct amdgpu_device *adev, int i)return 0 ; } +void amdgpu_vcn_get_profile (struct amdgpu_device *adev) +{ +int r; + +mutex_lock (&adev->vcn.workload_profile_mutex); + +if (adev->vcn.workload_profile_active) { +mutex_unlock (&adev->vcn.workload_profile_mutex); +return ; + } + r =amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , + true); +if (r) +dev_warn (adev->dev, +"(%d) failed to enable video power profile mode\n" , r); +else + adev->vcn.workload_profile_active = true; +mutex_unlock (&adev->vcn.workload_profile_mutex); +} + +void amdgpu_vcn_put_profile (struct amdgpu_device *adev) +{ +bool pg = true; +int r, i; + +mutex_lock (&adev->vcn.workload_profile_mutex); +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.inst[i].cur_state !=AMD_PG_STATE_GATE ) { + pg = false; +break ; + } + } + +if (pg) { + r =amdgpu_dpm_switch_power_profile ( + adev,PP_SMC_POWER_PROFILE_VIDEO , false); +if (r) +dev_warn ( + adev->dev, +"(%d) failed to disable video power profile mode\n" , + r); +else + adev->vcn.workload_profile_active = false; + } + +mutex_unlock (&adev->vcn.workload_profile_mutex); +} +static void amdgpu_vcn_idle_work_handler (struct work_struct *work) { struct amdgpu_vcn_inst *vcn_inst =
@@ -417,7 +465,6 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)struct amdgpu_device *adev = vcn_inst->adev;unsigned int fences =0 , fence[AMDGPU_MAX_VCN_INSTANCES ] = {0 };unsigned int i = vcn_inst->inst, j; -int r =0 ;if (adev->vcn.harvest_config & (1 << i))return ;
@@ -446,15 +493,8 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)mutex_lock (&vcn_inst->vcn_pg_lock); vcn_inst->set_pg_state (vcn_inst,AMD_PG_STATE_GATE );mutex_unlock (&vcn_inst->vcn_pg_lock); -mutex_lock (&adev->vcn.workload_profile_mutex); -if (adev->vcn.workload_profile_active) { - r =amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , - false); -if (r) -dev_warn (adev->dev,"(%d) failed to disable video power profile mode\n" , r); - adev->vcn.workload_profile_active = false; - } -mutex_unlock (&adev->vcn.workload_profile_mutex); +amdgpu_vcn_put_profile (adev); + }else {schedule_delayed_work (&vcn_inst->idle_work,VCN_IDLE_TIMEOUT ); }
@@ -464,30 +504,11 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev;struct amdgpu_vcn_inst *vcn_inst = &adev->vcn.inst[ring->me]; -int r =0 ;atomic_inc (&vcn_inst->total_submission_cnt);cancel_delayed_work_sync (&vcn_inst->idle_work); -/* We can safely return early here because we've cancelled the -* the delayed work so there is no one else to set it to false -* and we don't care if someone else sets it to true. -*/ -if (adev->vcn.workload_profile_active) - goto pg_lock; - -mutex_lock (&adev->vcn.workload_profile_mutex); -if (!adev->vcn.workload_profile_active) { - r =amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , - true); -if (r) -dev_warn (adev->dev,"(%d) failed to switch to video power profile mode\n" , r); - adev->vcn.workload_profile_active = true; - } -mutex_unlock (&adev->vcn.workload_profile_mutex); - -pg_lock:mutex_lock (&vcn_inst->vcn_pg_lock); vcn_inst->set_pg_state (vcn_inst,AMD_PG_STATE_UNGATE );
@@ -515,6 +536,7 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring) vcn_inst->pause_dpg_mode (vcn_inst, &new_state); }mutex_unlock (&vcn_inst->vcn_pg_lock); +amdgpu_vcn_get_profile (adev); }void amdgpu_vcn_ring_end_use (struct amdgpu_ring *ring)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
@@ -565,4 +565,7 @@ int amdgpu_vcn_reg_dump_init(struct amdgpu_device *adev, const struct amdgpu_hwip_reg_entry *reg, u32 count);void amdgpu_vcn_dump_ip_state (struct amdgpu_ip_block *ip_block);void amdgpu_vcn_print_ip_state (struct amdgpu_ip_block *ip_block,struct drm_printer *p); +void amdgpu_vcn_get_profile (struct amdgpu_device *adev); +void amdgpu_vcn_put_profile (struct amdgpu_device *adev); +#endif
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +2 -25
@@ -116,7 +116,6 @@ static void vcn_v2_5_idle_work_handler(struct work_struct *work)struct amdgpu_device *adev = vcn_inst->adev;unsigned int fences =0 , fence[AMDGPU_MAX_VCN_INSTANCES ] = {0 };unsigned int i, j; -int r =0 ;for (i =0 ; i < adev->vcn.num_vcn_inst; ++i) {struct amdgpu_vcn_inst *v = &adev->vcn.inst[i];
@@ -149,15 +148,7 @@ static void vcn_v2_5_idle_work_handler(struct work_struct *work)if (!fences && !atomic_read (&adev->vcn.inst[0 ].total_submission_cnt)) {amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_GATE ); -mutex_lock (&adev->vcn.workload_profile_mutex); -if (adev->vcn.workload_profile_active) { - r =amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , - false); -if (r) -dev_warn (adev->dev,"(%d) failed to disable video power profile mode\n" , r); - adev->vcn.workload_profile_active = false; - } -mutex_unlock (&adev->vcn.workload_profile_mutex); +amdgpu_vcn_put_profile (adev); }else {schedule_delayed_work (&adev->vcn.inst[0 ].idle_work,VCN_IDLE_TIMEOUT ); }
@@ -167,7 +158,6 @@ static void vcn_v2_5_ring_begin_use(struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev;struct amdgpu_vcn_inst *v = &adev->vcn.inst[ring->me]; -int r =0 ;atomic_inc (&adev->vcn.inst[0 ].total_submission_cnt);
@@ -177,20 +167,6 @@ static void vcn_v2_5_ring_begin_use(struct amdgpu_ring *ring)* the delayed work so there is no one else to set it to false * and we don't care if someone else sets it to true. */ -if (adev->vcn.workload_profile_active) - goto pg_lock; - -mutex_lock (&adev->vcn.workload_profile_mutex); -if (!adev->vcn.workload_profile_active) { - r =amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , - true); -if (r) -dev_warn (adev->dev,"(%d) failed to switch to video power profile mode\n" , r); - adev->vcn.workload_profile_active = true; - } -mutex_unlock (&adev->vcn.workload_profile_mutex); - -pg_lock:mutex_lock (&adev->vcn.inst[0 ].vcn_pg_lock);amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_UNGATE );
@@ -218,6 +194,7 @@ static void vcn_v2_5_ring_begin_use(struct amdgpu_ring *ring) v->pause_dpg_mode (v, &new_state); }mutex_unlock (&adev->vcn.inst[0 ].vcn_pg_lock); +amdgpu_vcn_get_profile (adev); }static void vcn_v2_5_ring_end_use (struct amdgpu_ring *ring)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 282/563 accel/amdxdna: Use int instead of u32 to store error codes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qianfeng Rong <[email protected]>
[ Upstream commit 24de3daf6179bce3710527b8292d7ee6f1b56393 ]
Change the 'ret' variable from u32 to int to store -EINVAL. Storing the negative error codes in unsigned type, doesn't cause an issue at runtime but it's ugly as pants.
Additionally, assigning -EINVAL to u32 ret (i.e., u32 ret = -EINVAL) may trigger a GCC warning when the -Wsign-conversion flag is enabled.
--- drivers/accel/amdxdna/aie2_ctx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/accel/amdxdna/aie2_ctx.c +3 -3
@@ -192,7 +192,7 @@ aie2_sched_resp_handler(void *handle, void __iomem *data, size_t size) {struct amdxdna_sched_job *job = handle;struct amdxdna_gem_obj *cmd_abo; -u32 ret =0 ; +int ret =0 ;u32 status; cmd_abo = job->cmd_bo;
@@ -222,7 +222,7 @@ static int aie2_sched_nocmd_resp_handler(void *handle, void __iomem *data, size_t size) {struct amdxdna_sched_job *job = handle; -u32 ret =0 ; +int ret =0 ;u32 status;if (unlikely (!data))
@@ -250,7 +250,7 @@ aie2_sched_cmdlist_resp_handler(void *handle, void __iomem *data, size_t size)u32 fail_cmd_status;u32 fail_cmd_idx;u32 cmd_status; -u32 ret =0 ; +int ret =0 ; cmd_abo = job->cmd_bo;if (unlikely (!data) ||unlikely (size !=sizeof (u32) *3 )) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 283/563 efi: Explain OVMF acronym in OVMF_DEBUG_LOG help text
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 05e75ac35ee9e38f96bbfebf1830ec2cace2e7f8 ]
People not very intimate with EFI may not know the meaning of the OVMF acronym. Write it in full, to help users with making good decisions when configuring their kernels.
--- drivers/firmware/efi/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/firmware/efi/Kconfig +4 -3
@@ -267,9 +267,10 @@ config OVMF_DEBUG_LOG bool "Expose OVMF firmware debug log via sysfs" depends on EFI help - Recent OVMF versions (edk2-stable202508 + newer) can write - their debug log to a memory buffer. This driver exposes the - log content via sysfs (/sys/firmware/efi/ovmf_debug_log). + Recent versions of the Open Virtual Machine Firmware + (edk2-stable202508 + newer) can write their debug log to a memory + buffer. This driver exposes the log content via sysfs + (/sys/firmware/efi/ovmf_debug_log). config UNACCEPTED_MEMORY bool
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 284/563 net: dst: introduce dst->dev_rcu
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit caedcc5b6df1b2e2b5f39079e3369c1d4d5c5f50 ]
Followup of commit 88fe14253e18 ("net: dst: add four helpers to annotate data-races around dst->dev").
We want to gradually add explicit RCU protection to dst->dev, including lockdep support.
Add an union to alias dst->dev_rcu and dst->dev.
Add dst_dev_net_rcu() helper.
--- include/net/dst.h | 16 +++++++++++----- net/core/dst.c | 2 +- net/ipv4/route.c | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-)
include/net/dst.h +11 -5
@@ -24,7 +24,10 @@struct sk_buff ;struct dst_entry { -struct net_device *dev; +union { +struct net_device *dev; +struct net_device __rcu *dev_rcu; + };struct dst_ops *ops;unsigned long _metrics;unsigned long expires;
@@ -570,9 +573,12 @@ static inline struct net_device *dst_dev(const struct dst_entry *dst)static inline struct net_device *dst_dev_rcu (const struct dst_entry *dst) { -/* In the future, use rcu_dereference(dst->dev) */ -WARN_ON_ONCE (!rcu_read_lock_held ()); -return READ_ONCE (dst->dev); +return rcu_dereference (dst->dev_rcu); +} + +static inline struct net *dst_dev_net_rcu (const struct dst_entry *dst) +{ +return dev_net_rcu (dst_dev_rcu (dst)); }static inline struct net_device *skb_dst_dev (const struct sk_buff *skb)
@@ -592,7 +598,7 @@ static inline struct net *skb_dst_dev_net(const struct sk_buff *skb)static inline struct net *skb_dst_dev_net_rcu (const struct sk_buff *skb) { -return dev_net_rcu (skb_dst_dev (skb)); +return dev_net_rcu (skb_dst_dev_rcu (skb)); }struct dst_entry *dst_blackhole_check (struct dst_entry *dst,u32 cookie);
net/core/dst.c +1 -1
@@ -150,7 +150,7 @@ void dst_dev_put(struct dst_entry *dst) dst->ops->ifdown (dst, dev);WRITE_ONCE (dst->input, dst_discard);WRITE_ONCE (dst->output, dst_discard_out); -WRITE_ONCE (dst->dev, blackhole_netdev); +rcu_assign_pointer (dst->dev_rcu, blackhole_netdev);netdev_ref_replace (dev, blackhole_netdev, &dst->dev_tracker,GFP_ATOMIC ); }
net/ipv4/route.c +2 -2
@@ -1026,7 +1026,7 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)return ;rcu_read_lock (); - net =dev_net_rcu (dst_dev (dst)); + net =dst_dev_net_rcu (dst);if (mtu < net->ipv4.ip_rt_min_pmtu) { lock = true; mtu =min (old_mtu, net->ipv4.ip_rt_min_pmtu);
@@ -1326,7 +1326,7 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst)struct net *net;rcu_read_lock (); - net =dev_net_rcu (dst_dev (dst)); + net =dst_dev_net_rcu (dst); advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, net->ipv4.ip_rt_min_advmss);rcu_read_unlock ();
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 285/563 ipv6: mcast: Add ip6_mc_find_idev() helper
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yue Haibing <[email protected]>
[ Upstream commit 60c481d4caa569001c708d4e9622d19650b6bedc ]
Extract the same code logic from __ipv6_sock_mc_join() and ip6_mc_find_dev(), also add new helper ip6_mc_find_idev() to reduce redundancy and enhance readability.
No functional changes intended.
Stable-dep-of: b775ecf1655c ("ipv6: start using dst_dev_rcu()")
--- net/ipv6/mcast.c | 67 ++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 36 deletions(-)
net/ipv6/mcast.c +31 -36
@@ -169,6 +169,29 @@ static int unsolicited_report_interval(struct inet6_dev *idev)return iv >0 ? iv :1 ; } +static struct net_device *ip6_mc_find_dev (struct net *net, +const struct in6_addr *group, +int ifindex) +{ +struct net_device *dev =NULL ; +struct rt6_info *rt; + +if (ifindex ==0 ) { +rcu_read_lock (); + rt =rt6_lookup (net, group,NULL ,0 ,NULL ,0 ); +if (rt) { + dev =dst_dev (&rt->dst); +dev_hold (dev); +ip6_rt_put (rt); + } +rcu_read_unlock (); + }else { + dev =dev_get_by_index (net, ifindex); + } + +return dev; +} +/* * socket join on multicast group */
@@ -191,28 +214,13 @@ static int __ipv6_sock_mc_join(struct sock *sk, int ifindex, } mc_lst =sock_kmalloc (sk,sizeof (struct ipv6_mc_socklist ),GFP_KERNEL ); -if (!mc_lst)return -ENOMEM ; mc_lst->next =NULL ; mc_lst->addr = *addr; -if (ifindex ==0 ) { -struct rt6_info *rt; - -rcu_read_lock (); - rt =rt6_lookup (net, addr,NULL ,0 ,NULL ,0 ); -if (rt) { - dev =dst_dev (&rt->dst); -dev_hold (dev); -ip6_rt_put (rt); - } -rcu_read_unlock (); - }else { - dev =dev_get_by_index (net, ifindex); - } - + dev =ip6_mc_find_dev (net, addr, ifindex);if (!dev) {sock_kfree_s (sk, mc_lst,sizeof (*mc_lst));return -ENODEV ;
@@ -302,27 +310,14 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) }EXPORT_SYMBOL (ipv6_sock_mc_drop); -static struct inet6_dev *ip6_mc_find_dev (struct net *net, -const struct in6_addr *group, -int ifindex) +static struct inet6_dev *ip6_mc_find_idev (struct net *net, +const struct in6_addr *group, +int ifindex) { -struct net_device *dev =NULL ; +struct net_device *dev;struct inet6_dev *idev; -if (ifindex ==0 ) { -struct rt6_info *rt; - -rcu_read_lock (); - rt =rt6_lookup (net, group,NULL ,0 ,NULL ,0 ); -if (rt) { - dev =dst_dev (&rt->dst); -dev_hold (dev); -ip6_rt_put (rt); - } -rcu_read_unlock (); - }else { - dev =dev_get_by_index (net, ifindex); - } + dev =ip6_mc_find_dev (net, group, ifindex);if (!dev)return NULL ;
@@ -374,7 +369,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,if (!ipv6_addr_is_multicast (group))return -EINVAL ; - idev =ip6_mc_find_dev (net, group, pgsr->gsr_interface); + idev =ip6_mc_find_idev (net, group, pgsr->gsr_interface);if (!idev)return -ENODEV ;
@@ -509,7 +504,7 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf, gsf->gf_fmode != MCAST_EXCLUDE)return -EINVAL ; - idev =ip6_mc_find_dev (net, group, gsf->gf_interface); + idev =ip6_mc_find_idev (net, group, gsf->gf_interface);if (!idev)return -ENODEV ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 286/563 ipv6: start using dst_dev_rcu()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b775ecf1655cedbc465fd6699ab18a2bc4e7a352 ]
Refactor icmpv6_xrlim_allow() and ip6_dst_hoplimit() so that we acquire rcu_read_lock() a bit longer to be able to use dst_dev_rcu() instead of dst_dev().
__ip6_rt_update_pmtu() and rt6_do_redirect can directly use dst_dev_rcu() in sections already holding rcu_read_lock().
Small changes to use dst_dev_net_rcu() inip6_default_advmss(), ipv6_sock_ac_join(),ip6_mc_find_dev() and ndisc_send_skb().
--- net/ipv6/anycast.c | 2 +- net/ipv6/icmp.c | 6 +++--- net/ipv6/mcast.c | 2 +- net/ipv6/ndisc.c | 2 +- net/ipv6/output_core.c | 8 +++++--- net/ipv6/route.c | 7 +++---- 6 files changed, 14 insertions(+), 13 deletions(-)
net/ipv6/anycast.c +1 -1
@@ -104,7 +104,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)rcu_read_lock (); rt =rt6_lookup (net, addr,NULL ,0 ,NULL ,0 );if (rt) { - dev =dst_dev (&rt->dst); + dev =dst_dev_rcu (&rt->dst);netdev_hold (dev, &dev_tracker,GFP_ATOMIC );ip6_rt_put (rt); }else if (ishost) {
net/ipv6/icmp.c +3 -3
@@ -209,7 +209,8 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type,* this lookup should be more aggressive (not longer than timeout). */ dst =ip6_route_output (net, sk, fl6); - dev =dst_dev (dst); +rcu_read_lock (); + dev =dst_dev_rcu (dst);if (dst->error) {IP6_INC_STATS (net,ip6_dst_idev (dst),IPSTATS_MIB_OUTNOROUTES );
@@ -224,11 +225,10 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type,if (rt->rt6i_dst.plen <128 ) tmo >>= ((128 - rt->rt6i_dst.plen)>>5 ); -rcu_read_lock (); peer =inet_getpeer_v6 (net->ipv6.peers, &fl6->daddr); res =inet_peer_xrlim_allow (peer, tmo); -rcu_read_unlock (); } +rcu_read_unlock ();if (!res)__ICMP6_INC_STATS (net,ip6_dst_idev (dst),ICMP6_MIB_RATELIMITHOST );
net/ipv6/mcast.c +1 -1
@@ -180,7 +180,7 @@ static struct net_device *ip6_mc_find_dev(struct net *net,rcu_read_lock (); rt =rt6_lookup (net, group,NULL ,0 ,NULL ,0 );if (rt) { - dev =dst_dev (&rt->dst); + dev =dst_dev_rcu (&rt->dst);dev_hold (dev);ip6_rt_put (rt); }
net/ipv6/ndisc.c +1 -1
@@ -505,7 +505,7 @@ void ndisc_send_skb(struct sk_buff *skb, const struct in6_addr *daddr,ip6_nd_hdr (skb, saddr, daddr,READ_ONCE (inet6_sk (sk)->hop_limit), skb->len); - dev =dst_dev (dst); + dev =dst_dev_rcu (dst); idev =__in6_dev_get (dev);IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTREQUESTS );
net/ipv6/output_core.c +5 -3
@@ -104,18 +104,20 @@ EXPORT_SYMBOL(ip6_find_1stfragopt);int ip6_dst_hoplimit (struct dst_entry *dst) {int hoplimit =dst_metric_raw (dst,RTAX_HOPLIMIT ); + +rcu_read_lock ();if (hoplimit ==0 ) { -struct net_device *dev =dst_dev (dst); +struct net_device *dev =dst_dev_rcu (dst);struct inet6_dev *idev; -rcu_read_lock (); idev =__in6_dev_get (dev);if (idev) hoplimit =READ_ONCE (idev->cnf.hop_limit);else hoplimit =READ_ONCE (dev_net (dev)->ipv6.devconf_all->hop_limit); -rcu_read_unlock (); } +rcu_read_unlock (); +return hoplimit; }EXPORT_SYMBOL (ip6_dst_hoplimit);
net/ipv6/route.c +3 -4
@@ -2943,7 +2943,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,if (res.f6i->nh) {struct fib6_nh_match_arg arg = { - .dev =dst_dev (dst), + .dev =dst_dev_rcu (dst), .gw = &rt6->rt6i_gateway, };
@@ -3238,7 +3238,6 @@ EXPORT_SYMBOL_GPL(ip6_sk_redirect);static unsigned int ip6_default_advmss (const struct dst_entry *dst) { -struct net_device *dev =dst_dev (dst);unsigned int mtu =dst_mtu (dst);struct net *net;
@@ -3246,7 +3245,7 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst)rcu_read_lock (); - net =dev_net_rcu (dev); + net =dst_dev_net_rcu (dst);if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) mtu = net->ipv6.sysctl.ip6_rt_min_advmss;
@@ -4301,7 +4300,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buif (res.f6i->nh) {struct fib6_nh_match_arg arg = { - .dev =dst_dev (dst), + .dev =dst_dev_rcu (dst), .gw = &rt->rt6i_gateway, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 269/563 net: phy: introduce phy_id_compare_vendor() PHY ID helper
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Marangi <[email protected]>
[ Upstream commit 1abe21ef1adf0c5b6dbb5878c2fa4573df8d29fc ]
Introduce phy_id_compare_vendor() PHY ID helper to compare a PHY ID with the PHY ID Vendor using the generic PHY ID Vendor mask.
While at it also rework the PHY_ID_MATCH macro and move the mask to dedicated define so that PHY driver can make use of the mask if needed.
Stable-dep-of: b4d5cd20507b ("net: phy: as21xxx: better handle PHY HW reset on soft-reboot")
--- include/linux/phy.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
include/linux/phy.h +20 -3
@@ -1273,9 +1273,13 @@ struct phy_driver {#define to_phy_driver (d) container_of_const(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) -#define PHY_ID_MATCH_EXACT (id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0) -#define PHY_ID_MATCH_MODEL (id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4) -#define PHY_ID_MATCH_VENDOR (id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10) +#define PHY_ID_MATCH_EXTACT_MASK GENMASK(31, 0) +#define PHY_ID_MATCH_MODEL_MASK GENMASK(31, 4) +#define PHY_ID_MATCH_VENDOR_MASK GENMASK(31, 10) + +#define PHY_ID_MATCH_EXACT (id) .phy_id = (id), .phy_id_mask = PHY_ID_MATCH_EXTACT_MASK +#define PHY_ID_MATCH_MODEL (id) .phy_id = (id), .phy_id_mask = PHY_ID_MATCH_MODEL_MASK +#define PHY_ID_MATCH_VENDOR (id) .phy_id = (id), .phy_id_mask = PHY_ID_MATCH_VENDOR_MASK/** * phy_id_compare - compare @id1 with @id2 taking account of @mask
@@ -1291,6 +1295,19 @@ static inline bool phy_id_compare(u32 id1, u32 id2, u32 mask)return !((id1 ^ id2) & mask); } +/** +* phy_id_compare_vendor - compare @id with @vendor mask +* @id: PHY ID +* @vendor_mask: PHY Vendor mask +* +* Return: true if the bits from @id match @vendor using the +* generic PHY Vendor mask. +*/ +static inline bool phy_id_compare_vendor (u32 id,u32 vendor_mask) +{ +return phy_id_compare (id, vendor_mask,PHY_ID_MATCH_VENDOR_MASK ); +} +/** * phydev_id_compare - compare @id with the PHY's Clause 22 ID * @phydev: the PHY device
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 287/563 ipv6: use RCU in ip6_xmit()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9085e56501d93af9f2d7bd16f7fcfacdde47b99c ]
Use RCU in ip6_xmit() in order to use dst_dev_rcu() to prevent possible UAF.
--- net/ipv6/ip6_output.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
net/ipv6/ip6_output.c +21 -14
@@ -268,35 +268,36 @@ bool ip6_autoflowlabel(struct net *net, const struct sock *sk)int ip6_xmit (const struct sock *sk,struct sk_buff *skb,struct flowi6 *fl6,__u32 mark,struct ipv6_txoptions *opt,int tclass,u32 priority) { -struct net *net =sock_net (sk);const struct ipv6_pinfo *np =inet6_sk (sk);struct in6_addr *first_hop = &fl6->daddr;struct dst_entry *dst =skb_dst (skb); -struct net_device *dev =dst_dev (dst);struct inet6_dev *idev =ip6_dst_idev (dst);struct hop_jumbo_hdr *hop_jumbo;int hoplen =sizeof (*hop_jumbo); +struct net *net =sock_net (sk);unsigned int head_room; +struct net_device *dev;struct ipv6hdr *hdr;u8 proto = fl6->flowi6_proto;int seg_len = skb->len; -int hlimit =-1 ; +int ret, hlimit =-1 ;u32 mtu; +rcu_read_lock (); + + dev =dst_dev_rcu (dst); head_room =sizeof (struct ipv6hdr ) + hoplen +LL_RESERVED_SPACE (dev);if (opt) head_room += opt->opt_nflen + opt->opt_flen;if (unlikely (head_room >skb_headroom (skb))) { -/* Make sure idev stays alive */ -rcu_read_lock (); +/* idev stays alive while we hold rcu_read_lock(). */ skb =skb_expand_head (skb, head_room);if (!skb) {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS ); -rcu_read_unlock (); -return -ENOBUFS ; + ret = -ENOBUFS ; + goto unlock; } -rcu_read_unlock (); }if (opt) {
@@ -358,17 +359,21 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,* skb to its handler for processing */ skb =l3mdev_ip6_out ((struct sock *)sk, skb); -if (unlikely (!skb)) -return 0 ; +if (unlikely (!skb)) { + ret =0 ; + goto unlock; + }/* hooks should never assume socket lock is held. * we promote our socket to non const */ -return NF_HOOK (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , - net, (struct sock *)sk, skb,NULL , dev, - dst_output); + ret =NF_HOOK (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , + net, (struct sock *)sk, skb,NULL , dev, + dst_output); + goto unlock; } + ret = -EMSGSIZE ; skb->dev = dev;/* ipv6_local_error() does not require socket lock, * we promote our socket to non const
@@ -377,7 +382,9 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,IP6_INC_STATS (net, idev,IPSTATS_MIB_FRAGFAILS );kfree_skb (skb); -return -EMSGSIZE ; +unlock: +rcu_read_unlock (); +return ret; }EXPORT_SYMBOL (ip6_xmit);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 288/563 ipv6: use RCU in ip6_output()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 11709573cc4e48dc34c80fc7ab9ce5b159e29695 ]
Use RCU in ip6_output() in order to use dst_dev_rcu() to prevent possible UAF.
We can remove rcu_read_lock()/rcu_read_unlock() pairs from ip6_finish_output2().
--- net/ipv6/ip6_output.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
net/ipv6/ip6_output.c +15 -14
@@ -60,7 +60,7 @@static int ip6_finish_output2 (struct net *net,struct sock *sk,struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb); -struct net_device *dev =dst_dev (dst); +struct net_device *dev =dst_dev_rcu (dst);struct inet6_dev *idev =ip6_dst_idev (dst);unsigned int hh_len =LL_RESERVED_SPACE (dev);const struct in6_addr *daddr, *nexthop;
@@ -70,15 +70,12 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff */* Be paranoid, rather than too clever. */ if (unlikely (hh_len >skb_headroom (skb)) && dev->header_ops) { -/* Make sure idev stays alive */ -rcu_read_lock (); +/* idev stays alive because we hold rcu_read_lock(). */ skb =skb_expand_head (skb, hh_len);if (!skb) {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS ); -rcu_read_unlock ();return -ENOMEM ; } -rcu_read_unlock (); } hdr =ipv6_hdr (skb);
@@ -123,7 +120,6 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUT , skb->len); -rcu_read_lock (); nexthop =rt6_nexthop (dst_rt6_info (dst), daddr); neigh =__ipv6_neigh_lookup_noref (dev, nexthop);
@@ -131,7 +127,6 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *if (unlikely (!neigh)) neigh =__neigh_create (&nd_tbl, nexthop, dev, false);if (IS_ERR (neigh)) { -rcu_read_unlock ();IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTNOROUTES );kfree_skb_reason (skb,SKB_DROP_REASON_NEIGH_CREATEFAIL );return -EINVAL ;
@@ -139,7 +134,6 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * }sock_confirm_neigh (skb, neigh); ret =neigh_output (neigh, skb, false); -rcu_read_unlock ();return ret; }
@@ -233,22 +227,29 @@ static int ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff *sint ip6_output (struct net *net,struct sock *sk,struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb); -struct net_device *dev =dst_dev (dst), *indev = skb->dev; -struct inet6_dev *idev =ip6_dst_idev (dst); +struct net_device *dev, *indev = skb->dev; +struct inet6_dev *idev; +int ret; skb->protocol =htons (ETH_P_IPV6 ); +rcu_read_lock (); + dev =dst_dev_rcu (dst); + idev =ip6_dst_idev (dst); skb->dev = dev;if (unlikely (!idev ||READ_ONCE (idev->cnf.disable_ipv6))) {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS ); +rcu_read_unlock ();kfree_skb_reason (skb,SKB_DROP_REASON_IPV6DISABLED );return 0 ; } -return NF_HOOK_COND (NFPROTO_IPV6 ,NF_INET_POST_ROUTING , - net, sk, skb, indev, dev, - ip6_finish_output, - !(IP6CB (skb)->flags &IP6SKB_REROUTED )); + ret =NF_HOOK_COND (NFPROTO_IPV6 ,NF_INET_POST_ROUTING , + net, sk, skb, indev, dev, + ip6_finish_output, + !(IP6CB (skb)->flags &IP6SKB_REROUTED )); +rcu_read_unlock (); +return ret; }EXPORT_SYMBOL (ip6_output);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 289/563 net: use dst_dev_rcu() in sk_setup_caps()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 99a2ace61b211b0be861b07fbaa062fca4b58879 ]
Use RCU to protect accesses to dst->dev from sk_setup_caps() and sk_dst_gso_max_size().
Also use dst_dev_rcu() in ip6_dst_mtu_maybe_forward(), and ip_dst_mtu_maybe_forward().
ip4_dst_hoplimit() can use dst_dev_net_rcu().
--- include/net/ip.h | 6 ++++-- include/net/ip6_route.h | 2 +- include/net/route.h | 2 +- net/core/sock.c | 16 ++++++++++------ 4 files changed, 16 insertions(+), 10 deletions(-)
include/net/ip.h +4 -2
@@ -467,12 +467,14 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, bool forwarding) {const struct rtable *rt =dst_rtable (dst); +const struct net_device *dev;unsigned int mtu, res;struct net *net;rcu_read_lock (); - net =dev_net_rcu (dst_dev (dst)); + dev =dst_dev_rcu (dst); + net =dev_net_rcu (dev);if (READ_ONCE (net->ipv4.sysctl_ip_fwd_use_pmtu) ||ip_mtu_locked (dst) || !forwarding) {
@@ -486,7 +488,7 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,if (mtu) goto out; - mtu =READ_ONCE (dst_dev (dst)->mtu); + mtu =READ_ONCE (dev->mtu);if (unlikely (ip_mtu_locked (dst))) {if (rt->rt_uses_gateway && mtu >576 )
include/net/ip6_route.h +1 -1
@@ -337,7 +337,7 @@ static inline unsigned int ip6_dst_mtu_maybe_forward(const struct dst_entry *dst mtu =IPV6_MIN_MTU ;rcu_read_lock (); - idev =__in6_dev_get (dst_dev (dst)); + idev =__in6_dev_get (dst_dev_rcu (dst));if (idev) mtu =READ_ONCE (idev->cnf.mtu6);rcu_read_unlock ();
include/net/route.h +1 -1
@@ -390,7 +390,7 @@ static inline int ip4_dst_hoplimit(const struct dst_entry *dst)const struct net *net;rcu_read_lock (); - net =dev_net_rcu (dst_dev (dst)); + net =dst_dev_net_rcu (dst); hoplimit =READ_ONCE (net->ipv4.sysctl_ip_default_ttl);rcu_read_unlock (); }
net/core/sock.c +10 -6
@@ -2584,7 +2584,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) }EXPORT_SYMBOL_GPL (sk_clone_lock); -static u32 sk_dst_gso_max_size (struct sock *sk,struct dst_entry *dst) +static u32 sk_dst_gso_max_size (struct sock *sk,const struct net_device *dev) {bool is_ipv6 = false;u32 max_size;
@@ -2594,8 +2594,8 @@ static u32 sk_dst_gso_max_size(struct sock *sk, struct dst_entry *dst) !ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr));#endif /* pairs with the WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */ - max_size = is_ipv6 ?READ_ONCE (dst_dev (dst)->gso_max_size) : -READ_ONCE (dst_dev (dst)->gso_ipv4_max_size); + max_size = is_ipv6 ?READ_ONCE (dev->gso_max_size) : +READ_ONCE (dev->gso_ipv4_max_size);if (max_size >GSO_LEGACY_MAX_SIZE && !sk_is_tcp (sk)) max_size =GSO_LEGACY_MAX_SIZE ;
@@ -2604,9 +2604,12 @@ static u32 sk_dst_gso_max_size(struct sock *sk, struct dst_entry *dst)void sk_setup_caps (struct sock *sk,struct dst_entry *dst) { +const struct net_device *dev;u32 max_segs =1 ; - sk->sk_route_caps =dst_dev (dst)->features; +rcu_read_lock (); + dev =dst_dev_rcu (dst); + sk->sk_route_caps = dev->features;if (sk_is_tcp (sk)) {struct inet_connection_sock *icsk =inet_csk (sk);
@@ -2622,13 +2625,14 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) sk->sk_route_caps &= ~NETIF_F_GSO_MASK ; }else { sk->sk_route_caps |=NETIF_F_SG |NETIF_F_HW_CSUM ; - sk->sk_gso_max_size =sk_dst_gso_max_size (sk, dst); + sk->sk_gso_max_size =sk_dst_gso_max_size (sk, dev);/* pairs with the WRITE_ONCE() in netif_set_gso_max_segs() */ - max_segs =max_t (u32,READ_ONCE (dst_dev (dst)->gso_max_segs),1 ); + max_segs =max_t (u32,READ_ONCE (dev->gso_max_segs),1 ); } } sk->sk_gso_max_segs = max_segs;sk_dst_set (sk, dst); +rcu_read_unlock (); }EXPORT_SYMBOL_GPL (sk_setup_caps);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 290/563 tcp_metrics: use dst_dev_net_rcu()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 50c127a69cd6285300931853b352a1918cfa180f ]
Replace three dst_dev() with a lockdep enabled helper.
--- net/ipv4/tcp_metrics.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/tcp_metrics.c +3 -3
@@ -170,7 +170,7 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst,struct net *net;spin_lock_bh (&tcp_metrics_lock); - net =dev_net_rcu (dst_dev (dst)); + net =dst_dev_net_rcu (dst);/* While waiting for the spin-lock the cache might have been populated * with this entry and so we have to check again.
@@ -273,7 +273,7 @@ static struct tcp_metrics_block *__tcp_get_metrics_req(struct request_sock *req,return NULL ; } - net =dev_net_rcu (dst_dev (dst)); + net =dst_dev_net_rcu (dst); hash ^=net_hash_mix (net); hash =hash_32 (hash, tcp_metrics_hash_log);
@@ -318,7 +318,7 @@ static struct tcp_metrics_block *tcp_get_metrics(struct sock *sk,else return NULL ; - net =dev_net_rcu (dst_dev (dst)); + net =dst_dev_net_rcu (dst); hash ^=net_hash_mix (net); hash =hash_32 (hash, tcp_metrics_hash_log);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 291/563 ipv4: start using dst_dev_rcu()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6ad8de3cefdb6ffa6708b21c567df0dbf82c43a8 ]
Change icmpv4_xrlim_allow(), ip_defrag() to prevent possible UAF.
Change ipmr_prepare_xmit(), ipmr_queue_fwd_xmit(), ip_mr_output(), ipv4_neigh_lookup() to use lockdep enabled dst_dev_rcu().
--- net/ipv4/icmp.c | 6 +++--- net/ipv4/ip_fragment.c | 6 ++++-- net/ipv4/ipmr.c | 6 +++--- net/ipv4/route.c | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-)
net/ipv4/icmp.c +3 -3
@@ -318,17 +318,17 @@ static bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,return true;/* No rate limit on loopback */ - dev =dst_dev (dst); +rcu_read_lock (); + dev =dst_dev_rcu (dst);if (dev && (dev->flags &IFF_LOOPBACK )) goto out; -rcu_read_lock (); peer =inet_getpeer_v4 (net->ipv4.peers, fl4->daddr,l3mdev_master_ifindex_rcu (dev)); rc =inet_peer_xrlim_allow (peer,READ_ONCE (net->ipv4.sysctl_icmp_ratelimit)); -rcu_read_unlock (); out: +rcu_read_unlock ();if (!rc)__ICMP_INC_STATS (net,ICMP_MIB_RATELIMITHOST );else
net/ipv4/ip_fragment.c +4 -2
@@ -476,14 +476,16 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,/* Process an incoming IP datagram fragment. */ int ip_defrag (struct net *net,struct sk_buff *skb,u32 user) { -struct net_device *dev = skb->dev ? :skb_dst_dev (skb); -int vif =l3mdev_master_ifindex_rcu (dev); +struct net_device *dev;struct ipq *qp; +int vif;__IP_INC_STATS (net,IPSTATS_MIB_REASMREQDS );/* Lookup (or create) queue header */ rcu_read_lock (); + dev = skb->dev ? :skb_dst_dev_rcu (skb); + vif =l3mdev_master_ifindex_rcu (dev); qp =ip_find (net,ip_hdr (skb), user, vif);if (qp) {int ret, refs =0 ;
net/ipv4/ipmr.c +3 -3
@@ -1904,7 +1904,7 @@ static int ipmr_prepare_xmit(struct net *net, struct mr_table *mrt,return -1 ; } - encap +=LL_RESERVED_SPACE (rt->dst.dev) + rt->dst.header_len; + encap +=LL_RESERVED_SPACE (dst_dev_rcu (&rt->dst)) + rt->dst.header_len;if (skb_cow (skb, encap)) {ip_rt_put (rt);
@@ -1957,7 +1957,7 @@ static void ipmr_queue_fwd_xmit(struct net *net, struct mr_table *mrt,* result in receiving multiple packets. */ NF_HOOK (NFPROTO_IPV4 ,NF_INET_FORWARD , - net,NULL , skb, skb->dev, rt->dst.dev, + net,NULL , skb, skb->dev,dst_dev_rcu (&rt->dst), ipmr_forward_finish);return ;
@@ -2301,7 +2301,7 @@ int ip_mr_output(struct net *net, struct sock *sk, struct sk_buff *skb)guard (rcu)(); - dev = rt->dst.dev; + dev =dst_dev_rcu (&rt->dst);if (IPCB (skb)->flags &IPSKB_FORWARDED ) goto mc_output;
net/ipv4/route.c +2 -2
@@ -413,11 +413,11 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const void *daddr) { const struct rtable *rt = container_of(dst, struct rtable, dst); -struct net_device *dev =dst_dev (dst); +struct net_device *dev;struct neighbour *n;rcu_read_lock (); - + dev =dst_dev_rcu (dst);if (likely (rt->rt_gw_family ==AF_INET )) { n =ip_neigh_gw4 (dev, rt->rt_gw4); }else if (rt->rt_gw_family ==AF_INET6 ) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 292/563 crypto: hisilicon/zip - remove unnecessary validation for high-performance mode configurations
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenghai Huang <[email protected]>
[ Upstream commit d4e081510471e79171c4e0a11f6cb608e49bc082 ]
When configuring the high-performance mode register, there is no need to verify whether the register has been successfully enabled, as there is no possibility of a write failure for this register.
--- drivers/crypto/hisilicon/zip/zip_main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/crypto/hisilicon/zip/zip_main.c +2 -12
@@ -448,10 +448,9 @@ bool hisi_zip_alg_support(struct hisi_qm *qm, u32 alg)return false; } -static int hisi_zip_set_high_perf (struct hisi_qm *qm) +static void hisi_zip_set_high_perf (struct hisi_qm *qm) {u32 val; -int ret; val =readl_relaxed (qm->io_base +HZIP_HIGH_PERF_OFFSET );if (perf_mode ==HZIP_HIGH_COMP_PERF )
@@ -461,13 +460,6 @@ static int hisi_zip_set_high_perf(struct hisi_qm *qm)/* Set perf mode */ writel (val, qm->io_base +HZIP_HIGH_PERF_OFFSET ); - ret =readl_relaxed_poll_timeout (qm->io_base +HZIP_HIGH_PERF_OFFSET , - val, val == perf_mode,HZIP_DELAY_1_US , -HZIP_POLL_TIMEOUT_US ); -if (ret) -pci_err (qm->pdev,"failed to set perf mode\n" ); - -return ret; }static void hisi_zip_open_sva_prefetch (struct hisi_qm *qm)
@@ -1251,9 +1243,7 @@ static int hisi_zip_pf_probe_init(struct hisi_zip *hisi_zip)if (ret)return ret; - ret =hisi_zip_set_high_perf (qm); -if (ret) -return ret; +hisi_zip_set_high_perf (qm);hisi_zip_open_sva_prefetch (qm);hisi_qm_dev_err_init (qm);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 293/563 crypto: hisilicon - re-enable address prefetch after device resuming
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenghai Huang <[email protected]>
[ Upstream commit 0dcd21443d9308ed88909d35aa0490c3fc680a47 ]
When the device resumes from a suspended state, it will revert to its initial state and requires re-enabling. Currently, the address prefetch function is not re-enabled after device resuming. Move the address prefetch enable to the initialization process. In this way, the address prefetch can be enabled when the device resumes by calling the initialization process.
--- drivers/crypto/hisilicon/hpre/hpre_main.c | 3 +- drivers/crypto/hisilicon/qm.c | 3 - drivers/crypto/hisilicon/sec2/sec_main.c | 80 +++++++++++------------ drivers/crypto/hisilicon/zip/zip_main.c | 5 +- 4 files changed, 43 insertions(+), 48 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_main.c +1 -2
@@ -721,6 +721,7 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm)/* Config data buffer pasid needed by Kunpeng 920 */ hpre_config_pasid (qm); +hpre_open_sva_prefetch (qm);hpre_enable_clock_gate (qm);
@@ -1450,8 +1451,6 @@ static int hpre_pf_probe_init(struct hpre *hpre)if (ret)return ret; -hpre_open_sva_prefetch (qm); -hisi_qm_dev_err_init (qm); ret =hpre_show_last_regs_init (qm);if (ret)
drivers/crypto/hisilicon/qm.c +0 -3
@@ -4447,9 +4447,6 @@ static void qm_restart_prepare(struct hisi_qm *qm) {u32 value; -if (qm->err_ini->open_sva_prefetch) - qm->err_ini->open_sva_prefetch (qm); -if (qm->ver >=QM_HW_V3 )return ;
drivers/crypto/hisilicon/sec2/sec_main.c +40 -40
98 lines not on this page · raw message
drivers/crypto/hisilicon/zip/zip_main.c +2 -3
@@ -557,6 +557,7 @@ static int hisi_zip_set_user_domain_and_cache(struct hisi_qm *qm)writel (AXUSER_BASE , base +HZIP_DATA_WUSER_32_63 );writel (AXUSER_BASE , base +HZIP_SGL_RUSER_32_63 ); } +hisi_zip_open_sva_prefetch (qm);/* let's open all compression/decompression cores */
@@ -572,6 +573,7 @@ static int hisi_zip_set_user_domain_and_cache(struct hisi_qm *qm)CQC_CACHE_WB_ENABLE |FIELD_PREP (SQC_CACHE_WB_THRD ,1 ) | FIELD_PREP(CQC_CACHE_WB_THRD, 1), base + QM_CACHE_CTL); +hisi_zip_set_high_perf (qm);hisi_zip_enable_clock_gate (qm);return hisi_dae_set_user_domain (qm);
@@ -1243,9 +1245,6 @@ static int hisi_zip_pf_probe_init(struct hisi_zip *hisi_zip)if (ret)return ret; -hisi_zip_set_high_perf (qm); - -hisi_zip_open_sva_prefetch (qm);hisi_qm_dev_err_init (qm);hisi_zip_debug_regs_clear (qm);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 294/563 crypto: hisilicon - check the sva module status while enabling or disabling address prefetch
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weili Qian <[email protected]>
[ Upstream commit 1f9128f121a872f27251be60ccccfd98c136d72e ]
After enabling address prefetch, check the sva module status. If all previous prefetch requests from the sva module are not completed, then disable the address prefetch to ensure normal execution of new task operations. After disabling address prefetch, check if all requests from the sva module have been completed.
--- drivers/crypto/hisilicon/hpre/hpre_main.c | 63 ++++++++++++++---- drivers/crypto/hisilicon/sec2/sec_main.c | 48 +++++++++++++- drivers/crypto/hisilicon/zip/zip_main.c | 79 +++++++++++++++++++---- 3 files changed, 164 insertions(+), 26 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_main.c +52 -11
@@ -78,6 +78,11 @@#define HPRE_PREFETCH_ENABLE (~(BIT(0) | BIT(30)))#define HPRE_PREFETCH_DISABLE BIT(30)#define HPRE_SVA_DISABLE_READY (BIT(4) | BIT(8)) +#define HPRE_SVA_PREFTCH_DFX4 0x301144 +#define HPRE_WAIT_SVA_READY 500000 +#define HPRE_READ_SVA_STATUS_TIMES 3 +#define HPRE_WAIT_US_MIN 10 +#define HPRE_WAIT_US_MAX 20/* clock gate */ #define HPRE_CLKGATE_CTL 0x301a10
@@ -466,6 +471,33 @@ struct hisi_qp *hpre_create_qp(u8 type)return NULL ; } +static int hpre_wait_sva_ready (struct hisi_qm *qm) +{ +u32 val, try_times =0 ; +u8 count =0 ; + +/* +* Read the register value every 10-20us. If the value is 0 for three +* consecutive times, the SVA module is ready. +*/ +do { + val =readl (qm->io_base +HPRE_SVA_PREFTCH_DFX4 ); +if (val) + count =0 ; +else if (++count ==HPRE_READ_SVA_STATUS_TIMES ) +break ; + +usleep_range (HPRE_WAIT_US_MIN ,HPRE_WAIT_US_MAX ); + }while (++try_times <HPRE_WAIT_SVA_READY ); + +if (try_times ==HPRE_WAIT_SVA_READY ) { +pci_err (qm->pdev,"failed to wait sva prefetch ready\n" ); +return -ETIMEDOUT ; + } + +return 0 ; +} +static void hpre_config_pasid (struct hisi_qm *qm) {u32 val1, val2;
@@ -563,7 +595,7 @@ static void disable_flr_of_bme(struct hisi_qm *qm)writel (PEH_AXUSER_CFG_ENABLE , qm->io_base +QM_PEH_AXUSER_CFG_ENABLE ); } -static void hpre_open_sva_prefetch (struct hisi_qm *qm) +static void hpre_close_sva_prefetch (struct hisi_qm *qm) {u32 val;int ret;
@@ -571,20 +603,21 @@ static void hpre_open_sva_prefetch(struct hisi_qm *qm)if (!test_bit (QM_SUPPORT_SVA_PREFETCH , &qm->caps))return ; -/* Enable prefetch */ val =readl_relaxed (qm->io_base +HPRE_PREFETCH_CFG ); - val &=HPRE_PREFETCH_ENABLE ; + val |=HPRE_PREFETCH_DISABLE ;writel (val, qm->io_base +HPRE_PREFETCH_CFG ); - ret =readl_relaxed_poll_timeout (qm->io_base +HPRE_PREFETCH_CFG , - val, !(val &HPRE_PREFETCH_DISABLE ), + ret =readl_relaxed_poll_timeout (qm->io_base +HPRE_SVA_PREFTCH_DFX , + val, !(val &HPRE_SVA_DISABLE_READY ),HPRE_REG_RD_INTVRL_US ,HPRE_REG_RD_TMOUT_US );if (ret) -pci_err (qm->pdev,"failed to open sva prefetch\n" ); +pci_err (qm->pdev,"failed to close sva prefetch\n" ); + + (void )hpre_wait_sva_ready (qm); } -static void hpre_close_sva_prefetch (struct hisi_qm *qm) +static void hpre_open_sva_prefetch (struct hisi_qm *qm) {u32 val;int ret;
@@ -592,16 +625,24 @@ static void hpre_close_sva_prefetch(struct hisi_qm *qm)if (!test_bit (QM_SUPPORT_SVA_PREFETCH , &qm->caps))return ; +/* Enable prefetch */ val =readl_relaxed (qm->io_base +HPRE_PREFETCH_CFG ); - val |=HPRE_PREFETCH_DISABLE ; + val &=HPRE_PREFETCH_ENABLE ;writel (val, qm->io_base +HPRE_PREFETCH_CFG ); - ret =readl_relaxed_poll_timeout (qm->io_base +HPRE_SVA_PREFTCH_DFX , - val, !(val &HPRE_SVA_DISABLE_READY ), + ret =readl_relaxed_poll_timeout (qm->io_base +HPRE_PREFETCH_CFG , + val, !(val &HPRE_PREFETCH_DISABLE ),HPRE_REG_RD_INTVRL_US ,HPRE_REG_RD_TMOUT_US ); +if (ret) { +pci_err (qm->pdev,"failed to open sva prefetch\n" ); +hpre_close_sva_prefetch (qm); +return ; + } + + ret =hpre_wait_sva_ready (qm);if (ret) -pci_err (qm->pdev,"failed to close sva prefetch\n" ); +hpre_close_sva_prefetch (qm); }static void hpre_enable_clock_gate (struct hisi_qm *qm)
drivers/crypto/hisilicon/sec2/sec_main.c +47 -1
73 lines not on this page · raw message
drivers/crypto/hisilicon/zip/zip_main.c +65 -14
129 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 295/563 crypto: hisilicon/qm - check whether the input function and PF are on the same device
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhushuai Yin <[email protected]>
[ Upstream commit 6a2c9164b52e6bc134127fd543461fdef95cc8ec ]
Function rate limiting is set through physical function driver. Users configure by providing function information and rate limit values. Before configuration, it is necessary to check whether the provided function and PF belong to the same device.
--- drivers/crypto/hisilicon/qm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/hisilicon/qm.c +4 -0
@@ -3826,6 +3826,10 @@ static ssize_t qm_get_qos_value(struct hisi_qm *qm, const char *buf, } pdev = container_of(dev, struct pci_dev, dev); +if (pci_physfn (pdev) != qm->pdev) { +pci_err (qm->pdev,"the pdev input does not match the pf!\n" ); +return -EINVAL ; + } *fun_index = pdev->devfn;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 296/563 crypto: hisilicon/qm - request reserved interrupt for virtual function
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weili Qian <[email protected]>
[ Upstream commit 9228facb308157ac0bdd264b873187896f7a9c7a ]
The device interrupt vector 3 is an error interrupt for physical function and a reserved interrupt for virtual function. However, the driver has not registered the reserved interrupt for virtual function. When allocating interrupts, the number of interrupts is allocated based on powers of two, which includes this interrupt. When the system enables GICv4 and the virtual function passthrough to the virtual machine, releasing the interrupt in the driver triggers a warning.
The WARNING report is:
WARNING: CPU: 62 PID: 14889 at arch/arm64/kvm/vgic/vgic-its.c:852 its_free_ite+0x94/0xb4
Therefore, register a reserved interrupt for VF and set the IRQF_NO_AUTOEN flag to avoid that warning.
--- drivers/crypto/hisilicon/qm.c | 38 +++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/crypto/hisilicon/qm.c +32 -6
@@ -4732,6 +4732,15 @@ void hisi_qm_reset_done(struct pci_dev *pdev) }EXPORT_SYMBOL_GPL (hisi_qm_reset_done); +static irqreturn_t qm_rsvd_irq (int irq,void *data) +{ +struct hisi_qm *qm = data; + +dev_info (&qm->pdev->dev,"Reserved interrupt, ignore!\n" ); + +return IRQ_HANDLED ; +} +static irqreturn_t qm_abnormal_irq (int irq,void *data) {struct hisi_qm *qm = data;
@@ -5015,7 +5024,7 @@ static void qm_unregister_abnormal_irq(struct hisi_qm *qm)struct pci_dev *pdev = qm->pdev;u32 irq_vector, val; -if (qm->fun_type ==QM_HW_VF ) +if (qm->fun_type ==QM_HW_VF && qm->ver <QM_HW_V3 )return ; val = qm->cap_tables.qm_cap_table[QM_ABNORMAL_IRQ ].cap_val;
@@ -5032,17 +5041,28 @@ static int qm_register_abnormal_irq(struct hisi_qm *qm)u32 irq_vector, val;int ret; -if (qm->fun_type ==QM_HW_VF ) -return 0 ; - val = qm->cap_tables.qm_cap_table[QM_ABNORMAL_IRQ ].cap_val;if (!((val >>QM_IRQ_TYPE_SHIFT ) &QM_ABN_IRQ_TYPE_MASK ))return 0 ; - irq_vector = val &QM_IRQ_VECTOR_MASK ; + +/* For VF, this is a reserved interrupt in V3 version. */ +if (qm->fun_type ==QM_HW_VF ) { +if (qm->ver <QM_HW_V3 ) +return 0 ; + + ret =request_irq (pci_irq_vector (pdev, irq_vector), qm_rsvd_irq, +IRQF_NO_AUTOEN , qm->dev_name, qm); +if (ret) { +dev_err (&pdev->dev,"failed to request reserved irq, ret = %d!\n" , ret); +return ret; + } +return 0 ; + } + ret =request_irq (pci_irq_vector (pdev, irq_vector), qm_abnormal_irq,0 , qm->dev_name, qm);if (ret) -dev_err (&qm->pdev->dev,"failed to request abnormal irq, ret = %d" , ret); +dev_err (&qm->pdev->dev,"failed to request abnormal irq, ret = %d!\n" , ret);return ret; }
@@ -5408,6 +5428,12 @@ static int hisi_qm_pci_init(struct hisi_qm *qm)pci_set_master (pdev); num_vec =qm_get_irq_num (qm); +if (!num_vec) { +dev_err (dev,"Device irq num is zero!\n" ); + ret = -EINVAL ; + goto err_get_pci_res; + } + num_vec =roundup_pow_of_two (num_vec); ret =pci_alloc_irq_vectors (pdev, num_vec, num_vec,PCI_IRQ_MSI );if (ret <0 ) {dev_err (dev,"Failed to enable MSI vectors!\n" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 270/563 net: phy: as21xxx: better handle PHY HW reset on soft-reboot
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Marangi <[email protected]>
[ Upstream commit b4d5cd20507b252c746fa6971d82ac96f3b3e5b7 ]
On soft-reboot, with a reset GPIO defined for an Aeonsemi PHY, the special match_phy_device fails to correctly identify that the PHY needs to load the firmware again.
This is caused by the fact that PHY ID is read BEFORE the PHY reset GPIO (if present) is asserted, so we can be in the scenario where the phydev have the previous PHY ID (with the PHY firmware loaded) but after reset the generic AS21xxx PHY is present in the PHY ID registers.
To better handle this, skip reading the PHY ID register only for the PHY that are not AS21xxx (by matching for the Aeonsemi Vendor) and always read the PHY ID for the other case to handle both firmware already loaded or an HW reset.
--- drivers/net/phy/as21xxx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/phy/as21xxx.c +4 -3
@@ -884,11 +884,12 @@ static int as21xxx_match_phy_device(struct phy_device *phydev,u32 phy_id;int ret; -/* Skip PHY that are not AS21xxx or already have firmware loaded */ -if (phydev->c45_ids.device_ids[MDIO_MMD_PCS ] !=PHY_ID_AS21XXX ) +/* Skip PHY that are not AS21xxx */ +if (!phy_id_compare_vendor (phydev->c45_ids.device_ids[MDIO_MMD_PCS ], +PHY_VENDOR_AEONSEMI ))return genphy_match_phy_device (phydev, phydrv); -/* Read PHY ID to handle firmware just loaded */ +/* Read PHY ID to handle firmware loaded or HW reset */ ret =phy_read_mmd (phydev,MDIO_MMD_PCS ,MII_PHYSID1 );if (ret <0 )return ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 297/563 inet: ping: check sock_net() in ping_get_port() and ping_lookup()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 59f26d86b2a16f1406f3b42025062b6d1fba5dd5 ]
We need to check socket netns before considering them in ping_get_port(). Otherwise, one malicious netns could 'consume' all ports.
Add corresponding check in ping_lookup().
--- net/ipv4/ping.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv4/ping.c +10 -4
@@ -77,6 +77,7 @@ static inline struct hlist_head *ping_hashslot(struct ping_table *table,int ping_get_port (struct sock *sk,unsigned short ident) { +struct net *net =sock_net (sk);struct inet_sock *isk, *isk2;struct hlist_head *hlist;struct sock *sk2 =NULL ;
@@ -90,9 +91,10 @@ int ping_get_port(struct sock *sk, unsigned short ident)for (i =0 ; i < (1L <<16 ); i++, result++) {if (!result) result++;/* avoid zero */ - hlist =ping_hashslot (&ping_table,sock_net (sk), - result); + hlist =ping_hashslot (&ping_table, net, result);sk_for_each (sk2, hlist) { +if (!net_eq (sock_net (sk2), net)) +continue ; isk2 =inet_sk (sk2);if (isk2->inet_num == result)
@@ -108,8 +110,10 @@ int ping_get_port(struct sock *sk, unsigned short ident)if (i >= (1L <<16 )) goto fail; }else { - hlist =ping_hashslot (&ping_table,sock_net (sk), ident); + hlist =ping_hashslot (&ping_table, net, ident);sk_for_each (sk2, hlist) { +if (!net_eq (sock_net (sk2), net)) +continue ; isk2 =inet_sk (sk2);/* BUG? Why is this reuse and not reuseaddr? ping.c
@@ -129,7 +133,7 @@ int ping_get_port(struct sock *sk, unsigned short ident)pr_debug ("was not hashed\n" );sk_add_node_rcu (sk, hlist);sock_set_flag (sk,SOCK_RCU_FREE ); -sock_prot_inuse_add (sock_net (sk), sk->sk_prot,1 ); +sock_prot_inuse_add (net, sk->sk_prot,1 ); }spin_unlock (&ping_table.lock);return 0 ;
@@ -188,6 +192,8 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) }sk_for_each_rcu (sk, hslot) { +if (!net_eq (sock_net (sk), net)) +continue ; isk =inet_sk (sk);pr_debug ("iterate\n" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 298/563 dmaengine: Fix dma_async_tx_descriptor->tx_submit documentation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Lynch <[email protected]>
[ Upstream commit 7ea95d55e63176899eb96f7aaa34a5646f501b2c ]
Commit 790fb9956eea ("linux/dmaengine.h: fix a few kernel-doc warnings") inserted new documentation for @desc_free in the middle of @tx_submit's description.
Put @tx_submit's description back together, matching the indentation style of the rest of the documentation for dma_async_tx_descriptor.
--- include/linux/dmaengine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dmaengine.h +1 -1
@@ -594,9 +594,9 @@ struct dma_descriptor_metadata_ops {* @phys: physical address of the descriptor * @chan: target channel for this operation * @tx_submit: accept the descriptor, assign ordered cookie and mark the +* descriptor pending. To be pushed on .issue_pending() call * @desc_free: driver's callback function to free a resusable descriptor * after completion -* descriptor pending. To be pushed on .issue_pending() call * @callback: routine to call after this operation is complete * @callback_result: error result from a DMA transaction * @callback_param: general parameter to pass to the callback routine
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 299/563 coresight: trbe: Add ISB after TRBLIMITR write
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 52c0164b2526bce7013fca193e076f6d9eec9c95 ]
DEN0154 states that hardware will be allowed to ignore writes to TRB* registers while the trace buffer is enabled. Add an ISB to ensure that it's disabled before clearing the other registers.
This is purely defensive because it's expected that arm_trbe_disable() would be called before teardown which has the required ISB.
--- drivers/hwtracing/coresight/coresight-trbe.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwtracing/coresight/coresight-trbe.c +1 -0
@@ -258,6 +258,7 @@ static void trbe_drain_and_disable_local(struct trbe_cpudata *cpudata)static void trbe_reset_local (struct trbe_cpudata *cpudata) {write_sysreg_s (0 ,SYS_TRBLIMITR_EL1 ); +isb ();trbe_drain_buffer ();write_sysreg_s (0 ,SYS_TRBPTR_EL1 );write_sysreg_s (0 ,SYS_TRBBASER_EL1 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 300/563 coresight: Fix missing include for FIELD_GET
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 08d24e076d0fb9f90522ef69bf6cdae06e0919de ]
Include the header for FIELD_GET which is only sometimes transitively included on some configs and kernel releases.
--- drivers/hwtracing/coresight/coresight-core.c | 1 + drivers/hwtracing/coresight/coresight-etm4x-core.c | 1 + drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 1 + drivers/hwtracing/coresight/ultrasoc-smb.h | 1 + 4 files changed, 4 insertions(+)
drivers/hwtracing/coresight/coresight-core.c +1 -0
@@ -3,6 +3,7 @@* Copyright (c) 2012, The Linux Foundation. All rights reserved. */ +#include <linux/bitfield.h> #include <linux/build_bug.h> #include <linux/kernel.h> #include <linux/init.h>
drivers/hwtracing/coresight/coresight-etm4x-core.c +1 -0
@@ -4,6 +4,7 @@*/ #include <linux/acpi.h> +#include <linux/bitfield.h> #include <linux/bitops.h> #include <linux/kernel.h> #include <linux/kvm_host.h>
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +1 -0
@@ -4,6 +4,7 @@* Author: Mathieu Poirier <[email protected]> */ +#include <linux/bitfield.h> #include <linux/coresight.h> #include <linux/pid_namespace.h> #include <linux/pm_runtime.h>
drivers/hwtracing/coresight/ultrasoc-smb.h +1 -0
@@ -7,6 +7,7 @@#ifndef _ULTRASOC_SMB_H#define _ULTRASOC_SMB_H +#include <linux/bitfield.h> #include <linux/miscdevice.h> #include <linux/spinlock.h>
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 301/563 coresight: Only register perf symlink for sinks with alloc_buffer
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanfang Zhang <[email protected]>
[ Upstream commit 12d9a9dd9d8a4f1968073e7f34515896d1e22b78 ]
Ensure that etm_perf_add_symlink_sink() is only called for devices that implement the alloc_buffer operation. This prevents invalid symlink creation for dummy sinks that do not implement alloc_buffer.
Without this check, perf may attempt to use a dummy sink that lacks alloc_buffer operationsu to initialise perf's ring buffer, leading to runtime failures.
--- drivers/hwtracing/coresight/coresight-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +3 -2
@@ -1375,8 +1375,9 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) goto out_unlock; } -if (csdev->type ==CORESIGHT_DEV_TYPE_SINK || - csdev->type ==CORESIGHT_DEV_TYPE_LINKSINK ) { +if ((csdev->type ==CORESIGHT_DEV_TYPE_SINK || + csdev->type ==CORESIGHT_DEV_TYPE_LINKSINK ) && +sink_ops (csdev)->alloc_buffer) { ret =etm_perf_add_symlink_sink (csdev);if (ret) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 302/563 drm/amdgpu: Power up UVD 3 for FW validation (v2)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit c661219cd7be75bb5599b525f16a455a058eb516 ]
Unlike later versions, UVD 3 has firmware validation. For this to work, the UVD should be powered up correctly.
When DPM is enabled and the display clock is off, the SMU may choose a power state which doesn't power the UVD, which can result in failure to initialize UVD.
v2:
Add code comments to explain about the UVD power state and how UVD clock is turned on/off.
--- drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c | 29 +++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c +25 -4
@@ -623,7 +623,22 @@ static void uvd_v3_1_enable_mgcg(struct amdgpu_device *adev,* * @ip_block: Pointer to the amdgpu_ip_block for this hw instance. * -* Initialize the hardware, boot up the VCPU and do some testing +* Initialize the hardware, boot up the VCPU and do some testing. +* +* On SI, the UVD is meant to be used in a specific power state, +* or alternatively the driver can manually enable its clock. +* In amdgpu we use the dedicated UVD power state when DPM is enabled. +* Calling amdgpu_dpm_enable_uvd makes DPM select the UVD power state +* for the SMU and afterwards enables the UVD clock. +* This is automatically done by amdgpu_uvd_ring_begin_use when work +* is submitted to the UVD ring. Here, we have to call it manually +* in order to power up UVD before firmware validation. +* +* Note that we must not disable the UVD clock here, as that would +* cause the ring test to fail. However, UVD is powered off +* automatically after the ring test: amdgpu_uvd_ring_end_use calls +* the UVD idle work handler which will disable the UVD clock when +* all fences are signalled. */ static int uvd_v3_1_hw_init (struct amdgpu_ip_block *ip_block) {
@@ -633,6 +648,15 @@ static int uvd_v3_1_hw_init(struct amdgpu_ip_block *ip_block)int r;uvd_v3_1_mc_resume (adev); +uvd_v3_1_enable_mgcg (adev, true); + +/* Make sure UVD is powered during FW validation. +* It's going to be automatically powered off after the ring test. +*/ +if (adev->pm.dpm_enabled) +amdgpu_dpm_enable_uvd (adev, true); +else +amdgpu_asic_set_uvd_clocks (adev,53300 ,40000 ); r =uvd_v3_1_fw_validate (adev);if (r) {
@@ -640,9 +664,6 @@ static int uvd_v3_1_hw_init(struct amdgpu_ip_block *ip_block)return r; } -uvd_v3_1_enable_mgcg (adev, true); -amdgpu_asic_set_uvd_clocks (adev,53300 ,40000 ); -uvd_v3_1_start (adev); r =amdgpu_ring_test_helper (ring);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 271/563 PCI: rcar-host: Pass proper IRQ domain to generic_handle_domain_irq()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit d3fee10e40a938331e2aae34348691136db31304 ]
Starting with commit dd26c1a23fd5 ("PCI: rcar-host: Switch to msi_create_parent_irq_domain()"), the MSI parent IRQ domain is NULL because the object of type struct irq_domain_info passed to:
msi_create_parent_irq_domain() ->
irq_domain_instantiate()() ->
__irq_domain_instantiate()
has no reference to the parent IRQ domain. Using msi->domain->parent as an argument for generic_handle_domain_irq() leads to below error:
"Unable to handle kernel NULL pointer dereference at virtual address"
This error was identified while switching the upcoming RZ/G3S PCIe host controller driver to msi_create_parent_irq_domain() (which was using a similar pattern to handle MSIs (see link section)), but it was not tested on hardware using the pcie-rcar-host controller driver due to lack of hardware.
--- drivers/pci/controller/pcie-rcar-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-rcar-host.c +1 -1
@@ -584,7 +584,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)unsigned int index =find_first_bit (®,32 );int ret; - ret =generic_handle_domain_irq (msi->domain->parent, index); + ret =generic_handle_domain_irq (msi->domain, index);if (ret) {/* Unknown MSI, just clear it */ dev_dbg (dev,"unexpected MSI\n" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 272/563 fuse: remove unneeded offset assignment when filling write pages
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joanne Koong <[email protected]>
[ Upstream commit 6fd26f50857698c6f07a9e6b149247925fadb8fd ]
With the change in aee03ea7ff98 ("fuse: support large folios for writethrough writes"), this old line for setting ap->descs[0].offset is now obsolete and unneeded. This should have been removed as part of aee03ea7ff98.
--- fs/fuse/file.c | 1 - 1 file changed, 1 deletion(-)
fs/fuse/file.c +0 -1
@@ -1175,7 +1175,6 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia, num =min (iov_iter_count (ii), fc->max_write); ap->args.in_pages = true; - ap->descs[0 ].offset = offset;while (num && ap->num_folios < max_folios) {size_t tmp;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 273/563 PCI: qcom: Restrict port parsing only to PCIe bridge child nodes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Chaitanya Chundru <[email protected]>
[ Upstream commit 45df22935bdc6bbddf87f38a57ae7257244cf3cf ]
The qcom_pcie_parse_ports() function currently iterates over all available child nodes of the PCIe controller's device tree node. This includes unrelated nodes such as OPP (Operating Performance Points) nodes, which do not contain the expected 'reset' and 'phy' properties. As a result, parsing fails and the driver falls back to the legacy method of parsing the controller node directly. However, this fallback also fails when properties are shifted to the Root Port node, leading to probe failure.
Fix this by restricting the parsing logic to only consider child nodes with device_type = "pci", which is the expected and required property for PCIe bridge nodes as per the pci-bus-common.yaml dtschema.
--- drivers/pci/controller/dwc/pcie-qcom.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
@@ -1740,6 +1740,8 @@ static int qcom_pcie_parse_ports(struct qcom_pcie *pcie)int ret = -ENOENT ;for_each_available_child_of_node_scoped (dev->of_node, of_port) { +if (!of_node_is_type (of_port,"pci" )) +continue ; ret =qcom_pcie_parse_port (pcie, of_port);if (ret) goto err_port_del;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 274/563 cdx: dont select CONFIG_GENERIC_MSI_IRQ
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nipun Gupta <[email protected]>
[ Upstream commit ab1d8dda32e9507ca3bfb6b43661aeaa27f7bd82 ]
x86 does not use CONFIG_GENERIC_MSI_IRQ, and trying to enable it anyway results in a build failure:
In file included from include/linux/ssb/ssb.h:10,
from drivers/ssb/pcihost_wrapper.c:18:include/linux/gpio/driver.h:41:33: error: field 'msiinfo' has incomplete type
41 | msi_alloc_info_t msiinfo;
| ^~~~~~~
In file included from include/linux/kvm_host.h:19,
from arch/x86/events/intel/core.c:17:include/linux/msi.h:528:33: error: field 'alloc_info' has incomplete type
528 | msi_alloc_info_t alloc_info;
Change the driver to actually build without this symbol and remove the incorrect 'select' statements.
--- drivers/cdx/Kconfig | 1 - drivers/cdx/cdx.c | 4 ++-- drivers/cdx/controller/Kconfig | 1 - drivers/cdx/controller/cdx_controller.c | 3 ++- 4 files changed, 4 insertions(+), 5 deletions(-)
drivers/cdx/Kconfig +0 -1
@@ -8,7 +8,6 @@ config CDX_BUS bool "CDX Bus driver" depends on OF && ARM64 || COMPILE_TEST - select GENERIC_MSI_IRQ help Driver to enable Composable DMA Transfer(CDX) Bus. CDX bus exposes Fabric devices which uses composable DMA IP to the
drivers/cdx/cdx.c +2 -2
@@ -310,7 +310,7 @@ static int cdx_probe(struct device *dev)* Setup MSI device data so that generic MSI alloc/free can * be used by the device driver. */ -if (cdx->msi_domain) { +if (IS_ENABLED (CONFIG_GENERIC_MSI_IRQ ) && cdx->msi_domain) { error =msi_setup_device_data (&cdx_dev->dev);if (error)return error;
@@ -833,7 +833,7 @@ int cdx_device_add(struct cdx_dev_params *dev_params) ((cdx->id <<CDX_CONTROLLER_ID_SHIFT ) | (cdx_dev->bus_num &CDX_BUS_NUM_MASK )), cdx_dev->dev_num); -if (cdx->msi_domain) { +if (IS_ENABLED (CONFIG_GENERIC_MSI_IRQ ) && cdx->msi_domain) { cdx_dev->num_msi = dev_params->num_msi;dev_set_msi_domain (&cdx_dev->dev, cdx->msi_domain); }
drivers/cdx/controller/Kconfig +0 -1
@@ -10,7 +10,6 @@ if CDX_BUS config CDX_CONTROLLER tristate "CDX bus controller" depends on HAS_DMA - select GENERIC_MSI_IRQ select REMOTEPROC select RPMSG help
drivers/cdx/controller/cdx_controller.c +2 -1
@@ -193,7 +193,8 @@ static int xlnx_cdx_probe(struct platform_device *pdev) cdx->ops = &cdx_ops;/* Create MSI domain */ - cdx->msi_domain =cdx_msi_domain_init (&pdev->dev); +if (IS_ENABLED (CONFIG_GENERIC_MSI_IRQ )) + cdx->msi_domain =cdx_msi_domain_init (&pdev->dev);if (!cdx->msi_domain) { ret =dev_err_probe (&pdev->dev, -ENODEV ,"cdx_msi_domain_init() failed" ); goto cdx_msi_fail;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 275/563 PCI/ACPI: Fix pci_acpi_preserve_config() memory leak
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nirmoy Das <[email protected]>
[ Upstream commit fac679df7580979174c90303f004b09cdc6f086f ]
pci_acpi_preserve_config() leaks memory by returning early without freeing the ACPI object on success. Fix that by always freeing the obj, which is not needed by the caller.
--- drivers/pci/pci-acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pci/pci-acpi.c +4 -2
@@ -122,6 +122,8 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)bool pci_acpi_preserve_config (struct pci_host_bridge *host_bridge) { +bool ret = false; +if (ACPI_HANDLE (&host_bridge->dev)) {union acpi_object *obj;
@@ -135,11 +137,11 @@ bool pci_acpi_preserve_config(struct pci_host_bridge *host_bridge)1 ,DSM_PCI_PRESERVE_BOOT_CONFIG , NULL, ACPI_TYPE_INTEGER);if (obj && obj->integer.value ==0 ) -return true; + ret = true;ACPI_FREE (obj); } -return false; +return ret; }/* _HPX PCI Setting Record (Type 0); same as _HPP */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 276/563 HID: i2c-hid: Fix test in i2c_hid_core_register_panel_follower()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 5c76c794bf29399394ebacaa5af8436b8bed0d46 ]
Bitwise AND was intended instead of OR. With the current code the condition is always true.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +1 -1
@@ -1189,7 +1189,7 @@ static int i2c_hid_core_register_panel_follower(struct i2c_hid *ihid)struct device *dev = &ihid->client->dev;int ret; -if (ihid->hid->initial_quirks |HID_QUIRK_POWER_ON_AFTER_BACKLIGHT ) +if (ihid->hid->initial_quirks &HID_QUIRK_POWER_ON_AFTER_BACKLIGHT ) ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_enable_funcs;else ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_prepare_funcs;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 267/563 RDMA/mlx5: Fix vport loopback forcing for MPV device
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit 08aae7860450c89eebbc6fd4d38416e53c7a33d2 ]
Previously loopback for MPV was supposed to be permanently enabled, however other driver flows were able to over-ride that configuration and disable it.
Add force_lb parameter that indicates that loopback should always be enabled which prevents all other driver flows from disabling it.
--- drivers/infiniband/hw/mlx5/main.c | 19 +++++++++++++++---- drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/main.c +15 -4
@@ -1839,7 +1839,8 @@ static void deallocate_uars(struct mlx5_ib_dev *dev, }static int mlx5_ib_enable_lb_mp (struct mlx5_core_dev *master, -struct mlx5_core_dev *slave) +struct mlx5_core_dev *slave, +struct mlx5_ib_lb_state *lb_state) {int err;
@@ -1851,6 +1852,7 @@ static int mlx5_ib_enable_lb_mp(struct mlx5_core_dev *master,if (err) goto out; + lb_state->force_enable = true;return 0 ; out:
@@ -1859,16 +1861,22 @@ static int mlx5_ib_enable_lb_mp(struct mlx5_core_dev *master, }static void mlx5_ib_disable_lb_mp (struct mlx5_core_dev *master, -struct mlx5_core_dev *slave) +struct mlx5_core_dev *slave, +struct mlx5_ib_lb_state *lb_state) {mlx5_nic_vport_update_local_lb (slave, false);mlx5_nic_vport_update_local_lb (master, false); + + lb_state->force_enable = false; }int mlx5_ib_enable_lb (struct mlx5_ib_dev *dev,bool td,bool qp) {int err =0 ; +if (dev->lb.force_enable) +return 0 ; +mutex_lock (&dev->lb.mutex);if (td) dev->lb.user_td++;
@@ -1890,6 +1898,9 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp)void mlx5_ib_disable_lb (struct mlx5_ib_dev *dev,bool td,bool qp) { +if (dev->lb.force_enable) +return ; +mutex_lock (&dev->lb.mutex);if (td) dev->lb.user_td--;
@@ -3569,7 +3580,7 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev,lockdep_assert_held (&mlx5_ib_multiport_mutex); -mlx5_ib_disable_lb_mp (ibdev->mdev, mpi->mdev); +mlx5_ib_disable_lb_mp (ibdev->mdev, mpi->mdev, &ibdev->lb); mlx5_core_mp_event_replay(ibdev->mdev, MLX5_DRIVER_EVENT_AFFILIATION_REMOVED,
@@ -3666,7 +3677,7 @@ static bool mlx5_ib_bind_slave_port(struct mlx5_ib_dev *ibdev,MLX5_DRIVER_EVENT_AFFILIATION_DONE , &key); - err =mlx5_ib_enable_lb_mp (ibdev->mdev, mpi->mdev); + err =mlx5_ib_enable_lb_mp (ibdev->mdev, mpi->mdev, &ibdev->lb);if (err) goto unbind;
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -0
@@ -1109,6 +1109,7 @@ struct mlx5_ib_lb_state {u32 user_td;int qps;bool enabled; +bool force_enable; };struct mlx5_ib_pf_eq {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 304/563 drm/amd/pm: Fix si_upload_smc_data (v3)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit a43b2cec04b02743338aa78f837ee0bdf066a6d5 ]
The si_upload_smc_data function uses si_write_smc_soft_register to set some register values in the SMC, and expects the result to be PPSMC_Result_OK which is 1.
The PPSMC_Result_OK / PPSMC_Result_Failed values are used for checking the result of a command sent to the SMC. However, the si_write_smc_soft_register actually doesn't send any commands to the SMC and returns zero on success, so this check was incorrect.
Fix that by not checking the return value, just like other calls to si_write_smc_soft_register.
v3:
Additionally, when no display is plugged in, there is no need to restrict MCLK switching, so program the registers to zero.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +24 -19
@@ -5813,9 +5813,9 @@ static int si_upload_smc_data(struct amdgpu_device *adev) {struct amdgpu_crtc *amdgpu_crtc =NULL ;int i; - -if (adev->pm.dpm.new_active_crtc_count ==0 ) -return 0 ; +u32 crtc_index =0 ; +u32 mclk_change_block_cp_min =0 ; +u32 mclk_change_block_cp_max =0 ;for (i =0 ; i < adev->mode_info.num_crtc; i++) {if (adev->pm.dpm.new_active_crtcs & (1 << i)) {
@@ -5824,26 +5824,31 @@ static int si_upload_smc_data(struct amdgpu_device *adev) } } -if (amdgpu_crtc ==NULL ) -return 0 ; +/* When a display is plugged in, program these so that the SMC +* performs MCLK switching when it doesn't cause flickering. +* When no display is plugged in, there is no need to restrict +* MCLK switching, so program them to zero. +*/ +if (adev->pm.dpm.new_active_crtc_count && amdgpu_crtc) { + crtc_index = amdgpu_crtc->crtc_id; -if (amdgpu_crtc->line_time <=0 ) -return 0 ; +if (amdgpu_crtc->line_time) { + mclk_change_block_cp_min = amdgpu_crtc->wm_high / amdgpu_crtc->line_time; + mclk_change_block_cp_max = amdgpu_crtc->wm_low / amdgpu_crtc->line_time; + } + } -if (si_write_smc_soft_register (adev, - SI_SMC_SOFT_REGISTER_crtc_index, - amdgpu_crtc->crtc_id) != PPSMC_Result_OK) -return 0 ; +si_write_smc_soft_register (adev, + SI_SMC_SOFT_REGISTER_crtc_index, + crtc_index); -if (si_write_smc_soft_register (adev, - SI_SMC_SOFT_REGISTER_mclk_change_block_cp_min, - amdgpu_crtc->wm_high / amdgpu_crtc->line_time) != PPSMC_Result_OK) -return 0 ; +si_write_smc_soft_register (adev, + SI_SMC_SOFT_REGISTER_mclk_change_block_cp_min, + mclk_change_block_cp_min); -if (si_write_smc_soft_register (adev, - SI_SMC_SOFT_REGISTER_mclk_change_block_cp_max, - amdgpu_crtc->wm_low / amdgpu_crtc->line_time) != PPSMC_Result_OK) -return 0 ; +si_write_smc_soft_register (adev, + SI_SMC_SOFT_REGISTER_mclk_change_block_cp_max, + mclk_change_block_cp_max);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 313/563 PCI: tegra: Fix devm_kcalloc() argument order for port->phys allocation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit e1a8805e5d263453ad76a4f50ab3b1c18ea07560 ]
Fix incorrect argument order in devm_kcalloc() when allocating port->phys. The original call used sizeof(phy) as the number of elements and port->lanes as the element size, which is reversed. While this happens to produce the correct total allocation size with current pointer size and lane counts, the argument order is wrong.
--- drivers/pci/controller/pci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
@@ -1344,7 +1344,7 @@ static int tegra_pcie_port_get_phys(struct tegra_pcie_port *port)unsigned int i;int err; - port->phys =devm_kcalloc (dev,sizeof (phy), port->lanes,GFP_KERNEL ); + port->phys =devm_kcalloc (dev, port->lanes,sizeof (phy),GFP_KERNEL );if (!port->phys)return -ENOMEM ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 314/563 wifi: mac80211: consider links for validating SCAN_FLAG_AP in scan request during MLO
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aditya Kumar Singh <[email protected]>
[ Upstream commit 36b75dcb1e25739a3a0975699208c98f4b55d012 ]
Commit 78a7a126dc5b ("wifi: mac80211: validate SCAN_FLAG_AP in scan request during MLO") introduced a check that rejects scan requests if any link is already beaconing. This works fine when all links share the same radio, but breaks down in multi-radio setups.
Consider a scenario where a 2.4 GHz link is beaconing and a scan is requested on a 5 GHz link, each backed by a different physical radio. The current logic still blocks the scan, even though it should be allowed. As a result, interface bring-up fails unnecessarily in valid configurations.
Fix this by checking whether the scan is being requested on the same underlying radio as the beaconing link. Only reject the scan if it targets a link that is already beaconing and the NL80211_FEATURE_AP_SCAN is not set. This ensures correct behavior in multi-radio environments and avoids false rejections.
--- net/mac80211/cfg.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
net/mac80211/cfg.c +17 -4
@@ -3001,6 +3001,9 @@ static int ieee80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *req) {struct ieee80211_sub_if_data *sdata; +struct ieee80211_link_data *link; +struct ieee80211_channel *chan; +int radio_idx; sdata =IEEE80211_WDEV_TO_SUB_IF (req->wdev);
@@ -3028,10 +3031,20 @@ static int ieee80211_scan(struct wiphy *wiphy,* the frames sent while scanning on other channel will be * lost) */ -if (ieee80211_num_beaconing_links (sdata) && - (!(wiphy->features &NL80211_FEATURE_AP_SCAN ) || - !(req->flags &NL80211_SCAN_FLAG_AP ))) -return -EOPNOTSUPP ; +for_each_link_data (sdata, link) { +/* if the link is not beaconing, ignore it */ +if (!sdata_dereference (link->u.ap.beacon, sdata)) +continue ; + + chan = link->conf->chanreq.oper.chan; + radio_idx =cfg80211_get_radio_idx_by_chan (wiphy, chan); + +if (ieee80211_is_radio_idx_in_scan_req (wiphy, req, + radio_idx) && + (!(wiphy->features &NL80211_FEATURE_AP_SCAN ) || + !(req->flags &NL80211_SCAN_FLAG_AP ))) +return -EOPNOTSUPP ; + }break ;case NL80211_IFTYPE_NAN :default :
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 315/563 PCI: qcom: Add equalization settings for 8.0 GT/s and 32.0 GT/s
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziyue Zhang <[email protected]>
[ Upstream commit 37bf0f4e39de9b53bc6f8d3702b021e2c6b5bae3 ]
Add lane equalization setting for 8.0 GT/s and 32.0 GT/s to enhance link stability and avoid AER Correctable Errors reported on some platforms (eg. SA8775P).
8.0 GT/s, 16.0 GT/s and 32.0 GT/s require the same equalization setting. This setting is programmed into a group of shadow registers, which can be switched to configure equalization for different speeds by writing 00b, 01b and 10b to RATE_SHADOW_SEL.
Hence, program equalization registers in a loop using link speed as index, so that equalization setting can be programmed for 8.0 GT/s, 16.0 GT/s and 32.0 GT/s.
--- drivers/pci/controller/dwc/pcie-designware.h | 1 - drivers/pci/controller/dwc/pcie-qcom-common.c | 58 +++++++++++-------- drivers/pci/controller/dwc/pcie-qcom-common.h | 2 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 6 +- drivers/pci/controller/dwc/pcie-qcom.c | 6 +- 5 files changed, 41 insertions(+), 32 deletions(-)
drivers/pci/controller/dwc/pcie-designware.h +0 -1
@@ -123,7 +123,6 @@#define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16)#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24) -#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_16_0GT 0x1#define GEN3_EQ_CONTROL_OFF 0x8A8#define GEN3_EQ_CONTROL_OFF_FB_MODE GENMASK(3, 0)
drivers/pci/controller/dwc/pcie-qcom-common.c +34 -24
75 lines not on this page · raw message
drivers/pci/controller/dwc/pcie-qcom-common.h +1 -1
@@ -8,7 +8,7 @@struct dw_pcie ; -void qcom_pcie_common_set_16gt_equalization (struct dw_pcie *pci); +void qcom_pcie_common_set_equalization (struct dw_pcie *pci);void qcom_pcie_common_set_16gt_lane_margining (struct dw_pcie *pci);#endif
drivers/pci/controller/dwc/pcie-qcom-ep.c +3 -3
@@ -511,10 +511,10 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci) goto err_disable_resources; } -if (pcie_link_speed[pci->max_link_speed] ==PCIE_SPEED_16_0GT ) { -qcom_pcie_common_set_16gt_equalization (pci); +qcom_pcie_common_set_equalization (pci); + +if (pcie_link_speed[pci->max_link_speed] ==PCIE_SPEED_16_0GT )qcom_pcie_common_set_16gt_lane_margining (pci); - }/* * The physical address of the MMIO region which is exposed as the BAR
drivers/pci/controller/dwc/pcie-qcom.c +3 -3
@@ -322,10 +322,10 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) {struct qcom_pcie *pcie =to_qcom_pcie (pci); -if (pcie_link_speed[pci->max_link_speed] ==PCIE_SPEED_16_0GT ) { -qcom_pcie_common_set_16gt_equalization (pci); +qcom_pcie_common_set_equalization (pci); + +if (pcie_link_speed[pci->max_link_speed] ==PCIE_SPEED_16_0GT )qcom_pcie_common_set_16gt_lane_margining (pci); - }/* Enable Link Training state machine */ if (pcie->cfg->ops->ltssm_enable)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 316/563 tcp: fix __tcp_close() to only send RST when required
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5f9238530970f2993b23dd67fdaffc552a2d2e98 ]
If the receive queue contains payload that was already received, __tcp_close() can send an unexpected RST.
Refine the code to take tp->copied_seq into account, as we already do in tcp recvmsg().
--- net/ipv4/tcp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +5 -4
@@ -3099,8 +3099,8 @@ bool tcp_check_oom(const struct sock *sk, int shift)void __tcp_close (struct sock *sk,long timeout) { +bool data_was_unread = false;struct sk_buff *skb; -int data_was_unread =0 ;int state;WRITE_ONCE (sk->sk_shutdown,SHUTDOWN_MASK );
@@ -3119,11 +3119,12 @@ void __tcp_close(struct sock *sk, long timeout)* reader process may not have drained the data yet! */ while ((skb =__skb_dequeue (&sk->sk_receive_queue)) !=NULL ) { -u32 len =TCP_SKB_CB (skb)->end_seq -TCP_SKB_CB (skb)->seq; +u32 end_seq =TCP_SKB_CB (skb)->end_seq;if (TCP_SKB_CB (skb)->tcp_flags &TCPHDR_FIN ) - len--; - data_was_unread += len; + end_seq--; +if (after (end_seq,tcp_sk (sk)->copied_seq)) + data_was_unread = true;__kfree_skb (skb); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 317/563 fanotify: Validate the return value of mnt_ns_from_dentry() before dereferencing
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anderson Nascimento <[email protected]>
[ Upstream commit 62e59ffe8787b5550ccff70c30b6f6be6a3ac3dd ]
The function do_fanotify_mark() does not validate if mnt_ns_from_dentry() returns NULL before dereferencing mntns->user_ns. This causes a NULL pointer dereference in do_fanotify_mark() if the path is not a mount namespace object.
Fix this by checking mnt_ns_from_dentry()'s return value before dereferencing it.
Before the patch
$ gcc fanotify_nullptr.c -o fanotify_nullptr $ mkdir A $ ./fanotify_nullptr Fanotify fd: 3 fanotify_mark: Operation not permitted $ unshare -Urm Fanotify fd: 3 Killed
int main(void){
int ffd;
ffd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_MNT, 0);
if(ffd < 0){
perror("fanotify_init");
exit(EXIT_FAILURE);
}
printf("Fanotify fd: %d\n",ffd);
if(fanotify_mark(ffd, FAN_MARK_ADD | FAN_MARK_MNTNS,
FAN_MNT_ATTACH, AT_FDCWD, "A") < 0){
perror("fanotify_mark");
exit(EXIT_FAILURE);
}return 0;
}
After the patch
$ gcc fanotify_nullptr.c -o fanotify_nullptr $ mkdir A $ ./fanotify_nullptr Fanotify fd: 3 fanotify_mark: Operation not permitted $ unshare -Urm Fanotify fd: 3 fanotify_mark: Invalid argument
[ 25.694973] BUG: kernel NULL pointer dereference, address: 0000000000000038 [ 25.695006] #PF: supervisor read access in kernel mode [ 25.695012] #PF: error_code(0x0000) - not-present page [ 25.695017] PGD 109a30067 P4D 109a30067 PUD 142b46067 PMD 0 [ 25.695025] Oops: Oops: 0000 [#1] SMP NOPTI [ 25.695032] CPU: 4 UID: 1000 PID: 1478 Comm: fanotify_nullpt Not tainted 6.17.0-rc4 #1 PREEMPT(lazy) [ 25.695040] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 11/12/2020 [ 25.695049] RIP: 0010:do_fanotify_mark+0x817/0x950 [ 25.695066] Code: 04 00 00 e9 45 fd ff ff 48 8b 7c 24 48 4c 89 54 24 18 4c 89 5c 24 10 4c 89 0c 24 e8 b3 11 fc ff 4c 8b 54 24 18 4c 8b 5c 24 10 <48> 8b 78 38 4c 8b 0c 24 49 89 c4 e9 13 fd ff ff 8b 4c 24 28 85 c9 [ 25.695081] RSP: 0018:ffffd31c469e3c08 EFLAGS: 00010203 [ 25.695104] RAX: 0000000000000000 RBX: 0000000001000000 RCX: ffff8eb48aebd220 [ 25.695110] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8eb4835e8180 [ 25.695115] RBP: 0000000000000111 R08: 0000000000000000 R09: 0000000000000000 [ 25.695142] R10: ffff8eb48a7d56c0 R11: ffff8eb482bede00 R12: 00000000004012a7 [ 25.695148] R13: 0000000000000110 R14: 0000000000000001 R15: ffff8eb48a7d56c0 [ 25.695154] FS: 00007f8733bda740(0000) GS:ffff8eb61ce5f000(0000) knlGS:0000000000000000 [ 25.695162] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 25.695170] CR2: 0000000000000038 CR3: 0000000136994006 CR4: 00000000003706f0 [ 25.695201] Call Trace: [ 25.695209] <TASK> [ 25.695215] __x64_sys_fanotify_mark+0x1f/0x30 [ 25.695222] do_syscall_64+0x82/0x2c0
...
--- fs/notify/fanotify/fanotify_user.c | 3 +++ 1 file changed, 3 insertions(+)
fs/notify/fanotify/fanotify_user.c +3 -0
@@ -1999,7 +1999,10 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, user_ns = path.mnt->mnt_sb->s_user_ns; obj = path.mnt->mnt_sb; }else if (obj_type ==FSNOTIFY_OBJ_TYPE_MNTNS ) { + ret = -EINVAL ; mntns =mnt_ns_from_dentry (path.dentry); +if (!mntns) + goto path_put_and_out; user_ns = mntns->user_ns; obj = mntns; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 318/563 drm/amdkfd: Fix error code sign for EINVAL in svm_ioctl()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qianfeng Rong <[email protected]>
[ Upstream commit cbda64f3f58027f68211dda8ea94d52d7e493995 ]
Use negative error code -EINVAL instead of positive EINVAL in the default case of svm_ioctl() to conform to Linux kernel error code conventions.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
@@ -4239,7 +4239,7 @@ svm_ioctl(struct kfd_process *p, enum kfd_ioctl_svm_op op, uint64_t start, r =svm_range_get_attr (p, mm, start, size, nattrs, attrs);break ;default : - r =EINVAL ; + r = -EINVAL ;break ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 319/563 usb: phy: twl6030: Fix incorrect type for ret
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xichao Zhao <[email protected]>
[ Upstream commit b570b346ddd727c4b41743a6a2f49e7217c5317f ]
In the twl6030_usb_probe(), the variable ret is declared as a u32 type. However, since ret may receive -ENODEV when accepting the return value of omap_usb2_set_comparator().Therefore, its type should be changed to int.
--- drivers/usb/phy/phy-twl6030-usb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/phy/phy-twl6030-usb.c +1 -2
@@ -328,9 +328,8 @@ static int twl6030_set_vbus(struct phy_companion *comparator, bool enabled)static int twl6030_usb_probe (struct platform_device *pdev) { -u32 ret;struct twl6030_usb *twl; -int status, err; +int status, err, ret;struct device_node *np = pdev->dev.of_node;struct device *dev = &pdev->dev;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 320/563 usb: gadget: configfs: Correctly set use_os_string at bind
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Wu <[email protected]>
[ Upstream commit e271cc0d25015f4be6c88bd7731444644eb352c2 ]
Once the use_os_string flag is set to true for some functions (e.g. adb/mtp) which need to response the OS string, and then if we re-bind the ConfigFS gadget to use the other functions (e.g. hid) which should not to response the OS string, however, because the use_os_string flag is still true, so the usb gadget response the OS string descriptor incorrectly, this can cause the USB device to be unrecognizable on the Windows system.
An example of this as follows:
echo 1 > os_desc/use
ln -s functions/ffs.adb configs/b.1/function0
start adbd
echo "<udc device>" > UDC #succeed
stop adbd
rm configs/b.1/function0
echo 0 > os_desc/use
ln -s functions/hid.gs0 configs/b.1/function0 echo "<udc device>" > UDC #fail to connect on Windows
This patch sets the use_os_string flag to false at bind if the functions not support OS Descriptors.
--- drivers/usb/gadget/configfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/configfs.c +2 -0
@@ -1750,6 +1750,8 @@ static int configfs_composite_bind(struct usb_gadget *gadget, cdev->use_os_string = true; cdev->b_vendor_code = gi->b_vendor_code;memcpy (cdev->qw_sign, gi->qw_sign,OS_STRING_QW_SIGN_LEN ); + }else { + cdev->use_os_string = false; }if (gadget_is_otg (gadget) && !otg_desc[0 ]) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 321/563 tty: n_gsm: Dont block input queue by waiting MSC
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seppo Takalo <[email protected]>
[ Upstream commit 3cf0b3c243e56bc43be560617416c1d9f301f44c ]
Currently gsm_queue() processes incoming frames and when opening a DLC channel it calls gsm_dlci_open() which calls gsm_modem_update(). If basic mode is used it calls gsm_modem_upd_via_msc() and it cannot block the input queue by waiting the response to come into the same input queue.
Instead allow sending Modem Status Command without waiting for remote end to respond. Define a new function gsm_modem_send_initial_msc() for this purpose. As MSC is only valid for basic encoding, it does not do anything for advanced or when convergence layer type 2 is used.
--- drivers/tty/n_gsm.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/tty/n_gsm.c +24 -1
@@ -461,6 +461,7 @@ static int gsm_send_packet(struct gsm_mux *gsm, struct gsm_msg *msg);static struct gsm_dlci *gsm_dlci_alloc (struct gsm_mux *gsm,int addr);static void gsmld_write_trigger (struct gsm_mux *gsm);static void gsmld_write_task (struct work_struct *work); +static int gsm_modem_send_initial_msc (struct gsm_dlci *dlci);/** * gsm_fcs_add - update FCS
@@ -2174,7 +2175,7 @@ static void gsm_dlci_open(struct gsm_dlci *dlci)pr_debug ("DLCI %d goes open.\n" , dlci->addr);/* Send current modem state */ if (dlci->addr) { -gsm_modem_update (dlci,0 ); +gsm_modem_send_initial_msc (dlci); }else {/* Start keep-alive control */ gsm->ka_num =0 ;
@@ -4161,6 +4162,28 @@ static int gsm_modem_upd_via_msc(struct gsm_dlci *dlci, u8 brk)return gsm_control_wait (dlci->gsm, ctrl); } +/** +* gsm_modem_send_initial_msc - Send initial modem status message +* +* @dlci channel +* +* Send an initial MSC message after DLCI open to set the initial +* modem status lines. This is only done for basic mode. +* Does not wait for a response as we cannot block the input queue +* processing. +*/ +static int gsm_modem_send_initial_msc (struct gsm_dlci *dlci) +{ +u8 modembits[2 ]; + +if (dlci->adaption !=1 || dlci->gsm->encoding !=GSM_BASIC_OPT ) +return 0 ; + + modembits[0 ] = (dlci->addr <<2 ) |2 |EA ;/* DLCI, Valid, EA */ + modembits[1 ] = (gsm_encode_modem (dlci) <<1 ) |EA ; +return gsm_control_command (dlci->gsm,CMD_MSC , (const u8 *)&modembits,2 ); +} +/** * gsm_modem_update - send modem status line state * @dlci: channel
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 322/563 misc: genwqe: Fix incorrect cmd field being reported in error
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 6b26053819dccc664120e07c56f107fb6f72f3fa ]
There is a dev_err message that is reporting the value of cmd->asiv_length when it should be reporting cmd->asv_length instead. Fix this.
--- drivers/misc/genwqe/card_ddcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/genwqe/card_ddcb.c +1 -1
@@ -923,7 +923,7 @@ int __genwqe_execute_raw_ddcb(struct genwqe_dev *cd, }if (cmd->asv_length >DDCB_ASV_LENGTH ) {dev_err (&pci_dev->dev,"[%s] err: wrong asv_length of %d\n" , - __func__, cmd->asiv_length); + __func__, cmd->asv_length);return -EINVAL ; } rc =__genwqe_enqueue_ddcb (cd, req, f_flags);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 305/563 drm/amd/pm: Adjust si_upload_smc_data register programming (v3)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit ce025130127437dc884c84c254170e27b2ce9309 ]
Based on some comments in dm_pp_display_configuration above the crtc_index and line_time fields, these values are programmed to the SMC to work around an SMC hang when it switches MCLK.
According to Alex, the Windows driver programs them to:mclk_change_block_cp_min = 200 / line_time mclk_change_block_cp_max = 100 / line_time Let's use the same for the sake of consistency.
Previously we used the watermark values, but it seemed buggy as the code was mixing up low/high and A/B watermarks, and was not saving a low watermark value on DCE 6, so mclk_change_block_cp_max would be always zero previously.
Split this change off from the previous si_upload_smc_data to make it easier to bisect, in case it causes any issues.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +2 -2
@@ -5833,8 +5833,8 @@ static int si_upload_smc_data(struct amdgpu_device *adev) crtc_index = amdgpu_crtc->crtc_id;if (amdgpu_crtc->line_time) { - mclk_change_block_cp_min = amdgpu_crtc->wm_high / amdgpu_crtc->line_time; - mclk_change_block_cp_max = amdgpu_crtc->wm_low / amdgpu_crtc->line_time; + mclk_change_block_cp_min =200 / amdgpu_crtc->line_time; + mclk_change_block_cp_max =100 / amdgpu_crtc->line_time; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 323/563 pps: fix warning in pps_register_cdev when register device fail
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Liang <[email protected]>
[ Upstream commit b0531cdba5029f897da5156815e3bdafe1e9b88d ]
Similar to previous commit 2a934fdb01db ("media: v4l2-dev: fix error handling in __video_register_device()"), the release hook should be set before device_register(). Otherwise, when device_register() return error and put_device() try to callback the release function, the below warning may happen.
------------[ cut here ]------------ WARNING: CPU: 1 PID: 4760 at drivers/base/core.c:2567 device_release+0x1bd/0x240 drivers/base/core.c:2567 Modules linked in: CPU: 1 UID: 0 PID: 4760 Comm: syz.4.914 Not tainted 6.17.0-rc3+ #1 NONE RIP: 0010:device_release+0x1bd/0x240 drivers/base/core.c:2567 Call Trace: <TASK> kobject_cleanup+0x136/0x410 lib/kobject.c:689 kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0xe9/0x130 lib/kobject.c:737 put_device+0x24/0x30 drivers/base/core.c:3797 pps_register_cdev+0x2da/0x370 drivers/pps/pps.c:402 pps_register_source+0x2f6/0x480 drivers/pps/kapi.c:108 pps_tty_open+0x190/0x310 drivers/pps/clients/pps-ldisc.c:57 tty_ldisc_open+0xa7/0x120 drivers/tty/tty_ldisc.c:432 tty_set_ldisc+0x333/0x780 drivers/tty/tty_ldisc.c:563 tiocsetd drivers/tty/tty_io.c:2429 [inline] tty_ioctl+0x5d1/0x1700 drivers/tty/tty_io.c:2728 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:598 [inline] __se_sys_ioctl fs/ioctl.c:584 [inline] __x64_sys_ioctl+0x194/0x210 fs/ioctl.c:584 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x5f/0x2a0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
Before commit c79a39dc8d06 ("pps: Fix a use-after-free"), pps_register_cdev() call device_create() to create pps->dev, which will init dev->release to device_create_release(). Now the comment is outdated, just remove it.
Thanks for the reminder from Calvin Owens, 'kfree_pps' should be removed in pps_register_source() to avoid a double free in the failure case.
--- drivers/pps/kapi.c | 5 +---- drivers/pps/pps.c | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/pps/kapi.c +1 -4
@@ -109,16 +109,13 @@ struct pps_device *pps_register_source(struct pps_source_info *info,if (err <0 ) {pr_err ("%s: unable to create char device\n" , info->name); - goto kfree_pps; + goto pps_register_source_exit; }dev_dbg (&pps->dev,"new PPS source %s\n" , info->name);return pps; -kfree_pps: -kfree (pps); - pps_register_source_exit:pr_err ("%s: unable to register source\n" , info->name);
drivers/pps/pps.c +2 -3
@@ -374,6 +374,7 @@ int pps_register_cdev(struct pps_device *pps) pps->info.name); err = -EBUSY ; } +kfree (pps); goto out_unlock; } pps->id = err;
@@ -383,13 +384,11 @@ int pps_register_cdev(struct pps_device *pps) pps->dev.devt =MKDEV (pps_major, pps->id);dev_set_drvdata (&pps->dev, pps);dev_set_name (&pps->dev,"pps%d" , pps->id); + pps->dev.release = pps_device_destruct; err =device_register (&pps->dev);if (err) goto free_idr; -/* Override the release function with our own */ - pps->dev.release = pps_device_destruct; -pr_debug ("source %s got cdev (%d:%d)\n" , pps->info.name, pps_major, pps->id);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 324/563 drm/msm: Fix obj leak in VM_BIND error path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 278f8904434aa96055e793936b5977c010549e28 ]
If we fail a handle-lookup part way thru, we need to drop the already obtained obj references.
Patchwork: https://patchwork.freedesktop.org/patch/669784/
--- drivers/gpu/drm/msm/msm_gem_vma.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/msm_gem_vma.c +19 -6
@@ -1023,6 +1023,7 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *argsstruct drm_device *dev = job->vm->drm;int ret =0 ;int cnt =0 ; +int i =-1 ;if (args->nr_ops ==1 ) {/* Single op case, the op is inlined: */
@@ -1056,11 +1057,12 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *argsspin_lock (&file->table_lock); -for (unsigned i =0 ; i < args->nr_ops; i++) { +for (i =0 ; i < args->nr_ops; i++) { +struct msm_vm_bind_op *op = &job->ops[i];struct drm_gem_object *obj; -if (!job->ops[i].handle) { - job->ops[i].obj =NULL ; +if (!op->handle) { + op->obj =NULL ;continue ; }
@@ -1068,15 +1070,15 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args* normally use drm_gem_object_lookup(), but for bulk lookup * all under single table_lock just hit object_idr directly: */ - obj =idr_find (&file->object_idr, job->ops[i].handle); + obj =idr_find (&file->object_idr, op->handle);if (!obj) { - ret =UERR (EINVAL , dev,"invalid handle %u at index %u\n" , job->ops[i].handle, i); + ret =UERR (EINVAL , dev,"invalid handle %u at index %u\n" , op->handle, i); goto out_unlock; }drm_gem_object_get (obj); - job->ops[i].obj = obj; + op->obj = obj; cnt++; }
@@ -1085,6 +1087,17 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args out_unlock:spin_unlock (&file->table_lock); +if (ret) { +for (; i >=0 ; i--) { +struct msm_vm_bind_op *op = &job->ops[i]; + +if (!op->obj) +continue ; + +drm_gem_object_put (op->obj); + op->obj =NULL ; + } + } out:return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 325/563 drm/msm: Fix missing VM_BIND offset/range validation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 3a3bef68a6c15d079646a964ebc4dc8bb0aedb06 ]
We need to reject the MAP op if offset+range is larger than the BO size.
Patchwork: https://patchwork.freedesktop.org/patch/669781/
--- drivers/gpu/drm/msm/msm_gem_vma.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/msm/msm_gem_vma.c +6 -0
@@ -1080,6 +1080,12 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args op->obj = obj; cnt++; + +if ((op->range + op->obj_offset) > obj->size) { + ret =UERR (EINVAL , dev,"invalid range: %016llx + %016llx > %016zx\n" , + op->range, op->obj_offset, obj->size); + goto out_unlock; + } } *nr_bos = cnt;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 326/563 wifi: iwlwifi: Remove redundant header files
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Yuanhong <[email protected]>
[ Upstream commit b4b34ba66443696cc5f3e95493f9d7597259b728 ]
The header file "fw/img.h" is already included on line 9. Remove the redundant include.
--- drivers/net/wireless/intel/iwlwifi/fw/regulatory.h | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/regulatory.h +0 -1
@@ -12,7 +12,6 @@#include "fw/api/phy.h" #include "fw/api/config.h" #include "fw/api/nvm-reg.h" -#include "fw/img.h" #include "iwl-trans.h" #define BIOS_SAR_MAX_PROFILE_NUM 4
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 327/563 drm/msm/mdp4: stop supporting no-IOMMU configuration
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit cc64568b522b64fb8f8c607da9eb4e2d9f72d0cf ]
With the switch to GPUVM the msm driver no longer supports the no-IOMMU configurations (even without the actual GPU). Return an error in case we face the lack of the IOMMU for an MDP4 device.
Patchwork: https://patchwork.freedesktop.org/patch/672557/
--- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +3 -3
@@ -463,9 +463,9 @@ static int mdp4_kms_init(struct drm_device *dev) ret =PTR_ERR (mmu); goto fail; }else if (!mmu) { -DRM_DEV_INFO (dev->dev,"no iommu, fallback to phys " -"contig buffers for scanout\n" ); - vm =NULL ; +DRM_DEV_INFO (dev->dev,"no IOMMU, bailing out\n" ); + ret = -ENODEV ; + goto fail; }else { vm = msm_gem_vm_create(dev, mmu, "mdp4", 0x1000, 0x100000000 - 0x1000,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 328/563 drm/msm: stop supporting no-IOMMU configuration
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit c94fc6d35685587aa0cb9a8d7d7062c73ab04d89 ]
With the switch to GPUVM the msm driver no longer supports the no-IOMMU configurations (even without the actual GPU). Return an error in case we face the lack of the IOMMU.
Patchwork: https://patchwork.freedesktop.org/patch/672559/
--- drivers/gpu/drm/msm/msm_kms.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/msm_kms.c +2 -3
@@ -195,14 +195,13 @@ struct drm_gpuvm *msm_kms_init_vm(struct drm_device *dev) iommu_dev = mdp_dev; else iommu_dev = mdss_dev; - mmu =msm_iommu_disp_new (iommu_dev,0 );if (IS_ERR (mmu))return ERR_CAST (mmu);if (!mmu) { -drm_info (dev,"no IOMMU, fallback to phys contig buffers for scanout\n" ); -return NULL ; +drm_info (dev,"no IOMMU, bailing out\n" ); +return ERR_PTR (-ENODEV ); } vm = msm_gem_vm_create(dev, mmu, "mdp_kms",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 329/563 idpf: fix Rx descriptor ready check barrier in splitq
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
[ Upstream commit c20edbacc0295fd36f5f634b3421647ce3e08fd7 ]
No idea what the current barrier position was meant for. At that point, nothing is read from the descriptor, only the pointer to the actual one is fetched.
The correct barrier usage here is after the generation check, so that only the first qword is read if the descriptor is not yet ready and we need to stop polling. Debatable on coherent DMA as the Rx descriptor size is <= cacheline size, but anyway, the current barrier position only makes the codegen worse.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.c +2 -6
@@ -3187,18 +3187,14 @@ static int idpf_rx_splitq_clean(struct idpf_rx_queue *rxq, int budget)/* get the Rx desc from Rx queue based on 'next_to_clean' */ rx_desc = &rxq->rx[ntc].flex_adv_nic_3_wb; -/* This memory barrier is needed to keep us from reading -* any other fields out of the rx_desc -*/ -dma_rmb (); -/* if the descriptor isn't done, no work yet to do */ gen_id =le16_get_bits (rx_desc->pktlen_gen_bufq_id,VIRTCHNL2_RX_FLEX_DESC_ADV_GEN_M ); -if (idpf_queue_has (GEN_CHK , rxq) != gen_id)break ; +dma_rmb (); + rxdid =FIELD_GET (VIRTCHNL2_RX_FLEX_DESC_ADV_RXDID_M , rx_desc->rxdid_ucast);if (rxdid !=VIRTCHNL2_RXDID_2_FLEX_SPLITQ ) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 330/563 ASoC: Intel: bytcht_es8316: Fix invalid quirk input mapping
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit b20eb0e8de383116f1e1470d74da2a3c83c4e345 ]
When an invalid value is passed via quirk option, currently bytcht_es8316 driver just ignores and leaves as is, which may lead to unepxected results like OOB access.
This patch adds the sanity check and corrects the input mapping to the certain default value if an invalid value is passed.
Message-ID: <[email protected]>
--- sound/soc/intel/boards/bytcht_es8316.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
sound/soc/intel/boards/bytcht_es8316.c +17 -3
@@ -47,7 +47,8 @@ enum { BYT_CHT_ES8316_INTMIC_IN2_MAP, }; -#define BYT_CHT_ES8316_MAP (quirk) ((quirk) & GENMASK(3, 0)) +#define BYT_CHT_ES8316_MAP_MASK GENMASK(3, 0) +#define BYT_CHT_ES8316_MAP (quirk) ((quirk) & BYT_CHT_ES8316_MAP_MASK)#define BYT_CHT_ES8316_SSP0 BIT(16)#define BYT_CHT_ES8316_MONO_SPEAKER BIT(17)#define BYT_CHT_ES8316_JD_INVERTED BIT(18)
@@ -60,10 +61,23 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");static void log_quirks (struct device *dev) { -if (BYT_CHT_ES8316_MAP (quirk) ==BYT_CHT_ES8316_INTMIC_IN1_MAP ) +int map; + + map =BYT_CHT_ES8316_MAP (quirk); +switch (map) { +case BYT_CHT_ES8316_INTMIC_IN1_MAP :dev_info (dev,"quirk IN1_MAP enabled" ); -if (BYT_CHT_ES8316_MAP (quirk) ==BYT_CHT_ES8316_INTMIC_IN2_MAP ) +break ; +case BYT_CHT_ES8316_INTMIC_IN2_MAP :dev_info (dev,"quirk IN2_MAP enabled" ); +break ; +default : +dev_warn_once (dev,"quirk sets invalid input map: 0x%x, default to INTMIC_IN1_MAP\n" , map); + quirk &= ~BYT_CHT_ES8316_MAP_MASK ; + quirk |=BYT_CHT_ES8316_INTMIC_IN1_MAP ; +break ; + } +if (quirk &BYT_CHT_ES8316_SSP0 )dev_info (dev,"quirk SSP0 enabled" );if (quirk &BYT_CHT_ES8316_MONO_SPEAKER )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 331/563 ASoC: Intel: bytcr_rt5640: Fix invalid quirk input mapping
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit fba404e4b4af4f4f747bb0e41e9fff7d03c7bcc0 ]
When an invalid value is passed via quirk option, currently bytcr_rt5640 driver only shows an error message but leaves as is. This may lead to unepxected results like OOB access.
This patch corrects the input mapping to the certain default value if an invalid value is passed.
Message-ID: <[email protected]>
--- sound/soc/intel/boards/bytcr_rt5640.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +5 -2
@@ -68,7 +68,8 @@ enum { BYT_RT5640_OVCD_SF_1P5 = (RT5640_OVCD_SF_1P5 << 13), }; -#define BYT_RT5640_MAP (quirk) ((quirk) & GENMASK(3, 0)) +#define BYT_RT5640_MAP_MASK GENMASK(3, 0) +#define BYT_RT5640_MAP (quirk) ((quirk) & BYT_RT5640_MAP_MASK)#define BYT_RT5640_JDSRC (quirk) (((quirk) & GENMASK(7, 4)) >> 4)#define BYT_RT5640_OVCD_TH (quirk) (((quirk) & GENMASK(12, 8)) >> 8)#define BYT_RT5640_OVCD_SF (quirk) (((quirk) & GENMASK(14, 13)) >> 13)
@@ -140,7 +141,9 @@ static void log_quirks(struct device *dev)dev_info (dev,"quirk NO_INTERNAL_MIC_MAP enabled\n" );break ;default : -dev_err (dev,"quirk map 0x%x is not supported, microphone input will not work\n" , map); +dev_warn_once (dev,"quirk sets invalid input map: 0x%x, default to DMIC1_MAP\n" , map); + byt_rt5640_quirk &= ~BYT_RT5640_MAP_MASK ; + byt_rt5640_quirk |=BYT_RT5640_DMIC1_MAP ;break ; }if (byt_rt5640_quirk &BYT_RT5640_HSMIC2_ON_IN1 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 332/563 ASoC: Intel: bytcr_rt5651: Fix invalid quirk input mapping
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 4336efb59ef364e691ef829a73d9dbd4d5ed7c7b ]
When an invalid value is passed via quirk option, currently bytcr_rt5640 driver just ignores and leaves as is, which may lead to unepxected results like OOB access.
This patch adds the sanity check and corrects the input mapping to the certain default value if an invalid value is passed.
Message-ID: <[email protected]>
--- sound/soc/intel/boards/bytcr_rt5651.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
sound/soc/intel/boards/bytcr_rt5651.c +21 -5
@@ -58,7 +58,8 @@ enum { BYT_RT5651_OVCD_SF_1P5 = (RT5651_OVCD_SF_1P5 << 13), }; -#define BYT_RT5651_MAP (quirk) ((quirk) & GENMASK(3, 0)) +#define BYT_RT5651_MAP_MASK GENMASK(3, 0) +#define BYT_RT5651_MAP (quirk) ((quirk) & BYT_RT5651_MAP_MASK)#define BYT_RT5651_JDSRC (quirk) (((quirk) & GENMASK(7, 4)) >> 4)#define BYT_RT5651_OVCD_TH (quirk) (((quirk) & GENMASK(12, 8)) >> 8)#define BYT_RT5651_OVCD_SF (quirk) (((quirk) & GENMASK(14, 13)) >> 13)
@@ -100,14 +101,29 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");static void log_quirks (struct device *dev) { -if (BYT_RT5651_MAP (byt_rt5651_quirk) ==BYT_RT5651_DMIC_MAP ) +int map; + + map =BYT_RT5651_MAP (byt_rt5651_quirk); +switch (map) { +case BYT_RT5651_DMIC_MAP :dev_info (dev,"quirk DMIC_MAP enabled" ); -if (BYT_RT5651_MAP (byt_rt5651_quirk) ==BYT_RT5651_IN1_MAP ) +break ; +case BYT_RT5651_IN1_MAP :dev_info (dev,"quirk IN1_MAP enabled" ); -if (BYT_RT5651_MAP (byt_rt5651_quirk) ==BYT_RT5651_IN2_MAP ) +break ; +case BYT_RT5651_IN2_MAP :dev_info (dev,"quirk IN2_MAP enabled" ); -if (BYT_RT5651_MAP (byt_rt5651_quirk) ==BYT_RT5651_IN1_IN2_MAP ) +break ; +case BYT_RT5651_IN1_IN2_MAP :dev_info (dev,"quirk IN1_IN2_MAP enabled" ); +break ; +default : +dev_warn_once (dev,"quirk sets invalid input map: 0x%x, default to DMIC_MAP\n" , map); + byt_rt5651_quirk &= ~BYT_RT5651_MAP_MASK ; + byt_rt5651_quirk |=BYT_RT5651_DMIC_MAP ; +break ; + } +if (BYT_RT5651_JDSRC (byt_rt5651_quirk)) {dev_info (dev,"quirk realtek,jack-detect-source %ld\n" ,BYT_RT5651_JDSRC (byt_rt5651_quirk));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 306/563 drm/amd/pm: Treat zero vblank time as too short in si_dpm (v3)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit 9003a0746864f39a0ef72bd45f8e1ad85d930d67 ]
Some parts of the code base expect that MCLK switching is turned off when the vblank time is set to zero.
According to pp_pm_compute_clocks the non-DC code has issues with MCLK switching with refresh rates over 120 Hz.
v3:
Add code comment to explain this better.
Add an if statement instead of changing the switch_limit.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +7 -1
@@ -3085,7 +3085,13 @@ static bool si_dpm_vblank_too_short(void *handle)/* we never hit the non-gddr5 limit so disable it */ u32 switch_limit = adev->gmc.vram_type ==AMDGPU_VRAM_TYPE_GDDR5 ?450 :0 ; -if (vblank_time < switch_limit) +/* Consider zero vblank time too short and disable MCLK switching. +* Note that the vblank time is set to maximum when no displays are attached, +* so we'll still enable MCLK switching in that case. +*/ +if (vblank_time ==0 ) +return true; +else if (vblank_time < switch_limit)return true;else return false;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 333/563 ipv6: snmp: do not use SNMP_MIB_SENTINEL anymore
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ceac1fb2290d230eb83aff3761058c559440de13 ]
Use ARRAY_SIZE(), so that we know the limit at compile time.
Following patch needs this preliminary change.
Stable-dep-of: 2fab94bcf313 ("ipv6: snmp: do not track per idev ICMP6_MIB_RATELIMITHOST")
--- include/net/ip.h | 24 ++++++++++++++++++++++++ net/ipv6/proc.c | 43 ++++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 19 deletions(-)
include/net/ip.h +24 -0
@@ -338,6 +338,19 @@ static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_o } \ } +#define snmp_get_cpu_field64_batch_cnt (buff64, stats_list, cnt, \ + mib_statistic, offset) \ +{ \ + int i, c; \ + for_each_possible_cpu(c) { \ + for (i = 0; i < cnt; i++) \ + buff64[i] += snmp_get_cpu_field64( \ + mib_statistic, \ + c, stats_list[i].entry, \ + offset); \ + } \ +} +#define snmp_get_cpu_field_batch (buff, stats_list, mib_statistic) \ { \ int i, c; \
@@ -349,6 +362,17 @@ static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_o } \ } +#define snmp_get_cpu_field_batch_cnt (buff, stats_list, cnt, mib_statistic) \ +{ \ + int i, c; \ + for_each_possible_cpu(c) { \ + for (i = 0; i < cnt; i++) \ + buff[i] += snmp_get_cpu_field( \ + mib_statistic, \ + c, stats_list[i].entry); \ + } \ +} +static inline void inet_get_local_port_range (const struct net *net,int *low,int *high) {u32 range =READ_ONCE (net->ipv4.ip_local_ports.range);
net/ipv6/proc.c +24 -19
110 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 334/563 ipv6: snmp: do not track per idev ICMP6_MIB_RATELIMITHOST
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2fab94bcf313480336b0a41eb45a24ffd5087490 ]
Blamed commit added a critical false sharing on a single atomic_long_t under DOS, like receiving UDP packets to closed ports.
Per netns ICMP6_MIB_RATELIMITHOST tracking uses per-cpu storage and is enough, we do not need per-device and slow tracking.
--- net/ipv6/icmp.c | 3 +-- net/ipv6/proc.c | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-)
net/ipv6/icmp.c +1 -2
@@ -230,8 +230,7 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type, }rcu_read_unlock ();if (!res) -__ICMP6_INC_STATS (net,ip6_dst_idev (dst), -ICMP6_MIB_RATELIMITHOST ); +__ICMP6_INC_STATS (net,NULL ,ICMP6_MIB_RATELIMITHOST );else icmp_global_consume (net);dst_release (dst);
net/ipv6/proc.c +5 -1
@@ -94,6 +94,7 @@ static const struct snmp_mib snmp6_icmp6_list[] = {SNMP_MIB_ITEM ("Icmp6OutMsgs" ,ICMP6_MIB_OUTMSGS ),SNMP_MIB_ITEM ("Icmp6OutErrors" ,ICMP6_MIB_OUTERRORS ),SNMP_MIB_ITEM ("Icmp6InCsumErrors" ,ICMP6_MIB_CSUMERRORS ), +/* ICMP6_MIB_RATELIMITHOST needs to be last, see snmp6_dev_seq_show(). */ SNMP_MIB_ITEM("Icmp6OutRateLimitHost", ICMP6_MIB_RATELIMITHOST), };
@@ -242,8 +243,11 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v) snmp6_ipstats_list,ARRAY_SIZE (snmp6_ipstats_list), offsetof(struct ipstats_mib, syncp)); + +/* Per idev icmp stats do not have ICMP6_MIB_RATELIMITHOST */ snmp6_seq_show_item (seq,NULL , idev->stats.icmpv6dev->mibs, - snmp6_icmp6_list,ARRAY_SIZE (snmp6_icmp6_list)); + snmp6_icmp6_list,ARRAY_SIZE (snmp6_icmp6_list) -1 ); +snmp6_seq_show_icmpv6msg (seq, idev->stats.icmpv6msgdev->mibs);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 335/563 drm/msm: Fix bootup splat with separate_gpu_drm modparam
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil P Oommen <[email protected]>
[ Upstream commit f028bcafb6dfb4c2bb656cbff9e6a66222d3d3d7 ]
The drm_gem_for_each_gpuvm_bo() call from lookup_vma() accesses drm_gem_obj.gpuva.list, which is not initialized when the drm driver does not support DRIVER_GEM_GPUVA feature. Enable it for msm_kms drm driver to fix the splat seen when msm.separate_gpu_drm=1 modparam is set:
[ 9.506020] Unable to handle kernel paging request at virtual address fffffffffffffff0 [ 9.523160] Mem abort info: [ 9.523161] ESR = 0x0000000096000006 [ 9.523163] EC = 0x25: DABT (current EL), IL = 32 bits [ 9.523165] SET = 0, FnV = 0 [ 9.523166] EA = 0, S1PTW = 0 [ 9.523167] FSC = 0x06: level 2 translation fault [ 9.523169] Data abort info: [ 9.523170] ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000 [ 9.523171] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 9.523172] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 9.523174] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000ad370f000 [ 9.523176] [fffffffffffffff0] pgd=0000000000000000, p4d=0000000ad4787403, pud=0000000ad4788403, pmd=0000000000000000 [ 9.523184] Internal error: Oops: 0000000096000006 [#1] SMP [ 9.592968] CPU: 9 UID: 0 PID: 448 Comm: (udev-worker) Not tainted 6.17.0-rc4-assorted-fix-00005-g0e9bb53a2282-dirty #3 PREEMPT [ 9.592970] Hardware name: Qualcomm CRD, BIOS 6.0.240718.BOOT.MXF.2.4-00515-HAMOA-1 07/18/2024 [ 9.592971] pstate: a1400005 (NzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 9.592973] pc : lookup_vma+0x28/0xe0 [msm] [ 9.592996] lr : get_vma_locked+0x2c/0x128 [msm] [ 9.763632] sp : ffff800082dab460 [ 9.763666] Call trace: [ 9.763668] lookup_vma+0x28/0xe0 [msm] (P) [ 9.763688] get_vma_locked+0x2c/0x128 [msm] [ 9.763706] msm_gem_get_and_pin_iova_range+0x68/0x11c [msm] [ 9.763723] msm_gem_get_and_pin_iova+0x18/0x24 [msm] [ 9.763740] msm_fbdev_driver_fbdev_probe+0xd0/0x258 [msm] [ 9.763760] __drm_fb_helper_initial_config_and_unlock+0x288/0x528 [drm_kms_helper] [ 9.763771] drm_fb_helper_initial_config+0x44/0x54 [drm_kms_helper] [ 9.763779] drm_fbdev_client_hotplug+0x84/0xd4 [drm_client_lib] [ 9.763782] drm_client_register+0x58/0x9c [drm] [ 9.763806] drm_fbdev_client_setup+0xe8/0xcf0 [drm_client_lib] [ 9.763809] drm_client_setup+0xb4/0xd8 [drm_client_lib] [ 9.763811] msm_drm_kms_post_init+0x2c/0x3c [msm] [ 9.763830] msm_drm_init+0x1a8/0x22c [msm] [ 9.763848] msm_drm_bind+0x30/0x3c [msm] [ 9.919273] try_to_bring_up_aggregate_device+0x168/0x1d4 [ 9.919283] __component_add+0xa4/0x170 [ 9.919286] component_add+0x14/0x20 [ 9.919288] msm_dp_display_probe_tail+0x4c/0xac [msm] [ 9.919315] msm_dp_auxbus_done_probe+0x14/0x20 [msm] [ 9.919335] dp_aux_ep_probe+0x4c/0xf0 [drm_dp_aux_bus] [ 9.919341] really_probe+0xbc/0x298 [ 9.919345] __driver_probe_device+0x78/0x12c [ 9.919348] driver_probe_device+0x40/0x160 [ 9.919350] __driver_attach+0x94/0x19c [ 9.919353] bus_for_each_dev+0x74/0xd4 [ 9.919355] driver_attach+0x24/0x30 [ 9.919358] bus_add_driver+0xe4/0x208 [ 9.919360] driver_register+0x60/0x128 [ 9.919363] __dp_aux_dp_driver_register+0x24/0x30 [drm_dp_aux_bus] [ 9.919365] atana33xc20_init+0x20/0x1000 [panel_samsung_atna33xc20] [ 9.919370] do_one_initcall+0x6c/0x1b0 [ 9.919374] do_init_module+0x58/0x234 [ 9.919377] load_module+0x19cc/0x1bd4 [ 9.919380] init_module_from_file+0x84/0xc4 [ 9.919382] __arm64_sys_finit_module+0x1b8/0x2cc [ 9.919384] invoke_syscall+0x48/0x110 [ 9.919389] el0_svc_common.constprop.0+0xc8/0xe8 [ 9.919393] do_el0_svc+0x20/0x2c [ 9.919396] el0_svc+0x34/0xf0 [ 9.919401] el0t_64_sync_handler+0xa0/0xe4 [ 9.919403] el0t_64_sync+0x198/0x19c [ 9.919407] Code: eb0000bf 54000480 d100a003 aa0303e2 (f8418c44) [ 9.919410] ---[ end trace 0000000000000000 ]---
Patchwork: https://patchwork.freedesktop.org/patch/672257/
--- drivers/gpu/drm/msm/msm_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_drv.c +1 -0
@@ -826,6 +826,7 @@ static const struct file_operations fops = {#define DRIVER_FEATURES_KMS ( \ DRIVER_GEM | \ + DRIVER_GEM_GPUVA | \ DRIVER_ATOMIC | \ DRIVER_MODESET | \ 0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 336/563 drm/msm/dpu: fix incorrect type for ret
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qianfeng Rong <[email protected]>
[ Upstream commit 88ec0e01a880e3326794e149efae39e3aa4dbbec ]
Change 'ret' from unsigned long to int, as storing negative error codes in an unsigned long makes it never equal to -ETIMEDOUT, causing logical errors.
Patchwork: https://patchwork.freedesktop.org/patch/671100/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +1 -1
@@ -446,7 +446,7 @@ static void _dpu_encoder_phys_wb_handle_wbdone_timeout(static int dpu_encoder_phys_wb_wait_for_commit_done (struct dpu_encoder_phys *phys_enc) { -unsigned long ret; +int ret;struct dpu_encoder_wait_info wait_info;struct dpu_encoder_phys_wb *wb_enc =to_dpu_encoder_phys_wb (phys_enc);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 337/563 wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarika Sharma <[email protected]>
[ Upstream commit eebccbfea4184feb758c104783b870ec4ddb6aec ]
Currently, sta_set_sinfo() fails to populate link-level station info when sinfo->valid_links is initially 0 and sta->sta.valid_links has bits set for links other than link 0. This typically occurs when association happens on a non-zero link or link 0 deleted dynamically. In such cases, the for_each_valid_link(sinfo, link_id) loop only executes for link 0 and terminates early, since sinfo->valid_links remains 0. As a result, only MLD-level information is reported to userspace.
Hence to fix, initialize sinfo->valid_links with sta->sta.valid_links before entering the loop to ensure loop executes for each valid link. During iteration, mask out invalid links from sinfo->valid_links if any of sta->link[link_id], sdata->link[link_id], or sinfo->links[link_id] are not present, to report only valid link information.
--- net/mac80211/sta_info.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/mac80211/sta_info.c +7 -3
@@ -3206,16 +3206,20 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,struct link_sta_info *link_sta;ether_addr_copy (sinfo->mld_addr, sta->addr); + +/* assign valid links first for iteration */ + sinfo->valid_links = sta->sta.valid_links; +for_each_valid_link (sinfo, link_id) { link_sta =wiphy_dereference (sta->local->hw.wiphy, sta->link[link_id]); link =wiphy_dereference (sdata->local->hw.wiphy, sdata->link[link_id]); -if (!link_sta || !sinfo->links[link_id] || !link) +if (!link_sta || !sinfo->links[link_id] || !link) { + sinfo->valid_links &= ~BIT (link_id);continue ; - - sinfo->valid_links = sta->sta.valid_links; + }sta_set_link_sinfo (sta, sinfo->links[link_id], link, tidstats); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 338/563 fs: ntfs3: Fix integer overflow in run_unpack()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Grigoryev <[email protected]>
[ Upstream commit 736fc7bf5f68f6b74a0925b7e072c571838657d2 ]
The MFT record relative to the file being opened contains its runlist, an array containing information about the file's location on the physical disk. Analysis of all Call Stack paths showed that the values of the runlist array, from which LCNs are calculated, are not validated before run_unpack function.
The run_unpack function decodes the compressed runlist data format from MFT attributes (for example, $DATA), converting them into a runs_tree structure, which describes the mapping of virtual clusters (VCN) to logical clusters (LCN). The NTFS3 subsystem also has a shortcut for deleting files from MFT records - in this case, the RUN_DEALLOCATE command is sent to the run_unpack input, and the function logic provides that all data transferred to the runlist about file or directory is deleted without creating a runs_tree structure.
Substituting the runlist in the $DATA attribute of the MFT record for an arbitrary file can lead either to access to arbitrary data on the disk bypassing access checks to them (since the inode access check occurs above) or to destruction of arbitrary data on the disk.
Add overflow check for addition operation.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/ntfs3/run.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/ntfs3/run.c +9 -3
@@ -9,6 +9,7 @@#include <linux/blkdev.h> #include <linux/fs.h> #include <linux/log2.h> +#include <linux/overflow.h> #include "debug.h" #include "ntfs.h"
@@ -982,14 +983,18 @@ int run_unpack(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,if (!dlcn)return -EINVAL ; - lcn = prev_lcn + dlcn; + +if (check_add_overflow (prev_lcn, dlcn, &lcn)) +return -EINVAL ; prev_lcn = lcn; }else {/* The size of 'dlcn' can't be > 8. */ return -EINVAL ; } - next_vcn = vcn64 + len; +if (check_add_overflow (vcn64, len, &next_vcn)) +return -EINVAL ; +/* Check boundary. */ if (next_vcn > evcn +1 )return -EINVAL ;
@@ -1153,7 +1158,8 @@ int run_get_highest_vcn(CLST vcn, const u8 *run_buf, u64 *highest_vcn)return -EINVAL ; run_buf += size_size + offset_size; - vcn64 += len; +if (check_add_overflow (vcn64, len, &vcn64)) +return -EINVAL ;#ifndef CONFIG_NTFS3_64BIT_CLUSTER if (vcn64 >0x100000000ull )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 339/563 fs/ntfs3: reject index allocation if $BITMAP is empty but blocks exist
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moon Hee Lee <[email protected]>
[ Upstream commit 0dc7117da8f92dd5fe077d712a756eccbe377d40 ]
Index allocation requires at least one bit in the $BITMAP attribute to track usage of index entries. If the bitmap is empty while index blocks are already present, this reflects on-disk corruption.
syzbot triggered this condition using a malformed NTFS image. During a rename() operation involving a long filename (which spans multiple index entries), the empty bitmap allowed the name to be added without valid tracking. Subsequent deletion of the original entry failed with -ENOENT, due to unexpected index state.
Reject such cases by verifying that the bitmap is not empty when index blocks exist.
--- fs/ntfs3/index.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ntfs3/index.c +10 -0
@@ -1508,6 +1508,16 @@ static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, bmp_size = bmp_size_v =le32_to_cpu (bmp->res.data_size); } +/* +* Index blocks exist, but $BITMAP has zero valid bits. +* This implies an on-disk corruption and must be rejected. +*/ +if (in->name ==I30_NAME && +unlikely (bmp_size_v ==0 && indx->alloc_run.count)) { + err = -EINVAL ; + goto out1; + } + bit = bmp_size <<3 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 307/563 drm/amd/pm: Disable MCLK switching with non-DC at 120 Hz+ (v2)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit ed3803533c7bf7df88bc3fc9f70bd317e1228ea8 ]
According to pp_pm_compute_clocks the non-DC display code has "issues with mclk switching with refresh rates over 120 hz". The workaround is to disable MCLK switching in this case.
Do the same for legacy DPM.
--- drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c +7 -0
@@ -66,6 +66,13 @@ u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev) (amdgpu_crtc->v_border * 2)); vblank_time_us = vblank_in_pixels *1000 / amdgpu_crtc->hw_mode.clock; + +/* we have issues with mclk switching with +* refresh rates over 120 hz on the non-DC code. +*/ +if (drm_mode_vrefresh (&amdgpu_crtc->hw_mode) >120 ) + vblank_time_us =0 ; +break ; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 308/563 drm/amd/pm: Disable SCLK switching on Oland with high pixel clocks (v3)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit 7009e3af0474aca5f64262b3c72fb6e23b232f9b ]
Port of commit 227545b9a08c ("drm/radeon/dpm: Disable sclk switching on Oland when two 4K 60Hz monitors are connected")
This is an ad-hoc DPM fix, necessary because we don't have proper bandwidth calculation for DCE 6.
We define "high pixelclock" for SI as higher than necessary for 4K 30Hz. For example, 4K 60Hz and 1080p 144Hz fall into this category.
When two high pixel clock displays are connected to Oland, additionally disable shader clock switching, which results in a higher voltage, thereby addressing some visible flickering.
v2:
Add more comments.
v3:
Split into two commits for easier review.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +31 -0
@@ -3449,12 +3449,14 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev, {struct si_ps *ps =si_get_ps (rps);struct amdgpu_clock_and_voltage_limits *max_limits; +struct amdgpu_connector *conn;bool disable_mclk_switching = false;bool disable_sclk_switching = false;u32 mclk, sclk;u16 vddc, vddci, min_vce_voltage =0 ;u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc;u32 max_sclk =0 , max_mclk =0 ; +u32 high_pixelclock_count =0 ;int i;if (adev->asic_type ==CHIP_HAINAN ) {
@@ -3482,6 +3484,35 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev, } } +/* We define "high pixelclock" for SI as higher than necessary for 4K 30Hz. +* For example, 4K 60Hz and 1080p 144Hz fall into this category. +* Find number of such displays connected. +*/ +for (i =0 ; i < adev->mode_info.num_crtc; i++) { +if (!(adev->pm.dpm.new_active_crtcs & (1 << i)) || + !adev->mode_info.crtcs[i]->enabled) +continue ; + + conn =to_amdgpu_connector (adev->mode_info.crtcs[i]->connector); + +if (conn->pixelclock_for_modeset >297000 ) + high_pixelclock_count++; + } + +/* These are some ad-hoc fixes to some issues observed with SI GPUs. +* They are necessary because we don't have something like dce_calcs +* for these GPUs to calculate bandwidth requirements. +*/ +if (high_pixelclock_count) { +/* On Oland, we observe some flickering when two 4K 60Hz +* displays are connected, possibly because voltage is too low. +* Raise the voltage by requiring a higher SCLK. +* (Voltage cannot be adjusted independently without also SCLK.) +*/ +if (high_pixelclock_count >1 && adev->asic_type ==CHIP_OLAND ) + disable_sclk_switching = true; + } +if (rps->vce_active) { rps->evclk = adev->pm.dpm.vce_states[adev->pm.dpm.vce_level].evclk; rps->ecclk = adev->pm.dpm.vce_states[adev->pm.dpm.vce_level].ecclk;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 309/563 wifi: mac80211: Make CONNECTION_MONITOR optional for MLO sta
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit ac36daa83650c26fd55dee1a6ee5144769239911 ]
Since commit '1bc892d76a6f ("wifi: mac80211: extend connection monitoring for MLO")' mac80211 supports connection monitor for MLO client interfaces. Remove the CONNECTION_MONITOR requirement in ieee80211_register_hw routine.
--- net/mac80211/main.c | 3 --- 1 file changed, 3 deletions(-)
net/mac80211/main.c +0 -3
@@ -1164,9 +1164,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)if (WARN_ON (!ieee80211_hw_check (hw,MFP_CAPABLE )))return -EINVAL ; -if (WARN_ON (!ieee80211_hw_check (hw,CONNECTION_MONITOR ))) -return -EINVAL ; -if (WARN_ON (ieee80211_hw_check (hw,NEED_DTIM_BEFORE_ASSOC )))return -EINVAL ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 310/563 wifi: mwifiex: send world regulatory domain to driver
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Kerkmann <[email protected]>
[ Upstream commit 56819d00bc2ebaa6308913c28680da5d896852b8 ]
The world regulatory domain is a restrictive subset of channel configurations which allows legal operation of the adapter all over the world. Changing to this domain should not be prevented.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +3 -4
@@ -686,10 +686,9 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy,return ; } -/* Don't send world or same regdom info to firmware */ -if (strncmp (request->alpha2,"00" ,2 ) && -strncmp (request->alpha2, adapter->country_code, -sizeof (request->alpha2))) { +/* Don't send same regdom info to firmware */ +if (strncmp (request->alpha2, adapter->country_code, +sizeof (request->alpha2)) !=0 ) {memcpy (adapter->country_code, request->alpha2,sizeof (request->alpha2));mwifiex_send_domain_info_cmd_fw (wiphy);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 311/563 wifi: brcmfmac: fix 43752 SDIO FWVID incorrectly labelled as Cypress (CYW)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gokul Sivakumar <[email protected]>
[ Upstream commit 74e2ef72bd4b25ce21c8f309d4f5b91b5df9ff5b ]
Cypress(Infineon) is not the vendor for this 43752 SDIO WLAN chip, and so has not officially released any firmware binary for it. It is incorrect to maintain this WLAN chip with firmware vendor ID as "CYW". So relabel the chip's firmware Vendor ID as "WCC" as suggested by the maintainer.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 4 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 8 ++++---- .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 - include/linux/mmc/sdio_ids.h | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +1 -1
@@ -997,9 +997,9 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = {BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_4356 ,WCC ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_4359 ,WCC ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_43751 ,WCC ), +BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_43752 ,WCC ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373 ,CYW ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012 ,CYW ), -BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752 ,CYW ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_CYPRESS_89359 ,CYW ), CYW_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43439, CYW), { /* end: all zeroes */ }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +2 -2
@@ -738,8 +738,8 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)case BRCM_CC_4364_CHIP_ID :case CY_CC_4373_CHIP_ID :return 0x160000 ; -case CY_CC_43752_CHIP_ID :case BRCM_CC_43751_CHIP_ID : +case BRCM_CC_43752_CHIP_ID :case BRCM_CC_4377_CHIP_ID :return 0x170000 ;case BRCM_CC_4378_CHIP_ID :
@@ -1452,7 +1452,7 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub)return (reg &CC_SR_CTL0_ENABLE_MASK ) !=0 ;case BRCM_CC_4359_CHIP_ID :case BRCM_CC_43751_CHIP_ID : -case CY_CC_43752_CHIP_ID : +case BRCM_CC_43752_CHIP_ID :case CY_CC_43012_CHIP_ID : addr =CORE_CC_REG (pmu->base, retention_ctl); reg = chip->ops->read32 (chip->ctx, addr);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +4 -4
@@ -655,10 +655,10 @@ static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {BRCMF_FW_ENTRY (BRCM_CC_4356_CHIP_ID ,0xFFFFFFFF ,4356 ),BRCMF_FW_ENTRY (BRCM_CC_4359_CHIP_ID ,0xFFFFFFFF ,4359 ),BRCMF_FW_ENTRY (BRCM_CC_43751_CHIP_ID ,0xFFFFFFFF ,43752 ), +BRCMF_FW_ENTRY (BRCM_CC_43752_CHIP_ID ,0xFFFFFFFF ,43752 ),BRCMF_FW_ENTRY (CY_CC_4373_CHIP_ID ,0xFFFFFFFF ,4373 ),BRCMF_FW_ENTRY (CY_CC_43012_CHIP_ID ,0xFFFFFFFF ,43012 ), BRCMF_FW_ENTRY(CY_CC_43439_CHIP_ID, 0xFFFFFFFF, 43439), - BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752) };#define TXCTL_CREDITS 2
@@ -3426,8 +3426,8 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus,static bool brcmf_sdio_aos_no_decode (struct brcmf_sdio *bus) {if (bus->ci->chip ==BRCM_CC_43751_CHIP_ID || - bus->ci->chip ==CY_CC_43012_CHIP_ID || - bus->ci->chip ==CY_CC_43752_CHIP_ID ) + bus->ci->chip ==BRCM_CC_43752_CHIP_ID || + bus->ci->chip ==CY_CC_43012_CHIP_ID )return true;else return false;
@@ -4278,8 +4278,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,switch (sdiod->func1->device) {case SDIO_DEVICE_ID_BROADCOM_43751 : +case SDIO_DEVICE_ID_BROADCOM_43752 :case SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373 : -case SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752 :brcmf_dbg (INFO ,"set F2 watermark to 0x%x*4 bytes\n" ,CY_4373_F2_WATERMARK ); brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +0 -1
@@ -60,7 +60,6 @@#define CY_CC_4373_CHIP_ID 0x4373#define CY_CC_43012_CHIP_ID 43012#define CY_CC_43439_CHIP_ID 43439 -#define CY_CC_43752_CHIP_ID 43752/* USB Device IDs */ #define BRCM_USB_43143_DEVICE_ID 0xbd1e
include/linux/mmc/sdio_ids.h +1 -1
@@ -77,7 +77,7 @@#define SDIO_DEVICE_ID_BROADCOM_43439 0xa9af#define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf#define SDIO_DEVICE_ID_BROADCOM_43751 0xaae7 -#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752 0xaae8 +#define SDIO_DEVICE_ID_BROADCOM_43752 0xaae8#define SDIO_VENDOR_ID_CYPRESS 0x04b4#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43439 0xbd3d
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 312/563 drm/msm: Do not validate SSPP when it is not ready
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun Nie <[email protected]>
[ Upstream commit 6fc616723bb5fd4289d7422fa013da062b44ae55 ]
Current code will validate current plane and previous plane to confirm they can share a SSPP with multi-rect mode. The SSPP is already allocated for previous plane, while current plane is not associated with any SSPP yet. Null pointer is referenced when validating the SSPP of current plane. Skip SSPP validation for current plane.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000888ac3000 [0000000000000020] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] SMP Modules linked in: CPU: 4 UID: 0 PID: 1891 Comm: modetest Tainted: G S 6.15.0-rc2-g3ee3f6e1202e #335 PREEMPT Tainted: [S]=CPU_OUT_OF_SPEC Hardware name: SM8650 EV1 rev1 4slam 2et (DT) pstate: 63400009 (nZCv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : dpu_plane_is_multirect_capable+0x68/0x90 lr : dpu_assign_plane_resources+0x288/0x410
sp : ffff800093dcb770
x29: ffff800093dcb770 x28: 0000000000002000 x27: ffff000817c6c000
x26: ffff000806b46368 x25: ffff0008013f6080 x24: ffff00080cbf4800
x23: ffff000810842680 x22: ffff0008013f1080 x21: ffff00080cc86080
x20: ffff000806b463b0 x19: ffff00080cbf5a00 x18: 00000000ffffffff
x17: 707a5f657a696c61 x16: 0000000000000003 x15: 0000000000002200
x14: 00000000ffffffff x13: 00aaaaaa00aaaaaa x12: 0000000000000000
x11: ffff000817c6e2b8 x10: 0000000000000000 x9 : ffff80008106a950 x8 : ffff00080cbf48f4 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000438 x3 : 0000000000000438 x2 : ffff800082e245e0 x1 : 0000000000000008 x0 : 0000000000000000
Call trace: dpu_plane_is_multirect_capable+0x68/0x90 (P) dpu_crtc_atomic_check+0x5bc/0x650 drm_atomic_helper_check_planes+0x13c/0x220 drm_atomic_helper_check+0x58/0xb8 msm_atomic_check+0xd8/0xf0 drm_atomic_check_only+0x4a8/0x968 drm_atomic_commit+0x50/0xd8 drm_atomic_helper_update_plane+0x140/0x188 __setplane_atomic+0xfc/0x148 drm_mode_setplane+0x164/0x378 drm_ioctl_kernel+0xc0/0x140 drm_ioctl+0x20c/0x500 __arm64_sys_ioctl+0xbc/0xf8 invoke_syscall+0x50/0x120 el0_svc_common.constprop.0+0x48/0xf8 do_el0_svc+0x28/0x40 el0_svc+0x30/0xd0 el0t_64_sync_handler+0x144/0x168 el0t_64_sync+0x198/0x1a0 Code: b9402021 370fffc1 f9401441 3707ff81 (f94010a1) ---[ end trace 0000000000000000 ]---
Patchwork: https://patchwork.freedesktop.org/patch/669224/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +4 -0
@@ -922,6 +922,9 @@ static int dpu_plane_is_multirect_capable(struct dpu_hw_sspp *sspp,if (MSM_FORMAT_IS_YUV (fmt))return false; +if (!sspp) +return true; +if (!test_bit (DPU_SSPP_SMART_DMA_V1 , &sspp->cap->features) && !test_bit (DPU_SSPP_SMART_DMA_V2 , &sspp->cap->features))return false;
@@ -1028,6 +1031,7 @@ static int dpu_plane_try_multirect_shared(struct dpu_plane_state *pstate, prev_pipe->multirect_mode != DPU_SSPP_MULTIRECT_NONE)return false; +/* Do not validate SSPP of current plane when it is not ready */ if (!dpu_plane_is_multirect_capable (pipe->sspp, pipe_cfg, fmt) || !dpu_plane_is_multirect_capable (prev_pipe->sspp, prev_pipe_cfg, prev_fmt))return false;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 303/563 drm/amd/pm: Disable ULV even if unsupported (v3)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit 3a0c3a4035f995e1f993dfaf4d63dc19e9b4bc1c ]
Always send PPSMC_MSG_DisableULV to the SMC, even if ULV mode is unsupported, to make sure it is properly turned off.
v3:
Simplify si_disable_ulv further.
Always check the return value of amdgpu_si_send_msg_to_smc.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +3 -7
@@ -5637,14 +5637,10 @@ static int si_populate_smc_t(struct amdgpu_device *adev,static int si_disable_ulv (struct amdgpu_device *adev) { -struct si_power_info *si_pi =si_get_pi (adev); -struct si_ulv_param *ulv = &si_pi->ulv; +PPSMC_Result r; -if (ulv->supported) -return (amdgpu_si_send_msg_to_smc (adev, PPSMC_MSG_DisableULV) == PPSMC_Result_OK) ? -0 : -EINVAL ; - -return 0 ; + r =amdgpu_si_send_msg_to_smc (adev, PPSMC_MSG_DisableULV); +return (r == PPSMC_Result_OK) ?0 : -EINVAL ; } static bool si_is_state_ulv_compatible(struct amdgpu_device *adev,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 341/563 iio: consumers: Fix offset handling in iio_convert_raw_to_processed()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 33f5c69c4daff39c010b3ea6da8ebab285f4277b ]
Fix iio_convert_raw_to_processed() offset handling for channels without a scale attribute.
The offset has been applied to the raw64 value not to the original raw value. Use the raw64 value so that the offset is taken into account.
--- drivers/iio/inkern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/inkern.c +1 -1
@@ -640,7 +640,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,* If no channel scaling is available apply consumer scale to * raw value and return. */ - *processed = raw * scale; + *processed = raw64 * scale;return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 350/563 PCI: endpoint: pci-epf-test: Fix doorbell test support
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit f272210b28d050df56ec7dfaecb9fa3bebca6419 ]
The doorbell feature temporarily overrides the inbound translation to point to the address stored in epf_test->db_bar.phys_addr, i.e., it calls set_bar() twice without ever calling clear_bar(), as calling clear_bar() would clear the BAR's PCI address assigned by the host.
Thus, when disabling the doorbell, restore the inbound translation to point to the memory allocated for the BAR.
Without this, running the PCI endpoint kselftest doorbell test case more than once would fail.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-test.c +13 -1
@@ -772,12 +772,24 @@ static void pci_epf_test_disable_doorbell(struct pci_epf_test *epf_test,u32 status =le32_to_cpu (reg->status);struct pci_epf *epf = epf_test->epf;struct pci_epc *epc = epf->epc; +int ret;if (bar <BAR_0 ) goto set_status_err;pci_epf_test_doorbell_cleanup (epf_test); -pci_epc_clear_bar (epc, epf->func_no, epf->vfunc_no, &epf_test->db_bar); + +/* +* The doorbell feature temporarily overrides the inbound translation +* to point to the address stored in epf_test->db_bar.phys_addr, i.e., +* it calls set_bar() twice without ever calling clear_bar(), as +* calling clear_bar() would clear the BAR's PCI address assigned by +* the host. Thus, when disabling the doorbell, restore the inbound +* translation to point to the memory allocated for the BAR. +*/ + ret =pci_epc_set_bar (epc, epf->func_no, epf->vfunc_no, &epf->bar[bar]); +if (ret) + goto set_status_err; status |=STATUS_DOORBELL_DISABLE_SUCCESS ; reg->status =cpu_to_le32 (status);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 351/563 drivers/base/node: handle error properly in register_one_node()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Donet Tom <[email protected]>
[ Upstream commit 786eb990cfb78aab94eb74fb32a030e14723a620 ]
If register_node() returns an error, it is not handled correctly. The function will proceed further and try to register CPUs under the node, which is not correct.
So, in this patch, if register_node() returns an error, we return immediately from the function.
--- drivers/base/node.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/base/node.c +5 -0
@@ -885,6 +885,11 @@ int register_one_node(int nid) node_devices[nid] = node; error =register_node (node_devices[nid], nid); +if (error) { + node_devices[nid] =NULL ; +kfree (node); +return error; + }/* link cpu under this node */ for_each_present_cpu (cpu) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 352/563 RDMA/cm: Rate limit destroy CM ID timeout error message
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Håkon Bugge <[email protected]>
[ Upstream commit 2bbe1255fcf19c5eb300efb6cb5ad98d66fdae2e ]
When the destroy CM ID timeout kicks in, you typically get a storm of them which creates a log flooding. Hence, change pr_err() to pr_err_ratelimited() in cm_destroy_id_wait_timeout().
--- drivers/infiniband/core/cm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +2 -2
@@ -1049,8 +1049,8 @@ static noinline void cm_destroy_id_wait_timeout(struct ib_cm_id *cm_id,struct cm_id_private *cm_id_priv; cm_id_priv = container_of(cm_id, struct cm_id_private, id); -pr_err ("%s: cm_id=%p timed out. state %d -> %d, refcnt=%d\n" , __func__, - cm_id, old_state, cm_id->state,refcount_read (&cm_id_priv->refcount)); +pr_err_ratelimited ("%s: cm_id=%p timed out. state %d -> %d, refcnt=%d\n" , __func__, + cm_id, old_state, cm_id->state,refcount_read (&cm_id_priv->refcount)); }static void cm_destroy_id (struct ib_cm_id *cm_id,int err)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 353/563 wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit fe219a41adaf5354c59e75ebb642b8cb8a851d38 ]
Fix the wcid pointer used in mt7996_mcu_sta_ba routine to properly support MLO scenario.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 6 ++++-- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 12 +++++++----- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +4 -2
@@ -1327,11 +1327,13 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,case IEEE80211_AMPDU_RX_START :mt76_rx_aggr_start (&dev->mt76, &msta_link->wcid, tid, ssn, params->buf_size); - ret =mt7996_mcu_add_rx_ba (dev, params, link, true); + ret =mt7996_mcu_add_rx_ba (dev, params, link, + msta_link, true);break ;case IEEE80211_AMPDU_RX_STOP :mt76_rx_aggr_stop (&dev->mt76, &msta_link->wcid, tid); - ret =mt7996_mcu_add_rx_ba (dev, params, link, false); + ret =mt7996_mcu_add_rx_ba (dev, params, link, + msta_link, false);break ;case IEEE80211_AMPDU_TX_OPERATIONAL : mtxq->aggr = true;
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +7 -5
@@ -1149,9 +1149,8 @@ int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct ieee80211_vif *vif,static int mt7996_mcu_sta_ba (struct mt7996_dev *dev,struct mt76_vif_link *mvif,struct ieee80211_ampdu_params *params, -bool enable,bool tx) +struct mt76_wcid *wcid,bool enable,bool tx) { -struct mt76_wcid *wcid = (struct mt76_wcid *)params->sta->drv_priv;struct sta_rec_ba_uni *ba;struct sk_buff *skb;struct tlv *tlv;
@@ -1185,14 +1184,17 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,if (enable && !params->amsdu) msta_link->wcid.amsdu = false; -return mt7996_mcu_sta_ba (dev, &link->mt76, params, enable, true); +return mt7996_mcu_sta_ba (dev, &link->mt76, params, &msta_link->wcid, + enable, true); }int mt7996_mcu_add_rx_ba (struct mt7996_dev *dev,struct ieee80211_ampdu_params *params, -struct mt7996_vif_link *link,bool enable) +struct mt7996_vif_link *link, +struct mt7996_sta_link *msta_link,bool enable) { -return mt7996_mcu_sta_ba (dev, &link->mt76, params, enable, false); +return mt7996_mcu_sta_ba (dev, &link->mt76, params, &msta_link->wcid, + enable, false); } static void
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +2 -1
@@ -608,7 +608,8 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev, struct mt7996_sta_link *msta_link, bool enable);int mt7996_mcu_add_rx_ba (struct mt7996_dev *dev,struct ieee80211_ampdu_params *params, -struct mt7996_vif_link *link,bool enable); +struct mt7996_vif_link *link, +struct mt7996_sta_link *msta_link,bool enable);int mt7996_mcu_update_bss_color (struct mt7996_dev *dev,struct mt76_vif_link *mlink,struct cfg80211_he_bss_color *he_bss_color);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 354/563 wifi: mt76: mt7996: Fix mt7996_mcu_bss_mld_tlv routine
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit ed01c310eca96453c11b59db46c855aa593cffdd ]
Update mt7996_mcu_bss_mld_tlv routine to properly support MLO configuring the BSS.
--- .../net/wireless/mediatek/mt76/mt7996/main.c | 46 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 26 ++++++++--- .../net/wireless/mediatek/mt76/mt7996/mcu.h | 3 +- .../wireless/mediatek/mt76/mt7996/mt7996.h | 8 ++++ 4 files changed, 75 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +45 -1
@@ -138,6 +138,28 @@ static int get_omac_idx(enum nl80211_iftype type, u64 mask)return -1 ; } +static int get_own_mld_idx (u64 mask,bool group_mld) +{ +u8 start = group_mld ?0 :16 ; +u8 end = group_mld ?15 :63 ; +int idx; + + idx =get_free_idx (mask, start, end); +if (idx) +return idx -1 ; + +/* If the 16-63 range is not available, perform another lookup in the +* range 0-15 +*/ +if (!group_mld) { + idx =get_free_idx (mask,0 ,15 ); +if (idx) +return idx -1 ; + } + +return -EINVAL ; +} +static void mt7996_init_bitrate_mask (struct ieee80211_vif *vif,struct mt7996_vif_link *mlink) {
@@ -279,7 +301,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,struct mt7996_dev *dev = phy->dev;u8 band_idx = phy->mt76->band_idx;struct mt76_txq *mtxq; -int idx, ret; +int mld_idx, idx, ret; mlink->idx =__ffs64 (~dev->mt76.vif_mask);if (mlink->idx >=mt7996_max_interface_num (dev))
@@ -289,6 +311,17 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,if (idx <0 )return -ENOSPC ; +if (!dev->mld_idx_mask) {/* first link in the group */ + mvif->mld_group_idx =get_own_mld_idx (dev->mld_idx_mask, true); + mvif->mld_remap_idx =get_free_idx (dev->mld_remap_idx_mask, +0 ,15 ); + } + + mld_idx =get_own_mld_idx (dev->mld_idx_mask, false); +if (mld_idx <0 ) +return -ENOSPC ; + + link->mld_idx = mld_idx; link->phy = phy; mlink->omac_idx = idx; mlink->band_idx = band_idx;
@@ -301,6 +334,11 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,return ret; dev->mt76.vif_mask |=BIT_ULL (mlink->idx); +if (!dev->mld_idx_mask) { + dev->mld_idx_mask |=BIT_ULL (mvif->mld_group_idx); + dev->mld_remap_idx_mask |=BIT_ULL (mvif->mld_remap_idx); + } + dev->mld_idx_mask |=BIT_ULL (link->mld_idx); phy->omac_mask |=BIT_ULL (mlink->omac_idx); idx =MT7996_WTBL_RESERVED - mlink->idx;
@@ -380,7 +418,13 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif, } dev->mt76.vif_mask &= ~BIT_ULL (mlink->idx); + dev->mld_idx_mask &= ~BIT_ULL (link->mld_idx); phy->omac_mask &= ~BIT_ULL (mlink->omac_idx); +if (!(dev->mld_idx_mask & ~BIT_ULL (mvif->mld_group_idx))) { +/* last link */ + dev->mld_idx_mask &= ~BIT_ULL (mvif->mld_group_idx); + dev->mld_remap_idx_mask &= ~BIT_ULL (mvif->mld_remap_idx); + }spin_lock_bh (&dev->mt76.sta_poll_lock);if (!list_empty (&msta_link->wcid.poll_list))
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +20 -6
@@ -899,17 +899,28 @@ mt7996_mcu_bss_txcmd_tlv(struct sk_buff *skb, bool en) }static void -mt7996_mcu_bss_mld_tlv (struct sk_buff *skb,struct mt76_vif_link *mlink) +mt7996_mcu_bss_mld_tlv (struct sk_buff *skb, +struct ieee80211_bss_conf *link_conf, +struct mt7996_vif_link *link) { +struct ieee80211_vif *vif = link_conf->vif; +struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;struct bss_mld_tlv *mld;struct tlv *tlv; tlv =mt7996_mcu_add_uni_tlv (skb,UNI_BSS_INFO_MLD ,sizeof (*mld)); - mld = (struct bss_mld_tlv *)tlv; - mld->group_mld_id =0xff ; - mld->own_mld_id = mlink->idx; - mld->remap_idx =0xff ; + mld->own_mld_id = link->mld_idx; + mld->link_id = link_conf->link_id; + +if (ieee80211_vif_is_mld (vif)) { + mld->group_mld_id = mvif->mld_group_idx; + mld->remap_idx = mvif->mld_remap_idx; +memcpy (mld->mac_addr, vif->addr,ETH_ALEN ); + }else { + mld->group_mld_id =0xff ; + mld->remap_idx =0xff ; + } } static void
@@ -1108,6 +1119,8 @@ int mt7996_mcu_add_bss_info(struct mt7996_phy *phy, struct ieee80211_vif *vif, goto out;if (enable) { +struct mt7996_vif_link *link; +mt7996_mcu_bss_rfch_tlv (skb, phy);mt7996_mcu_bss_bmc_tlv (skb, mlink, phy);mt7996_mcu_bss_ra_tlv (skb, phy);
@@ -1118,7 +1131,8 @@ int mt7996_mcu_add_bss_info(struct mt7996_phy *phy, struct ieee80211_vif *vif,mt7996_mcu_bss_he_tlv (skb, vif, link_conf, phy);/* this tag is necessary no matter if the vif is MLD */ -mt7996_mcu_bss_mld_tlv (skb, mlink); + link = container_of(mlink, struct mt7996_vif_link, mt76); +mt7996_mcu_bss_mld_tlv (skb, link_conf, link); }mt7996_mcu_bss_mbssid_tlv (skb, link_conf, enable);
drivers/net/wireless/mediatek/mt76/mt7996/mcu.h +2 -1
@@ -481,7 +481,8 @@ struct bss_mld_tlv {u8 own_mld_id;u8 mac_addr[ETH_ALEN ];u8 remap_idx; -u8 __rsv[3 ]; +u8 link_id; +u8 __rsv[2 ]; } __packed;struct sta_rec_ht_uni {
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +8 -0
@@ -248,11 +248,16 @@ struct mt7996_vif_link {struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS ];struct cfg80211_bitrate_mask bitrate_mask; + +u8 mld_idx; };struct mt7996_vif {struct mt7996_vif_link deflink;/* must be first */ struct mt76_vif_data mt76; + +u8 mld_group_idx; +u8 mld_remap_idx; };/* crash-dump */
@@ -337,6 +342,9 @@ struct mt7996_dev {u32 q_int_mask[MT7996_MAX_QUEUE ];u32 q_wfdma_mask; +u64 mld_idx_mask; +u64 mld_remap_idx_mask; +const struct mt76_bus_ops *bus_ops;struct mt7996_phy phy;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 355/563 wifi: mt76: fix potential memory leak in mt76_wmac_probe()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit 42754b7de2b1a2cf116c5e3f1e8e78392f4ed700 ]
In mt76_wmac_probe(), when the mt76_alloc_device() call succeeds, memory is allocated for both struct ieee80211_hw and a workqueue. However, on the error path, the workqueue is not freed. Fix that by calling mt76_free_device() on the error path.
--- drivers/net/wireless/mediatek/mt76/mt7603/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7603/soc.c +1 -1
@@ -48,7 +48,7 @@ mt76_wmac_probe(struct platform_device *pdev)return 0 ; error: -ieee80211_free_hw (mt76_hw (dev)); +mt76_free_device (mdev);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 356/563 wifi: mt76: mt7996: Use proper link_id in link_sta_rc_update callback
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit afff4325548f0cf872e404df2856bf8bd9581c7e ]
Do not always use deflink_id in link_sta_rc_update mac80211 callback but use the proper link_id provided by mac80211.
--- .../net/wireless/mediatek/mt76/mt7996/main.c | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +28 -15
@@ -1663,19 +1663,13 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, } } -static void mt7996_link_rate_ctrl_update (void *data,struct ieee80211_sta *sta) +static void mt7996_link_rate_ctrl_update (void *data, +struct mt7996_sta_link *msta_link) { -struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; +struct mt7996_sta *msta = msta_link->sta;struct mt7996_dev *dev = msta->vif->deflink.phy->dev; -struct mt7996_sta_link *msta_link;u32 *changed = data; -rcu_read_lock (); - - msta_link =rcu_dereference (msta->link[msta->deflink_id]); -if (!msta_link) - goto out; -spin_lock_bh (&dev->mt76.sta_poll_lock); msta_link->changed |= *changed;
@@ -1683,8 +1677,6 @@ static void mt7996_link_rate_ctrl_update(void *data, struct ieee80211_sta *sta)list_add_tail (&msta_link->rc_list, &dev->sta_rc_list);spin_unlock_bh (&dev->mt76.sta_poll_lock); -out: -rcu_read_unlock (); } static void mt7996_link_sta_rc_update(struct ieee80211_hw *hw,
@@ -1692,11 +1684,32 @@ static void mt7996_link_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_link_sta *link_sta, u32 changed) { -struct mt7996_dev *dev =mt7996_hw_dev (hw);struct ieee80211_sta *sta = link_sta->sta; +struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; +struct mt7996_sta_link *msta_link; -mt7996_link_rate_ctrl_update (&changed, sta); -ieee80211_queue_work (hw, &dev->rc_work); +rcu_read_lock (); + + msta_link =rcu_dereference (msta->link[link_sta->link_id]); +if (msta_link) { +struct mt7996_dev *dev =mt7996_hw_dev (hw); + +mt7996_link_rate_ctrl_update (&changed, msta_link); +ieee80211_queue_work (hw, &dev->rc_work); + } + +rcu_read_unlock (); +} + +static void mt7996_sta_rate_ctrl_update (void *data,struct ieee80211_sta *sta) +{ +struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; +struct mt7996_sta_link *msta_link; +u32 *changed = data; + + msta_link =rcu_dereference (msta->link[msta->deflink_id]); +if (msta_link) +mt7996_link_rate_ctrl_update (&changed, msta_link); } static int
@@ -1717,7 +1730,7 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,* - multiple rates: if it's not in range format i.e 0-{7,8,9} for VHT * then multiple MCS setting (MCS 4,5,6) is not supported. */ -ieee80211_iterate_stations_atomic (hw, mt7996_link_rate_ctrl_update, +ieee80211_iterate_stations_atomic (hw, mt7996_sta_rate_ctrl_update, &changed);ieee80211_queue_work (hw, &dev->rc_work);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 357/563 wifi: mt76: mt7996: Check phy before init msta_link in mt7996_mac_sta_add_links()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit fe5fffadc6c77c56f122cf1042dc830f59e904bf ]
In order to avoid a possible NULL pointer dereference in mt7996_mac_sta_init_link routine, move the phy pointer check before running mt7996_mac_sta_init_link() in mt7996_mac_sta_add_links routine.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +6 -5
@@ -1080,16 +1080,17 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif, goto error_unlink; } - err =mt7996_mac_sta_init_link (dev, link_conf, link_sta, link, - link_id); -if (err) - goto error_unlink; - mphy =mt76_vif_link_phy (&link->mt76);if (!mphy) { err = -EINVAL ; goto error_unlink; } + + err =mt7996_mac_sta_init_link (dev, link_conf, link_sta, link, + link_id); +if (err) + goto error_unlink; + mphy->num_sta++; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 358/563 wifi: mt76: mt7996: Fix tx-queues initialization for second phy on mt7996
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 77ff8caf3b17626ad91568cef63d75e288aa4052 ]
Fix the second phy tx queue initialization if hif device is not available for MT7990 chipset.
--- .../net/wireless/mediatek/mt76/mt7996/init.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +14 -7
@@ -671,13 +671,20 @@ static int mt7996_register_phy(struct mt7996_dev *dev, enum mt76_band_id band)/* init wiphy according to mphy and phy */ mt7996_init_wiphy_band (mphy->hw, phy); - ret =mt7996_init_tx_queues (mphy->priv, -MT_TXQ_ID (band), -MT7996_TX_RING_SIZE , -MT_TXQ_RING_BASE (band) + hif1_ofs, - wed); -if (ret) - goto error; + +if (is_mt7996 (&dev->mt76) && !dev->hif2 && band ==MT_BAND1 ) { +int i; + +for (i =0 ; i <=MT_TXQ_PSD ; i++) + mphy->q_tx[i] = dev->mt76.phys[MT_BAND0 ]->q_tx[0 ]; + }else { + ret =mt7996_init_tx_queues (mphy->priv,MT_TXQ_ID (band), +MT7996_TX_RING_SIZE , +MT_TXQ_RING_BASE (band) + hif1_ofs, + wed); +if (ret) + goto error; + } ret =mt76_register_phy (mphy, true, mt76_rates,ARRAY_SIZE (mt76_rates));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 359/563 wifi: mt76: mt7996: Fix RX packets configuration for primary WED device
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit cffed52dbf0ddd0db11f9df63f9976fe58ac9628 ]
In order to properly set the number of rx packets for primary WED device if hif device is available, move hif pointer initialization before running mt7996_mmio_wed_init routine.
--- drivers/net/wireless/mediatek/mt76/mt7996/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/pci.c +1 -1
@@ -137,6 +137,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev, mdev = &dev->mt76;mt7996_wfsys_reset (dev); hif2 =mt7996_pci_init_hif2 (pdev); + dev->hif2 = hif2; ret =mt7996_mmio_wed_init (dev, pdev, false, &irq);if (ret <0 )
@@ -161,7 +162,6 @@ static int mt7996_pci_probe(struct pci_dev *pdev,if (hif2) { hif2_dev = container_of(hif2->dev, struct pci_dev, dev); - dev->hif2 = hif2; ret =mt7996_mmio_wed_init (dev, hif2_dev, true, &hif2_irq);if (ret <0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 342/563 mm/slub: Fix cmp_loc_by_count() to return 0 when counts are equal
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit e1c4350327b39c9cad27b6c5779b3754384f26c8 ]
The comparison function cmp_loc_by_count() used for sorting stack trace locations in debugfs currently returns -1 if a->count > b->count and 1 otherwise. This breaks the antisymmetry property required by sort(), because when two counts are equal, both cmp(a, b) and cmp(b, a) return 1.
This can lead to undefined or incorrect ordering results. Fix it by updating the comparison logic to explicitly handle the case when counts are equal, and use cmp_int() to ensure the comparison function adheres to the required mathematical properties of antisymmetry.
--- mm/slub.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
mm/slub.c +1 -4
@@ -7731,10 +7731,7 @@ static int cmp_loc_by_count(const void *a, const void *b, const void *data)struct location *loc1 = (struct location *)a;struct location *loc2 = (struct location *)b; -if (loc1->count > loc2->count) -return -1 ; -else -return 1 ; +return cmp_int (loc2->count, loc1->count); }static void *slab_debugfs_start (struct seq_file *seq,loff_t *ppos)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 360/563 wifi: mt76: mt7996: Convert mt7996_wed_rro_addr to LE
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 809054a60d613ccca6e7f243bc68966b58044163 ]
Do not use bitmask in mt7996_wed_rro_addr DMA descriptor in order to not break endianness
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 8 +++++--- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 11 +++++------ 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +5 -3
@@ -734,6 +734,7 @@ void mt7996_wfsys_reset(struct mt7996_dev *dev)static int mt7996_wed_rro_init (struct mt7996_dev *dev) {#ifdef CONFIG_NET_MEDIATEK_SOC_WED +u32 val =FIELD_PREP (WED_RRO_ADDR_SIGNATURE_MASK ,0xff );struct mtk_wed_device *wed = &dev->mt76.mmio.wed;u32 reg =MT_RRO_ADDR_ELEM_SEG_ADDR0 ;struct mt7996_wed_rro_addr *addr;
@@ -773,7 +774,7 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev) addr = dev->wed_rro.addr_elem[i].ptr;for (j =0 ; j <MT7996_RRO_WINDOW_MAX_SIZE ; j++) { - addr->signature =0xff ; + addr->data =cpu_to_le32 (val); addr++; }
@@ -791,7 +792,7 @@ static int mt7996_wed_rro_init(struct mt7996_dev *dev) dev->wed_rro.session.ptr = ptr; addr = dev->wed_rro.session.ptr;for (i =0 ; i <MT7996_RRO_WINDOW_MAX_LEN ; i++) { - addr->signature =0xff ; + addr->data =cpu_to_le32 (val); addr++; }
@@ -891,6 +892,7 @@ static void mt7996_wed_rro_free(struct mt7996_dev *dev)static void mt7996_wed_rro_work (struct work_struct *work) {#ifdef CONFIG_NET_MEDIATEK_SOC_WED +u32 val =FIELD_PREP (WED_RRO_ADDR_SIGNATURE_MASK ,0xff );struct mt7996_dev *dev;LIST_HEAD (list);
@@ -927,7 +929,7 @@ static void mt7996_wed_rro_work(struct work_struct *work)MT7996_RRO_WINDOW_MAX_LEN ; reset: elem = ptr + elem_id *sizeof (*elem); - elem->signature =0xff ; + elem->data |=cpu_to_le32 (val); }mt7996_mcu_wed_rro_reset_sessions (dev, e->id); out:
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +5 -6
@@ -277,13 +277,12 @@ struct mt7996_hif {int irq; }; +#define WED_RRO_ADDR_SIGNATURE_MASK GENMASK(31, 24) +#define WED_RRO_ADDR_COUNT_MASK GENMASK(14, 4) +#define WED_RRO_ADDR_HEAD_HIGH_MASK GENMASK(3, 0)struct mt7996_wed_rro_addr { -u32 head_low; -u32 head_high :4 ; -u32 count:11 ; -u32 oor:1 ; -u32 rsv :8 ; -u32 signature :8 ; +__le32 head_low; +__le32 data; };struct mt7996_wed_rro_session_id {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 361/563 wifi: mt76: mt7915: fix mt7981 pre-calibration
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <[email protected]>
[ Upstream commit 2b660ee10a0c25b209d7fda3c41b821b75dd85d9 ]
In vendor driver, size of group cal and dpd cal for mt7981 includes 6G although the chip doesn't support it.
mt76 doesn't take this into account which results in reading from the incorrect offset.
For devices with precal, this would lead to lower bitrate.
Fix this by aligning groupcal size with vendor driver and switch to freq_list_v2 in mt7915_dpd_freq_idx in order to get the correct offset.
Below are iwinfo of the test device with two clients connected (iPhone 16, Intel AX210).
Before :
Mode: Master Channel: 36 (5.180 GHz) HT Mode: HE80 Center Channel 1: 42 2: unknown Tx-Power: 23 dBm Link Quality: 43/70 Signal: -67 dBm Noise: -92 dBm Bit Rate: 612.4 MBit/s Encryption: WPA3 SAE (CCMP) Type: nl80211 HW Mode(s): 802.11ac/ax/n Hardware: embedded [MediaTek MT7981]
After:
Mode: Master Channel: 36 (5.180 GHz) HT Mode: HE80 Center Channel 1: 42 2: unknown Tx-Power: 23 dBm Link Quality: 43/70 Signal: -67 dBm Noise: -92 dBm Bit Rate: 900.6 MBit/s Encryption: WPA3 SAE (CCMP) Type: nl80211 HW Mode(s): 802.11ac/ax/n Hardware: embedded [MediaTek MT7981]
Tested-on: mt7981 20240823
--- .../wireless/mediatek/mt76/mt7915/eeprom.h | 6 ++-- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 29 +++++-------------- 2 files changed, 10 insertions(+), 25 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h +3 -3
@@ -50,9 +50,9 @@ enum mt7915_eeprom_field {#define MT_EE_CAL_GROUP_SIZE_7975 (54 * MT_EE_CAL_UNIT + 16)#define MT_EE_CAL_GROUP_SIZE_7976 (94 * MT_EE_CAL_UNIT + 16)#define MT_EE_CAL_GROUP_SIZE_7916_6G (94 * MT_EE_CAL_UNIT + 16) +#define MT_EE_CAL_GROUP_SIZE_7981 (144 * MT_EE_CAL_UNIT + 16)#define MT_EE_CAL_DPD_SIZE_V1 (54 * MT_EE_CAL_UNIT)#define MT_EE_CAL_DPD_SIZE_V2 (300 * MT_EE_CAL_UNIT) -#define MT_EE_CAL_DPD_SIZE_V2_7981 (102 * MT_EE_CAL_UNIT)/* no 6g dpd data */ #define MT_EE_WIFI_CONF0_TX_PATH GENMASK(2, 0)#define MT_EE_WIFI_CONF0_RX_PATH GENMASK(5, 3)
@@ -180,6 +180,8 @@ mt7915_get_cal_group_size(struct mt7915_dev *dev) val =FIELD_GET (MT_EE_WIFI_CONF0_BAND_SEL , val);return (val ==MT_EE_V2_BAND_SEL_6GHZ ) ?MT_EE_CAL_GROUP_SIZE_7916_6G :MT_EE_CAL_GROUP_SIZE_7916 ; + }else if (is_mt7981 (&dev->mt76)) { +return MT_EE_CAL_GROUP_SIZE_7981 ; }else if (mt7915_check_adie (dev, false)) {return MT_EE_CAL_GROUP_SIZE_7976 ; }else {
@@ -192,8 +194,6 @@ mt7915_get_cal_dpd_size(struct mt7915_dev *dev) {if (is_mt7915 (&dev->mt76))return MT_EE_CAL_DPD_SIZE_V1 ; -else if (is_mt7981 (&dev->mt76)) -return MT_EE_CAL_DPD_SIZE_V2_7981 ;else return MT_EE_CAL_DPD_SIZE_V2 ; }
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +7 -22
@@ -3052,30 +3052,15 @@ static int mt7915_dpd_freq_idx(struct mt7915_dev *dev, u16 freq, u8 bw)/* 5G BW160 */ 5250, 5570, 5815 }; -static const u16 freq_list_v2_7981[] = { -/* 5G BW20 */ -5180 ,5200 ,5220 ,5240 , -5260 ,5280 ,5300 ,5320 , -5500 ,5520 ,5540 ,5560 , -5580 ,5600 ,5620 ,5640 , -5660 ,5680 ,5700 ,5720 , -5745 ,5765 ,5785 ,5805 , -5825 ,5845 ,5865 ,5885 , -/* 5G BW160 */ -5250 ,5570 ,5815 - }; -const u16 *freq_list = freq_list_v1; -int n_freqs =ARRAY_SIZE (freq_list_v1); -int idx; +const u16 *freq_list; +int idx, n_freqs;if (!is_mt7915 (&dev->mt76)) { -if (is_mt7981 (&dev->mt76)) { - freq_list = freq_list_v2_7981; - n_freqs =ARRAY_SIZE (freq_list_v2_7981); - }else { - freq_list = freq_list_v2; - n_freqs =ARRAY_SIZE (freq_list_v2); - } + freq_list = freq_list_v2; + n_freqs =ARRAY_SIZE (freq_list_v2); + }else { + freq_list = freq_list_v1; + n_freqs =ARRAY_SIZE (freq_list_v1); }if (freq <4000 ) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 362/563 wifi: mt76: mt7996: remove redundant per-phy mac80211 calls during restart
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 0a5df0ec47f7edc04957925a9644101682041d27 ]
There is only one wiphy, so extra calls must be removed. For calls that need to remain per-wiphy, use mt7996_for_each_phy
--- .../net/wireless/mediatek/mt76/mt7996/mac.c | 137 +++++------------- 1 file changed, 35 insertions(+), 102 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +35 -102
@@ -1766,13 +1766,10 @@ void mt7996_tx_token_put(struct mt7996_dev *dev)static int mt7996_mac_restart (struct mt7996_dev *dev) { -struct mt7996_phy *phy2, *phy3;struct mt76_dev *mdev = &dev->mt76; +struct mt7996_phy *phy;int i, ret; - phy2 =mt7996_phy2 (dev); - phy3 =mt7996_phy3 (dev); -if (dev->hif2) {mt76_wr (dev,MT_INT1_MASK_CSR ,0x0 );mt76_wr (dev,MT_INT1_SOURCE_CSR , ~0 );
@@ -1784,20 +1781,14 @@ mt7996_mac_restart(struct mt7996_dev *dev)mt76_wr (dev,MT_PCIE1_MAC_INT_ENABLE ,0x0 ); } -set_bit (MT76_RESET , &dev->mphy.state);set_bit (MT76_MCU_RESET , &dev->mphy.state); +mt7996_for_each_phy (dev, phy) +set_bit (MT76_RESET , &phy->mt76->state);wake_up (&dev->mt76.mcu.wait); -if (phy2) -set_bit (MT76_RESET , &phy2->mt76->state); -if (phy3) -set_bit (MT76_RESET , &phy3->mt76->state);/* lock/unlock all queues to ensure that no tx is pending */ -mt76_txq_schedule_all (&dev->mphy); -if (phy2) -mt76_txq_schedule_all (phy2->mt76); -if (phy3) -mt76_txq_schedule_all (phy3->mt76); +mt7996_for_each_phy (dev, phy) +mt76_txq_schedule_all (phy->mt76);/* disable all tx/rx napi */ mt76_worker_disable (&dev->mt76.tx_worker);
@@ -1855,36 +1846,25 @@ mt7996_mac_restart(struct mt7996_dev *dev) goto out;mt7996_mac_init (dev); -mt7996_init_txpower (&dev->phy); -mt7996_init_txpower (phy2); -mt7996_init_txpower (phy3); +mt7996_for_each_phy (dev, phy) +mt7996_init_txpower (phy); ret =mt7996_txbf_init (dev); +if (ret) + goto out; -if (test_bit (MT76_STATE_RUNNING , &dev->mphy.state)) { - ret =mt7996_run (&dev->phy); -if (ret) - goto out; - } - -if (phy2 &&test_bit (MT76_STATE_RUNNING , &phy2->mt76->state)) { - ret =mt7996_run (phy2); -if (ret) - goto out; - } +mt7996_for_each_phy (dev, phy) { +if (!test_bit (MT76_STATE_RUNNING , &phy->mt76->state)) +continue ; -if (phy3 &&test_bit (MT76_STATE_RUNNING , &phy3->mt76->state)) { - ret =mt7996_run (phy3); + ret =mt7996_run (&dev->phy);if (ret) goto out; } out:/* reset done */ -clear_bit (MT76_RESET , &dev->mphy.state); -if (phy2) -clear_bit (MT76_RESET , &phy2->mt76->state); -if (phy3) -clear_bit (MT76_RESET , &phy3->mt76->state); +mt7996_for_each_phy (dev, phy) +clear_bit (MT76_RESET , &phy->mt76->state);napi_enable (&dev->mt76.tx_napi);local_bh_disable ();
@@ -1898,26 +1878,18 @@ mt7996_mac_restart(struct mt7996_dev *dev)static void mt7996_mac_full_reset (struct mt7996_dev *dev) { -struct mt7996_phy *phy2, *phy3; +struct ieee80211_hw *hw =mt76_hw (dev); +struct mt7996_phy *phy;int i; - phy2 =mt7996_phy2 (dev); - phy3 =mt7996_phy3 (dev); dev->recovery.hw_full_reset = true;wake_up (&dev->mt76.mcu.wait); -ieee80211_stop_queues (mt76_hw (dev)); -if (phy2) -ieee80211_stop_queues (phy2->mt76->hw); -if (phy3) -ieee80211_stop_queues (phy3->mt76->hw); +ieee80211_stop_queues (hw);cancel_work_sync (&dev->wed_rro.work); -cancel_delayed_work_sync (&dev->mphy.mac_work); -if (phy2) -cancel_delayed_work_sync (&phy2->mt76->mac_work); -if (phy3) -cancel_delayed_work_sync (&phy3->mt76->mac_work); +mt7996_for_each_phy (dev, phy) +cancel_delayed_work_sync (&phy->mt76->mac_work);mutex_lock (&dev->mt76.mutex);for (i =0 ; i <10 ; i++) {
@@ -1930,40 +1902,23 @@ mt7996_mac_full_reset(struct mt7996_dev *dev)dev_err (dev->mt76.dev,"chip full reset failed\n" );ieee80211_restart_hw (mt76_hw (dev)); -if (phy2) -ieee80211_restart_hw (phy2->mt76->hw); -if (phy3) -ieee80211_restart_hw (phy3->mt76->hw); -ieee80211_wake_queues (mt76_hw (dev)); -if (phy2) -ieee80211_wake_queues (phy2->mt76->hw); -if (phy3) -ieee80211_wake_queues (phy3->mt76->hw); dev->recovery.hw_full_reset = false; -ieee80211_queue_delayed_work (mt76_hw (dev), - &dev->mphy.mac_work, -MT7996_WATCHDOG_TIME ); -if (phy2) -ieee80211_queue_delayed_work (phy2->mt76->hw, - &phy2->mt76->mac_work, -MT7996_WATCHDOG_TIME ); -if (phy3) -ieee80211_queue_delayed_work (phy3->mt76->hw, - &phy3->mt76->mac_work, +mt7996_for_each_phy (dev, phy) +ieee80211_queue_delayed_work (hw, &phy->mt76->mac_work,MT7996_WATCHDOG_TIME ); }void mt7996_mac_reset_work (struct work_struct *work) { -struct mt7996_phy *phy2, *phy3; +struct ieee80211_hw *hw;struct mt7996_dev *dev; +struct mt7996_phy *phy;int i; dev = container_of(work, struct mt7996_dev, reset_work); - phy2 =mt7996_phy2 (dev); - phy3 =mt7996_phy3 (dev); + hw =mt76_hw (dev);/* chip full reset */ if (dev->recovery.restart) {
@@ -1994,7 +1949,7 @@ void mt7996_mac_reset_work(struct work_struct *work)return ;dev_info (dev->mt76.dev,"\n%s L1 SER recovery start." , -wiphy_name (dev->mt76.hw->wiphy)); +wiphy_name (hw->wiphy));if (mtk_wed_device_active (&dev->mt76.mmio.wed_hif2))mtk_wed_device_stop (&dev->mt76.mmio.wed_hif2);
@@ -2003,25 +1958,17 @@ void mt7996_mac_reset_work(struct work_struct *work)mtk_wed_device_stop (&dev->mt76.mmio.wed);ieee80211_stop_queues (mt76_hw (dev)); -if (phy2) -ieee80211_stop_queues (phy2->mt76->hw); -if (phy3) -ieee80211_stop_queues (phy3->mt76->hw);set_bit (MT76_RESET , &dev->mphy.state);set_bit (MT76_MCU_RESET , &dev->mphy.state);wake_up (&dev->mt76.mcu.wait);cancel_work_sync (&dev->wed_rro.work); -cancel_delayed_work_sync (&dev->mphy.mac_work); -if (phy2) { -set_bit (MT76_RESET , &phy2->mt76->state); -cancel_delayed_work_sync (&phy2->mt76->mac_work); - } -if (phy3) { -set_bit (MT76_RESET , &phy3->mt76->state); -cancel_delayed_work_sync (&phy3->mt76->mac_work); +mt7996_for_each_phy (dev, phy) { +set_bit (MT76_RESET , &phy->mt76->state); +cancel_delayed_work_sync (&phy->mt76->mac_work); } +mt76_worker_disable (&dev->mt76.tx_worker);mt76_for_each_q_rx (&dev->mt76, i) { if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
@@ -2074,11 +2021,8 @@ void mt7996_mac_reset_work(struct work_struct *work) }clear_bit (MT76_MCU_RESET , &dev->mphy.state); -clear_bit (MT76_RESET , &dev->mphy.state); -if (phy2) -clear_bit (MT76_RESET , &phy2->mt76->state); -if (phy3) -clear_bit (MT76_RESET , &phy3->mt76->state); +mt7996_for_each_phy (dev, phy) +clear_bit (MT76_RESET , &phy->mt76->state);mt76_for_each_q_rx (&dev->mt76, i) { if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
@@ -2100,25 +2044,14 @@ void mt7996_mac_reset_work(struct work_struct *work)napi_schedule (&dev->mt76.tx_napi);local_bh_enable (); -ieee80211_wake_queues (mt76_hw (dev)); -if (phy2) -ieee80211_wake_queues (phy2->mt76->hw); -if (phy3) -ieee80211_wake_queues (phy3->mt76->hw); +ieee80211_wake_queues (hw);mutex_unlock (&dev->mt76.mutex);mt7996_update_beacons (dev); -ieee80211_queue_delayed_work (mt76_hw (dev), &dev->mphy.mac_work, -MT7996_WATCHDOG_TIME ); -if (phy2) -ieee80211_queue_delayed_work (phy2->mt76->hw, - &phy2->mt76->mac_work, -MT7996_WATCHDOG_TIME ); -if (phy3) -ieee80211_queue_delayed_work (phy3->mt76->hw, - &phy3->mt76->mac_work, +mt7996_for_each_phy (dev, phy) +ieee80211_queue_delayed_work (hw, &phy->mt76->mac_work,MT7996_WATCHDOG_TIME );dev_info (dev->mt76.dev,"\n%s L1 SER recovery completed." ,wiphy_name (dev->mt76.hw->wiphy));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 363/563 ASoC: Intel: hda-sdw-bpt: set persistent_buffer false
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 8b184c34806e5da4d4847fabd3faeff38b47e70a ]
The persistent_buffer agreement is false when hda_cl_prepare() is called. We should use the same value when hda_cl_cleanup() is called.
--- sound/soc/sof/intel/hda-sdw-bpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/intel/hda-sdw-bpt.c +1 -1
@@ -150,7 +150,7 @@ static int hda_sdw_bpt_dma_deprepare(struct device *dev, struct hdac_ext_streamu32 mask;int ret; - ret =hda_cl_cleanup (sdev->dev, dmab_bdl, true, sdw_bpt_stream); + ret =hda_cl_cleanup (sdev->dev, dmab_bdl, false, sdw_bpt_stream);if (ret <0 ) {dev_err (sdev->dev,"%s: SDW BPT DMA cleanup failed\n" , __func__);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 364/563 srcu/tiny: Remove preempt_disable/enable() in srcu_gp_start_if_needed()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zqiang <[email protected]>
[ Upstream commit e6a43aeb71852a39432332dcc3a6d11bb464b075 ]
Currently, the srcu_gp_start_if_needed() is always be invoked in preempt disable's critical section, this commit therefore remove redundant preempt_disable/enable() in srcu_gp_start_if_needed() and adds a call to lockdep_assert_preemption_disabled() in order to enable lockdep to diagnose mistaken invocations of this function from preempts-enabled code.
--- kernel/rcu/srcutiny.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/rcu/srcutiny.c +1 -3
@@ -176,10 +176,9 @@ static void srcu_gp_start_if_needed(struct srcu_struct *ssp) {unsigned long cookie; -preempt_disable ();// Needed for PREEMPT_LAZY +lockdep_assert_preemption_disabled ();// Needed for PREEMPT_LAZY cookie =get_state_synchronize_srcu (ssp);if (ULONG_CMP_GE (READ_ONCE (ssp->srcu_idx_max), cookie)) { -preempt_enable ();return ; }WRITE_ONCE (ssp->srcu_idx_max, cookie);
@@ -189,7 +188,6 @@ static void srcu_gp_start_if_needed(struct srcu_struct *ssp)else if (list_empty (&ssp->srcu_work.entry))list_add (&ssp->srcu_work.entry, &srcu_boot_list); } -preempt_enable (); }/*
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 365/563 drm/amdgpu: Fix allocating extra dwords for rings (v2)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit ae5c2bee1680436d9bf8bfaca7416496adff0ee0 ]
Rename extra_dw to extra_bytes and document what it's for.
The value is already used as if it were bytes in vcn_v4_0.c and in amdgpu_ring_init. Just adjust the dword count in jpeg_v1_0.c so that it becomes a byte count.
v2:
Rename extra_dw to extra_bytes as discussed during review.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 13 ++++++++++++- drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
@@ -364,7 +364,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,/* Allocate ring buffer */ if (ring->ring_obj ==NULL ) { - r = amdgpu_bo_create_kernel(adev, ring->ring_size + ring->funcs->extra_dw, PAGE_SIZE, + r = amdgpu_bo_create_kernel(adev, ring->ring_size + ring->funcs->extra_bytes, + PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT, &ring->ring_obj, &ring->gpu_addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +12 -1
@@ -211,7 +211,18 @@ struct amdgpu_ring_funcs {bool support_64bit_ptrs;bool no_user_fence;bool secure_submission_supported; -unsigned extra_dw; + +/** +* @extra_bytes: +* +* Optional extra space in bytes that is added to the ring size +* when allocating the BO that holds the contents of the ring. +* This space isn't used for command submission to the ring, +* but is just there to satisfy some hardware requirements or +* implement workarounds. It's up to the implementation of each +* specific ring to initialize this space. +*/ +unsigned extra_bytes;/* ring read/write ptr handling */ u64 (*get_rptr)(struct amdgpu_ring *ring);
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +1 -1
@@ -557,7 +557,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = { .nop = PACKET0(0x81ff, 0), .support_64bit_ptrs = false, .no_user_fence = true, - .extra_dw = 64, + .extra_bytes = 256, .get_rptr = jpeg_v1_0_decode_ring_get_rptr, .get_wptr = jpeg_v1_0_decode_ring_get_wptr, .set_wptr = jpeg_v1_0_decode_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +1 -1
@@ -1984,7 +1984,7 @@ static struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = { .type = AMDGPU_RING_TYPE_VCN_ENC, .align_mask = 0x3f, .nop = VCN_ENC_CMD_NO_OP, - .extra_dw = sizeof(struct amdgpu_vcn_rb_metadata), + .extra_bytes = sizeof(struct amdgpu_vcn_rb_metadata), .get_rptr = vcn_v4_0_unified_ring_get_rptr, .get_wptr = vcn_v4_0_unified_ring_get_wptr, .set_wptr = vcn_v4_0_unified_ring_set_wptr,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 366/563 f2fs: fix to update map->m_next_extent correctly in f2fs_map_blocks()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 869833f54e8306326b85ca3ed08979b7ad412a4a ]
Script to reproduce:
mkfs.f2fs -O extra_attr,compression /dev/vdb -f mount /dev/vdb /mnt/f2fs -o mode=lfs,noextent_cache cd /mnt/f2fsf2fs_io write 1 0 1024 rand dsync testfile xfs_io testfile -c "fsync"f2fs_io write 1 0 512 rand dsync testfile xfs_io testfile -c "fsync"
cd /
umount /mnt/f2fs
mount /dev/vdb /mnt/f2fsf2fs_io precache_extents /mnt/f2fs/testfile umount /mnt/f2fs
Tracepoint output:f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 0, len = 512, blkaddr = 1055744, c_len = 0 f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 513, len = 351, blkaddr = 17921, c_len = 0 f2fs_update_read_extent_tree_range: dev = (253,16), ino = 4, pgofs = 864, len = 160, blkaddr = 18272, c_len = 0
During precache_extents, there is off-by-one issue, we should update map->m_next_extent to pgofs rather than pgofs + 1, if last blkaddr is valid and not contiguous to previous extent.
--- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +1 -1
@@ -1783,7 +1783,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) map->m_len - ofs); }if (map->m_next_extent) - *map->m_next_extent = pgofs +1 ; + *map->m_next_extent = is_hole ? pgofs +1 : pgofs; }f2fs_put_dnode (&dn); unlock_out:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 367/563 f2fs: fix to truncate first page in error path of f2fs_truncate()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 9251a9e6e871cb03c4714a18efa8f5d4a8818450 ]
syzbot reports a bug as below:
loop0: detected capacity change from 0 to 40427
F2FS-fs (loop0): Wrong SSA boundary, start(3584) end(4096) blocks(3072)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): invalid crc value
F2FS-fs (loop0): f2fs_convert_inline_folio: corrupted inline inode ino=3, i_addr[0]:0x1601, run fsck to fix.
------------[ cut here ]------------ kernel BUG at fs/inode.c:753! RIP: 0010:clear_inode+0x169/0x190 fs/inode.c:753 Call Trace: <TASK> evict+0x504/0x9c0 fs/inode.c:810 f2fs_fill_super+0x5612/0x6fa0 fs/f2fs/super.c:5047 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1692 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
During f2fs_evict_inode(), clear_inode() detects that we missed to truncate all page cache before destorying inode, that is because in below path, we will create page #0 in cache, but missed to drop it in error path, let's fix it.
- evict
- f2fs_evict_inode
- f2fs_truncate
- f2fs_convert_inline_inode
- f2fs_grab_cache_folio
: create page #0 in cache
- f2fs_convert_inline_folio
: sanity check failed, return -EFSCORRUPTED
- clear_inode detects that inode->i_data.nrpages is not zero
--- fs/f2fs/file.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/f2fs/file.c +9 -1
@@ -904,8 +904,16 @@ int f2fs_truncate(struct inode *inode)/* we should check inline_data size */ if (!f2fs_may_inline_data (inode)) { err =f2fs_convert_inline_inode (inode); -if (err) +if (err) { +/* +* Always truncate page #0 to avoid page cache +* leak in evict() path. +*/ +truncate_inode_pages_range (inode->i_mapping, +F2FS_BLK_TO_BYTES (0 ), +F2FS_BLK_END_BYTES (0 ));return err; + } } err =f2fs_truncate_blocks (inode,i_size_read (inode), true);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 368/563 f2fs: fix to avoid migrating empty section
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit d625a2b08c089397d3a03bff13fa8645e4ec7a01 ]
It reports a bug from device w/ zufs:
F2FS-fs (dm-64): Inconsistent segment (173822) type [1, 0] in SSA and SIT F2FS-fs (dm-64): Stopped filesystem due to reason: 4
Thread A Thread B
- f2fs_expand_inode_data
- f2fs_allocate_pinning_section
- f2fs_gc_range
- do_garbage_collect w/ segno #x
- writepage
- f2fs_allocate_data_block
- new_curseg
- allocate segno #x
The root cause is: fallocate on pinning file may race w/ block allocation as above, result in do_garbage_collect() from fallocate() may migrate segment which is just allocated by a log, the log will update segment type in its in-memory structure, however GC will get segment type from on-disk SSA block, once segment type changes by log, we can detect such inconsistency, then shutdown filesystem.
In this case, on-disk SSA shows type of segno #173822 is 1 (SUM_TYPE_NODE), however segno #173822 was just allocated as data type segment, so in-memory SIT shows type of segno #173822 is 0 (SUM_TYPE_DATA).
Change as below to fix this issue:
- check whether current section is empty before gc
- add sanity checks on do_garbage_collect() to avoid any race case, result in migrating segment used by log.
- btw, it fixes misc issue in printed logs: "SSA and SIT" -> "SIT and SSA".
--- fs/f2fs/gc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +15 -1
@@ -1794,6 +1794,13 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,struct folio *sum_folio =filemap_get_folio (META_MAPPING (sbi),GET_SUM_BLOCK (sbi, segno)); +if (is_cursec (sbi,GET_SEC_FROM_SEG (sbi, segno))) { +f2fs_err (sbi,"%s: segment %u is used by log" , + __func__, segno); +f2fs_bug_on (sbi,1 ); + goto skip; + } +if (get_valid_blocks (sbi, segno, false) ==0 ) goto freed; if (gc_type == BG_GC && __is_large_section(sbi) &&
@@ -1805,7 +1812,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, sum =folio_address (sum_folio);if (type !=GET_SUM_TYPE ((&sum->footer))) { -f2fs_err (sbi,"Inconsistent segment (%u) type [%d, %d] in SSA and SIT" , +f2fs_err (sbi,"Inconsistent segment (%u) type [%d, %d] in SIT and SSA" , segno, type,GET_SUM_TYPE ((&sum->footer)));f2fs_stop_checkpoint (sbi, false,STOP_CP_REASON_CORRUPTED_SUMMARY );
@@ -2068,6 +2075,13 @@ int f2fs_gc_range(struct f2fs_sb_info *sbi, .iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS), }; +/* +* avoid migrating empty section, as it can be allocated by +* log in parallel. +*/ +if (!get_valid_blocks (sbi, segno, true)) +continue ; +if (is_cursec (sbi,GET_SEC_FROM_SEG (sbi, segno)))continue ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 369/563 f2fs: fix to mitigate overhead of f2fs_zero_post_eof_page()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit c2f7c32b254006ad48f8e4efb2e7e7bf71739f17 ]
f2fs_zero_post_eof_page() may cuase more overhead due to invalidate_lock and page lookup, change as below to mitigate its overhead:
- check new_size before grabbing invalidate_lock
- lookup and invalidate pages only in range of [old_size, new_size]
--- fs/f2fs/file.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
fs/f2fs/file.c +19 -20
@@ -35,15 +35,23 @@#include <trace/events/f2fs.h> #include <uapi/linux/f2fs.h> -static void f2fs_zero_post_eof_page (struct inode *inode,loff_t new_size) +static void f2fs_zero_post_eof_page (struct inode *inode, +loff_t new_size,bool lock) {loff_t old_size =i_size_read (inode);if (old_size >= new_size)return ; +if (mapping_empty (inode->i_mapping)) +return ; + +if (lock) +filemap_invalidate_lock (inode->i_mapping);/* zero or drop pages only in range of [old_size, new_size] */ -truncate_pagecache (inode, old_size); +truncate_inode_pages_range (inode->i_mapping, old_size, new_size); +if (lock) +filemap_invalidate_unlock (inode->i_mapping); }static vm_fault_t f2fs_filemap_fault (struct vm_fault *vmf)
@@ -114,9 +122,7 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)f2fs_bug_on (sbi,f2fs_has_inline_data (inode)); -filemap_invalidate_lock (inode->i_mapping); -f2fs_zero_post_eof_page (inode, (folio->index +1 ) <<PAGE_SHIFT ); -filemap_invalidate_unlock (inode->i_mapping); +f2fs_zero_post_eof_page (inode, (folio->index +1 ) <<PAGE_SHIFT , true);file_update_time (vmf->vma->vm_file);filemap_invalidate_lock_shared (inode->i_mapping);
@@ -1149,7 +1155,7 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,filemap_invalidate_lock (inode->i_mapping);if (attr->ia_size > old_size) -f2fs_zero_post_eof_page (inode, attr->ia_size); +f2fs_zero_post_eof_page (inode, attr->ia_size, false);truncate_setsize (inode, attr->ia_size);if (attr->ia_size <= old_size)
@@ -1268,9 +1274,7 @@ static int f2fs_punch_hole(struct inode *inode, loff_t offset, loff_t len)if (ret)return ret; -filemap_invalidate_lock (inode->i_mapping); -f2fs_zero_post_eof_page (inode, offset + len); -filemap_invalidate_unlock (inode->i_mapping); +f2fs_zero_post_eof_page (inode, offset + len, true); pg_start = ((unsigned long long ) offset) >>PAGE_SHIFT ; pg_end = ((unsigned long long ) offset + len) >>PAGE_SHIFT ;
@@ -1555,7 +1559,7 @@ static int f2fs_do_collapse(struct inode *inode, loff_t offset, loff_t len)f2fs_down_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]);filemap_invalidate_lock (inode->i_mapping); -f2fs_zero_post_eof_page (inode, offset + len); +f2fs_zero_post_eof_page (inode, offset + len, false);f2fs_lock_op (sbi);f2fs_drop_extent_tree (inode);
@@ -1678,9 +1682,7 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len,if (ret)return ret; -filemap_invalidate_lock (mapping); -f2fs_zero_post_eof_page (inode, offset + len); -filemap_invalidate_unlock (mapping); +f2fs_zero_post_eof_page (inode, offset + len, true); pg_start = ((unsigned long long ) offset) >>PAGE_SHIFT ; pg_end = ((unsigned long long ) offset + len) >>PAGE_SHIFT ;
@@ -1814,7 +1816,7 @@ static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len)f2fs_down_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]);filemap_invalidate_lock (mapping); -f2fs_zero_post_eof_page (inode, offset + len); +f2fs_zero_post_eof_page (inode, offset + len, false);truncate_pagecache (inode, offset);while (!ret && idx > pg_start) {
@@ -1872,9 +1874,7 @@ static int f2fs_expand_inode_data(struct inode *inode, loff_t offset,if (err)return err; -filemap_invalidate_lock (inode->i_mapping); -f2fs_zero_post_eof_page (inode, offset + len); -filemap_invalidate_unlock (inode->i_mapping); +f2fs_zero_post_eof_page (inode, offset + len, true);f2fs_balance_fs (sbi, true);
@@ -4922,9 +4922,8 @@ static ssize_t f2fs_write_checks(struct kiocb *iocb, struct iov_iter *from)if (err)return err; -filemap_invalidate_lock (inode->i_mapping); -f2fs_zero_post_eof_page (inode, iocb->ki_pos +iov_iter_count (from)); -filemap_invalidate_unlock (inode->i_mapping); +f2fs_zero_post_eof_page (inode, + iocb->ki_pos +iov_iter_count (from), true);return count; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 343/563 tools: ynl: fix undefined variable name
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
[ Upstream commit 7a3aaaa9fce710938c3557e5708ba5b00dd38226 ]
This variable used in the error path was not defined according to Ruff. msg_format.attr_set is used instead, presumably the one that was supposed to be used originally.
This is linked to Ruff error F821 [1]:
An undefined name is likely to raise NameError at runtime.
--- tools/net/ynl/pyynl/lib/ynl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/net/ynl/pyynl/lib/ynl.py +1 -1
@@ -746,7 +746,7 @@ class YnlFamily(SpecFamily): subdict = self._decode(NlAttrs(attr.raw, offset), msg_format.attr_set) decoded.update(subdict) else: - raise Exception(f"Unknown attribute-set '{attr_space}' when decoding '{attr_spec.name}'") + raise Exception(f"Unknown attribute-set '{msg_format.attr_set}' when decoding '{attr_spec.name}'") return decoded def _decode(self, attrs, space, outer_attrs = None):
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 370/563 RISC-V: KVM: Write hgatp register with valid mode bits
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fangyu Yu <[email protected]>
[ Upstream commit 2b351e3d04be9e1533f26c3464f1e44a5beace30 ]
According to the RISC-V Privileged Architecture Spec, when MODE=Bare is selected,software must write zero to the remaining fields of hgatp.
We have detected the valid mode supported by the HW before, So using a valid mode to detect how many vmid bits are supported.
--- arch/riscv/kvm/vmid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/kvm/vmid.c +2 -1
@@ -14,6 +14,7 @@#include <linux/smp.h> #include <linux/kvm_host.h> #include <asm/csr.h> +#include <asm/kvm_mmu.h> #include <asm/kvm_tlb.h> #include <asm/kvm_vmid.h>
@@ -28,7 +29,7 @@ void __init kvm_riscv_gstage_vmid_detect(void)/* Figure-out number of VMID bits in HW */ old =csr_read (CSR_HGATP ); -csr_write (CSR_HGATP , old |HGATP_VMID ); +csr_write (CSR_HGATP , (kvm_riscv_gstage_mode <<HGATP_MODE_SHIFT ) |HGATP_VMID ); vmid_bits =csr_read (CSR_HGATP ); vmid_bits = (vmid_bits &HGATP_VMID ) >>HGATP_VMID_SHIFT ; vmid_bits =fls_long (vmid_bits);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 371/563 ALSA: pcm: Disable bottom softirqs as part of spin_lock_irq() on PREEMPT_RT
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 9fc4a3da9a0259a0500848b5d8657918efde176b ]
snd_pcm_group_lock_irq() acquires a spinlock_t and disables interrupts via spin_lock_irq(). This also implicitly disables the handling of softirqs such as TIMER_SOFTIRQ.
On PREEMPT_RT softirqs are preemptible and spin_lock_irq() does not disable them. That means a timer can be invoked during spin_lock_irq() on the same CPU. Due to synchronisations reasons local_bh_disable() has a per-CPU lock named softirq_ctrl.lock which synchronizes individual softirq against each other.
syz-bot managed to trigger a lockdep report where softirq_ctrl.lock is acquired in hrtimer_cancel() in addition to hrtimer_run_softirq(). This is a possible deadlock.
The softirq_ctrl.lock can not be made part of spin_lock_irq() as this would lead to too much synchronisation against individual threads on the system. To avoid the possible deadlock, softirqs must be manually disabled before the lock is acquired.
Disable softirqs before the lock is acquired on PREEMPT_RT.
--- sound/core/pcm_native.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
sound/core/pcm_native.c +15 -10
@@ -84,19 +84,24 @@ void snd_pcm_group_init(struct snd_pcm_group *group) }/* define group lock helpers */ -#define DEFINE_PCM_GROUP_LOCK (action, mutex_action) \ +#define DEFINE_PCM_GROUP_LOCK (action, bh_lock, bh_unlock, mutex_action) \ static void snd_pcm_group_ ## action(struct snd_pcm_group *group, bool nonatomic) \ { \ - if (nonatomic) \ + if (nonatomic) { \ mutex_ ## mutex_action(&group->mutex); \ - else \ - spin_ ## action(&group->lock); \ -} - -DEFINE_PCM_GROUP_LOCK (lock, lock); -DEFINE_PCM_GROUP_LOCK (unlock, unlock); -DEFINE_PCM_GROUP_LOCK (lock_irq, lock); -DEFINE_PCM_GROUP_LOCK (unlock_irq, unlock); + } else { \ + if (IS_ENABLED(CONFIG_PREEMPT_RT) && bh_lock) \ + local_bh_disable(); \ + spin_ ## action(&group->lock); \ + if (IS_ENABLED(CONFIG_PREEMPT_RT) && bh_unlock) \ + local_bh_enable(); \ + } \ +} + +DEFINE_PCM_GROUP_LOCK (lock, false, false, lock); +DEFINE_PCM_GROUP_LOCK (unlock, false, false, unlock); +DEFINE_PCM_GROUP_LOCK (lock_irq, true, false, lock); +DEFINE_PCM_GROUP_LOCK (unlock_irq, false, true, unlock);/** * snd_pcm_stream_lock - Lock the PCM stream
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 372/563 ACPI: NFIT: Fix incorrect ndr_desc being reportedin dev_err message
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit d1a599a8136b16522b5afebd122395524496d549 ]
There appears to be a cut-n-paste error with the incorrect field ndr_desc->numa_node being reported for the target node. Fix this by using ndr_desc->target_node instead.
--- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/nfit/core.c +1 -1
@@ -2637,7 +2637,7 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc,if (ndr_desc->target_node ==NUMA_NO_NODE ) { ndr_desc->target_node =phys_to_target_node (spa->address);dev_info (acpi_desc->dev,"changing target node from %d to %d for nfit region [%pa-%pa]" , -NUMA_NO_NODE , ndr_desc->numa_node, &res.start, &res.end); +NUMA_NO_NODE , ndr_desc->target_node, &res.start, &res.end); }/*
Signature · 1 line
2.51.0
RE: [PATCH 6.17 209/563] i3c: fix big-endian FIFO transfers
In reply to Greg Kroah-Hartman[AMD Official Use Only - AMD Internal Distribution Only]
Hi Greg,
Please ignore this one - the next version of it has already been merged.
Thanks,
Manikanta
Quoted 83 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, October 13, 2025 8:11 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Guntupalli, Manikanta <[email protected]>; Arnd Bergmann <[email protected]>; Jorge Marques <[email protected]>; Alexandre Belloni <[email protected]>; Sasha Levin <[email protected]>
Subject: [PATCH 6.17 209/563] i3c: fix big-endian FIFO transfers6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit
d6ddd9beb1a5c32acb9b80f5c2cd8b17f41371d1]Short MMIO transfers that are not a multiple of four bytes in size need a special case for the final bytes, however the existing implementation is not endian-safe and introduces an incorrect byteswap on big-endian kernels.
This usually does not cause problems because most systems are little-endian and most transfers are multiple of four bytes long, but still needs to be fixed to avoid the extra byteswap.
Change the special case for both
i3c_writel_fifo()andi3c_readl_fifo()to use non- byteswappingwritesl()andreadsl()with a single element instead of the byteswapping writel()/readl() that are meant for individual MMIO registers. As data is copied between a FIFO and a memory buffer, the writesl()/readsl() loops are typically based on __raw_readl()/__raw_writel(), resulting in the order of bytes in the FIFO to match the order in the buffer, regardless of the CPU endianess.The earlier versions in the dw-i3c and i3c-master-cdns had a correct implementation, but the generic version that was recently added broke it.
Fixes 733b439375b4 ("i3c: master: Add inline i3c_readl_fifo() and i3c_writel_fifo()")Cc Manikanta Guntupalli <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>Reviewed-by Jorge Marques <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/i3c/internals.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/i3c/internals.h index renamed from drivers/i3c/internals.h +0
-0
0d857cc68cc5d..79ceaa5f5afd6100644drivers/i3c/internals.h +10
-2@@ -38,7 +38,11 @@ static inline void i3c_writel_fifo(void __iomem *addr, constvoid *buf, u32 tmp = 0;memcpy (&tmp, buf + (nbytes & ~3 ), nbytes &3 ); -writel (tmp, addr); +/* +* writesl() instead of writel() to keep FIFO +* byteorder on big-endian targets +*/ +writesl (addr, &tmp,1 ); } }@@ -55,7 +59,11 @@ static inline void i3c_readl_fifo(const void __iomem *addr, void *buf, if (nbytes & 3) {u32 tmp; - tmp =readl (addr); +/* +* readsl() instead of readl() to keep FIFO +* byteorder on big-endian targets +*/ +readsl (addr, &tmp,1 );memcpy (buf + (nbytes & ~3 ), &tmp, nbytes &3 ); }}
--
2.51.0
Greg Kroah-Hartman
maintainerPATCH 373/563 scsi: qla2xxx: edif: Fix incorrect sign of error code
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qianfeng Rong <[email protected]>
[ Upstream commit 066b8f3fa85c1be7fb7dbae202231e131d38f7bc ]
Change the error code EAGAIN to -EAGAIN in qla24xx_sadb_update() and qla_edif_process_els() to align with qla2x00_start_sp() returning negative error codes or QLA_SUCCESS, preventing logical errors.
Message-ID: <[email protected]>
--- drivers/scsi/qla2xxx/qla_edif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +2 -2
@@ -1798,7 +1798,7 @@ qla24xx_sadb_update(struct bsg_job *bsg_job)switch (rval) {case QLA_SUCCESS :break ; -case EAGAIN : +case -EAGAIN :msleep (EDIF_MSLEEP_INTERVAL ); cnt++;if (cnt <EDIF_RETRY_COUNT )
@@ -3649,7 +3649,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job) p->e.extra_rx_xchg_address, p->e.extra_control_flags, sp->handle, sp->remap.req.len, bsg_job);break ; -case EAGAIN : +case -EAGAIN :msleep (EDIF_MSLEEP_INTERVAL ); cnt++;if (cnt <EDIF_RETRY_COUNT )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 374/563 scsi: qla2xxx: Fix incorrect sign of error code in START_SP_W_RETRIES()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qianfeng Rong <[email protected]>
[ Upstream commit 1f037e3acda79639a78f096355f2c308a3d45492 ]
Change the error code EAGAIN to -EAGAIN in START_SP_W_RETRIES() to align with qla2x00_start_sp() returning negative error codes or QLA_SUCCESS, preventing logical errors. Additionally, the '_rval' variable should store negative error codes to conform to Linux kernel error code conventions.
Message-ID: <[email protected]>
--- drivers/scsi/qla2xxx/qla_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +2 -2
@@ -2059,11 +2059,11 @@ static void qla_marker_sp_done(srb_t *sp, int res)int cnt =5 ; \ do { \ if (_chip_gen != sp->vha->hw->chip_reset || _login_gen != sp->fcport->login_gen) {\ - _rval = EINVAL; \ + _rval = -EINVAL; \ break; \ } \ _rval = qla2x00_start_sp(_sp); \ - if (_rval == EAGAIN) \ + if (_rval == -EAGAIN) \ msleep(1); \ else \ break; \
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 344/563 RDMA/mlx5: Fix page size bitmap calculation for KSM mode
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Srouji <[email protected]>
[ Upstream commit 372fdb5c75b61f038f4abf596abdcf01acbdb7af ]
When using KSM (Key Scatter-gather Memory) access mode, the HW requires the IOVA to be aligned to the selected page size.
Without this alignment, the HW may not function correctly.
Currently, mlx5_umem_mkc_find_best_pgsz() does not filter out page sizes that would result in misaligned IOVAs for KSM mode. This can lead to selecting page sizes that are incompatible with the given IOVA.
Fix this by filtering the page size bitmap when in KSM mode, keeping only page sizes to which the IOVA is aligned to.
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/mlx5/mlx5_ib.h +4 -0
@@ -1803,6 +1803,10 @@ mlx5_umem_mkc_find_best_pgsz(struct mlx5_ib_dev *dev, struct ib_umem *umem, bitmap =GENMASK_ULL (max_log_entity_size_cap, min_log_entity_size_cap); +/* In KSM mode HW requires IOVA and mkey's page size to be aligned */ +if (access_mode ==MLX5_MKC_ACCESS_MODE_KSM && iova) + bitmap &=GENMASK_ULL (__ffs64 (iova),0 ); +return ib_umem_find_best_pgsz (umem, bitmap, iova); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 345/563 netfilter: ipset: Remove unused htable_bits in macro ahash_region
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhen Ni <[email protected]>
[ Upstream commit ba941796d7cd1e81f51eed145dad1b47240ff420 ]
Since the ahash_region() macro was redefined to calculate the region index solely from HTABLE_REGION_BITS, the htable_bits parameter became unused.
Remove the unused htable_bits argument and its call sites, simplifying the code without changing semantics.
--- net/netfilter/ipset/ip_set_hash_gen.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netfilter/ipset/ip_set_hash_gen.h +4 -4
@@ -63,7 +63,7 @@ struct hbucket { : jhash_size((htable_bits) - HTABLE_REGION_BITS))#define ahash_sizeof_regions (htable_bits) \ (ahash_numof_locks(htable_bits) * sizeof(struct ip_set_region)) -#define ahash_region (n, htable_bits) \ +#define ahash_region (n) \ ((n) / jhash_size(HTABLE_REGION_BITS))#define ahash_bucket_start (h, htable_bits) \ ((htable_bits) < HTABLE_REGION_BITS ? 0 \
@@ -702,7 +702,7 @@ mtype_resize(struct ip_set *set, bool retried)#endif key =HKEY (data, h->initval, htable_bits); m =__ipset_dereference (hbucket (t, key)); - nr =ahash_region (key, htable_bits); + nr =ahash_region (key);if (!m) { m = kzalloc(sizeof(*m) + AHASH_INIT_SIZE * dsize,
@@ -852,7 +852,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,rcu_read_lock_bh (); t =rcu_dereference_bh (h->table); key =HKEY (value, h->initval, t->htable_bits); - r =ahash_region (key, t->htable_bits); + r =ahash_region (key);atomic_inc (&t->uref); elements = t->hregion[r].elements; maxelem = t->maxelem;
@@ -1050,7 +1050,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,rcu_read_lock_bh (); t =rcu_dereference_bh (h->table); key =HKEY (value, h->initval, t->htable_bits); - r =ahash_region (key, t->htable_bits); + r =ahash_region (key);atomic_inc (&t->uref);rcu_read_unlock_bh ();
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 346/563 ipvs: Use READ_ONCE/WRITE_ONCE for ipvs->enable
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Tengfei <[email protected]>
[ Upstream commit 944b6b216c0387ac3050cd8b773819ae360bfb1c ]
KCSAN reported a data-race on the ipvs->enable flag, which is written in the control path and read concurrently from many other contexts.
Following a suggestion by Julian, this patch fixes the race by converting all accesses to use WRITE_ONCE()/READ_ONCE(). This lightweight approach ensures atomic access and acts as a compiler barrier, preventing unsafe optimizations where the flag is checked in loops (e.g., in ip_vs_est.c).
Additionally, the enable checks in the fast-path hooks (ip_vs_in_hook, ip_vs_out_hook, ip_vs_forward_icmp) are removed. These are unnecessary since commit 857ca89711de ("ipvs: register hooks only with services"). The enable=0 condition they check for can only occur in two rare and non-fatal
scenarios: 1) after hooks are registered but before the flag is set, and 2) after hooks are unregistered on cleanup_net. In the worst case, a single packet might be mishandled (e.g., dropped), which does not lead to a system crash or data corruption. Adding a check in the performance-critical fast-path to handle this harmless condition is not a worthwhile trade-off.
--- net/netfilter/ipvs/ip_vs_conn.c | 4 ++-- net/netfilter/ipvs/ip_vs_core.c | 11 ++++------- net/netfilter/ipvs/ip_vs_ctl.c | 6 +++--- net/netfilter/ipvs/ip_vs_est.c | 16 ++++++++-------- 4 files changed, 17 insertions(+), 20 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +2 -2
@@ -885,7 +885,7 @@ static void ip_vs_conn_expire(struct timer_list *t)* conntrack cleanup for the net. */ smp_rmb (); -if (ipvs->enable) +if (READ_ONCE (ipvs->enable))ip_vs_conn_drop_conntrack (cp); }
@@ -1439,7 +1439,7 @@ void ip_vs_expire_nodest_conn_flush(struct netns_ipvs *ipvs)cond_resched_rcu ();/* netns clean up started, abort delayed work */ -if (!ipvs->enable) +if (!READ_ONCE (ipvs->enable))break ; }rcu_read_unlock ();
net/netfilter/ipvs/ip_vs_core.c +4 -7
@@ -1353,9 +1353,6 @@ ip_vs_out_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *statif (unlikely (!skb_dst (skb)))return NF_ACCEPT ; -if (!ipvs->enable) -return NF_ACCEPT ; -ip_vs_fill_iph_skb (af, skb, false, &iph);#ifdef CONFIG_IP_VS_IPV6 if (af ==AF_INET6 ) {
@@ -1940,7 +1937,7 @@ ip_vs_in_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *statereturn NF_ACCEPT ; }/* ipvs enabled in this netns ? */ -if (unlikely (sysctl_backup_only (ipvs) || !ipvs->enable)) +if (unlikely (sysctl_backup_only (ipvs)))return NF_ACCEPT ;ip_vs_fill_iph_skb (af, skb, false, &iph);
@@ -2108,7 +2105,7 @@ ip_vs_forward_icmp(void *priv, struct sk_buff *skb,int r;/* ipvs enabled in this netns ? */ -if (unlikely (sysctl_backup_only (ipvs) || !ipvs->enable)) +if (unlikely (sysctl_backup_only (ipvs)))return NF_ACCEPT ;if (state->pf ==NFPROTO_IPV4 ) {
@@ -2295,7 +2292,7 @@ static int __net_init __ip_vs_init(struct net *net)return -ENOMEM ;/* Hold the beast until a service is registered */ - ipvs->enable =0 ; +WRITE_ONCE (ipvs->enable,0 ); ipvs->net = net;/* Counters used for creating unique names */ ipvs->gen =atomic_read (&ipvs_netns_cnt);
@@ -2367,7 +2364,7 @@ static void __net_exit __ip_vs_dev_cleanup_batch(struct list_head *net_list) ipvs =net_ipvs (net);ip_vs_unregister_hooks (ipvs,AF_INET );ip_vs_unregister_hooks (ipvs,AF_INET6 ); - ipvs->enable =0 ;/* Disable packet reception */ +WRITE_ONCE (ipvs->enable,0 );/* Disable packet reception */ smp_wmb ();ip_vs_sync_net_cleanup (ipvs); }
net/netfilter/ipvs/ip_vs_ctl.c +3 -3
@@ -256,7 +256,7 @@ static void est_reload_work_handler(struct work_struct *work)struct ip_vs_est_kt_data *kd = ipvs->est_kt_arr[id];/* netns clean up started, abort delayed work */ -if (!ipvs->enable) +if (!READ_ONCE (ipvs->enable)) goto unlock;if (!kd)continue ;
@@ -1483,9 +1483,9 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, *svc_p = svc; -if (!ipvs->enable) { +if (!READ_ONCE (ipvs->enable)) {/* Now there is a service - full throttle */ - ipvs->enable =1 ; +WRITE_ONCE (ipvs->enable,1 );/* Start estimation for first time */ ip_vs_est_reload_start (ipvs);
net/netfilter/ipvs/ip_vs_est.c +8 -8
@@ -231,7 +231,7 @@ static int ip_vs_estimation_kthread(void *data)void ip_vs_est_reload_start (struct netns_ipvs *ipvs) {/* Ignore reloads before first service is added */ -if (!ipvs->enable) +if (!READ_ONCE (ipvs->enable))return ;ip_vs_est_stopped_recalc (ipvs);/* Bump the kthread configuration genid */
@@ -306,7 +306,7 @@ static int ip_vs_est_add_kthread(struct netns_ipvs *ipvs)int i;if ((unsigned long )ipvs->est_kt_count >= ipvs->est_max_threads && - ipvs->enable && ipvs->est_max_threads) +READ_ONCE (ipvs->enable) && ipvs->est_max_threads)return -EINVAL ;mutex_lock (&ipvs->est_mutex);
@@ -343,7 +343,7 @@ static int ip_vs_est_add_kthread(struct netns_ipvs *ipvs) }/* Start kthread tasks only when services are present */ -if (ipvs->enable && !ip_vs_est_stopped (ipvs)) { +if (READ_ONCE (ipvs->enable) && !ip_vs_est_stopped (ipvs)) { ret =ip_vs_est_kthread_start (ipvs, kd);if (ret <0 ) goto out;
@@ -486,7 +486,7 @@ int ip_vs_start_estimator(struct netns_ipvs *ipvs, struct ip_vs_stats *stats)struct ip_vs_estimator *est = &stats->est;int ret; -if (!ipvs->est_max_threads && ipvs->enable) +if (!ipvs->est_max_threads &&READ_ONCE (ipvs->enable)) ipvs->est_max_threads =ip_vs_est_max_threads (ipvs); est->ktid =-1 ;
@@ -663,7 +663,7 @@ static int ip_vs_est_calc_limits(struct netns_ipvs *ipvs, int *chain_max)/* Wait for cpufreq frequency transition */ wait_event_idle_timeout (wq,kthread_should_stop (),HZ /50 ); -if (!ipvs->enable ||kthread_should_stop ()) +if (!READ_ONCE (ipvs->enable) ||kthread_should_stop ()) goto stop; }
@@ -681,7 +681,7 @@ static int ip_vs_est_calc_limits(struct netns_ipvs *ipvs, int *chain_max)rcu_read_unlock ();local_bh_enable (); -if (!ipvs->enable ||kthread_should_stop ()) +if (!READ_ONCE (ipvs->enable) ||kthread_should_stop ()) goto stop;cond_resched ();
@@ -757,7 +757,7 @@ static void ip_vs_est_calc_phase(struct netns_ipvs *ipvs)mutex_lock (&ipvs->est_mutex);for (id =1 ; id < ipvs->est_kt_count; id++) {/* netns clean up started, abort */ -if (!ipvs->enable) +if (!READ_ONCE (ipvs->enable)) goto unlock2; kd = ipvs->est_kt_arr[id];if (!kd)
@@ -787,7 +787,7 @@ static void ip_vs_est_calc_phase(struct netns_ipvs *ipvs) id = ipvs->est_kt_count; next_kt: -if (!ipvs->enable ||kthread_should_stop ()) +if (!READ_ONCE (ipvs->enable) ||kthread_should_stop ()) goto unlock; id--;if (id <0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 347/563 HID: steelseries: Fix STEELSERIES_SRWS1 handling in steelseries_remove()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
[ Upstream commit 2910913ef87dd9b9ce39e844c7295e1896b3b039 ]
srws1_remove label can be only reached only if LEDS subsystem is enabled. To avoid putting horryfing ifdef second time around the label, just perform the cleanup and exit immediately directly.
--- drivers/hid/hid-steelseries.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hid/hid-steelseries.c +1 -2
@@ -582,7 +582,7 @@ static void steelseries_remove(struct hid_device *hdev)if (hdev->product ==USB_DEVICE_ID_STEELSERIES_SRWS1 ) {#if IS_BUILTIN (CONFIG_LEDS_CLASS ) || \ (IS_MODULE (CONFIG_LEDS_CLASS ) &&IS_MODULE (CONFIG_HID_STEELSERIES )) - goto srws1_remove; +hid_hw_stop (hdev);#endif return ; }
@@ -596,7 +596,6 @@ static void steelseries_remove(struct hid_device *hdev)cancel_delayed_work_sync (&sd->battery_work);hid_hw_close (hdev); -srws1_remove:hid_hw_stop (hdev); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 348/563 watchdog: intel_oc_wdt: Do not try to write into const memory
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit bdbb4a2d2aeae3d115bbdc402adac72aec071492 ]
The code tries to update the intel_oc_wdt_info data structure if the watchdog is locked. That data structure is marked as const and can not be written into. Copy it into struct intel_oc_wdt and modify it there to fix the problem.
--- drivers/watchdog/intel_oc_wdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/watchdog/intel_oc_wdt.c +4 -4
@@ -41,6 +41,7 @@struct intel_oc_wdt {struct watchdog_device wdd;struct resource *ctrl_res; +struct watchdog_info info;bool locked; };
@@ -115,7 +116,6 @@ static const struct watchdog_ops intel_oc_wdt_ops = {static int intel_oc_wdt_setup (struct intel_oc_wdt *oc_wdt) { -struct watchdog_info *info;unsigned long val; val =inl (INTEL_OC_WDT_CTRL_REG (oc_wdt));
@@ -134,7 +134,6 @@ static int intel_oc_wdt_setup(struct intel_oc_wdt *oc_wdt)set_bit (WDOG_HW_RUNNING , &oc_wdt->wdd.status);if (oc_wdt->locked) { - info = (struct watchdog_info *)&intel_oc_wdt_info;/* * Set nowayout unconditionally as we cannot stop * the watchdog.
@@ -145,7 +144,7 @@ static int intel_oc_wdt_setup(struct intel_oc_wdt *oc_wdt)* and inform the core we can't change it. */ oc_wdt->wdd.timeout = (val &INTEL_OC_WDT_TOV ) +1 ; - info->options &= ~WDIOF_SETTIMEOUT ; + oc_wdt->info.options &= ~WDIOF_SETTIMEOUT ; dev_info(oc_wdt->wdd.parent, "Register access locked, heartbeat fixed at: %u s\n",
@@ -193,7 +192,8 @@ static int intel_oc_wdt_probe(struct platform_device *pdev) wdd->min_timeout =INTEL_OC_WDT_MIN_TOV ; wdd->max_timeout =INTEL_OC_WDT_MAX_TOV ; wdd->timeout =INTEL_OC_WDT_DEF_TOV ; - wdd->info = &intel_oc_wdt_info; + oc_wdt->info = intel_oc_wdt_info; + wdd->info = &oc_wdt->info; wdd->ops = &intel_oc_wdt_ops; wdd->parent = dev;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 349/563 watchdog: mpc8xxx_wdt: Reload the watchdog timer when enabling the watchdog
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 7dfd80f70ef00d871df5af7c391133f7ba61ad9b ]
When the watchdog gets enabled with this driver, it leaves enough time for the core watchdog subsystem to start pinging it. But when the watchdog is already started by hardware or by the boot loader, little time remains before it fires and it happens that the core watchdog subsystem doesn't have time to start pinging it.
Until commit 19ce9490aa84 ("watchdog: mpc8xxx: use the core worker function") pinging was managed by the driver itself and the watchdog was immediately pinged by setting the timer expiry to 0.
So restore similar behaviour by pinging it when enabling it so that if it was already enabled the watchdog timer counter is reloaded.
--- drivers/watchdog/mpc8xxx_wdt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/watchdog/mpc8xxx_wdt.c +2 -0
@@ -100,6 +100,8 @@ static int mpc8xxx_wdt_start(struct watchdog_device *w) ddata->swtc = tmp >>16 ;set_bit (WDOG_HW_RUNNING , &ddata->wdd.status); +mpc8xxx_wdt_keepalive (ddata); +return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 340/563 iio: consumers: Fix handling of negative channel scale in iio_convert_raw_to_processed()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 0f85406bf830eb8747dd555ab53c9d97ee4af293 ]
There is an issue with the handling of negative channel scales in iio_convert_raw_to_processed_unlocked() when the channel-scale is of the IIO_VAL_INT_PLUS_[MICRO|NANO] type:
Things work for channel-scale values > -1.0 and < 0.0 because of the use of signed values in:
*processed += div_s64(raw64 * (s64)scale_val2 * scale, 1000000LL);
Things will break however for scale values < -1.0. Lets for example say that raw = 2, (caller-provided)scale = 10 and (channel)scale_val = -1.5.
The result should then be 2 * 10 * -1.5 = -30.
channel-scale = -1.5 means scale_val = -1 and scale_val2 = 500000, now lets see what gets stored in processed:
1. *processed = raw64 * scale_val * scale;
2. *processed += raw64 * scale_val2 * scale / 1000000LL;
1. Sets processed to 2 * -1 * 10 = -20
2. Adds 2 * 500000 * 10 / 1000000 = 10 to processed
And the end result is processed = -20 + 10 = -10, which is not correct.
Fix this by always using the abs value of both scale_val and scale_val2 and if either is negative multiply the end-result by -1.
Note there seems to be an unwritten rule about negative IIO_VAL_INT_PLUS_[MICRO|NANO] values that:
i. values > -1.0 and < 0.0 are written as val=0 val2=-xxx
ii. values <= -1.0 are written as val=-xxx val2=xxx
But iio_format_value() will also correctly display a third option:
iii. values <= -1.0 written as val=-xxx val2=-xxx
Since iio_format_value() uses abs(val) when val2 < 0.
This fix also makes iio_convert_raw_to_processed() properly handle channel-scales using this third option.
--- drivers/iio/inkern.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/iio/inkern.c +14 -14
@@ -11,6 +11,7 @@#include <linux/mutex.h> #include <linux/property.h> #include <linux/slab.h> +#include <linux/units.h> #include <linux/iio/iio.h> #include <linux/iio/iio-opaque.h>
@@ -604,7 +605,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, {int scale_type, scale_val, scale_val2;int offset_type, offset_val, offset_val2; -s64 raw64 = raw; +s64 denominator, raw64 = raw; offset_type =iio_channel_read (chan, &offset_val, &offset_val2,IIO_CHAN_INFO_OFFSET );
@@ -648,20 +649,19 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, *processed = raw64 * scale_val * scale;break ;case IIO_VAL_INT_PLUS_MICRO : -if (scale_val2 <0 ) - *processed = -raw64 * scale_val * scale; -else - *processed = raw64 * scale_val * scale; - *processed +=div_s64 (raw64 * (s64 )scale_val2 * scale, -1000000LL ); -break ;case IIO_VAL_INT_PLUS_NANO : -if (scale_val2 <0 ) - *processed = -raw64 * scale_val * scale; -else - *processed = raw64 * scale_val * scale; - *processed +=div_s64 (raw64 * (s64 )scale_val2 * scale, -1000000000LL ); +switch (scale_type) { +case IIO_VAL_INT_PLUS_MICRO : + denominator =MICRO ; +break ; +case IIO_VAL_INT_PLUS_NANO : + denominator =NANO ; +break ; + } + *processed = raw64 * scale *abs (scale_val); + *processed +=div_s64 (raw64 * scale *abs (scale_val2), denominator); +if (scale_val <0 || scale_val2 <0 ) + *processed *=-1 ;break ;case IIO_VAL_FRACTIONAL : *processed = div_s64(raw64 * (s64)scale_val * scale,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 376/563 HID: hidraw: tighten ioctl command parsing
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
[ Upstream commit 75d5546f60b36900051d75ee623fceccbeb6750c ]
The handling for variable-length ioctl commands in hidraw_ioctl() is rather complex and the check for the data direction is incomplete.
Simplify this code by factoring out the various ioctls grouped by dir and size, and using a switch() statement with the size masked out, to ensure the rest of the command is correctly matched.
--- drivers/hid/hidraw.c | 224 ++++++++++++++++++++---------------- include/uapi/linux/hidraw.h | 2 + 2 files changed, 124 insertions(+), 102 deletions(-)
drivers/hid/hidraw.c +122 -102
@@ -394,27 +394,15 @@ static int hidraw_revoke(struct hidraw_list *list)return 0 ; } -static long hidraw_ioctl (struct file *file,unsigned int cmd, -unsigned long arg) +static long hidraw_fixed_size_ioctl (struct file *file,struct hidraw *dev,unsigned int cmd, +void __user *arg) { -struct inode *inode =file_inode (file); -unsigned int minor =iminor (inode); -long ret =0 ; -struct hidraw *dev; -struct hidraw_list *list = file->private_data; -void __user *user_arg = (void __user *) arg; - -down_read (&minors_rwsem); - dev = hidraw_table[minor]; -if (!dev || !dev->exist ||hidraw_is_revoked (list)) { - ret = -ENODEV ; - goto out; - } +struct hid_device *hid = dev->hid;switch (cmd) {case HIDIOCGRDESCSIZE : -if (put_user (dev->hid->rsize, (int __user *)arg)) - ret = -EFAULT ; +if (put_user (hid->rsize, (int __user *)arg)) +return -EFAULT ;break ;case HIDIOCGRDESC :
@@ -422,113 +410,145 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,__u32 len;if (get_user (len, (int __user *)arg)) - ret = -EFAULT ; -else if (len >HID_MAX_DESCRIPTOR_SIZE -1 ) - ret = -EINVAL ; -else if (copy_to_user (user_arg + offsetof( -struct hidraw_report_descriptor , - value[0]), - dev->hid->rdesc, - min(dev->hid->rsize, len))) - ret = -EFAULT ; +return -EFAULT ; + +if (len >HID_MAX_DESCRIPTOR_SIZE -1 ) +return -EINVAL ; + +if (copy_to_user (arg + offsetof( +struct hidraw_report_descriptor , + value[0]), + hid->rdesc, + min(hid->rsize, len))) +return -EFAULT ; +break ; }case HIDIOCGRAWINFO : {struct hidraw_devinfo dinfo; - dinfo.bustype = dev->hid->bus; - dinfo.vendor = dev->hid->vendor; - dinfo.product = dev->hid->product; -if (copy_to_user (user_arg, &dinfo,sizeof (dinfo))) - ret = -EFAULT ; + dinfo.bustype = hid->bus; + dinfo.vendor = hid->vendor; + dinfo.product = hid->product; +if (copy_to_user (arg, &dinfo,sizeof (dinfo))) +return -EFAULT ;break ; }case HIDIOCREVOKE : { -if (user_arg) - ret = -EINVAL ; -else - ret =hidraw_revoke (list); -break ; +struct hidraw_list *list = file->private_data; + +if (arg) +return -EINVAL ; + +return hidraw_revoke (list); }default : - { -struct hid_device *hid = dev->hid; -if (_IOC_TYPE (cmd) !='H' ) { - ret = -EINVAL ; -break ; - } +/* +* None of the above ioctls can return -EAGAIN, so +* use it as a marker that we need to check variable +* length ioctls. +*/ +return -EAGAIN ; + } -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCSFEATURE (0 ))) { -int len =_IOC_SIZE (cmd); - ret =hidraw_send_report (file, user_arg, len,HID_FEATURE_REPORT ); -break ; - } -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCGFEATURE (0 ))) { -int len =_IOC_SIZE (cmd); - ret =hidraw_get_report (file, user_arg, len,HID_FEATURE_REPORT ); -break ; - } +return 0 ; +} -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCSINPUT (0 ))) { -int len =_IOC_SIZE (cmd); - ret =hidraw_send_report (file, user_arg, len,HID_INPUT_REPORT ); -break ; - } -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCGINPUT (0 ))) { -int len =_IOC_SIZE (cmd); - ret =hidraw_get_report (file, user_arg, len,HID_INPUT_REPORT ); -break ; - } +static long hidraw_rw_variable_size_ioctl (struct file *file,struct hidraw *dev,unsigned int cmd, +void __user *user_arg) +{ +int len =_IOC_SIZE (cmd); + +switch (cmd & ~IOCSIZE_MASK ) { +case HIDIOCSFEATURE (0 ): +return hidraw_send_report (file, user_arg, len,HID_FEATURE_REPORT ); +case HIDIOCGFEATURE (0 ): +return hidraw_get_report (file, user_arg, len,HID_FEATURE_REPORT ); +case HIDIOCSINPUT (0 ): +return hidraw_send_report (file, user_arg, len,HID_INPUT_REPORT ); +case HIDIOCGINPUT (0 ): +return hidraw_get_report (file, user_arg, len,HID_INPUT_REPORT ); +case HIDIOCSOUTPUT (0 ): +return hidraw_send_report (file, user_arg, len,HID_OUTPUT_REPORT ); +case HIDIOCGOUTPUT (0 ): +return hidraw_get_report (file, user_arg, len,HID_OUTPUT_REPORT ); + } -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCSOUTPUT (0 ))) { -int len =_IOC_SIZE (cmd); - ret =hidraw_send_report (file, user_arg, len,HID_OUTPUT_REPORT ); -break ; - } -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCGOUTPUT (0 ))) { -int len =_IOC_SIZE (cmd); - ret =hidraw_get_report (file, user_arg, len,HID_OUTPUT_REPORT ); -break ; - } +return -EINVAL ; +} -/* Begin Read-only ioctls. */ -if (_IOC_DIR (cmd) != _IOC_READ) { - ret = -EINVAL ; -break ; - } +static long hidraw_ro_variable_size_ioctl (struct file *file,struct hidraw *dev,unsigned int cmd, +void __user *user_arg) +{ +struct hid_device *hid = dev->hid; +int len =_IOC_SIZE (cmd); +int field_len; + +switch (cmd & ~IOCSIZE_MASK ) { +case HIDIOCGRAWNAME (0 ): + field_len =strlen (hid->name) +1 ; +if (len > field_len) + len = field_len; +return copy_to_user (user_arg, hid->name, len) ? -EFAULT : len; +case HIDIOCGRAWPHYS (0 ): + field_len =strlen (hid->phys) +1 ; +if (len > field_len) + len = field_len; +return copy_to_user (user_arg, hid->phys, len) ? -EFAULT : len; +case HIDIOCGRAWUNIQ (0 ): + field_len =strlen (hid->uniq) +1 ; +if (len > field_len) + len = field_len; +return copy_to_user (user_arg, hid->uniq, len) ? -EFAULT : len; + } -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCGRAWNAME (0 ))) { -int len =strlen (hid->name) +1 ; -if (len >_IOC_SIZE (cmd)) - len =_IOC_SIZE (cmd); - ret =copy_to_user (user_arg, hid->name, len) ? - -EFAULT : len; -break ; - } +return -EINVAL ; +} -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCGRAWPHYS (0 ))) { -int len =strlen (hid->phys) +1 ; -if (len >_IOC_SIZE (cmd)) - len =_IOC_SIZE (cmd); - ret =copy_to_user (user_arg, hid->phys, len) ? - -EFAULT : len; -break ; - } +static long hidraw_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +struct inode *inode =file_inode (file); +unsigned int minor =iminor (inode); +struct hidraw *dev; +struct hidraw_list *list = file->private_data; +void __user *user_arg = (void __user *)arg; +int ret; -if (_IOC_NR (cmd) ==_IOC_NR (HIDIOCGRAWUNIQ (0 ))) { -int len =strlen (hid->uniq) +1 ; -if (len >_IOC_SIZE (cmd)) - len =_IOC_SIZE (cmd); - ret =copy_to_user (user_arg, hid->uniq, len) ? - -EFAULT : len; -break ; - } - } +down_read (&minors_rwsem); + dev = hidraw_table[minor]; +if (!dev || !dev->exist ||hidraw_is_revoked (list)) { + ret = -ENODEV ; + goto out; + } + +if (_IOC_TYPE (cmd) !='H' ) { + ret = -EINVAL ; + goto out; + } +if (_IOC_NR (cmd) >HIDIOCTL_LAST ||_IOC_NR (cmd) ==0 ) { ret = -ENOTTY ; + goto out; } + + ret =hidraw_fixed_size_ioctl (file, dev, cmd, user_arg); +if (ret != -EAGAIN ) + goto out; + +switch (_IOC_DIR (cmd)) { +case (_IOC_READ | _IOC_WRITE): + ret =hidraw_rw_variable_size_ioctl (file, dev, cmd, user_arg); +break ; +case _IOC_READ: + ret =hidraw_ro_variable_size_ioctl (file, dev, cmd, user_arg); +break ; +default : +/* Any other IOC_DIR is wrong */ + ret = -EINVAL ; + } + out:up_read (&minors_rwsem);return ret;
include/uapi/linux/hidraw.h +2 -0
@@ -48,6 +48,8 @@ struct hidraw_devinfo {#define HIDIOCGOUTPUT (len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0C, len)#define HIDIOCREVOKE _IOW('H', 0x0D, int)/* Revoke device access */ +#define HIDIOCTL_LAST _IOC_NR(HIDIOCREVOKE) +#define HIDRAW_FIRST_MINOR 0#define HIDRAW_MAX_DEVICES 64/* number of reports to buffer */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 385/563 Revert "usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running"
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
[ Upstream commit 08fa726e66039dfa80226dfa112931f60ad4c898 ]
This reverts commit 28a76fcc4c85dd39633fb96edb643c91820133e3.
No actual HW bugs are known where Endpoint Context shows Running state but Stop Endpoint fails repeatedly with Context State Error and leaves the endpoint state unchanged. Stop Endpoint retries on Running EPs have been performed since early 2021 with no such issues reported so far.
Trying to handle this hypothetical case brings a more realistic danger:
if Stop Endpoint fails on an endpoint which hasn't yet started after a doorbell ring and enough latency occurs before this completion event is handled, the driver may time out and begin removing cancelled TDs from a running endpoint, even though one more retry would stop it reliably.
Such high latency is rare but not impossible, and removing TDs from a running endpoint can cause more damage than not giving back a cancelled URB (which wasn't happening anyway). So err on the side of caution and revert to the old policy of always retrying if the EP appears running.
[Remove stable tag as we are dealing with theoretical cases -Mathias]
--- drivers/usb/host/xhci-ring.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/usb/host/xhci-ring.c +4 -7
@@ -1262,19 +1262,16 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,* Stopped state, but it will soon change to Running. * * Assume this bug on unexpected Stop Endpoint failures. -* Keep retrying until the EP starts and stops again. +* Keep retrying until the EP starts and stops again, on +* chips where this is known to help. Wait for 100ms. */ +if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 ))) +break ; fallthrough;case EP_STATE_RUNNING :/* Race, HW handled stop ep cmd before ep was running */ xhci_dbg (xhci,"Stop ep completion ctx error, ctx_state %d\n" ,GET_EP_CTX_STATE (ep_ctx)); -/* -* Don't retry forever if we guessed wrong or a defective HC never starts -* the EP or says 'Running' but fails the command. We must give back TDs. -*/ -if (time_is_before_jiffies (ep->stop_time +msecs_to_jiffies (100 ))) -break ; command =xhci_alloc_command (xhci, false,GFP_ATOMIC );if (!command) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 386/563 RDMA/core: Resolve MAC of next-hop device without ARP support
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
[ Upstream commit 200651b9b8aadfbbec852f0e5d042d9abe75e2ab ]
Currently, if the next-hop netdevice does not support ARP resolution, the destination MAC address is silently set to zero without reporting an error. This leads to incorrect behavior and may result in packet transmission failures.
Fix this by deferring MAC resolution to the IP stack via neighbour lookup, allowing proper resolution or error reporting as appropriate.
--- drivers/infiniband/core/addr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/infiniband/core/addr.c +3 -7
@@ -454,14 +454,10 @@ static int addr_resolve_neigh(const struct dst_entry *dst, {int ret =0 ; -if (ndev_flags &IFF_LOOPBACK ) { +if (ndev_flags &IFF_LOOPBACK )memcpy (addr->dst_dev_addr, addr->src_dev_addr,MAX_ADDR_LEN ); - }else { -if (!(ndev_flags &IFF_NOARP )) { -/* If the device doesn't do ARP internally */ - ret =fetch_ha (dst, addr, dst_in, seq); - } - } +else + ret =fetch_ha (dst, addr, dst_in, seq);return ret; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 387/563 IB/sa: Fix sa_local_svc_timeout_ms read race
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Dumitrescu <[email protected]>
[ Upstream commit 1428cd764cd708d53a072a2f208d87014bfe05bc ]
When computing the delta, the sa_local_svc_timeout_ms is read without ib_nl_request_lock held. Though unlikely in practice, this can cause a race condition if multiple local service threads are managing the timeout.
--- drivers/infiniband/core/sa_query.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/sa_query.c +4 -2
@@ -1013,6 +1013,8 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,if (timeout >IB_SA_LOCAL_SVC_TIMEOUT_MAX ) timeout =IB_SA_LOCAL_SVC_TIMEOUT_MAX ; +spin_lock_irqsave (&ib_nl_request_lock, flags); + delta = timeout - sa_local_svc_timeout_ms;if (delta <0 ) abs_delta = -delta;
@@ -1020,7 +1022,6 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, abs_delta = delta;if (delta !=0 ) { -spin_lock_irqsave (&ib_nl_request_lock, flags); sa_local_svc_timeout_ms = timeout;list_for_each_entry (query, &ib_nl_request_list, list) {if (delta <0 && abs_delta > query->timeout)
@@ -1038,9 +1039,10 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,if (delay)mod_delayed_work (ib_nl_wq, &ib_nl_timed_work, (unsigned long )delay); -spin_unlock_irqrestore (&ib_nl_request_lock, flags); } +spin_unlock_irqrestore (&ib_nl_request_lock, flags); + settimeout_out:return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 388/563 Documentation: trace: historgram-design: Separate sched_waking histogram section heading and the following diagram
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bagas Sanjaya <[email protected]>
[ Upstream commit 8c716e87ea33519920811338100d6d8a7fb32456 ]
Section heading for sched_waking histogram is shown as normal paragraph instead due to codeblock marker for the following diagram being in the same line as the section underline. Separate them.
Message-ID: <[email protected]>
--- Documentation/trace/histogram-design.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/trace/histogram-design.rst +3 -1
@@ -380,7 +380,9 @@ entry, ts0, corresponding to the ts0 variable in the sched_waking trigger above. sched_waking histogram -----------------------:: +---------------------- + +.. code-block:: +------------------+ | hist_data |<-------------------------------------------------------+
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 389/563 ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <[email protected]>
[ Upstream commit 62a7b3bbb6b873fdcc85a37efbd0102d66c8a73e ]
In ipc4_ssp_dai_config_pcm_params_match() when comparing params_channels() against hw_config->tdm_slots the comparison should be a <= not a ==.
The number of TDM slots must be enough for the number of required channels. But it can be greater. There are various reason why a I2S/TDM link has more TDM slots than a particular audio stream needs.
The original comparison would fail on systems that had more TDM slots.
--- sound/soc/sof/ipc4-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/ipc4-pcm.c +2 -2
@@ -639,14 +639,14 @@ static int ipc4_ssp_dai_config_pcm_params_match(struct snd_sof_dev *sdev,if (params_rate (params) ==le32_to_cpu (hw_config->fsync_rate) &¶ms_width (params) ==le32_to_cpu (hw_config->tdm_slot_width) && -params_channels (params) ==le32_to_cpu (hw_config->tdm_slots)) { +params_channels (params) <=le32_to_cpu (hw_config->tdm_slots)) { current_config =le32_to_cpu (hw_config->id); partial_match = false;/* best match found */ break ; }else if (current_config <0 &¶ms_rate (params) ==le32_to_cpu (hw_config->fsync_rate) && -params_channels (params) ==le32_to_cpu (hw_config->tdm_slots)) { +params_channels (params) <=le32_to_cpu (hw_config->tdm_slots)) { current_config =le32_to_cpu (hw_config->id); partial_match = true;/* keep looking for better match */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 390/563 wifi: ath12k: initialize eirp_power before use
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit bba2f9faf41ee9607c78fcd669527b7654543cfe ]
Currently, at the end of ath12k_mac_fill_reg_tpc_info(), the reg_tpc_info struct is populated, including the following:reg_tpc_info->is_psd_power = is_psd_power; reg_tpc_info->eirp_power = eirp_power;
Kernel test robot complains on uninitialized symbol:drivers/net/wireless/ath/ath12k/mac.c:10069 ath12k_mac_fill_reg_tpc_info() error: uninitialized symbol 'eirp_power'
This is because there are some code paths that never set eirp_power, so the assignment of reg_tpc_info->eirp_power can come from an uninitialized variable. Functionally this is OK since the eirp_power only has meaning when is_psd_power is true, and all code paths which set is_psd_power to true also set eirp_power. However, to keep the robot happy, always initialize eirp_power before use.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +2 -2
@@ -11240,8 +11240,8 @@ void ath12k_mac_fill_reg_tpc_info(struct ath12k *ar,struct ieee80211_channel *chan, *temp_chan;u8 pwr_lvl_idx, num_pwr_levels, pwr_reduction;bool is_psd_power = false, is_tpe_present = false; -s8 max_tx_power[ATH12K_NUM_PWR_LEVELS ], - psd_power, tx_power, eirp_power; +s8 max_tx_power[ATH12K_NUM_PWR_LEVELS ], psd_power, tx_power; +s8 eirp_power =0 ;struct ath12k_vif *ahvif = arvif->ahvif;u16 start_freq, center_freq;u8 reg_6ghz_power_mode;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 391/563 wifi: ath12k: fix overflow warning on num_pwr_levels
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit ea2b0af4c9e3f7187b5be4b7fc1511ea239046c0 ]
In ath12k_mac_parse_tx_pwr_env(), for the non-PSD case num_pwr_levels is limited by ATH12K_NUM_PWR_LEVELS which is 16:
if (tpc_info->num_pwr_levels > ATH12K_NUM_PWR_LEVELS) tpc_info->num_pwr_levels = ATH12K_NUM_PWR_LEVELS;
Then it is used to iterate entries in local_non_psd->power[] and reg_non_psd->power[]:
for (i = 0; i < tpc_info->num_pwr_levels; i++) {
tpc_info->tpe[i] = min(local_non_psd->power[i],
reg_non_psd->power[i]) / 2;Since the two array are of size 5, Smatch warns:
drivers/net/wireless/ath/ath12k/mac.c:9812 ath12k_mac_parse_tx_pwr_env() error: buffer overflow 'local_non_psd->power' 5 <= 15 drivers/net/wireless/ath/ath12k/mac.c:9812 ath12k_mac_parse_tx_pwr_env() error: buffer overflow 'reg_non_psd->power' 5 <= 15
This is a false positive as there is already implicit limitation:
tpc_info->num_pwr_levels = max(local_non_psd->count, reg_non_psd->count);
meaning it won't exceed 5.
However, to make robot happy, add explicit limit there.
Also add the same to the PSD case, although no warning due to ATH12K_NUM_PWR_LEVELS equals IEEE80211_TPE_PSD_ENTRIES_320MHZ.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/mac.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +8 -4
@@ -11447,8 +11447,10 @@ static void ath12k_mac_parse_tx_pwr_env(struct ath12k *ar, tpc_info->num_pwr_levels =max (local_psd->count, reg_psd->count); -if (tpc_info->num_pwr_levels >ATH12K_NUM_PWR_LEVELS ) - tpc_info->num_pwr_levels =ATH12K_NUM_PWR_LEVELS ; + tpc_info->num_pwr_levels = +min3 (tpc_info->num_pwr_levels, +IEEE80211_TPE_PSD_ENTRIES_320MHZ , +ATH12K_NUM_PWR_LEVELS );for (i =0 ; i < tpc_info->num_pwr_levels; i++) { tpc_info->tpe[i] = min(local_psd->power[i],
@@ -11463,8 +11465,10 @@ static void ath12k_mac_parse_tx_pwr_env(struct ath12k *ar, tpc_info->num_pwr_levels =max (local_non_psd->count, reg_non_psd->count); -if (tpc_info->num_pwr_levels >ATH12K_NUM_PWR_LEVELS ) - tpc_info->num_pwr_levels =ATH12K_NUM_PWR_LEVELS ; + tpc_info->num_pwr_levels = +min3 (tpc_info->num_pwr_levels, +IEEE80211_TPE_EIRP_ENTRIES_320MHZ , +ATH12K_NUM_PWR_LEVELS );for (i =0 ; i < tpc_info->num_pwr_levels; i++) { tpc_info->tpe[i] = min(local_non_psd->power[i],
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 392/563 wifi: ath12k: fix signal in radiotap for WCN7850
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <[email protected]>
[ Upstream commit cf412ae7b7124e2b3bfe472616ec24b117b6008a ]
Currently host will add ATH12K_DEFAULT_NOISE_FLOOR to rssi_comb to convert RSSI from dB to dBm.
For WCN7850, this conversion is unnecessary because the RSSI value is already reported in dBm units.
No longer convert for those firmware that already support dBM conversion.
This patch won't affect QCN chips.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/dp_mon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp_mon.c +5 -1
@@ -2154,8 +2154,12 @@ static void ath12k_dp_mon_update_radiotap(struct ath12k *ar,spin_unlock_bh (&ar->data_lock); rxs->flag |=RX_FLAG_MACTIME_START ; - rxs->signal = ppduinfo->rssi_comb + noise_floor; rxs->nss = ppduinfo->nss +1 ; +if (test_bit (WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT , + ar->ab->wmi_ab.svc_map)) + rxs->signal = ppduinfo->rssi_comb; +else + rxs->signal = ppduinfo->rssi_comb + noise_floor;if (ppduinfo->userstats[ppduinfo->userid].ampdu_present) { rxs->flag |=RX_FLAG_AMPDU_DETAILS ;
Signature · 1 line
2.51.0