soc: aspeed-lpc-ctrl: Fail probe of lpc-ctrl if reserved memory is not aligned
Subsystems (25)
Sasha Levin
maintainerPATCH 1/217 soc: aspeed-lpc-ctrl: Fail probe of lpc-ctrl if reserved memory is not aligned
From: Andrew Jeffery <[email protected]>
[ Upstream commit 6bf4ddbe2b4805f0628922446a7e85e34013cd10 ]
Alignment is a hardware constraint of the LPC2AHB bridge, and misaligned reserved memory will present as corrupted data.
--- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/soc/aspeed/aspeed-lpc-ctrl.c +13 -0
@@ -4,6 +4,7 @@*/ #include <linux/clk.h> +#include <linux/log2.h> #include <linux/mfd/syscon.h> #include <linux/miscdevice.h> #include <linux/mm.h>
@@ -241,6 +242,18 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) lpc_ctrl->mem_size =resource_size (&resm); lpc_ctrl->mem_base = resm.start; + +if (!is_power_of_2 (lpc_ctrl->mem_size)) { +dev_err (dev,"Reserved memory size must be a power of 2, got %u\n" , + (unsigned int )lpc_ctrl->mem_size); +return -EINVAL ; + } + +if (!IS_ALIGNED (lpc_ctrl->mem_base, lpc_ctrl->mem_size)) { +dev_err (dev,"Reserved memory must be naturally aligned for size %u\n" , + (unsigned int )lpc_ctrl->mem_size); +return -EINVAL ; + } } lpc_ctrl->regmap = syscon_node_to_regmap(
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 2/217 drm/ingenic: Reset pixclock rate when parent clock rate changes
From: Paul Cercueil <[email protected]>
[ Upstream commit 33700f6f7d9f6b4e1e6df933ef7fd388889c662c ]
Old Ingenic SoCs can overclock very well, up to +50% of their nominal clock rate, whithout requiring overvolting or anything like that, just by changing the rate of the main PLL. Unfortunately, all clocks on the system are derived from that PLL, and when the PLL rate is updated, so is our pixel clock.
To counter that issue, we make sure that the panel is in VBLANK before the rate change happens, and we will then re-set the pixel clock rate afterwards, once the PLL has been changed, to be as close as possible to the pixel rate requested by the encoder.
v2: Add comment about mutex usage
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 61 ++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +60 -1
@@ -10,6 +10,7 @@#include <linux/clk.h> #include <linux/dma-mapping.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/regmap.h>
@@ -68,6 +69,21 @@ struct ingenic_drm {bool panel_is_sharp;bool no_vblank; + +/* +* clk_mutex is used to synchronize the pixel clock rate update with +* the VBLANK. When the pixel clock's parent clock needs to be updated, +* clock_nb's notifier function will lock the mutex, then wait until the +* next VBLANK. At that point, the parent clock's rate can be updated, +* and the mutex is then unlocked. If an atomic commit happens in the +* meantime, it will lock on the mutex, effectively waiting until the +* clock update process finishes. Finally, the pixel clock's rate will +* be recomputed when the mutex has been released, in the pending atomic +* commit, or a future one. +*/ +struct mutex clk_mutex; +bool update_clk_rate; +struct notifier_block clock_nb; };static const u32 ingenic_drm_primary_formats[] = {
@@ -111,6 +127,29 @@ static inline struct ingenic_drm *drm_crtc_get_priv(struct drm_crtc *crtc) return container_of(crtc, struct ingenic_drm, crtc); } +static inline struct ingenic_drm *drm_nb_get_priv (struct notifier_block *nb) +{ + return container_of(nb, struct ingenic_drm, clock_nb); +} + +static int ingenic_drm_update_pixclk (struct notifier_block *nb, +unsigned long action, +void *data) +{ +struct ingenic_drm *priv =drm_nb_get_priv (nb); + +switch (action) { +case PRE_RATE_CHANGE : +mutex_lock (&priv->clk_mutex); + priv->update_clk_rate = true; +drm_crtc_wait_one_vblank (&priv->crtc); +return NOTIFY_OK ; +default : +mutex_unlock (&priv->clk_mutex); +return NOTIFY_OK ; + } +} +static void ingenic_drm_crtc_atomic_enable (struct drm_crtc *crtc,struct drm_crtc_state *state) {
@@ -276,8 +315,14 @@ static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,if (drm_atomic_crtc_needs_modeset (state)) {ingenic_drm_crtc_update_timings (priv, &state->mode); + priv->update_clk_rate = true; + } +if (priv->update_clk_rate) { +mutex_lock (&priv->clk_mutex);clk_set_rate (priv->pix_clk, state->adjusted_mode.clock *1000 ); + priv->update_clk_rate = false; +mutex_unlock (&priv->clk_mutex); }if (event) {
@@ -934,16 +979,28 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)if (soc_info->has_osd)regmap_write (priv->map,JZ_REG_LCD_OSDC ,JZ_LCD_OSDC_OSDEN ); +mutex_init (&priv->clk_mutex); + priv->clock_nb.notifier_call = ingenic_drm_update_pixclk; + + parent_clk =clk_get_parent (priv->pix_clk); + ret =clk_notifier_register (parent_clk, &priv->clock_nb); +if (ret) { +dev_err (dev,"Unable to register clock notifier\n" ); + goto err_devclk_disable; + } + ret =drm_dev_register (drm,0 );if (ret) {dev_err (dev,"Failed to register DRM driver\n" ); - goto err_devclk_disable; + goto err_clk_notifier_unregister; }drm_fbdev_generic_setup (drm,32 );return 0 ; +err_clk_notifier_unregister: +clk_notifier_unregister (parent_clk, &priv->clock_nb); err_devclk_disable:if (priv->lcd_clk)clk_disable_unprepare (priv->lcd_clk);
@@ -965,7 +1022,9 @@ static int compare_of(struct device *dev, void *data)static void ingenic_drm_unbind (struct device *dev) {struct ingenic_drm *priv =dev_get_drvdata (dev); +struct clk *parent_clk =clk_get_parent (priv->pix_clk); +clk_notifier_unregister (parent_clk, &priv->clock_nb);if (priv->lcd_clk)clk_disable_unprepare (priv->lcd_clk);clk_disable_unprepare (priv->pix_clk);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 3/217 drm/bridge: ti-sn65dsi86: Add retries for link training
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 137655d1ed353806b8591855b569efd090d84135 ]
On some panels hooked up to the ti-sn65dsi86 bridge chip we found that link training was failing. Specifically, we'd see:
ti_sn65dsi86 2-002d: [drm:ti_sn_bridge_enable] *ERROR* Link training failed, link is off (-5)
The panel was hooked up to a logic analyzer and it was found that, as part of link training, the bridge chip was writing a 0x1 to DPCD address 00600h and the panel responded NACK. As can be seen in header files, the write of 0x1 to DPCD address 0x600h means we were trying to write the value DP_SET_POWER_D0 to the register DP_SET_POWER. The panel vendor says that a NACK in this case is not unexpected and means "not ready, try again".
In testing, we found that this panel would respond with a NACK in about 1/25 times. Adding the retry logic worked fine and the most number of tries needed was 3. Just to be safe, we'll add 10 tries here and we'll add a little blurb to the logs if we ever need more than 5.
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 40 +++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +29 -11
@@ -106,6 +106,8 @@#define SN_NUM_GPIOS 4#define SN_GPIO_PHYSICAL_OFFSET 1 +#define SN_LINK_TRAINING_TRIES 10 +/** * struct ti_sn_bridge - Platform data for ti-sn65dsi86 driver. * @dev: Pointer to our device.
@@ -673,6 +675,7 @@ static int ti_sn_link_training(struct ti_sn_bridge *pdata, int dp_rate_idx, {unsigned int val;int ret; +int i;/* set dp clk frequency value */ regmap_update_bits(pdata->regmap, SN_DATARATE_CONFIG_REG,
@@ -689,19 +692,34 @@ static int ti_sn_link_training(struct ti_sn_bridge *pdata, int dp_rate_idx, goto exit; } -/* Semi auto link training mode */ -regmap_write (pdata->regmap,SN_ML_TX_MODE_REG ,0x0A ); - ret =regmap_read_poll_timeout (pdata->regmap,SN_ML_TX_MODE_REG , val, - val ==ML_TX_MAIN_LINK_OFF || - val ==ML_TX_NORMAL_MODE ,1000 , -500 *1000 ); -if (ret) { - *last_err_str ="Training complete polling failed" ; - }else if (val ==ML_TX_MAIN_LINK_OFF ) { - *last_err_str ="Link training failed, link is off" ; - ret = -EIO ; +/* +* We'll try to link train several times. As part of link training +* the bridge chip will write DP_SET_POWER_D0 to DP_SET_POWER. If +* the panel isn't ready quite it might respond NAK here which means +* we need to try again. +*/ +for (i =0 ; i <SN_LINK_TRAINING_TRIES ; i++) { +/* Semi auto link training mode */ +regmap_write (pdata->regmap,SN_ML_TX_MODE_REG ,0x0A ); + ret =regmap_read_poll_timeout (pdata->regmap,SN_ML_TX_MODE_REG , val, + val ==ML_TX_MAIN_LINK_OFF || + val ==ML_TX_NORMAL_MODE ,1000 , +500 *1000 ); +if (ret) { + *last_err_str ="Training complete polling failed" ; + }else if (val ==ML_TX_MAIN_LINK_OFF ) { + *last_err_str ="Link training failed, link is off" ; + ret = -EIO ; +continue ; + } + +break ; } +/* If we saw quite a few retries, add a note about it */ +if (!ret && i >SN_LINK_TRAINING_TRIES /2 ) +DRM_DEV_INFO (pdata->dev,"Link training needed %d retries\n" , i); + exit:/* Disable the PLL if we failed */ if (ret)
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 4/217 drm/amd/display: setup system context in dm_init
In reply to Sasha LevinFrom: Yifan Zhang <[email protected]>
[ Upstream commit c0fb85ae02b62bded71110f44e8b0fe34f11260f ]
[why]
display S/G mode fails in Renoir
[how]
Setup system context in dm init.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +61 -0
@@ -921,12 +921,67 @@ static void amdgpu_check_debugfs_connector_property_change(struct amdgpu_device } } +static void mmhub_read_system_context (struct amdgpu_device *adev,struct dc_phy_addr_space_config *pa_config) +{ +uint64_t pt_base; +uint32_t logical_addr_low; +uint32_t logical_addr_high; +uint32_t agp_base, agp_bot, agp_top; +PHYSICAL_ADDRESS_LOC page_table_start, page_table_end, page_table_base; + + logical_addr_low =min (adev->gmc.fb_start, adev->gmc.agp_start) >>18 ; + pt_base =amdgpu_gmc_pd_addr (adev->gart.bo); + +if (adev->apu_flags &AMD_APU_IS_RAVEN2 ) +/* +* Raven2 has a HW issue that it is unable to use the vram which +* is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the +* workaround that increase system aperture high address (add 1) +* to get rid of the VM fault and hardware hang. +*/ + logical_addr_high =max ((adev->gmc.fb_end >>18 ) +0x1 , adev->gmc.agp_end >>18 ); +else + logical_addr_high =max (adev->gmc.fb_end, adev->gmc.agp_end) >>18 ; + + agp_base =0 ; + agp_bot = adev->gmc.agp_start >>24 ; + agp_top = adev->gmc.agp_end >>24 ; + + + page_table_start.high_part = (u32)(adev->gmc.gart_start >>44 ) &0xF ; + page_table_start.low_part = (u32)(adev->gmc.gart_start >>12 ); + page_table_end.high_part = (u32)(adev->gmc.gart_end >>44 ) &0xF ; + page_table_end.low_part = (u32)(adev->gmc.gart_end >>12 ); + page_table_base.high_part =upper_32_bits (pt_base) &0xF ; + page_table_base.low_part =lower_32_bits (pt_base); + + pa_config->system_aperture.start_addr = (uint64_t )logical_addr_low <<18 ; + pa_config->system_aperture.end_addr = (uint64_t )logical_addr_high <<18 ; + + pa_config->system_aperture.agp_base = (uint64_t )agp_base <<24 ; + pa_config->system_aperture.agp_bot = (uint64_t )agp_bot <<24 ; + pa_config->system_aperture.agp_top = (uint64_t )agp_top <<24 ; + + pa_config->system_aperture.fb_base = adev->gmc.fb_start; + pa_config->system_aperture.fb_offset = adev->gmc.aper_base; + pa_config->system_aperture.fb_top = adev->gmc.fb_end; + + pa_config->gart_config.page_table_start_addr = page_table_start.quad_part <<12 ; + pa_config->gart_config.page_table_end_addr = page_table_end.quad_part <<12 ; + pa_config->gart_config.page_table_base_addr = page_table_base.quad_part; + + pa_config->is_hvm_enabled =0 ; + +} + +static int amdgpu_dm_init (struct amdgpu_device *adev) {struct dc_init_data init_data;#ifdef CONFIG_DRM_AMD_DC_HDCP struct dc_callback_init init_params;#endif +struct dc_phy_addr_space_config pa_config;int r; adev->dm.ddev =adev_to_drm (adev);
@@ -1030,6 +1085,11 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)dc_hardware_init (adev->dm.dc); +mmhub_read_system_context (adev, &pa_config); + +// Call the DC init_memory func +dc_setup_system_context (adev->dm.dc, &pa_config); + adev->dm.freesync_module =mod_freesync_create (adev->dm.dc);if (!adev->dm.freesync_module) { DRM_ERROR(
@@ -1073,6 +1133,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) goto error; } +DRM_DEBUG_DRIVER ("KMS initialized.\n" );return 0 ;
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 5/217 drm/amd/display: Fix the display corruption issue on Navi10
In reply to Sasha LevinFrom: Yifan Zhang <[email protected]>
[ Upstream commit 0b08c54bb7a37047a3a006e36c2270ebc62fef7d ]
[Why]
Screen corruption on Navi10 card
[How]
Set system context in DCN only on Renoir
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -3
@@ -1085,10 +1085,14 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)dc_hardware_init (adev->dm.dc); -mmhub_read_system_context (adev, &pa_config); +#if defined(CONFIG_DRM_AMD_DC_DCN ) +if (adev->asic_type ==CHIP_RENOIR ) { +mmhub_read_system_context (adev, &pa_config); -// Call the DC init_memory func -dc_setup_system_context (adev->dm.dc, &pa_config); +// Call the DC init_memory func +dc_setup_system_context (adev->dm.dc, &pa_config); + } +#endif adev->dm.freesync_module =mod_freesync_create (adev->dm.dc);if (!adev->dm.freesync_module) {
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 6/217 locks: Fix UBSAN undefined behaviour in flock64_to_posix_lock
In reply to Sasha LevinFrom: Luo Meng <[email protected]>
[ Upstream commit 16238415eb9886328a89fe7a3cb0b88c7335fe16 ]
When the sum of fl->fl_start and l->l_len overflows, UBSAN shows the following warning:
UBSAN: Undefined behaviour in fs/locks.c:482:29 signed integer overflow: 2 + 9223372036854775806 cannot be represented in type 'long long int' Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xe4/0x14e lib/dump_stack.c:118 ubsan_epilogue+0xe/0x81 lib/ubsan.c:161 handle_overflow+0x193/0x1e2 lib/ubsan.c:192 flock64_to_posix_lock fs/locks.c:482 [inline] flock_to_posix_lock+0x595/0x690 fs/locks.c:515 fcntl_setlk+0xf3/0xa90 fs/locks.c:2262 do_fcntl+0x456/0xf60 fs/fcntl.c:387 __do_sys_fcntl fs/fcntl.c:483 [inline] __se_sys_fcntl fs/fcntl.c:468 [inline] __x64_sys_fcntl+0x12d/0x180 fs/fcntl.c:468 do_syscall_64+0xc8/0x5a0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Fix it by parenthesizing 'l->l_len - 1'.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -542,7 +542,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,if (l->l_len >0 ) {if (l->l_len -1 >OFFSET_MAX - fl->fl_start)return -EOVERFLOW ; - fl->fl_end = fl->fl_start + l->l_len -1 ; + fl->fl_end = fl->fl_start + (l->l_len -1 ); }else if (l->l_len <0 ) {if (fl->fl_start + l->l_len <0 )
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 7/217 platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360
In reply to Sasha LevinFrom: Samuel Čavoj <[email protected]>
[ Upstream commit ea856ec266c1e6aecd2b107032d5b5d661f0686d ]
The UX360CA has a WMI device id 0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0).
Add a quirk (quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out the SW_TABLET_MODE state, as opposed to the quirk_asus_use_kbd_dock_devid.
Additionally, the device needs to be queried on resume and restore because the firmware does not generate an event if the laptop is put to sleep while in tablet mode, flipped to normal mode, and later awoken.
It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly.
The reason for using an allowlist via the quirk mechanism is that the new WMI device (0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on.
--- drivers/platform/x86/asus-nb-wmi.c | 15 ++++++++ drivers/platform/x86/asus-wmi.c | 40 ++++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 1 + 4 files changed, 57 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +15 -0
@@ -119,6 +119,11 @@ static struct quirk_entry quirk_asus_use_kbd_dock_devid = { .use_kbd_dock_devid = true, }; +static struct quirk_entry quirk_asus_use_lid_flip_devid = { + .wmi_backlight_set_devstate = true, + .use_lid_flip_devid = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);
@@ -520,6 +525,16 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_kbd_dock_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ZenBook Flip UX360", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + /* Match UX360* */ + DMI_MATCH(DMI_PRODUCT_NAME, "UX360"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };
drivers/platform/x86/asus-wmi.c +40 -0
@@ -63,6 +63,7 @@ MODULE_LICENSE("GPL");#define NOTIFY_KBD_BRTTOGGLE 0xc7#define NOTIFY_KBD_FBM 0x99#define NOTIFY_KBD_TTP 0xae +#define NOTIFY_LID_FLIP 0xfa#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
@@ -375,6 +376,20 @@ static int asus_wmi_input_init(struct asus_wmi *asus) } } +if (asus->driver->quirks->use_lid_flip_devid) { + result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); +if (result <0 ) + asus->driver->quirks->use_lid_flip_devid =0 ; +if (result >=0 ) { +input_set_capability (asus->inputdev,EV_SW ,SW_TABLET_MODE ); +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); + }else if (result == -ENODEV ) { +pr_err ("This device has lid_flip quirk but got ENODEV checking it. This is a bug." ); + }else { +pr_err ("Error checking for lid-flip: %d\n" , result); + } + } + err =input_register_device (asus->inputdev);if (err) goto err_free_dev;
@@ -394,6 +409,18 @@ static void asus_wmi_input_exit(struct asus_wmi *asus) asus->inputdev =NULL ; } +/* Tablet mode ****************************************************************/ + +static void lid_flip_tablet_mode_get_state (struct asus_wmi *asus) +{ +int result =asus_wmi_get_devstate_simple (asus,ASUS_WMI_DEVID_LID_FLIP ); + +if (result >=0 ) { +input_report_switch (asus->inputdev,SW_TABLET_MODE , result); +input_sync (asus->inputdev); + } +} +/* Battery ********************************************************************/ /* The battery maximum charging percentage */
@@ -2128,6 +2155,11 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)return ; } +if (asus->driver->quirks->use_lid_flip_devid && code ==NOTIFY_LID_FLIP ) { +lid_flip_tablet_mode_get_state (asus); +return ; + } +if (asus->fan_boost_mode_available && code ==NOTIFY_KBD_FBM ) {fan_boost_mode_switch_next (asus);return ;
@@ -2719,6 +2751,10 @@ static int asus_hotk_resume(struct device *device)if (asus_wmi_has_fnlock_key (asus))asus_wmi_fnlock_update (asus); + +if (asus->driver->quirks->use_lid_flip_devid) +lid_flip_tablet_mode_get_state (asus); +return 0 ; }
@@ -2757,6 +2793,10 @@ static int asus_hotk_restore(struct device *device)if (asus_wmi_has_fnlock_key (asus))asus_wmi_fnlock_update (asus); + +if (asus->driver->quirks->use_lid_flip_devid) +lid_flip_tablet_mode_get_state (asus); +return 0 ; }
drivers/platform/x86/asus-wmi.h +1 -0
@@ -34,6 +34,7 @@ struct quirk_entry {bool wmi_backlight_set_devstate;bool wmi_force_als_set;bool use_kbd_dock_devid; +bool use_lid_flip_devid;int wapf;/* * For machines with AMD graphic chips, it will send out WMI event
include/linux/platform_data/x86/asus-wmi.h +1 -0
@@ -62,6 +62,7 @@/* Misc */ #define ASUS_WMI_DEVID_CAMERA 0x00060013 +#define ASUS_WMI_DEVID_LID_FLIP 0x00060062/* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 8/217 tomoyo: fix clang pointer arithmetic warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d9594e0409651a237903a13c9718df889f43d43b ]
clang warns about additions on NULL pointers being undefined in C:
security/tomoyo/securityfs_if.c:226:59: warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
securityfs_create_file(name, mode, parent, ((u8 *) NULL) + key,
Change the code to instead use a cast through uintptr_t to avoid the warning.
--- security/tomoyo/securityfs_if.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
security/tomoyo/securityfs_if.c +3 -3
@@ -131,8 +131,8 @@ static const struct file_operations tomoyo_self_operations = {*/ static int tomoyo_open (struct inode *inode,struct file *file) { -const int key = ((u8 *)file_inode (file)->i_private) - - ((u8 *)NULL ); +const u8 key = (uintptr_t )file_inode (file)->i_private; +return tomoyo_open_control (key, file); }
@@ -223,7 +223,7 @@ static const struct file_operations tomoyo_operations = {static void __init tomoyo_create_entry (const char *name,const umode_t mode,struct dentry *parent,const u8 key) { -securityfs_create_file (name, mode, parent, ((u8 *)NULL ) + key, +securityfs_create_file (name, mode, parent, (void *) (uintptr_t ) key, &tomoyo_operations); }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 9/217 HID: hid-input: occasionally report stylus battery even if not changed
In reply to Sasha LevinFrom: "[email protected]" <[email protected]>
[ Upstream commit c6838eeef2fbc7e3e1f83759aa016ae6b70c643e ]
There are styluses that only report their battery status when they are touching the touchscreen; additionally we currently suppress battery reports if capacity has not changed. To help userspace recognize how long ago the device reported battery status, let's send the change event through if either capacity has changed, or at least 30 seconds have passed since last report we've let through.
--- drivers/hid/hid-input.c | 5 ++++- include/linux/hid.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/hid/hid-input.c +4 -1
@@ -537,9 +537,12 @@ static void hidinput_update_battery(struct hid_device *dev, int value) capacity =hidinput_scale_battery_capacity (dev, value);if (dev->battery_status !=HID_BATTERY_REPORTED || - capacity != dev->battery_capacity) { + capacity != dev->battery_capacity || +ktime_after (ktime_get_coarse (), dev->battery_ratelimit_time)) { dev->battery_capacity = capacity; dev->battery_status =HID_BATTERY_REPORTED ; + dev->battery_ratelimit_time = +ktime_add_ms (ktime_get_coarse (),30 *1000 );power_supply_changed (dev->battery); } }
include/linux/hid.h +1 -0
@@ -585,6 +585,7 @@ struct hid_device { /* device report descriptor */__s32 battery_report_id;enum hid_battery_status battery_status;bool battery_avoid_query; +ktime_t battery_ratelimit_time;#endif unsigned long status;/* see STAT flags above */
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 10/217 drm/amdgpu: change to save bad pages in UMC error interrupt callback
In reply to Sasha LevinFrom: Dennis Li <[email protected]>
[ Upstream commit 22503d803dab174b7f038fc9886c225ef30ee95c ]
Instead of saving bad pages in amdgpu_ras_reset_gpu, it will reduce the unnecessary calling of amdgpu_ras_save_bad_pages.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +---- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 7 ++++--- 3 files changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -4
@@ -1665,7 +1665,7 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev,* write error record array to eeprom, the function should be * protected by recovery_lock */ -static int amdgpu_ras_save_bad_pages (struct amdgpu_device *adev) +int amdgpu_ras_save_bad_pages (struct amdgpu_device *adev) {struct amdgpu_ras *con =amdgpu_ras_get_context (adev);struct ras_err_handler_data *data;
@@ -1838,9 +1838,6 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) data->last_reserved = i +1 ; bo =NULL ; } - -/* continue to save bad pages to eeprom even reesrve_vram fails */ - ret =amdgpu_ras_save_bad_pages (adev); out:mutex_unlock (&con->recovery_lock);return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
@@ -506,6 +506,7 @@ bool amdgpu_ras_check_err_threshold(struct amdgpu_device *adev);int amdgpu_ras_add_bad_pages (struct amdgpu_device *adev,struct eeprom_table_record *bps,int pages); +int amdgpu_ras_save_bad_pages (struct amdgpu_device *adev);int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev);static inline int amdgpu_ras_reset_gpu (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +4 -3
@@ -126,10 +126,11 @@ int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, err_data->ue_count);if ((amdgpu_bad_page_threshold !=0 ) && - err_data->err_addr_cnt && + err_data->err_addr_cnt) {amdgpu_ras_add_bad_pages (adev, err_data->err_addr, - err_data->err_addr_cnt)) -dev_warn (adev->dev,"Failed to add ras bad page!\n" ); + err_data->err_addr_cnt); +amdgpu_ras_save_bad_pages (adev); + }amdgpu_ras_reset_gpu (adev); }
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 11/217 crypto: omap-aes - fix the reference count leak of omap device
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit 383e8a823014532ffd81c787ef9009f1c2bd3b79 ]
pm_runtime_get_sync() will increment pm usage counter even when it returns an error code. We should call put operation in error handling paths of omap_aes_hw_init.
--- drivers/crypto/omap-aes.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/omap-aes.c +1 -0
@@ -105,6 +105,7 @@ static int omap_aes_hw_init(struct omap_aes_dev *dd) err =pm_runtime_get_sync (dd->dev);if (err <0 ) { +pm_runtime_put_noidle (dd->dev);dev_err (dd->dev,"failed to get sync: %d\n" , err);return err; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 12/217 drm/amd/display: Do not silently accept DCC for multiplane formats.
In reply to Sasha LevinFrom: Bas Nieuwenhuizen <[email protected]>
[ Upstream commit b35ce7b364ec80b54f48a8fdf9fb74667774d2da ]
Silently accepting it could result in corruption.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -3825,7 +3825,7 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev,return 0 ;if (format >=SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ) -return 0 ; +return -EINVAL ;if (!dc->cap_funcs.get_dcc_compression_cap)return -EINVAL ;
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 13/217 ASoC: intel: sof_rt5682: Add quirk for Dooly
In reply to Sasha LevinFrom: Brent Lu <[email protected]>
[ Upstream commit bdd088ce5bfd32b95ab1bd90b49405e7c1f1fff5 ]
This DMI product family string of this board is "Google_Hatch" so the DMI quirk will take place. However, this board is using rt1015 speaker amp instead of max98357a specified in the quirk. Therefore, we need an new DMI quirk for this board.
--- sound/soc/intel/boards/sof_rt5682.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
sound/soc/intel/boards/sof_rt5682.c +18 -0
@@ -99,6 +99,24 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {SOF_RT5682_MCLK_24MHZ | SOF_RT5682_SSP_CODEC(1)), }, + { +/* +* Dooly is hatch family but using rt1015 amp so it +* requires a quirk before "Google_Hatch". +*/ + .callback = sof_rt5682_quirk_cb, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"HP" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"), + }, + .driver_data = (void *)(SOF_RT5682_MCLK_EN | +SOF_RT5682_MCLK_24MHZ | +SOF_RT5682_SSP_CODEC (0 ) | +SOF_SPEAKER_AMP_PRESENT | +SOF_RT1015_SPEAKER_AMP_PRESENT | +SOF_RT1015_SPEAKER_AMP_100FS | + SOF_RT5682_SSP_AMP(1)), + }, { .callback = sof_rt5682_quirk_cb, .matches = {
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 14/217 bpf: Use separate lockdep class for each hashtab
In reply to Sasha LevinFrom: Song Liu <[email protected]>
[ Upstream commit c50eb518e262fa06bd334e6eec172eaf5d7a5bd9 ]
If a hashtab is accessed in both NMI and non-NMI contexts, it may cause deadlock in bucket->lock. LOCKDEP NMI warning highlighted this issue:
./test_progs -t stacktrace
[ 74.828970]
[ 74.828971] ================================
[ 74.828972] WARNING: inconsistent lock state
[ 74.828973] 5.9.0-rc8+ #275 Not tainted
[ 74.828974] --------------------------------
[ 74.828975] inconsistent {INITIAL USE} -> {IN-NMI} usage.
[ 74.828976] taskset/1174 [HC2[2]:SC0[0]:HE0:SE1] takes:
[ 74.828977] ffffc90000ee96b0 (&htab->buckets[i].raw_lock){....}-{2:2}, at: htab_map_update_elem+0x271/0x5a0
[ 74.828981] {INITIAL USE} state was registered at:
[ 74.828982] lock_acquire+0x137/0x510
[ 74.828983] _raw_spin_lock_irqsave+0x43/0x90
[ 74.828984] htab_map_update_elem+0x271/0x5a0
[ 74.828984] 0xffffffffa0040b34
[ 74.828985] trace_call_bpf+0x159/0x310
[ 74.828986] perf_trace_run_bpf_submit+0x5f/0xd0
[ 74.828987] perf_trace_urandom_read+0x1be/0x220
[ 74.828988] urandom_read_nowarn.isra.0+0x26f/0x380
[ 74.828989] vfs_read+0xf8/0x280
[ 74.828989] ksys_read+0xc9/0x160
[ 74.828990] do_syscall_64+0x33/0x40
[ 74.828991] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 74.828992] irq event stamp: 1766
[ 74.828993] hardirqs last enabled at (1765): [<ffffffff82800ace>] asm_exc_page_fault+0x1e/0x30
[ 74.828994] hardirqs last disabled at (1766): [<ffffffff8267df87>] irqentry_enter+0x37/0x60
[ 74.828995] softirqs last enabled at (856): [<ffffffff81043e7c>] fpu__clear+0xac/0x120
[ 74.828996] softirqs last disabled at (854): [<ffffffff81043df0>] fpu__clear+0x20/0x120
[ 74.828997]
[ 74.828998] other info that might help us debug this:
[ 74.828999] Possible unsafe locking scenario:
[ 74.828999]
[ 74.829000] CPU0
[ 74.829001] ----
[ 74.829001] lock(&htab->buckets[i].raw_lock);
[ 74.829003] <Interrupt>
[ 74.829004] lock(&htab->buckets[i].raw_lock);
[ 74.829006]
[ 74.829006] *** DEADLOCK ***
[ 74.829007]
[ 74.829008] 1 lock held by taskset/1174:
[ 74.829008] #0: ffff8883ec3fd020 (&cpuctx_lock){-...}-{2:2}, at: perf_event_task_tick+0x101/0x650
[ 74.829012]
[ 74.829013] stack backtrace:
[ 74.829014] CPU: 0 PID: 1174 Comm: taskset Not tainted 5.9.0-rc8+ #275
[ 74.829015] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
[ 74.829016] Call Trace:
[ 74.829016] <NMI>
[ 74.829017] dump_stack+0x9a/0xd0
[ 74.829018] lock_acquire+0x461/0x510
[ 74.829019] ? lock_release+0x6b0/0x6b0
[ 74.829020] ? stack_map_get_build_id_offset+0x45e/0x800
[ 74.829021] ? htab_map_update_elem+0x271/0x5a0
[ 74.829022] ? rcu_read_lock_held_common+0x1a/0x50
[ 74.829022] ? rcu_read_lock_held+0x5f/0xb0
[ 74.829023] _raw_spin_lock_irqsave+0x43/0x90
[ 74.829024] ? htab_map_update_elem+0x271/0x5a0
[ 74.829025] htab_map_update_elem+0x271/0x5a0
[ 74.829026] bpf_prog_1fd9e30e1438d3c5_oncpu+0x9c/0xe88
[ 74.829027] bpf_overflow_handler+0x127/0x320
[ 74.829028] ? perf_event_text_poke_output+0x4d0/0x4d0
[ 74.829029] ? sched_clock_cpu+0x18/0x130
[ 74.829030] __perf_event_overflow+0xae/0x190
[ 74.829030] handle_pmi_common+0x34c/0x470
[ 74.829031] ? intel_pmu_save_and_restart+0x90/0x90
[ 74.829032] ? lock_acquire+0x3f8/0x510
[ 74.829033] ? lock_release+0x6b0/0x6b0
[ 74.829034] intel_pmu_handle_irq+0x11e/0x240
[ 74.829034] perf_event_nmi_handler+0x40/0x60
[ 74.829035] nmi_handle+0x110/0x360
[ 74.829036] ? __intel_pmu_enable_all.constprop.0+0x72/0xf0
[ 74.829037] default_do_nmi+0x6b/0x170
[ 74.829038] exc_nmi+0x106/0x130
[ 74.829038] end_repeat_nmi+0x16/0x55
[ 74.829039] RIP: 0010:__intel_pmu_enable_all.constprop.0+0x72/0xf0
[ 74.829042] Code: 2f 1f 03 48 8d bb b8 0c 00 00 e8 29 09 41 00 48 ...
[ 74.829043] RSP: 0000:ffff8880a604fc90 EFLAGS: 00000002
[ 74.829044] RAX: 000000070000000f RBX: ffff8883ec2195a0 RCX: 000000000000038f
[ 74.829045] RDX: 0000000000000007 RSI: ffffffff82e72c20 RDI: ffff8883ec21a258
[ 74.829046] RBP: 000000070000000f R08: ffffffff8101b013 R09: fffffbfff0a7982d
[ 74.829047] R10: ffffffff853cc167 R11: fffffbfff0a7982c R12: 0000000000000000
[ 74.829049] R13: ffff8883ec3f0af0 R14: ffff8883ec3fd120 R15: ffff8883e9c92098
[ 74.829049] ? intel_pmu_lbr_enable_all+0x43/0x240
[ 74.829050] ? __intel_pmu_enable_all.constprop.0+0x72/0xf0
[ 74.829051] ? __intel_pmu_enable_all.constprop.0+0x72/0xf0
[ 74.829052] </NMI>
[ 74.829053] perf_event_task_tick+0x48d/0x650
[ 74.829054] scheduler_tick+0x129/0x210
[ 74.829054] update_process_times+0x37/0x70
[ 74.829055] tick_sched_handle.isra.0+0x35/0x90
[ 74.829056] tick_sched_timer+0x8f/0xb0
[ 74.829057] __hrtimer_run_queues+0x364/0x7d0
[ 74.829058] ? tick_sched_do_timer+0xa0/0xa0
[ 74.829058] ? enqueue_hrtimer+0x1e0/0x1e0
[ 74.829059] ? recalibrate_cpu_khz+0x10/0x10
[ 74.829060] ? ktime_get_update_offsets_now+0x1a3/0x360
[ 74.829061] hrtimer_interrupt+0x1bb/0x360
[ 74.829062] ? rcu_read_lock_sched_held+0xa1/0xd0
[ 74.829063] __sysvec_apic_timer_interrupt+0xed/0x3d0
[ 74.829064] sysvec_apic_timer_interrupt+0x3f/0xd0
[ 74.829064] ? asm_sysvec_apic_timer_interrupt+0xa/0x20
[ 74.829065] asm_sysvec_apic_timer_interrupt+0x12/0x20
[ 74.829066] RIP: 0033:0x7fba18d579b4
[ 74.829068] Code: 74 54 44 0f b6 4a 04 41 83 e1 0f 41 80 f9 ...
[ 74.829069] RSP: 002b:00007ffc9ba69570 EFLAGS: 00000206
[ 74.829071] RAX: 00007fba192084c0 RBX: 00007fba18c24d28 RCX: 00000000000007a4
[ 74.829072] RDX: 00007fba18c30488 RSI: 0000000000000000 RDI: 000000000000037b
[ 74.829073] RBP: 00007fba18ca5760 R08: 00007fba18c248fc R09: 00007fba18c94c30
[ 74.829074] R10: 000000000000002f R11: 0000000000073c30 R12: 00007ffc9ba695e0
[ 74.829075] R13: 00000000000003f3 R14: 00007fba18c21ac8 R15: 00000000000058d6However, such warning should not apply across multiple hashtabs. The system will not deadlock if one hashtab is used in NMI, while another hashtab is used in non-NMI.
Use separate lockdep class for each hashtab, so that we don't get this false alert.
--- kernel/bpf/hashtab.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/bpf/hashtab.c +10 -2
@@ -99,6 +99,7 @@ struct bpf_htab {u32 n_buckets;/* number of hash buckets */ u32 elem_size;/* size of each element in bytes */ u32 hashrnd; +struct lock_class_key lockdep_key; };/* each htab element is struct htab_elem + key + value */
@@ -136,12 +137,18 @@ static void htab_init_buckets(struct bpf_htab *htab) {unsigned i; +lockdep_register_key (&htab->lockdep_key);for (i =0 ; i < htab->n_buckets; i++) {INIT_HLIST_NULLS_HEAD (&htab->buckets[i].head, i); -if (htab_use_raw_lock (htab)) +if (htab_use_raw_lock (htab)) {raw_spin_lock_init (&htab->buckets[i].raw_lock); -else +lockdep_set_class (&htab->buckets[i].raw_lock, + &htab->lockdep_key); + }else {spin_lock_init (&htab->buckets[i].lock); +lockdep_set_class (&htab->buckets[i].lock, + &htab->lockdep_key); + } } }
@@ -1338,6 +1345,7 @@ static void htab_map_free(struct bpf_map *map)free_percpu (htab->extra_elems);bpf_map_area_free (htab->buckets); +lockdep_unregister_key (&htab->lockdep_key);kfree (htab); }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 15/217 drm/msm: Fix race condition in msm driver with async layer updates
In reply to Sasha LevinFrom: Krishna Manikandan <[email protected]>
[ Upstream commit b3d91800d9ac35014e0349292273a6fa7938d402 ]
When there are back to back commits with async cursor update, there is a case where second commit can program the DPU hw blocks while first didn't complete flushing config to HW.
Synchronize the compositions such that second commit waits until first commit flushes the composition.
This change also introduces per crtc commit lock, such that commits on different crtcs are not blocked by each other.
Changes in v2:
- Use an array of mutexes in kms to handle commit lock per crtc. (Rob Clark)
Changes in v3:
- Add wrapper functions to handle lock and unlock of commit_lock for each crtc. (Rob Clark)
--- drivers/gpu/drm/msm/msm_atomic.c | 37 +++++++++++++++++++++----------- drivers/gpu/drm/msm/msm_kms.h | 6 ++++-- 2 files changed, 28 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/msm_atomic.c +24 -13
@@ -55,16 +55,32 @@ static void vblank_put(struct msm_kms *kms, unsigned crtc_mask) } } +static void lock_crtcs (struct msm_kms *kms,unsigned int crtc_mask) +{ +struct drm_crtc *crtc; + +for_each_crtc_mask (kms->dev, crtc, crtc_mask) +mutex_lock (&kms->commit_lock[drm_crtc_index (crtc)]); +} + +static void unlock_crtcs (struct msm_kms *kms,unsigned int crtc_mask) +{ +struct drm_crtc *crtc; + +for_each_crtc_mask (kms->dev, crtc, crtc_mask) +mutex_unlock (&kms->commit_lock[drm_crtc_index (crtc)]); +} +static void msm_atomic_async_commit (struct msm_kms *kms,int crtc_idx) {unsigned crtc_mask =BIT (crtc_idx);trace_msm_atomic_async_commit_start (crtc_mask); -mutex_lock (&kms->commit_lock); +lock_crtcs (kms, crtc_mask);if (!(kms->pending_crtc_mask & crtc_mask)) { -mutex_unlock (&kms->commit_lock); +unlock_crtcs (kms, crtc_mask); goto out; }
@@ -79,7 +95,6 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)*/ trace_msm_atomic_flush_commit (crtc_mask); kms->funcs->flush_commit (kms, crtc_mask); -mutex_unlock (&kms->commit_lock);/* * Wait for flush to complete:
@@ -90,9 +105,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)vblank_put (kms, crtc_mask); -mutex_lock (&kms->commit_lock); kms->funcs->complete_commit (kms, crtc_mask); -mutex_unlock (&kms->commit_lock); +unlock_crtcs (kms, crtc_mask); kms->funcs->disable_commit (kms); out:
@@ -189,12 +203,11 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)* Ensure any previous (potentially async) commit has * completed: */ +lock_crtcs (kms, crtc_mask);trace_msm_atomic_wait_flush_start (crtc_mask); kms->funcs->wait_flush (kms, crtc_mask);trace_msm_atomic_wait_flush_finish (crtc_mask); -mutex_lock (&kms->commit_lock); -/* * Now that there is no in-progress flush, prepare the * current update:
@@ -232,8 +245,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) } kms->funcs->disable_commit (kms); -mutex_unlock (&kms->commit_lock); - +unlock_crtcs (kms, crtc_mask);/* * At this point, from drm core's perspective, we * are done with the atomic update, so we can just
@@ -260,8 +272,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)*/ trace_msm_atomic_flush_commit (crtc_mask); kms->funcs->flush_commit (kms, crtc_mask); -mutex_unlock (&kms->commit_lock); - +unlock_crtcs (kms, crtc_mask);/* * Wait for flush to complete: */
@@ -271,9 +282,9 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)vblank_put (kms, crtc_mask); -mutex_lock (&kms->commit_lock); +lock_crtcs (kms, crtc_mask); kms->funcs->complete_commit (kms, crtc_mask); -mutex_unlock (&kms->commit_lock); +unlock_crtcs (kms, crtc_mask); kms->funcs->disable_commit (kms);drm_atomic_helper_commit_hw_done (state);
drivers/gpu/drm/msm/msm_kms.h +4 -2
@@ -155,7 +155,7 @@ struct msm_kms {* For async commit, where ->flush_commit() and later happens * from the crtc's pending_timer close to end of the frame: */ -struct mutex commit_lock; +struct mutex commit_lock[MAX_CRTCS ];unsigned pending_crtc_mask;struct msm_pending_timer pending_timers[MAX_CRTCS ]; };
@@ -165,7 +165,9 @@ static inline void msm_kms_init(struct msm_kms *kms, {unsigned i; -mutex_init (&kms->commit_lock); +for (i =0 ; i <ARRAY_SIZE (kms->commit_lock); i++) +mutex_init (&kms->commit_lock[i]); + kms->funcs = funcs;for (i =0 ; i <ARRAY_SIZE (kms->pending_timers); i++)
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 16/217 staging: wimax: depends on NET
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 9364a2cf567187c0a075942c22d1f434c758de5d ]
Fix build errors when CONFIG_NET is not enabled. E.g. (trimmed):
ld: drivers/staging/wimax/op-msg.o: in function `wimax_msg_alloc':
op-msg.c:(.text+0xa9): undefined reference to `__alloc_skb'
ld: op-msg.c:(.text+0xcc): undefined reference to `genlmsg_put'
ld: op-msg.c:(.text+0xfc): undefined reference to `nla_put'
ld: op-msg.c:(.text+0x168): undefined reference to `kfree_skb'
ld: drivers/staging/wimax/op-msg.o: in function `wimax_msg_data_len':
op-msg.c:(.text+0x1ba): undefined reference to `nla_find'
ld: drivers/staging/wimax/op-msg.o: in function `wimax_msg_send':
op-msg.c:(.text+0x311): undefined reference to `init_net'
ld: op-msg.c:(.text+0x326): undefined reference to `netlink_broadcast'
ld: drivers/staging/wimax/stack.o: in function `__wimax_state_change':
stack.c:(.text+0x433): undefined reference to `netif_carrier_off'
ld: stack.c:(.text+0x46b): undefined reference to `netif_carrier_on'
ld: stack.c:(.text+0x478): undefined reference to `netif_tx_wake_queue'
ld: drivers/staging/wimax/stack.o: in function `wimax_subsys_exit':
stack.c:(.exit.text+0xe): undefined reference to `genl_unregister_family'
ld: drivers/staging/wimax/stack.o: in function `wimax_subsys_init':
stack.c:(.init.text+0x1a): undefined reference to `genl_register_family'
--- net/wimax/Kconfig | 1 + 1 file changed, 1 insertion(+)
net/wimax/Kconfig +1 -0
@@ -5,6 +5,7 @@ menuconfig WIMAX tristate "WiMAX Wireless Broadband support" + depends on NET depends on RFKILL || !RFKILL help
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 17/217 RDMA/siw: Fix typo of EAGAIN not -EAGAIN in siw_cm_work_handler()
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit 856c2998999958761b6a52208b4edb4d352c4037 ]
The rv cannot be 'EAGAIN' in the previous path, we should use '-EAGAIN' to check it. For example:
Call trace: ->siw_cm_work_handler ->siw_proc_mpareq ->siw_recv_mpa_rr
--- drivers/infiniband/sw/siw/siw_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_cm.c +1 -1
@@ -1047,7 +1047,7 @@ static void siw_cm_work_handler(struct work_struct *w) cep->state); } } -if (rv && rv !=EAGAIN ) +if (rv && rv != -EAGAIN ) release_cep =1 ;break ;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 18/217 drm/amd/display: Fix compilation error
In reply to Sasha LevinFrom: "Tao.Huang" <[email protected]>
[ Upstream commit 585e7cedf304ce76410c922e632bef04fd316ead ]
[Why]
The C standard does not specify whether an enum is signed or unsigned. In the function prototype, one of the argument is defined as an enum but its declaration was unit32_t. Fix this by changing the function argument to enum in the declaration.
--- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.h | 2 +- drivers/gpu/drm/amd/display/dc/dsc/rc_calc.c | 6 +++--- drivers/gpu/drm/amd/display/dc/dsc/rc_calc.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.h +1 -1
@@ -585,7 +585,7 @@ void dpp3_cm_set_gamut_remap( const struct dpp_grph_csc_adjustment *adjust);void dpp3_set_pre_degam (struct dpp *dpp_base, -uint32_t degamma_lut_selection); +enum dc_transfer_func_predefined tr); void dpp3_set_cursor_attributes( struct dpp *dpp_base,
drivers/gpu/drm/amd/display/dc/dsc/rc_calc.c +3 -3
@@ -51,7 +51,7 @@ static void get_qp_set(qp_set qps, enum colour_mode cm, enum bits_per_comp bpc,const struct qp_entry *table =0L ;// alias enum -enum { min =MM_MIN , max =MM_MAX }; +enum { min =DAL_MM_MIN , max =DAL_MM_MAX };switch (sel) {TABLE_CASE (444 ,8 , max);TABLE_CASE (444 ,8 , min);
@@ -233,8 +233,8 @@ static void _do_calc_rc_params(struct rc_params *rc, enum colour_mode cm, rc->flatness_max_qp = ((bpc ==BPC_8 ) ? (12 ) : ((bpc ==BPC_10 ) ? (16 ) : (20 ))) - ((minor_version ==1 && cm ==CM_444 ) ?1 :0 ); rc->flatness_det_thresh =2 << (bpc -8 ); -get_qp_set (rc->qp_min, cm, bpc,MM_MIN , bpp); -get_qp_set (rc->qp_max, cm, bpc,MM_MAX , bpp); +get_qp_set (rc->qp_min, cm, bpc,DAL_MM_MIN , bpp); +get_qp_set (rc->qp_max, cm, bpc,DAL_MM_MAX , bpp);if (cm ==CM_444 && minor_version ==1 ) {for (i =0 ; i <QP_SET_SIZE ; ++i) { rc->qp_min[i] = rc->qp_min[i] >0 ? rc->qp_min[i] -1 :0 ;
drivers/gpu/drm/amd/display/dc/dsc/rc_calc.h +2 -2
@@ -66,8 +66,8 @@ enum bits_per_comp { };enum max_min { -MM_MIN =0 , -MM_MAX =1 +DAL_MM_MIN =0 , +DAL_MM_MAX =1 };struct qp_entry {
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 19/217 drm/amd/display: Force prefetch mode to 0
In reply to Sasha LevinFrom: Isabel Zhang <[email protected]>
[ Upstream commit 685b4d8142dcbf11b817f74c2bc5b94eca7ee7f2 ]
[Why]
On APU should be always using prefetch mode 0. Currently, sometimes prefetch mode 1 is being used causing system to hard hang due to minTTUVBlank being too low.
[How]
Any ASIC running DCN21 will by default allow self refresh and mclk switch. This sets both min and max prefetch mode to 0 by default.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +3 -1
@@ -301,7 +301,9 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { .xfc_bus_transport_time_us = 4, .xfc_xbuf_latency_tolerance_us = 4, .use_urgent_burst_bw = 1, - .num_states = 8 + .num_states = 8, + .allow_dram_self_refresh_or_dram_clock_change_in_vblank + = dm_allow_self_refresh_and_mclk_switch };#ifndef MAX
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 20/217 drm/amd/display: Keep GSL for full updates with planes that flip VSYNC
In reply to Sasha LevinFrom: Alvin Lee <[email protected]>
[ Upstream commit 6f2239ccdfc04938dc35e67dd60191b2c05dfb63 ]
[Why]
When enabling PIP in Heaven, the PIP planes are VSYNC flip and is also the top-most pipe. In this case GSL will be disabled because we only check immediate flip for the top pipe. However, the desktop planes are still flip immediate so we should at least keep GSL on until the full update.
[How]
Check each pipe in the tree to see if any planes are flip immediate. Maintain the GSL lock if yes, and take it down after when unlocking if any planes are flipping VSYNC. Keeping GSL on with VSYNC + flip immediate planes causes corruption.
--- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +19 -0
@@ -1158,6 +1158,7 @@ void dcn20_pipe_control_lock( struct pipe_ctx *pipe, bool lock) { +struct pipe_ctx *temp_pipe;bool flip_immediate = false;/* use TG master update lock to lock everything on the TG
@@ -1169,6 +1170,13 @@ void dcn20_pipe_control_lock(if (pipe->plane_state !=NULL ) flip_immediate = pipe->plane_state->flip_immediate; + temp_pipe = pipe->bottom_pipe; +while (!flip_immediate && temp_pipe) { +if (temp_pipe->plane_state !=NULL ) + flip_immediate = temp_pipe->plane_state->flip_immediate; + temp_pipe = temp_pipe->bottom_pipe; + } +if (flip_immediate && lock) {const int TIMEOUT_FOR_FLIP_PENDING =100000 ;int i;
@@ -1196,6 +1204,17 @@ void dcn20_pipe_control_lock( (!flip_immediate && pipe->stream_res.gsl_group > 0))dcn20_setup_gsl_group_as_lock (dc, pipe, flip_immediate); + temp_pipe = pipe->bottom_pipe; +while (flip_immediate && temp_pipe) { +if (temp_pipe->plane_state !=NULL ) + flip_immediate = temp_pipe->plane_state->flip_immediate; + temp_pipe = temp_pipe->bottom_pipe; + } + +if (!lock && pipe->stream_res.gsl_group >0 && pipe->plane_state && + !flip_immediate) +dcn20_setup_gsl_group_as_lock (dc, pipe, false); +if (pipe->stream &&should_use_dmub_lock (pipe->stream->link)) {union dmub_hw_lock_flags hw_locks = {0 };struct dmub_hw_lock_inst_flags inst_flags = {0 };
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 21/217 drm/amd/display: stop top_mgr when type change to non-MST during s3
In reply to Sasha LevinFrom: Lewis Huang <[email protected]>
[ Upstream commit e748b59fb74e8725c8774a4b0753fabba9de7b97 ]
[Why]
Driver keeps the invalid information cause report the incorrect monitor which save in remote sink to OS
[How]
When connector type change from MST to non-MST, stop the topology manager.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +8 -0
@@ -854,6 +854,7 @@ static bool dc_link_detect_helper(struct dc_link *link,struct dpcd_caps prev_dpcd_caps;bool same_dpcd = true;enum dc_connection_type new_connection_type = dc_connection_none; +enum dc_connection_type pre_connection_type = dc_connection_none;bool perform_dp_seamless_boot = false;const uint32_t post_oui_delay =30 ;// 30ms
@@ -889,6 +890,7 @@ static bool dc_link_detect_helper(struct dc_link *link,link_disconnect_sink (link);if (new_connection_type != dc_connection_none) { + pre_connection_type = link->type; link->type = new_connection_type; link->link_state_valid = false;
@@ -962,6 +964,12 @@ static bool dc_link_detect_helper(struct dc_link *link,return true; } +// link switch from MST to non-MST stop topology manager +if (pre_connection_type == dc_connection_mst_branch && + link->type != dc_connection_mst_branch) { +dm_helpers_dp_mst_stop_top_mgr (link->ctx, link); + } +if (link->type == dc_connection_mst_branch) {LINK_INFO ("link=%d, mst branch is now Connected\n" , link->link_index);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 22/217 drm/amd/display: correct eDP T9 delay
In reply to Sasha LevinFrom: Hugo Hu <[email protected]>
[ Upstream commit 3a372bed1e337efa450d8288bc75cfc9237b7bad ]
[Why]
The current end of T9 delay is relay on polling sink status by DPCD. But the polling for sink status change after NoVideoStream_flag set to 0.
[How]
Add function edp_add_delay_for_T9 to add T9 delay. Move the sink status polling after blank.
--- .../gpu/drm/amd/display/dc/core/dc_link_hwss.c | 13 ++++++++----- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 16 ++++++++-------- drivers/gpu/drm/amd/display/dc/inc/link_hwss.h | 1 + 3 files changed, 17 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +8 -5
@@ -156,6 +156,13 @@ void dp_enable_link_phy(dp_receiver_power_ctrl (link, true); } +void edp_add_delay_for_T9 (struct dc_link *link) +{ +if (link->local_sink && + link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off >0 ) +udelay (link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off *1000 ); +} +bool edp_receiver_ready_T9 (struct dc_link *link) {unsigned int tries =0 ;
@@ -165,7 +172,7 @@ bool edp_receiver_ready_T9(struct dc_link *link) result =core_link_read_dpcd (link,DP_EDP_DPCD_REV , &edpRev,sizeof (edpRev)); -/* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/ +/* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/ if (result ==DC_OK && edpRev >=DP_EDP_12 ) { do { sinkstatus = 1;
@@ -178,10 +185,6 @@ bool edp_receiver_ready_T9(struct dc_link *link) }while (++tries <50 ); } -if (link->local_sink && - link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off >0 ) -udelay (link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off *1000 ); -return result; }bool edp_receiver_ready_T7 (struct dc_link *link)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +8 -8
@@ -992,8 +992,6 @@ void dce110_edp_backlight_control(link_transmitter_control (ctx->dc_bios, &cntl); - -if (enable && link->dpcd_sink_ext_caps.bits.oled)msleep (OLED_POST_T7_DELAY );
@@ -1004,7 +1002,7 @@ void dce110_edp_backlight_control(/*edp 1.2*/ if (cntl.action ==TRANSMITTER_CONTROL_BACKLIGHT_OFF ) -edp_receiver_ready_T9 (link); +edp_add_delay_for_T9 (link);if (!enable && link->dpcd_sink_ext_caps.bits.oled)msleep (OLED_PRE_T11_DELAY );
@@ -1145,12 +1143,14 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx)if (dc_is_dp_signal (pipe_ctx->stream->signal)) { pipe_ctx->stream_res.stream_enc->funcs->dp_blank (pipe_ctx->stream_res.stream_enc); -/* -* After output is idle pattern some sinks need time to recognize the stream -* has changed or they enter protection state and hang. -*/ -if (!dc_is_embedded_signal (pipe_ctx->stream->signal)) +if (!dc_is_embedded_signal (pipe_ctx->stream->signal)) { +/* +* After output is idle pattern some sinks need time to recognize the stream +* has changed or they enter protection state and hang. +*/ msleep (60 ); + }else if (pipe_ctx->stream->signal ==SIGNAL_TYPE_EDP ) +edp_receiver_ready_T9 (link); } }
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +1 -0
@@ -51,6 +51,7 @@ void dp_enable_link_phy( const struct dc_link_settings *link_settings);void dp_receiver_power_ctrl (struct dc_link *link,bool on); +void edp_add_delay_for_T9 (struct dc_link *link);bool edp_receiver_ready_T9 (struct dc_link *link);bool edp_receiver_ready_T7 (struct dc_link *link);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 23/217 drm/amd/display: Update connector on DSC property change
In reply to Sasha LevinFrom: Eryk Brol <[email protected]>
[ Upstream commit 886876ecf7f46917af8065bb574a669f19302f96 ]
[Why]
We want to trigger atomic check on connector when
DSC debugfs properties are changed. The previous
method was reverted because it accessed connector
properties unsafely and would also heavily
impact performance.
[How]
Add a flag for forcing DSC update in CRTC state and add connector to the state if the flag is set.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 + .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 124 ++++++++++++++++++ 3 files changed, 130 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -1
@@ -8656,6 +8656,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,enum dc_status status;int ret, i;bool lock_and_validation_needed = false; +struct dm_crtc_state *dm_old_crtc_state;amdgpu_check_debugfs_connector_property_change (adev, state);
@@ -8698,9 +8699,12 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, }#endif for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { + dm_old_crtc_state =to_dm_crtc_state (old_crtc_state); +if (!drm_atomic_crtc_needs_modeset (new_crtc_state) && !new_crtc_state->color_mgmt_changed && - old_crtc_state->vrr_enabled == new_crtc_state->vrr_enabled) + old_crtc_state->vrr_enabled == new_crtc_state->vrr_enabled && + dm_old_crtc_state->dsc_force_changed == false)continue ;if (!new_crtc_state->enable)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
@@ -440,6 +440,7 @@ struct dm_crtc_state {bool freesync_timing_changed;bool freesync_vrr_info_changed; +bool dsc_force_changed;bool vrr_supported;struct mod_freesync_config freesync_config;struct dc_info_packet vrr_infopacket;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +124 -0
192 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 24/217 drm/amd/display: fix recout calculation for left side clip
In reply to Sasha LevinFrom: Dmytro Laktyushkin <[email protected]>
[ Upstream commit 84aef2ab0977199784671295a07043191233d7c7 ]
Recout calculation does not corrrectly handle plane clip rect that extends beyond the left most border of stream source rect. This change adds handling by truncating the invisible clip rect.
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
@@ -796,6 +796,8 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx) }else data->recout.x =0 ; +if (stream->src.x > surf_clip.x) + surf_clip.width -= stream->src.x - surf_clip.x; data->recout.width = surf_clip.width * stream->dst.width / stream->src.width;if (data->recout.width + data->recout.x > stream->dst.x + stream->dst.width) data->recout.width = stream->dst.x + stream->dst.width - data->recout.x;
@@ -804,6 +806,8 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx)if (stream->src.y < surf_clip.y) data->recout.y += (surf_clip.y - stream->src.y) * stream->dst.height / stream->src.height; +else if (stream->src.y > surf_clip.y) + surf_clip.height -= stream->src.y - surf_clip.y; data->recout.height = surf_clip.height * stream->dst.height / stream->src.height;if (data->recout.height + data->recout.y > stream->dst.y + stream->dst.height)
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 25/217 drm/amdgpu: disable gfxoff if VCN is busy
In reply to Sasha LevinFrom: Jiansong Chen <[email protected]>
[ Upstream commit ef3b2987254035f9b869f70151b4220c34f2f133 ]
Toggle on/off gfxoff during video playback to fix gpu hang.
v2: change sequence to be more compatible with original code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -1
@@ -345,6 +345,7 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work) }if (!fences && !atomic_read (&adev->vcn.total_submission_cnt)) { +amdgpu_gfx_off_ctrl (adev, true);amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_GATE ); }else {
@@ -357,7 +358,9 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;atomic_inc (&adev->vcn.total_submission_cnt); -cancel_delayed_work_sync (&adev->vcn.idle_work); + +if (!cancel_delayed_work_sync (&adev->vcn.idle_work)) +amdgpu_gfx_off_ctrl (adev, false);mutex_lock (&adev->vcn.vcn_pg_lock); amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 26/217 net: ethernet: ti: am65-cpsw: fix tx csum offload for multi mac mode
In reply to Sasha LevinFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 97067aaf127487788a297267dede0008cd75bb7b ]
The current implementation uses .ndo_set_features() callback to track NETIF_F_HW_CSUM feature changes and update generic CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option accordingly. It's not going to work in case of multi-port devices as TX csum offload can be changed per netdev.
On K3 CPSWxG devices TX csum offload enabled in the following way:
- the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option enables TX csum offload in
generic and affects all TX DMA channels and packets;
- corresponding fields in TX DMA descriptor have to be filed properly when
upper layer wants to offload TX csum (skb->ip_summed == CHECKSUM_PARTIAL) and it's per-packet option.
The Linux Network core is expected to never request TX csum offload if netdev NETIF_F_HW_CSUM feature is disabled, and, as result, TX DMA descriptors should not be modified, and per-packet TX csum offload will be disabled (or enabled) on per-netdev basis. Which, in turn, makes it safe to enable the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option unconditionally.
Hence, fix TX csum offload for multi-port devices by:
- enabling the CPSW_P0_CONTROL_REG.RX_CHECKSUM_EN option inam65_cpsw_nuss_common_open() unconditionally
- and removing .ndo_set_features() callback implementation, which was used
only NETIF_F_HW_CSUM feature update purposes
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 30 +----------------------- 1 file changed, 1 insertion(+), 29 deletions(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +1 -29
@@ -426,9 +426,7 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common,writel (common->rx_flow_id_base, host_p->port_base +AM65_CPSW_PORT0_REG_FLOW_ID_OFFSET );/* en tx crc offload */ -if (features &NETIF_F_HW_CSUM ) -writel (AM65_CPSW_P0_REG_CTL_RX_CHECKSUM_EN , - host_p->port_base +AM65_CPSW_P0_REG_CTL ); +writel (AM65_CPSW_P0_REG_CTL_RX_CHECKSUM_EN , host_p->port_base +AM65_CPSW_P0_REG_CTL );am65_cpsw_nuss_set_p0_ptype (common);
@@ -1369,31 +1367,6 @@ static void am65_cpsw_nuss_ndo_get_stats(struct net_device *dev, stats->tx_dropped = dev->stats.tx_dropped; } -static int am65_cpsw_nuss_ndo_slave_set_features (struct net_device *ndev, -netdev_features_t features) -{ -struct am65_cpsw_common *common =am65_ndev_to_common (ndev); -netdev_features_t changes = features ^ ndev->features; -struct am65_cpsw_host *host_p; - - host_p =am65_common_get_host (common); - -if (changes &NETIF_F_HW_CSUM ) { -bool enable = !!(features &NETIF_F_HW_CSUM ); - -dev_info (common->dev,"Turn %s tx-checksum-ip-generic\n" , - enable ?"ON" :"OFF" ); -if (enable) -writel (AM65_CPSW_P0_REG_CTL_RX_CHECKSUM_EN , - host_p->port_base +AM65_CPSW_P0_REG_CTL ); -else -writel (0 , - host_p->port_base +AM65_CPSW_P0_REG_CTL ); - } - -return 0 ; -} -static const struct net_device_ops am65_cpsw_nuss_netdev_ops_2g = { .ndo_open = am65_cpsw_nuss_ndo_slave_open, .ndo_stop = am65_cpsw_nuss_ndo_slave_stop,
@@ -1406,7 +1379,6 @@ static const struct net_device_ops am65_cpsw_nuss_netdev_ops_2g = { .ndo_vlan_rx_add_vid = am65_cpsw_nuss_ndo_slave_add_vid, .ndo_vlan_rx_kill_vid = am65_cpsw_nuss_ndo_slave_kill_vid, .ndo_do_ioctl = am65_cpsw_nuss_ndo_slave_ioctl, - .ndo_set_features = am65_cpsw_nuss_ndo_slave_set_features, .ndo_setup_tc = am65_cpsw_qos_ndo_setup_tc, };
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 27/217 net: mscc: ocelot: don't reset the pvid to 0 when deleting it
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 110e847ca7d5e712cabc8cb866a66b629832f4a2 ]
I have no idea why this code is here, but I have 2 hypotheses:
1.
A desperate attempt to keep untagged traffic working when the bridge deletes the pvid on a port.
There was a fairly okay discussion here:
https://lore.kernel.org/netdev/CA+h21hrRMrLH-RjBGhEJSTZd6_QPRSd3RkVRQF-wNKkrgKcRSA@mail.gmail.com/#t
which established that in vlan_filtering=1 mode, the absence of a pvid should denote that the ingress port should drop untagged and priority tagged traffic. While in vlan_filtering=0 mode, nothing should change.
So in vlan_filtering=1 mode, we should simply let things happen, and not attempt to save the day. And in vlan_filtering=0 mode, the pvid is 0 anyway, no need to do anything.
2.
The driver encodes the native VLAN (ocelot_port->vid) value of 0 as special, meaning "not valid". There are checks based on that. But there are no such checks for the ocelot_port->pvid value of 0. In fact, that's a perfectly valid value, which is used in standalone mode. Maybe there was some confusion and the author thought that 0 means "invalid" here as well.
In conclusion, delete the code*.
*in fact we'll add it back later, in a slightly different form, but for an entirely different reason than the one for which this exists now.
--- drivers/net/ethernet/mscc/ocelot.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +0 -4
@@ -289,10 +289,6 @@ int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)if (ret)return ret; -/* Ingress */ -if (ocelot_port->pvid == vid) -ocelot_port_set_pvid (ocelot, port,0 ); -/* Egress */ if (ocelot_port->vid == vid)ocelot_port_set_native_vlan (ocelot, port,0 );
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 28/217 drm/amdgpu: set LDS_CONFIG=0x20 on Navy Flounder to fix a GPU hang (v2)
In reply to Sasha LevinFrom: Marek Olšák <[email protected]>
[ Upstream commit 4b60bb0dde1baf347540253f856c54bc908e525c ]
v2: squash in build fix
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -1
@@ -3183,7 +3183,10 @@ static const struct soc15_reg_golden golden_settings_gc_10_3_2[] =SOC15_REG_GOLDEN_VALUE (GC ,0 , mmSQ_PERFCOUNTER9_SELECT,0xf0f001ff ,0x00000000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmTA_CNTL_AUX,0xfff7ffff ,0x01030000 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , mmUTCL1_CTRL,0xffbfffff ,0x00a00000 ), - SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff) +SOC15_REG_GOLDEN_VALUE (GC ,0 , mmVGT_GS_MAX_WAVE_ID,0x00000fff ,0x000003ff ), + +/* This is not in GDB yet. Don't remove it. It fixes a GPU hang on Navy Flounder. */ + SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x00000020, 0x00000020), };#define DEFAULT_SH_MEM_CONFIG \
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 29/217 scsi: target: Fix cmd_count ref leak
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit 02dd4914b0bcb8fd8f8cad9817f5715a17466261 ]
percpu_ref_init sets the refcount to 1 and percpu_ref_kill drops it. Drivers like iSCSI and loop do not call target_sess_cmd_list_set_waiting during session shutdown, though, so they have been calling percpu_ref_exit with a refcount still taken and leaking the cmd_counts memory.
--- drivers/target/target_core_transport.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/target/target_core_transport.c +8 -0
@@ -238,6 +238,14 @@ EXPORT_SYMBOL(transport_init_session);void transport_uninit_session (struct se_session *se_sess) { +/* +* Drivers like iscsi and loop do not call +* target_sess_cmd_list_set_waiting during session shutdown so we +* have to drop the ref taken at init time here. +*/ +if (!se_sess->sess_tearing_down) +percpu_ref_put (&se_sess->cmd_count); +percpu_ref_exit (&se_sess->cmd_count); }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 30/217 scsi: pm80xx: Make mpi_build_cmd locking consistent
In reply to Sasha LevinFrom: peter chang <[email protected]>
[ Upstream commit 7640e1eb8c5de33dafa6c68fd4389214ff9ec1f9 ]
Driver submits all internal requests (like abort_task, event acknowledgment etc.) through inbound queue 0. While submitting those, driver does not acquire any lock and this may lead to a race when there is an I/O request coming in on CPU0 and submitted through inbound queue 0. To avoid this, lock acquisition has been moved to pm8001_mpi_build_cmd(). All command submission will go through this path.
--- drivers/scsi/pm8001/pm8001_hwi.c | 21 +++++++++++++++------ drivers/scsi/pm8001/pm80xx_hwi.c | 8 -------- 2 files changed, 15 insertions(+), 14 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +15 -6
@@ -1356,12 +1356,19 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, {u32 Header =0 , hpriority =0 , bc =1 , category =0x02 ;void *pMessage; - -if (pm8001_mpi_msg_free_get (circularQ, pm8001_ha->iomb_size, - &pMessage) <0 ) { +unsigned long flags; +int q_index = circularQ - pm8001_ha->inbnd_q_tbl; +int rv =-1 ; + +WARN_ON (q_index >=PM8001_MAX_INB_NUM ); +spin_lock_irqsave (&circularQ->iq_lock, flags); + rv =pm8001_mpi_msg_free_get (circularQ, pm8001_ha->iomb_size, + &pMessage); +if (rv <0 ) {PM8001_IO_DBG (pm8001_ha, -pm8001_printk ("No free mpi buffer\n" )); -return -ENOMEM ; +pm8001_printk ("No free mpi buffer\n" )); + rv = -ENOMEM ; + goto done; }if (nb > (pm8001_ha->iomb_size -sizeof (struct mpi_msg_hdr )))
@@ -1384,7 +1391,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,pm8001_printk ("INB Q %x OPCODE:%x , UPDATED PI=%d CI=%d\n" , responseQueue, opCode, circularQ->producer_idx, circularQ->consumer_index)); -return 0 ; +done: +spin_unlock_irqrestore (&circularQ->iq_lock, flags); +return rv; } u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
drivers/scsi/pm8001/pm80xx_hwi.c +0 -8
@@ -4281,7 +4281,6 @@ static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,char *preq_dma_addr =NULL ;__le64 tmp_addr;u32 i, length; -unsigned long flags;memset (&smp_cmd,0 ,sizeof (smp_cmd));/*
@@ -4377,10 +4376,8 @@ static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,build_smp_cmd (pm8001_dev->device_id, smp_cmd.tag, &smp_cmd, pm8001_ha->smp_exp_mode, length); -spin_lock_irqsave (&circularQ->iq_lock, flags); rc =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &smp_cmd,sizeof (smp_cmd),0 ); -spin_unlock_irqrestore (&circularQ->iq_lock, flags);if (rc) goto err_out_2;return 0 ;
@@ -4444,7 +4441,6 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,u64 phys_addr, start_addr, end_addr;u32 end_addr_high, end_addr_low;struct inbound_queue_table *circularQ; -unsigned long flags;u32 q_index, cpu_id;u32 opc =OPC_INB_SSPINIIOSTART ;memset (&ssp_cmd,0 ,sizeof (ssp_cmd));
@@ -4582,10 +4578,8 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.esgl =0 ; } } -spin_lock_irqsave (&circularQ->iq_lock, flags); ret =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &ssp_cmd,sizeof (ssp_cmd), q_index); -spin_unlock_irqrestore (&circularQ->iq_lock, flags);return ret; }
@@ -4819,10 +4813,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, } } } -spin_lock_irqsave (&circularQ->iq_lock, flags); ret =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &sata_cmd,sizeof (sata_cmd), q_index); -spin_unlock_irqrestore (&circularQ->iq_lock, flags);return ret; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 31/217 scsi: pm80xx: Make running_req atomic
In reply to Sasha LevinFrom: Viswas G <[email protected]>
[ Upstream commit 4a2efd4b89fcaa6e9a7b4ce49a441afaacba00ea ]
Incorrect value of the running_req was causing the driver unload to be stuck during the SAS lldd_dev_gone notification handling. During SATA I/O completion, for some error status values, the driver schedules the event handler and running_req is decremented from that. However, there are some other error status values (like IO_DS_IN_RECOVERY, IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR) where the I/O has already been completed by fw/driver so running_req is not decremented.
Also during NCQ error handling, driver itself will initiate READ_LOG_EXT and ABORT_ALL. When libsas/libata initiate READ_LOG_EXT (0x2F), driver increments running_req. This will be completed by the driver in pm80xx_chip_sata_req(), but running_req was not decremented.
--- drivers/scsi/pm8001/pm8001_hwi.c | 58 +++++++++++++---- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pm8001/pm8001_sas.c | 11 ++-- drivers/scsi/pm8001/pm8001_sas.h | 2 +- drivers/scsi/pm8001/pm80xx_hwi.c | 101 +++++++++++++++++++++++++++--- 5 files changed, 147 insertions(+), 27 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +47 -11
@@ -1587,7 +1587,7 @@ void pm8001_work_fn(struct work_struct *work) ts->stat =SAS_QUEUE_FULL ; pm8001_dev = ccb->device;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);spin_lock_irqsave (&t->task_state_lock, flags1); t->task_state_flags &= ~SAS_TASK_STATE_PENDING ; t->task_state_flags &= ~SAS_TASK_AT_INITIATOR ;
@@ -1942,7 +1942,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb)sas_ssp_task_response (pm8001_ha->dev, t, iu); }if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_ABORTED : PM8001_IO_DBG(pm8001_ha,
@@ -1958,7 +1958,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) ts->stat =SAS_DATA_UNDERRUN ; ts->residual = param;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_NO_DEVICE : PM8001_IO_DBG(pm8001_ha,
@@ -2172,7 +2172,7 @@ static void mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) ts->stat =SAS_DATA_OVERRUN ; ts->residual =0 ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_BREAK : PM8001_IO_DBG(pm8001_ha,
@@ -2487,7 +2487,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) pm8001_printk("response to large\n")); }if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_ABORTED : PM8001_IO_DBG(pm8001_ha,
@@ -2495,7 +2495,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_ABORTED_TASK ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;/* following cases are to do cases */ case IO_UNDERFLOW :
@@ -2506,19 +2506,23 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->stat =SAS_DATA_UNDERRUN ; ts->residual = param;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_NO_DEVICE :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_NO_DEVICE\n" )); ts->resp =SAS_TASK_UNDELIVERED ; ts->stat =SAS_PHY_DOWN ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_BREAK :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_ERROR_BREAK\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_INTERRUPTED ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_PHY_NOT_READY : PM8001_IO_DBG(pm8001_ha,
@@ -2526,6 +2530,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_RSVD_RETRY ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED : PM8001_IO_DBG(pm8001_ha,
@@ -2534,6 +2540,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_EPROTO ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_OPEN_CNX_ERROR_ZONE_VIOLATION : PM8001_IO_DBG(pm8001_ha,
@@ -2541,6 +2549,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_UNKNOWN ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_OPEN_CNX_ERROR_BREAK : PM8001_IO_DBG(pm8001_ha,
@@ -2548,6 +2558,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_RSVD_CONT0 ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS : PM8001_IO_DBG(pm8001_ha,
@@ -2587,6 +2599,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_CONN_RATE ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY : PM8001_IO_DBG(pm8001_ha,
@@ -2610,48 +2624,64 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_WRONG_DEST ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_NAK_RECEIVED :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_ERROR_NAK_RECEIVED\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_NAK_R_ERR ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_ACK_NAK_TIMEOUT :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_ERROR_ACK_NAK_TIMEOUT\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_NAK_R_ERR ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_DMA :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_ERROR_DMA\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_ABORTED_TASK ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_SATA_LINK_TIMEOUT :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_ERROR_SATA_LINK_TIMEOUT\n" )); ts->resp =SAS_TASK_UNDELIVERED ; ts->stat =SAS_DEV_NO_RESPONSE ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_REJECTED_NCQ_MODE :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_ERROR_REJECTED_NCQ_MODE\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_DATA_UNDERRUN ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_OPEN_RETRY_TIMEOUT :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_XFER_OPEN_RETRY_TIMEOUT\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_TO ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_PORT_IN_RESET :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_PORT_IN_RESET\n" )); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_DEV_NO_RESPONSE ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_DS_NON_OPERATIONAL : PM8001_IO_DBG(pm8001_ha,
@@ -2672,6 +2702,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) pm8001_printk(" IO_DS_IN_RECOVERY\n")); ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_DEV_NO_RESPONSE ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;case IO_DS_IN_ERROR : PM8001_IO_DBG(pm8001_ha,
@@ -2693,6 +2725,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_RSVD_RETRY ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ;default : PM8001_DEVIO_DBG(pm8001_ha,
@@ -2700,6 +2734,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)/* not allowed case. Therefore, return failed status */ ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_DEV_NO_RESPONSE ; +if (pm8001_dev) +atomic_dec (&pm8001_dev->running_req);break ; }spin_lock_irqsave (&t->task_state_lock, flags);
@@ -2776,7 +2812,7 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) ts->stat =SAS_DATA_OVERRUN ; ts->residual =0 ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_XFER_ERROR_BREAK : PM8001_IO_DBG(pm8001_ha,
@@ -2976,7 +3012,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAM_STAT_GOOD ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_ABORTED : PM8001_IO_DBG(pm8001_ha,
@@ -2984,7 +3020,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_ABORTED_TASK ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_OVERFLOW :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_UNDERFLOW\n" ));
@@ -2992,7 +3028,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) ts->stat =SAS_DATA_OVERRUN ; ts->residual =0 ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);break ;case IO_NO_DEVICE :PM8001_IO_DBG (pm8001_ha,pm8001_printk ("IO_NO_DEVICE\n" ));
drivers/scsi/pm8001/pm8001_init.c +1 -1
@@ -412,7 +412,7 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, pm8001_ha->devices[i].dev_type =SAS_PHY_UNUSED ; pm8001_ha->devices[i].id = i; pm8001_ha->devices[i].device_id =PM8001_MAX_DEVICES ; - pm8001_ha->devices[i].running_req =0 ; +atomic_set (&pm8001_ha->devices[i].running_req,0 ); } pm8001_ha->flags =PM8001F_INIT_TIME ;/* Initialize tags */
drivers/scsi/pm8001/pm8001_sas.c +7 -4
@@ -456,9 +456,11 @@ static int pm8001_task_exec(struct sas_task *task, ccb->device = pm8001_dev;switch (task_proto) {case SAS_PROTOCOL_SMP : +atomic_inc (&pm8001_dev->running_req); rc =pm8001_task_prep_smp (pm8001_ha, ccb);break ;case SAS_PROTOCOL_SSP : +atomic_inc (&pm8001_dev->running_req);if (is_tmf) rc =pm8001_task_prep_ssp_tm (pm8001_ha, ccb, tmf);
@@ -467,6 +469,7 @@ static int pm8001_task_exec(struct sas_task *task,break ;case SAS_PROTOCOL_SATA :case SAS_PROTOCOL_STP : +atomic_inc (&pm8001_dev->running_req); rc =pm8001_task_prep_ata (pm8001_ha, ccb);break ;default :
@@ -479,13 +482,13 @@ static int pm8001_task_exec(struct sas_task *task,if (rc) {PM8001_IO_DBG (pm8001_ha,pm8001_printk ("rc is %x\n" , rc)); +atomic_dec (&pm8001_dev->running_req); goto err_out_tag; }/* TODO: select normal or high priority */ spin_lock (&t->task_state_lock); t->task_state_flags |=SAS_TASK_AT_INITIATOR ;spin_unlock (&t->task_state_lock); - pm8001_dev->running_req++; }while (0 ); rc =0 ; goto out_done;
@@ -886,11 +889,11 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)PM8001_DISC_DBG (pm8001_ha,pm8001_printk ("found dev[%d:%x] is gone.\n" , pm8001_dev->device_id, pm8001_dev->dev_type)); -if (pm8001_dev->running_req) { +if (atomic_read (&pm8001_dev->running_req)) {spin_unlock_irqrestore (&pm8001_ha->lock, flags);pm8001_exec_internal_task_abort (pm8001_ha, pm8001_dev , dev,1 ,0 ); -while (pm8001_dev->running_req) +while (atomic_read (&pm8001_dev->running_req))msleep (20 );spin_lock_irqsave (&pm8001_ha->lock, flags); }
@@ -968,7 +971,7 @@ void pm8001_open_reject_retry( ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_RSVD_RETRY ;if (pm8001_dev) - pm8001_dev->running_req--; +atomic_dec (&pm8001_dev->running_req);spin_lock_irqsave (&task->task_state_lock, flags1); task->task_state_flags &= ~SAS_TASK_STATE_PENDING ; task->task_state_flags &= ~SAS_TASK_AT_INITIATOR ;
drivers/scsi/pm8001/pm8001_sas.h +1 -1
@@ -293,7 +293,7 @@ struct pm8001_device {struct completion *dcompletion;struct completion *setds_completion;u32 device_id; -u32 running_req; +atomic_t running_req; };struct pm8001_prd_imt {
drivers/scsi/pm8001/pm80xx_hwi.c +91 -10
407 lines not on this page · raw message
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 32/217 scsi: pm80xx: Avoid busywait in FW ready check
In reply to Sasha LevinFrom: akshatzen <[email protected]>
[ Upstream commit 48cd6b38eb4f2874f091c4776ea1c26e7e4f967e ]
In function check_fw_ready() we busy wait using udelay. The CPU is not released and we see need_resched failures.
Busy waiting is not necessary since we are in process context and we can sleep instead. Replace udelay with msleep of 20 ms intervals while waiting for firmware to become ready.
It has been verified that check_fw_ready is not being used in interrupt context anywhere, hence it is safe to make this change.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 21 +++++++++++---------- drivers/scsi/pm8001/pm80xx_hwi.h | 6 ++++++ 2 files changed, 17 insertions(+), 10 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +11 -10
@@ -1042,6 +1042,7 @@ static int mpi_init_check(struct pm8001_hba_info *pm8001_ha)/** * check_fw_ready - The LLDD check if the FW is ready, if not, return error. +* This function sleeps hence it must not be used in atomic context. * @pm8001_ha: our hba card information */ static int check_fw_ready (struct pm8001_hba_info *pm8001_ha)
@@ -1052,16 +1053,16 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha)int ret =0 ;/* reset / PCIe ready */ - max_wait_time = max_wait_count =100 *1000 ;/* 100 milli sec */ + max_wait_time = max_wait_count =5 ;/* 100 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while ((value ==0xFFFFFFFF ) && (--max_wait_count));/* check ila status */ - max_wait_time = max_wait_count =1000 *1000 ;/* 1000 milli sec */ + max_wait_time = max_wait_count =50 ;/* 1000 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_ILA_READY ) !=SCRATCH_PAD_ILA_READY ) && (--max_wait_count));
@@ -1074,9 +1075,9 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha) }/* check RAAE status */ - max_wait_time = max_wait_count =1800 *1000 ;/* 1800 milli sec */ + max_wait_time = max_wait_count =90 ;/* 1800 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_RAAE_READY ) !=SCRATCH_PAD_RAAE_READY ) && (--max_wait_count));
@@ -1089,9 +1090,9 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha) }/* check iop0 status */ - max_wait_time = max_wait_count =600 *1000 ;/* 600 milli sec */ + max_wait_time = max_wait_count =30 ;/* 600 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_IOP0_READY ) !=SCRATCH_PAD_IOP0_READY ) && (--max_wait_count));
@@ -1107,9 +1108,9 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha)if ((pm8001_ha->chip_id != chip_8008) && (pm8001_ha->chip_id != chip_8009)) {/* 200 milli sec */ - max_wait_time = max_wait_count =200 *1000 ; + max_wait_time = max_wait_count =10 ;do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_IOP1_READY ) !=SCRATCH_PAD_IOP1_READY ) && (--max_wait_count));
drivers/scsi/pm8001/pm80xx_hwi.h +6 -0
@@ -1639,3 +1639,9 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;#define MEMBASE_II_SHIFT_REGISTER 0x1010#endif + +/** +* As we know sleep (1~20) ms may result in sleep longer than ~20 ms, hence we +* choose 20 ms interval. +*/ +#define FW_READY_INTERVAL 20
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 33/217 scsi: pm80xx: Fix pm8001_mpi_get_nvmd_resp() race condition
In reply to Sasha LevinFrom: yuuzheng <[email protected]>
[ Upstream commit 1f889b58716a5f5e3e4fe0e6742c1a4472f29ac1 ]
A use-after-free or null-pointer error occurs when the 251-byte response data is copied from IOMB buffer to response message buffer in function pm8001_mpi_get_nvmd_resp().
After sending the command get_nvmd_data(), the caller begins to sleep by calling wait_for_complete() and waits for the wake-up from calling complete() in pm8001_mpi_get_nvmd_resp(). Due to unexpected events (e.g., interrupt), if response buffer gets freed before memcpy(), a use-after-free error will occur. To fix this, the complete() should be called after memcpy().
--- drivers/scsi/pm8001/pm8001_hwi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_hwi.c +6 -1
@@ -3279,10 +3279,15 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) pm8001_ha->memoryMap.region[NVMD ].virt_ptr, fw_control_context->len);kfree (ccb->fw_control_context); +/* To avoid race condition, complete should be +* called after the message is copied to +* fw_control_context->usrAddr +*/ +complete (pm8001_ha->nvmd_completion); +PM8001_MSG_DBG (pm8001_ha,pm8001_printk ("Set nvm data complete!\n" )); ccb->task =NULL ; ccb->ccb_tag =0xFFFFFFFF ;pm8001_tag_free (pm8001_ha, tag); -complete (pm8001_ha->nvmd_completion); }int pm8001_mpi_local_phy_ctl (struct pm8001_hba_info *pm8001_ha,void *piomb)
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 34/217 scsi: ufs: Allow an error return value from ->device_reset()
In reply to Sasha LevinFrom: Adrian Hunter <[email protected]>
[ Upstream commit 151f1b664ffbb847c7fbbce5a5b8580f1b9b1d98 ]
It is simpler for drivers to provide a ->device_reset() callback irrespective of whether the GPIO, or firmware interface necessary to do the reset, is discovered during probe.
Change ->device_reset() to return an error code. Drivers that provide the callback, but do not do the reset operation should return -EOPNOTSUPP.
--- drivers/scsi/ufs/ufs-mediatek.c | 4 +++- drivers/scsi/ufs/ufs-qcom.c | 6 ++++-- drivers/scsi/ufs/ufshcd.h | 11 +++++++---- 3 files changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +3 -1
@@ -743,7 +743,7 @@ static int ufs_mtk_link_startup_notify(struct ufs_hba *hba,return ret; } -static void ufs_mtk_device_reset (struct ufs_hba *hba) +static int ufs_mtk_device_reset (struct ufs_hba *hba) {struct arm_smccc_res res;
@@ -764,6 +764,8 @@ static void ufs_mtk_device_reset(struct ufs_hba *hba)usleep_range (10000 ,15000 );dev_info (hba->dev,"device reset done\n" ); + +return 0 ; }static int ufs_mtk_link_set_hpm (struct ufs_hba *hba)
drivers/scsi/ufs/ufs-qcom.c +4 -2
@@ -1421,13 +1421,13 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)* * Toggles the (optional) reset line to reset the attached device. */ -static void ufs_qcom_device_reset (struct ufs_hba *hba) +static int ufs_qcom_device_reset (struct ufs_hba *hba) {struct ufs_qcom_host *host =ufshcd_get_variant (hba);/* reset gpio is optional */ if (!host->device_reset) -return ; +return -EOPNOTSUPP ;/* * The UFS device shall detect reset pulses of 1us, sleep for 10us to
@@ -1438,6 +1438,8 @@ static void ufs_qcom_device_reset(struct ufs_hba *hba)gpiod_set_value_cansleep (host->device_reset,0 );usleep_range (10 ,15 ); + +return 0 ; }#if IS_ENABLED (CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND )
drivers/scsi/ufs/ufshcd.h +7 -4
@@ -318,7 +318,7 @@ struct ufs_hba_variant_ops {int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);int (*phy_initialization)(struct ufs_hba *); -void (*device_reset)(struct ufs_hba *hba); +int (*device_reset)(struct ufs_hba *hba);void (*config_scaling_param)(struct ufs_hba *hba,struct devfreq_dev_profile *profile,void *data);
@@ -1181,9 +1181,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)static inline void ufshcd_vops_device_reset (struct ufs_hba *hba) {if (hba->vops && hba->vops->device_reset) { - hba->vops->device_reset (hba); -ufshcd_set_ufs_dev_active (hba); -ufshcd_update_reg_hist (&hba->ufs_stats.dev_reset,0 ); +int err = hba->vops->device_reset (hba); + +if (!err) +ufshcd_set_ufs_dev_active (hba); +if (err != -EOPNOTSUPP ) +ufshcd_update_reg_hist (&hba->ufs_stats.dev_reset, err); } }
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Sasha Levin
maintainerPATCH 35/217 fcntl: Fix potential deadlock in send_sig{io, urg}()
In reply to Sasha LevinFrom: Boqun Feng <[email protected]>
[ Upstream commit 8d1ddb5e79374fb277985a6b3faa2ed8631c5b4c ]
Syzbot reports a potential deadlock found by the newly added recursive read deadlock detection in lockdep:
[...] ========================================================
[...] WARNING: possible irq lock inversion dependency detected
[...] 5.9.0-rc2-syzkaller #0 Not tainted
[...] --------------------------------------------------------
[...] syz-executor.1/10214 just changed the state of lock:
[...] ffff88811f506338 (&f->f_owner.lock){.+..}-{2:2}, at: send_sigurg+0x1d/0x200 [...] but this lock was taken by another, HARDIRQ-safe lock in the past:
[...] (&dev->event_lock){-...}-{2:2}
[...]
[...]
[...] and interrupts could create inverse lock ordering between them. [...]
[...]
[...] other info that might help us debug this:
[...] Chain exists of:
[...] &dev->event_lock --> &new->fa_lock --> &f->f_owner.lock
[...]
[...] Possible interrupt unsafe locking scenario:
[...]
[...] CPU0 CPU1 [...] ---- ---- [...] lock(&f->f_owner.lock); [...] local_irq_disable(); [...] lock(&dev->event_lock); [...] lock(&new->fa_lock);
[...] <Interrupt>
[...] lock(&dev->event_lock);
[...]
[...] *** DEADLOCK ***
The corresponding deadlock case is as followed:
CPU 0 CPU 1 CPU 2 read_lock(&fown->lock); spin_lock_irqsave(&dev->event_lock, ...) write_lock_irq(&filp->f_owner.lock); // wait for the lock read_lock(&fown-lock); // have to wait until the writer release // due to the fairness <interrupted> spin_lock_irqsave(&dev->event_lock); // wait for the lock
The lock dependency on CPU 1 happens if there exists a call sequence:
input_inject_event(): spin_lock_irqsave(&dev->event_lock,...); input_handle_event(): input_pass_values(): input_to_handler(): handler->event(): // evdev_event() evdev_pass_values(): spin_lock(&client->buffer_lock); __pass_event(): kill_fasync(): kill_fasync_rcu(): read_lock(&fa->fa_lock); send_sigio(): read_lock(&fown->lock);
To fix this, make the reader in send_sigurg() and send_sigio() use read_lock_irqsave() and read_lock_irqrestore().
--- fs/fcntl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/fcntl.c +6 -4
@@ -781,9 +781,10 @@ void send_sigio(struct fown_struct *fown, int fd, int band) {struct task_struct *p;enum pid_type type; +unsigned long flags;struct pid *pid; -read_lock (&fown->lock); +read_lock_irqsave (&fown->lock, flags); type = fown->pid_type; pid = fown->pid;
@@ -804,7 +805,7 @@ void send_sigio(struct fown_struct *fown, int fd, int band)read_unlock (&tasklist_lock); } out_unlock_fown: -read_unlock (&fown->lock); +read_unlock_irqrestore (&fown->lock, flags); } static void send_sigurg_to_task(struct task_struct *p,
@@ -819,9 +820,10 @@ int send_sigurg(struct fown_struct *fown)struct task_struct *p;enum pid_type type;struct pid *pid; +unsigned long flags;int ret =0 ; -read_lock (&fown->lock); +read_lock_irqsave (&fown->lock, flags); type = fown->pid_type; pid = fown->pid;
@@ -844,7 +846,7 @@ int send_sigurg(struct fown_struct *fown)read_unlock (&tasklist_lock); } out_unlock_fown: -read_unlock (&fown->lock); +read_unlock_irqrestore (&fown->lock, flags);return ret; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 36/217 drm/amdgpu: add missing clock gating info in amdgpu_pm_info
In reply to Sasha LevinFrom: Kevin Wang <[email protected]>
[ Upstream commit 71037bfc78bf63a6640792ace925741767fb6bfc ]
add missing clock gating informations in amdgpu_pm_info
1. AMD_CG_SUPPORT_VCN_MGCG
2. AMD_CG_SUPPORT_HDP_DS
3. AMD_CG_SUPPORT_HDP_SD
4. AMD_CG_SUPPORT_IH_CG
5. AMD_CG_SUPPORT_JPEG_MGCG
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +5 -0
@@ -63,6 +63,11 @@ static const struct cg_flag_name clocks[] = { {AMD_CG_SUPPORT_DRM_LS, "Digital Right Management Light Sleep"}, {AMD_CG_SUPPORT_ROM_MGCG, "Rom Medium Grain Clock Gating"}, {AMD_CG_SUPPORT_DF_MGCG, "Data Fabric Medium Grain Clock Gating"}, + {AMD_CG_SUPPORT_VCN_MGCG, "VCN Medium Grain Clock Gating"}, + {AMD_CG_SUPPORT_HDP_DS, "Host Data Path Deep Sleep"}, + {AMD_CG_SUPPORT_HDP_SD, "Host Data Path Shutdown"}, + {AMD_CG_SUPPORT_IH_CG, "Interrupt Handler Clock Gating"}, + {AMD_CG_SUPPORT_JPEG_MGCG, "JPEG Medium Grain Clock Gating"}, {AMD_CG_SUPPORT_ATHUB_MGCG, "Address Translation Hub Medium Grain Clock Gating"}, {AMD_CG_SUPPORT_ATHUB_LS, "Address Translation Hub Light Sleep"},
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 37/217 mac80211: don't overwrite QoS TID of injected frames
In reply to Sasha LevinFrom: Mathy Vanhoef <[email protected]>
[ Upstream commit 527d675969a1dff17baa270d4447ac1c87058299 ]
Currently ieee80211_set_qos_hdr sets the QoS TID of all frames based on the value assigned to skb->priority. This means it will also overwrite the QoS TID of injected frames. The commit 753ffad3d624 ("mac80211: fix TID field in monitor mode transmit") prevented injected frames from being modified because of this by setting skb->priority to the TID of the injected frame, which assured the QoS TID will not be changed to a different value. Unfortunately, this workaround complicates the handling of injected frames because we can't set skb->priority without affecting the TID value in the QoS field of injected frames.
To avoid this, and to simplify the next patch, detect if a frame is injected in ieee80211_set_qos_hdr and if so do not change its QoS field.
--- net/mac80211/tx.c | 5 +---- net/mac80211/wme.c | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-)
net/mac80211/tx.c +1 -4
@@ -2279,10 +2279,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, payload[7]); } -/* -* Initialize skb->priority for QoS frames. This is put in the TID field -* of the frame before passing it to the driver. -*/ +/* Initialize skb->priority for QoS frames */ if (ieee80211_is_data_qos (hdr->frame_control)) {u8 *p =ieee80211_get_qos_ctl (hdr); skb->priority = *p &IEEE80211_QOS_CTL_TAG1D_MASK ;
net/mac80211/wme.c +8 -0
@@ -249,6 +249,14 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, p =ieee80211_get_qos_ctl (hdr); +/* don't overwrite the QoS field of injected frames */ +if (info->flags &IEEE80211_TX_CTL_INJECTED ) { +/* do take into account Ack policy of injected frames */ +if (*p &IEEE80211_QOS_CTL_ACK_POLICY_NOACK ) + info->flags |=IEEE80211_TX_CTL_NO_ACK ; +return ; + } +/* set up the first byte */ /*
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 38/217 staging: ks7010: fix missing destroy_workqueue() on error in ks7010_sdio_probe
In reply to Sasha LevinFrom: Qinglang Miao <[email protected]>
[ Upstream commit d1e7550ad081fa5e9260f636dd51e1c496e0fd5f ]
Add the missing destroy_workqueue() before return from ks7010_sdio_probe in the error handling case.
--- drivers/staging/ks7010/ks7010_sdio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/ks7010/ks7010_sdio.c +3 -1
@@ -1029,10 +1029,12 @@ static int ks7010_sdio_probe(struct sdio_func *func, ret =register_netdev (priv->net_dev);if (ret) - goto err_free_netdev; + goto err_destroy_wq;return 0 ; + err_destroy_wq: +destroy_workqueue (priv->wq); err_free_netdev:free_netdev (netdev); err_release_irq:
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 39/217 staging: rtl8192u: fix wrong judgement in rtl8192_rx_isr
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit 071dc1787a2f8bb636f864c1f306280deea3b1d5 ]
The 'EPERM' cannot appear in the previous path, we should use '-EPERM' to check it. For example:
Call trace:
->rtl8192_rx_isr
->usb_submit_urb
->usb_hcd_submit_urb
->rh_urb_enqueue
->rh_queue_status
->usb_hcd_link_urb_to_ep--- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -1
@@ -867,7 +867,7 @@ static void rtl8192_rx_isr(struct urb *urb) urb->context = skb;skb_queue_tail (&priv->rx_queue, skb); err =usb_submit_urb (urb,GFP_ATOMIC ); -if (err && err !=EPERM ) +if (err && err != -EPERM )netdev_err (dev,"can not submit rxurb, err is %x, URB status is %x\n" , err, urb->status);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 40/217 mips: ar7: add missing iounmap() on error in ar7_gpio_init
In reply to Sasha LevinFrom: Qinglang Miao <[email protected]>
[ Upstream commit 5a5aa912f687204d50455d0db36f94dd8de601c2 ]
Add the missing iounmap() of gpch->regs before return from ar7_gpio_init() in the error handling case.
--- arch/mips/ar7/gpio.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/ar7/gpio.c +1 -0
@@ -319,6 +319,7 @@ int __init ar7_gpio_init(void)if (ret) {printk (KERN_ERR "%s: failed to add gpiochip\n" , gpch->chip.label); +iounmap (gpch->regs);return ret; } printk(KERN_INFO "%s: registered %d GPIOs\n",
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 41/217 mips: cm: add missing iounmap() on error in mips_cm_probe()
In reply to Sasha LevinFrom: Qinglang Miao <[email protected]>
[ Upstream commit 2673ecf9586551c5bcee499c1cc1949f6f7cc9a1 ]
Add the missing iounmap() of iounmap(mips_gcr_base) before return from mips_cm_probe() in the error handling case.
--- arch/mips/kernel/mips-cm.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/kernel/mips-cm.c +1 -0
@@ -266,6 +266,7 @@ int mips_cm_probe(void)if ((base_reg &CM_GCR_BASE_GCRBASE ) != addr) {pr_err ("GCRs appear to have been moved (expected them at 0x%08lx)!\n" , (unsigned long )addr); +iounmap (mips_gcr_base); mips_gcr_base =NULL ;return -ENODEV ; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 42/217 usb: typec: ucsi: Work around PPM losing change information
In reply to Sasha LevinFrom: Benjamin Berg <[email protected]>
[ Upstream commit 217504a055325fe76ec1142aa15f14d3db77f94f ]
Some/many PPMs are simply clearing the change bitfield when a notification on a port is acknowledge. Unfortunately, doing so means that any changes between the GET_CONNECTOR_STATUS and ACK_CC_CI commands is simply lost.
Work around this by re-fetching the connector status afterwards. We can then infer any changes that we see have happened but that may not be respresented in the change bitfield.
We end up with the following actions:
1. UCSI_GET_CONNECTOR_STATUS, store result, update unprocessed_changes
2. UCSI_GET_CAM_SUPPORTED, discard result
3. ACK connector change
4. UCSI_GET_CONNECTOR_STATUS, store result
5. Infere lost changes by comparing UCSI_GET_CONNECTOR_STATUS results
6. If PPM reported a new change, then restart in order to ACK
7. Process everything as usual.
The worker is also changed to re-schedule itself if a new change notification happened while it was running.
Doing this fixes quite commonly occurring issues where e.g. the UCSI power supply would remain online even thought the ThunderBolt cable was unplugged.
--- drivers/usb/typec/ucsi/ucsi.c | 125 ++++++++++++++++++++++++++++------ drivers/usb/typec/ucsi/ucsi.h | 2 + 2 files changed, 107 insertions(+), 20 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +105 -20
@@ -53,7 +53,7 @@ static int ucsi_acknowledge_connector_change(struct ucsi *ucsi) ctrl =UCSI_ACK_CC_CI ; ctrl |=UCSI_ACK_CONNECTOR_CHANGE ; -return ucsi->ops->async_write (ucsi,UCSI_CONTROL , &ctrl,sizeof (ctrl)); +return ucsi->ops->sync_write (ucsi,UCSI_CONTROL , &ctrl,sizeof (ctrl)); }static int ucsi_exec_command (struct ucsi *ucsi,u64 command);
@@ -625,21 +625,113 @@ static void ucsi_handle_connector_change(struct work_struct *work) struct ucsi_connector *con = container_of(work, struct ucsi_connector, work);struct ucsi *ucsi = con->ucsi; +struct ucsi_connector_status pre_ack_status; +struct ucsi_connector_status post_ack_status;enum typec_role role; +u16 inferred_changes; +u16 changed_flags;u64 command;int ret;mutex_lock (&con->lock); +/* +* Some/many PPMs have an issue where all fields in the change bitfield +* are cleared when an ACK is send. This will causes any change +* between GET_CONNECTOR_STATUS and ACK to be lost. +* +* We work around this by re-fetching the connector status afterwards. +* We then infer any changes that we see have happened but that may not +* be represented in the change bitfield. +* +* Also, even though we don't need to know the currently supported alt +* modes, we run the GET_CAM_SUPPORTED command to ensure the PPM does +* not get stuck in case it assumes we do. +* Always do this, rather than relying on UCSI_CONSTAT_CAM_CHANGE to be +* set in the change bitfield. +* +* We end up with the following actions: +* 1. UCSI_GET_CONNECTOR_STATUS, store result, update unprocessed_changes +* 2. UCSI_GET_CAM_SUPPORTED, discard result +* 3. ACK connector change +* 4. UCSI_GET_CONNECTOR_STATUS, store result +* 5. Infere lost changes by comparing UCSI_GET_CONNECTOR_STATUS results +* 6. If PPM reported a new change, then restart in order to ACK +* 7. Process everything as usual. +* +* We may end up seeing a change twice, but we can only miss extremely +* short transitional changes. +*/ + +/* 1. First UCSI_GET_CONNECTOR_STATUS */ + command =UCSI_GET_CONNECTOR_STATUS |UCSI_CONNECTOR_NUMBER (con->num); + ret =ucsi_send_command (ucsi, command, &pre_ack_status, +sizeof (pre_ack_status)); +if (ret <0 ) { +dev_err (ucsi->dev,"%s: GET_CONNECTOR_STATUS failed (%d)\n" , + __func__, ret); + goto out_unlock; + } + con->unprocessed_changes |= pre_ack_status.change; + +/* 2. Run UCSI_GET_CAM_SUPPORTED and discard the result. */ + command =UCSI_GET_CAM_SUPPORTED ; + command |=UCSI_CONNECTOR_NUMBER (con->num); +ucsi_send_command (con->ucsi, command,NULL ,0 ); + +/* 3. ACK connector change */ +clear_bit (EVENT_PENDING , &ucsi->flags); + ret =ucsi_acknowledge_connector_change (ucsi); +if (ret) { +dev_err (ucsi->dev,"%s: ACK failed (%d)" , __func__, ret); + goto out_unlock; + } + +/* 4. Second UCSI_GET_CONNECTOR_STATUS */ command =UCSI_GET_CONNECTOR_STATUS |UCSI_CONNECTOR_NUMBER (con->num); - ret =ucsi_send_command (ucsi, command, &con->status, -sizeof (con->status)); + ret =ucsi_send_command (ucsi, command, &post_ack_status, +sizeof (post_ack_status));if (ret <0 ) {dev_err (ucsi->dev,"%s: GET_CONNECTOR_STATUS failed (%d)\n" , __func__, ret); goto out_unlock; } +/* 5. Inferre any missing changes */ + changed_flags = pre_ack_status.flags ^ post_ack_status.flags; + inferred_changes =0 ; +if (UCSI_CONSTAT_PWR_OPMODE (changed_flags) !=0 ) + inferred_changes |=UCSI_CONSTAT_POWER_OPMODE_CHANGE ; + +if (changed_flags &UCSI_CONSTAT_CONNECTED ) + inferred_changes |=UCSI_CONSTAT_CONNECT_CHANGE ; + +if (changed_flags &UCSI_CONSTAT_PWR_DIR ) + inferred_changes |=UCSI_CONSTAT_POWER_DIR_CHANGE ; + +if (UCSI_CONSTAT_PARTNER_FLAGS (changed_flags) !=0 ) + inferred_changes |=UCSI_CONSTAT_PARTNER_CHANGE ; + +if (UCSI_CONSTAT_PARTNER_TYPE (changed_flags) !=0 ) + inferred_changes |=UCSI_CONSTAT_PARTNER_CHANGE ; + +/* Mask out anything that was correctly notified in the later call. */ + inferred_changes &= ~post_ack_status.change; +if (inferred_changes) +dev_dbg (ucsi->dev,"%s: Inferred changes that would have been lost: 0x%04x\n" , + __func__, inferred_changes); + + con->unprocessed_changes |= inferred_changes; + +/* 6. If PPM reported a new change, then restart in order to ACK */ +if (post_ack_status.change) + goto out_unlock; + +/* 7. Continue as if nothing happened */ + con->status = post_ack_status; + con->status.change = con->unprocessed_changes; + con->unprocessed_changes =0 ; + role = !!(con->status.flags &UCSI_CONSTAT_PWR_DIR ); if (con->status.change & UCSI_CONSTAT_POWER_OPMODE_CHANGE ||
@@ -680,28 +772,19 @@ static void ucsi_handle_connector_change(struct work_struct *work)ucsi_port_psy_changed (con); } -if (con->status.change &UCSI_CONSTAT_CAM_CHANGE ) { -/* -* We don't need to know the currently supported alt modes here. -* Running GET_CAM_SUPPORTED command just to make sure the PPM -* does not get stuck in case it assumes we do so. -*/ - command =UCSI_GET_CAM_SUPPORTED ; - command |=UCSI_CONNECTOR_NUMBER (con->num); -ucsi_send_command (con->ucsi, command,NULL ,0 ); - } -if (con->status.change &UCSI_CONSTAT_PARTNER_CHANGE )ucsi_partner_change (con); - ret =ucsi_acknowledge_connector_change (ucsi); -if (ret) -dev_err (ucsi->dev,"%s: ACK failed (%d)" , __func__, ret); -trace_ucsi_connector_change (con->num, &con->status); out_unlock: -clear_bit (EVENT_PENDING , &ucsi->flags); +if (test_and_clear_bit (EVENT_PENDING , &ucsi->flags)) { +schedule_work (&con->work); +mutex_unlock (&con->lock); +return ; + } + +clear_bit (EVENT_PROCESSING , &ucsi->flags);mutex_unlock (&con->lock); }
@@ -719,7 +802,9 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num)return ; } -if (!test_and_set_bit (EVENT_PENDING , &ucsi->flags)) +set_bit (EVENT_PENDING , &ucsi->flags); + +if (!test_and_set_bit (EVENT_PROCESSING , &ucsi->flags))schedule_work (&con->work); }EXPORT_SYMBOL_GPL (ucsi_connector_change);
drivers/usb/typec/ucsi/ucsi.h +2 -0
@@ -296,6 +296,7 @@ struct ucsi {#define EVENT_PENDING 0#define COMMAND_PENDING 1#define ACK_PENDING 2 +#define EVENT_PROCESSING 3 };#define UCSI_MAX_SVID 5
@@ -322,6 +323,7 @@ struct ucsi_connector {struct typec_capability typec_cap; +u16 unprocessed_changes;struct ucsi_connector_status status;struct ucsi_connector_capability cap;struct power_supply *psy;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 43/217 rcuscale: Prevent hangs for invalid arguments
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 2f2214d43ccd27ac6d124287107c136a0f7c6053 ]
If an rcuscale torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a rcu_scale_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error.
--- kernel/rcu/rcuscale.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +4 -1
@@ -772,7 +772,6 @@ rcu_scale_init(void)for (i =0 ; i <ARRAY_SIZE (scale_ops); i++)pr_cont (" %s" , scale_ops[i]->name);pr_cont ("\n" ); -WARN_ON (!IS_MODULE (CONFIG_RCU_SCALE_TEST )); firsterr = -EINVAL ; cur_ops =NULL ; goto unwind;
@@ -846,6 +845,10 @@ rcu_scale_init(void) unwind:torture_init_end ();rcu_scale_cleanup (); +if (shutdown) { +WARN_ON (!IS_MODULE (CONFIG_RCU_SCALE_TEST )); +kernel_power_off (); + }return firsterr; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 44/217 refscale: Prevent hangs for invalid arguments
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit bc80d353b3f565138cda7e95ed4020e6e69360b2 ]
If an refscale torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a ref_scale_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error.
--- kernel/rcu/refscale.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/refscale.c +4 -1
@@ -658,7 +658,6 @@ ref_scale_init(void)for (i =0 ; i <ARRAY_SIZE (scale_ops); i++)pr_cont (" %s" , scale_ops[i]->name);pr_cont ("\n" ); -WARN_ON (!IS_MODULE (CONFIG_RCU_REF_SCALE_TEST )); firsterr = -EINVAL ; cur_ops =NULL ; goto unwind;
@@ -712,6 +711,10 @@ ref_scale_init(void) unwind:torture_init_end ();ref_scale_cleanup (); +if (shutdown) { +WARN_ON (!IS_MODULE (CONFIG_RCU_REF_SCALE_TEST )); +kernel_power_off (); + }return firsterr; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 45/217 locktorture: Prevent hangs for invalid arguments
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 6b74fa0a776e3715d385b23d29db469179c825b0 ]
If an locktorture torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a lock_torture_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error.
--- kernel/locking/locktorture.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/locking/locktorture.c +5 -0
@@ -29,6 +29,7 @@#include <linux/slab.h> #include <linux/percpu-rwsem.h> #include <linux/torture.h> +#include <linux/reboot.h> MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" );
@@ -1038,6 +1039,10 @@ static int __init lock_torture_init(void) unwind:torture_init_end ();lock_torture_cleanup (); +if (shutdown_secs) { +WARN_ON (!IS_MODULE (CONFIG_LOCK_TORTURE_TEST )); +kernel_power_off (); + }return firsterr; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 46/217 torture: Prevent jitter processes from delaying failed run
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit c64659ef29e3901be0900ec6fb0485fa3dbdcfd8 ]
Even when the kernel panics and qemu dies, runs with jitter enabled will continue uselessly until the jitter.sh processes terminate. This can be annoying if a planned one-hour run instead dies during boot.
This commit therefore kills the jitter.sh processes when the run ends more than one minute prior to the termination time specified by the kvm.sh --duration argument or its default.
--- .../selftests/rcutorture/bin/kvm-test-1-run.sh | 14 ++++++++++++++ tools/testing/selftests/rcutorture/bin/kvm.sh | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +14 -0
@@ -223,6 +223,20 @@ do echo "ps -fp $killpid" >> $resdir/Warnings 2>&1 ps -fp $killpid >> $resdir/Warnings 2>&1 fi + # Reduce probability of PID reuse by allowing a one-minute buffer + if test $((kruntime + 60)) -lt $seconds && test -s "$resdir/../jitter_pids" + then + awk < "$resdir/../jitter_pids" ' + NF > 0 { + pidlist = pidlist " " $1; + n++; + } + END { + if (n > 0) { + print "kill " pidlist; + } + }' | sh + fi else echo ' ---' `date`: "Kernel done" fi
tools/testing/selftests/rcutorture/bin/kvm.sh +4 -1
@@ -459,8 +459,11 @@ function dump(first, pastlast, batchnum) print "if test -n \"$needqemurun\"" print "then" print "\techo ---- Starting kernels. `date` | tee -a " rd "log"; - for (j = 0; j < njitter; j++) + print "\techo > " rd "jitter_pids" + for (j = 0; j < njitter; j++) { print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&" + print "\techo $! >> " rd "jitter_pids" + } print "\twait" print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log"; print "else"
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 47/217 rcutorture: Prevent hangs for invalid arguments
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 4994684ce10924a0302567c315c91b0a64eeef46 ]
If an rcutorture torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a rcu_torture_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error.
--- kernel/rcu/rcutorture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/rcutorture.c +4 -1
@@ -2647,7 +2647,6 @@ rcu_torture_init(void)for (i =0 ; i <ARRAY_SIZE (torture_ops); i++)pr_cont (" %s" , torture_ops[i]->name);pr_cont ("\n" ); -WARN_ON (!IS_MODULE (CONFIG_RCU_TORTURE_TEST )); firsterr = -EINVAL ; cur_ops =NULL ; goto unwind;
@@ -2815,6 +2814,10 @@ rcu_torture_init(void) unwind:torture_init_end ();rcu_torture_cleanup (); +if (shutdown_secs) { +WARN_ON (!IS_MODULE (CONFIG_RCU_TORTURE_TEST )); +kernel_power_off (); + }return firsterr; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 48/217 kcsan: Fix encoding masks and regain address bit
In reply to Sasha LevinFrom: Marco Elver <[email protected]>
[ Upstream commit 1d094cefc37e5ed4dec44a41841c8628f6b548a2 ]
The watchpoint encoding masks for size and address were off-by-one bit each, with the size mask using 1 unnecessary bit and the address mask missing 1 bit. However, due to the way the size is shifted into the encoded watchpoint, we were effectively wasting and never using the extra bit.
For example, on x86 with PAGE_SIZE==4K, we have 1 bit for the is-write bit, 14 bits for the size bits, and then 49 bits left for the address. Prior to this fix we would end up with this usage:
[ write<1> | size<14> | wasted<1> | address<48> ]
Fix it by subtracting 1 bit from the GENMASK() end and start ranges of size and address respectively. The added static_assert()s verify that the masks are as expected. With the fixed version, we get the expected usage:
[ write<1> | size<14> | address<49> ]
Functionally no change is expected, since that extra address bit is insignificant for enabled architectures.
--- kernel/kcsan/encoding.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
kernel/kcsan/encoding.h +6 -8
@@ -37,14 +37,12 @@*/ #define WATCHPOINT_ADDR_BITS (BITS_PER_LONG-1 - WATCHPOINT_SIZE_BITS) -/* -* Masks to set/retrieve the encoded data. -*/ -#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG-1) -#define WATCHPOINT_SIZE_MASK \ - GENMASK(BITS_PER_LONG-2, BITS_PER_LONG-2 - WATCHPOINT_SIZE_BITS) -#define WATCHPOINT_ADDR_MASK \ - GENMASK(BITS_PER_LONG-3 - WATCHPOINT_SIZE_BITS, 0) +/* Bitmasks for the encoded watchpoint access information. */ +#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG-1) +#define WATCHPOINT_SIZE_MASK GENMASK(BITS_PER_LONG-2, WATCHPOINT_ADDR_BITS) +#define WATCHPOINT_ADDR_MASK GENMASK(WATCHPOINT_ADDR_BITS-1, 0) +static_assert (WATCHPOINT_ADDR_MASK == (1UL <<WATCHPOINT_ADDR_BITS ) -1 ); +static_assert ((WATCHPOINT_WRITE_MASK ^WATCHPOINT_SIZE_MASK ^WATCHPOINT_ADDR_MASK ) == ~0UL );static inline bool check_encodable (unsigned long addr,size_t size) {
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 49/217 ath10k: fix compilation warning
In reply to Sasha LevinFrom: Tamizh Chelvam <[email protected]>
[ Upstream commit b9162645117841978a3fb31546409271e007dd28 ]
This change fixes below compilation warning.
smatch warnings:
drivers/net/wireless/ath/ath10k/mac.c:9125 ath10k_mac_op_set_tid_config() error: uninitialized symbol 'ret'.
No functional changes. Compile tested only.
--- drivers/net/wireless/ath/ath10k/mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +2 -1
@@ -9169,10 +9169,11 @@ static int ath10k_mac_op_set_tid_config(struct ieee80211_hw *hw, goto exit; } + ret =0 ; +if (sta) goto exit; - ret =0 ; arvif->tids_rst =0 ; data.curr_vif = vif; data.ar = ar;
Signature · 7 lines
2.27.0 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 50/217 rsi: Fix TX EAPOL packet handling against iwlwifi AP
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 65277100caa2f2c62b6f3c4648b90d6f0435f3bc ]
In case RSI9116 SDIO WiFi operates in STA mode against Intel 9260 in AP mode, the association fails. The former is using wpa_supplicant during association, the later is set up using hostapd:
iwl$ cat hostapd.conf
interface=wlp1s0
ssid=test
country_code=DE
hw_mode=g
channel=1
wpa=2
wpa_passphrase=test
wpa_key_mgmt=WPA-PSK
iwl$ hostapd -d hostapd.conf
rsi$ wpa_supplicant -i wlan0 -c <(wpa_passphrase test test)
The problem is that the TX EAPOL data descriptor RSI_DESC_REQUIRE_CFM_TO_HOST flag and extended descriptor EAPOL4_CONFIRM frame type are not set in case the AP is iwlwifi, because in that case the TX EAPOL packet is 2 bytes shorter.
The downstream vendor driver has this change in place already [1], however there is no explanation for it, neither is there any commit history from which such explanation could be obtained.
[1] https://github.com/SiliconLabs/RS911X-nLink-OSD/blob/master/rsi/rsi_91x_hal.c#L238
--- drivers/net/wireless/rsi/rsi_91x_hal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_hal.c +2 -1
@@ -248,7 +248,8 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)rsi_set_len_qno (&data_desc->len_qno, (skb->len -FRAME_DESC_SZ ),RSI_WIFI_MGMT_Q ); -if ((skb->len - header_size) ==EAPOL4_PACKET_LEN ) { +if (((skb->len - header_size) ==EAPOL4_PACKET_LEN ) || + ((skb->len - header_size) ==EAPOL4_PACKET_LEN -2 )) { data_desc->misc_flags |=RSI_DESC_REQUIRE_CFM_TO_HOST ; xtend_desc->confirm_frame_type =EAPOL4_CONFIRM ;
Signature · 1 line
2.27.0
Re: [PATCH AUTOSEL 5.10 050/217] rsi: Fix TX EAPOL packet handling against iwlwifi AP
On 12/23/20 3:13 AM, Sasha Levin wrote:
Hello Sasha,
Quoted 7 lines
From: Marek Vasut <[email protected]>
[ Upstream commit
65277100caa2f2c62b6f3c4648b90d6f0435f3bc]In case RSI9116 SDIO WiFi operates in STA mode against Intel 9260 in AP mode, the association fails. The former is using
wpa_supplicantduring association, the later is set up using hostapd:
[...]
Was this patch possibly missed from 5.10.y ?
Also, while at it, I think it might make sense to pick the following two patches as well, they dramatically reduce interrupt rate of the RSI WiFi device, so it stops overloading lower-end devices:287431463e786 ("rsi: Move card interrupt handling to RX thread")abd131a19f6b8 ("rsi: Clean up loop in the interrupt handler")
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.10 050/217] rsi: Fix TX EAPOL packet handling against iwlwifi AP
Quoted 8 lines · Marek Vasut
On 12/23/20 3:13 AM, Sasha Levin wrote:
Hello Sasha,
Quoted 4 lines
From: Marek Vasut <[email protected]>
[ Upstream commit
65277100caa2f2c62b6f3c4648b90d6f0435f3bc]
Quoted 7 lines
Quoted 3 lines
In case RSI9116 SDIO WiFi operates in STA mode against Intel 9260 in AP mode, the association fails. The former is using
wpa_supplicantduring association, the later is set up using hostapd:[...]
Was this patch possibly missed from 5.10.y ?
I'm not sure what happened there, but I can queue it up.
Quoted 2 lines
Also, while at it, I think it might make sense to pick the following two patches as well, they dramatically reduce interrupt rate of the RSI WiFi device, so it stops overloading lower-end devices:
287431463e786("rsi: Move card interrupt handling to RX thread")
And this one too.
Quoted 1 line
abd131a19f6b8("rsi: Clean up loop in the interrupt handler")
But not this one, it looks like just a cleanup. Why is it needed?
Signature · 2 lines
Thanks, Sasha
Re: [PATCH AUTOSEL 5.10 050/217] rsi: Fix TX EAPOL packet handling against iwlwifi AP
Quoted 13 lines · Sasha Levin
Quoted 12 lines · Marek Vasut
On 12/23/20 3:13 AM, Sasha Levin wrote:
Hello Sasha,
Quoted 7 lines
From: Marek Vasut <[email protected]>
[ Upstream commit
65277100caa2f2c62b6f3c4648b90d6f0435f3bc]In case RSI9116 SDIO WiFi operates in STA mode against Intel 9260 in AP mode, the association fails. The former is using
wpa_supplicantduring association, the later is set up using hostapd:
Quoted 5 lines
Quoted 3 lines
[...]
Was this patch possibly missed from 5.10.y ?
I'm not sure what happened there, but I can queue it up.
Thank you
Quoted 4 lines
Quoted 2 lines
Also, while at it, I think it might make sense to pick the following two patches as well, they dramatically reduce interrupt rate of the RSI WiFi device, so it stops overloading lower-end devices:
287431463e786("rsi: Move card interrupt handling to RX thread")And this one too.
Thanks
Quoted 3 lines
Quoted 1 line
abd131a19f6b8("rsi: Clean up loop in the interrupt handler")But not this one, it looks like just a cleanup. Why is it needed?
Now I got confused, yes, please skip abd131a19f6b8, thanks for spotting it. (I still have one more patch for the RSI wifi which I need to send out, but that's for later)
Sasha Levin
maintainerPATCH 51/217 thermal: intel: pch: fix S0ix failure due to PCH temperature above threshold
In reply to Sasha LevinFrom: Sumeet Pawnikar <[email protected]>
[ Upstream commit ef63b043ac8645d2540d7b50dd3e09c53db3d504 ]
When system tries to enter S0ix suspend state, just after active load scenarios, it fails due to PCH current temperature is higher than set threshold.
This patch introduces delay loop mechanism that allows PCH temperature to go down below threshold during suspend so it won't fail to enter S0ix. Add delay loop timeout and count as module parameters for user to tune it, if required based on system design. This change notifies the different warning messages like when PCH temperature above the threshold and executing delay loop. Also, notify the messages when it success or failure for S0ix entry.
Previously out of 1000 runs around 3 to 5 times it might fail to enter S0ix just after heavy workload. With this change, S0ix failures reduced as PCH cools down below threshold.
--- drivers/thermal/intel/intel_pch_thermal.c | 76 +++++++++++++++++++++-- 1 file changed, 70 insertions(+), 6 deletions(-)
drivers/thermal/intel/intel_pch_thermal.c +70 -6
@@ -7,14 +7,16 @@* Tushar Dave <[email protected]> */ +#include <linux/acpi.h> +#include <linux/delay.h> #include <linux/module.h> -#include <linux/types.h> #include <linux/init.h> #include <linux/pci.h> -#include <linux/acpi.h> +#include <linux/pm.h> +#include <linux/suspend.h> #include <linux/thermal.h> +#include <linux/types.h> #include <linux/units.h> -#include <linux/pm.h> /* Intel PCH thermal Device IDs */ #define PCH_THERMAL_DID_HSW_1 0x9C24/* Haswell PCH */
@@ -35,6 +37,7 @@#define WPT_TSREL 0x0A/* Thermal Sensor Report Enable and Lock */ #define WPT_TSMIC 0x0C/* Thermal Sensor SMI Control */ #define WPT_CTT 0x0010/* Catastrophic Trip Point */ +#define WPT_TSPM 0x001C/* Thermal Sensor Power Management */ #define WPT_TAHV 0x0014/* Thermal Alert High Value */ #define WPT_TALV 0x0018/* Thermal Alert Low Value */ #define WPT_TL 0x00000040/* Throttle Value */
@@ -55,6 +58,22 @@#define WPT_TL_T1L 0x1ff00000/* T1 Level */ #define WPT_TL_TTEN 0x20000000/* TT Enable */ +/* Resolution of 1/2 degree C and an offset of -50C */ +#define PCH_TEMP_OFFSET (-50) +#define GET_WPT_TEMP (x) ((x) * MILLIDEGREE_PER_DEGREE / 2 + WPT_TEMP_OFFSET) +#define WPT_TEMP_OFFSET (PCH_TEMP_OFFSET * MILLIDEGREE_PER_DEGREE) +#define GET_PCH_TEMP (x) (((x) / 2) + PCH_TEMP_OFFSET) + +/* Amount of time for each cooling delay, 100ms by default for now */ +static unsigned int delay_timeout =100 ; +module_param (delay_timeout, int,0644 ); +MODULE_PARM_DESC (delay_timeout,"amount of time delay for each iteration." ); + +/* Number of iterations for cooling delay, 10 counts by default for now */ +static unsigned int delay_cnt =10 ; +module_param (delay_cnt, int,0644 ); +MODULE_PARM_DESC (delay_cnt,"total number of iterations for time delay." ); +static char driver_name[] ="Intel PCH thermal driver" ;struct pch_thermal_device {
@@ -183,13 +202,58 @@ static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp)static int pch_wpt_suspend (struct pch_thermal_device *ptd) {u8 tsel; +u8 pch_delay_cnt =1 ; +u16 pch_thr_temp, pch_cur_temp; -if (ptd->bios_enabled) +/* Shutdown the thermal sensor if it is not enabled by BIOS */ +if (!ptd->bios_enabled) { + tsel =readb (ptd->hw_base +WPT_TSEL ); +writeb (tsel &0xFE , ptd->hw_base +WPT_TSEL ); +return 0 ; + } + +/* Do not check temperature if it is not a S0ix capable platform */ +if (!(acpi_gbl_FADT.flags &ACPI_FADT_LOW_POWER_S0 ))return 0 ; - tsel =readb (ptd->hw_base +WPT_TSEL ); +/* Do not check temperature if it is not s2idle */ +if (pm_suspend_via_firmware ()) +return 0 ; + +/* Get the PCH temperature threshold value */ + pch_thr_temp =GET_PCH_TEMP (WPT_TEMP_TSR &readw (ptd->hw_base +WPT_TSPM )); + +/* Get the PCH current temperature value */ + pch_cur_temp =GET_PCH_TEMP (WPT_TEMP_TSR &readw (ptd->hw_base +WPT_TEMP )); -writeb (tsel &0xFE , ptd->hw_base +WPT_TSEL ); +/* +* If current PCH temperature is higher than configured PCH threshold +* value, run some delay loop with sleep to let the current temperature +* go down below the threshold value which helps to allow system enter +* lower power S0ix suspend state. Even after delay loop if PCH current +* temperature stays above threshold, notify the warning message +* which helps to indentify the reason why S0ix entry was rejected. +*/ +while (pch_delay_cnt <= delay_cnt) { +if (pch_cur_temp <= pch_thr_temp) +break ; + +dev_warn (&ptd->pdev->dev, +"CPU-PCH current temp [%dC] higher than the threshold temp [%dC], sleep %d times for %d ms duration\n" , + pch_cur_temp, pch_thr_temp, pch_delay_cnt, delay_timeout); +msleep (delay_timeout); +/* Read the PCH current temperature for next cycle. */ + pch_cur_temp =GET_PCH_TEMP (WPT_TEMP_TSR &readw (ptd->hw_base +WPT_TEMP )); + pch_delay_cnt++; + } + +if (pch_cur_temp > pch_thr_temp) +dev_warn (&ptd->pdev->dev, +"CPU-PCH is hot [%dC] even after delay, continue to suspend. S0ix might fail\n" , + pch_cur_temp); +else +dev_info (&ptd->pdev->dev, +"CPU-PCH is cool [%dC], continue to suspend\n" , pch_cur_temp);return 0 ; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 52/217 drm: panel: simple: add missing platform_driver_unregister() in panel_simple_init
In reply to Sasha LevinFrom: Qinglang Miao <[email protected]>
[ Upstream commit f2e66f212a9de04afc2caa5ec79057c0ac75c728 ]
Add the missing platform_driver_unregister() before return from panel_simple_init in the error handling case when failed to register panel_simple_dsi_driver with CONFIG_DRM_MIPI_DSI enabled.
--- drivers/gpu/drm/panel/panel-simple.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +3 -1
@@ -4644,8 +4644,10 @@ static int __init panel_simple_init(void)if (IS_ENABLED (CONFIG_DRM_MIPI_DSI )) { err =mipi_dsi_driver_register (&panel_simple_dsi_driver); -if (err <0 ) +if (err <0 ) { +platform_driver_unregister (&panel_simple_platform_driver);return err; + } }return 0 ;
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 53/217 drm/bridge: lvds-codec: Use dev_err_probe for error handling
In reply to Sasha LevinFrom: Biju Das <[email protected]>
[ Upstream commit 4178bd5a3c57e107b3df5e17de6dc60cb3890647 ]
dev_err_probe function simplifies error handling. So use the same in probe function wherever possible.
--- drivers/gpu/drm/bridge/lvds-codec.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/lvds-codec.c +3 -8
@@ -80,7 +80,6 @@ static int lvds_codec_probe(struct platform_device *pdev)struct device_node *panel_node;struct drm_panel *panel;struct lvds_codec *lvds_codec; -int ret; lvds_codec =devm_kzalloc (dev,sizeof (*lvds_codec),GFP_KERNEL );if (!lvds_codec)
@@ -90,13 +89,9 @@ static int lvds_codec_probe(struct platform_device *pdev) lvds_codec->connector_type = (uintptr_t )of_device_get_match_data (dev); lvds_codec->vcc =devm_regulator_get (lvds_codec->dev,"power" ); -if (IS_ERR (lvds_codec->vcc)) { - ret =PTR_ERR (lvds_codec->vcc); -if (ret != -EPROBE_DEFER ) -dev_err (lvds_codec->dev, -"Unable to get \"vcc\" supply: %d\n" , ret); -return ret; - } +if (IS_ERR (lvds_codec->vcc)) +return dev_err_probe (dev,PTR_ERR (lvds_codec->vcc), +"Unable to get \"vcc\" supply\n" ); lvds_codec->powerdown_gpio =devm_gpiod_get_optional (dev,"powerdown" ,GPIOD_OUT_HIGH );
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 54/217 drm/ast: Fixed 1920x1080 sync. polarity issue
In reply to Sasha LevinFrom: KuoHsiang Chou <[email protected]>
[ Upstream commit 2d26123dd9075df82f217364f585a3a6aab5412d ]
[Bug] Change the vertical synchroous polary of 1920x1080 @60Hz
from Negtive to Positive
--- drivers/gpu/drm/ast/ast_tables.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_tables.h +2 -2
@@ -293,10 +293,10 @@ static const struct ast_vbios_enhtable res_1600x900[] = {static const struct ast_vbios_enhtable res_1920x1080[] = { {2200 ,1920 ,88 ,44 ,1125 ,1080 ,4 ,5 ,VCLK148_5 ,/* 60Hz */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | AST2500PreCatchCRT),60 ,1 ,0x38 }, {2200 ,1920 ,88 ,44 ,1125 ,1080 ,4 ,5 ,VCLK148_5 ,/* 60Hz */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | AST2500PreCatchCRT),0xFF ,1 ,0x38 }, };
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 55/217 s390: make sure vmemmap is top region table entry aligned
In reply to Sasha LevinFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 97b142b7400bdce93aa674df044a4bc58e88f08c ]
Since commit 29d37e5b82f3 ("s390/protvirt: add ultravisor initialization") vmax is adjusted to the ultravisor secure storage limit. This limit is currently applied when 4-level paging is used. Later vmax is also used to align vmemmap address to the top region table entry border. When vmax is set to the ultravisor secure storage limit this is no longer the case.
Instead of changing vmax, make only MODULES_END be affected by the secure storage limit, so that vmax stays intact for further vmemmap address alignment.
--- arch/s390/kernel/setup.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/s390/kernel/setup.c +5 -4
@@ -567,13 +567,14 @@ static void __init setup_memory_end(void) vmax = _REGION2_SIZE;/* 3-level kernel page table */ else vmax = _REGION1_SIZE;/* 4-level kernel page table */ +/* module area is at the end of the kernel address space. */ +MODULES_END = vmax;if (is_prot_virt_host ()) -adjust_to_uv_max (&vmax); +adjust_to_uv_max (&MODULES_END );#ifdef CONFIG_KASAN - vmax = kasan_vmax; + vmax = _REGION1_SIZE; +MODULES_END = kasan_vmax;#endif -/* module area is at the end of the kernel address space. */ -MODULES_END = vmax;MODULES_VADDR =MODULES_END -MODULES_LEN ;VMALLOC_END =MODULES_VADDR ;VMALLOC_START =VMALLOC_END - vmalloc_size;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 56/217 s390/pci: remove races against pte updates
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
[ Upstream commit a67a88b0b8de16b4cd6ad50bfe0e03605904dc75 ]
Way back it was a reasonable assumptions that iomem mappings never change the pfn range they point at. But this has changed:
- gpu drivers dynamically manage their memory nowadays, invalidating ptes with unmap_mapping_range when buffers get moved
- contiguous dma allocations have moved from dedicated carvetouts to cma regions. This means if we miss the unmap the pfn might contain pagecache or anon memory (well anything allocated with GFP_MOVEABLE)
- even /dev/mem now invalidates mappings when the kernel requests that iomem region when CONFIG_IO_STRICT_DEVMEM is set, see
commit 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims the region")
Accessing pfns obtained from ptes without holding all the locks is therefore no longer a good idea. Fix this.
Since zpci_memcpy_from|toio seems to not do anything nefarious with locks we just need to open code get_pfn and follow_pfn and make sure we drop the locks only after we're done. The write function also needs the copy_from_user move, since we can't take userspace faults while holding the mmap sem.
--- arch/s390/pci/pci_mmio.c | 98 +++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 41 deletions(-)
arch/s390/pci/pci_mmio.c +57 -41
@@ -119,33 +119,15 @@ static inline int __memcpy_toio_inuser(void __iomem *dst,return rc; } -static long get_pfn (unsigned long user_addr,unsigned long access, -unsigned long *pfn) -{ -struct vm_area_struct *vma; -long ret; - -mmap_read_lock (current->mm); - ret = -EINVAL ; - vma =find_vma (current->mm, user_addr); -if (!vma) - goto out; - ret = -EACCES ; -if (!(vma->vm_flags & access)) - goto out; - ret =follow_pfn (vma, user_addr, pfn); -out: -mmap_read_unlock (current->mm); -return ret; -} - SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, const void __user *, user_buffer, size_t, length) {u8 local_buf[64 ];void __iomem *io_addr;void *buf; -unsigned long pfn; +struct vm_area_struct *vma; +pte_t *ptep; +spinlock_t *ptl;long ret;if (!zpci_is_enabled ())
@@ -158,7 +140,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,* We only support write access to MIO capable devices if we are on * a MIO enabled system. Otherwise we would have to check for every * address if it is a special ZPCI_ADDR and would have to do -* a get_pfn() which we don't need for MIO capable devices. Currently +* a pfn lookup which we don't need for MIO capable devices. Currently * ISM devices are the only devices without MIO support and there is no * known need for accessing these from userspace. */
@@ -176,21 +158,37 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, }else buf = local_buf; - ret =get_pfn (mmio_addr,VM_WRITE , &pfn); + ret = -EFAULT ; +if (copy_from_user (buf, user_buffer, length)) + goto out_free; + +mmap_read_lock (current->mm); + ret = -EINVAL ; + vma =find_vma (current->mm, mmio_addr); +if (!vma) + goto out_unlock_mmap; +if (!(vma->vm_flags & (VM_IO |VM_PFNMAP ))) + goto out_unlock_mmap; + ret = -EACCES ; +if (!(vma->vm_flags &VM_WRITE )) + goto out_unlock_mmap; + + ret =follow_pte_pmd (vma->vm_mm, mmio_addr,NULL , &ptep,NULL , &ptl);if (ret) - goto out; - io_addr = (void __iomem *)((pfn <<PAGE_SHIFT ) | + goto out_unlock_mmap; + + io_addr = (void __iomem *)((pte_pfn (*ptep) <<PAGE_SHIFT ) | (mmio_addr & ~PAGE_MASK )); - ret = -EFAULT ;if ((unsigned long ) io_addr <ZPCI_IOMAP_ADDR_BASE ) - goto out; - -if (copy_from_user (buf, user_buffer, length)) - goto out; + goto out_unlock_pt; ret =zpci_memcpy_toio (io_addr, buf, length); -out: +out_unlock_pt: +pte_unmap_unlock (ptep, ptl); +out_unlock_mmap: +mmap_read_unlock (current->mm); +out_free:if (buf != local_buf)kfree (buf);return ret;
@@ -274,7 +272,9 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,u8 local_buf[64 ];void __iomem *io_addr;void *buf; -unsigned long pfn; +struct vm_area_struct *vma; +pte_t *ptep; +spinlock_t *ptl;long ret;if (!zpci_is_enabled ())
@@ -287,7 +287,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,* We only support read access to MIO capable devices if we are on * a MIO enabled system. Otherwise we would have to check for every * address if it is a special ZPCI_ADDR and would have to do -* a get_pfn() which we don't need for MIO capable devices. Currently +* a pfn lookup which we don't need for MIO capable devices. Currently * ISM devices are the only devices without MIO support and there is no * known need for accessing these from userspace. */
@@ -306,22 +306,38 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr, buf = local_buf; } - ret =get_pfn (mmio_addr,VM_READ , &pfn); +mmap_read_lock (current->mm); + ret = -EINVAL ; + vma =find_vma (current->mm, mmio_addr); +if (!vma) + goto out_unlock_mmap; +if (!(vma->vm_flags & (VM_IO |VM_PFNMAP ))) + goto out_unlock_mmap; + ret = -EACCES ; +if (!(vma->vm_flags &VM_WRITE )) + goto out_unlock_mmap; + + ret =follow_pte_pmd (vma->vm_mm, mmio_addr,NULL , &ptep,NULL , &ptl);if (ret) - goto out; - io_addr = (void __iomem *)((pfn <<PAGE_SHIFT ) | (mmio_addr & ~PAGE_MASK )); + goto out_unlock_mmap; + + io_addr = (void __iomem *)((pte_pfn (*ptep) <<PAGE_SHIFT ) | + (mmio_addr & ~PAGE_MASK ));if ((unsigned long ) io_addr <ZPCI_IOMAP_ADDR_BASE ) { ret = -EFAULT ; - goto out; + goto out_unlock_pt; } ret =zpci_memcpy_fromio (buf, io_addr, length); -if (ret) - goto out; -if (copy_to_user (user_buffer, buf, length)) + +out_unlock_pt: +pte_unmap_unlock (ptep, ptl); +out_unlock_mmap: +mmap_read_unlock (current->mm); + +if (!ret &©_to_user (user_buffer, buf, length)) ret = -EFAULT ; -out:if (buf != local_buf)kfree (buf);return ret;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 57/217 s390/trng: set quality to 1024
In reply to Sasha LevinFrom: Christian Borntraeger <[email protected]>
[ Upstream commit d041315ef75cf52df19613f56a2da2c5911c163c ]
The s390-trng does provide 100% entropy. The quality value is supported to be between 1 and 1024 and not 1..1000. Use 1024 to make this driver the preferred one. If we ever have a better driver that has the same quality but is faster we can change this again when merging the new driver. No need to be conservative.
This makes sure that the hw variant is preferred over things like virtio-rng, where the hypervisor has a potential to be misconfigured and thus should have a slightly lower confidence.
--- drivers/char/hw_random/s390-trng.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/char/hw_random/s390-trng.c +4 -3
@@ -192,14 +192,15 @@ static int trng_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait)/* * hwrng register struct -* The trng is suppost to have 100% entropy, and thus -* we register with a very high quality value. +* The trng is supposed to have 100% entropy, and thus we register with a very +* high quality value. If we ever have a better driver in the future, we should +* change this value again when we merge this driver. */ static struct hwrng trng_hwrng_dev = { .name ="s390-trng" , .data_read = trng_hwrng_data_read, .read = trng_hwrng_read, - .quality =999 , + .quality =1024 , };
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 58/217 Bluetooth: btqca: Add valid le states quirk
In reply to Sasha LevinFrom: Abhishek Pandit-Subedi <[email protected]>
[ Upstream commit 547801380ec7e6104ea679f599d03c342b4b39a0 ]
WCN3991 supports connectable advertisements so we need to add the valid le states quirk so the 'central-peripheral' role is exposed in userspace.
--- drivers/bluetooth/hci_qca.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/bluetooth/hci_qca.c +13 -6
@@ -78,6 +78,7 @@ enum qca_flags {enum qca_capabilities {QCA_CAP_WIDEBAND_SPEECH =BIT (0 ), +QCA_CAP_VALID_LE_STATES =BIT (1 ), };/* HCI_IBS transmit side sleep protocol states */
@@ -1780,7 +1781,7 @@ static const struct qca_device_data qca_soc_data_wcn3991 = { { "vddch0", 450000 }, }, .num_vregs = 4, - .capabilities = QCA_CAP_WIDEBAND_SPEECH, + .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES, }; static const struct qca_device_data qca_soc_data_wcn3998 = {
@@ -2017,11 +2018,17 @@ static int qca_serdev_probe(struct serdev_device *serdev) hdev->shutdown = qca_power_off; } -/* Wideband speech support must be set per driver since it can't be -* queried via hci. -*/ -if (data && (data->capabilities &QCA_CAP_WIDEBAND_SPEECH )) -set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); +if (data) { +/* Wideband speech support must be set per driver since it can't +* be queried via hci. Same with the valid le states quirk. +*/ +if (data->capabilities &QCA_CAP_WIDEBAND_SPEECH ) +set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , + &hdev->quirks); + +if (data->capabilities &QCA_CAP_VALID_LE_STATES ) +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); + }return 0 ; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 59/217 Bluetooth: Resume advertising after LE connection
In reply to Sasha LevinFrom: Daniel Winkler <[email protected]>
[ Upstream commit 2943d8ede38310db932eb38f91aa1094b471058c ]
When an LE connection request is made, advertising is disabled and never resumed. When a client has an active advertisement, this is disruptive. This change adds resume logic for client-configured (non-directed) advertisements after the connection attempt.
The patch was tested by registering an advertisement, initiating an LE connection from a remote peer, and verifying that the advertisement is re-activated after the connection is established. This is performed on Hatch and Kukui Chromebooks.
--- net/bluetooth/hci_conn.c | 12 ++++++++++-- net/bluetooth/hci_request.c | 21 ++++++++++++++++----- net/bluetooth/hci_request.h | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-)
net/bluetooth/hci_conn.c +10 -2
@@ -758,6 +758,9 @@ static void create_le_conn_complete(struct hci_dev *hdev, u8 status, u16 opcode) conn =hci_lookup_le_connect (hdev); +if (hdev->adv_instance_cnt) +hci_req_resume_adv_instances (hdev); +if (!status) {hci_connect_le_scan_cleanup (conn); goto done;
@@ -1067,10 +1070,11 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,* connections most controllers will refuse to connect if * advertising is enabled, and for slave role connections we * anyway have to disable it in order to start directed -* advertising. +* advertising. Any registered advertisements will be +* re-enabled after the connection attempt is finished. */ if (hci_dev_test_flag (hdev,HCI_LE_ADV )) -__hci_req_disable_advertising (&req); +__hci_req_pause_adv_instances (&req);/* If requested to connect as slave use directed advertising */ if (conn->role ==HCI_ROLE_SLAVE ) {
@@ -1118,6 +1122,10 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, err =hci_req_run (&req, create_le_conn_complete);if (err) {hci_conn_del (conn); + +if (hdev->adv_instance_cnt) +hci_req_resume_adv_instances (hdev); +return ERR_PTR (err); }
net/bluetooth/hci_request.c +16 -5
@@ -1123,9 +1123,9 @@ static void cancel_adv_timeout(struct hci_dev *hdev) }/* This function requires the caller holds hdev->lock */ -static void hci_suspend_adv_instances (struct hci_request *req) +void __hci_req_pause_adv_instances (struct hci_request *req) { -bt_dev_dbg (req->hdev,"Suspending advertising instances" ); +bt_dev_dbg (req->hdev,"Pausing advertising instances" );/* Call to disable any advertisements active on the controller. * This will succeed even if no advertisements are configured.
@@ -1138,7 +1138,7 @@ static void hci_suspend_adv_instances(struct hci_request *req) }/* This function requires the caller holds hdev->lock */ -static void hci_resume_adv_instances (struct hci_request *req) +static void __hci_req_resume_adv_instances (struct hci_request *req) {struct adv_info *adv;
@@ -1161,6 +1161,17 @@ static void hci_resume_adv_instances(struct hci_request *req) } } +/* This function requires the caller holds hdev->lock */ +int hci_req_resume_adv_instances (struct hci_dev *hdev) +{ +struct hci_request req; + +hci_req_init (&req, hdev); +__hci_req_resume_adv_instances (&req); + +return hci_req_run (&req,NULL ); +} +static void suspend_req_complete (struct hci_dev *hdev,u8 status,u16 opcode) { bt_dev_dbg(hdev, "Request complete opcode=0x%x, status=0x%x", opcode,
@@ -1214,7 +1225,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)/* Pause other advertisements */ if (hdev->adv_instance_cnt) -hci_suspend_adv_instances (&req); +__hci_req_pause_adv_instances (&req); hdev->advertising_paused = true; hdev->advertising_old_state = old_state;
@@ -1279,7 +1290,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)/* Resume other advertisements */ if (hdev->adv_instance_cnt) -hci_resume_adv_instances (&req); +__hci_req_resume_adv_instances (&req);/* Unpause discovery */ hdev->discovery_paused = false;
net/bluetooth/hci_request.h +2 -0
@@ -71,6 +71,8 @@ void hci_req_add_le_passive_scan(struct hci_request *req);void hci_req_prepare_suspend (struct hci_dev *hdev,enum suspended_state next);void hci_req_disable_address_resolution (struct hci_dev *hdev); +void __hci_req_pause_adv_instances (struct hci_request *req); +int hci_req_resume_adv_instances (struct hci_dev *hdev);void hci_req_reenable_advertising (struct hci_dev *hdev);void __hci_req_enable_advertising (struct hci_request *req);void __hci_req_disable_advertising (struct hci_request *req);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 60/217 Bluetooth: Move force_bredr_smp debugfs into hci_debugfs_create_bredr
In reply to Sasha LevinFrom: Claire Chang <[email protected]>
[ Upstream commit 82493316507a720b6faa2ec23971c0ca89c6dcb0 ]
Avoid multiple attempts to create the debugfs entry, force_bredr_smp, by moving it from the SMP registration to the BR/EDR controller init section. hci_debugfs_create_bredr is only called when HCI_SETUP and HCI_CONFIG is not set.
--- net/bluetooth/hci_debugfs.c | 50 +++++++++++++++++++++++++++++++++++++ net/bluetooth/smp.c | 44 ++------------------------------ net/bluetooth/smp.h | 2 ++ 3 files changed, 54 insertions(+), 42 deletions(-)
net/bluetooth/hci_debugfs.c +50 -0
@@ -494,6 +494,45 @@ static int auto_accept_delay_get(void *data, u64 *val)DEFINE_SIMPLE_ATTRIBUTE (auto_accept_delay_fops, auto_accept_delay_get, auto_accept_delay_set,"%llu\n" ); +static ssize_t force_bredr_smp_read (struct file *file, +char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct hci_dev *hdev = file->private_data; +char buf[3 ]; + + buf[0 ] =hci_dev_test_flag (hdev,HCI_FORCE_BREDR_SMP ) ?'Y' :'N' ; + buf[1 ] ='\n' ; + buf[2 ] ='\0' ; +return simple_read_from_buffer (user_buf, count, ppos, buf,2 ); +} + +static ssize_t force_bredr_smp_write (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct hci_dev *hdev = file->private_data; +bool enable; +int err; + + err =kstrtobool_from_user (user_buf, count, &enable); +if (err) +return err; + + err =smp_force_bredr (hdev, enable); +if (err) +return err; + +return count; +} + +static const struct file_operations force_bredr_smp_fops = { + .open = simple_open, + .read = force_bredr_smp_read, + .write = force_bredr_smp_write, + .llseek = default_llseek, +}; +static int idle_timeout_set (void *data,u64 val) {struct hci_dev *hdev = data;
@@ -589,6 +628,17 @@ void hci_debugfs_create_bredr(struct hci_dev *hdev)debugfs_create_file ("voice_setting" ,0444 , hdev->debugfs, hdev, &voice_setting_fops); +/* If the controller does not support BR/EDR Secure Connections +* feature, then the BR/EDR SMP channel shall not be present. +* +* To test this with Bluetooth 4.0 controllers, create a debugfs +* switch that allows forcing BR/EDR SMP support and accepting +* cross-transport pairing on non-AES encrypted connections. +*/ +if (!lmp_sc_capable (hdev)) +debugfs_create_file ("force_bredr_smp" ,0644 , hdev->debugfs, + hdev, &force_bredr_smp_fops); +if (lmp_ssp_capable (hdev)) {debugfs_create_file ("ssp_debug_mode" ,0444 , hdev->debugfs, hdev, &ssp_debug_mode_fops);
net/bluetooth/smp.c +2 -42
66 lines not on this page · raw message
net/bluetooth/smp.h +2 -0
@@ -193,6 +193,8 @@ bool smp_irk_matches(struct hci_dev *hdev, const u8 irk[16],int smp_generate_rpa (struct hci_dev *hdev,const u8 irk[16 ],bdaddr_t *rpa);int smp_generate_oob (struct hci_dev *hdev,u8 hash[16 ],u8 rand[16 ]); +int smp_force_bredr (struct hci_dev *hdev,bool enable); +int smp_register (struct hci_dev *hdev);void smp_unregister (struct hci_dev *hdev);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 61/217 Bluetooth: hidp: use correct wait queue when removing ctrl_wait
In reply to Sasha LevinFrom: Ole Bjørn Midtbø <[email protected]>
[ Upstream commit cca342d98bef68151a80b024f7bf5f388d1fbdea ]
A different wait queue was used when removing ctrl_wait than when adding it. This effectively made the remove operation without locking compared to other operations on the wait queue ctrl_wait was part of. This caused issues like below where dead000000000100 is LIST_POISON1 and dead000000000200 is LIST_POISON2.
list_add corruption. next->prev should be prev (ffffffc1b0a33a08), \ but was dead000000000200. (next=ffffffc03ac77de0). ------------[ cut here ]------------ CPU: 3 PID: 2138 Comm: bluetoothd Tainted: G O 4.4.238+ #9 ... ---[ end trace 0adc2158f0646eac ]--- Call trace: [<ffffffc000443f78>] __list_add+0x38/0xb0 [<ffffffc0000f0d04>] add_wait_queue+0x4c/0x68 [<ffffffc00020eecc>] __pollwait+0xec/0x100 [<ffffffc000d1556c>] bt_sock_poll+0x74/0x200 [<ffffffc000bdb8a8>] sock_poll+0x110/0x128 [<ffffffc000210378>] do_sys_poll+0x220/0x480 [<ffffffc0002106f0>] SyS_poll+0x80/0x138 [<ffffffc00008510c>] __sys_trace_return+0x0/0x4 Unable to handle kernel paging request at virtual address dead000000000100 ... CPU: 4 PID: 5387 Comm: kworker/u15:3 Tainted: G W O 4.4.238+ #9 ... Call trace: [<ffffffc0000f079c>] __wake_up_common+0x7c/0xa8 [<ffffffc0000f0818>] __wake_up+0x50/0x70 [<ffffffc000be11b0>] sock_def_wakeup+0x58/0x60 [<ffffffc000de5e10>] l2cap_sock_teardown_cb+0x200/0x224 [<ffffffc000d3f2ac>] l2cap_chan_del+0xa4/0x298 [<ffffffc000d45ea0>] l2cap_conn_del+0x118/0x198 [<ffffffc000d45f8c>] l2cap_disconn_cfm+0x6c/0x78 [<ffffffc000d29934>] hci_event_packet+0x564/0x2e30 [<ffffffc000d19b0c>] hci_rx_work+0x10c/0x360 [<ffffffc0000c2218>] process_one_work+0x268/0x460 [<ffffffc0000c2678>] worker_thread+0x268/0x480 [<ffffffc0000c94e0>] kthread+0x118/0x128 [<ffffffc000085070>] ret_from_fork+0x10/0x20 ---[ end trace 0adc2158f0646ead ]---
--- net/bluetooth/hidp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hidp/core.c +1 -1
@@ -1290,7 +1290,7 @@ static int hidp_session_thread(void *arg)/* cleanup runtime environment */ remove_wait_queue (sk_sleep (session->intr_sock->sk), &intr_wait); -remove_wait_queue (sk_sleep (session->intr_sock->sk), &ctrl_wait); +remove_wait_queue (sk_sleep (session->ctrl_sock->sk), &ctrl_wait);wake_up_interruptible (&session->report_queue);hidp_del_timer (session);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 62/217 binder: change error code from postive to negative in binder_transaction
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit 88f6c77927e4aee04e0193fd94e13a55753a72b0 ]
Depending on the context, the error return value
here (extra_buffers_size < added_size) should be
negative.
--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
@@ -3103,7 +3103,7 @@ static void binder_transaction(struct binder_proc *proc,if (extra_buffers_size < added_size) {/* integer overflow of extra_buffers_size */ return_error =BR_FAILED_REPLY ; - return_error_param =EINVAL ; + return_error_param = -EINVAL ; return_error_line = __LINE__; goto err_bad_extra_size; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 63/217 net: skb_vlan_untag(): don't reset transport offset if set by GRO layer
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 8be33ecfc1ffd2da20cc29e957e4cb6eb99310cb ]
Similar to commit fda55eca5a33f
("net: introduce skb_transport_header_was_set()"), avoid resetting transport offsets that were already set by GRO layer. This not only mirrors the behavior of __netif_receive_skb_core(), but also makes sense when it comes to UDP GSO fraglists forwarding: transport offset of such skbs is set only once by GRO receive callback and remains untouched and correct up to the xmitting driver in 1:1 case, but becomes junk after untagging in ingress VLAN case and breaks UDP GSO offload. This does not happen after this change, and all types of forwarding of UDP GSO fraglists work as expected.
Since v1 [1]:
- keep the code 1:1 with __netif_receive_skb_core() (Jakub).
[1] https://lore.kernel.org/netdev/[email protected]
--- net/core/skbuff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/skbuff.c +2 -1
@@ -5430,7 +5430,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb) goto err_free;skb_reset_network_header (skb); -skb_reset_transport_header (skb); +if (!skb_transport_header_was_set (skb)) +skb_reset_transport_header (skb);skb_reset_mac_len (skb);return skb;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 64/217 drm/omap: Fix runtime PM imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit a5d704d33245b0799947a3008f9f376dba4d5c91 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. However, users of its direct wrappers in omapdrm assume that PM usage counter will not change on error. Thus a pairing decrement is needed on the error handling path for these wrappers to keep the counter balanced.
--- drivers/gpu/drm/omapdrm/dss/dispc.c | 7 +++++-- drivers/gpu/drm/omapdrm/dss/dsi.c | 7 +++++-- drivers/gpu/drm/omapdrm/dss/dss.c | 7 +++++-- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 6 +++--- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 6 +++--- drivers/gpu/drm/omapdrm/dss/venc.c | 7 +++++-- 6 files changed, 26 insertions(+), 14 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +5 -2
@@ -653,8 +653,11 @@ int dispc_runtime_get(struct dispc_device *dispc)DSSDBG ("dispc_runtime_get\n" ); r =pm_runtime_get_sync (&dispc->pdev->dev); -WARN_ON (r <0 ); -return r <0 ? r :0 ; +if (WARN_ON (r <0 )) { +pm_runtime_put_noidle (&dispc->pdev->dev); +return r; + } +return 0 ; }void dispc_runtime_put (struct dispc_device *dispc)
drivers/gpu/drm/omapdrm/dss/dsi.c +5 -2
@@ -1112,8 +1112,11 @@ static int dsi_runtime_get(struct dsi_data *dsi)DSSDBG ("dsi_runtime_get\n" ); r =pm_runtime_get_sync (dsi->dev); -WARN_ON (r <0 ); -return r <0 ? r :0 ; +if (WARN_ON (r <0 )) { +pm_runtime_put_noidle (dsi->dev); +return r; + } +return 0 ; }static void dsi_runtime_put (struct dsi_data *dsi)
drivers/gpu/drm/omapdrm/dss/dss.c +5 -2
@@ -858,8 +858,11 @@ int dss_runtime_get(struct dss_device *dss)DSSDBG ("dss_runtime_get\n" ); r =pm_runtime_get_sync (&dss->pdev->dev); -WARN_ON (r <0 ); -return r <0 ? r :0 ; +if (WARN_ON (r <0 )) { +pm_runtime_put_noidle (&dss->pdev->dev); +return r; + } +return 0 ; }void dss_runtime_put (struct dss_device *dss)
drivers/gpu/drm/omapdrm/dss/hdmi4.c +3 -3
@@ -43,10 +43,10 @@ static int hdmi_runtime_get(struct omap_hdmi *hdmi)DSSDBG ("hdmi_runtime_get\n" ); r =pm_runtime_get_sync (&hdmi->pdev->dev); -WARN_ON (r <0 ); -if (r <0 ) +if (WARN_ON (r <0 )) { +pm_runtime_put_noidle (&hdmi->pdev->dev);return r; - + }return 0 ; }
drivers/gpu/drm/omapdrm/dss/hdmi5.c +3 -3
@@ -44,10 +44,10 @@ static int hdmi_runtime_get(struct omap_hdmi *hdmi)DSSDBG ("hdmi_runtime_get\n" ); r =pm_runtime_get_sync (&hdmi->pdev->dev); -WARN_ON (r <0 ); -if (r <0 ) +if (WARN_ON (r <0 )) { +pm_runtime_put_noidle (&hdmi->pdev->dev);return r; - + }return 0 ; }
drivers/gpu/drm/omapdrm/dss/venc.c +5 -2
@@ -361,8 +361,11 @@ static int venc_runtime_get(struct venc_device *venc)DSSDBG ("venc_runtime_get\n" ); r =pm_runtime_get_sync (&venc->pdev->dev); -WARN_ON (r <0 ); -return r <0 ? r :0 ; +if (WARN_ON (r <0 )) { +pm_runtime_put_noidle (&venc->pdev->dev); +return r; + } +return 0 ; }static void venc_runtime_put (struct venc_device *venc)
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 65/217 pinctrl: qcom: Kconfig: Rework PINCTRL_MSM to be a depenency rather then a selected config
In reply to Sasha LevinFrom: John Stultz <[email protected]>
[ Upstream commit be117ca32261c3331b614f440c737650791a6998 ]
This patch reworks PINCTRL_MSM to be a visible option, and instead of having the various SoC specific drivers select PINCTRL_MSM, this switches those configs to depend on PINCTRL_MSM.
This is useful, as it will be needed in order to cleanly support having the qcom-scm driver, which pinctrl-msm calls into, configured as a module. Without this change, we would eventually have to add dependency lines to every config that selects PINCTRL_MSM, and that would becomes a maintenance headache.
We also add PINCTRL_MSM to the arm64 defconfig to avoid surprises as otherwise PINCTRL_MSM/IPQ* options previously enabled, will be off.
--- arch/arm64/configs/defconfig | 1 + drivers/pinctrl/qcom/Kconfig | 48 ++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 24 deletions(-)
arch/arm64/configs/defconfig +1 -0
@@ -483,6 +483,7 @@ CONFIG_PINCTRL_IMX8MP=y CONFIG_PINCTRL_IMX8MQ=y CONFIG_PINCTRL_IMX8QXP=y CONFIG_PINCTRL_IMX8DXL=y +CONFIG_PINCTRL_MSM=y CONFIG_PINCTRL_IPQ8074=y CONFIG_PINCTRL_IPQ6018=y CONFIG_PINCTRL_MSM8916=y
drivers/pinctrl/qcom/Kconfig +24 -24
192 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 66/217 ASoC: Fix vaud18 power leakage of mt6359
In reply to Sasha LevinFrom: "Shane.Chien" <[email protected]>
[ Upstream commit 64a70744b77898a15d7a5b2b4dc0fa9523a75cde ]
vaud18 is power of mt6359 audio path. It should only enable when audio is used, instead of in boot up stage.
Once mt6359 audio path is enabled or disabled, vaud18 is controlled by regulator supply widget "LDO_VAUD18". Due to vaud18 is controlled by regulator dapm macro instead of regmap, the macro MT6359_LDO_VAUD18_CON0 and variable avdd_reg is no used and removed from mt6359.h.
--- sound/soc/codecs/mt6359.c | 25 +------------------------ sound/soc/codecs/mt6359.h | 8 -------- 2 files changed, 1 insertion(+), 32 deletions(-)
sound/soc/codecs/mt6359.c +1 -24
@@ -1833,9 +1833,7 @@ static const struct snd_soc_dapm_widget mt6359_dapm_widgets[] = {SND_SOC_DAPM_SUPPLY_S ("CLK_BUF" ,SUPPLY_SEQ_CLK_BUF ,MT6359_DCXO_CW12 ,RG_XO_AUDIO_EN_M_SFT ,0 ,NULL ,0 ), -SND_SOC_DAPM_SUPPLY_S ("LDO_VAUD18" ,SUPPLY_SEQ_LDO_VAUD18 , -MT6359_LDO_VAUD18_CON0 , -RG_LDO_VAUD18_EN_SFT ,0 ,NULL ,0 ), +SND_SOC_DAPM_REGULATOR_SUPPLY ("LDO_VAUD18" ,0 ,0 ),SND_SOC_DAPM_SUPPLY_S ("AUDGLB" ,SUPPLY_SEQ_AUD_GLB ,MT6359_AUDDEC_ANA_CON13 , RG_AUDGLB_PWRDN_VA32_SFT, 1, NULL, 0),
@@ -2697,20 +2695,6 @@ static int mt6359_platform_driver_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, priv); priv->dev = &pdev->dev; - priv->avdd_reg =devm_regulator_get (&pdev->dev,"vaud18" ); -if (IS_ERR (priv->avdd_reg)) { -dev_err (&pdev->dev,"%s(), have no vaud18 supply: %ld" , - __func__,PTR_ERR (priv->avdd_reg)); -return PTR_ERR (priv->avdd_reg); - } - - ret =regulator_enable (priv->avdd_reg); -if (ret) { -dev_err (&pdev->dev,"%s(), failed to enable regulator!\n" , - __func__); -return ret; - } - ret =mt6359_parse_dt (priv);if (ret) {dev_warn (&pdev->dev,"%s() failed to parse dts\n" , __func__);
@@ -2731,13 +2715,6 @@ static int mt6359_platform_driver_remove(struct platform_device *pdev)dev_dbg (&pdev->dev,"%s(), dev name %s\n" , __func__,dev_name (&pdev->dev)); - ret =regulator_disable (priv->avdd_reg); -if (ret) { -dev_err (&pdev->dev,"%s(), failed to disable regulator!\n" , - __func__); -return ret; - } -return 0 ; }
sound/soc/codecs/mt6359.h +0 -8
@@ -135,11 +135,6 @@/* MT6359_DCXO_CW12 */ #define RG_XO_AUDIO_EN_M_SFT 13 -/* LDO_VAUD18_CON0 */ -#define RG_LDO_VAUD18_EN_SFT 0 -#define RG_LDO_VAUD18_EN_MASK 0x1 -#define RG_LDO_VAUD18_EN_MASK_SFT (0x1 << 0) -/* AUD_TOP_CKPDN_CON0 */ #define RG_VOW13M_CK_PDN_SFT 13#define RG_VOW13M_CK_PDN_MASK 0x1
@@ -2132,7 +2127,6 @@#define MT6359_DCXO_CW11 0x7a6#define MT6359_DCXO_CW12 0x7a8 -#define MT6359_LDO_VAUD18_CON0 0x1c98#define MT6359_GPIO_MODE0 0xcc#define MT6359_GPIO_MODE0_SET 0xce
@@ -2469,7 +2463,6 @@ enum {enum {/* common */ SUPPLY_SEQ_CLK_BUF , -SUPPLY_SEQ_LDO_VAUD18 ,SUPPLY_SEQ_AUD_GLB ,SUPPLY_SEQ_HP_PULL_DOWN ,SUPPLY_SEQ_CLKSQ ,
@@ -2629,7 +2622,6 @@ struct mt6359_priv {int hp_gain_ctl;int hp_hifi_mode;int mtkaif_protocol; -struct regulator *avdd_reg; };#define CODEC_MT6359_NAME "mtk-codec-mt6359"
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Sasha Levin
maintainerPATCH 67/217 mwifiex: pcie: skip cancel_work_sync() on reset failure path
In reply to Sasha LevinFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit 4add4d988f95f47493500a7a19c623827061589b ]
If a reset is performed, but even the reset fails for some reasons (e.g., on Surface devices, the fw reset requires another quirks), cancel_work_sync() hangs in mwifiex_cleanup_pcie().
# firmware went into a bad state
[...]
[ 1608.281690] mwifiex_pcie 0000:03:00.0: info: shutdown mwifiex...
[ 1608.282724] mwifiex_pcie 0000:03:00.0: rx_pending=0, tx_pending=1, cmd_pending=0
[ 1608.292400] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
[ 1608.292405] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed
# reset performed after firmware went into a bad state
[ 1609.394320] mwifiex_pcie 0000:03:00.0: WLAN FW already running! Skip FW dnld
[ 1609.394335] mwifiex_pcie 0000:03:00.0: WLAN FW is active
# but even the reset failed
[ 1619.499049] mwifiex_pcie 0000:03:00.0: mwifiex_cmd_timeout_func: Timeout cmd id = 0xfa, act = 0xe000
[ 1619.499094] mwifiex_pcie 0000:03:00.0: num_data_h2c_failure = 0
[ 1619.499103] mwifiex_pcie 0000:03:00.0: num_cmd_h2c_failure = 0
[ 1619.499110] mwifiex_pcie 0000:03:00.0: is_cmd_timedout = 1
[ 1619.499117] mwifiex_pcie 0000:03:00.0: num_tx_timeout = 0
[ 1619.499124] mwifiex_pcie 0000:03:00.0: last_cmd_index = 0
[ 1619.499133] mwifiex_pcie 0000:03:00.0: last_cmd_id: fa 00 07 01 07 01 07 01 07 01
[ 1619.499140] mwifiex_pcie 0000:03:00.0: last_cmd_act: 00 e0 00 00 00 00 00 00 00 00
[ 1619.499147] mwifiex_pcie 0000:03:00.0: last_cmd_resp_index = 3
[ 1619.499155] mwifiex_pcie 0000:03:00.0: last_cmd_resp_id: 07 81 07 81 07 81 07 81 07 81
[ 1619.499162] mwifiex_pcie 0000:03:00.0: last_event_index = 2
[ 1619.499169] mwifiex_pcie 0000:03:00.0: last_event: 58 00 58 00 58 00 58 00 58 00
[ 1619.499177] mwifiex_pcie 0000:03:00.0: data_sent=0 cmd_sent=1
[ 1619.499185] mwifiex_pcie 0000:03:00.0: ps_mode=0 ps_state=0
[ 1619.499215] mwifiex_pcie 0000:03:00.0: info: _mwifiex_fw_dpc: unregister device
# mwifiex_pcie_work hang happening
[ 1823.233923] INFO: task kworker/3:1:44 blocked for more than 122 seconds.
[ 1823.233932] Tainted: G WC OE 5.10.0-rc1-1-mainline #1
[ 1823.233935] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1823.233940] task:kworker/3:1 state:D stack: 0 pid: 44 ppid: 2 flags:0x00004000
[ 1823.233960] Workqueue: events mwifiex_pcie_work [mwifiex_pcie]
[ 1823.233965] Call Trace:
[ 1823.233981] __schedule+0x292/0x820
[ 1823.233990] schedule+0x45/0xe0
[ 1823.233995] schedule_timeout+0x11c/0x160
[ 1823.234003] wait_for_completion+0x9e/0x100
[ 1823.234012] __flush_work.isra.0+0x156/0x210
[ 1823.234018] ? flush_workqueue_prep_pwqs+0x130/0x130
[ 1823.234026] __cancel_work_timer+0x11e/0x1a0
[ 1823.234035] mwifiex_cleanup_pcie+0x28/0xd0 [mwifiex_pcie]
[ 1823.234049] mwifiex_free_adapter+0x24/0xe0 [mwifiex]
[ 1823.234060] _mwifiex_fw_dpc+0x294/0x560 [mwifiex]
[ 1823.234074] mwifiex_reinit_sw+0x15d/0x300 [mwifiex]
[ 1823.234080] mwifiex_pcie_reset_done+0x50/0x80 [mwifiex_pcie]
[ 1823.234087] pci_try_reset_function+0x5c/0x90
[ 1823.234094] process_one_work+0x1d6/0x3a0
[ 1823.234100] worker_thread+0x4d/0x3d0
[ 1823.234107] ? rescuer_thread+0x410/0x410
[ 1823.234112] kthread+0x142/0x160
[ 1823.234117] ? __kthread_bind_mask+0x60/0x60
[ 1823.234124] ret_from_fork+0x22/0x30
[...]This is a deadlock caused by calling cancel_work_sync() in mwifiex_cleanup_pcie():
- Device resets are done via mwifiex_pcie_card_reset()
- which schedules card->work to call mwifiex_pcie_card_reset_work()
- which calls pci_try_reset_function().
- This leads to mwifiex_pcie_reset_done() be called on the same workqueue, which in turn calls
- mwifiex_reinit_sw() and that calls
- _mwifiex_fw_dpc().
The problem is now that _mwifiex_fw_dpc() calls mwifiex_free_adapter() in case firmware initialization fails. That ends up calling mwifiex_cleanup_pcie().
Note that all those calls are still running on the workqueue. So when mwifiex_cleanup_pcie() now calls cancel_work_sync(), it's really waiting on itself to complete, causing a deadlock.
This commit fixes the deadlock by skipping cancel_work_sync() on a reset failure path.
After this commit, when reset fails, the following output is expected to be shown:
kernel: mwifiex_pcie 0000:03:00.0: info: _mwifiex_fw_dpc: unregister device
kernel: mwifiex: Failed to bring up adapter: -5
kernel: mwifiex_pcie 0000:03:00.0: reinit failed: -5To reproduce this issue, for example, try putting the root port of wifi into D3 (replace "00:1d.3" with your setup).
# put into D3 (root port)
sudo setpci -v -s 00:1d.3 CAP_PM+4.b=0b--- drivers/net/wireless/marvell/mwifiex/pcie.c | 18 +++++++++++++++++- drivers/net/wireless/marvell/mwifiex/pcie.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +17 -1
@@ -526,6 +526,8 @@ static void mwifiex_pcie_reset_prepare(struct pci_dev *pdev)clear_bit (MWIFIEX_IFACE_WORK_DEVICE_DUMP , &card->work_flags);clear_bit (MWIFIEX_IFACE_WORK_CARD_RESET , &card->work_flags);mwifiex_dbg (adapter,INFO ,"%s, successful\n" , __func__); + + card->pci_reset_ongoing = true; }/*
@@ -554,6 +556,8 @@ static void mwifiex_pcie_reset_done(struct pci_dev *pdev)dev_err (&pdev->dev,"reinit failed: %d\n" , ret); else mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__); + + card->pci_reset_ongoing = false; }static const struct pci_error_handlers mwifiex_pcie_err_handler = {
@@ -3142,7 +3146,19 @@ static void mwifiex_cleanup_pcie(struct mwifiex_adapter *adapter)int ret;u32 fw_status; -cancel_work_sync (&card->work); +/* Perform the cancel_work_sync() only when we're not resetting +* the card. It's because that function never returns if we're +* in reset path. If we're here when resetting the card, it means +* that we failed to reset the card (reset failure path). +*/ +if (!card->pci_reset_ongoing) { +mwifiex_dbg (adapter,MSG ,"performing cancel_work_sync()...\n" ); +cancel_work_sync (&card->work); +mwifiex_dbg (adapter,MSG ,"cancel_work_sync() done\n" ); + }else { +mwifiex_dbg (adapter,MSG , +"skipped cancel_work_sync() because we're in card reset failure path\n" ); + } ret =mwifiex_read_reg (adapter, reg->fw_status, &fw_status);if (fw_status ==FIRMWARE_READY_PCIE ) {
drivers/net/wireless/marvell/mwifiex/pcie.h +2 -0
@@ -242,6 +242,8 @@ struct pcie_service_card {struct mwifiex_msix_context share_irq_ctx;struct work_struct work;unsigned long work_flags; + +bool pci_reset_ongoing; }; static inline int
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 68/217 drm/amd/amdgpu: Fix incorrect logic to increment VCN doorbell index
In reply to Sasha LevinFrom: Bokun Zhang <[email protected]>
[ Upstream commit 25a35065c066496935217748b1662a7fcf26ed58 ]
- The original logic uses a counter based index assignment, which is incorrect if we only assign VCN1 to this VF but no VCN0
The doorbell index is absolute, so we can calculate it by using index variable i and j
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +9 -6
@@ -155,6 +155,13 @@ static int vcn_v3_0_sw_init(void *handle)if (r)return r; +/* +* Note: doorbell assignment is fixed for SRIOV multiple VCN engines +* Formula: +* vcn_db_base = adev->doorbell_index.vcn.vcn_ring0_1 << 1; +* dec_ring_i = vcn_db_base + i * (adev->vcn.num_enc_rings + 1) +* enc_ring_i,j = vcn_db_base + i * (adev->vcn.num_enc_rings + 1) + 1 + j +*/ if (amdgpu_sriov_vf (adev)) { vcn_doorbell_index = adev->doorbell_index.vcn.vcn_ring0_1;/* get DWORD offset */
@@ -192,9 +199,7 @@ static int vcn_v3_0_sw_init(void *handle) ring = &adev->vcn.inst[i].ring_dec; ring->use_doorbell = true;if (amdgpu_sriov_vf (adev)) { - ring->doorbell_index = vcn_doorbell_index; -/* NOTE: increment so next VCN engine use next DOORBELL DWORD */ - vcn_doorbell_index++; + ring->doorbell_index = vcn_doorbell_index + i * (adev->vcn.num_enc_rings +1 ); }else { ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 <<1 ) +8 * i; }
@@ -216,9 +221,7 @@ static int vcn_v3_0_sw_init(void *handle) ring = &adev->vcn.inst[i].ring_enc[j]; ring->use_doorbell = true;if (amdgpu_sriov_vf (adev)) { - ring->doorbell_index = vcn_doorbell_index; -/* NOTE: increment so next VCN engine use next DOORBELL DWORD */ - vcn_doorbell_index++; + ring->doorbell_index = vcn_doorbell_index + i * (adev->vcn.num_enc_rings +1 ) +1 + j; }else { ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 <<1 ) +2 + j +8 * i; }
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 69/217 drm/amd/amdgpu: Add rev_id workaround logic for SRIOV setup
In reply to Sasha LevinFrom: Bokun Zhang <[email protected]>
[ Upstream commit de21e4aeb2b26128dcc5be1bcb2fafa73d041e51 ]
- When we are under SRIOV setup, the rev_id cannot be read properly. Therefore, we will return default value for it
--- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +10 -1
@@ -51,8 +51,17 @@ static void nbio_v2_3_remap_hdp_registers(struct amdgpu_device *adev)static u32 nbio_v2_3_get_rev_id (struct amdgpu_device *adev) { -u32 tmp =RREG32_SOC15 (NBIO ,0 , mmRCC_DEV0_EPF0_STRAP0); +u32 tmp; +/* +* guest vm gets 0xffffffff when reading RCC_DEV0_EPF0_STRAP0, +* therefore we force rev_id to 0 (which is the default value) +*/ +if (amdgpu_sriov_vf (adev)) { +return 0 ; + } + + tmp =RREG32_SOC15 (NBIO ,0 , mmRCC_DEV0_EPF0_STRAP0); tmp &=RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK ; tmp >>=RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT ;
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 70/217 ASoC: Intel: sof_sdw: add quirk for new TigerLake-SDCA device
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 488cdbd8931fe4bc7f374a8b429e81d0e4b7ac76 ]
Add quirks for jack detection, rt715 DAI and number of speakers.
--- sound/soc/intel/boards/sof_sdw.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/intel/boards/sof_sdw.c +10 -0
@@ -48,6 +48,16 @@ static int sof_sdw_quirk_cb(const struct dmi_system_id *id) }static const struct dmi_system_id sof_sdw_quirk_table[] = { + { + .callback = sof_sdw_quirk_cb, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc" ), +DMI_EXACT_MATCH (DMI_PRODUCT_SKU ,"0A32" ) + }, + .driver_data = (void *)(SOF_RT711_JD_SRC_JD2 | +SOF_RT715_DAI_ID_FIX | +SOF_SDW_FOUR_SPK ), + }, { .callback = sof_sdw_quirk_cb, .matches = {
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 71/217 RDMA/core: Postpone uobject cleanup on failure till FD close
In reply to Sasha LevinFrom: Leon Romanovsky <[email protected]>
[ Upstream commit efa968ee20248ebf8da8542f21d5d2811e86392f ]
Remove the ib_is_destroyable_retryable() concept.
The idea here was to allow the drivers to forcibly clean the HW object even if they otherwise didn't want to (eg because of usecnt). This was an attempt to clean up in a world where drivers were not allowed to fail HW object destruction.
Now that we are going back to allowing HW objects to fail destroy this doesn't make sense. Instead if a uobject's HW object can't be destroyed it is left on the uobject list and it is up to uverbs_destroy_ufile_hw() to clean it. Multiple passes over the uobject list allow hidden dependencies to be resolved. If that fails the HW driver is broken, throw a WARN_ON and leak the HW object memory.
All the other tricky failure paths (eg on creation error unwind) have already been updated to this new model.
--- drivers/infiniband/core/rdma_core.c | 51 +++++++------------ drivers/infiniband/core/uverbs_cmd.c | 5 +- drivers/infiniband/core/uverbs_std_types.c | 15 +++--- .../core/uverbs_std_types_counters.c | 5 +- drivers/infiniband/core/uverbs_std_types_cq.c | 4 +- drivers/infiniband/core/uverbs_std_types_dm.c | 6 +-- .../core/uverbs_std_types_flow_action.c | 6 +-- drivers/infiniband/core/uverbs_std_types_qp.c | 4 +- .../infiniband/core/uverbs_std_types_srq.c | 4 +- drivers/infiniband/core/uverbs_std_types_wq.c | 4 +- drivers/infiniband/hw/mlx5/devx.c | 4 +- drivers/infiniband/hw/mlx5/fs.c | 6 +-- include/rdma/ib_verbs.h | 44 +--------------- 13 files changed, 45 insertions(+), 113 deletions(-)
drivers/infiniband/core/rdma_core.c +17 -34
@@ -137,15 +137,9 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj, }else if (uobj->object) { ret = uobj->uapi_object->type_class->destroy_hw (uobj, reason, attrs); -if (ret) { -if (ib_is_destroy_retryable (ret, reason, uobj)) -return ret; - -/* Nothing to be done, dangle the memory and move on */ -WARN (true, -"ib_uverbs: failed to remove uobject id %d, driver err=%d" , - uobj->id, ret); - } +if (ret) +/* Nothing to be done, wait till ucontext will clean it */ +return ret; uobj->object =NULL ; }
@@ -543,12 +537,7 @@ static int __must_check destroy_hw_idr_uobject(struct ib_uobject *uobj, struct uverbs_obj_idr_type, type);int ret = idr_type->destroy_object (uobj, why, attrs); -/* -* We can only fail gracefully if the user requested to destroy the -* object or when a retry may be called upon an error. -* In the rest of the cases, just remove whatever you can. -*/ -if (ib_is_destroy_retryable (ret, why, uobj)) +if (ret)return ret;if (why ==RDMA_REMOVE_ABORT )
@@ -581,12 +570,8 @@ static int __must_check destroy_hw_fd_uobject(struct ib_uobject *uobj, {const struct uverbs_obj_fd_type *fd_type =container_of ( uobj->uapi_object->type_attrs, struct uverbs_obj_fd_type, type); -int ret = fd_type->destroy_object (uobj, why); -if (ib_is_destroy_retryable (ret, why, uobj)) -return ret; - -return 0 ; +return fd_type->destroy_object (uobj, why); }static void remove_handle_fd_uobject (struct ib_uobject *uobj)
@@ -863,11 +848,18 @@ static int __uverbs_cleanup_ufile(struct ib_uverbs_file *ufile,* racing with a lookup_get. */ WARN_ON (uverbs_try_lock_object (obj,UVERBS_LOOKUP_WRITE )); +if (reason ==RDMA_REMOVE_DRIVER_FAILURE ) + obj->object =NULL ;if (!uverbs_destroy_uobject (obj, reason, &attrs)) ret =0 ;else atomic_set (&obj->usecnt,0 ); } + +if (reason ==RDMA_REMOVE_DRIVER_FAILURE ) { +WARN_ON (!list_empty (&ufile->uobjects)); +return 0 ; + }return ret; }
@@ -889,21 +881,12 @@ void uverbs_destroy_ufile_hw(struct ib_uverbs_file *ufile,if (!ufile->ucontext) goto done; - ufile->ucontext->cleanup_retryable = true; -while (!list_empty (&ufile->uobjects)) -if (__uverbs_cleanup_ufile (ufile, reason)) { -/* -* No entry was cleaned-up successfully during this -* iteration. It is a driver bug to fail destruction. -*/ -WARN_ON (!list_empty (&ufile->uobjects)); -break ; - } - - ufile->ucontext->cleanup_retryable = false; -if (!list_empty (&ufile->uobjects)) -__uverbs_cleanup_ufile (ufile, reason); +while (!list_empty (&ufile->uobjects) && + !__uverbs_cleanup_ufile (ufile, reason)) { + } +if (WARN_ON (!list_empty (&ufile->uobjects))) +__uverbs_cleanup_ufile (ufile,RDMA_REMOVE_DRIVER_FAILURE );ufile_destroy_ucontext (ufile, reason); done:
drivers/infiniband/core/uverbs_cmd.c +2 -3
@@ -681,8 +681,7 @@ int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject, struct ib_xrcd *xrcd,return 0 ; ret =ib_dealloc_xrcd_user (xrcd, &attrs->driver_udata); - -if (ib_is_destroy_retryable (ret, why, uobject)) { +if (ret) {atomic_inc (&xrcd->usecnt);return ret; }
@@ -690,7 +689,7 @@ int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject, struct ib_xrcd *xrcd,if (inode)xrcd_table_delete (dev, inode); -return ret; +return 0 ; }static int ib_uverbs_reg_mr (struct uverbs_attr_bundle *attrs)
drivers/infiniband/core/uverbs_std_types.c +6 -9
@@ -88,7 +88,7 @@ static int uverbs_free_rwq_ind_tbl(struct ib_uobject *uobject,return -EBUSY ; ret = rwq_ind_tbl->device->ops.destroy_rwq_ind_table (rwq_ind_tbl); -if (ib_is_destroy_retryable (ret, why, uobject)) +if (ret)return ret;for (i =0 ; i < table_size; i++)
@@ -96,7 +96,7 @@ static int uverbs_free_rwq_ind_tbl(struct ib_uobject *uobject,kfree (rwq_ind_tbl);kfree (ind_tbl); -return ret; +return 0 ; } static int uverbs_free_xrcd(struct ib_uobject *uobject,
@@ -108,9 +108,8 @@ static int uverbs_free_xrcd(struct ib_uobject *uobject, container_of(uobject, struct ib_uxrcd_object, uobject);int ret; - ret =ib_destroy_usecnt (&uxrcd->refcnt, why, uobject); -if (ret) -return ret; +if (atomic_read (&uxrcd->refcnt)) +return -EBUSY ;mutex_lock (&attrs->ufile->device->xrcd_tree_mutex); ret =ib_uverbs_dealloc_xrcd (uobject, xrcd, why, attrs);
@@ -124,11 +123,9 @@ static int uverbs_free_pd(struct ib_uobject *uobject, struct uverbs_attr_bundle *attrs) {struct ib_pd *pd = uobject->object; -int ret; - ret =ib_destroy_usecnt (&pd->usecnt, why, uobject); -if (ret) -return ret; +if (atomic_read (&pd->usecnt)) +return -EBUSY ;return ib_dealloc_pd_user (pd, &attrs->driver_udata); }
drivers/infiniband/core/uverbs_std_types_counters.c +2 -3
@@ -42,9 +42,8 @@ static int uverbs_free_counters(struct ib_uobject *uobject,struct ib_counters *counters = uobject->object;int ret; - ret =ib_destroy_usecnt (&counters->usecnt, why, uobject); -if (ret) -return ret; +if (atomic_read (&counters->usecnt)) +return -EBUSY ; ret = counters->device->ops.destroy_counters (counters);if (ret)
drivers/infiniband/core/uverbs_std_types_cq.c +2 -2
@@ -46,7 +46,7 @@ static int uverbs_free_cq(struct ib_uobject *uobject,int ret; ret =ib_destroy_cq_user (cq, &attrs->driver_udata); -if (ib_is_destroy_retryable (ret, why, uobject)) +if (ret)return ret; ib_uverbs_release_ucq(
@@ -55,7 +55,7 @@ static int uverbs_free_cq(struct ib_uobject *uobject, ev_queue) :NULL , ucq); -return ret; +return 0 ; } static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
drivers/infiniband/core/uverbs_std_types_dm.c +2 -4
@@ -39,11 +39,9 @@ static int uverbs_free_dm(struct ib_uobject *uobject, struct uverbs_attr_bundle *attrs) {struct ib_dm *dm = uobject->object; -int ret; - ret =ib_destroy_usecnt (&dm->usecnt, why, uobject); -if (ret) -return ret; +if (atomic_read (&dm->usecnt)) +return -EBUSY ;return dm->device->ops.dealloc_dm (dm, attrs); }
drivers/infiniband/core/uverbs_std_types_flow_action.c +2 -4
@@ -39,11 +39,9 @@ static int uverbs_free_flow_action(struct ib_uobject *uobject, struct uverbs_attr_bundle *attrs) {struct ib_flow_action *action = uobject->object; -int ret; - ret =ib_destroy_usecnt (&action->usecnt, why, uobject); -if (ret) -return ret; +if (atomic_read (&action->usecnt)) +return -EBUSY ;return action->device->ops.destroy_flow_action (action); }
drivers/infiniband/core/uverbs_std_types_qp.c +2 -2
@@ -32,14 +32,14 @@ static int uverbs_free_qp(struct ib_uobject *uobject, } ret =ib_destroy_qp_user (qp, &attrs->driver_udata); -if (ib_is_destroy_retryable (ret, why, uobject)) +if (ret)return ret;if (uqp->uxrcd)atomic_dec (&uqp->uxrcd->refcnt);ib_uverbs_release_uevent (&uqp->uevent); -return ret; +return 0 ; } static int check_creation_flags(enum ib_qp_type qp_type,
drivers/infiniband/core/uverbs_std_types_srq.c +2 -2
@@ -18,7 +18,7 @@ static int uverbs_free_srq(struct ib_uobject *uobject,int ret; ret =ib_destroy_srq_user (srq, &attrs->driver_udata); -if (ib_is_destroy_retryable (ret, why, uobject)) +if (ret)return ret;if (srq_type ==IB_SRQT_XRC ) {
@@ -30,7 +30,7 @@ static int uverbs_free_srq(struct ib_uobject *uobject, }ib_uverbs_release_uevent (uevent); -return ret; +return 0 ; } static int UVERBS_HANDLER(UVERBS_METHOD_SRQ_CREATE)(
drivers/infiniband/core/uverbs_std_types_wq.c +2 -2
@@ -17,11 +17,11 @@ static int uverbs_free_wq(struct ib_uobject *uobject,int ret; ret =ib_destroy_wq_user (wq, &attrs->driver_udata); -if (ib_is_destroy_retryable (ret, why, uobject)) +if (ret)return ret;ib_uverbs_release_uevent (&uwq->uevent); -return ret; +return 0 ; } static int UVERBS_HANDLER(UVERBS_METHOD_WQ_CREATE)(
drivers/infiniband/hw/mlx5/devx.c +2 -2
@@ -1311,7 +1311,7 @@ static int devx_obj_cleanup(struct ib_uobject *uobject,else ret =mlx5_cmd_exec (obj->ib_dev->mdev, obj->dinbox, obj->dinlen, out,sizeof (out)); -if (ib_is_destroy_retryable (ret, why, uobject)) +if (ret)return ret; devx_event_table = &dev->devx_event_table;
@@ -2187,7 +2187,7 @@ static int devx_umem_cleanup(struct ib_uobject *uobject,int err; err =mlx5_cmd_exec (obj->mdev, obj->dinbox, obj->dinlen, out,sizeof (out)); -if (ib_is_destroy_retryable (err, why, uobject)) +if (err)return err;ib_umem_release (obj->umem);
drivers/infiniband/hw/mlx5/fs.c +2 -4
@@ -2035,11 +2035,9 @@ static int flow_matcher_cleanup(struct ib_uobject *uobject, struct uverbs_attr_bundle *attrs) {struct mlx5_ib_flow_matcher *obj = uobject->object; -int ret; - ret =ib_destroy_usecnt (&obj->usecnt, why, uobject); -if (ret) -return ret; +if (atomic_read (&obj->usecnt)) +return -EBUSY ;kfree (obj);return 0 ;
include/rdma/ib_verbs.h +2 -42
62 lines not on this page · raw message
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 72/217 MIPS: BMC47xx: fix kconfig dependency bug for BCM47XX_SSB
In reply to Sasha LevinFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 09a48cbcd7af9203296938044f1100bb113ce01a ]
When BCM47XX_SSB is enabled and SSB_PCIHOST is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for SSB_B43_PCI_BRIDGE
Depends on [n]: SSB [=y] && SSB_PCIHOST [=n]
Selected by [y]:
- BCM47XX_SSB [=y] && BCM47XX [=y] && PCI [=y]
The reason is that BCM47XX_SSB selects SSB_B43_PCI_BRIDGE without depending on or selecting SSB_PCIHOST while SSB_B43_PCI_BRIDGE depends on SSB_PCIHOST. This can also fail building the kernel as demonstrated in a bug report.
Honor the kconfig dependency to remove unmet direct dependency warnings and avoid any potential build failures.
--- arch/mips/bcm47xx/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/bcm47xx/Kconfig +1 -0
@@ -9,6 +9,7 @@ config BCM47XX_SSB select SSB_DRIVER_MIPS select SSB_DRIVER_EXTIF select SSB_EMBEDDED + select SSB_PCIHOST if PCI select SSB_B43_PCI_BRIDGE if PCI select SSB_DRIVER_PCICORE if PCI select SSB_PCICORE_HOSTMODE if PCI
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 73/217 net: ipconfig: Avoid spurious blank lines in boot log
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
[ Upstream commit c9f64d1fc101c64ea2be1b2e562b4395127befc9 ]
When dumping the name and NTP servers advertised by DHCP, a blank line is emitted if either of the lists is empty. This can lead to confusing issues such as the blank line getting flagged as warning. This happens because the blank line is the result of pr_cont("\n") and that may see its level corrupted by some other driver concurrently writing to the console.
Fix this by making sure that the terminating newline is only emitted if at least one entry in the lists was printed before.
--- net/ipv4/ipconfig.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
net/ipv4/ipconfig.c +9 -5
@@ -1441,7 +1441,7 @@ static int __init ip_auto_config(void)int retries =CONF_OPEN_RETRIES ;#endif int err; -unsigned int i; +unsigned int i, count;/* Initialise all name servers and NTP servers to NONE (but only if the * "ip=" or "nfsaddrs=" kernel command line parameters weren't decoded,
@@ -1575,7 +1575,7 @@ static int __init ip_auto_config(void)if (ic_dev_mtu)pr_cont (", mtu=%d" , ic_dev_mtu);/* Name servers (if any): */ -for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) { +for (i =0 , count =0 ; i <CONF_NAMESERVERS_MAX ; i++) {if (ic_nameservers[i] !=NONE ) {if (i ==0 ) pr_info(" nameserver%u=%pI4",
@@ -1583,12 +1583,14 @@ static int __init ip_auto_config(void)else pr_cont (", nameserver%u=%pI4" , i, &ic_nameservers[i]); + + count++; } -if (i +1 ==CONF_NAMESERVERS_MAX ) +if ((i +1 ==CONF_NAMESERVERS_MAX ) && count >0 )pr_cont ("\n" ); }/* NTP servers (if any): */ -for (i =0 ; i <CONF_NTP_SERVERS_MAX ; i++) { +for (i =0 , count =0 ; i <CONF_NTP_SERVERS_MAX ; i++) {if (ic_ntp_servers[i] !=NONE ) {if (i ==0 ) pr_info(" ntpserver%u=%pI4",
@@ -1596,8 +1598,10 @@ static int __init ip_auto_config(void) else pr_cont(", ntpserver%u=%pI4", i, &ic_ntp_servers[i]); + + count++; } -if (i +1 ==CONF_NTP_SERVERS_MAX ) +if ((i +1 ==CONF_NTP_SERVERS_MAX ) && count >0 )pr_cont ("\n" ); }#endif /* !SILENT */
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 74/217 drm/amd/amdgpu: Update VCN initizalization behvaior
In reply to Sasha LevinFrom: Bokun Zhang <[email protected]>
[ Upstream commit 3617e579eba427ed1f6b86050fe678623184db74 ]
- Issue:
In the original vcn3.0 code, it assumes that the VCN's init_status is always 1, even after the MMSCH updates the header.
This is incorrect since by default, it should be set to 0, and MMSCH will update it to 1 if VCN is ready.
- Fix:
We need to read back the table header after send it to MMSCH. After that, if a VCN instance is not ready (host disabled it), we needs to disable the ring buffer as well.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 46 +++++++++++++++++++++------ 1 file changed, 37 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +37 -9
@@ -294,17 +294,19 @@ static int vcn_v3_0_hw_init(void *handle)continue ; ring = &adev->vcn.inst[i].ring_dec; - ring->wptr =0 ; - ring->wptr_old =0 ; -vcn_v3_0_dec_ring_set_wptr (ring); - ring->sched.ready = true; +if (ring->sched.ready) { + ring->wptr =0 ; + ring->wptr_old =0 ; +vcn_v3_0_dec_ring_set_wptr (ring); + }for (j =0 ; j < adev->vcn.num_enc_rings; ++j) { ring = &adev->vcn.inst[i].ring_enc[j]; - ring->wptr =0 ; - ring->wptr_old =0 ; -vcn_v3_0_enc_ring_set_wptr (ring); - ring->sched.ready = true; +if (ring->sched.ready) { + ring->wptr =0 ; + ring->wptr_old =0 ; +vcn_v3_0_enc_ring_set_wptr (ring); + } } } }else {
@@ -1239,6 +1241,8 @@ static int vcn_v3_0_start_sriov(struct amdgpu_device *adev)uint32_t table_size;uint32_t size, size_dw; +bool is_vcn_ready; +struct mmsch_v3_0_cmd_direct_write direct_wt = { {0 } };struct mmsch_v3_0_cmd_direct_read_modify_write
@@ -1376,7 +1380,7 @@ static int vcn_v3_0_start_sriov(struct amdgpu_device *adev)MMSCH_V3_0_INSERT_END ();/* refine header */ - header.inst[i].init_status =1 ; + header.inst[i].init_status =0 ; header.inst[i].table_offset = header.total_size; header.inst[i].table_size = table_size; header.total_size += table_size;
@@ -1434,6 +1438,30 @@ static int vcn_v3_0_start_sriov(struct amdgpu_device *adev) } } +/* 6, check each VCN's init_status +* if it remains as 0, then this VCN is not assigned to current VF +* do not start ring for this VCN +*/ + size =sizeof (struct mmsch_v3_0_init_header ); + table_loc = (uint32_t *)table->cpu_addr; +memcpy (&header, (void *)table_loc, size); + +for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { +if (adev->vcn.harvest_config & (1 << i)) +continue ; + + is_vcn_ready = (header.inst[i].init_status ==1 ); +if (!is_vcn_ready) +DRM_INFO ("VCN(%d) engine is disabled by hypervisor\n" , i); + + ring = &adev->vcn.inst[i].ring_dec; + ring->sched.ready = is_vcn_ready; +for (j =0 ; j < adev->vcn.num_enc_rings; ++j) { + ring = &adev->vcn.inst[i].ring_enc[j]; + ring->sched.ready = is_vcn_ready; + } + } +return 0 ; }
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 75/217 drm/amdgpu: check hive pointer before access
In reply to Sasha LevinFrom: Hawking Zhang <[email protected]>
[ Upstream commit a9f5f98f796ee93a865b9886bf7cb694cf124eb5 ]
in case it is an invalid one
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +9 -4
@@ -395,12 +395,17 @@ void amdgpu_put_xgmi_hive(struct amdgpu_hive_info *hive)int amdgpu_xgmi_set_pstate (struct amdgpu_device *adev,int pstate) {int ret =0 ; -struct amdgpu_hive_info *hive =amdgpu_get_xgmi_hive (adev); -struct amdgpu_device *request_adev = hive->hi_req_gpu ? - hive->hi_req_gpu : adev; +struct amdgpu_hive_info *hive; +struct amdgpu_device *request_adev;bool is_hi_req = pstate ==AMDGPU_XGMI_PSTATE_MAX_VEGA20 ; -bool init_low = hive->pstate ==AMDGPU_XGMI_PSTATE_UNKNOWN ; +bool init_low; + + hive =amdgpu_get_xgmi_hive (adev); +if (!hive) +return 0 ; + request_adev = hive->hi_req_gpu ? hive->hi_req_gpu : adev; + init_low = hive->pstate ==AMDGPU_XGMI_PSTATE_UNKNOWN ;amdgpu_put_xgmi_hive (hive);/* fw bug so temporarily disable pstate switching */ return 0 ;
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 76/217 jfs: Fix memleak in dbAdjCtl
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 751341b4d7841e2b76e78eec382c2e119165497f ]
When dbBackSplit() fails, mp should be released to prevent memleak. It's the same when dbJoin() fails.
--- fs/jfs/jfs_dmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/jfs/jfs_dmap.c +6 -2
@@ -2549,15 +2549,19 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)*/ if (oldval ==NOFREE ) { rc =dbBackSplit ((dmtree_t *) dcp, leafno); -if (rc) +if (rc) { +release_metapage (mp);return rc; + } oldval = dcp->stree[ti]; }dbSplit ((dmtree_t *) dcp, leafno, dcp->budmin, newval); }else { rc =dbJoin ((dmtree_t *) dcp, leafno, newval); -if (rc) +if (rc) { +release_metapage (mp);return rc; + } }/* check if the root of the current dmap control page changed due
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 77/217 r8169: use READ_ONCE in rtl_tx_slots_avail
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 95f3c5458dfa5856bb110e31d156e00d894d0134 ]
tp->dirty_tx and tp->cur_tx may be changed by a racing rtl_tx() or rtl8169_start_xmit(). Use READ_ONCE() to annotate the races and ensure that the compiler doesn't use cached values.
--- drivers/net/ethernet/realtek/r8169_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +2 -1
@@ -4173,7 +4173,8 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,static bool rtl_tx_slots_avail (struct rtl8169_private *tp,unsigned int nr_frags) { -unsigned int slots_avail = tp->dirty_tx +NUM_TX_DESC - tp->cur_tx; +unsigned int slots_avail =READ_ONCE (tp->dirty_tx) +NUM_TX_DESC + -READ_ONCE (tp->cur_tx);/* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */ return slots_avail > nr_frags;
Signature · 1 line
2.27.0