kconfig: merge_config: use an empty file as initfile
Subsystems (79)
Sasha Levin
maintainerPATCH 147/486 wifi: iwlwifi: don't warn when if there is a FW error
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit c7f50d0433a016d43681592836a3d484817bfb34 ]
iwl_trans_reclaim is warning if it is called when the FW is not alive. But if it is called when there is a pending restart, i.e. after a FW error, there is no need to warn, instead - return silently.
--- drivers/net/wireless/intel/iwlwifi/iwl-trans.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-trans.c +4 -1
@@ -2,7 +2,7 @@/* * Copyright (C) 2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH -* Copyright (C) 2019-2021, 2023-2024 Intel Corporation +* Copyright (C) 2019-2021, 2023-2025 Intel Corporation */ #include <linux/kernel.h> #include <linux/bsearch.h>
@@ -420,6 +420,9 @@ IWL_EXPORT_SYMBOL(iwl_trans_tx);void iwl_trans_reclaim (struct iwl_trans *trans,int queue,int ssn,struct sk_buff_head *skbs,bool is_flush) { +if (unlikely (test_bit (STATUS_FW_ERROR , &trans->status))) +return ; +if (WARN_ONCE (trans->state !=IWL_TRANS_FW_ALIVE ,"bad state = %d\n" , trans->state))return ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 148/486 wifi: iwlwifi: w/a FW SMPS mode selection
In reply to Sasha LevinFrom: Daniel Gabay <[email protected]>
[ Upstream commit b2e709805ce955f80803b7cab3421813c79e1df4 ]
The FW is now responsible of determining the SMPS mode.
If the user disabled power save in a certain vif, we send the vif-level power command to clear out the POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK bit for that vif.
But erroneously, the FW checks DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK in the device-level command to determine the SMPS mode.
To W/A this, send also the device-level command when the power save of a vif changes, and disable power save if there is any vif that has power save disabled.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 15 +++++++++++++++ .../net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +15 -0
@@ -4096,6 +4096,20 @@ iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm,return 0 ; } +void iwl_mvm_smps_workaround (struct iwl_mvm *mvm,struct ieee80211_vif *vif, +bool update) +{ +struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); + +if (!iwl_mvm_has_rlc_offload (mvm)) +return ; + + mvmvif->ps_disabled = !vif->cfg.ps; + +if (update) +iwl_mvm_power_update_mac (mvm); +} +/* Common part for MLD and non-MLD modes */ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -4188,6 +4202,7 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw, new_state == IEEE80211_STA_AUTHORIZED) { ret =iwl_mvm_sta_state_assoc_to_authorized (mvm, vif, sta, callbacks); +iwl_mvm_smps_workaround (mvm, vif, true); } else if (old_state == IEEE80211_STA_AUTHORIZED && new_state == IEEE80211_STA_ASSOC) { ret = iwl_mvm_sta_state_authorized_to_assoc(mvm, vif, sta,
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +2 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2022-2024 Intel Corporation +* Copyright (C) 2022-2025 Intel Corporation */ #include "mvm.h"
@@ -961,6 +961,7 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm, }if (changes &BSS_CHANGED_PS ) { +iwl_mvm_smps_workaround (mvm, vif, false); ret =iwl_mvm_power_update_mac (mvm);if (ret)IWL_ERR (mvm,"failed to update power mode\n" );
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +3 -0
@@ -3042,4 +3042,7 @@ iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm,struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, bool is_ap); + +void iwl_mvm_smps_workaround (struct iwl_mvm *mvm,struct ieee80211_vif *vif, +bool update);#endif /* __IWL_MVM_H__ */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 149/486 wifi: iwlwifi: fix debug actions order
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit eb29b4ffafb20281624dcd2cbb768d6f30edf600 ]
The order of actions taken for debug was implemented incorrectly. Now we implemented the dump split and do the FW reset only in the middle of the dump (rather than the FW killing itself on error.) As a result, some of the actions taken when applying the config will now crash the device, so we need to fix the order.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +5 -5
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2018-2024 Intel Corporation +* Copyright (C) 2018-2025 Intel Corporation */ #include <linux/firmware.h> #include "iwl-drv.h"
@@ -1372,15 +1372,15 @@ void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,switch (tp_id) {case IWL_FW_INI_TIME_POINT_EARLY :iwl_dbg_tlv_init_cfg (fwrt); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_update_drams (fwrt);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data,NULL ); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ;case IWL_FW_INI_TIME_POINT_AFTER_ALIVE :iwl_dbg_tlv_apply_buffers (fwrt);iwl_dbg_tlv_send_hcmds (fwrt, hcmd_list); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data,NULL ); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ;case IWL_FW_INI_TIME_POINT_PERIODIC :iwl_dbg_tlv_set_periodic_trigs (fwrt);
@@ -1390,14 +1390,14 @@ void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_TIME_POINT_MISSED_BEACONS :case IWL_FW_INI_TIME_POINT_FW_DHC_NOTIFICATION :iwl_dbg_tlv_send_hcmds (fwrt, hcmd_list); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data, iwl_dbg_tlv_check_fw_pkt); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ;default :iwl_dbg_tlv_send_hcmds (fwrt, hcmd_list); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data,NULL ); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 150/486 wifi: iwlwifi: mark Br device not integrated
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 5f0ab2f35a43773a0dfe1297129a8dbff906b932 ]
This is a discrete device, don't mark it as integrated. This also means we cannot set the LTR delay.
--- drivers/net/wireless/intel/iwlwifi/cfg/dr.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/dr.c +0 -2
@@ -148,11 +148,9 @@ const struct iwl_cfg_trans_params iwl_br_trans_cfg = { .mq_rx_supported = true, .rf_id = true, .gen2 = true, - .integrated = true, .umac_prph_offset = 0x300000, .xtal_latency = 12000, .low_latency_xtal = true, - .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US, };const char iwl_br_name[] ="Intel(R) TBD Br device" ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 151/486 wifi: iwlwifi: fix the ECKV UEFI variable name
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 3ea2970b0578011ab8402ad0cff39712255f63df ]
This UEFI variable name was badly named. Fix its name and also use the right GUID to find it: we need to use the BT_WIFI (a.k.a. Common) GUID.
--- drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 8 +++++--- drivers/net/wireless/intel/iwlwifi/fw/uefi.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/uefi.c +5 -3
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright(c) 2021-2024 Intel Corporation +* Copyright(c) 2021-2025 Intel Corporation */ #include "iwl-drv.h"
@@ -673,8 +673,10 @@ int iwl_uefi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk)struct uefi_cnv_var_eckv *data;int ret =0 ; - data =iwl_uefi_get_verified_variable (fwrt->trans,IWL_UEFI_ECKV_NAME , -"ECKV" ,sizeof (*data),NULL ); + data =iwl_uefi_get_verified_variable_guid (fwrt->trans, + &IWL_EFI_WIFI_BT_GUID , +IWL_UEFI_ECKV_NAME , +"ECKV" ,sizeof (*data),NULL );if (IS_ERR (data))return -EINVAL ;
drivers/net/wireless/intel/iwlwifi/fw/uefi.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright(c) 2021-2024 Intel Corporation +* Copyright(c) 2021-2025 Intel Corporation */ #ifndef __iwl_fw_uefi__#define __iwl_fw_uefi__
@@ -19,7 +19,7 @@#define IWL_UEFI_WTAS_NAME L"UefiCnvWlanWTAS"#define IWL_UEFI_SPLC_NAME L"UefiCnvWlanSPLC"#define IWL_UEFI_WRDD_NAME L"UefiCnvWlanWRDD" -#define IWL_UEFI_ECKV_NAME L"UefiCnvWlanECKV" +#define IWL_UEFI_ECKV_NAME L"UefiCnvCommonECKV"#define IWL_UEFI_DSM_NAME L"UefiCnvWlanGeneralCfg"#define IWL_UEFI_WBEM_NAME L"UefiCnvWlanWBEM"#define IWL_UEFI_PUNCTURING_NAME L"UefiCnvWlanPuncturing"
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 152/486 wifi: mac80211: fix warning on disconnect during failed ML reconf
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 0e104aa3676d020f6c442cd7fbaeb72adaaab6fc ]
If multi-link reconfiguration fails, we can disconnect with a local link already allocated but the BSS entry not assigned yet, which leads to a warning in cfg80211. Add a check to avoid the warning.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -4033,7 +4033,7 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)struct ieee80211_link_data *link; link =sdata_dereference (sdata->link[link_id], sdata); -if (!link) +if (!link || !link->conf->bss)continue ;cfg80211_unlink_bss (local->hw.wiphy, link->conf->bss); link->conf->bss =NULL ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 153/486 wifi: mac80211_hwsim: Fix MLD address translation
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 65bff0be9b154621b617fc2e4bd89f1e18e97cdb ]
Do address translations only between shared links. It is possible that while an non-AP MLD station and an AP MLD station have shared links, the frame is intended to be sent on a link which is not shared (for example when sending a probe response).
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim.c +8 -6
@@ -4,7 +4,7 @@* Copyright (c) 2008, Jouni Malinen <[email protected]> * Copyright (c) 2011, Javier Lopez <[email protected]> * Copyright (c) 2016 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2024 Intel Corporation +* Copyright (C) 2018 - 2025 Intel Corporation */ /*
@@ -1983,11 +1983,13 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,return ; } -if (sta && sta->mlo) { -if (WARN_ON (!link_sta)) { -ieee80211_free_txskb (hw, skb); -return ; - } +/* Do address translations only between shared links. It is +* possible that while an non-AP MLD station and an AP MLD +* station have shared links, the frame is intended to be sent +* on a link which is not shared (for example when sending a +* probe response). +*/ +if (sta && sta->mlo && link_sta) {/* address translation to link addresses on TX */ ether_addr_copy (hdr->addr1, link_sta->addr);ether_addr_copy (hdr->addr2, bss_conf->addr);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 154/486 wifi: cfg80211: allow IR in 20 MHz configurations
In reply to Sasha LevinFrom: Anjaneyulu <[email protected]>
[ Upstream commit cf4bd1608882792d4742e27a819493312904a680 ]
Some regulatory bodies doesn't allow IR (initiate radioation) on a specific subband, but allows it for channels with a bandwidth of 20 MHz. Add a channel flag that indicates that, and consider it in cfg80211_reg_check_beaconing.
While on it, fix the kernel doc of enum nl80211_reg_rule_flags and change it to use BIT().
--- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 52 ++++++++++++++++++++---------------- net/wireless/chan.c | 8 +++++- net/wireless/nl80211.c | 4 +++ net/wireless/reg.c | 4 ++- 5 files changed, 46 insertions(+), 25 deletions(-)
include/net/cfg80211.h +3 -0
@@ -127,6 +127,8 @@ struct wiphy;* even if it is otherwise disabled. * @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation * with very low power (VLP), even if otherwise set to NO_IR. +* @IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY: Allow activity on a 20 MHz channel, +* even if otherwise set to NO_IR. */ enum ieee80211_channel_flags {IEEE80211_CHAN_DISABLED =BIT (0 ),
@@ -155,6 +157,7 @@ enum ieee80211_channel_flags {IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT =BIT (23 ),IEEE80211_CHAN_CAN_MONITOR =BIT (24 ),IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP =BIT (25 ), + IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY = BIT(26), };#define IEEE80211_CHAN_NO_HT40 \
include/uapi/linux/nl80211.h +29 -23
72 lines not on this page · raw message
net/wireless/chan.c +7 -1
@@ -6,7 +6,7 @@* * Copyright 2009 Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH -* Copyright 2018-2024 Intel Corporation +* Copyright 2018-2025 Intel Corporation */ #include <linux/export.h>
@@ -1621,6 +1621,12 @@ bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,if (cfg->reg_power ==IEEE80211_REG_VLP_AP ) permitting_flags |=IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP ; +if ((cfg->iftype ==NL80211_IFTYPE_P2P_GO || + cfg->iftype ==NL80211_IFTYPE_AP ) && + (chandef->width ==NL80211_CHAN_WIDTH_20_NOHT || + chandef->width ==NL80211_CHAN_WIDTH_20 )) + permitting_flags |=IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY ; +return _cfg80211_reg_can_beacon (wiphy, chandef, cfg->iftype, check_no_ir ?IEEE80211_CHAN_NO_IR :0 , permitting_flags);
net/wireless/nl80211.c +4 -0
@@ -1213,6 +1213,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, struct wiphy *wiphy,if ((chan->flags &IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP ) &&nla_put_flag (msg,NL80211_FREQUENCY_ATTR_ALLOW_6GHZ_VLP_AP )) goto nla_put_failure; +if ((chan->flags &IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY ) && +nla_put_flag (msg, +NL80211_FREQUENCY_ATTR_ALLOW_20MHZ_ACTIVITY )) + goto nla_put_failure; } if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
net/wireless/reg.c +3 -1
@@ -5,7 +5,7 @@* Copyright 2008-2011 Luis R. Rodriguez <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2024 Intel Corporation +* Copyright (C) 2018 - 2025 Intel Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -1603,6 +1603,8 @@ static u32 map_regdom_flags(u32 rd_flags) channel_flags |=IEEE80211_CHAN_PSD ;if (rd_flags &NL80211_RRF_ALLOW_6GHZ_VLP_AP ) channel_flags |=IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP ; +if (rd_flags &NL80211_RRF_ALLOW_20MHZ_ACTIVITY ) + channel_flags |=IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY ;return channel_flags; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 155/486 ipv6: save dontfrag in cork
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit a18dfa9925b9ef6107ea3aa5814ca3c704d34a8a ]
When spanning datagram construction over multiple send calls using MSG_MORE, per datagram settings are configured on the first send.
That is when ip(6)_setup_cork stores these settings for subsequent use in __ip(6)_append_data and others.
The only flag that escaped this was dontfrag. As a result, a datagram could be constructed with df=0 on the first sendmsg, but df=1 on a next. Which is what cmsg_ip.sh does in an upcoming MSG_MORE test in the "diff" scenario.
Changing datagram conditions in the middle of constructing an skb makes this already complex code path even more convoluted. It is here unintentional. Bring this flag in line with expected sockopt/cmsg behavior.
And stop passing ipc6 to __ip6_append_data, to avoid such issues in the future. This is already the case for __ip_append_data.
inet6_cork had a 6 byte hole, so the 1B flag has no impact.
--- include/linux/ipv6.h | 1 + net/ipv6/ip6_output.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
include/linux/ipv6.h +1 -0
@@ -207,6 +207,7 @@ struct inet6_cork {struct ipv6_txoptions *opt;u8 hop_limit;u8 tclass; + u8 dontfrag:1; };/* struct ipv6_pinfo - ipv6 private area */
net/ipv6/ip6_output.c +5 -4
@@ -1386,6 +1386,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, } v6_cork->hop_limit = ipc6->hlimit; v6_cork->tclass = ipc6->tclass; + v6_cork->dontfrag = ipc6->dontfrag;if (rt->dst.flags &DST_XFRM_TUNNEL ) mtu =READ_ONCE (np->pmtudisc) >=IPV6_PMTUDISC_PROBE ?READ_ONCE (rt->dst.dev->mtu) :dst_mtu (&rt->dst);
@@ -1417,7 +1418,7 @@ static int __ip6_append_data(struct sock *sk,int getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), void *from, size_t length, int transhdrlen, - unsigned int flags, struct ipcm6_cookie *ipc6) + unsigned int flags) { struct sk_buff *skb, *skb_prev = NULL;struct inet_cork *cork = &cork_full->base;
@@ -1471,7 +1472,7 @@ static int __ip6_append_data(struct sock *sk,if (headersize + transhdrlen > mtu) goto emsgsize; -if (cork->length + length > mtu - headersize && ipc6->dontfrag && +if (cork->length + length > mtu - headersize && v6_cork->dontfrag && (sk->sk_protocol ==IPPROTO_UDP || sk->sk_protocol ==IPPROTO_ICMPV6 || sk->sk_protocol ==IPPROTO_RAW )) {
@@ -1843,7 +1844,7 @@ int ip6_append_data(struct sock *sk,return __ip6_append_data (sk, &sk->sk_write_queue, &inet->cork, &np->cork,sk_page_frag (sk), getfrag, - from, length, transhdrlen, flags, ipc6); + from, length, transhdrlen, flags); }EXPORT_SYMBOL_GPL (ip6_append_data);
@@ -2048,7 +2049,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk, err =__ip6_append_data (sk, &queue, cork, &v6_cork, ¤t->task_frag, getfrag, from, length + exthdrlen, transhdrlen + exthdrlen, - flags, ipc6); + flags);if (err) {__ip6_flush_pending_frames (sk, &queue, cork, &v6_cork);return ERR_PTR (err);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 156/486 drm/amd/display: remove minimum Dispclk and apply oem panel timing.
In reply to Sasha LevinFrom: Charlene Liu <[email protected]>
[ Upstream commit 756e58e83e89d372b94269c0cde61fe55da76947 ]
[why & how]
1. apply oem panel timing (not only on OLED)
2. remove MIN_DPP_DISP_CLK request in driver.
This fix will apply for dcn31x but not
sync with DML's output.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 2 -- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 2 -- drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 3 ++- 3 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +0 -2
@@ -194,8 +194,6 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,// workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. if (new_clocks->dppclk_khz <MIN_DPP_DISP_CLK ) new_clocks->dppclk_khz =MIN_DPP_DISP_CLK ; -if (new_clocks->dispclk_khz <MIN_DPP_DISP_CLK ) - new_clocks->dispclk_khz =MIN_DPP_DISP_CLK ;if (should_set_clock (safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +0 -2
@@ -201,8 +201,6 @@ static void dcn316_update_clocks(struct clk_mgr *clk_mgr_base,// workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. if (new_clocks->dppclk_khz <100000 ) new_clocks->dppclk_khz =100000 ; -if (new_clocks->dispclk_khz <100000 ) - new_clocks->dispclk_khz =100000 ;if (should_set_clock (safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +2 -1
@@ -1064,7 +1064,8 @@ void dce110_edp_backlight_control(DC_LOG_DC ("edp_receiver_ready_T9 skipped\n" ); } -if (!enable && link->dpcd_sink_ext_caps.bits.oled) { +if (!enable) { +/*follow oem panel config's requirement*/ pre_T11_delay += link->panel_config.pps.extra_pre_t11_ms;msleep (pre_T11_delay); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 157/486 drm/amd/display: calculate the remain segments for all pipes
In reply to Sasha LevinFrom: Zhikai Zhai <[email protected]>
[ Upstream commit d3069feecdb5542604d29b59acfd1fd213bad95b ]
[WHY]
In some cases the remain de-tile buffer segments will be greater than zero if we don't add the non-top pipe to calculate, at this time the override de-tile buffer size will be valid and used. But it makes the de-tile buffer segments used finally for all of pipes exceed the maximum.
[HOW]
Add the non-top pipe to calculate the remain de-tile buffer segments. Don't set override size to use the average according to pipe count if the value exceed the maximum.
--- .../dc/resource/dcn315/dcn315_resource.c | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c +20 -22
@@ -1699,7 +1699,7 @@ static int dcn315_populate_dml_pipes_from_context( pipes[pipe_cnt].dout.dsc_input_bpc =0 ;DC_FP_START ();dcn31_zero_pipe_dcc_fraction (pipes, pipe_cnt); -if (pixel_rate_crb && !pipe->top_pipe && !pipe->prev_odm_pipe) { +if (pixel_rate_crb) {int bpp =source_format_to_bpp (pipes[pipe_cnt].pipe.src.source_format);/* Ceil to crb segment size */ int approx_det_segs_required_for_pstate = dcn_get_approx_det_segs_required_for_pstate(
@@ -1756,28 +1756,26 @@ static int dcn315_populate_dml_pipes_from_context(continue ; } -if (!pipe->top_pipe && !pipe->prev_odm_pipe) { -bool split_required = pipe->stream->timing.pix_clk_100hz >=dcn_get_max_non_odm_pix_rate_100hz (&dc->dml.soc) - || (pipe->plane_state && pipe->plane_state->src_rect.width >5120 ); - -if (remaining_det_segs >MIN_RESERVED_DET_SEGS && crb_pipes !=0 ) - pipes[pipe_cnt].pipe.src.det_size_override += (remaining_det_segs -MIN_RESERVED_DET_SEGS ) / crb_pipes + - (crb_idx < (remaining_det_segs -MIN_RESERVED_DET_SEGS ) % crb_pipes ?1 :0 ); -if (pipes[pipe_cnt].pipe.src.det_size_override >2 *DCN3_15_MAX_DET_SEGS ) { -/* Clamp to 2 pipe split max det segments */ - remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override -2 * (DCN3_15_MAX_DET_SEGS ); - pipes[pipe_cnt].pipe.src.det_size_override =2 *DCN3_15_MAX_DET_SEGS ; - } -if (pipes[pipe_cnt].pipe.src.det_size_override >DCN3_15_MAX_DET_SEGS || split_required) { -/* If we are splitting we must have an even number of segments */ - remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override %2 ; - pipes[pipe_cnt].pipe.src.det_size_override -= pipes[pipe_cnt].pipe.src.det_size_override %2 ; - } -/* Convert segments into size for DML use */ - pipes[pipe_cnt].pipe.src.det_size_override *=DCN3_15_CRB_SEGMENT_SIZE_KB ; - - crb_idx++; +bool split_required = pipe->stream->timing.pix_clk_100hz >=dcn_get_max_non_odm_pix_rate_100hz (&dc->dml.soc) + || (pipe->plane_state && pipe->plane_state->src_rect.width >5120 ); + +if (remaining_det_segs >MIN_RESERVED_DET_SEGS && crb_pipes !=0 ) + pipes[pipe_cnt].pipe.src.det_size_override += (remaining_det_segs -MIN_RESERVED_DET_SEGS ) / crb_pipes + + (crb_idx < (remaining_det_segs -MIN_RESERVED_DET_SEGS ) % crb_pipes ?1 :0 ); +if (pipes[pipe_cnt].pipe.src.det_size_override >2 *DCN3_15_MAX_DET_SEGS ) { +/* Clamp to 2 pipe split max det segments */ + remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override -2 * (DCN3_15_MAX_DET_SEGS ); + pipes[pipe_cnt].pipe.src.det_size_override =2 *DCN3_15_MAX_DET_SEGS ; + } +if (pipes[pipe_cnt].pipe.src.det_size_override >DCN3_15_MAX_DET_SEGS || split_required) { +/* If we are splitting we must have an even number of segments */ + remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override %2 ; + pipes[pipe_cnt].pipe.src.det_size_override -= pipes[pipe_cnt].pipe.src.det_size_override %2 ; } +/* Convert segments into size for DML use */ + pipes[pipe_cnt].pipe.src.det_size_override *=DCN3_15_CRB_SEGMENT_SIZE_KB ; + + crb_idx++; pipe_cnt++; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 158/486 drm/amd/display: not abort link train when bw is low
In reply to Sasha LevinFrom: Peichen Huang <[email protected]>
[ Upstream commit 8a21da2842bb22b2b80e5902d0438030d729bfd3 ]
[WHY]
DP tunneling should not abort link train even bandwidth become too low after downgrade. Otherwise, it would fail compliance test.
[HOW}
Do link train with downgrade settings even bandwidth is not enough
--- .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +1 -4
@@ -1769,13 +1769,10 @@ bool perform_link_training_with_retries( is_link_bw_min = ((cur_link_settings.link_rate <=LINK_RATE_LOW ) && (cur_link_settings.lane_count <=LANE_COUNT_ONE )); -if (is_link_bw_low) { +if (is_link_bw_low)DC_LOG_WARNING ("%s: Link(%d) bandwidth too low after fallback req_bw(%d) > link_bw(%d)\n" , __func__, link->link_index, req_bw, link_bw); - -return false; - } }msleep (delay_between_attempts);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 159/486 drm/amd/display: Fix incorrect DPCD configs while Replay/PSR switch
In reply to Sasha LevinFrom: Leon Huang <[email protected]>
[ Upstream commit 0d9cabc8f591ea1cd97c071b853b75b155c13259 ]
[Why]
When switching between PSR/Replay,
the DPCD config of previous mode is not cleared, resulting in unexpected behavior in TCON.
[How]
Initialize the DPCD in setup function
--- .../link/protocols/link_edp_panel_control.c | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +22 -3
@@ -674,6 +674,18 @@ bool edp_setup_psr(struct dc_link *link,if (!link)return false; +//Clear PSR cfg +memset (&psr_configuration,0 ,sizeof (psr_configuration)); +dm_helpers_dp_write_dpcd ( + link->ctx, + link, +DP_PSR_EN_CFG , + &psr_configuration.raw, +sizeof (psr_configuration.raw)); + +if (link->psr_settings.psr_version ==DC_PSR_VERSION_UNSUPPORTED ) +return false; + dc = link->ctx->dc; dmcu = dc->res_pool->dmcu; psr = dc->res_pool->psr;
@@ -684,9 +696,6 @@ bool edp_setup_psr(struct dc_link *link,if (!dc_get_edp_link_panel_inst (dc, link, &panel_inst))return false; - -memset (&psr_configuration,0 ,sizeof (psr_configuration)); - psr_configuration.bits.ENABLE =1 ; psr_configuration.bits.CRC_VERIFICATION =1 ; psr_configuration.bits.FRAME_CAPTURE_INDICATION =
@@ -950,6 +959,16 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *streamif (!link)return false; +//Clear Replay config +dm_helpers_dp_write_dpcd (link->ctx, link, +DP_SINK_PR_ENABLE_AND_CONFIGURATION , + (uint8_t *)&(replay_config.raw),sizeof (uint8_t )); + +if (!(link->replay_settings.config.replay_supported)) +return false; + + link->replay_settings.config.replay_error_status.raw =0 ; + dc = link->ctx->dc; replay = dc->res_pool->replay;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 160/486 gfs2: Check for empty queue in run_queue
In reply to Sasha LevinFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit d838605fea6eabae3746a276fd448f6719eb3926 ]
In run_queue(), check if the queue of pending requests is empty instead of blindly assuming that it won't be.
--- fs/gfs2/glock.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/gfs2/glock.c +8 -3
@@ -843,12 +843,13 @@ static void run_queue(struct gfs2_glock *gl, const int nonblock) __releases(&gl->gl_lockref.lock) __acquires(&gl->gl_lockref.lock) { -struct gfs2_holder *gh =NULL ; +struct gfs2_holder *gh;if (test_bit (GLF_LOCK , &gl->gl_flags))return ;set_bit (GLF_LOCK , &gl->gl_flags); +/* While a demote is in progress, the GLF_LOCK flag must be set. */ GLOCK_BUG_ON (gl,test_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags)); if (test_bit(GLF_DEMOTE, &gl->gl_flags) &&
@@ -860,18 +861,22 @@ __acquires(&gl->gl_lockref.lock)set_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags);GLOCK_BUG_ON (gl, gl->gl_demote_state ==LM_ST_EXCLUSIVE ); gl->gl_target = gl->gl_demote_state; +do_xmote (gl,NULL , gl->gl_target); +return ; }else {if (test_bit (GLF_DEMOTE , &gl->gl_flags))gfs2_demote_wake (gl);if (do_promote (gl)) goto out_unlock; gh =find_first_waiter (gl); +if (!gh) + goto out_unlock; gl->gl_target = gh->gh_state;if (!(gh->gh_flags & (LM_FLAG_TRY |LM_FLAG_TRY_1CB )))do_error (gl,0 );/* Fail queued try locks */ +do_xmote (gl, gh, gl->gl_target); +return ; } -do_xmote (gl, gh, gl->gl_target); -return ; out_sched:clear_bit (GLF_LOCK , &gl->gl_flags);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 161/486 auxdisplay: charlcd: Partially revert "Move hwidth and bwidth to struct hd44780_common"
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 09965a142078080fe7807bab0f6f1890cb5987a4 ]
Commit 2545c1c948a6 ("auxdisplay: Move hwidth and bwidth to struct hd44780_common") makes charlcd_alloc() argument-less effectively dropping the single allocation for the struct charlcd_priv object along with the driver specific one. Restore that behaviour here.
--- drivers/auxdisplay/charlcd.c | 5 +++-- drivers/auxdisplay/charlcd.h | 5 +++-- drivers/auxdisplay/hd44780.c | 2 +- drivers/auxdisplay/lcd2s.c | 2 +- drivers/auxdisplay/panel.c | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-)
drivers/auxdisplay/charlcd.c +3 -2
@@ -595,18 +595,19 @@ static int charlcd_init(struct charlcd *lcd)return 0 ; } -struct charlcd *charlcd_alloc (void ) +struct charlcd *charlcd_alloc (unsigned int drvdata_size) {struct charlcd_priv *priv;struct charlcd *lcd; - priv =kzalloc (sizeof (*priv),GFP_KERNEL ); + priv =kzalloc (sizeof (*priv) + drvdata_size,GFP_KERNEL );if (!priv)return NULL ; priv->esc_seq.len =-1 ; lcd = &priv->lcd; + lcd->drvdata = priv->drvdata;return lcd; }
drivers/auxdisplay/charlcd.h +3 -2
@@ -51,7 +51,7 @@ struct charlcd {unsigned long y; } addr; -void *drvdata; +void *drvdata;/* Set by charlcd_alloc() */ };/**
@@ -95,7 +95,8 @@ struct charlcd_ops { };void charlcd_backlight (struct charlcd *lcd,enum charlcd_onoff on); -struct charlcd *charlcd_alloc (void ); + +struct charlcd *charlcd_alloc (unsigned int drvdata_size);void charlcd_free (struct charlcd *lcd);int charlcd_register (struct charlcd *lcd);
drivers/auxdisplay/hd44780.c +1 -1
@@ -226,7 +226,7 @@ static int hd44780_probe(struct platform_device *pdev)if (!hdc)return -ENOMEM ; - lcd =charlcd_alloc (); + lcd =charlcd_alloc (0 );if (!lcd) goto fail1;
drivers/auxdisplay/lcd2s.c +1 -1
@@ -307,7 +307,7 @@ static int lcd2s_i2c_probe(struct i2c_client *i2c)if (err <0 )return err; - lcd =charlcd_alloc (); + lcd =charlcd_alloc (0 );if (!lcd)return -ENOMEM ;
drivers/auxdisplay/panel.c +1 -1
@@ -835,7 +835,7 @@ static void lcd_init(void)if (!hdc)return ; - charlcd =charlcd_alloc (); + charlcd =charlcd_alloc (0 );if (!charlcd) {kfree (hdc);return ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 162/486 ASoC: qcom: sm8250: explicitly set format in sm8250_be_hw_params_fixup()
In reply to Sasha LevinFrom: Alexey Klimov <[email protected]>
[ Upstream commit 89be3c15a58b2ccf31e969223c8ac93ca8932d81 ]
Setting format to s16le is required for compressed playback on compatible soundcards.
--- sound/soc/qcom/sm8250.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/qcom/sm8250.c +3 -0
@@ -7,6 +7,7 @@#include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/pcm.h> +#include <sound/pcm_params.h> #include <linux/soundwire/sdw.h> #include <sound/jack.h> #include <linux/input-event-codes.h>
@@ -39,9 +40,11 @@ static int sm8250_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, SNDRV_PCM_HW_PARAM_RATE);struct snd_interval *channels =hw_param_interval (params,SNDRV_PCM_HW_PARAM_CHANNELS ); +struct snd_mask *fmt =hw_param_mask (params,SNDRV_PCM_HW_PARAM_FORMAT ); rate->min = rate->max =48000 ; channels->min = channels->max =2 ; +snd_mask_set_format (fmt,SNDRV_PCM_FORMAT_S16_LE );return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 163/486 badblocks: Fix a nonsense WARN_ON() which checks whether a u64 variable < 0
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit 7e76336e14de9a2b67af96012ddd46c5676cf340 ]
In _badblocks_check(), there are lines of code like this,
1246 sectors -= len;
[snipped]
1251 WARN_ON(sectors < 0);
The WARN_ON() at line 1257 doesn't make sense because sectors is unsigned long long type and never to be <0.
Fix it by checking directly checking whether sectors is less than len.
--- block/badblocks.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
block/badblocks.c +3 -2
@@ -1349,14 +1349,15 @@ static int _badblocks_check(struct badblocks *bb, sector_t s, int sectors, len = sectors; update_sectors: +/* This situation should never happen */ +WARN_ON (sectors < len); + s += len; sectors -= len;if (sectors >0 ) goto re_check; -WARN_ON (sectors <0 ); -if (unacked_badblocks >0 ) rv =-1 ;else if (acked_badblocks >0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 164/486 coresight-etb10: change etb_drvdata spinlock's type to raw_spinlock_t
In reply to Sasha LevinFrom: Yeoreum Yun <[email protected]>
[ Upstream commit 6b80c0abe475ed1017c5e862636049aa1cc17a1a ]
In coresight-etb10 drivers, etb_drvdata->spinlock can be held during __schedule() by perf_event_task_sched_out()/in().
Since etb_drvdata->spinlock type is spinlock_t and perf_event_task_sched_out()/in() is called after acquiring rq_lock, which is raw_spinlock_t (an unsleepable lock),
this poses an issue in PREEMPT_RT kernel where spinlock_t is sleepable.
To address this, change type etb_drvdata->spinlock in coresight-etb10 drivers, which can be called by perf_event_task_sched_out()/in(),
from spinlock_t to raw_spinlock_t.
--- drivers/hwtracing/coresight/coresight-etb10.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +13 -13
@@ -84,7 +84,7 @@ struct etb_drvdata {struct clk *atclk;struct coresight_device *csdev;struct miscdevice miscdev; -spinlock_t spinlock; +raw_spinlock_t spinlock;local_t reading;pid_t pid;u8 *buf;
@@ -145,7 +145,7 @@ static int etb_enable_sysfs(struct coresight_device *csdev)unsigned long flags;struct etb_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent); -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);/* Don't messup with perf sessions. */ if (coresight_get_mode (csdev) ==CS_MODE_PERF ) {
@@ -163,7 +163,7 @@ static int etb_enable_sysfs(struct coresight_device *csdev) csdev->refcnt++; out: -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return ret; }
@@ -176,7 +176,7 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data)struct perf_output_handle *handle = data;struct cs_buffers *buf =etm_perf_sink_config (handle); -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);/* No need to continue if the component is already in used by sysFS. */ if (coresight_get_mode (drvdata->csdev) ==CS_MODE_SYSFS ) {
@@ -219,7 +219,7 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data) } out: -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return ret; }
@@ -352,11 +352,11 @@ static int etb_disable(struct coresight_device *csdev)struct etb_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent);unsigned long flags; -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags); csdev->refcnt--;if (csdev->refcnt) { -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return -EBUSY ; }
@@ -366,7 +366,7 @@ static int etb_disable(struct coresight_device *csdev)/* Dissociate from monitored process. */ drvdata->pid =-1 ;coresight_set_mode (csdev,CS_MODE_DISABLED ); -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);dev_dbg (&csdev->dev,"ETB disabled\n" );return 0 ;
@@ -443,7 +443,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, capacity = drvdata->buffer_depth *ETB_FRAME_SIZE_WORDS ; -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);/* Don't do anything if another tracer is using this sink */ if (csdev->refcnt !=1 )
@@ -566,7 +566,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev,__etb_enable_hw (drvdata);CS_LOCK (drvdata->base); out: -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return to_read; }
@@ -587,13 +587,13 @@ static void etb_dump(struct etb_drvdata *drvdata) {unsigned long flags; -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);if (coresight_get_mode (drvdata->csdev) ==CS_MODE_SYSFS ) {__etb_disable_hw (drvdata);etb_dump_hw (drvdata);__etb_enable_hw (drvdata); } -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);dev_dbg (&drvdata->csdev->dev,"ETB dumped\n" ); }
@@ -746,7 +746,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) drvdata->base = base; desc.access =CSDEV_ACCESS_IOMEM (base); -spin_lock_init (&drvdata->spinlock); +raw_spin_lock_init (&drvdata->spinlock); drvdata->buffer_depth =etb_get_buffer_depth (drvdata);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 165/486 iommu/vt-d: Move scalable mode ATS enablement to probe path
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 5518f239aff1baf772c5748da3add7243c5fb5df ]
Device ATS is currently enabled when a domain is attached to the device and disabled when the domain is detached. This creates a limitation:
when the IOMMU is operating in scalable mode and IOPF is enabled, the device's domain cannot be changed.
The previous code enables ATS when a domain is set to a device's RID and disables it during RID domain switch. So, if a PASID is set with a domain requiring PRI, ATS should remain enabled until the domain is removed. During the PASID domain's lifecycle, if the RID's domain changes, PRI will be disrupted because it depends on ATS, which is disabled when the blocking domain is set for the device's RID.
Remove this limitation by moving ATS enablement to the device probe path.
--- drivers/iommu/intel/iommu.c | 51 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/iommu/intel/iommu.c +27 -24
@@ -1284,32 +1284,28 @@ static bool dev_needs_extra_dtlb_flush(struct pci_dev *pdev)return true; } -static void iommu_enable_pci_caps (struct device_domain_info *info) +static void iommu_enable_pci_ats (struct device_domain_info *info) {struct pci_dev *pdev; -if (!dev_is_pci (info->dev)) +if (!info->ats_supported)return ; pdev =to_pci_dev (info->dev); -if (info->ats_supported &&pci_ats_page_aligned (pdev) && - !pci_enable_ats (pdev,VTD_PAGE_SHIFT )) +if (!pci_ats_page_aligned (pdev)) +return ; + +if (!pci_enable_ats (pdev,VTD_PAGE_SHIFT )) info->ats_enabled =1 ; } -static void iommu_disable_pci_caps (struct device_domain_info *info) +static void iommu_disable_pci_ats (struct device_domain_info *info) { -struct pci_dev *pdev; - -if (!dev_is_pci (info->dev)) +if (!info->ats_enabled)return ; - pdev =to_pci_dev (info->dev); - -if (info->ats_enabled) { -pci_disable_ats (pdev); - info->ats_enabled =0 ; - } +pci_disable_ats (to_pci_dev (info->dev)); + info->ats_enabled =0 ; }static void intel_flush_iotlb_all (struct iommu_domain *domain)
@@ -1722,12 +1718,19 @@ domain_context_mapping(struct dmar_domain *domain, struct device *dev)struct device_domain_info *info =dev_iommu_priv_get (dev);struct intel_iommu *iommu = info->iommu;u8 bus = info->bus, devfn = info->devfn; +int ret;if (!dev_is_pci (dev))return domain_context_mapping_one (domain, iommu, bus, devfn); -return pci_for_each_dma_alias (to_pci_dev (dev), - domain_context_mapping_cb, domain); + ret =pci_for_each_dma_alias (to_pci_dev (dev), + domain_context_mapping_cb, domain); +if (ret) +return ret; + +iommu_enable_pci_ats (info); + +return 0 ; }/* Return largest possible superpage level for a given mapping */
@@ -1987,8 +1990,6 @@ static int dmar_domain_attach_device(struct dmar_domain *domain,if (ret) goto out_block_translation; -iommu_enable_pci_caps (info); - ret =cache_tag_assign_domain (domain, dev,IOMMU_NO_PASID );if (ret) goto out_block_translation;
@@ -3368,6 +3369,7 @@ static void domain_context_clear(struct device_domain_info *info)pci_for_each_dma_alias (to_pci_dev (info->dev), &domain_context_clear_one_cb, info); +iommu_disable_pci_ats (info); }/*
@@ -3384,7 +3386,6 @@ void device_block_translation(struct device *dev)if (info->domain)cache_tag_unassign_domain (info->domain, dev,IOMMU_NO_PASID ); -iommu_disable_pci_caps (info);if (!dev_is_real_dma_subdevice (dev)) {if (sm_supported (iommu)) intel_pasid_tear_down_entry(iommu, dev,
@@ -3964,6 +3965,9 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev) !pci_enable_pasid(pdev, info->pasid_supported & ~1)) info->pasid_enabled = 1; +if (sm_supported (iommu)) +iommu_enable_pci_ats (info); +return &iommu->iommu; free_table:intel_pasid_free_table (dev);
@@ -3980,6 +3984,8 @@ static void intel_iommu_release_device(struct device *dev)struct device_domain_info *info =dev_iommu_priv_get (dev);struct intel_iommu *iommu = info->iommu; +iommu_disable_pci_ats (info); +if (info->pasid_enabled) {pci_disable_pasid (to_pci_dev (dev)); info->pasid_enabled =0 ;
@@ -4581,13 +4587,10 @@ static int identity_domain_attach_dev(struct iommu_domain *domain, struct deviceif (dev_is_real_dma_subdevice (dev))return 0 ; -if (sm_supported (iommu)) { +if (sm_supported (iommu)) ret =intel_pasid_setup_pass_through (iommu, dev,IOMMU_NO_PASID ); -if (!ret) -iommu_enable_pci_caps (info); - }else { +else ret =device_setup_pass_through (dev); - }return ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 166/486 iommu/amd/pgtbl_v2: Improve error handling
In reply to Sasha LevinFrom: Vasant Hegde <[email protected]>
[ Upstream commit 36a1cfd497435ba5e37572fe9463bb62a7b1b984 ]
Return -ENOMEM if v2_alloc_pte() fails to allocate memory.
--- drivers/iommu/amd/io_pgtable_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/io_pgtable_v2.c +1 -1
@@ -254,7 +254,7 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova, pte =v2_alloc_pte (cfg->amd.nid, pgtable->pgd, iova, map_size, gfp, &updated);if (!pte) { - ret = -EINVAL ; + ret = -ENOMEM ; goto out; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 167/486 cpufreq: tegra186: Share policy per cluster
In reply to Sasha LevinFrom: Aaron Kling <[email protected]>
[ Upstream commit be4ae8c19492cd6d5de61ccb34ffb3f5ede5eec8 ]
This functionally brings tegra186 in line with tegra210 and tegra194, sharing a cpufreq policy between all cores in a cluster.
--- drivers/cpufreq/tegra186-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/tegra186-cpufreq.c +7 -0
@@ -73,11 +73,18 @@ static int tegra186_cpufreq_init(struct cpufreq_policy *policy) {struct tegra186_cpufreq_data *data =cpufreq_get_driver_data ();unsigned int cluster = data->cpus[policy->cpu].bpmp_cluster_id; +u32 cpu; policy->freq_table = data->clusters[cluster].table; policy->cpuinfo.transition_latency =300 *1000 ; policy->driver_data =NULL ; +/* set same policy for all cpus in a cluster */ +for (cpu =0 ; cpu <ARRAY_SIZE (tegra186_cpus); cpu++) { +if (data->cpus[cpu].bpmp_cluster_id == cluster) +cpumask_set_cpu (cpu, policy->cpus); + } +return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 168/486 watchdog: aspeed: Update bootstatus handling
In reply to Sasha LevinFrom: Chin-Ting Kuo <[email protected]>
[ Upstream commit 5c03f9f4d36292150c14ebd90788c4d3273ed9dc ]
The boot status in the watchdog device struct is updated during controller probe stage. Application layer can get the boot status through the command, cat /sys/class/watchdog/watchdogX/bootstatus. The bootstatus can be,WDIOF_CARDRESET => System is reset due to WDT timeout occurs.
Others => Other reset events, e.g., power on reset.
On ASPEED platforms, boot status is recorded in the SCU registers.
- AST2400: Only a bit is used to represent system reset triggered by any WDT controller.
- AST2500/AST2600: System reset triggered by different WDT controllers can be distinguished by different SCU bits.
Besides, on AST2400 and AST2500, since alternating boot event is also triggered by using WDT timeout mechanism, it is classified as WDIOF_CARDRESET.
--- drivers/watchdog/aspeed_wdt.c | 81 ++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-)
drivers/watchdog/aspeed_wdt.c +79 -2
@@ -11,21 +11,30 @@#include <linux/io.h> #include <linux/kernel.h> #include <linux/kstrtox.h> +#include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_irq.h> #include <linux/platform_device.h> +#include <linux/regmap.h> #include <linux/watchdog.h> static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (nowayout, bool,0 ); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); +struct aspeed_wdt_scu { +const char *compatible; +u32 reset_status_reg; +u32 wdt_reset_mask; +u32 wdt_reset_mask_shift; +};struct aspeed_wdt_config {u32 ext_pulse_width_mask;u32 irq_shift;u32 irq_mask; +struct aspeed_wdt_scu scu; };struct aspeed_wdt {
@@ -39,18 +48,36 @@ static const struct aspeed_wdt_config ast2400_config = { .ext_pulse_width_mask = 0xff, .irq_shift = 0, .irq_mask = 0, + .scu = { + .compatible = "aspeed,ast2400-scu", + .reset_status_reg = 0x3c, + .wdt_reset_mask = 0x1, + .wdt_reset_mask_shift = 1, + }, };static const struct aspeed_wdt_config ast2500_config = { .ext_pulse_width_mask =0xfffff , .irq_shift =12 , .irq_mask =GENMASK (31 ,12 ), + .scu = { + .compatible ="aspeed,ast2500-scu" , + .reset_status_reg =0x3c , + .wdt_reset_mask =0x1 , + .wdt_reset_mask_shift =2 , + }, };static const struct aspeed_wdt_config ast2600_config = { .ext_pulse_width_mask =0xfffff , .irq_shift =0 , .irq_mask =GENMASK (31 ,10 ), + .scu = { + .compatible ="aspeed,ast2600-scu" , + .reset_status_reg =0x74 , + .wdt_reset_mask =0xf , + .wdt_reset_mask_shift =16 , + }, };static const struct of_device_id aspeed_wdt_of_table[] = {
@@ -213,6 +240,56 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,return 0 ; } +static void aspeed_wdt_update_bootstatus (struct platform_device *pdev, +struct aspeed_wdt *wdt) +{ +const struct resource *res; +struct aspeed_wdt_scu scu = wdt->cfg->scu; +struct regmap *scu_base; +u32 reset_mask_width; +u32 reset_mask_shift; +u32 idx =0 ; +u32 status; +int ret; + +if (!of_device_is_compatible (pdev->dev.of_node,"aspeed,ast2400-wdt" )) { + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + idx = ((intptr_t )wdt->base &0x00000fff ) /resource_size (res); + } + + scu_base =syscon_regmap_lookup_by_compatible (scu.compatible); +if (IS_ERR (scu_base)) { + wdt->wdd.bootstatus =WDIOS_UNKNOWN ; +return ; + } + + ret =regmap_read (scu_base, scu.reset_status_reg, &status); +if (ret) { + wdt->wdd.bootstatus =WDIOS_UNKNOWN ; +return ; + } + + reset_mask_width =hweight32 (scu.wdt_reset_mask); + reset_mask_shift = scu.wdt_reset_mask_shift + + reset_mask_width * idx; + +if (status & (scu.wdt_reset_mask << reset_mask_shift)) + wdt->wdd.bootstatus =WDIOF_CARDRESET ; + +/* clear wdt reset event flag */ +if (of_device_is_compatible (pdev->dev.of_node,"aspeed,ast2400-wdt" ) || +of_device_is_compatible (pdev->dev.of_node,"aspeed,ast2500-wdt" )) { + ret =regmap_read (scu_base, scu.reset_status_reg, &status); +if (!ret) { + status &= ~(scu.wdt_reset_mask << reset_mask_shift); +regmap_write (scu_base, scu.reset_status_reg, status); + } + }else { +regmap_write (scu_base, scu.reset_status_reg, + scu.wdt_reset_mask << reset_mask_shift); + } +} +/* access_cs0 shows if cs0 is accessible, hence the reverted bit */ static ssize_t access_cs0_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -458,10 +535,10 @@ static int aspeed_wdt_probe(struct platform_device *pdev)writel (duration -1 , wdt->base +WDT_RESET_WIDTH ); } +aspeed_wdt_update_bootstatus (pdev, wdt); + status =readl (wdt->base +WDT_TIMEOUT_STATUS );if (status &WDT_TIMEOUT_STATUS_BOOT_SECONDARY ) { - wdt->wdd.bootstatus =WDIOF_CARDRESET ; -if (of_device_is_compatible (np,"aspeed,ast2400-wdt" ) ||of_device_is_compatible (np,"aspeed,ast2500-wdt" )) wdt->wdd.groups = bswitch_groups;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 169/486 PCI: endpoint: pci-epf-test: Fix double free that causes kernel to oops
In reply to Sasha LevinFrom: Christian Bruel <[email protected]>
[ Upstream commit 934e9d137d937706004c325fa1474f9e3f1ba10a ]
Fix a kernel oops found while testing the stm32_pcie Endpoint driver with handling of PERST# deassertion:
During EP initialization, pci_epf_test_alloc_space() allocates all BARs, which are further freed if epc_set_bar() fails (for instance, due to no free inbound window).
However, when pci_epc_set_bar() fails, the error path:
pci_epc_set_bar() ->
pci_epf_free_space()
does not clear the previous assignment to epf_test->reg[bar].
Then, if the host reboots, the PERST# deassertion restarts the BAR allocation sequence with the same allocation failure (no free inbound window), creating a double free situation since epf_test->reg[bar] was deallocated and is still non-NULL.
Thus, make sure that pci_epf_alloc_space() and pci_epf_free_space() invocations are symmetric, and as such, set epf_test->reg[bar] to NULL when memory is freed.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/endpoint/functions/pci-epf-test.c +2 -0
@@ -703,6 +703,7 @@ static int pci_epf_test_set_bar(struct pci_epf *epf)if (ret) {pci_epf_free_space (epf, epf_test->reg[bar], bar,PRIMARY_INTERFACE ); + epf_test->reg[bar] =NULL ;dev_err (dev,"Failed to set BAR%d\n" , bar);if (bar == test_reg_bar)return ret;
@@ -878,6 +879,7 @@ static void pci_epf_test_free_space(struct pci_epf *epf)pci_epf_free_space (epf, epf_test->reg[bar], bar,PRIMARY_INTERFACE ); + epf_test->reg[bar] =NULL ; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 170/486 misc: pci_endpoint_test: Give disabled BARs a distinct error code
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit 7e80bbef1d697dbce7a39cfad0df770880fe3f29 ]
The current code returns -ENOMEM if test->bar[barno] is NULL.
There can be two reasons why test->bar[barno] is NULL:
1) The pci_ioremap_bar() call in pci_endpoint_test_probe() failed.
2) The BAR was skipped, because it is disabled by the endpoint.
Many PCI endpoint controller drivers will disable all BARs in their init function. A disabled BAR will have a size of 0.
A PCI endpoint function driver will be able to enable any BAR that is not marked as BAR_RESERVED (which means that the BAR should not be touched by the EPF driver).
Thus, perform check if the size is 0, before checking if test->bar[barno] is NULL, such that we can return different errors.
This will allow the selftests to return SKIP instead of FAIL for disabled BARs.
--- drivers/misc/pci_endpoint_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/misc/pci_endpoint_test.c +4 -2
@@ -287,11 +287,13 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test, void *read_buf __free(kfree) = NULL;struct pci_dev *pdev = test->pdev; + bar_size =pci_resource_len (pdev, barno); +if (!bar_size) +return -ENODATA ; +if (!test->bar[barno])return false; - bar_size =pci_resource_len (pdev, barno); -if (barno == test->test_reg_bar) bar_size =0x4 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 171/486 crypto: lzo - Fix compression buffer overrun
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
[ Upstream commit cc47f07234f72cbd8e2c973cdbf2a6730660a463 ]
Unlike the decompression code, the compression code in LZO never checked for output overruns. It instead assumes that the caller always provides enough buffer space, disregarding the buffer length provided by the caller.
Add a safe compression interface that checks for the end of buffer before each write. Use the safe interface in crypto/lzo.
--- crypto/lzo-rle.c | 2 +- crypto/lzo.c | 2 +- include/linux/lzo.h | 8 +++ lib/lzo/Makefile | 2 +- lib/lzo/lzo1x_compress.c | 102 +++++++++++++++++++++++++--------- lib/lzo/lzo1x_compress_safe.c | 18 ++++++ 6 files changed, 106 insertions(+), 28 deletions(-) create mode 100644 lib/lzo/lzo1x_compress_safe.c
crypto/lzo-rle.c +1 -1
@@ -55,7 +55,7 @@ static int __lzorle_compress(const u8 *src, unsigned int slen,size_t tmp_len = *dlen;/* size_t(ulong) <-> uint on 64 bit */ int err; - err =lzorle1x_1_compress (src, slen, dst, &tmp_len, ctx); + err =lzorle1x_1_compress_safe (src, slen, dst, &tmp_len, ctx);if (err !=LZO_E_OK )return -EINVAL ;
crypto/lzo.c +1 -1
@@ -55,7 +55,7 @@ static int __lzo_compress(const u8 *src, unsigned int slen,size_t tmp_len = *dlen;/* size_t(ulong) <-> uint on 64 bit */ int err; - err =lzo1x_1_compress (src, slen, dst, &tmp_len, ctx); + err =lzo1x_1_compress_safe (src, slen, dst, &tmp_len, ctx);if (err !=LZO_E_OK )return -EINVAL ;
include/linux/lzo.h +8 -0
@@ -24,10 +24,18 @@int lzo1x_1_compress (const unsigned char *src,size_t src_len,unsigned char *dst,size_t *dst_len,void *wrkmem); +/* Same as above but does not write more than dst_len to dst. */ +int lzo1x_1_compress_safe (const unsigned char *src,size_t src_len, +unsigned char *dst,size_t *dst_len,void *wrkmem); +/* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */ int lzorle1x_1_compress (const unsigned char *src,size_t src_len,unsigned char *dst,size_t *dst_len,void *wrkmem); +/* Same as above but does not write more than dst_len to dst. */ +int lzorle1x_1_compress_safe (const unsigned char *src,size_t src_len, +unsigned char *dst,size_t *dst_len,void *wrkmem); +/* safe decompression with overrun testing */ int lzo1x_decompress_safe (const unsigned char *src,size_t src_len,unsigned char *dst,size_t *dst_len);
lib/lzo/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -lzo_compress-objs := lzo1x_compress.o +lzo_compress-objs := lzo1x_compress.o lzo1x_compress_safe.o lzo_decompress-objs := lzo1x_decompress_safe.o obj-$(CONFIG_LZO_COMPRESS) += lzo_compress.o
lib/lzo/lzo1x_compress.c +77 -25
241 lines not on this page · raw message
lib/lzo/lzo1x_compress_safe.c new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* LZO1X Compressor from LZO +* +* Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <[email protected]> +* +* The full LZO package can be found at: +* http://www.oberhumer.com/opensource/lzo/ +* +* Changed for Linux kernel use by: +* Nitin Gupta <[email protected]> +* Richard Purdie <[email protected]> +*/ + +#define LZO_SAFE (name) name##_safe +#define HAVE_OP (x) ((size_t)(op_end - op) >= (size_t)(x)) + +#include "lzo1x_compress.c"
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 172/486 crypto: mxs-dcp - Only set OTP_KEY bit for OTP key
In reply to Sasha LevinFrom: Sven Schwermer <[email protected]>
[ Upstream commit caa9dbb76ff52ec848a57245062aaeaa07740adc ]
While MXS_DCP_CONTROL0_OTP_KEY is set, the CRYPTO_KEY (DCP_PAES_KEY_OTP) is used even if the UNIQUE_KEY (DCP_PAES_KEY_UNIQUE) is selected. This is not clearly documented, but this implementation is consistent with NXP's downstream kernel fork and optee_os.
--- drivers/crypto/mxs-dcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/mxs-dcp.c +4 -4
@@ -265,12 +265,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,MXS_DCP_CONTROL0_INTERRUPT |MXS_DCP_CONTROL0_ENABLE_CIPHER ; -if (key_referenced) -/* Set OTP key bit to select the key via KEY_SELECT. */ - desc->control0 |=MXS_DCP_CONTROL0_OTP_KEY ; -else +if (!key_referenced)/* Payload contains the key. */ desc->control0 |=MXS_DCP_CONTROL0_PAYLOAD_KEY ; +else if (actx->key[0 ] ==DCP_PAES_KEY_OTP ) +/* Set OTP key bit to select the key via KEY_SELECT. */ + desc->control0 |=MXS_DCP_CONTROL0_OTP_KEY ;if (rctx->enc) desc->control0 |=MXS_DCP_CONTROL0_CIPHER_ENCRYPT ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 173/486 drm/amdkfd: Set per-process flags only once for gfx9/10/11/12
In reply to Sasha LevinFrom: Harish Kasiviswanathan <[email protected]>
[ Upstream commit 61972cd93af70738a6ad7f93e17cc7f68a01e182 ]
Define set_cache_memory_policy() for these asics and move all static changes from update_qpd() which is called each time a queue is created to set_cache_memory_policy() which is called once during process initialization
--- .../amd/amdkfd/kfd_device_queue_manager_v10.c | 41 +++++++++++-------- .../amd/amdkfd/kfd_device_queue_manager_v11.c | 41 +++++++++++-------- .../amd/amdkfd/kfd_device_queue_manager_v12.c | 41 +++++++++++-------- .../amd/amdkfd/kfd_device_queue_manager_v9.c | 36 +++++++++++++++- 4 files changed, 107 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c +24 -17
@@ -31,10 +31,17 @@ static int update_qpd_v10(struct device_queue_manager *dqm, struct qcm_process_device *qpd);static void init_sdma_vm_v10 (struct device_queue_manager *dqm,struct queue *q,struct qcm_process_device *qpd); +static bool set_cache_memory_policy_v10 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size);void device_queue_manager_init_v10 (struct device_queue_manager_asic_ops *asic_ops) { + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v10; asic_ops->update_qpd = update_qpd_v10; asic_ops->init_sdma_vm = init_sdma_vm_v10; asic_ops->mqd_manager_init = mqd_manager_init_v10;
@@ -49,27 +56,27 @@ static uint32_t compute_sh_mem_bases_64bit(struct kfd_process_device *pdd) private_base; } -static int update_qpd_v10 (struct device_queue_manager *dqm, -struct qcm_process_device *qpd) +static bool set_cache_memory_policy_v10 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size) { -struct kfd_process_device *pdd; - - pdd =qpd_to_pdd (qpd); - -/* check if sh_mem_config register already configured */ -if (qpd->sh_mem_config ==0 ) { - qpd->sh_mem_config = - (SH_MEM_ALIGNMENT_MODE_UNALIGNED << -SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ) | - (3 <<SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT ); - qpd->sh_mem_ape1_limit =0 ; - qpd->sh_mem_ape1_base =0 ; - } - - qpd->sh_mem_bases =compute_sh_mem_bases_64bit (pdd); + qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED << +SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ) | + (3 <<SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT ); + qpd->sh_mem_ape1_limit =0 ; + qpd->sh_mem_ape1_base =0 ; + qpd->sh_mem_bases =compute_sh_mem_bases_64bit (qpd_to_pdd (qpd));pr_debug ("sh_mem_bases 0x%X\n" , qpd->sh_mem_bases); +return true; +} +static int update_qpd_v10 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd) +{return 0 ; }
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v11.c +24 -17
62 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v12.c +24 -17
62 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c +35 -1
@@ -30,10 +30,17 @@ static int update_qpd_v9(struct device_queue_manager *dqm, struct qcm_process_device *qpd);static void init_sdma_vm_v9 (struct device_queue_manager *dqm,struct queue *q,struct qcm_process_device *qpd); +static bool set_cache_memory_policy_v9 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size);void device_queue_manager_init_v9 (struct device_queue_manager_asic_ops *asic_ops) { + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v9; asic_ops->update_qpd = update_qpd_v9; asic_ops->init_sdma_vm = init_sdma_vm_v9; asic_ops->mqd_manager_init = mqd_manager_init_v9;
@@ -48,10 +55,37 @@ static uint32_t compute_sh_mem_bases_64bit(struct kfd_process_device *pdd) private_base; } +static bool set_cache_memory_policy_v9 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size) +{ + qpd->sh_mem_config =SH_MEM_ALIGNMENT_MODE_UNALIGNED << +SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ; + +if (dqm->dev->kfd->noretry) + qpd->sh_mem_config |=1 <<SH_MEM_CONFIG__RETRY_DISABLE__SHIFT ; + +if (KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,3 ) || +KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,4 ) || +KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,5 ,0 )) + qpd->sh_mem_config |= (1 <<SH_MEM_CONFIG__F8_MODE__SHIFT ); + + qpd->sh_mem_ape1_limit =0 ; + qpd->sh_mem_ape1_base =0 ; + qpd->sh_mem_bases =compute_sh_mem_bases_64bit (qpd_to_pdd (qpd)); + +pr_debug ("sh_mem_bases 0x%X sh_mem_config 0x%X\n" , qpd->sh_mem_bases, + qpd->sh_mem_config); +return true; +} +static int update_qpd_v9 (struct device_queue_manager *dqm,struct qcm_process_device *qpd) { -struct kfd_process_device *pdd; +struct kfd_process_device *pdd =qpd_to_pdd (qpd); pdd =qpd_to_pdd (qpd);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 174/486 drm/amdkfd: Set per-process flags only once cik/vi
In reply to Sasha LevinFrom: Harish Kasiviswanathan <[email protected]>
[ Upstream commit 289e68503a4533b014f8447e2af28ad44c92c221 ]
Set per-process static sh_mem config only once during process initialization. Move all static changes from update_qpd() which is called each time a queue is created to set_cache_memory_policy() which is called once during process initialization.
set_cache_memory_policy() is currently defined only for cik and vi family. So this commit only focuses on these two. A separate commit will address other asics.
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 39 +--------- .../amd/amdkfd/kfd_device_queue_manager_cik.c | 69 ++++++++++++------ .../amd/amdkfd/kfd_device_queue_manager_vi.c | 71 ++++++++++++------- 3 files changed, 94 insertions(+), 85 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -36
@@ -2453,14 +2453,6 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,return retval; } -/* -* Low bits must be 0000/FFFF as required by HW, high bits must be 0 to -* stay in user mode. -*/ -#define APE1_FIXED_BITS_MASK 0xFFFF80000000FFFFULL -/* APE1 limit is inclusive and 64K aligned. */ -#define APE1_LIMIT_ALIGNMENT 0xFFFF - static bool set_cache_memory_policy(struct device_queue_manager *dqm, struct qcm_process_device *qpd, enum cache_policy default_policy,
@@ -2475,34 +2467,6 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm,dqm_lock (dqm); -if (alternate_aperture_size ==0 ) { -/* base > limit disables APE1 */ - qpd->sh_mem_ape1_base =1 ; - qpd->sh_mem_ape1_limit =0 ; - }else { -/* -* In FSA64, APE1_Base[63:0] = { 16{SH_MEM_APE1_BASE[31]}, -* SH_MEM_APE1_BASE[31:0], 0x0000 } -* APE1_Limit[63:0] = { 16{SH_MEM_APE1_LIMIT[31]}, -* SH_MEM_APE1_LIMIT[31:0], 0xFFFF } -* Verify that the base and size parameters can be -* represented in this format and convert them. -* Additionally restrict APE1 to user-mode addresses. -*/ - -uint64_t base = (uintptr_t )alternate_aperture_base; -uint64_t limit = base + alternate_aperture_size -1 ; - -if (limit <= base || (base &APE1_FIXED_BITS_MASK ) !=0 || - (limit &APE1_FIXED_BITS_MASK ) !=APE1_LIMIT_ALIGNMENT ) { - retval = false; - goto out; - } - - qpd->sh_mem_ape1_base = base >>16 ; - qpd->sh_mem_ape1_limit = limit >>16 ; - } - retval = dqm->asic_ops.set_cache_memory_policy( dqm, qpd,
@@ -2511,6 +2475,9 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm, alternate_aperture_base, alternate_aperture_size); +if (retval) + goto out; +if ((dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS ) && (qpd->vmid !=0 ))program_sh_mem_settings (dqm, qpd);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c +46 -23
95 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c +45 -26
97 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 175/486 drm/amdgpu: Fix missing drain retry fault the last entry
In reply to Sasha LevinFrom: Emily Deng <[email protected]>
[ Upstream commit fe2fa3be3d59ba67d6de54a0064441ec233cb50c ]
While the entry get in svm_range_unmap_from_cpu is the last entry, and the entry is page fault, it also need to be dropped. So for equal case, it also need to be dropped.
v2:
Only modify the svm_range_restore_pages.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +3 -0
@@ -78,6 +78,9 @@ struct amdgpu_ih_ring {#define amdgpu_ih_ts_after (t1, t2) \ (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL) +#define amdgpu_ih_ts_after_or_equal (t1, t2) \ + (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >= 0LL) +/* provided by the ih block */ struct amdgpu_ih_funcs {/* ring read/write ptr handling, called from interrupt context */
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
@@ -3014,7 +3014,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,/* check if this page fault time stamp is before svms->checkpoint_ts */ if (svms->checkpoint_ts[gpuidx] !=0 ) { -if (amdgpu_ih_ts_after (ts, svms->checkpoint_ts[gpuidx])) { +if (amdgpu_ih_ts_after_or_equal (ts, svms->checkpoint_ts[gpuidx])) {pr_debug ("draining retry fault, drop fault 0x%llx\n" , addr); r = -EAGAIN ; goto out_unlock_svms;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 176/486 arm64: tegra: p2597: Fix gpio for vdd-1v8-dis regulator
In reply to Sasha LevinFrom: Diogo Ivo <[email protected]>
[ Upstream commit f34621f31e3be81456c903287f7e4c0609829e29 ]
According to the board schematics the enable pin of this regulator is connected to gpio line #9 of the first instance of the TCA9539 GPIO expander, so adjust it.
--- arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi +1 -1
@@ -1686,7 +1686,7 @@ vdd_1v8_dis: regulator-vdd-1v8-dis { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-always-on; - gpio = <&exp1 14 GPIO_ACTIVE_HIGH>; + gpio = <&exp1 9 GPIO_ACTIVE_HIGH>; enable-active-high; vin-supply = <&vdd_1v8>; };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 177/486 arm64: tegra: Resize aperture for the IGX PCIe C5 slot
In reply to Sasha LevinFrom: Jon Hunter <[email protected]>
[ Upstream commit 6d4bfe6d86af1ef52bdb4592c9afb2037f24f2c4 ]
Some discrete graphics cards such as the NVIDIA RTX A6000 support resizable BARs. When connecting an A6000 card to the NVIDIA IGX Orin platform, resizing the BAR1 aperture to 8GB fails because the current device-tree configuration for the PCIe C5 slot cannot support this. Fix this by updating the device-tree 'reg' and 'ranges' properties for the PCIe C5 slot to support this.
--- .../boot/dts/nvidia/tegra234-p3740-0002+p3701-0008.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234-p3740-0002+p3701-0008.dts +10 -0
@@ -302,6 +302,16 @@ pcie@14160000 { }; pcie@141a0000 { + reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ + 0x00 0x3a000000 0x0 0x00040000 /* configuration space (256K) */ + 0x00 0x3a040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ + 0x00 0x3a080000 0x0 0x00040000 /* DBI reg space (256K) */ + 0x2e 0x20000000 0x0 0x10000000>; /* ECAM (256MB) */ + + ranges = <0x81000000 0x00 0x3a100000 0x00 0x3a100000 0x0 0x00100000 /* downstream I/O (1MB) */ + 0x82000000 0x00 0x40000000 0x2e 0x30000000 0x0 0x08000000 /* non-prefetchable memory (128MB) */ + 0xc3000000 0x28 0x00000000 0x28 0x00000000 0x6 0x20000000>; /* prefetchable memory (25088MB) */ + status = "okay"; vddio-pex-ctl-supply = <&vdd_1v8_ls>; phys = <&p2u_nvhs_0>, <&p2u_nvhs_1>, <&p2u_nvhs_2>,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 178/486 powerpc/prom_init: Fixup missing #size-cells on PowerBook6,7
In reply to Sasha LevinFrom: Andreas Schwab <[email protected]>
[ Upstream commit 7e67ef889c9ab7246547db73d524459f47403a77 ]
Similar to the PowerMac3,1, the PowerBook6,7 is missing the #size-cells property on the i2s node.
Depends-on: commit 045b14ca5c36 ("of: WARN on deprecated #address-cells/#size-cells handling")
--- arch/powerpc/kernel/prom_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom_init.c +2 -2
@@ -2982,11 +2982,11 @@ static void __init fixup_device_tree_pmac(void)char type[8 ];phandle node; -// Some pmacs are missing #size-cells on escc nodes +// Some pmacs are missing #size-cells on escc or i2s nodes for (node =0 ;prom_next_node (&node); ) { type[0 ] ='\0' ;prom_getprop (node,"device_type" , type,sizeof (type)); -if (prom_strcmp (type,"escc" )) +if (prom_strcmp (type,"escc" ) &&prom_strcmp (type,"i2s" ))continue ;if (prom_getproplen (node,"#size-cells" ) !=PROM_ERROR )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 179/486 ALSA: seq: Improve data consistency at polling
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit e3cd33ab17c33bd8f1a9df66ec83a15dd8f7afbb ]
snd_seq_poll() calls snd_seq_write_pool_allocated() that reads out a field in client->pool object, while it can be updated concurrently via ioctls, as reported by syzbot. The data race itself is harmless, as it's merely a poll() call, and the state is volatile. OTOH, the read out of poll object info from the caller side is fragile, and we can leave it better in snd_seq_pool_poll_wait() alone.
A similar pattern is seen in snd_seq_kernel_client_write_poll(), too, which is called from the OSS sequencer.
This patch drops the pool checks from the caller side and add the pool->lock in snd_seq_pool_poll_wait() for better data consistency.
--- sound/core/seq/seq_clientmgr.c | 5 +---- sound/core/seq/seq_memory.c | 1 + 2 files changed, 2 insertions(+), 4 deletions(-)
sound/core/seq/seq_clientmgr.c +1 -4
@@ -1150,8 +1150,7 @@ static __poll_t snd_seq_poll(struct file *file, poll_table * wait)if (snd_seq_file_flags (file) &SNDRV_SEQ_LFLG_OUTPUT ) {/* check if data is available in the pool */ -if (!snd_seq_write_pool_allocated (client) || -snd_seq_pool_poll_wait (client->pool, file, wait)) +if (snd_seq_pool_poll_wait (client->pool, file, wait)) mask |=EPOLLOUT |EPOLLWRNORM ; }
@@ -2569,8 +2568,6 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_tableif (client ==NULL )return -ENXIO ; -if (!snd_seq_write_pool_allocated (client)) -return 1 ;if (snd_seq_pool_poll_wait (client->pool, file, wait))return 1 ;return 0 ;
sound/core/seq/seq_memory.c +1 -0
@@ -427,6 +427,7 @@ int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait) {poll_wait (file, &pool->output_sleep, wait); +guard (spinlock_irq)(&pool->lock);return snd_seq_output_ok (pool); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 180/486 tcp: bring back NUMA dispersion in inet_ehash_locks_alloc()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit f8ece40786c9342249aa0a1b55e148ee23b2a746 ]
We have platforms with 6 NUMA nodes and 480 cpus.
inet_ehash_locks_alloc() currently allocates a single 64KB page to hold all ehash spinlocks. This adds more pressure on a single node.
Change inet_ehash_locks_alloc() to use vmalloc() to spread the spinlocks on all online nodes, driven by NUMA policies.
At boot time, NUMA policy is interleave=all, meaning that tcp_hashinfo.ehash_locks gets hash dispersion on all nodes.
Tested:
lack5:~# grep inet_ehash_locks_alloc /proc/vmallocinfo 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
lack5:~# echo 8192 >/proc/sys/net/ipv4/tcp_child_ehash_entries lack5:~# numactl --interleave=all unshare -n bash -c "grep inet_ehash_locks_alloc /proc/vmallocinfo" 0x000000004e99d30c-0x00000000763f3279 36864 inet_ehash_locks_alloc+0x90/0x100 pages=8 vmalloc N0=1 N1=2 N2=2 N3=1 N4=1 N5=1 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
lack5:~# numactl --interleave=0,5 unshare -n bash -c "grep inet_ehash_locks_alloc /proc/vmallocinfo" 0x00000000fd73a33e-0x0000000004b9a177 36864 inet_ehash_locks_alloc+0x90/0x100 pages=8 vmalloc N0=4 N5=4 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
lack5:~# echo 1024 >/proc/sys/net/ipv4/tcp_child_ehash_entries lack5:~# numactl --interleave=all unshare -n bash -c "grep inet_ehash_locks_alloc /proc/vmallocinfo" 0x00000000db07d7a2-0x00000000ad697d29 8192 inet_ehash_locks_alloc+0x90/0x100 pages=1 vmalloc N2=1 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
--- net/ipv4/inet_hashtables.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
net/ipv4/inet_hashtables.c +26 -11
@@ -1230,22 +1230,37 @@ int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) {unsigned int locksz =sizeof (spinlock_t);unsigned int i, nblocks =1 ; +spinlock_t *ptr =NULL ; -if (locksz !=0 ) { -/* allocate 2 cache lines or at least one spinlock per cpu */ - nblocks =max (2U *L1_CACHE_BYTES / locksz,1U ); - nblocks =roundup_pow_of_two (nblocks *num_possible_cpus ()); +if (locksz ==0 ) + goto set_mask; -/* no more locks than number of hash buckets */ - nblocks =min (nblocks, hashinfo->ehash_mask +1 ); +/* Allocate 2 cache lines or at least one spinlock per cpu. */ + nblocks =max (2U *L1_CACHE_BYTES / locksz,1U ) *num_possible_cpus (); - hashinfo->ehash_locks =kvmalloc_array (nblocks, locksz,GFP_KERNEL ); -if (!hashinfo->ehash_locks) -return -ENOMEM ; +/* At least one page per NUMA node. */ + nblocks =max (nblocks,num_online_nodes () *PAGE_SIZE / locksz); + + nblocks =roundup_pow_of_two (nblocks); + +/* No more locks than number of hash buckets. */ + nblocks =min (nblocks, hashinfo->ehash_mask +1 ); -for (i =0 ; i < nblocks; i++) -spin_lock_init (&hashinfo->ehash_locks[i]); +if (num_online_nodes () >1 ) { +/* Use vmalloc() to allow NUMA policy to spread pages +* on all available nodes if desired. +*/ + ptr =vmalloc_array (nblocks, locksz); + } +if (!ptr) { + ptr =kvmalloc_array (nblocks, locksz,GFP_KERNEL ); +if (!ptr) +return -ENOMEM ; } +for (i =0 ; i < nblocks; i++) +spin_lock_init (&ptr[i]); + hashinfo->ehash_locks = ptr; +set_mask: hashinfo->ehash_locks_mask = nblocks -1 ;return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 181/486 rtc: ds1307: stop disabling alarms on probe
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit dcec12617ee61beed928e889607bf37e145bf86b ]
It is a bad practice to disable alarms on probe or remove as this will prevent alarms across reboots.
--- drivers/rtc/rtc-ds1307.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-ds1307.c +1 -3
@@ -1807,10 +1807,8 @@ static int ds1307_probe(struct i2c_client *client)* For some variants, be sure alarms can trigger when we're * running on Vbackup (BBSQI/BBSQW) */ -if (want_irq || ds1307_can_wakeup_device) { +if (want_irq || ds1307_can_wakeup_device) regs[0 ] |=DS1337_BIT_INTCN | chip->bbsqi_bit; - regs[0 ] &= ~(DS1337_BIT_A2IE |DS1337_BIT_A1IE ); - }regmap_write (ds1307->regmap,DS1337_REG_CONTROL , regs[0 ]);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 182/486 ieee802154: ca8210: Use proper setters and getters for bitwise types
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 169b2262205836a5d1213ff44dca2962276bece1 ]
Sparse complains that the driver doesn't respect the bitwise types:
drivers/net/ieee802154/ca8210.c:1796:27: warning: incorrect type in assignment (different base types)drivers/net/ieee802154/ca8210.c:1796:27: expected restricted __le16 [addressable] [assigned] [usertype] pan_iddrivers/net/ieee802154/ca8210.c:1796:27: got unsigned short [usertype]drivers/net/ieee802154/ca8210.c:1801:25: warning: incorrect type in assignment (different base types)drivers/net/ieee802154/ca8210.c:1801:25: expected restricted __le16 [addressable] [assigned] [usertype] pan_iddrivers/net/ieee802154/ca8210.c:1801:25: got unsigned short [usertype]drivers/net/ieee802154/ca8210.c:1928:28: warning: incorrect type in argument 3 (different base types)drivers/net/ieee802154/ca8210.c:1928:28: expected unsigned short [usertype] dst_pan_iddrivers/net/ieee802154/ca8210.c:1928:28: got restricted __le16 [addressable] [usertype] pan_id
Use proper setters and getters for bitwise types.
Note, in accordance with [1] the protocol is little endian.
--- drivers/net/ieee802154/ca8210.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ieee802154/ca8210.c +4 -5
@@ -1446,8 +1446,7 @@ static u8 mcps_data_request( command.pdata.data_req.src_addr_mode = src_addr_mode; command.pdata.data_req.dst.mode = dst_address_mode;if (dst_address_mode !=MAC_MODE_NO_ADDR ) { - command.pdata.data_req.dst.pan_id[0 ] =LS_BYTE (dst_pan_id); - command.pdata.data_req.dst.pan_id[1 ] =MS_BYTE (dst_pan_id); +put_unaligned_le16 (dst_pan_id, command.pdata.data_req.dst.pan_id);if (dst_address_mode ==MAC_MODE_SHORT_ADDR ) { command.pdata.data_req.dst.address[0 ] =LS_BYTE ( dst_addr->short_address
@@ -1795,12 +1794,12 @@ static int ca8210_skb_rx( } hdr.source.mode = data_ind[0 ];dev_dbg (&priv->spi->dev,"srcAddrMode: %#03x\n" , hdr.source.mode); - hdr.source.pan_id = *(u16 *)&data_ind[1 ]; + hdr.source.pan_id =cpu_to_le16 (get_unaligned_le16 (&data_ind[1 ]));dev_dbg (&priv->spi->dev,"srcPanId: %#06x\n" , hdr.source.pan_id);memcpy (&hdr.source.extended_addr, &data_ind[3 ],8 ); hdr.dest.mode = data_ind[11 ];dev_dbg (&priv->spi->dev,"dstAddrMode: %#03x\n" , hdr.dest.mode); - hdr.dest.pan_id = *(u16 *)&data_ind[12 ]; + hdr.dest.pan_id =cpu_to_le16 (get_unaligned_le16 (&data_ind[12 ]));dev_dbg (&priv->spi->dev,"dstPanId: %#06x\n" , hdr.dest.pan_id);memcpy (&hdr.dest.extended_addr, &data_ind[14 ],8 );
@@ -1927,7 +1926,7 @@ static int ca8210_skb_tx( status = mcps_data_request( header.source.mode, header.dest.mode, - header.dest.pan_id, + le16_to_cpu(header.dest.pan_id), (union macaddr *)&header.dest.extended_addr, skb->len - mac_len, &skb->data[mac_len],
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 183/486 drm/xe: Nuke VM's mapping upon close
In reply to Sasha LevinFrom: Matthew Brost <[email protected]>
[ Upstream commit 074e40d9c2a84939fe28d7121d3469db50f34a3d ]
Clear root PT entry and invalidate entire VM's address space when closing the VM. Will prevent the GPU from accessing any of the VM's memory after closing.
v2:
- s/vma/vm in kernel doc (CI)
- Don't nuke migration VM as this occur at driver unload (CI)
v3:
- Rebase and pull into SVM series (Thomas)
- Wait for pending binds (Thomas)
v5:
- Remove xe_gt_tlb_invalidation_fence_fini in error case (Matt Auld)
- Drop local migration bool (Thomas)
v7:
- Add drm_dev_enter/exit protecting invalidation (CI, Matt Auld)
--- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 22 ++++++++++++++ drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h | 2 ++ drivers/gpu/drm/xe/xe_pt.c | 14 +++++++++ drivers/gpu/drm/xe/xe_pt.h | 3 ++ drivers/gpu/drm/xe/xe_vm.c | 32 +++++++++++++++++++++ 5 files changed, 73 insertions(+)
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c +22 -0
@@ -406,6 +406,28 @@ int xe_gt_tlb_invalidation_range(struct xe_gt *gt,return send_tlb_invalidation (>->uc.guc, fence, action, len); } +/** +* xe_gt_tlb_invalidation_vm - Issue a TLB invalidation on this GT for a VM +* @gt: graphics tile +* @vm: VM to invalidate +* +* Invalidate entire VM's address space +*/ +void xe_gt_tlb_invalidation_vm (struct xe_gt *gt,struct xe_vm *vm) +{ +struct xe_gt_tlb_invalidation_fence fence; +u64 range =1ull << vm->xe->info.va_bits; +int ret; + +xe_gt_tlb_invalidation_fence_init (gt, &fence, true); + + ret =xe_gt_tlb_invalidation_range (gt, &fence,0 , range, vm->usm.asid); +if (ret <0 ) +return ; + +xe_gt_tlb_invalidation_fence_wait (&fence); +} +/** * xe_gt_tlb_invalidation_vma - Issue a TLB invalidation on this GT for a VMA * @gt: graphics tile
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h +2 -0
@@ -12,6 +12,7 @@struct xe_gt ;struct xe_guc ; +struct xe_vm ;struct xe_vma ;int xe_gt_tlb_invalidation_init_early (struct xe_gt *gt);
@@ -21,6 +22,7 @@ int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);int xe_gt_tlb_invalidation_vma (struct xe_gt *gt,struct xe_gt_tlb_invalidation_fence *fence,struct xe_vma *vma); +void xe_gt_tlb_invalidation_vm (struct xe_gt *gt,struct xe_vm *vm);int xe_gt_tlb_invalidation_range (struct xe_gt *gt,struct xe_gt_tlb_invalidation_fence *fence,u64 start,u64 end,u32 asid);
drivers/gpu/drm/xe/xe_pt.c +14 -0
@@ -217,6 +217,20 @@ void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred)xe_pt_free (pt); } +/** +* xe_pt_clear() - Clear a page-table. +* @xe: xe device. +* @pt: The page-table. +* +* Clears page-table by setting to zero. +*/ +void xe_pt_clear (struct xe_device *xe,struct xe_pt *pt) +{ +struct iosys_map *map = &pt->bo->vmap; + +xe_map_memset (xe, map,0 ,0 ,SZ_4K ); +} +/** * DOC: Pagetable building *
drivers/gpu/drm/xe/xe_pt.h +3 -0
@@ -13,6 +13,7 @@ struct dma_fence;struct xe_bo ;struct xe_device ;struct xe_exec_queue ; +struct xe_svm_range ;struct xe_sync_entry ;struct xe_tile ;struct xe_vm ;
@@ -35,6 +36,8 @@ void xe_pt_populate_empty(struct xe_tile *tile, struct xe_vm *vm,void xe_pt_destroy (struct xe_pt *pt,u32 flags,struct llist_head *deferred); +void xe_pt_clear (struct xe_device *xe,struct xe_pt *pt); +int xe_pt_update_ops_prepare (struct xe_tile *tile,struct xe_vma_ops *vops);struct dma_fence *xe_pt_update_ops_run (struct xe_tile *tile,struct xe_vma_ops *vops);
drivers/gpu/drm/xe/xe_vm.c +32 -0
@@ -8,6 +8,7 @@#include <linux/dma-fence-array.h> #include <linux/nospec.h> +#include <drm/drm_drv.h> #include <drm/drm_exec.h> #include <drm/drm_print.h> #include <drm/ttm/ttm_execbuf_util.h>
@@ -1581,9 +1582,40 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)static void xe_vm_close (struct xe_vm *vm) { +struct xe_device *xe = vm->xe; +bool bound; +int idx; + + bound =drm_dev_enter (&xe->drm, &idx); +down_write (&vm->lock); + vm->size =0 ; + +if (!((vm->flags &XE_VM_FLAG_MIGRATION ))) { +struct xe_tile *tile; +struct xe_gt *gt; +u8 id; + +/* Wait for pending binds */ +dma_resv_wait_timeout (xe_vm_resv (vm), +DMA_RESV_USAGE_BOOKKEEP , + false,MAX_SCHEDULE_TIMEOUT ); + +if (bound) { +for_each_tile (tile, xe, id) +if (vm->pt_root[id]) +xe_pt_clear (xe, vm->pt_root[id]); + +for_each_gt (gt, xe, id) +xe_gt_tlb_invalidation_vm (gt, vm); + } + } +up_write (&vm->lock); + +if (bound) +drm_dev_exit (idx); }void xe_vm_close_and_put (struct xe_vm *vm)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 184/486 drm/xe: Retry BO allocation
In reply to Sasha LevinFrom: Matthew Brost <[email protected]>
[ Upstream commit 1d724a2f1b2c3f0cba4975784a808482e0631adf ]
TTM doesn't support fair eviction via WW locking, this mitigated in by using retry loops in exec and preempt rebind worker. Extend this retry loop to BO allocation. Once TTM supports fair eviction this patch can be reverted.
v4:
- Keep line break (Stuart)
--- drivers/gpu/drm/xe/xe_bo.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/xe/xe_bo.c +7 -0
@@ -1975,6 +1975,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,struct xe_file *xef =to_xe_file (file);struct drm_xe_gem_create *args = data;struct xe_vm *vm =NULL ; +ktime_t end =0 ;struct xe_bo *bo;unsigned int bo_flags;u32 handle;
@@ -2047,6 +2048,10 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data, vm =xe_vm_lookup (xef, args->vm_id);if (XE_IOCTL_DBG (xe, !vm))return -ENOENT ; + } + +retry: +if (vm) { err =xe_vm_lock (vm, true);if (err) goto out_vm;
@@ -2060,6 +2065,8 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,if (IS_ERR (bo)) { err =PTR_ERR (bo); +if (xe_vm_validate_should_retry (NULL , err, &end)) + goto retry; goto out_vm; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 185/486 soc: samsung: include linux/array_size.h where needed
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 4c57930f68d90e0d52c396d058cfa9ed8447a6c4 ]
This does not necessarily get included through asm/io.h:
drivers/soc/samsung/exynos3250-pmu.c:120:18: error: use of undeclared identifier 'ARRAY_SIZE'
120 | for (i = 0; i < ARRAY_SIZE(exynos3250_list_feed); i++) {
| ^drivers/soc/samsung/exynos5250-pmu.c:162:18: error: use of undeclared identifier 'ARRAY_SIZE'
162 | for (i = 0; i < ARRAY_SIZE(exynos5_list_both_cnt_feed); i++) {
| ^
--- drivers/soc/samsung/exynos-asv.c | 1 + drivers/soc/samsung/exynos-chipid.c | 1 + drivers/soc/samsung/exynos-pmu.c | 1 + drivers/soc/samsung/exynos-usi.c | 1 + drivers/soc/samsung/exynos3250-pmu.c | 1 + drivers/soc/samsung/exynos5250-pmu.c | 1 + drivers/soc/samsung/exynos5420-pmu.c | 1 + 7 files changed, 7 insertions(+)
drivers/soc/samsung/exynos-asv.c +1 -0
@@ -9,6 +9,7 @@* Samsung Exynos SoC Adaptive Supply Voltage support */ +#include <linux/array_size.h> #include <linux/cpu.h> #include <linux/device.h> #include <linux/energy_model.h>
drivers/soc/samsung/exynos-chipid.c +1 -0
@@ -12,6 +12,7 @@* Samsung Exynos SoC Adaptive Supply Voltage and Chip ID support */ +#include <linux/array_size.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/mfd/syscon.h>
drivers/soc/samsung/exynos-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos - CPU PMU(Power Management Unit) support +#include <linux/array_size.h> #include <linux/arm-smccc.h> #include <linux/of.h> #include <linux/of_address.h>
drivers/soc/samsung/exynos-usi.c +1 -0
@@ -6,6 +6,7 @@* Samsung Exynos USI driver (Universal Serial Interface). */ +#include <linux/array_size.h> #include <linux/clk.h> #include <linux/mfd/syscon.h> #include <linux/module.h>
drivers/soc/samsung/exynos3250-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos3250 - CPU PMU (Power Management Unit) support +#include <linux/array_size.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h>
drivers/soc/samsung/exynos5250-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos5250 - CPU PMU (Power Management Unit) support +#include <linux/array_size.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h>
drivers/soc/samsung/exynos5420-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos5420 - CPU PMU (Power Management Unit) support +#include <linux/array_size.h> #include <linux/pm.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h>
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 186/486 ARM: tegra: Switch DSI-B clock parent to PLLD on Tegra114
In reply to Sasha LevinFrom: Svyatoslav Ryhel <[email protected]>
[ Upstream commit 2b3db788f2f614b875b257cdb079adadedc060f3 ]
PLLD is usually used as parent clock for internal video devices, like DSI for example, while PLLD2 is used as parent for HDMI.
--- arch/arm/boot/dts/nvidia/tegra114.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/nvidia/tegra114.dtsi +1 -1
@@ -139,7 +139,7 @@ dsib: dsi@54400000 { reg = <0x54400000 0x00040000>; clocks = <&tegra_car TEGRA114_CLK_DSIB>, <&tegra_car TEGRA114_CLK_DSIBLP>, - <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>; + <&tegra_car TEGRA114_CLK_PLL_D_OUT0>; clock-names = "dsi", "lp", "parent"; resets = <&tegra_car 82>; reset-names = "dsi";
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 187/486 media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe()
In reply to Sasha LevinFrom: Markus Elfring <[email protected]>
[ Upstream commit b773530a34df0687020520015057075f8b7b4ac4 ]
An of_node_put(i2c_bus) call was immediately used after a pointer check for an of_find_i2c_adapter_by_node() call in this function implementation. Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
--- drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c +1 -2
@@ -797,13 +797,12 @@ static int c8sectpfe_probe(struct platform_device *pdev) } tsin->i2c_adapter =of_find_i2c_adapter_by_node (i2c_bus); +of_node_put (i2c_bus);if (!tsin->i2c_adapter) {dev_err (&pdev->dev,"No i2c adapter found\n" ); -of_node_put (i2c_bus); ret = -ENODEV ; goto err_node_put; } -of_node_put (i2c_bus);/* Acquire reset GPIO and activate it */ tsin->rst_gpio = devm_fwnode_gpiod_get(dev,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 188/486 usb: xhci: set page size to the xHCI-supported size
In reply to Sasha LevinFrom: Niklas Neronin <[email protected]>
[ Upstream commit 68c1f1671650b49bbd26e6a65ddcf33f2565efa3 ]
The current xHCI driver does not validate whether a page size of 4096 bytes is supported. Address the issue by setting the page size to the value supported by the xHCI controller, as read from the Page Size register. In the event of an unexpected value; default to a 4K page size.
Additionally, this commit removes unnecessary debug messages and instead prints the supported and used page size once.
The xHCI controller supports page sizes of (2^{(n+12)}) bytes, where 'n' is the Page Size Bit. Only one page size is supported, with a maximum page size of 128 KB.
--- drivers/usb/host/xhci-mem.c | 34 ++++++++++++++++++---------------- drivers/usb/host/xhci.h | 8 ++++---- 2 files changed, 22 insertions(+), 20 deletions(-)
drivers/usb/host/xhci-mem.c +18 -16
@@ -1959,7 +1959,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) xhci->interrupters =NULL ; xhci->page_size =0 ; - xhci->page_shift =0 ; xhci->usb2_rhub.bus_state.bus_suspended =0 ; xhci->usb3_rhub.bus_state.bus_suspended =0 ; }
@@ -2378,6 +2377,22 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs, }EXPORT_SYMBOL_GPL (xhci_create_secondary_interrupter); +static void xhci_hcd_page_size (struct xhci_hcd *xhci) +{ +u32 page_size; + + page_size =readl (&xhci->op_regs->page_size) &XHCI_PAGE_SIZE_MASK ; +if (!is_power_of_2 (page_size)) { +xhci_warn (xhci,"Invalid page size register = 0x%x\n" , page_size); +/* Fallback to 4K page size, since that's common */ + page_size =1 ; + } + + xhci->page_size = page_size <<12 ; +xhci_dbg_trace (xhci, trace_xhci_dbg_init,"HCD page size set to %iK" , + xhci->page_size >>10 ); +} +int xhci_mem_init (struct xhci_hcd *xhci,gfp_t flags) {struct xhci_interrupter *ir;
@@ -2385,7 +2400,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)dma_addr_t dma;unsigned int val, val2;u64 val_64; -u32 page_size, temp; +u32 temp;int i;INIT_LIST_HEAD (&xhci->cmd_list);
@@ -2394,20 +2409,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)INIT_DELAYED_WORK (&xhci->cmd_timer, xhci_handle_command_timeout);init_completion (&xhci->cmd_ring_stop_completion); - page_size =readl (&xhci->op_regs->page_size); -xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"Supported page size register = 0x%x" , page_size); - val =ffs (page_size) -1 ; -if (val <16 ) -xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"Supported page size of %iK" , (1 << (val +12 )) /1024 ); -else -xhci_warn (xhci,"WARN: no supported page size\n" ); -/* Use 4K pages, since that's common and the minimum the HC supports */ - xhci->page_shift =12 ; - xhci->page_size =1 << xhci->page_shift; -xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"HCD page size set to %iK" , xhci->page_size /1024 ); +xhci_hcd_page_size (xhci);/* * Program the Number of Device Slots Enabled field in the CONFIG
drivers/usb/host/xhci.h +4 -4
@@ -211,6 +211,9 @@ struct xhci_op_regs {#define CONFIG_CIE (1 << 9)/* bits 10:31 - reserved and should be preserved */ +/* bits 15:0 - HCD page shift bit */ +#define XHCI_PAGE_SIZE_MASK 0xffff +/** * struct xhci_intr_reg - Interrupt Register Set * @irq_pending: IMAN - Interrupt Management Register. Used to enable
@@ -1503,10 +1506,7 @@ struct xhci_hcd {u16 max_interrupters;/* imod_interval in ns (I * 250ns) */ u32 imod_interval; -/* 4KB min, 128MB max */ -int page_size; -/* Valid values are 12 to 20, inclusive */ -int page_shift; +u32 page_size;/* MSI-X/MSI vectors */ int nvecs;/* optional clocks */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 189/486 dm cache: prevent BUG_ON by blocking retries on failed device resumes
In reply to Sasha LevinFrom: Ming-Hung Tsai <[email protected]>
[ Upstream commit 5da692e2262b8f81993baa9592f57d12c2703dea ]
A cache device failing to resume due to mapping errors should not be retried, as the failure leaves a partially initialized policy object. Repeating the resume operation risks triggering BUG_ON when reloading cache mappings into the incomplete policy object.
Reproduce steps:
1. create a cache metadata consisting of 512 or more cache blocks, with some mappings stored in the first array block of the mapping array. Here we use cache_restore v1.0 to build the metadata.
cat <<EOF >> cmeta.xml
<superblock uuid="" block_size="128" nr_cache_blocks="512" \
policy="smq" hint_width="4">
<mappings>
<mapping cache_block="0" origin_block="0" dirty="false"/>
</mappings>
</superblock>
EOF
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" cache_restore -i cmeta.xml -o /dev/mapper/cmeta --metadata-version=2 dmsetup remove cmeta
2. wipe the second array block of the mapping array to simulate data degradations.
mapping_root=$(dd if=/dev/sdc bs=1c count=8 skip=192 \
2>/dev/null | hexdump -e '1/8 "%u\n"')
ablock=$(dd if=/dev/sdc bs=1c count=8 skip=$((4096*mapping_root+2056)) \
2>/dev/null | hexdump -e '1/8 "%u\n"')
dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock
3. try bringing up the cache device. The resume is expected to fail due to the broken array block.
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc 262144" dmsetup create cache --notable
dmsetup load cache --table "0 524288 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" dmsetup resume cache
4. try resuming the cache again. An unexpected BUG_ON is triggered while loading cache mappings.
dmsetup resume cache
Kernel logs:
(snip)
------------[ cut here ]------------ kernel BUG at drivers/md/dm-cache-policy-smq.c:752! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI CPU: 0 UID: 0 PID: 332 Comm: dmsetup Not tainted 6.13.4 #3 RIP: 0010:smq_load_mapping+0x3e5/0x570
Fix by disallowing resume operations for devices that failed the initial attempt.
--- drivers/md/dm-cache-target.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/md/dm-cache-target.c +24 -0
@@ -2899,6 +2899,27 @@ static dm_cblock_t get_cache_dev_size(struct cache *cache)return to_cblock (size); } +static bool can_resume (struct cache *cache) +{ +/* +* Disallow retrying the resume operation for devices that failed the +* first resume attempt, as the failure leaves the policy object partially +* initialized. Retrying could trigger BUG_ON when loading cache mappings +* into the incomplete policy object. +*/ +if (cache->sized && !cache->loaded_mappings) { +if (get_cache_mode (cache) !=CM_WRITE ) +DMERR ("%s: unable to resume a failed-loaded cache, please check metadata." , +cache_device_name (cache)); +else +DMERR ("%s: unable to resume cache due to missing proper cache table reload" , +cache_device_name (cache)); +return false; + } + +return true; +} +static bool can_resize (struct cache *cache,dm_cblock_t new_size) {if (from_cblock (new_size) >from_cblock (cache->cache_size)) {
@@ -2947,6 +2968,9 @@ static int cache_preresume(struct dm_target *ti)struct cache *cache = ti->private;dm_cblock_t csize =get_cache_dev_size (cache); +if (!can_resume (cache)) +return -EINVAL ; +/* * Check to see if the cache has resized. */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 190/486 soc: mediatek: mtk-mutex: Add DPI1 SOF/EOF to MT8188 mutex tables
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 694e0b7c1747603243da874de9cbbf8cb806ca44 ]
MT8188 uses DPI1 to output to the HDMI controller: add the Start of Frame and End of Frame configuration for the DPI1 IP to the tables to unblock generation and sending of these signals to the GCE.
--- drivers/soc/mediatek/mtk-mutex.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/soc/mediatek/mtk-mutex.c +6 -0
@@ -155,6 +155,7 @@#define MT8188_MUTEX_MOD_DISP1_VPP_MERGE3 23#define MT8188_MUTEX_MOD_DISP1_VPP_MERGE4 24#define MT8188_MUTEX_MOD_DISP1_DISP_MIXER 30 +#define MT8188_MUTEX_MOD_DISP1_DPI1 38#define MT8188_MUTEX_MOD_DISP1_DP_INTF1 39#define MT8195_MUTEX_MOD_DISP_OVL0 0
@@ -289,6 +290,7 @@#define MT8188_MUTEX_SOF_DSI0 1#define MT8188_MUTEX_SOF_DP_INTF0 3#define MT8188_MUTEX_SOF_DP_INTF1 4 +#define MT8188_MUTEX_SOF_DPI1 5#define MT8195_MUTEX_SOF_DSI0 1#define MT8195_MUTEX_SOF_DSI1 2#define MT8195_MUTEX_SOF_DP_INTF0 3
@@ -301,6 +303,7 @@#define MT8188_MUTEX_EOF_DSI0 (MT8188_MUTEX_SOF_DSI0 << 7)#define MT8188_MUTEX_EOF_DP_INTF0 (MT8188_MUTEX_SOF_DP_INTF0 << 7)#define MT8188_MUTEX_EOF_DP_INTF1 (MT8188_MUTEX_SOF_DP_INTF1 << 7) +#define MT8188_MUTEX_EOF_DPI1 (MT8188_MUTEX_SOF_DPI1 << 7)#define MT8195_MUTEX_EOF_DSI0 (MT8195_MUTEX_SOF_DSI0 << 7)#define MT8195_MUTEX_EOF_DSI1 (MT8195_MUTEX_SOF_DSI1 << 7)#define MT8195_MUTEX_EOF_DP_INTF0 (MT8195_MUTEX_SOF_DP_INTF0 << 7)
@@ -472,6 +475,7 @@ static const u8 mt8188_mutex_mod[DDP_COMPONENT_ID_MAX] = { [DDP_COMPONENT_PWM0] = MT8188_MUTEX_MOD2_DISP_PWM0, [DDP_COMPONENT_DP_INTF0] = MT8188_MUTEX_MOD_DISP_DP_INTF0, [DDP_COMPONENT_DP_INTF1] = MT8188_MUTEX_MOD_DISP1_DP_INTF1, + [DDP_COMPONENT_DPI1] = MT8188_MUTEX_MOD_DISP1_DPI1, [DDP_COMPONENT_ETHDR_MIXER] = MT8188_MUTEX_MOD_DISP1_DISP_MIXER, [DDP_COMPONENT_MDP_RDMA0] = MT8188_MUTEX_MOD_DISP1_MDP_RDMA0, [DDP_COMPONENT_MDP_RDMA1] = MT8188_MUTEX_MOD_DISP1_MDP_RDMA1,
@@ -686,6 +690,8 @@ static const u16 mt8188_mutex_sof[DDP_MUTEX_SOF_MAX] = { [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, [MUTEX_SOF_DSI0 ] = MT8188_MUTEX_SOF_DSI0 | MT8188_MUTEX_EOF_DSI0, + [MUTEX_SOF_DPI1 ] = + MT8188_MUTEX_SOF_DPI1 | MT8188_MUTEX_EOF_DPI1, [MUTEX_SOF_DP_INTF0 ] = MT8188_MUTEX_SOF_DP_INTF0 | MT8188_MUTEX_EOF_DP_INTF0, [MUTEX_SOF_DP_INTF1] =
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 191/486 orangefs: Do not truncate file size
In reply to Sasha LevinFrom: "Matthew Wilcox (Oracle)" <[email protected]>
[ Upstream commit 062e8093592fb866b8e016641a8b27feb6ac509d ]
'len' is used to store the result of i_size_read(), so making 'len' a size_t results in truncation to 4GiB on 32-bit systems.
--- fs/orangefs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/orangefs/inode.c +3 -4
@@ -23,9 +23,9 @@ static int orangefs_writepage_locked(struct page *page,struct orangefs_write_range *wr =NULL ;struct iov_iter iter;struct bio_vec bv; -size_t len, wlen; +size_t wlen;ssize_t ret; -loff_t off; +loff_t len, off;set_page_writeback (page);
@@ -91,8 +91,7 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow,struct orangefs_write_range *wrp, wr;struct iov_iter iter;ssize_t ret; -size_t len; -loff_t off; +loff_t len, off;int i; len =i_size_read (inode);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 192/486 drm/gem: Test for imported GEM buffers with helper
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit b57aa47d39e94dc47403a745e2024664e544078c ]
Add drm_gem_is_imported() that tests if a GEM object's buffer has been imported. Update the GEM code accordingly.
GEM code usually tests for imports if import_attach has been set in struct drm_gem_object. But attaching a dma-buf on import requires a DMA-capable importer device, which is not the case for many serial busses like USB or I2C. The new helper tests if a GEM object's dma-buf has been created from the GEM object.
--- drivers/gpu/drm/drm_gem.c | 4 ++-- include/drm/drm_gem.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_gem.c +2 -2
@@ -322,7 +322,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,return -ENOENT ;/* Don't allow imported objects to be mapped */ -if (obj->import_attach) { +if (drm_gem_is_imported (obj)) { ret = -EINVAL ; goto out; }
@@ -1152,7 +1152,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent, drm_vma_node_start(&obj->vma_node));drm_printf_indent (p, indent,"size=%zu\n" , obj->size);drm_printf_indent (p, indent,"imported=%s\n" , -str_yes_no (obj->import_attach)); +str_yes_no (drm_gem_is_imported (obj)));if (obj->funcs->print_info) obj->funcs->print_info (p, indent, obj);
include/drm/drm_gem.h +14 -0
@@ -35,6 +35,7 @@*/ #include <linux/kref.h> +#include <linux/dma-buf.h> #include <linux/dma-resv.h> #include <linux/list.h> #include <linux/mutex.h>
@@ -570,6 +571,19 @@ static inline bool drm_gem_object_is_shared_for_memory_stats(struct drm_gem_objereturn (obj->handle_count >1 ) || obj->dma_buf; } +/** +* drm_gem_is_imported() - Tests if GEM object's buffer has been imported +* @obj: the GEM object +* +* Returns: +* True if the GEM object's buffer has been imported, false otherwise +*/ +static inline bool drm_gem_is_imported (const struct drm_gem_object *obj) +{ +/* The dma-buf's priv field points to the original GEM object. */ +return obj->dma_buf && (obj->dma_buf->priv != obj); +} +#ifdef CONFIG_LOCKDEP /** * drm_gem_gpuva_set_lock() - Set the lock protecting accesses to the gpuva list.
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 193/486 net: phylink: use pl->link_interface in phylink_expects_phy()
In reply to Sasha LevinFrom: Choong Yong Liang <[email protected]>
[ Upstream commit b63263555eaafbf9ab1a82f2020bbee872d83759 ]
The phylink_expects_phy() function allows MAC drivers to check if they are expecting a PHY to attach. The checking condition in phylink_expects_phy() aims to achieve the same result as the checking condition in phylink_attach_phy().
However, the checking condition in phylink_expects_phy() uses pl->link_config.interface, while phylink_attach_phy() uses pl->link_interface.
Initially, both pl->link_interface and pl->link_config.interface are set to SGMII, and pl->cfg_link_an_mode is set to MLO_AN_INBAND.
When the interface switches from SGMII to 2500BASE-X, pl->link_config.interface is updated by phylink_major_config(). At this point, pl->cfg_link_an_mode remains MLO_AN_INBAND, and pl->link_config.interface is set to 2500BASE-X. Subsequently, when the STMMAC interface is taken down administratively and brought back up, it is blocked by phylink_expects_phy().
Since phylink_expects_phy() and phylink_attach_phy() aim to achieve the same result, phylink_expects_phy() should check pl->link_interface, which never changes, instead of pl->link_config.interface, which is updated by phylink_major_config().
--- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
@@ -1811,7 +1811,7 @@ bool phylink_expects_phy(struct phylink *pl) {if (pl->cfg_link_an_mode ==MLO_AN_FIXED || (pl->cfg_link_an_mode ==MLO_AN_INBAND && -phy_interface_mode_is_8023z (pl->link_config.interface))) +phy_interface_mode_is_8023z (pl->link_interface)))return false;return true; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 194/486 blk-throttle: don't take carryover for prioritized processing of metadata
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit a9fc8868b350cbf4ff730a4ea9651319cc669516 ]
Commit 29390bb5661d ("blk-throttle: support prioritized processing of metadata") takes bytes/ios carryover for prioritized processing of metadata. Turns out we can support it by charging it directly without trimming slice, and the result is same with carryover.
--- block/blk-throttle.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
block/blk-throttle.c +5 -10
@@ -1593,13 +1593,6 @@ static bool tg_within_limit(struct throtl_grp *tg, struct bio *bio, bool rw)return tg_may_dispatch (tg, bio,NULL ); } -static void tg_dispatch_in_debt (struct throtl_grp *tg,struct bio *bio,bool rw) -{ -if (!bio_flagged (bio,BIO_BPS_THROTTLED )) - tg->carryover_bytes[rw] -=throtl_bio_data_size (bio); - tg->carryover_ios[rw]--; -} -bool __blk_throtl_bio (struct bio *bio) {struct request_queue *q =bdev_get_queue (bio->bi_bdev);
@@ -1636,10 +1629,12 @@ bool __blk_throtl_bio(struct bio *bio)/* * IOs which may cause priority inversions are * dispatched directly, even if they're over limit. -* Debts are handled by carryover_bytes/ios while -* calculating wait time. +* +* Charge and dispatch directly, and our throttle +* control algorithm is adaptive, and extra IO bytes +* will be throttled for paying the debt */ -tg_dispatch_in_debt (tg, bio, rw); +throtl_charge_bio (tg, bio); }else {/* if above limits, break to queue */ break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 195/486 remoteproc: qcom_wcnss: Handle platforms with only single power domain
In reply to Sasha LevinFrom: Matti Lehtimäki <[email protected]>
[ Upstream commit 65991ea8a6d1e68effdc01d95ebe39f1653f7b71 ]
Both MSM8974 and MSM8226 have only CX as power domain with MX & PX being handled as regulators. Handle this case by reodering pd_names to have CX first, and handling that the driver core will already attach a single power domain internally.
--- drivers/remoteproc/qcom_wcnss.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
drivers/remoteproc/qcom_wcnss.c +26 -7
@@ -117,10 +117,10 @@ static const struct wcnss_data pronto_v1_data = { .pmu_offset = 0x1004, .spare_offset = 0x1088, - .pd_names = { "mx", "cx" }, + .pd_names = { "cx", "mx" }, .vregs = (struct wcnss_vreg_info[]) { - {"vddmx" ,950000 ,1150000 ,0 }, {"vddcx" , .super_turbo = true}, + {"vddmx" ,950000 ,1150000 ,0 }, {"vddpx" ,1800000 ,1800000 ,0 }, }, .num_pd_vregs = 2,
@@ -131,10 +131,10 @@ static const struct wcnss_data pronto_v2_data = { .pmu_offset = 0x1004, .spare_offset = 0x1088, - .pd_names = { "mx", "cx" }, + .pd_names = { "cx", "mx" }, .vregs = (struct wcnss_vreg_info[]) { - {"vddmx" ,1287500 ,1287500 ,0 }, {"vddcx" , .super_turbo = true }, + {"vddmx" ,1287500 ,1287500 ,0 }, {"vddpx" ,1800000 ,1800000 ,0 }, }, .num_pd_vregs = 2,
@@ -397,8 +397,17 @@ static irqreturn_t wcnss_stop_ack_interrupt(int irq, void *dev)static int wcnss_init_pds (struct qcom_wcnss *wcnss,const char *const pd_names[WCNSS_MAX_PDS ]) { +struct device *dev = wcnss->dev;int i, ret; +/* Handle single power domain */ +if (dev->pm_domain) { + wcnss->pds[0 ] = dev; + wcnss->num_pds =1 ; +pm_runtime_enable (dev); +return 0 ; + } +for (i =0 ; i <WCNSS_MAX_PDS ; i++) {if (!pd_names[i])break ;
@@ -418,8 +427,15 @@ static int wcnss_init_pds(struct qcom_wcnss *wcnss,static void wcnss_release_pds (struct qcom_wcnss *wcnss) { +struct device *dev = wcnss->dev;int i; +/* Handle single power domain */ +if (wcnss->num_pds ==1 && dev->pm_domain) { +pm_runtime_disable (dev); +return ; + } +for (i =0 ; i < wcnss->num_pds; i++)dev_pm_domain_detach (wcnss->pds[i], false); }
@@ -437,10 +453,13 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss,* the regulators for the power domains. For old device trees we need to * reserve extra space to manage them through the regulator interface. */ -if (wcnss->num_pds) - info += num_pd_vregs; -else +if (wcnss->num_pds) { + info += wcnss->num_pds; +/* Handle single power domain case */ + num_vregs += num_pd_vregs - wcnss->num_pds; + }else { num_vregs += num_pd_vregs; + } bulk = devm_kcalloc(wcnss->dev, num_vregs, sizeof(struct regulator_bulk_data),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 196/486 drm/amdgpu: Do not program AGP BAR regs under SRIOV in gfxhub_v1_0.c
In reply to Sasha LevinFrom: Victor Lu <[email protected]>
[ Upstream commit 057fef20b8401110a7bc1c2fe9d804a8a0bf0d24 ]
SRIOV VF does not have write access to AGP BAR regs. Skip the writes to avoid a dmesg warning.
--- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +5 -5
@@ -92,12 +92,12 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev) {uint64_t value; -/* Program the AGP BAR */ -WREG32_SOC15_RLC (GC ,0 , mmMC_VM_AGP_BASE,0 ); -WREG32_SOC15_RLC (GC ,0 , mmMC_VM_AGP_BOT, adev->gmc.agp_start >>24 ); -WREG32_SOC15_RLC (GC ,0 , mmMC_VM_AGP_TOP, adev->gmc.agp_end >>24 ); -if (!amdgpu_sriov_vf (adev) || adev->asic_type <=CHIP_VEGA10 ) { +/* Program the AGP BAR */ +WREG32_SOC15_RLC (GC ,0 , mmMC_VM_AGP_BASE,0 ); +WREG32_SOC15_RLC (GC ,0 , mmMC_VM_AGP_BOT, adev->gmc.agp_start >>24 ); +WREG32_SOC15_RLC (GC ,0 , mmMC_VM_AGP_TOP, adev->gmc.agp_end >>24 ); +/* Program the system aperture low logical page number. */ WREG32_SOC15_RLC (GC ,0 , mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,min (adev->gmc.fb_start, adev->gmc.agp_start) >>18 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 197/486 drm/amd/display: Ensure DMCUB idle before reset on DCN31/DCN35
In reply to Sasha LevinFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit c707ea82c79dbd1d295ec94cc6529a5248c77757 ]
[Why]
If we soft reset before halt finishes and there are outstanding memory transactions then the memory interface may produce unexpected results, such as out of order transactions when the firmware next runs.
These can manifest as random or unexpected load/store violations.
[How]
Increase the timeout before soft reset to ensure the DMCUB has quiesced. This is effectively 1s maximum based on experimentation.
Use the enable bit check on DCN31 like we're doing on DCN35 and reorder the reset writes to follow the HW programming guide.
Ensure we're reading SCRATCH7 instead of SCRATCH8 for the HALT code. No current versions of DMCUB firmware use the SCRATCH8 boot bit to dynamically switch where the HALT code goes to maintain backwards compatibility with PSP.
--- .../gpu/drm/amd/display/dmub/src/dmub_dcn31.c | 17 +++++++++++------ .../gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c +11 -6
@@ -83,8 +83,8 @@ static inline void dmub_dcn31_translate_addr(const union dmub_addr *addr_in,void dmub_dcn31_reset (struct dmub_srv *dmub) {union dmub_gpint_data_register cmd; -const uint32_t timeout =100 ; -uint32_t in_reset, scratch, i, pwait_mode; +const uint32_t timeout =100000 ; +uint32_t in_reset, is_enabled, scratch, i, pwait_mode;REG_GET (DMCUB_CNTL2 ,DMCUB_SOFT_RESET , &in_reset);
@@ -108,7 +108,7 @@ void dmub_dcn31_reset(struct dmub_srv *dmub) }for (i =0 ; i < timeout; ++i) { - scratch = dmub->hw_funcs.get_gpint_response (dmub); + scratch =REG_READ (DMCUB_SCRATCH7 );if (scratch ==DMUB_GPINT__STOP_FW_RESPONSE )break ;
@@ -125,9 +125,14 @@ void dmub_dcn31_reset(struct dmub_srv *dmub)/* Force reset in case we timed out, DMCUB is likely hung. */ } -REG_UPDATE (DMCUB_CNTL2 ,DMCUB_SOFT_RESET ,1 ); -REG_UPDATE (DMCUB_CNTL ,DMCUB_ENABLE ,0 ); -REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 ); +REG_GET (DMCUB_CNTL ,DMCUB_ENABLE , &is_enabled); + +if (is_enabled) { +REG_UPDATE (DMCUB_CNTL2 ,DMCUB_SOFT_RESET ,1 ); +REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 ); +REG_UPDATE (DMCUB_CNTL ,DMCUB_ENABLE ,0 ); + } +REG_WRITE (DMCUB_INBOX1_RPTR ,0 );REG_WRITE (DMCUB_INBOX1_WPTR ,0 );REG_WRITE (DMCUB_OUTBOX1_RPTR ,0 );
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c +2 -2
@@ -88,7 +88,7 @@ static inline void dmub_dcn35_translate_addr(const union dmub_addr *addr_in,void dmub_dcn35_reset (struct dmub_srv *dmub) {union dmub_gpint_data_register cmd; -const uint32_t timeout =100 ; +const uint32_t timeout =100000 ;uint32_t in_reset, is_enabled, scratch, i, pwait_mode;REG_GET (DMCUB_CNTL2 ,DMCUB_SOFT_RESET , &in_reset);
@@ -113,7 +113,7 @@ void dmub_dcn35_reset(struct dmub_srv *dmub) }for (i =0 ; i < timeout; ++i) { - scratch = dmub->hw_funcs.get_gpint_response (dmub); + scratch =REG_READ (DMCUB_SCRATCH7 );if (scratch ==DMUB_GPINT__STOP_FW_RESPONSE )break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 198/486 drm/amd/display: Skip checking FRL_MODE bit for PCON BW determination
In reply to Sasha LevinFrom: George Shen <[email protected]>
[ Upstream commit 0584bbcf0c53c133081100e4f4c9fe41e598d045 ]
[Why/How]
Certain PCON will clear the FRL_MODE bit despite supporting the link BW indicated in the other bits.
Thus, skip checking the FRL_MODE bit when interpreting the hdmi_encoded_link_bw struct.
--- .../dc/link/protocols/link_dp_capability.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +15 -15
@@ -250,21 +250,21 @@ static uint32_t intersect_frl_link_bw_support( {uint32_t supported_bw_in_kbps = max_supported_frl_bw_in_kbps; -// HDMI_ENCODED_LINK_BW bits are only valid if HDMI Link Configuration bit is 1 (FRL mode) -if (hdmi_encoded_link_bw.bits.FRL_MODE) { -if (hdmi_encoded_link_bw.bits.BW_48Gbps) - supported_bw_in_kbps =48000000 ; -else if (hdmi_encoded_link_bw.bits.BW_40Gbps) - supported_bw_in_kbps =40000000 ; -else if (hdmi_encoded_link_bw.bits.BW_32Gbps) - supported_bw_in_kbps =32000000 ; -else if (hdmi_encoded_link_bw.bits.BW_24Gbps) - supported_bw_in_kbps =24000000 ; -else if (hdmi_encoded_link_bw.bits.BW_18Gbps) - supported_bw_in_kbps =18000000 ; -else if (hdmi_encoded_link_bw.bits.BW_9Gbps) - supported_bw_in_kbps =9000000 ; - } +/* Skip checking FRL_MODE bit, as certain PCON will clear +* it despite supporting the link BW indicated in the other bits. +*/ +if (hdmi_encoded_link_bw.bits.BW_48Gbps) + supported_bw_in_kbps =48000000 ; +else if (hdmi_encoded_link_bw.bits.BW_40Gbps) + supported_bw_in_kbps =40000000 ; +else if (hdmi_encoded_link_bw.bits.BW_32Gbps) + supported_bw_in_kbps =32000000 ; +else if (hdmi_encoded_link_bw.bits.BW_24Gbps) + supported_bw_in_kbps =24000000 ; +else if (hdmi_encoded_link_bw.bits.BW_18Gbps) + supported_bw_in_kbps =18000000 ; +else if (hdmi_encoded_link_bw.bits.BW_9Gbps) + supported_bw_in_kbps =9000000 ;return supported_bw_in_kbps; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 199/486 drm/amd/display: Fix DMUB reset sequence for DCN401
In reply to Sasha LevinFrom: Dillon Varone <[email protected]>
[ Upstream commit 0dfcc2bf269010a6e093793034c048049a40ee93 ]
[WHY]
It should no longer use DMCUB_SOFT_RESET as it can result in the memory request path becoming desynchronized.
[HOW]
To ensure robustness in the reset sequence:
1) Extend timeout on the "halt" command sent via gpint, and check for controller to enter "wait" as a stronger guarantee that there are no requests to memory still in flight.
2) Remove usage of DMCUB_SOFT_RESET
3) Rely on PSP to reset the controller safely
--- .../drm/amd/display/dmub/src/dmub_dcn401.c | 47 ++++++++++++------- .../drm/amd/display/dmub/src/dmub_dcn401.h | 3 +- 2 files changed, 32 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn401.c +30 -17
@@ -63,8 +63,10 @@ static inline void dmub_dcn401_translate_addr(const union dmub_addr *addr_in,void dmub_dcn401_reset (struct dmub_srv *dmub) {union dmub_gpint_data_register cmd; -const uint32_t timeout =30 ; -uint32_t in_reset, scratch, i; +const uint32_t timeout_us =1 *1000 *1000 ;//1s +const uint32_t poll_delay_us =1 ;//1us +uint32_t i =0 ; +uint32_t in_reset, scratch, pwait_mode;REG_GET (DMCUB_CNTL2 ,DMCUB_SOFT_RESET , &in_reset);
@@ -75,32 +77,35 @@ void dmub_dcn401_reset(struct dmub_srv *dmub) dmub->hw_funcs.set_gpint (dmub, cmd); -/** -* Timeout covers both the ACK and the wait -* for remaining work to finish. -* -* This is mostly bound by the PHY disable sequence. -* Each register check will be greater than 1us, so -* don't bother using udelay. -*/ - -for (i =0 ; i < timeout; ++i) { +for (i =0 ; i < timeout_us; i++) {if (dmub->hw_funcs.is_gpint_acked (dmub, cmd))break ; + +udelay (poll_delay_us); } -for (i =0 ; i < timeout; ++i) { +for (; i < timeout_us; i++) { scratch = dmub->hw_funcs.get_gpint_response (dmub);if (scratch ==DMUB_GPINT__STOP_FW_RESPONSE )break ; + +udelay (poll_delay_us); } -/* Force reset in case we timed out, DMCUB is likely hung. */ +for (; i < timeout_us; i++) { +REG_GET (DMCUB_CNTL ,DMCUB_PWAIT_MODE_STATUS , &pwait_mode); +if (pwait_mode & (1 <<0 )) +break ; + +udelay (poll_delay_us); + } + } + +if (i >= timeout_us) { +/* timeout should never occur */ +BREAK_TO_DEBUGGER (); } -REG_UPDATE (DMCUB_CNTL2 ,DMCUB_SOFT_RESET ,1 ); -REG_UPDATE (DMCUB_CNTL ,DMCUB_ENABLE ,0 ); -REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 );REG_WRITE (DMCUB_INBOX1_RPTR ,0 );REG_WRITE (DMCUB_INBOX1_WPTR ,0 );REG_WRITE (DMCUB_OUTBOX1_RPTR ,0 );
@@ -131,7 +136,10 @@ void dmub_dcn401_backdoor_load(struct dmub_srv *dmub,dmub_dcn401_get_fb_base_offset (dmub, &fb_base, &fb_offset); +/* reset and disable DMCUB and MMHUBBUB DMUIF */ REG_UPDATE (DMCUB_SEC_CNTL ,DMCUB_SEC_RESET ,1 ); +REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 ); +REG_UPDATE (DMCUB_CNTL ,DMCUB_ENABLE ,0 );dmub_dcn401_translate_addr (&cw0->offset, fb_base, fb_offset, &offset);
@@ -151,6 +159,7 @@ void dmub_dcn401_backdoor_load(struct dmub_srv *dmub,DMCUB_REGION3_CW1_TOP_ADDRESS , cw1->region.top, DMCUB_REGION3_CW1_ENABLE, 1); +/* release DMCUB reset only to prevent premature execution */ REG_UPDATE_2 (DMCUB_SEC_CNTL ,DMCUB_SEC_RESET ,0 ,DMCUB_MEM_UNIT_ID ,0x20 ); }
@@ -161,7 +170,10 @@ void dmub_dcn401_backdoor_load_zfb_mode(struct dmub_srv *dmub, {union dmub_addr offset; +/* reset and disable DMCUB and MMHUBBUB DMUIF */ REG_UPDATE (DMCUB_SEC_CNTL ,DMCUB_SEC_RESET ,1 ); +REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 ); +REG_UPDATE (DMCUB_CNTL ,DMCUB_ENABLE ,0 ); offset = cw0->offset;
@@ -181,6 +193,7 @@ void dmub_dcn401_backdoor_load_zfb_mode(struct dmub_srv *dmub,DMCUB_REGION3_CW1_TOP_ADDRESS , cw1->region.top, DMCUB_REGION3_CW1_ENABLE, 1); +/* release DMCUB reset only to prevent premature execution */ REG_UPDATE_2 (DMCUB_SEC_CNTL ,DMCUB_SEC_RESET ,0 ,DMCUB_MEM_UNIT_ID ,0x20 ); }
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn401.h +2 -1
@@ -169,7 +169,8 @@ struct dmub_srv; DMUB_SF(HOST_INTERRUPT_CSR, HOST_REG_INBOX0_RSP_INT_EN) \ DMUB_SF(HOST_INTERRUPT_CSR, HOST_REG_OUTBOX0_RDY_INT_ACK) \ DMUB_SF(HOST_INTERRUPT_CSR, HOST_REG_OUTBOX0_RDY_INT_STAT) \ - DMUB_SF(HOST_INTERRUPT_CSR, HOST_REG_OUTBOX0_RDY_INT_EN) + DMUB_SF(HOST_INTERRUPT_CSR, HOST_REG_OUTBOX0_RDY_INT_EN) \ + DMUB_SF(DMCUB_CNTL, DMCUB_PWAIT_MODE_STATUS)struct dmub_srv_dcn401_reg_offset {#define DMUB_SR (reg) uint32_t reg;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 200/486 drm/amd/display: Fix p-state type when p-state is unsupported
In reply to Sasha LevinFrom: Dillon Varone <[email protected]>
[ Upstream commit a025f424af0407b7561bd5e6217295dde3abbc2e ]
[WHY&HOW]
P-state type would remain on previously used when unsupported which causes confusion in logging and visual confirm, so set back to zero when unsupported.
--- drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +1 -0
@@ -508,6 +508,7 @@ void set_p_state_switch_method(if (!dc->ctx || !dc->ctx->dmub_srv || !pipe_ctx || !vba)return ; + pipe_ctx->p_state_type =P_STATE_UNKNOWN ;if (vba->DRAMClockChangeSupport[vba->VoltageLevel][vba->maxMpcComb] != dm_dram_clock_change_unsupported) {/* MCLK switching is supported */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 201/486 drm/amd/display: Request HW cursor on DCN3.2 with SubVP
In reply to Sasha LevinFrom: Aric Cyr <[email protected]>
[ Upstream commit b74f46f3ce1e5f6336645f1e9ff47c56d5dfdef1 ]
[why]
When SubVP is active the HW cursor size is limited to 64x64, and anything larger will force composition which is bad for gaming on DCN3.2 if the game uses a larger cursor.
[how]
If HW cursor is requested, typically by a fullscreen game, do not enable SubVP so that up to 256x256 cursor sizes are available for DCN3.2.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
@@ -4734,7 +4734,8 @@ static bool full_update_required(struct dc *dc, stream_update->lut3d_func || stream_update->pending_test_pattern || stream_update->crtc_timing_adjust || - stream_update->scaler_sharpener_update)) + stream_update->scaler_sharpener_update || + stream_update->hw_cursor_req)) return true;if (stream) {
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +1 -0
@@ -626,6 +626,7 @@ static bool dcn32_assign_subvp_pipe(struct dc *dc,* - Not TMZ surface */ if (pipe->plane_state && !pipe->top_pipe && !pipe->prev_odm_pipe && !dcn32_is_center_timing(pipe) && + !pipe->stream->hw_cursor_req && !(pipe->stream->timing.pix_clk_100hz / 10000 > DCN3_2_MAX_SUBVP_PIXEL_RATE_MHZ) && (!dcn32_is_psr_capable(pipe) || (context->stream_count == 1 && dc->caps.dmub_caps.subvp_psr)) && dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_NONE &&
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 202/486 perf/core: Clean up perf_try_init_event()
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit da02f54e81db2f7bf6af9d1d0cfc5b41ec6d0dcb ]
Make sure that perf_try_init_event() doesn't leave event->pmu nor event->destroy set on failure.
--- kernel/events/core.c | 65 ++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 27 deletions(-)
kernel/events/core.c +38 -27
@@ -11978,40 +11978,51 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)if (ctx)perf_event_ctx_unlock (event->group_leader, ctx); -if (!ret) { -if (!(pmu->capabilities &PERF_PMU_CAP_EXTENDED_REGS ) && -has_extended_regs (event)) - ret = -EOPNOTSUPP ; +if (ret) + goto err_pmu; -if (pmu->capabilities &PERF_PMU_CAP_NO_EXCLUDE && -event_has_any_exclude_flag (event)) - ret = -EINVAL ; +if (!(pmu->capabilities &PERF_PMU_CAP_EXTENDED_REGS ) && +has_extended_regs (event)) { + ret = -EOPNOTSUPP ; + goto err_destroy; + } -if (pmu->scope !=PERF_PMU_SCOPE_NONE && event->cpu >=0 ) { -const struct cpumask *cpumask =perf_scope_cpu_topology_cpumask (pmu->scope, event->cpu); -struct cpumask *pmu_cpumask =perf_scope_cpumask (pmu->scope); -int cpu; - -if (pmu_cpumask && cpumask) { - cpu =cpumask_any_and (pmu_cpumask, cpumask); -if (cpu >= nr_cpu_ids) - ret = -ENODEV ; -else - event->event_caps |=PERF_EV_CAP_READ_SCOPE ; - }else { - ret = -ENODEV ; - } - } +if (pmu->capabilities &PERF_PMU_CAP_NO_EXCLUDE && +event_has_any_exclude_flag (event)) { + ret = -EINVAL ; + goto err_destroy; + } -if (ret && event->destroy) - event->destroy (event); +if (pmu->scope !=PERF_PMU_SCOPE_NONE && event->cpu >=0 ) { +const struct cpumask *cpumask; +struct cpumask *pmu_cpumask; +int cpu; + + cpumask =perf_scope_cpu_topology_cpumask (pmu->scope, event->cpu); + pmu_cpumask =perf_scope_cpumask (pmu->scope); + + ret = -ENODEV ; +if (!pmu_cpumask || !cpumask) + goto err_destroy; + + cpu =cpumask_any_and (pmu_cpumask, cpumask); +if (cpu >= nr_cpu_ids) + goto err_destroy; + + event->event_caps |=PERF_EV_CAP_READ_SCOPE ; } -if (ret) { - event->pmu =NULL ; -module_put (pmu->module); +return 0 ; + +err_destroy: +if (event->destroy) { + event->destroy (event); + event->destroy =NULL ; } +err_pmu: + event->pmu =NULL ; +module_put (pmu->module);return ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 203/486 media: cx231xx: set device_caps for 417
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit a79efc44b51432490538a55b9753a721f7d3ea42 ]
The video_device for the MPEG encoder did not set device_caps.
Add this, otherwise the video device can't be registered (you get a WARN_ON instead).
Not seen before since currently 417 support is disabled, but I found this while experimenting with it.
--- drivers/media/usb/cx231xx/cx231xx-417.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/cx231xx/cx231xx-417.c +2 -0
@@ -1722,6 +1722,8 @@ static void cx231xx_video_dev_init( vfd->lock = &dev->lock; vfd->release = video_device_release_empty; vfd->ctrl_handler = &dev->mpeg_ctrl_handler.hdl; + vfd->device_caps =V4L2_CAP_READWRITE |V4L2_CAP_STREAMING | +V4L2_CAP_VIDEO_CAPTURE ;video_set_drvdata (vfd, dev);if (dev->tuner_type ==TUNER_ABSENT ) {v4l2_disable_ioctl (vfd,VIDIOC_G_FREQUENCY );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 204/486 pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned"
In reply to Sasha LevinFrom: Artur Weber <[email protected]>
[ Upstream commit 07b5a2a13f4704c5eae3be7277ec54ffdba45f72 ]
Replace uses of bare "unsigned" with "unsigned int" to fix checkpatch warnings. No functional change.
--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +22 -22
@@ -72,7 +72,7 @@ static enum bcm281xx_pin_type hdmi_pin = BCM281XX_PIN_TYPE_HDMI;struct bcm281xx_pin_function {const char *name;const char *const *groups; -const unsigned ngroups; +const unsigned int ngroups; };/*
@@ -84,10 +84,10 @@ struct bcm281xx_pinctrl_data {/* List of all pins */ const struct pinctrl_pin_desc *pins; -const unsigned npins; +const unsigned int npins;const struct bcm281xx_pin_function *functions; -const unsigned nfunctions; +const unsigned int nfunctions;struct regmap *regmap; };
@@ -941,7 +941,7 @@ static struct bcm281xx_pinctrl_data bcm281xx_pinctrl = { };static inline enum bcm281xx_pin_type pin_type_get (struct pinctrl_dev *pctldev, -unsigned pin) +unsigned int pin) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -985,7 +985,7 @@ static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) }static const char *bcm281xx_pinctrl_get_group_name (struct pinctrl_dev *pctldev, -unsigned group) +unsigned int group) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -993,9 +993,9 @@ static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev, }static int bcm281xx_pinctrl_get_group_pins (struct pinctrl_dev *pctldev, -unsigned group, +unsigned int group,const unsigned **pins, -unsigned *num_pins) +unsigned int *num_pins) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1007,7 +1007,7 @@ static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,static void bcm281xx_pinctrl_pin_dbg_show (struct pinctrl_dev *pctldev,struct seq_file *s, -unsigned offset) +unsigned int offset) {seq_printf (s," %s" ,dev_name (pctldev->dev)); }
@@ -1029,7 +1029,7 @@ static int bcm281xx_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev) }static const char *bcm281xx_pinctrl_get_fcn_name (struct pinctrl_dev *pctldev, -unsigned function) +unsigned int function) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1037,9 +1037,9 @@ static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev, }static int bcm281xx_pinctrl_get_fcn_groups (struct pinctrl_dev *pctldev, -unsigned function, +unsigned int function,const char *const **groups, -unsigned *const num_groups) +unsigned int *const num_groups) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1050,8 +1050,8 @@ static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev, }static int bcm281xx_pinmux_set (struct pinctrl_dev *pctldev, -unsigned function, -unsigned group) +unsigned int function, +unsigned int group) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);const struct bcm281xx_pin_function *f = &pdata->functions[function];
@@ -1082,7 +1082,7 @@ static const struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = { };static int bcm281xx_pinctrl_pin_config_get (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *config) {return -ENOTSUPP ;
@@ -1091,9 +1091,9 @@ static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev,/* Goes through the configs and update register val/mask */ static int bcm281xx_std_pin_update (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs, +unsigned int num_configs,u32 *val,u32 *mask) {
@@ -1207,9 +1207,9 @@ static const u16 bcm281xx_pullup_map[] = {/* Goes through the configs and update register val/mask */ static int bcm281xx_i2c_pin_update (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs, +unsigned int num_configs,u32 *val,u32 *mask) {
@@ -1277,9 +1277,9 @@ static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,/* Goes through the configs and update register val/mask */ static int bcm281xx_hdmi_pin_update (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs, +unsigned int num_configs,u32 *val,u32 *mask) {
@@ -1321,9 +1321,9 @@ static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev, }static int bcm281xx_pinctrl_pin_config_set (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs) +unsigned int num_configs) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);enum bcm281xx_pin_type pin_type;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 205/486 rcu: Fix get_state_synchronize_rcu_full() GP-start detection
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 85aad7cc417877054c65bd490dc037b087ef21b4 ]
The get_state_synchronize_rcu_full() and poll_state_synchronize_rcu_full() functions use the root rcu_node structure's ->gp_seq field to detect the beginnings and ends of grace periods, respectively. This choice is necessary for the poll_state_synchronize_rcu_full() function because (give or take counter wrap), the following sequence is guaranteed not to trigger:
get_state_synchronize_rcu_full(&rgos); synchronize_rcu(); WARN_ON_ONCE(!poll_state_synchronize_rcu_full(&rgos));
The RCU callbacks that awaken synchronize_rcu() instances are guaranteed not to be invoked before the root rcu_node structure's ->gp_seq field is updated to indicate the end of the grace period. However, these callbacks might start being invoked immediately thereafter, in particular, before rcu_state.gp_seq has been updated. Therefore, poll_state_synchronize_rcu_full() must refer to the root rcu_node structure's ->gp_seq field. Because this field is updated under this structure's ->lock, any code following a call to poll_state_synchronize_rcu_full() will be fully ordered after the full grace-period computation, as is required by RCU's memory-ordering semantics.
By symmetry, the get_state_synchronize_rcu_full() function should also use this same root rcu_node structure's ->gp_seq field. But it turns out that symmetry is profoundly (though extremely infrequently) destructive in this case. To see this, consider the following sequence of events:
1. CPU 0 starts a new grace period, and updates rcu_state.gp_seq
accordingly.
2. As its first step of grace-period initialization, CPU 0 examines
the current CPU hotplug state and decides that it need not wait for CPU 1, which is currently offline.
3. CPU 1 comes online, and updates its state. But this does not
affect the current grace period, but rather the one after that. After all, CPU 1 was offline when the current grace period started, so all pre-existing RCU readers on CPU 1 must have completed or been preempted before it last went offline. The current grace period therefore has nothing it needs to wait for on CPU 1.
4. CPU 1 switches to an rcutorture kthread which is running
rcutorture's rcu_torture_reader() function, which starts a new RCU reader.
5. CPU 2 is running rcutorture's rcu_torture_writer() function
and collects a new polled grace-period "cookie" using get_state_synchronize_rcu_full(). Because the newly started grace period has not completed initialization, the root rcu_node structure's ->gp_seq field has not yet been updated to indicate that this new grace period has already started.
This cookie is therefore set up for the end of the current grace period (rather than the end of the following grace period).
6. CPU 0 finishes grace-period initialization.
7. If CPU 1’s rcutorture reader is preempted, it will be added to
the ->blkd_tasks list, but because CPU 1’s ->qsmask bit is not set in CPU 1's leaf rcu_node structure, the ->gp_tasks pointer will not be updated. Thus, this grace period will not wait on it. Which is only fair, given that the CPU did not come online until after the grace period officially started.
8. CPUs 0 and 2 then detect the new grace period and then report
a quiescent state to the RCU core.
9. Because CPU 1 was offline at the start of the current grace
period, CPUs 0 and 2 are the only CPUs that this grace period needs to wait on. So the grace period ends and post-grace-period cleanup starts. In particular, the root rcu_node structure's ->gp_seq field is updated to indicate that this grace period has now ended.
10. CPU 2 continues running rcu_torture_writer() and sees that,
from the viewpoint of the root rcu_node structure consulted by the poll_state_synchronize_rcu_full() function, the grace period has ended. It therefore updates state accordingly.
11. CPU 1 is still running the same RCU reader, which notices this
update and thus complains about the too-short grace period.
The fix is for the get_state_synchronize_rcu_full() function to use rcu_state.gp_seq instead of the root rcu_node structure's ->gp_seq field. With this change in place, if step 5's cookie indicates that the grace period has not yet started, then any prior code executed by CPU 2 must have happened before CPU 1 came online. This will in turn prevent CPU 1's code in steps 3 and 11 from spanning CPU 2's grace-period wait, thus preventing CPU 1 from being subjected to a too-short grace period.
This commit therefore makes this change. Note that there is no change to the poll_state_synchronize_rcu_full() function, which as noted above, must continue to use the root rcu_node structure's ->gp_seq field. This is of course an asymmetry between these two functions, but is an asymmetry that is absolutely required for correct operation. It is a common human tendency to greatly value symmetry, and sometimes symmetry is a wonderful thing. Other times, symmetry results in poor performance. But in this case, symmetry is just plain wrong.
Nevertheless, the asymmetry does require an additional adjustment. It is possible for get_state_synchronize_rcu_full() to see a given grace period as having started, but for an immediately following poll_state_synchronize_rcu_full() to see it as having not yet started. Given the current rcu_seq_done_exact() implementation, this will result in a false-positive indication that the grace period is done from poll_state_synchronize_rcu_full(). This is dealt with by making rcu_seq_done_exact() reach back three grace periods rather than just two of them.
However, simply changing get_state_synchronize_rcu_full() function to use rcu_state.gp_seq instead of the root rcu_node structure's ->gp_seq field results in a theoretical bug in kernels booted with rcutree.rcu_normal_wake_from_gp=1 due to the following sequence of events:
o The rcu_gp_init() function invokes rcu_seq_start() to officially
start a new grace period.
o A new RCU reader begins, referencing X from some RCU-protected
list. The new grace period is not obligated to wait for this reader.
o An updater removes X, then calls synchronize_rcu(), which queues
a wait element.
o The grace period ends, awakening the updater, which frees X
while the reader is still referencing it.
The reason that this is theoretical is that although the grace period has officially started, none of the CPUs are officially aware of this, and thus will have to assume that the RCU reader pre-dated the start of the grace period. Detailed explanation can be found at [2] and [3].
Except for kernels built with CONFIG_PROVE_RCU=y, which use the polled grace-period APIs, which can and do complain bitterly when this sequence of events occurs. Not only that, there might be some future RCU grace-period mechanism that pulls this sequence of events from theory into practice. This commit therefore also pulls the call to rcu_sr_normal_gp_init() to precede that to rcu_seq_start().
Although this fixes commit 91a967fd6934 ("rcu: Add full-sized polling for get_completed*() and poll_state*()"), it is not clear that it is worth backporting this commit. First, it took me many weeks to convince rcutorture to reproduce this more frequently than once per year. Second, this cannot be reproduced at all without frequent CPU-hotplug operations, as in waiting all of 50 milliseconds from the end of the previous operation until starting the next one. Third, the TREE03.boot settings cause multi-millisecond delays during RCU grace-period initialization, which greatly increase the probability of the above sequence of events. (Don't do this in production workloads!) Fourth, the TREE03 rcutorture scenario was modified to use four-CPU guest OSes, to have a single-rcu_node combining tree, no testing of RCU priority boosting, and no random preemption, and these modifications were necessary to reproduce this issue in a reasonable timeframe. Fifth, extremely heavy use of get_state_synchronize_rcu_full() and/or poll_state_synchronize_rcu_full() is required to reproduce this, and as of v6.12, only kfree_rcu() uses it, and even then not particularly heavily.
[boqun: Apply the fix [1], and add the comment before the moved rcu_sr_normal_gp_init(). Additional links are added for explanation.]
--- kernel/rcu/rcu.h | 2 +- kernel/rcu/tree.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-)
kernel/rcu/rcu.h +1 -1
@@ -162,7 +162,7 @@ static inline bool rcu_seq_done_exact(unsigned long *sp, unsigned long s) {unsigned long cur_s =READ_ONCE (*sp); -return ULONG_CMP_GE (cur_s, s) ||ULONG_CMP_LT (cur_s, s - (2 *RCU_SEQ_STATE_MASK +1 )); +return ULONG_CMP_GE (cur_s, s) ||ULONG_CMP_LT (cur_s, s - (3 *RCU_SEQ_STATE_MASK +1 )); }/*
kernel/rcu/tree.c +11 -4
@@ -1822,10 +1822,14 @@ static noinline_for_stack bool rcu_gp_init(void)/* Advance to a new grace period and initialize state. */ record_gp_stall_check_time (); +/* +* A new wait segment must be started before gp_seq advanced, so +* that previous gp waiters won't observe the new gp_seq. +*/ + start_new_poll =rcu_sr_normal_gp_init ();/* Record GP times before starting GP, hence rcu_seq_start(). */ rcu_seq_start (&rcu_state.gp_seq);ASSERT_EXCLUSIVE_WRITER (rcu_state.gp_seq); - start_new_poll =rcu_sr_normal_gp_init ();trace_rcu_grace_period (rcu_state.name, rcu_state.gp_seq,TPS ("start" ));rcu_poll_gp_seq_start (&rcu_state.gp_seq_polled_snap);raw_spin_unlock_irq_rcu_node (rnp);
@@ -4183,14 +4187,17 @@ EXPORT_SYMBOL_GPL(get_state_synchronize_rcu);*/ void get_state_synchronize_rcu_full (struct rcu_gp_oldstate *rgosp) { -struct rcu_node *rnp =rcu_get_root (); -/* * Any prior manipulation of RCU-protected data must happen * before the loads from ->gp_seq and ->expedited_sequence. */ smp_mb ();/* ^^^ */ - rgosp->rgos_norm =rcu_seq_snap (&rnp->gp_seq); + +// Yes, rcu_state.gp_seq, not rnp_root->gp_seq, the latter's use +// in poll_state_synchronize_rcu_full() notwithstanding. Use of +// the latter here would result in too-short grace periods due to +// interactions with newly onlined CPUs. + rgosp->rgos_norm =rcu_seq_snap (&rcu_state.gp_seq); rgosp->rgos_exp =rcu_seq_snap (&rcu_state.expedited_sequence); }EXPORT_SYMBOL_GPL (get_state_synchronize_rcu_full);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 206/486 net: ethernet: ti: cpsw_new: populate netdev of_node
In reply to Sasha LevinFrom: Alexander Sverdlin <[email protected]>
[ Upstream commit 7ff1c88fc89688c27f773ba956f65f0c11367269 ]
So that of_find_net_device_by_node() can find CPSW ports and other DSA switches can be stacked downstream. Tested in conjunction with KSZ8873.
--- drivers/net/ethernet/ti/cpsw_new.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/cpsw_new.c +1 -0
@@ -1417,6 +1417,7 @@ static int cpsw_create_ports(struct cpsw_common *cpsw) ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops;SET_NETDEV_DEV (ndev, dev); + ndev->dev.of_node = slave_data->slave_node;if (!napi_ndev) {/* CPSW Host port CPDMA interface is shared between
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 207/486 net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104
In reply to Sasha LevinFrom: Andrei Botila <[email protected]>
[ Upstream commit a06a868a0cd96bc51401cdea897313a3f6ad01a0 ]
Add .match_phy_device for the existing TJAs to differentiate between TJA1103 and TJA1104.
TJA1103 and TJA1104 share the same PHY_ID but TJA1104 has MACsec capabilities while TJA1103 doesn't.
--- drivers/net/phy/nxp-c45-tja11xx.c | 54 +++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-)
drivers/net/phy/nxp-c45-tja11xx.c +52 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* NXP C45 PHY driver -* Copyright 2021-2023 NXP +* Copyright 2021-2025 NXP * Author: Radu Pirea <[email protected]> */
@@ -18,6 +18,8 @@#include "nxp-c45-tja11xx.h" +#define PHY_ID_MASK GENMASK(31, 4) +/* Same id: TJA1103, TJA1104 */ #define PHY_ID_TJA_1103 0x001BB010#define PHY_ID_TJA_1120 0x001BB031
@@ -1930,6 +1932,30 @@ static void tja1120_nmi_handler(struct phy_device *phydev, } } +static int nxp_c45_macsec_ability (struct phy_device *phydev) +{ +bool macsec_ability; +int phy_abilities; + + phy_abilities =phy_read_mmd (phydev,MDIO_MMD_VEND1 , +VEND1_PORT_ABILITIES ); + macsec_ability = !!(phy_abilities &MACSEC_ABILITY ); + +return macsec_ability; +} + +static int tja1103_match_phy_device (struct phy_device *phydev) +{ +return phy_id_compare (phydev->phy_id,PHY_ID_TJA_1103 ,PHY_ID_MASK ) && + !nxp_c45_macsec_ability (phydev); +} + +static int tja1104_match_phy_device (struct phy_device *phydev) +{ +return phy_id_compare (phydev->phy_id,PHY_ID_TJA_1103 ,PHY_ID_MASK ) && +nxp_c45_macsec_ability (phydev); +} +static const struct nxp_c45_regmap tja1120_regmap = { .vend1_ptp_clk_period =0x1020 , .vend1_event_msg_filt =0x9010 ,
@@ -2000,7 +2026,6 @@ static const struct nxp_c45_phy_data tja1120_phy_data = {static struct phy_driver nxp_c45_driver[] = { { -PHY_ID_MATCH_MODEL (PHY_ID_TJA_1103 ), .name ="NXP C45 TJA1103" , .get_features = nxp_c45_get_features, .driver_data = &tja1103_phy_data,
@@ -2022,6 +2047,31 @@ static struct phy_driver nxp_c45_driver[] = { .get_sqi = nxp_c45_get_sqi, .get_sqi_max = nxp_c45_get_sqi_max, .remove = nxp_c45_remove, + .match_phy_device = tja1103_match_phy_device, + }, + { + .name = "NXP C45 TJA1104", + .get_features = nxp_c45_get_features, + .driver_data = &tja1103_phy_data, + .probe = nxp_c45_probe, + .soft_reset = nxp_c45_soft_reset, + .config_aneg = genphy_c45_config_aneg, + .config_init = nxp_c45_config_init, + .config_intr = tja1103_config_intr, + .handle_interrupt = nxp_c45_handle_interrupt, + .read_status = genphy_c45_read_status, + .suspend = genphy_c45_pma_suspend, + .resume = genphy_c45_pma_resume, + .get_sset_count = nxp_c45_get_sset_count, + .get_strings = nxp_c45_get_strings, + .get_stats = nxp_c45_get_stats, + .cable_test_start = nxp_c45_cable_test_start, + .cable_test_get_status = nxp_c45_cable_test_get_status, + .set_loopback = genphy_c45_loopback, + .get_sqi = nxp_c45_get_sqi, + .get_sqi_max = nxp_c45_get_sqi_max, + .remove = nxp_c45_remove, + .match_phy_device = tja1104_match_phy_device, }, { PHY_ID_MATCH_MODEL(PHY_ID_TJA_1120),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 208/486 dpll: Add an assertion to check freq_supported_num
In reply to Sasha LevinFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 39e912a959c19338855b768eaaee2917d7841f71 ]
Since the driver is broken in the case that src->freq_supported is not NULL but src->freq_supported_num is 0, add an assertion for it.
--- drivers/dpll/dpll_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dpll/dpll_core.c +4 -1
@@ -443,8 +443,11 @@ static void dpll_pin_prop_free(struct dpll_pin_properties *prop)static int dpll_pin_prop_dup (const struct dpll_pin_properties *src,struct dpll_pin_properties *dst) { +if (WARN_ON (src->freq_supported && !src->freq_supported_num)) +return -EINVAL ; +memcpy (dst, src,sizeof (*dst)); -if (src->freq_supported && src->freq_supported_num) { +if (src->freq_supported) {size_t freq_size = src->freq_supported_num *sizeof (*src->freq_supported); dst->freq_supported = kmemdup(src->freq_supported,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 209/486 ublk: enforce ublks_max only for unprivileged devices
In reply to Sasha LevinFrom: Uday Shankar <[email protected]>
[ Upstream commit 80bdfbb3545b6f16680a72c825063d08a6b44c7a ]
Commit 403ebc877832 ("ublk_drv: add module parameter of ublks_max for limiting max allowed ublk dev"), claimed ublks_max was added to prevent a DoS situation with an untrusted user creating too many ublk devices. If that's the case, ublks_max should only restrict the number of unprivileged ublk devices in the system. Enforce the limit only for unprivileged ublk devices, and rename variables accordingly. Leave the external-facing parameter name unchanged, since changing it may break systems which use it (but still update its documentation to reflect its new meaning).
As a result of this change, in a system where there are only normal (non-unprivileged) devices, the maximum number of such devices is increased to 1 << MINORBITS, or 1048576. That ought to be enough for anyone, right?
--- drivers/block/ublk_drv.c | 42 ++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-)
drivers/block/ublk_drv.c +27 -15
@@ -484,15 +484,17 @@ static wait_queue_head_t ublk_idr_wq; /* wait until one idr is freed */static DEFINE_MUTEX (ublk_ctl_mutex); + +#define UBLK_MAX_UBLKS UBLK_MINORS +/* -* Max ublk devices allowed to add +* Max unprivileged ublk devices allowed to add * * It can be extended to one per-user limit in future or even controlled * by cgroup. */ -#define UBLK_MAX_UBLKS UBLK_MINORS -static unsigned int ublks_max =64 ; -static unsigned int ublks_added;/* protected by ublk_ctl_mutex */ +static unsigned int unprivileged_ublks_max =64 ; +static unsigned int unprivileged_ublks_added;/* protected by ublk_ctl_mutex */ static struct miscdevice ublk_misc;
@@ -2203,7 +2205,8 @@ static int ublk_add_chdev(struct ublk_device *ub)if (ret) goto fail; - ublks_added++; +if (ub->dev_info.flags &UBLK_F_UNPRIVILEGED_DEV ) + unprivileged_ublks_added++;return 0 ; fail:put_device (dev);
@@ -2241,12 +2244,17 @@ static int ublk_add_tag_set(struct ublk_device *ub)static void ublk_remove (struct ublk_device *ub) { +bool unprivileged; +ublk_stop_dev (ub);cancel_work_sync (&ub->stop_work);cancel_work_sync (&ub->quiesce_work);cdev_device_del (&ub->cdev, &ub->cdev_dev); + unprivileged = ub->dev_info.flags &UBLK_F_UNPRIVILEGED_DEV ;ublk_put_device (ub); - ublks_added--; + +if (unprivileged) + unprivileged_ublks_added--; }static struct ublk_device *ublk_get_device_from_id (int idx)
@@ -2495,7 +2503,8 @@ static int ublk_ctrl_add_dev(struct io_uring_cmd *cmd)return ret; ret = -EACCES ; -if (ublks_added >= ublks_max) +if ((info.flags &UBLK_F_UNPRIVILEGED_DEV ) && + unprivileged_ublks_added >= unprivileged_ublks_max) goto out_unlock; ret = -ENOMEM ;
@@ -3123,23 +3132,26 @@ static void __exit ublk_exit(void)module_init (ublk_init);module_exit (ublk_exit); -static int ublk_set_max_ublks (const char *buf,const struct kernel_param *kp) +static int ublk_set_max_unprivileged_ublks (const char *buf, +const struct kernel_param *kp) {return param_set_uint_minmax (buf, kp,0 ,UBLK_MAX_UBLKS ); } -static int ublk_get_max_ublks (char *buf,const struct kernel_param *kp) +static int ublk_get_max_unprivileged_ublks (char *buf, +const struct kernel_param *kp) { -return sysfs_emit (buf,"%u\n" , ublks_max); +return sysfs_emit (buf,"%u\n" , unprivileged_ublks_max); } -static const struct kernel_param_ops ublk_max_ublks_ops = { - .set = ublk_set_max_ublks, - .get = ublk_get_max_ublks, +static const struct kernel_param_ops ublk_max_unprivileged_ublks_ops = { + .set = ublk_set_max_unprivileged_ublks, + .get = ublk_get_max_unprivileged_ublks, }; -module_param_cb (ublks_max, &ublk_max_ublks_ops, &ublks_max,0644 ); -MODULE_PARM_DESC (ublks_max,"max number of ublk devices allowed to add(default: 64)" ); +module_param_cb (ublks_max, &ublk_max_unprivileged_ublks_ops, + &unprivileged_ublks_max,0644 ); +MODULE_PARM_DESC (ublks_max,"max number of unprivileged ublk devices allowed to add(default: 64)" );MODULE_AUTHOR ("Ming Lei <[email protected]>" );MODULE_DESCRIPTION ("Userspace block device" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 210/486 iommufd: Disallow allocating nested parent domain with fault ID
In reply to Sasha LevinFrom: Yi Liu <[email protected]>
[ Upstream commit 1062d81086156e42878d701b816d2f368b53a77c ]
Allocating a domain with a fault ID indicates that the domain is faultable. However, there is a gap for the nested parent domain to support PRI. Some hardware lacks the capability to distinguish whether PRI occurs at stage 1 or stage 2. This limitation may require software-based page table walking to resolve. Since no in-tree IOMMU driver currently supports this functionality, it is disallowed. For more details, refer to the related discussion at [1].
[1] https://lore.kernel.org/linux-iommu/[email protected]/
--- drivers/iommu/iommufd/hw_pagetable.c | 3 +++ tools/testing/selftests/iommu/iommufd.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/iommu/iommufd/hw_pagetable.c +3 -0
@@ -122,6 +122,9 @@ iommufd_hwpt_paging_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,if ((flags &IOMMU_HWPT_ALLOC_DIRTY_TRACKING ) && !device_iommu_capable (idev->dev,IOMMU_CAP_DIRTY_TRACKING ))return ERR_PTR (-EOPNOTSUPP ); +if ((flags &IOMMU_HWPT_FAULT_ID_VALID ) && + (flags &IOMMU_HWPT_ALLOC_NEST_PARENT )) +return ERR_PTR (-EOPNOTSUPP ); hwpt_paging =__iommufd_object_alloc ( ictx, hwpt_paging,IOMMUFD_OBJ_HWPT_PAGING , common.obj);
tools/testing/selftests/iommu/iommufd.c +4 -0
@@ -289,6 +289,10 @@ TEST_F(iommufd_ioas, alloc_hwpt_nested) &test_hwpt_id);test_err_hwpt_alloc (EINVAL , self->device_id, self->device_id,0 , &test_hwpt_id); +test_err_hwpt_alloc (EOPNOTSUPP , self->device_id, self->ioas_id, +IOMMU_HWPT_ALLOC_NEST_PARENT | +IOMMU_HWPT_FAULT_ID_VALID , + &test_hwpt_id); test_cmd_hwpt_alloc(self->device_id, self->ioas_id, IOMMU_HWPT_ALLOC_NEST_PARENT,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 211/486 media: imx335: Set vblank immediately
In reply to Sasha LevinFrom: Paul Elder <[email protected]>
[ Upstream commit c0aa40f45fef80b4182704d1bc089cbf8ae8bed0 ]
When the vblank v4l2 control is set, it does not get written to the hardware unless exposure is also changed. Change the behavior such that the vblank is written immediately when the control is set, as setting the vblank without changing the exposure is a valid use case (such as for changing the frame rate).
--- drivers/media/i2c/imx335.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/media/i2c/imx335.c +15 -6
@@ -559,12 +559,14 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl) imx335->vblank, imx335->vblank + imx335->cur_mode->height); -return __v4l2_ctrl_modify_range (imx335->exp_ctrl, -IMX335_EXPOSURE_MIN , - imx335->vblank + - imx335->cur_mode->height - -IMX335_EXPOSURE_OFFSET , -1 ,IMX335_EXPOSURE_DEFAULT ); + ret =__v4l2_ctrl_modify_range (imx335->exp_ctrl, +IMX335_EXPOSURE_MIN , + imx335->vblank + + imx335->cur_mode->height - +IMX335_EXPOSURE_OFFSET , +1 ,IMX335_EXPOSURE_DEFAULT ); +if (ret) +return ret; }/*
@@ -575,6 +577,13 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl)return 0 ;switch (ctrl->id) { +case V4L2_CID_VBLANK : + exposure = imx335->exp_ctrl->val; + analog_gain = imx335->again_ctrl->val; + + ret =imx335_update_exp_gain (imx335, exposure, analog_gain); + +break ;case V4L2_CID_EXPOSURE : exposure = ctrl->val; analog_gain = imx335->again_ctrl->val;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 212/486 net: pktgen: fix mpls maximum labels list parsing
In reply to Sasha LevinFrom: Peter Seiderer <[email protected]>
[ Upstream commit 2b15a0693f70d1e8119743ee89edbfb1271b3ea8 ]
Fix mpls maximum labels list parsing up to MAX_MPLS_LABELS entries (instead of up to MAX_MPLS_LABELS - 1).
Addresses the following:
$ echo "mpls 00000f00,00000f01,00000f02,00000f03,00000f04,00000f05,00000f06,00000f07,00000f08,00000f09,00000f0a,00000f0b,00000f0c,00000f0d,00000f0e,00000f0f" > /proc/net/pktgen/lo\@0 -bash: echo: write error: Argument list too long
--- net/core/pktgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/pktgen.c +4 -2
@@ -898,6 +898,10 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev) pkt_dev->nr_labels =0 ; do { __u32 tmp; + + if (n >= MAX_MPLS_LABELS) + return -E2BIG; + len = hex32_arg(&buffer[i], 8, &tmp); if (len <= 0) return len;
@@ -909,8 +913,6 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev)return -EFAULT ; i++; n++; -if (n >=MAX_MPLS_LABELS ) -return -E2BIG ; }while (c ==',' ); pkt_dev->nr_labels = n;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 213/486 perf/hw_breakpoint: Return EOPNOTSUPP for unsupported breakpoint type
In reply to Sasha LevinFrom: Saket Kumar Bhaskar <[email protected]>
[ Upstream commit 061c991697062f3bf87b72ed553d1d33a0e370dd ]
Currently, __reserve_bp_slot() returns -ENOSPC for unsupported breakpoint types on the architecture. For example, powerpc does not support hardware instruction breakpoints. This causes the perf_skip BPF selftest to fail, as neither ENOENT nor EOPNOTSUPP is returned by perf_event_open for unsupported breakpoint types. As a result, the test that should be skipped for this arch is not correctly identified.
To resolve this, hw_breakpoint_event_init() should exit early by checking for unsupported breakpoint types using hw_breakpoint_slots_cached() and return the appropriate error (-EOPNOTSUPP).
--- kernel/events/hw_breakpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/events/hw_breakpoint.c +3 -2
@@ -950,9 +950,10 @@ static int hw_breakpoint_event_init(struct perf_event *bp)return -ENOENT ;/* -* no branch sampling for breakpoint events +* Check if breakpoint type is supported before proceeding. +* Also, no branch sampling for breakpoint events. */ -if (has_branch_stack (bp)) +if (!hw_breakpoint_slots_cached (find_slot_idx (bp->attr.bp_type)) ||has_branch_stack (bp))return -EOPNOTSUPP ; err =register_perf_hw_breakpoint (bp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 214/486 ALSA: hda/realtek: Enable PC beep passthrough for HP EliteBook 855 G7
In reply to Sasha LevinFrom: "Maciej S. Szmigiero" <[email protected]>
[ Upstream commit aa85822c611aef7cd4dc17d27121d43e21bb82f0 ]
PC speaker works well on this platform in BIOS and in Linux until sound card drivers are loaded. Then it stops working.
There seems to be a beep generator node at 0x1a in this CODEC (ALC269_TYPE_ALC215) but it seems to be only connected to capture mixers at nodes 0x22 and 0x23.
If I unmute the mixer input for 0x1a at node 0x23 and start recording from its "ALC285 Analog" capture device I can clearly hear beeps in that recording.
So the beep generator is indeed working properly, however I wasn't able to figure out any way to connect it to speakers.
However, the bits in the "Passthrough Control" register (0x36) seems to work at least partially: by zeroing "B" and "h" and setting "S" I can at least make the PIT PC speaker output appear either in this laptop speakers or headphones (depending on whether they are connected or not).
There are some caveats, however:
* If the CODEC gets runtime-suspended the beeps stop so it needs HDA beep device for keeping it awake during beeping.
* If the beep generator node is generating any beep the PC beep passthrough seems to be temporarily inhibited, so the HDA beep device has to be prevented from using the actual beep generator node - but the beep device is still necessary due to the previous point.
* In contrast with other platforms here beep amplification has to be disabled otherwise the beeps output are WAY louder than they were on pure BIOS setup.
Unless someone (from Realtek probably) knows how to make the beep generator node output appear in speakers / headphones using PC beep passthrough seems to be the only way to make PC speaker beeping actually work on this platform.
--- include/sound/hda_codec.h | 1 + sound/pci/hda/hda_beep.c | 15 +++++++++------ sound/pci/hda/patch_realtek.c | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 7 deletions(-)
include/sound/hda_codec.h +1 -0
@@ -195,6 +195,7 @@ struct hda_codec {/* beep device */ struct hda_beep *beep;unsigned int beep_mode; +bool beep_just_power_on;/* widget capabilities cache */ u32 *wcaps;
sound/pci/hda/hda_beep.c +9 -6
@@ -31,8 +31,9 @@ static void generate_tone(struct hda_beep *beep, int tone) beep->power_hook (beep, true); beep->playing =1 ; } -snd_hda_codec_write (codec, beep->nid,0 , -AC_VERB_SET_BEEP_CONTROL , tone); +if (!codec->beep_just_power_on) +snd_hda_codec_write (codec, beep->nid,0 , +AC_VERB_SET_BEEP_CONTROL , tone);if (!tone && beep->playing) { beep->playing =0 ;if (beep->power_hook)
@@ -212,10 +213,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)struct hda_beep *beep;int err; -if (!snd_hda_get_bool_hint (codec,"beep" )) -return 0 ;/* disabled explicitly by hints */ -if (codec->beep_mode ==HDA_BEEP_MODE_OFF ) -return 0 ;/* disabled by module option */ +if (!codec->beep_just_power_on) { +if (!snd_hda_get_bool_hint (codec,"beep" )) +return 0 ;/* disabled explicitly by hints */ +if (codec->beep_mode ==HDA_BEEP_MODE_OFF ) +return 0 ;/* disabled by module option */ + } beep =kzalloc (sizeof (*beep),GFP_KERNEL );if (beep ==NULL )
sound/pci/hda/patch_realtek.c +33 -1
@@ -28,6 +28,7 @@#include <sound/hda_codec.h> #include "hda_local.h" #include "hda_auto_parser.h" +#include "hda_beep.h" #include "hda_jack.h" #include "hda_generic.h" #include "hda_component.h"
@@ -7036,6 +7037,30 @@ static void alc285_fixup_hp_envy_x360(struct hda_codec *codec, } } +static void alc285_fixup_hp_beep (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + codec->beep_just_power_on = true; + }else if (action ==HDA_FIXUP_ACT_INIT ) { +#ifdef CONFIG_SND_HDA_INPUT_BEEP +/* +* Just enable loopback to internal speaker and headphone jack. +* Disable amplification to get about the same beep volume as +* was on pure BIOS setup before loading the driver. +*/ +alc_update_coef_idx (codec,0x36 ,0x7070 ,BIT (13 )); + +snd_hda_enable_beep_device (codec,1 ); + +#if !IS_ENABLED (CONFIG_INPUT_PCSPKR ) +dev_warn_once (hda_codec_dev (codec), +"enable CONFIG_INPUT_PCSPKR to get PC beeps\n" ); +#endif +#endif + } +} +/* for hda_fixup_thinkpad_acpi() */ #include "thinkpad_helper.c"
@@ -7806,6 +7831,7 @@ enum {ALC285_FIXUP_HP_GPIO_LED ,ALC285_FIXUP_HP_MUTE_LED ,ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED , +ALC285_FIXUP_HP_BEEP_MICMUTE_LED ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ,ALC236_FIXUP_HP_GPIO_LED , ALC236_FIXUP_HP_MUTE_LED,
@@ -9395,6 +9421,12 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_mute_led, }, + [ALC285_FIXUP_HP_BEEP_MICMUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_beep, + .chained = true, + .chain_id = ALC285_FIXUP_HP_MUTE_LED, + }, [ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = { .type = HDA_FIXUP_FUNC, .v.func = alc236_fixup_hp_mute_led_coefbit2,
@@ -10493,7 +10525,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8730 ,"HP ProBook 445 G7" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8735 ,"HP ProBook 435 G7" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), -SND_PCI_QUIRK (0x103c ,0x8760 ,"HP" ,ALC285_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x8760 ,"HP EliteBook 8{4,5}5 G7" ,ALC285_FIXUP_HP_BEEP_MICMUTE_LED ),SND_PCI_QUIRK (0x103c ,0x876e ,"HP ENVY x360 Convertible 13-ay0xxx" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x877a ,"HP" ,ALC285_FIXUP_HP_MUTE_LED ), SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 215/486 scsi: logging: Fix scsi_logging_level bounds
In reply to Sasha LevinFrom: Nicolas Bouchinet <[email protected]>
[ Upstream commit 2cef5b4472c602e6c5a119aca869d9d4050586f3 ]
Bound scsi_logging_level sysctl writings between SYSCTL_ZERO and SYSCTL_INT_MAX.
The proc_handler has thus been updated to proc_dointvec_minmax.
--- drivers/scsi/scsi_sysctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_sysctl.c +3 -1
@@ -17,7 +17,9 @@ static struct ctl_table scsi_table[] = { .data = &scsi_logging_level, .maxlen = sizeof(scsi_logging_level), .mode = 0644, - .proc_handler = proc_dointvec }, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX }, };static struct ctl_table_header *scsi_table_header;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 216/486 ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config().
In reply to Sasha LevinFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 254ba7e6032d3fc738050d500b0c1d8197af90ca ]
fib_valid_key_len() is called in the beginning of fib_table_insert() or fib_table_delete() to check if the prefix length is valid.
fib_table_insert() and fib_table_delete() are called from 3 paths
- ip_rt_ioctl()
- inet_rtm_newroute() / inet_rtm_delroute()
- fib_magic()
In the first ioctl() path, rtentry_to_fib_config() checks the prefix length with bad_mask(). Also, fib_magic() always passes the correct
prefix: 32 or ifa->ifa_prefixlen, which is already validated.
Let's move fib_valid_key_len() to the rtnetlink path, rtm_to_fib_config().
While at it, 2 direct returns in rtm_to_fib_config() are changed to goto to match other places in the same function
--- net/ipv4/fib_frontend.c | 18 ++++++++++++++++-- net/ipv4/fib_trie.c | 22 ---------------------- 2 files changed, 16 insertions(+), 24 deletions(-)
net/ipv4/fib_frontend.c +16 -2
@@ -829,19 +829,33 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, } } +if (cfg->fc_dst_len >32 ) { +NL_SET_ERR_MSG (extack,"Invalid prefix length" ); + err = -EINVAL ; + goto errout; + } + +if (cfg->fc_dst_len <32 && (ntohl (cfg->fc_dst) << cfg->fc_dst_len)) { +NL_SET_ERR_MSG (extack,"Invalid prefix for given prefix length" ); + err = -EINVAL ; + goto errout; + } +if (cfg->fc_nh_id) {if (cfg->fc_oif || cfg->fc_gw_family || cfg->fc_encap || cfg->fc_mp) {NL_SET_ERR_MSG (extack,"Nexthop specification and nexthop id are mutually exclusive" ); -return -EINVAL ; + err = -EINVAL ; + goto errout; } }if (has_gw && has_via) {NL_SET_ERR_MSG (extack,"Nexthop configuration can not contain both GATEWAY and VIA" ); -return -EINVAL ; + err = -EINVAL ; + goto errout; }if (!cfg->fc_table)
net/ipv4/fib_trie.c +0 -22
@@ -1193,22 +1193,6 @@ static int fib_insert_alias(struct trie *t, struct key_vector *tp,return 0 ; } -static bool fib_valid_key_len (u32 key,u8 plen,struct netlink_ext_ack *extack) -{ -if (plen >KEYLENGTH ) { -NL_SET_ERR_MSG (extack,"Invalid prefix length" ); -return false; - } - -if ((plen <KEYLENGTH ) && (key << plen)) { -NL_SET_ERR_MSG (extack, -"Invalid prefix for given prefix length" ); -return false; - } - -return true; -} -static void fib_remove_alias (struct trie *t,struct key_vector *tp,struct key_vector *l,struct fib_alias *old);
@@ -1229,9 +1213,6 @@ int fib_table_insert(struct net *net, struct fib_table *tb, key =ntohl (cfg->fc_dst); -if (!fib_valid_key_len (key, plen, extack)) -return -EINVAL ; -pr_debug ("Insert table=%u %08x/%d\n" , tb->tb_id, key, plen); fi =fib_create_info (cfg, extack);
@@ -1723,9 +1704,6 @@ int fib_table_delete(struct net *net, struct fib_table *tb, key =ntohl (cfg->fc_dst); -if (!fib_valid_key_len (key, plen, extack)) -return -EINVAL ; - l =fib_find_node (t, &tp, key);if (!l)return -ESRCH ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 217/486 drm/rockchip: vop2: Add uv swap for cluster window
In reply to Sasha LevinFrom: Andy Yan <[email protected]>
[ Upstream commit e7aae9f6d762139f8d2b86db03793ae0ab3dd802 ]
The Cluster windows of upcoming VOP on rk3576 also support linear YUV support, we need to set uv swap bit for it.
As the VOP2_WIN_UV_SWA register defined on rk3568/rk3588 is 0xffffffff, so this register will not be touched on these two platforms.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +2 -4
@@ -1432,10 +1432,8 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, rb_swap =vop2_win_rb_swap (fb->format->format);vop2_win_write (win,VOP2_WIN_RB_SWAP , rb_swap); -if (!vop2_cluster_window (win)) { - uv_swap =vop2_win_uv_swap (fb->format->format); -vop2_win_write (win,VOP2_WIN_UV_SWAP , uv_swap); - } + uv_swap =vop2_win_uv_swap (fb->format->format); +vop2_win_write (win,VOP2_WIN_UV_SWAP , uv_swap);if (fb->format->is_yuv) {vop2_win_write (win,VOP2_WIN_UV_VIR ,DIV_ROUND_UP (fb->pitches[1 ],4 ));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 218/486 block: mark bounce buffering as incompatible with integrity
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 5fd0268a8806d35dcaf89139bfcda92be51b2b2f ]
None of the few drivers still using the legacy block layer bounce buffering support integrity metadata. Explicitly mark the features as incompatible and stop creating the slab and mempool for integrity buffers for the bounce bio_set.
--- block/blk-settings.c | 5 +++++ block/bounce.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-)
block/blk-settings.c +5 -0
@@ -124,6 +124,11 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)return 0 ; } +if (lim->features &BLK_FEAT_BOUNCE_HIGH ) { +pr_warn ("no bounce buffer support for integrity metadata\n" ); +return -EINVAL ; + } +if (!IS_ENABLED (CONFIG_BLK_DEV_INTEGRITY )) {pr_warn ("integrity support disabled.\n" );return -EINVAL ;
block/bounce.c +0 -2
@@ -41,8 +41,6 @@ static void init_bounce_bioset(void) ret =bioset_init (&bounce_bio_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS );BUG_ON (ret); -if (bioset_integrity_create (&bounce_bio_set,BIO_POOL_SIZE )) -BUG_ON (1 ); ret =bioset_init (&bounce_bio_split,BIO_POOL_SIZE ,0 ,0 );BUG_ON (ret);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 219/486 ublk: complete command synchronously on error
In reply to Sasha LevinFrom: Caleb Sander Mateos <[email protected]>
[ Upstream commit 603f9be21c1894e462416e3324962d6c9c2b95f8 ]
In case of an error, ublk's ->uring_cmd() functions currently return -EIOCBQUEUED and immediately call io_uring_cmd_done(). -EIOCBQUEUED and io_uring_cmd_done() are intended for asynchronous completions. For synchronous completions, the ->uring_cmd() function can just return the negative return code directly. This skips io_uring_cmd_del_cancelable(), and deferring the completion to task work. So return the error code directly from __ublk_ch_uring_cmd() and ublk_ctrl_uring_cmd().
Update ublk_ch_uring_cmd_cb(), which currently ignores the return value from __ublk_ch_uring_cmd(), to call io_uring_cmd_done() for synchronous completions.
--- drivers/block/ublk_drv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/block/ublk_drv.c +6 -5
@@ -1881,10 +1881,9 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,return -EIOCBQUEUED ; out: -io_uring_cmd_done (cmd, ret,0 , issue_flags);pr_devel ("%s: complete: cmd op %d, tag %d ret %x io_flags %x\n" , __func__, cmd_op, tag, ret, io->flags); -return -EIOCBQUEUED ; +return ret; } static inline struct request *__ublk_check_and_get_req(struct ublk_device *ub,
@@ -1940,7 +1939,10 @@ static inline int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,static void ublk_ch_uring_cmd_cb (struct io_uring_cmd *cmd,unsigned int issue_flags) { -ublk_ch_uring_cmd_local (cmd, issue_flags); +int ret =ublk_ch_uring_cmd_local (cmd, issue_flags); + +if (ret != -EIOCBQUEUED ) +io_uring_cmd_done (cmd, ret,0 , issue_flags); }static int ublk_ch_uring_cmd (struct io_uring_cmd *cmd,unsigned int issue_flags)
@@ -3065,10 +3067,9 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,if (ub)ublk_put_device (ub); out: -io_uring_cmd_done (cmd, ret,0 , issue_flags);pr_devel ("%s: cmd done ret %d cmd_op %x, dev id %d qid %d\n" , __func__, ret, cmd->cmd_op, header->dev_id, header->queue_id); -return -EIOCBQUEUED ; +return ret; }static const struct file_operations ublk_ctl_fops = {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 220/486 media: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 990262fdfce24d6055df9711424343d94d829e6a ]
Do not process unknown data types.
--- drivers/media/usb/uvc/uvc_v4l2.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/usb/uvc/uvc_v4l2.c +6 -0
@@ -106,6 +106,12 @@ static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chain *chain,struct uvc_control_mapping *map;int ret; +if (xmap->data_type >UVC_CTRL_DATA_TYPE_BITMASK ) { +uvc_dbg (chain->dev,CONTROL , +"Unsupported UVC data type %u\n" , xmap->data_type); +return -EINVAL ; + } + map =kzalloc (sizeof (*map),GFP_KERNEL );if (map ==NULL )return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 221/486 media: uvcvideo: Handle uvc menu translation inside uvc_get_le_value
In reply to Sasha LevinFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 9109a0b4cb10fd681e9c6e9a4497a6fec5b91c39 ]
map->get() gets a value from an uvc_control in "UVC format" and converts it to a value that can be consumed by v4l2.
Instead of using a special get function for V4L2_CTRL_TYPE_MENU, we were converting from uvc_get_le_value in two different places.
Move the conversion to uvc_get_le_value().
--- drivers/media/usb/uvc/uvc_ctrl.c | 77 +++++++++++++------------------- 1 file changed, 32 insertions(+), 45 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +32 -45
@@ -862,6 +862,25 @@ static inline void uvc_clear_bit(u8 *data, int bit) data[bit >>3 ] &= ~(1 << (bit &7 )); } +static s32 uvc_menu_to_v4l2_menu (struct uvc_control_mapping *mapping,s32 val) +{ +unsigned int i; + +for (i =0 ;BIT (i) <= mapping->menu_mask; ++i) { +u32 menu_value; + +if (!test_bit (i, &mapping->menu_mask)) +continue ; + + menu_value =uvc_mapping_get_menu_value (mapping, i); + +if (menu_value == val) +return i; + } + +return val; +} +/* * Extract the bit string specified by mapping->offset and mapping->size * from the little-endian data stored at 'data' and return the result as
@@ -896,6 +915,16 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping,if (mapping->data_type ==UVC_CTRL_DATA_TYPE_SIGNED ) value |= -(value & (1 << (mapping->size -1 ))); +/* If it is a menu, convert from uvc to v4l2. */ +if (mapping->v4l2_type !=V4L2_CTRL_TYPE_MENU ) +return value; + +switch (query) { +case UVC_GET_CUR : +case UVC_GET_DEF : +return uvc_menu_to_v4l2_menu (mapping, value); + } +return value; }
@@ -1060,32 +1089,6 @@ static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain,return 0 ; } -static s32 __uvc_ctrl_get_value (struct uvc_control_mapping *mapping, -const u8 *data) -{ -s32 value = mapping->get (mapping,UVC_GET_CUR , data); - -if (mapping->v4l2_type ==V4L2_CTRL_TYPE_MENU ) { -unsigned int i; - -for (i =0 ;BIT (i) <= mapping->menu_mask; ++i) { -u32 menu_value; - -if (!test_bit (i, &mapping->menu_mask)) -continue ; - - menu_value =uvc_mapping_get_menu_value (mapping, i); - -if (menu_value == value) { - value = i; -break ; - } - } - } - -return value; -} -static int __uvc_ctrl_load_cur (struct uvc_video_chain *chain,struct uvc_control *ctrl) {
@@ -1136,8 +1139,8 @@ static int __uvc_ctrl_get(struct uvc_video_chain *chain,if (ret <0 )return ret; - *value =__uvc_ctrl_get_value (mapping, -uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT )); + *value = mapping->get (mapping,UVC_GET_CUR , +uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ));return 0 ; }
@@ -1287,7 +1290,6 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, {struct uvc_control_mapping *master_map =NULL ;struct uvc_control *master_ctrl =NULL ; -unsigned int i;memset (v4l2_ctrl,0 ,sizeof (*v4l2_ctrl)); v4l2_ctrl->id = mapping->id;
@@ -1330,21 +1332,6 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, v4l2_ctrl->minimum =ffs (mapping->menu_mask) -1 ; v4l2_ctrl->maximum =fls (mapping->menu_mask) -1 ; v4l2_ctrl->step =1 ; - -for (i =0 ;BIT (i) <= mapping->menu_mask; ++i) { -u32 menu_value; - -if (!test_bit (i, &mapping->menu_mask)) -continue ; - - menu_value =uvc_mapping_get_menu_value (mapping, i); - -if (menu_value == v4l2_ctrl->default_value) { - v4l2_ctrl->default_value = i; -break ; - } - } -return 0 ;case V4L2_CTRL_TYPE_BOOLEAN :
@@ -1627,7 +1614,7 @@ void uvc_ctrl_status_event(struct uvc_video_chain *chain,uvc_ctrl_set_handle (handle, ctrl,NULL );list_for_each_entry (mapping, &ctrl->info.mappings, list) { -s32 value =__uvc_ctrl_get_value (mapping, data); +s32 value = mapping->get (mapping,UVC_GET_CUR , data);/* * handle may be NULL here if the device sends auto-update
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 222/486 clk: imx8mp: inform CCF of maximum frequency of clocks
In reply to Sasha LevinFrom: Ahmad Fatoum <[email protected]>
[ Upstream commit 06a61b5cb6a8638fa8823cd09b17233b29696fa2 ]
The IMX8MPCEC datasheet lists maximum frequencies allowed for different modules. Some of these limits are universal, but some depend on whether the SoC is operating in nominal or in overdrive mode.
The imx8mp.dtsi currently assumes overdrive mode and configures some clocks in accordance with this. Boards wishing to make use of nominal mode will need to override some of the clock rates manually.
As operating the clocks outside of their allowed range can lead to difficult to debug issues, it makes sense to register the maximum rates allowed in the driver, so the CCF can take them into account.
--- drivers/clk/imx/clk-imx8mp.c | 151 +++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+)
drivers/clk/imx/clk-imx8mp.c +151 -0
@@ -8,6 +8,7 @@#include <linux/err.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/units.h> #include <linux/of_address.h> #include <linux/platform_device.h> #include <linux/slab.h>
@@ -406,11 +407,151 @@ static const char * const imx8mp_clkout_sels[] = {"audio_pll1_out", "audio_pll2_static struct clk_hw **hws;static struct clk_hw_onecell_data *clk_hw_data; +struct imx8mp_clock_constraints { +unsigned int clkid; +u32 maxrate; +}; + +/* +* Below tables are taken from IMX8MPCEC Rev. 2.1, 07/2023 +* Table 13. Maximum frequency of modules. +* Probable typos fixed are marked with a comment. +*/ +static const struct imx8mp_clock_constraints imx8mp_clock_common_constraints[] = { + {IMX8MP_CLK_A53_DIV ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_ENET_AXI ,266666667 },/* Datasheet claims 266MHz */ + {IMX8MP_CLK_NAND_USDHC_BUS ,266666667 },/* Datasheet claims 266MHz */ + {IMX8MP_CLK_MEDIA_APB ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_HDMI_APB ,133333333 },/* Datasheet claims 133MHz */ + {IMX8MP_CLK_ML_AXI ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_AHB ,133333333 }, + {IMX8MP_CLK_IPG_ROOT ,66666667 }, + {IMX8MP_CLK_AUDIO_AHB ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_DISP2_PIX ,170 *HZ_PER_MHZ }, + {IMX8MP_CLK_DRAM_ALT ,666666667 }, + {IMX8MP_CLK_DRAM_APB ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_CAN1 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_CAN2 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_PCIE_AUX ,10 *HZ_PER_MHZ }, + {IMX8MP_CLK_I2C5 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_I2C6 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_SAI1 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_SAI2 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_SAI3 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_SAI5 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_SAI6 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_ENET_QOS ,125 *HZ_PER_MHZ }, + {IMX8MP_CLK_ENET_QOS_TIMER ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_ENET_REF ,125 *HZ_PER_MHZ }, + {IMX8MP_CLK_ENET_TIMER ,125 *HZ_PER_MHZ }, + {IMX8MP_CLK_ENET_PHY_REF ,125 *HZ_PER_MHZ }, + {IMX8MP_CLK_NAND ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_QSPI ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_USDHC1 ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_USDHC2 ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_I2C1 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_I2C2 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_I2C3 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_I2C4 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_UART1 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_UART2 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_UART3 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_UART4 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_ECSPI1 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_ECSPI2 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_PWM1 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_PWM2 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_PWM3 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_PWM4 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_GPT1 ,100 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPT2 ,100 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPT3 ,100 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPT4 ,100 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPT5 ,100 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPT6 ,100 *HZ_PER_MHZ }, + {IMX8MP_CLK_WDOG ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_IPP_DO_CLKO1 ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_IPP_DO_CLKO2 ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_HDMI_REF_266M ,266 *HZ_PER_MHZ }, + {IMX8MP_CLK_USDHC3 ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_MIPI_PHY1_REF ,300 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_DISP1_PIX ,250 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_CAM2_PIX ,277 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_LDB ,595 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_MIPI_TEST_BYTE ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_ECSPI3 ,80 *HZ_PER_MHZ }, + {IMX8MP_CLK_PDM ,200 *HZ_PER_MHZ }, + {IMX8MP_CLK_SAI7 ,66666667 },/* Datasheet claims 66MHz */ + {IMX8MP_CLK_MAIN_AXI ,400 *HZ_PER_MHZ }, + {/* Sentinel */ } +}; + +static const struct imx8mp_clock_constraints imx8mp_clock_nominal_constraints[] = { + {IMX8MP_CLK_M7_CORE ,600 *HZ_PER_MHZ }, + {IMX8MP_CLK_ML_CORE ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU3D_CORE ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU3D_SHADER_CORE ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU2D_CORE ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_AUDIO_AXI_SRC ,600 *HZ_PER_MHZ }, + {IMX8MP_CLK_HSIO_AXI ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_ISP ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_BUS ,600 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_AXI ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_HDMI_AXI ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU_AXI ,600 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU_AHB ,300 *HZ_PER_MHZ }, + {IMX8MP_CLK_NOC ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_NOC_IO ,600 *HZ_PER_MHZ }, + {IMX8MP_CLK_ML_AHB ,300 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_G1 ,600 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_G2 ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_CAM1_PIX ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_VC8000E ,400 *HZ_PER_MHZ },/* Datasheet claims 500MHz */ + {IMX8MP_CLK_DRAM_CORE ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_GIC ,400 *HZ_PER_MHZ }, + {/* Sentinel */ } +}; + +static const struct imx8mp_clock_constraints imx8mp_clock_overdrive_constraints[] = { + {IMX8MP_CLK_M7_CORE ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_ML_CORE ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU3D_CORE ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU3D_SHADER_CORE ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU2D_CORE ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_AUDIO_AXI_SRC ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_HSIO_AXI ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_ISP ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_BUS ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_AXI ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_HDMI_AXI ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU_AXI ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_GPU_AHB ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_NOC ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_NOC_IO ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_ML_AHB ,400 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_G1 ,800 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_G2 ,700 *HZ_PER_MHZ }, + {IMX8MP_CLK_MEDIA_CAM1_PIX ,500 *HZ_PER_MHZ }, + {IMX8MP_CLK_VPU_VC8000E ,500 *HZ_PER_MHZ },/* Datasheet claims 400MHz */ + {IMX8MP_CLK_DRAM_CORE ,1000 *HZ_PER_MHZ }, + {IMX8MP_CLK_GIC ,500 *HZ_PER_MHZ }, + {/* Sentinel */ } +}; + +static void imx8mp_clocks_apply_constraints (const struct imx8mp_clock_constraints constraints[]) +{ +const struct imx8mp_clock_constraints *constr; + +for (constr = constraints; constr->clkid; constr++) +clk_hw_set_rate_range (hws[constr->clkid],0 , constr->maxrate); +} +static int imx8mp_clocks_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct device_node *np;void __iomem *anatop_base, *ccm_base; +const char *opmode;int err; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx8mp-anatop" );
@@ -715,6 +856,16 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)imx_check_clk_hws (hws,IMX8MP_CLK_END ); +imx8mp_clocks_apply_constraints (imx8mp_clock_common_constraints); + + err =of_property_read_string (np,"fsl,operating-mode" , &opmode); +if (!err) { +if (!strcmp (opmode,"nominal" )) +imx8mp_clocks_apply_constraints (imx8mp_clock_nominal_constraints); +else if (!strcmp (opmode,"overdrive" )) +imx8mp_clocks_apply_constraints (imx8mp_clock_overdrive_constraints); + } + err =of_clk_add_hw_provider (np, of_clk_hw_onecell_get, clk_hw_data);if (err <0 ) {dev_err (dev,"failed to register hws for i.MX8MP\n" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 223/486 x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2
In reply to Sasha LevinFrom: Breno Leitao <[email protected]>
[ Upstream commit 98fdaeb296f51ef08e727a7cc72e5b5c864c4f4d ]
Change the default value of spectre v2 in user mode to respect the CONFIG_MITIGATION_SPECTRE_V2 config option.
Currently, user mode spectre v2 is set to auto
(SPECTRE_V2_USER_CMD_AUTO) by default, even ifCONFIG_MITIGATION_SPECTRE_V2 is disabled.
Set the spectre_v2 value to auto (SPECTRE_V2_USER_CMD_AUTO) if the Spectre v2 config (CONFIG_MITIGATION_SPECTRE_V2) is enabled, otherwise set the value to none (SPECTRE_V2_USER_CMD_NONE).
Important to say the command line argument "spectre_v2_user" overwrites the default value in both cases.
When CONFIG_MITIGATION_SPECTRE_V2 is not set, users have the flexibility to opt-in for specific mitigations independently. In this scenario, setting spectre_v2= will not enable spectre_v2_user=, and command line options spectre_v2_user and spectre_v2 are independent when CONFIG_MITIGATION_SPECTRE_V2=n.
--- Documentation/admin-guide/kernel-parameters.txt | 2 ++ arch/x86/kernel/cpu/bugs.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +2 -0
@@ -6243,6 +6243,8 @@ Selecting 'on' will also enable the mitigation against user space to user space task attacks. + Selecting specific mitigation does not force enable + user mitigations. Selecting 'off' will disable both the kernel and the user space protections.
arch/x86/kernel/cpu/bugs.c +7 -3
@@ -1293,9 +1293,13 @@ static __ro_after_init enum spectre_v2_mitigation_cmd spectre_v2_cmd;static enum spectre_v2_user_cmd __init spectre_v2_parse_user_cmdline (void ) { +enum spectre_v2_user_cmd mode;char arg[20 ];int ret, i; + mode =IS_ENABLED (CONFIG_MITIGATION_SPECTRE_V2 ) ? +SPECTRE_V2_USER_CMD_AUTO :SPECTRE_V2_USER_CMD_NONE ; +switch (spectre_v2_cmd) {case SPECTRE_V2_CMD_NONE :return SPECTRE_V2_USER_CMD_NONE ;
@@ -1308,7 +1312,7 @@ spectre_v2_parse_user_cmdline(void) ret =cmdline_find_option (boot_command_line,"spectre_v2_user" , arg,sizeof (arg));if (ret <0 ) -return SPECTRE_V2_USER_CMD_AUTO ; +return mode;for (i =0 ; i <ARRAY_SIZE (v2_user_options); i++) {if (match_option (arg, ret, v2_user_options[i].option)) {
@@ -1318,8 +1322,8 @@ spectre_v2_parse_user_cmdline(void) } } -pr_err ("Unknown user space protection option (%s). Switching to AUTO select\n" , arg); -return SPECTRE_V2_USER_CMD_AUTO ; +pr_err ("Unknown user space protection option (%s). Switching to default\n" , arg); +return mode; }static inline bool spectre_v2_in_ibrs_mode (enum spectre_v2_mitigation mode)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 224/486 hwmon: (gpio-fan) Add missing mutex locks
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 9fee7d19bab635f89223cc40dfd2c8797fdc4988 ]
set_fan_speed() is expected to be called with fan_data->lock being locked. Add locking for proper synchronization.
--- drivers/hwmon/gpio-fan.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/hwmon/gpio-fan.c +15 -1
@@ -393,7 +393,12 @@ static int gpio_fan_set_cur_state(struct thermal_cooling_device *cdev,if (state >= fan_data->num_speed)return -EINVAL ; +mutex_lock (&fan_data->lock); +set_fan_speed (fan_data, state); + +mutex_unlock (&fan_data->lock); +return 0 ; }
@@ -489,7 +494,11 @@ MODULE_DEVICE_TABLE(of, of_gpio_fan_match);static void gpio_fan_stop (void *data) { +struct gpio_fan_data *fan_data = data; + +mutex_lock (&fan_data->lock);set_fan_speed (data,0 ); +mutex_unlock (&fan_data->lock); }static int gpio_fan_probe (struct platform_device *pdev)
@@ -562,7 +571,9 @@ static int gpio_fan_suspend(struct device *dev)if (fan_data->gpios) { fan_data->resume_speed = fan_data->speed_index; +mutex_lock (&fan_data->lock);set_fan_speed (fan_data,0 ); +mutex_unlock (&fan_data->lock); }return 0 ;
@@ -572,8 +583,11 @@ static int gpio_fan_resume(struct device *dev) {struct gpio_fan_data *fan_data =dev_get_drvdata (dev); -if (fan_data->gpios) +if (fan_data->gpios) { +mutex_lock (&fan_data->lock);set_fan_speed (fan_data, fan_data->resume_speed); +mutex_unlock (&fan_data->lock); + }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 225/486 ARM: at91: pm: fix at91_suspend_finish for ZQ calibration
In reply to Sasha LevinFrom: Li Bin <[email protected]>
[ Upstream commit bc4722c3598d0e2c2dbf9609a3d3198993093e2b ]
For sama7g5 and sama7d65 backup mode, we encountered a "ZQ calibrate error" during recalibrating the impedance in BootStrap.
We found that the impedance value saved in at91_suspend_finish() before the DDR entered self-refresh mode did not match the resistor values. The ZDATA field in the DDR3PHY_ZQ0CR0 register uses a modified gray code to select the different impedance setting.
But these gray code are incorrect, a workaournd from design team fixed the bug in the calibration logic. The ZDATA contains four independent impedance elements, but the algorithm combined the four elements into one. The elements were fixed using properly shifted offsets.
--- arch/arm/mach-at91/pm.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
arch/arm/mach-at91/pm.c +11 -10
@@ -545,11 +545,12 @@ extern u32 at91_pm_suspend_in_sram_sz;static int at91_suspend_finish (unsigned long val) { -unsigned char modified_gray_code[] = { -0x00 ,0x01 ,0x02 ,0x03 ,0x06 ,0x07 ,0x04 ,0x05 ,0x0c ,0x0d , -0x0e ,0x0f ,0x0a ,0x0b ,0x08 ,0x09 ,0x18 ,0x19 ,0x1a ,0x1b , -0x1e ,0x1f ,0x1c ,0x1d ,0x14 ,0x15 ,0x16 ,0x17 ,0x12 ,0x13 , -0x10 ,0x11 , +/* SYNOPSYS workaround to fix a bug in the calibration logic */ +unsigned char modified_fix_code[] = { +0x00 ,0x01 ,0x01 ,0x06 ,0x07 ,0x0c ,0x06 ,0x07 ,0x0b ,0x18 , +0x0a ,0x0b ,0x0c ,0x0d ,0x0d ,0x0a ,0x13 ,0x13 ,0x12 ,0x13 , +0x14 ,0x15 ,0x15 ,0x12 ,0x18 ,0x19 ,0x19 ,0x1e ,0x1f ,0x14 , +0x1e ,0x1f , };unsigned int tmp, index;int i;
@@ -560,25 +561,25 @@ static int at91_suspend_finish(unsigned long val)* restore the ZQ0SR0 with the value saved here. But the * calibration is buggy and restoring some values from ZQ0SR0 * is forbidden and risky thus we need to provide processed -* values for these (modified gray code values). +* values for these. */ tmp =readl (soc_pm.data.ramc_phy +DDR3PHY_ZQ0SR0 );/* Store pull-down output impedance select. */ index = (tmp >>DDR3PHY_ZQ0SR0_PDO_OFF ) &0x1f ; - soc_pm.bu->ddr_phy_calibration[0 ] = modified_gray_code[index]; + soc_pm.bu->ddr_phy_calibration[0 ] = modified_fix_code[index] <<DDR3PHY_ZQ0SR0_PDO_OFF ;/* Store pull-up output impedance select. */ index = (tmp >>DDR3PHY_ZQ0SR0_PUO_OFF ) &0x1f ; - soc_pm.bu->ddr_phy_calibration[0 ] |= modified_gray_code[index]; + soc_pm.bu->ddr_phy_calibration[0 ] |= modified_fix_code[index] <<DDR3PHY_ZQ0SR0_PUO_OFF ;/* Store pull-down on-die termination impedance select. */ index = (tmp >>DDR3PHY_ZQ0SR0_PDODT_OFF ) &0x1f ; - soc_pm.bu->ddr_phy_calibration[0 ] |= modified_gray_code[index]; + soc_pm.bu->ddr_phy_calibration[0 ] |= modified_fix_code[index] <<DDR3PHY_ZQ0SR0_PDODT_OFF ;/* Store pull-up on-die termination impedance select. */ index = (tmp >>DDR3PHY_ZQ0SRO_PUODT_OFF ) &0x1f ; - soc_pm.bu->ddr_phy_calibration[0 ] |= modified_gray_code[index]; + soc_pm.bu->ddr_phy_calibration[0 ] |= modified_fix_code[index] <<DDR3PHY_ZQ0SRO_PUODT_OFF ;/* * The 1st 8 words of memory might get corrupted in the process
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 226/486 drm/mediatek: mtk_dpi: Add checks for reg_h_fre_con existence
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 8c9da7cd0bbcc90ab444454fecf535320456a312 ]
In preparation for adding support for newer DPI instances which do support direct-pin but do not have any H_FRE_CON register, like the one found in MT8195 and MT8188, add a branch to check if the reg_h_fre_con variable was declared in the mtk_dpi_conf structure for the probed SoC DPI version.
As a note, this is useful specifically only for cases in which the support_direct_pin variable is true, so mt8195-dpintf is not affected by any issue.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +3 -2
@@ -410,12 +410,13 @@ static void mtk_dpi_config_swap_input(struct mtk_dpi *dpi, bool enable)static void mtk_dpi_config_2n_h_fre (struct mtk_dpi *dpi) { -mtk_dpi_mask (dpi, dpi->conf->reg_h_fre_con,H_FRE_2N ,H_FRE_2N ); +if (dpi->conf->reg_h_fre_con) +mtk_dpi_mask (dpi, dpi->conf->reg_h_fre_con,H_FRE_2N ,H_FRE_2N ); }static void mtk_dpi_config_disable_edge (struct mtk_dpi *dpi) { -if (dpi->conf->edge_sel_en) +if (dpi->conf->edge_sel_en && dpi->conf->reg_h_fre_con)mtk_dpi_mask (dpi, dpi->conf->reg_h_fre_con,0 ,EDGE_SEL_EN ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 227/486 fpga: altera-cvp: Increase credit timeout
In reply to Sasha LevinFrom: Kuhanh Murugasen Krishnan <[email protected]>
[ Upstream commit 0f05886a40fdc55016ba4d9ae0a9c41f8312f15b ]
Increase the timeout for SDM (Secure device manager) data credits from 20ms to 40ms. Internal stress tests running at 500 loops failed with the current timeout of 20ms. At the start of a FPGA configuration, the CVP host driver reads the transmit credits from SDM. It then sends bitstream FPGA data to SDM based on the total credits. Each credit allows the CVP host driver to send 4kBytes of data. There are situations whereby, the SDM did not respond in time during testing.
--- drivers/fpga/altera-cvp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-cvp.c +1 -1
@@ -52,7 +52,7 @@/* V2 Defines */ #define VSE_CVP_TX_CREDITS 0x49/* 8bit */ -#define V2_CREDIT_TIMEOUT_US 20000 +#define V2_CREDIT_TIMEOUT_US 40000#define V2_CHECK_CREDIT_US 10#define V2_POLL_TIMEOUT_US 1000000#define V2_USER_TIMEOUT_US 500000
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 228/486 perf: arm_pmuv3: Call kvm_vcpu_pmu_resync_el0() before enabling counters
In reply to Sasha LevinFrom: "Rob Herring (Arm)" <[email protected]>
[ Upstream commit 04bd15c4cbc3f7bd2399d1baab958c5e738dbfc9 ]
Counting events related to setup of the PMU is not desired, but kvm_vcpu_pmu_resync_el0() is called just after the PMU counters have been enabled. Move the call to before enabling the counters.
--- drivers/perf/arm_pmuv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/perf/arm_pmuv3.c +2 -2
@@ -816,10 +816,10 @@ static void armv8pmu_start(struct arm_pmu *cpu_pmu)else armv8pmu_disable_user_access (); +kvm_vcpu_pmu_resync_el0 (); +/* Enable all counters */ armv8pmu_pmcr_write (armv8pmu_pmcr_read () |ARMV8_PMU_PMCR_E ); - -kvm_vcpu_pmu_resync_el0 (); }static void armv8pmu_stop (struct arm_pmu *cpu_pmu)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 229/486 soc: apple: rtkit: Use high prio work queue
In reply to Sasha LevinFrom: Janne Grunau <[email protected]>
[ Upstream commit 22af2fac88fa5dbc310bfe7d0b66d4de3ac47305 ]
rtkit messages as communication with the DCP firmware for framebuffer swaps or input events are time critical so use WQ_HIGHPRI to prevent user space CPU load to increase latency.
With kwin_wayland 6's explicit sync mode user space load was able to delay the IOMFB rtkit communication enough to miss vsync for surface swaps. Minimal test scenario is constantly resizing a glxgears Xwayland window.
--- drivers/soc/apple/rtkit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/apple/rtkit.c +1 -1
@@ -667,7 +667,7 @@ struct apple_rtkit *apple_rtkit_init(struct device *dev, void *cookie, rtk->mbox->rx = apple_rtkit_rx; rtk->mbox->cookie = rtk; - rtk->wq =alloc_ordered_workqueue ("rtkit-%s" ,WQ_MEM_RECLAIM , + rtk->wq =alloc_ordered_workqueue ("rtkit-%s" ,WQ_HIGHPRI |WQ_MEM_RECLAIM ,dev_name (rtk->dev));if (!rtk->wq) { ret = -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 230/486 soc: apple: rtkit: Implement OSLog buffers properly
In reply to Sasha LevinFrom: Hector Martin <[email protected]>
[ Upstream commit a06398687065e0c334dc5fc4d2778b5b87292e43 ]
Apparently nobody can figure out where the old logic came from, but it seems like it has never been actually used on any supported firmware to this day. OSLog buffers were apparently never requested.
But starting with 13.3, we actually need this implemented properly for MTP (and later AOP) to work, so let's actually do that.
--- drivers/soc/apple/rtkit-internal.h | 1 + drivers/soc/apple/rtkit.c | 56 ++++++++++++++++++------------ 2 files changed, 35 insertions(+), 22 deletions(-)
drivers/soc/apple/rtkit-internal.h +1 -0
@@ -44,6 +44,7 @@ struct apple_rtkit {struct apple_rtkit_shmem ioreport_buffer;struct apple_rtkit_shmem crashlog_buffer; +struct apple_rtkit_shmem oslog_buffer;struct apple_rtkit_shmem syslog_buffer;char *syslog_msg_buffer;
drivers/soc/apple/rtkit.c +34 -22
105 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 231/486 wifi: ath12k: Report proper tx completion status to mac80211
In reply to Sasha LevinFrom: Vinith Kumar R <[email protected]>
[ Upstream commit d2d9c9b8de725e1006d3aa3d18678a732f5d3584 ]
Currently Tx completion for few exception packets are received from firmware and the tx status updated to mac80211. The tx status values of HAL_WBM_REL_HTT_TX_COMP_STATUS_DROP and HAL_WBM_REL_HTT_TX_COMP_STATUS_TTL are considered as tx failure and reported as tx failure to mac80211. But these failure status is due to internal firmware tx drop and these packets were not tried to transmit in the air.
In case of mesh this invalid tx status report might trigger mpath broken issue due to increase in mpath fail average.
So do not report these tx status as tx failure instead free the skb by calling ieee80211_free_txskb(), and that will be accounted as dropped frame.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/dp_tx.c +2 -2
@@ -557,13 +557,13 @@ ath12k_dp_tx_process_htt_tx_complete(struct ath12k_base *ab,switch (wbm_status) {case HAL_WBM_REL_HTT_TX_COMP_STATUS_OK : -case HAL_WBM_REL_HTT_TX_COMP_STATUS_DROP : -case HAL_WBM_REL_HTT_TX_COMP_STATUS_TTL : ts.acked = (wbm_status ==HAL_WBM_REL_HTT_TX_COMP_STATUS_OK ); ts.ack_rssi =le32_get_bits (status_desc->info2,HTT_TX_WBM_COMP_INFO2_ACK_RSSI );ath12k_dp_tx_htt_tx_complete_buf (ab, msdu, tx_ring, &ts);break ; +case HAL_WBM_REL_HTT_TX_COMP_STATUS_DROP : +case HAL_WBM_REL_HTT_TX_COMP_STATUS_TTL :case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ :case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT :ath12k_dp_tx_free_txbuf (ab, msdu, mac_id, tx_ring);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 232/486 PCI: brcmstb: Expand inbound window size up to 64GB
In reply to Sasha LevinFrom: Stanimir Varbanov <[email protected]>
[ Upstream commit 25a98c727015638baffcfa236e3f37b70cedcf87 ]
The BCM2712 memory map can support up to 64GB of system memory, thus expand the inbound window size in calculation helper function.
The change is safe for the currently supported SoCs that have smaller inbound window sizes.
--- drivers/pci/controller/pcie-brcmstb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-brcmstb.c +2 -2
@@ -309,8 +309,8 @@ static int brcm_pcie_encode_ibar_size(u64 size)if (log2_in >=12 && log2_in <=15 )/* Covers 4KB to 32KB (inclusive) */ return (log2_in -12 ) +0x1c ; -else if (log2_in >=16 && log2_in <=35 ) -/* Covers 64KB to 32GB, (inclusive) */ +else if (log2_in >=16 && log2_in <=36 ) +/* Covers 64KB to 64GB, (inclusive) */ return log2_in -15 ;/* Something is awry so disable */ return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 233/486 PCI: brcmstb: Add a softdep to MIP MSI-X driver
In reply to Sasha LevinFrom: Stanimir Varbanov <[email protected]>
[ Upstream commit 2294059118c550464dd8906286324d90c33b152b ]
Then the brcmstb PCIe driver and MIP MSI-X interrupt controller drivers are built as modules there could be a race in probing.
To avoid this, add a softdep to MIP driver to guarantee that MIP driver will be load first.
--- drivers/pci/controller/pcie-brcmstb.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/pcie-brcmstb.c +1 -0
@@ -1947,3 +1947,4 @@ module_platform_driver(brcm_pcie_driver);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Broadcom STB PCIe RC driver" );MODULE_AUTHOR ("Broadcom" ); +MODULE_SOFTDEP ("pre: irq_bcm2712_mip" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 234/486 nvme: map uring_cmd data even if address is 0
In reply to Sasha LevinFrom: Xinyu Zhang <[email protected]>
[ Upstream commit 99fde895ff56ac2241e7b7b4566731d72f2fdaa7 ]
When using kernel registered bvec fixed buffers, the "address" is actually the offset into the bvec rather than userspace address. Therefore it can be 0.
We can skip checking whether the address is NULL before mapping uring_cmd data. Bad userspace address will be handled properly later when the user buffer is imported.
With this patch, we will be able to use the kernel registered bvec fixed buffers in io_uring NVMe passthru with ublk zero-copy support.
--- drivers/nvme/host/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +1 -1
@@ -515,7 +515,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,return PTR_ERR (req); req->timeout = d.timeout_ms ?msecs_to_jiffies (d.timeout_ms) :0 ; -if (d.addr && d.data_len) { +if (d.data_len) { ret =nvme_map_user_request (req, d.addr, d.data_len,nvme_to_user_ptr (d.metadata), d.metadata_len,0 , ioucmd, vec);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 235/486 firmware: arm_ffa: Set dma_mask for ffa devices
In reply to Sasha LevinFrom: Viresh Kumar <[email protected]>
[ Upstream commit cc0aac7ca17e0ea3ca84b552fc79f3e86fd07f53 ]
Set dma_mask for FFA devices, otherwise DMA allocation using the device pointer lead to following warning:
WARNING: CPU: 1 PID: 1 at kernel/dma/mapping.c:597 dma_alloc_attrs+0xe0/0x124
Message-Id: <e3dd8042ac680bd74b6580c25df855d092079c18.1737107520.git.viresh.kumar@linaro.org>
--- drivers/firmware/arm_ffa/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/arm_ffa/bus.c +1 -0
@@ -212,6 +212,7 @@ ffa_device_register(const struct ffa_partition_info *part_info, dev = &ffa_dev->dev; dev->bus = &ffa_bus_type; dev->release = ffa_release_device; + dev->dma_mask = &dev->coherent_dma_mask;dev_set_name (&ffa_dev->dev,"arm-ffa-%d" , id); ffa_dev->id = id;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 236/486 drm/xe/vf: Retry sending MMIO request to GUC on timeout error
In reply to Sasha LevinFrom: Satyanarayana K V P <[email protected]>
[ Upstream commit ba757a65d2a28d46a8ccf50538f4f05036983f1b ]
Add support to allow retrying the sending of MMIO requests from the VF to the GUC in the event of an error. During the suspend/resume process, VFs begin resuming only after the PF has resumed. Although the PF resumes, the GUC reset and provisioning occur later in a separate worker process.
When there are a large number of VFs, some may attempt to resume before the PF has completed its provisioning. Therefore, if a MMIO request from a VF fails during this period, we will retry sending the request up to GUC_RESET_VF_STATE_RETRY_MAX times, which is set to a maximum of 10 attempts.
--- drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_sriov_vf.c +8 -1
@@ -46,12 +46,19 @@ static int guc_action_vf_reset(struct xe_guc *guc)return ret >0 ? -EPROTO : ret; } +#define GUC_RESET_VF_STATE_RETRY_MAX 10static int vf_reset_guc_state (struct xe_gt *gt) { +unsigned int retry =GUC_RESET_VF_STATE_RETRY_MAX ;struct xe_guc *guc = >->uc.guc;int err; - err =guc_action_vf_reset (guc); +do { + err =guc_action_vf_reset (guc); +if (!err || err != -ETIMEDOUT ) +break ; + }while (--retry); +if (unlikely (err))xe_gt_sriov_err (gt,"Failed to reset GuC state (%pe)\n" ,ERR_PTR (err));return err;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 237/486 drm/xe/pf: Create a link between PF and VF devices
In reply to Sasha LevinFrom: Satyanarayana K V P <[email protected]>
[ Upstream commit 8c0aff7d92e2be25717669eb65a81a89740a24f2 ]
When both PF and VF devices are enabled on the host, they resume simultaneously during system resume.
However, the PF must finish provisioning the VF before any VFs can successfully resume.
Establish a parent-child device link between the PF and VF devices to ensure the correct order of resumption.
V4 -> V5:
- Added missing break in the error condition.
V3 -> V4:
- Made xe_pci_pf_get_vf_dev() as a static function and updated input parameter types.
- Updated xe_sriov_warn() to xe_sriov_abort() when VF device cannot be found.
V2 -> V3:
- Added function documentation for xe_pci_pf_get_vf_dev().
- Added assertion if not called from PF.
V1 -> V2:
- Added a helper function to get VF pci_dev.
- Updated xe_sriov_notice() to xe_sriov_warn() if vf pci_dev is not found.
--- drivers/gpu/drm/xe/xe_pci_sriov.c | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/gpu/drm/xe/xe_pci_sriov.c +51 -0
@@ -62,6 +62,55 @@ static void pf_reset_vfs(struct xe_device *xe, unsigned int num_vfs)xe_gt_sriov_pf_control_trigger_flr (gt, n); } +static struct pci_dev *xe_pci_pf_get_vf_dev (struct xe_device *xe,unsigned int vf_id) +{ +struct pci_dev *pdev =to_pci_dev (xe->drm.dev); + +xe_assert (xe,IS_SRIOV_PF (xe)); + +/* caller must use pci_dev_put() */ +return pci_get_domain_bus_and_slot (pci_domain_nr (pdev->bus), + pdev->bus->number, +pci_iov_virtfn_devfn (pdev, vf_id)); +} + +static void pf_link_vfs (struct xe_device *xe,int num_vfs) +{ +struct pci_dev *pdev_pf =to_pci_dev (xe->drm.dev); +struct device_link *link; +struct pci_dev *pdev_vf; +unsigned int n; + +/* +* When both PF and VF devices are enabled on the host, during system +* resume they are resuming in parallel. +* +* But PF has to complete the provision of VF first to allow any VFs to +* successfully resume. +* +* Create a parent-child device link between PF and VF devices that will +* enforce correct resume order. +*/ +for (n =1 ; n <= num_vfs; n++) { + pdev_vf =xe_pci_pf_get_vf_dev (xe, n -1 ); + +/* unlikely, something weird is happening, abort */ +if (!pdev_vf) { +xe_sriov_err (xe,"Cannot find VF%u device, aborting link%s creation!\n" , + n,str_plural (num_vfs)); +break ; + } + + link =device_link_add (&pdev_vf->dev, &pdev_pf->dev, +DL_FLAG_AUTOREMOVE_CONSUMER ); +/* unlikely and harmless, continue with other VFs */ +if (!link) +xe_sriov_notice (xe,"Failed linking VF%u\n" , n); + +pci_dev_put (pdev_vf); + } +} +static int pf_enable_vfs (struct xe_device *xe,int num_vfs) {struct pci_dev *pdev =to_pci_dev (xe->drm.dev);
@@ -92,6 +141,8 @@ static int pf_enable_vfs(struct xe_device *xe, int num_vfs)if (err <0 ) goto failed; +pf_link_vfs (xe, num_vfs); +xe_sriov_info (xe,"Enabled %u of %u VF%s\n" , num_vfs, total_vfs,str_plural (total_vfs));return num_vfs;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 238/486 net/mlx5: Avoid report two health errors on same syndrome
In reply to Sasha LevinFrom: Moshe Shemesh <[email protected]>
[ Upstream commit b5d7b2f04ebcff740f44ef4d295b3401aeb029f4 ]
In case health counter has not increased for few polling intervals, miss counter will reach max misses threshold and health report will be triggered for FW health reporter. In case syndrome found on same health poll another health report will be triggered.
Avoid two health reports on same syndrome by marking this syndrome as already known.
--- drivers/net/ethernet/mellanox/mlx5/core/health.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/health.c +1 -0
@@ -799,6 +799,7 @@ static void poll_health(struct timer_list *t) health->prev = count;if (health->miss_counter ==MAX_MISSES ) {mlx5_core_err (dev,"device's health compromised - reached miss count\n" ); + health->synd =ioread8 (&h->synd);print_health_info (dev);queue_work (health->wq, &health->report_work); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 239/486 selftests/net: have `gro.sh -t` return a correct exit code
In reply to Sasha LevinFrom: Kevin Krakauer <[email protected]>
[ Upstream commit 784e6abd99f24024a8998b5916795f0bec9d2fd9 ]
Modify gro.sh to return a useful exit code when the -t flag is used. It formerly returned 0 no matter what.
Tested: Ran gro.sh -t large and verified that test failures return 1.
--- tools/testing/selftests/net/gro.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/gro.sh +2 -1
@@ -100,5 +100,6 @@ trap cleanup EXIT if [[ "${test}" == "all" ]]; then run_all_tests else - run_test "${proto}" "${test}" + exit_code=$(run_test "${proto}" "${test}") + exit $exit_code fi;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 240/486 pinctrl: sophgo: avoid to modify untouched bit when setting cv1800 pinconf
In reply to Sasha LevinFrom: Inochi Amaoto <[email protected]>
[ Upstream commit ef1a5121ae3da02372fcb66d9632ed3d47ad5637 ]
When setting pinconf configuration for cv1800 SoC, the driver just writes the value. It may zero some bits of the pinconf register and cause some unexpected error. Add a mask to avoid this.
--- drivers/pinctrl/sophgo/pinctrl-cv18xx.c | 33 +++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/pinctrl/sophgo/pinctrl-cv18xx.c +23 -10
@@ -574,10 +574,10 @@ static int cv1800_pinconf_compute_config(struct cv1800_pinctrl *pctrl,struct cv1800_pin *pin, unsigned long *configs, unsigned int num_configs, - u32 *value) + u32 *value, u32 *mask) { int i; -u32 v =0 ; +u32 v =0 , m =0 ;enum cv1800_pin_io_type type;int ret;
@@ -596,10 +596,12 @@ static int cv1800_pinconf_compute_config(struct cv1800_pinctrl *pctrl,case PIN_CONFIG_BIAS_PULL_DOWN : v &= ~PIN_IO_PULLDOWN ; v |=FIELD_PREP (PIN_IO_PULLDOWN , arg); + m |=PIN_IO_PULLDOWN ;break ;case PIN_CONFIG_BIAS_PULL_UP : v &= ~PIN_IO_PULLUP ; v |=FIELD_PREP (PIN_IO_PULLUP , arg); + m |=PIN_IO_PULLUP ;break ;case PIN_CONFIG_DRIVE_STRENGTH_UA : ret =cv1800_pinctrl_oc2reg (pctrl, pin, arg);
@@ -607,6 +609,7 @@ static int cv1800_pinconf_compute_config(struct cv1800_pinctrl *pctrl,return ret; v &= ~PIN_IO_DRIVE ; v |=FIELD_PREP (PIN_IO_DRIVE , ret); + m |=PIN_IO_DRIVE ;break ;case PIN_CONFIG_INPUT_SCHMITT_UV : ret =cv1800_pinctrl_schmitt2reg (pctrl, pin, arg);
@@ -614,6 +617,7 @@ static int cv1800_pinconf_compute_config(struct cv1800_pinctrl *pctrl,return ret; v &= ~PIN_IO_SCHMITT ; v |=FIELD_PREP (PIN_IO_SCHMITT , ret); + m |=PIN_IO_SCHMITT ;break ;case PIN_CONFIG_POWER_SOURCE :/* Ignore power source as it is always fixed */
@@ -621,10 +625,12 @@ static int cv1800_pinconf_compute_config(struct cv1800_pinctrl *pctrl,case PIN_CONFIG_SLEW_RATE : v &= ~PIN_IO_OUT_FAST_SLEW ; v |=FIELD_PREP (PIN_IO_OUT_FAST_SLEW , arg); + m |=PIN_IO_OUT_FAST_SLEW ;break ;case PIN_CONFIG_BIAS_BUS_HOLD : v &= ~PIN_IO_BUS_HOLD ; v |=FIELD_PREP (PIN_IO_BUS_HOLD , arg); + m |=PIN_IO_BUS_HOLD ;break ;default :return -ENOTSUPP ;
@@ -632,17 +638,19 @@ static int cv1800_pinconf_compute_config(struct cv1800_pinctrl *pctrl, } *value = v; + *mask = m;return 0 ; }static int cv1800_pin_set_config (struct cv1800_pinctrl *pctrl,unsigned int pin_id, -u32 value) +u32 value,u32 mask) {struct cv1800_pin *pin =cv1800_get_pin (pctrl, pin_id);unsigned long flags;void __iomem *addr; +u32 reg;if (!pin)return -EINVAL ;
@@ -650,7 +658,10 @@ static int cv1800_pin_set_config(struct cv1800_pinctrl *pctrl, addr =cv1800_pinctrl_get_component_addr (pctrl, &pin->conf);raw_spin_lock_irqsave (&pctrl->lock, flags); -writel (value, addr); + reg =readl (addr); + reg &= ~mask; + reg |= value; +writel (reg, addr);raw_spin_unlock_irqrestore (&pctrl->lock, flags);return 0 ;
@@ -662,16 +673,17 @@ static int cv1800_pconf_set(struct pinctrl_dev *pctldev, {struct cv1800_pinctrl *pctrl =pinctrl_dev_get_drvdata (pctldev);struct cv1800_pin *pin =cv1800_get_pin (pctrl, pin_id); -u32 value; +u32 value, mask;if (!pin)return -ENODEV ;if (cv1800_pinconf_compute_config (pctrl, pin, - configs, num_configs, &value)) + configs, num_configs, + &value, &mask))return -ENOTSUPP ; -return cv1800_pin_set_config (pctrl, pin_id, value); +return cv1800_pin_set_config (pctrl, pin_id, value, mask); } static int cv1800_pconf_group_set(struct pinctrl_dev *pctldev,
@@ -682,7 +694,7 @@ static int cv1800_pconf_group_set(struct pinctrl_dev *pctldev,struct cv1800_pinctrl *pctrl =pinctrl_dev_get_drvdata (pctldev);const struct group_desc *group;const struct cv1800_pin_mux_config *pinmuxs; -u32 value; +u32 value, mask;int i; group =pinctrl_generic_get_group (pctldev, gsel);
@@ -692,11 +704,12 @@ static int cv1800_pconf_group_set(struct pinctrl_dev *pctldev, pinmuxs = group->data;if (cv1800_pinconf_compute_config (pctrl, pinmuxs[0 ].pin, - configs, num_configs, &value)) + configs, num_configs, + &value, &mask))return -ENOTSUPP ;for (i =0 ; i < group->grp.npins; i++) -cv1800_pin_set_config (pctrl, group->grp.pins[i], value); +cv1800_pin_set_config (pctrl, group->grp.pins[i], value, mask);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 241/486 drm/amdkfd: KFD release_work possible circular locking
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit 1b9366c601039d60546794c63fbb83ce8e53b978 ]
If waiting for gpu reset done in KFD release_work, thers is WARNING:
possible circular locking dependency detected
#2 kfd_create_process
kfd_process_mutex
flush kfd release work
#1 kfd release work
wait for amdgpu reset work
#0 amdgpu_device_gpu_reset
kgd2kfd_pre_reset
kfd_process_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock((work_completion)(&p->release_work));
lock((wq_completion)kfd_process_wq);
lock((work_completion)(&p->release_work));lock((wq_completion)amdgpu-reset-dev);
To fix this, KFD create process move flush release work outside kfd_process_mutex.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +8 -8
@@ -842,6 +842,14 @@ struct kfd_process *kfd_create_process(struct task_struct *thread)return ERR_PTR (-EINVAL ); } +/* If the process just called exec(3), it is possible that the +* cleanup of the kfd_process (following the release of the mm +* of the old process image) is still in the cleanup work queue. +* Make sure to drain any job before trying to recreate any +* resource for this process. +*/ +flush_workqueue (kfd_process_wq); +/* * take kfd processes mutex before starting of process creation * so there won't be a case where two threads of the same process
@@ -860,14 +868,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread)if (process) {pr_debug ("Process already found\n" ); }else { -/* If the process just called exec(3), it is possible that the -* cleanup of the kfd_process (following the release of the mm -* of the old process image) is still in the cleanup work queue. -* Make sure to drain any job before trying to recreate any -* resource for this process. -*/ -flush_workqueue (kfd_process_wq); - process =create_process (thread);if (IS_ERR (process)) goto out;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 242/486 drm/xe: xe_gen_wa_oob: replace program_invocation_short_name
In reply to Sasha LevinFrom: Daniel Gomez <[email protected]>
[ Upstream commit 89eb42b5539f6ae6a0cabcb39e5b6fcc83c106a1 ]
program_invocation_short_name may not be available in other systems. Instead, replace it with the argv[0] to pass the executable name.
Fixes build error when program_invocation_short_name is not available:
drivers/gpu/drm/xe/xe_gen_wa_oob.c:34:3: error: use of
undeclared identifier 'program_invocation_short_name' 34 |program_invocation_short_name); | ^ 1 error
generated.
--- drivers/gpu/drm/xe/xe_gen_wa_oob.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_gen_wa_oob.c +3 -3
@@ -28,10 +28,10 @@"\n" \"#endif\n" -static void print_usage(FILE *f) +static void print_usage(FILE *f, const char *progname) {fprintf (f,"usage: %s <input-rule-file> <generated-c-source-file> <generated-c-header-file>\n" , - program_invocation_short_name); + progname); } static void print_parse_error(const char *err_msg, const char *line,
@@ -144,7 +144,7 @@ int main(int argc, const char *argv[])if (argc <3 ) {fprintf (stderr,"ERROR: wrong arguments\n" ); -print_usage (stderr); +print_usage (stderr, argv[0 ]);return 1 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 243/486 leds: pwm-multicolor: Add check for fwnode_property_read_u32
In reply to Sasha LevinFrom: Yuanjun Gong <[email protected]>
[ Upstream commit 6d91124e7edc109f114b1afe6d00d85d0d0ac174 ]
Add a check to the return value of fwnode_property_read_u32() in case it fails.
--- drivers/leds/rgb/leds-pwm-multicolor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/leds/rgb/leds-pwm-multicolor.c +4 -1
@@ -135,8 +135,11 @@ static int led_pwm_mc_probe(struct platform_device *pdev)/* init the multicolor's LED class device */ cdev = &priv->mc_cdev.led_cdev; -fwnode_property_read_u32 (mcnode,"max-brightness" , + ret =fwnode_property_read_u32 (mcnode,"max-brightness" , &cdev->max_brightness); +if (ret) + goto release_mcnode; + cdev->flags =LED_CORE_SUSPENDRESUME ; cdev->brightness_set_blocking = led_pwm_mc_set;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 244/486 net: ethernet: mtk_ppe_offload: Allow QinQ, double ETH_P_8021Q only
In reply to Sasha LevinFrom: Eric Woudstra <[email protected]>
[ Upstream commit 7fe0353606d77a32c4c7f2814833dd1c043ebdd2 ]
mtk_foe_entry_set_vlan() in mtk_ppe.c already supports double vlan tagging, but mtk_flow_offload_replace() in mtk_ppe_offload.c only allows for 1 vlan tag, optionally in combination with pppoe and dsa tags.
However, mtk_foe_entry_set_vlan() only allows for setting the vlan id. The protocol cannot be set, it is always ETH_P_8021Q, for inner and outer tag. This patch adds QinQ support to mtk_flow_offload_replace(), only in the case that both inner and outer tags are ETH_P_8021Q.
Only PPPoE-in-Q (as before) and Q-in-Q are allowed. A combination of PPPoE and Q-in-Q is not allowed.
--- .../net/ethernet/mediatek/mtk_ppe_offload.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/mediatek/mtk_ppe_offload.c +11 -11
@@ -34,8 +34,10 @@ struct mtk_flow_data {u16 vlan_in;struct { -u16 id; -__be16 proto; +struct { +u16 id; +__be16 proto; + } vlans[2 ];u8 num; } vlan;struct {
@@ -349,18 +351,19 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f,case FLOW_ACTION_CSUM :break ;case FLOW_ACTION_VLAN_PUSH : -if (data.vlan.num ==1 || +if (data.vlan.num + data.pppoe.num ==2 || act->vlan.proto !=htons (ETH_P_8021Q ))return -EOPNOTSUPP ; - data.vlan.id = act->vlan.vid; - data.vlan.proto = act->vlan.proto; + data.vlan.vlans[data.vlan.num].id = act->vlan.vid; + data.vlan.vlans[data.vlan.num].proto = act->vlan.proto; data.vlan.num++;break ;case FLOW_ACTION_VLAN_POP :break ;case FLOW_ACTION_PPPOE_PUSH : -if (data.pppoe.num ==1 ) +if (data.pppoe.num ==1 || + data.vlan.num ==2 )return -EOPNOTSUPP ; data.pppoe.sid = act->pppoe.sid;
@@ -450,12 +453,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f,if (offload_type ==MTK_PPE_PKT_TYPE_BRIDGE ) foe.bridge.vlan = data.vlan_in; -if (data.vlan.num ==1 ) { -if (data.vlan.proto !=htons (ETH_P_8021Q )) -return -EOPNOTSUPP ; +for (i =0 ; i < data.vlan.num; i++) +mtk_foe_entry_set_vlan (eth, &foe, data.vlan.vlans[i].id); -mtk_foe_entry_set_vlan (eth, &foe, data.vlan.id); - }if (data.pppoe.num ==1 )mtk_foe_entry_set_pppoe (eth, &foe, data.pppoe.sid);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 245/486 net: xgene-v2: remove incorrect ACPI_PTR annotation
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 01358e8fe922f716c05d7864ac2213b2440026e7 ]
Building with W=1 shows a warning about xge_acpi_match being unused when CONFIG_ACPI is disabled:
drivers/net/ethernet/apm/xgene-v2/main.c:723:36: error: unused variable 'xge_acpi_match' [-Werror,-Wunused-const-variable]
--- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/apm/xgene-v2/main.c +1 -3
@@ -9,8 +9,6 @@#include "main.h" -static const struct acpi_device_id xge_acpi_match[]; -static int xge_get_resources (struct xge_pdata *pdata) {struct platform_device *pdev;
@@ -731,7 +729,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove_new = xge_remove,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 246/486 bonding: report duplicate MAC address in all situations
In reply to Sasha LevinFrom: Hangbin Liu <[email protected]>
[ Upstream commit 28d68d396a1cd21591e8c6d74afbde33a7ea107e ]
Normally, a bond uses the MAC address of the first added slave as the bond’s MAC address. And the bond will set active slave’s MAC address to bond’s address if fail_over_mac is set to none (0) or follow (2).
When the first slave is removed, the bond will still use the removed slave’s MAC address, which can lead to a duplicate MAC address and potentially cause issues with the switch. To avoid confusion, let's warn the user in all situations, including when fail_over_mac is set to 2 or not in active-backup mode.
--- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
@@ -2542,7 +2542,7 @@ static int __bond_release_one(struct net_device *bond_dev,RCU_INIT_POINTER (bond->current_arp_slave,NULL ); -if (!all && (!bond->params.fail_over_mac || +if (!all && (bond->params.fail_over_mac !=BOND_FOM_ACTIVE ||BOND_MODE (bond) !=BOND_MODE_ACTIVEBACKUP )) {if (ether_addr_equal_64bits (bond_dev->dev_addr, slave->perm_hwaddr) &&bond_has_slaves (bond))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 247/486 wifi: ath12k: Improve BSS discovery with hidden SSID in 6 GHz band
In reply to Sasha LevinFrom: Ramasamy Kaliappan <[email protected]>
[ Upstream commit 27d38bdfd416f4db70e09c3bef3b030c86fd235a ]
Currently, sometimes, the station is unable to identify the configured AP SSID in its scan results when the AP is not broadcasting its name publicly and has a hidden SSID.
Currently, channel dwell time for an ath12k station is 30 ms. Sometimes, station can send broadcast probe request to AP close to the end of dwell time. In some of these cases, before AP sends a response to the received probe request, the dwell time on the station side would come to an end. So, the station will move to scan next channel and will not be able to acknowledge the unicast probe response.
Resolve this issue by increasing station's channel dwell time to 70 ms, so that the it remains on the same channel for a longer period. This would increase the station's chance of receiving probe response from the AP. The station will then send a response acknowledgment back to the AP, thus leading to successful scan and BSS discovery.
With an increased dwell time, scan would take longer than it takes now. But, this fix is an improvement for hidden SSID scan issue.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/wmi.c +2 -2
@@ -2206,8 +2206,8 @@ void ath12k_wmi_start_scan_init(struct ath12k *ar, arg->dwell_time_active =50 ; arg->dwell_time_active_2g =0 ; arg->dwell_time_passive =150 ; - arg->dwell_time_active_6g =40 ; - arg->dwell_time_passive_6g =30 ; + arg->dwell_time_active_6g =70 ; + arg->dwell_time_passive_6g =70 ; arg->min_rest_time =50 ; arg->max_rest_time =500 ; arg->repeat_probe_time =0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 248/486 soc: ti: k3-socinfo: Do not use syscon helper to build regmap
In reply to Sasha LevinFrom: Andrew Davis <[email protected]>
[ Upstream commit a5caf03188e44388e8c618dcbe5fffad1a249385 ]
The syscon helper device_node_to_regmap() is used to fetch a regmap registered to a device node. It also currently creates this regmap if the node did not already have a regmap associated with it. This should only be used on "syscon" nodes. This driver is not such a device and instead uses device_node_to_regmap() on its own node as a hacky way to create a regmap for itself.
This will not work going forward and so we should create our regmap the normal way by defining our regmap_config, fetching our memory resource, then using the normal regmap_init_mmio() function.
--- drivers/soc/ti/k3-socinfo.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/soc/ti/k3-socinfo.c +12 -1
@@ -105,6 +105,12 @@ k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,return -ENODEV ; } +static const struct regmap_config k3_chipinfo_regmap_cfg = { + .reg_bits =32 , + .val_bits =32 , + .reg_stride =4 , +}; +static int k3_chipinfo_probe (struct platform_device *pdev) {struct device_node *node = pdev->dev.of_node;
@@ -112,13 +118,18 @@ static int k3_chipinfo_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct soc_device *soc_dev;struct regmap *regmap; +void __iomem *base;u32 partno_id;u32 variant;u32 jtag_id;u32 mfg;int ret; - regmap =device_node_to_regmap (node); + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) +return PTR_ERR (base); + + regmap =regmap_init_mmio (dev, base, &k3_chipinfo_regmap_cfg);if (IS_ERR (regmap))return PTR_ERR (regmap);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 249/486 bpf: Search and add kfuncs in struct_ops prologue and epilogue
In reply to Sasha LevinFrom: Amery Hung <[email protected]>
[ Upstream commit d519594ee2445d7cd1ad51f4db4cee58f8213400 ]
Currently, add_kfunc_call() is only invoked once before the main verification loop. Therefore, the verifier could not find the bpf_kfunc_btf_tab of a new kfunc call which is not seen in user defined struct_ops operators but introduced in gen_prologue or gen_epilogue during do_misc_fixup(). Fix this by searching kfuncs in the patching instruction buffer and add them to prog->aux->kfunc_tab.
--- kernel/bpf/verifier.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
kernel/bpf/verifier.c +24 -1
@@ -2987,6 +2987,21 @@ bpf_jit_find_kfunc_model(const struct bpf_prog *prog,return res ? &res->func_model :NULL ; } +static int add_kfunc_in_insns (struct bpf_verifier_env *env, +struct bpf_insn *insn,int cnt) +{ +int i, ret; + +for (i =0 ; i < cnt; i++, insn++) { +if (bpf_pseudo_kfunc_call (insn)) { + ret =add_kfunc_call (env, insn->imm, insn->off); +if (ret <0 ) +return ret; + } + } +return 0 ; +} +static int add_subprog_and_kfunc (struct bpf_verifier_env *env) {struct bpf_subprog_info *subprog = env->subprog_info;
@@ -19768,7 +19783,7 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) {struct bpf_subprog_info *subprogs = env->subprog_info;const struct bpf_verifier_ops *ops = env->ops; -int i, cnt, size, ctx_field_size, delta =0 , epilogue_cnt =0 ; +int i, cnt, size, ctx_field_size, ret, delta =0 , epilogue_cnt =0 ;const int insn_cnt = env->prog->len;struct bpf_insn *epilogue_buf = env->epilogue_buf;struct bpf_insn *insn_buf = env->insn_buf;
@@ -19797,6 +19812,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)return -ENOMEM ; env->prog = new_prog; delta += cnt -1 ; + + ret =add_kfunc_in_insns (env, epilogue_buf, epilogue_cnt -1 ); +if (ret <0 ) +return ret; } }
@@ -19817,6 +19836,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) env->prog = new_prog; delta += cnt -1 ; + + ret =add_kfunc_in_insns (env, insn_buf, cnt -1 ); +if (ret <0 ) +return ret; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 250/486 Octeontx2-af: RPM: Register driver with PCI subsys IDs
In reply to Sasha LevinFrom: Hariprasad Kelam <[email protected]>
[ Upstream commit fc9167192f29485be5621e2e9c8208b717b65753 ]
Although the PCI device ID and Vendor ID for the RPM (MAC) block have remained the same across Octeon CN10K and the next-generation CN20K silicon, Hardware architecture has changed (NIX mapped RPMs and RFOE Mapped RPMs).
Add PCI Subsystem IDs to the device table to ensure that this driver can be probed from NIX mapped RPM devices only.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 14 ++++++++++++-- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +12 -2
@@ -66,8 +66,18 @@ static int cgx_fwi_link_change(struct cgx *cgx, int lmac_id, bool en);/* Supported devices */ static const struct pci_device_id cgx_id_table[] = { {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_CGX ) }, - {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10K_RPM ) }, - {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10KB_RPM ) }, + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10K_RPM , +PCI_ANY_ID ,PCI_SUBSYS_DEVID_CN10K_A ) }, + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10K_RPM , +PCI_ANY_ID ,PCI_SUBSYS_DEVID_CNF10K_A ) }, + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10K_RPM , +PCI_ANY_ID ,PCI_SUBSYS_DEVID_CNF10K_B ) }, + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10KB_RPM , +PCI_ANY_ID ,PCI_SUBSYS_DEVID_CN10K_B ) }, + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10KB_RPM , +PCI_ANY_ID ,PCI_SUBSYS_DEVID_CN20KA ) }, + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_CN10KB_RPM , +PCI_ANY_ID ,PCI_SUBSYS_DEVID_CNF20KA ) }, {0 , }/* end of table */ };
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -30,6 +30,8 @@#define PCI_SUBSYS_DEVID_CNF10K_A 0xBA00#define PCI_SUBSYS_DEVID_CNF10K_B 0xBC00#define PCI_SUBSYS_DEVID_CN10K_B 0xBD00 +#define PCI_SUBSYS_DEVID_CN20KA 0xC220 +#define PCI_SUBSYS_DEVID_CNF20KA 0xC320/* PCI BAR nos */ #define PCI_AF_REG_BAR_NUM 0
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 251/486 x86/build: Fix broken copy command in genimage.sh when making isoimage
In reply to Sasha LevinFrom: Nir Lichtman <[email protected]>
[ Upstream commit e451630226bd09dc730eedb4e32cab1cc7155ae8 ]
Problem: Currently when running the "make isoimage" command there is an error related to wrong parameters passed to the cp command:
"cp: missing destination file operand after 'arch/x86/boot/isoimage/'"
This is caused because FDINITRDS is an empty array.
Solution: Check if FDINITRDS is empty before executing the "cp" command, similar to how it is done in the case of hdimage.
--- arch/x86/boot/genimage.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/boot/genimage.sh +4 -1
@@ -22,6 +22,7 @@ # This script requires: # bash # syslinux +# genisoimage # mtools (for fdimage* and hdimage) # edk2/OVMF (for hdimage) #
@@ -251,7 +252,9 @@ geniso() { cp "$isolinux" "$ldlinux" "$tmp_dir" cp "$FBZIMAGE" "$tmp_dir"/linux echo default linux "$KCMDLINE" > "$tmp_dir"/isolinux.cfg - cp "${FDINITRDS[@]}" "$tmp_dir"/ + if [ ${#FDINITRDS[@]} -gt 0 ]; then + cp "${FDINITRDS[@]}" "$tmp_dir"/ + fi genisoimage -J -r -appid 'LINUX_BOOT' -input-charset=utf-8 \ -quiet -o "$FIMAGE" -b isolinux.bin \ -c boot.cat -no-emul-boot -boot-load-size 4 \
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 252/486 drm/amd/display: handle max_downscale_src_width fail check
In reply to Sasha LevinFrom: Yihan Zhu <[email protected]>
[ Upstream commit 02a940da2ccc0cc0299811379580852b405a0ea2 ]
[WHY]
If max_downscale_src_width check fails, we exit early from TAP calculation and left a NULL value to the scaling data structure to cause the zero divide in the DML validation.
[HOW]
Call set default TAP calculation before early exit in get_optimal_number_of_taps due to max downscale limit exceed.
--- drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c +6 -5
@@ -425,11 +425,6 @@ bool dpp3_get_optimal_number_of_taps(int min_taps_y, min_taps_c;enum lb_memory_config lb_config; -if (scl_data->viewport.width > scl_data->h_active && - dpp->ctx->dc->debug.max_downscale_src_width !=0 && - scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width) -return false; -/* * Set default taps if none are provided * From programming guide: taps = min{ ceil(2*H_RATIO,1), 8} for downscaling
@@ -467,6 +462,12 @@ bool dpp3_get_optimal_number_of_taps(else scl_data->taps.h_taps_c = in_taps->h_taps_c; +// Avoid null data in the scl data with this early return, proceed non-adaptive calcualtion first +if (scl_data->viewport.width > scl_data->h_active && + dpp->ctx->dc->debug.max_downscale_src_width !=0 && + scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width) +return false; +/*Ensure we can support the requested number of vtaps*/ min_taps_y =dc_fixpt_ceil (scl_data->ratios.vert); min_taps_c =dc_fixpt_ceil (scl_data->ratios.vert_c);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 253/486 drm/amd/display: fix dcn4x init failed
In reply to Sasha LevinFrom: Charlene Liu <[email protected]>
[ Upstream commit 23ef388a84c72b0614a6c10f866ffeac7e807719 ]
[why]
failed due to cmdtable not created.
switch atombios cmdtable as default.
--- drivers/gpu/drm/amd/display/dc/bios/command_table2.c | 9 --------- .../gpu/drm/amd/display/dc/bios/command_table_helper2.c | 3 +-- 2 files changed, 1 insertion(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/command_table2.c +0 -9
@@ -101,7 +101,6 @@ static void init_dig_encoder_control(struct bios_parser *bp) bp->cmd_tbl.dig_encoder_control = encoder_control_digx_v1_5;break ;default : -dm_output_to_console ("Don't have dig_encoder_control for v%d\n" , version); bp->cmd_tbl.dig_encoder_control = encoder_control_fallback;break ; }
@@ -238,7 +237,6 @@ static void init_transmitter_control(struct bios_parser *bp) bp->cmd_tbl.transmitter_control = transmitter_control_v1_7;break ;default : -dm_output_to_console ("Don't have transmitter_control for v%d\n" , crev); bp->cmd_tbl.transmitter_control = transmitter_control_fallback;break ; }
@@ -408,8 +406,6 @@ static void init_set_pixel_clock(struct bios_parser *bp) bp->cmd_tbl.set_pixel_clock = set_pixel_clock_v7;break ;default : -dm_output_to_console ("Don't have set_pixel_clock for v%d\n" , -BIOS_CMD_TABLE_PARA_REVISION (setpixelclock)); bp->cmd_tbl.set_pixel_clock = set_pixel_clock_fallback;break ; }
@@ -554,7 +550,6 @@ static void init_set_crtc_timing(struct bios_parser *bp) set_crtc_using_dtd_timing_v3;break ;default : -dm_output_to_console ("Don't have set_crtc_timing for v%d\n" , dtd_version); bp->cmd_tbl.set_crtc_timing =NULL ;break ; }
@@ -671,8 +666,6 @@ static void init_enable_crtc(struct bios_parser *bp) bp->cmd_tbl.enable_crtc = enable_crtc_v1;break ;default : -dm_output_to_console ("Don't have enable_crtc for v%d\n" , -BIOS_CMD_TABLE_PARA_REVISION (enablecrtc)); bp->cmd_tbl.enable_crtc =NULL ;break ; }
@@ -864,8 +857,6 @@ static void init_set_dce_clock(struct bios_parser *bp) bp->cmd_tbl.set_dce_clock = set_dce_clock_v2_1;break ;default : -dm_output_to_console ("Don't have set_dce_clock for v%d\n" , -BIOS_CMD_TABLE_PARA_REVISION (setdceclock)); bp->cmd_tbl.set_dce_clock =NULL ;break ; }
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +1 -2
@@ -87,8 +87,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(return true;default : -/* Unsupported DCE */ -BREAK_TO_DEBUGGER (); + *h =dal_cmd_tbl_helper_dce112_get_table2 ();return false; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 254/486 drm/amd/display: Fix mismatch type comparison
In reply to Sasha LevinFrom: "Assadian, Navid" <[email protected]>
[ Upstream commit 26873260d394b1e33cdd720154aedf0af95327f9 ]
The mismatch type comparison/assignment may cause data loss. Since the values are always non-negative, it is safe to use unsigned variables to resolve the mismatch.
--- drivers/gpu/drm/amd/display/dc/spl/dc_spl.c | 4 ++-- drivers/gpu/drm/amd/display/dc/spl/dc_spl_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/spl/dc_spl.c +2 -2
@@ -875,8 +875,8 @@ static bool spl_get_optimal_number_of_taps( bool *enable_isharp) {int num_part_y, num_part_c; -int max_taps_y, max_taps_c; -int min_taps_y, min_taps_c; +unsigned int max_taps_y, max_taps_c; +unsigned int min_taps_y, min_taps_c;enum lb_memory_config lb_config;bool skip_easf = false;
drivers/gpu/drm/amd/display/dc/spl/dc_spl_types.h +1 -1
@@ -479,7 +479,7 @@ struct spl_sharpness_range { };struct adaptive_sharpness {bool enable; -int sharpness_level; +unsigned int sharpness_level;struct spl_sharpness_range sharpness_range; };enum linear_light_scaling {// convert it in translation logic
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 255/486 ASoC: mediatek: mt8188: Treat DMIC_GAINx_CUR as non-volatile
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 7d87bde21c73731ddaf15e572020f80999c38ee3 ]
The DMIC_GAINx_CUR registers contain the current (as in present) gain of each DMIC. During capture, this gain will ramp up until a target value is reached, and therefore the register is volatile since it is updated automatically by hardware.
However, after capture the register's value returns to the value that was written to it. So reading these registers returns the current gain, and writing configures the initial gain for every capture.
Quoted 1 line
From an audio configuration perspective, reading the instantaneous gain
is not really useful. Instead, reading back the initial gain that was configured is the desired behavior. For that reason, consider the DMIC_GAINx_CUR registers as non-volatile, so the regmap's cache can be used to retrieve the values, rather than requiring pm runtime resuming the device.
--- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 4 ---- 1 file changed, 4 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +0 -4
@@ -2855,10 +2855,6 @@ static bool mt8188_is_volatile_reg(struct device *dev, unsigned int reg)case AFE_DMIC3_SRC_DEBUG_MON0 :case AFE_DMIC3_UL_SRC_MON0 :case AFE_DMIC3_UL_SRC_MON1 : -case DMIC_GAIN1_CUR : -case DMIC_GAIN2_CUR : -case DMIC_GAIN3_CUR : -case DMIC_GAIN4_CUR :case ETDM_IN1_MONITOR :case ETDM_IN2_MONITOR :case ETDM_OUT1_MONITOR :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 256/486 ASoC: mediatek: mt8188: Add reference for dmic clocks
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit bf1800073f4d55f08191b034c86b95881e99b6fd ]
Add the names for the dmic clocks, aud_afe_dmic* and aud_dmic_hires*, so they can be acquired and enabled by the platform driver.
--- sound/soc/mediatek/mt8188/mt8188-afe-clk.c | 8 ++++++++ sound/soc/mediatek/mt8188/mt8188-afe-clk.h | 8 ++++++++ 2 files changed, 16 insertions(+)
sound/soc/mediatek/mt8188/mt8188-afe-clk.c +8 -0
@@ -58,7 +58,15 @@ static const char *aud_clks[MT8188_CLK_NUM] = { [MT8188_CLK_AUD_ADC] = "aud_adc", [MT8188_CLK_AUD_DAC_HIRES] = "aud_dac_hires", [MT8188_CLK_AUD_A1SYS_HP] = "aud_a1sys_hp", + [MT8188_CLK_AUD_AFE_DMIC1] = "aud_afe_dmic1", + [MT8188_CLK_AUD_AFE_DMIC2] = "aud_afe_dmic2", + [MT8188_CLK_AUD_AFE_DMIC3] = "aud_afe_dmic3", + [MT8188_CLK_AUD_AFE_DMIC4] = "aud_afe_dmic4", [MT8188_CLK_AUD_ADC_HIRES] = "aud_adc_hires", + [MT8188_CLK_AUD_DMIC_HIRES1] = "aud_dmic_hires1", + [MT8188_CLK_AUD_DMIC_HIRES2] = "aud_dmic_hires2", + [MT8188_CLK_AUD_DMIC_HIRES3] = "aud_dmic_hires3", + [MT8188_CLK_AUD_DMIC_HIRES4] = "aud_dmic_hires4", [MT8188_CLK_AUD_I2SIN] = "aud_i2sin", [MT8188_CLK_AUD_TDM_IN] = "aud_tdm_in", [MT8188_CLK_AUD_I2S_OUT] = "aud_i2s_out",
sound/soc/mediatek/mt8188/mt8188-afe-clk.h +8 -0
@@ -54,7 +54,15 @@ enum {MT8188_CLK_AUD_ADC ,MT8188_CLK_AUD_DAC_HIRES ,MT8188_CLK_AUD_A1SYS_HP , +MT8188_CLK_AUD_AFE_DMIC1 , +MT8188_CLK_AUD_AFE_DMIC2 , +MT8188_CLK_AUD_AFE_DMIC3 , +MT8188_CLK_AUD_AFE_DMIC4 ,MT8188_CLK_AUD_ADC_HIRES , +MT8188_CLK_AUD_DMIC_HIRES1 , +MT8188_CLK_AUD_DMIC_HIRES2 , +MT8188_CLK_AUD_DMIC_HIRES3 , +MT8188_CLK_AUD_DMIC_HIRES4 ,MT8188_CLK_AUD_I2SIN ,MT8188_CLK_AUD_TDM_IN , MT8188_CLK_AUD_I2S_OUT,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 257/486 x86/nmi: Add an emergency handler in nmi_desc & use it in nmi_shootdown_cpus()
In reply to Sasha LevinFrom: Waiman Long <[email protected]>
[ Upstream commit fe37c699ae3eed6e02ee55fbf5cb9ceb7fcfd76c ]
Depending on the type of panics, it was found that the __register_nmi_handler() function can be called in NMI context from nmi_shootdown_cpus() leading to a lockdep splat:
WARNING: inconsistent lock state
inconsistent {INITIAL USE} -> {IN-NMI} usage.
lock(&nmi_desc[0].lock);
<Interrupt>
lock(&nmi_desc[0].lock); Call Trace:
_raw_spin_lock_irqsave
__register_nmi_handler
nmi_shootdown_cpus
kdump_nmi_shootdown_cpus
native_machine_crash_shutdown
__crash_kexecIn this particular case, the following panic message was printed before:
Kernel panic - not syncing: Fatal hardware error!
This message seemed to be given out from __ghes_panic() running in NMI context.
The __register_nmi_handler() function which takes the nmi_desc lock with irq disabled shouldn't be called from NMI context as this can lead to deadlock.
The nmi_shootdown_cpus() function can only be invoked once. After the first invocation, all other CPUs should be stuck in the newly added crash_nmi_callback() and cannot respond to a second NMI.
Fix it by adding a new emergency NMI handler to the nmi_desc structure and provide a new set_emergency_nmi_handler() helper to set crash_nmi_callback() in any context. The new emergency handler will preempt other handlers in the linked list. That will eliminate the need to take any lock and serve the panic in NMI use case.
--- arch/x86/include/asm/nmi.h | 2 ++ arch/x86/kernel/nmi.c | 42 ++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/reboot.c | 10 +++------ 3 files changed, 47 insertions(+), 7 deletions(-)
arch/x86/include/asm/nmi.h +2 -0
@@ -56,6 +56,8 @@ int __register_nmi_handler(unsigned int, struct nmiaction *);void unregister_nmi_handler (unsigned int ,const char *); +void set_emergency_nmi_handler (unsigned int type,nmi_handler_t handler); +void stop_nmi (void );void restart_nmi (void );void local_touch_nmi (void );
arch/x86/kernel/nmi.c +42 -0
65 lines not on this page · raw message
arch/x86/kernel/reboot.c +3 -7
@@ -926,15 +926,11 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) shootdown_callback = callback;atomic_set (&waiting_for_crash_ipi,num_online_cpus () -1 ); -/* Would it be better to replace the trap vector here? */ -if (register_nmi_handler (NMI_LOCAL , crash_nmi_callback, -NMI_FLAG_FIRST ,"crash" )) -return ;/* Return what? */ +/* -* Ensure the new callback function is set before sending -* out the NMI +* Set emergency handler to preempt other handlers. */ -wmb (); +set_emergency_nmi_handler (NMI_LOCAL , crash_nmi_callback);apic_send_IPI_allbutself (NMI_VECTOR );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 258/486 vhost-scsi: Return queue full for page alloc failures during copy
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit 891b99eab0f89dbe08d216f4ab71acbeaf7a3102 ]
This has us return queue full if we can't allocate a page during the copy operation so the initiator can retry.
Message-Id: <[email protected]>
--- drivers/vhost/scsi.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/vhost/scsi.c +9 -6
@@ -757,7 +757,7 @@ vhost_scsi_copy_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter,size_t len =iov_iter_count (iter);unsigned int nbytes =0 ;struct page *page; -int i; +int i, ret;if (cmd->tvc_data_direction ==DMA_FROM_DEVICE ) { cmd->saved_iter_addr = dup_iter(&cmd->saved_iter, iter,
@@ -770,6 +770,7 @@ vhost_scsi_copy_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter, page =alloc_page (GFP_KERNEL );if (!page) { i--; + ret = -ENOMEM ; goto err; }
@@ -777,8 +778,10 @@ vhost_scsi_copy_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter,sg_set_page (&sg[i], page, nbytes,0 );if (cmd->tvc_data_direction ==DMA_TO_DEVICE && -copy_page_from_iter (page,0 , nbytes, iter) != nbytes) +copy_page_from_iter (page,0 , nbytes, iter) != nbytes) { + ret = -EFAULT ; goto err; + } len -= nbytes; }
@@ -793,7 +796,7 @@ vhost_scsi_copy_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter,for (; i >=0 ; i--)__free_page (sg_page (&sg[i]));kfree (cmd->saved_iter_addr); -return -ENOMEM ; +return ret; } static int
@@ -1277,9 +1280,9 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) " %d\n", cmd, exp_data_len, prot_bytes, data_direction);if (data_direction !=DMA_NONE ) { -if (unlikely (vhost_scsi_mapal (cmd, prot_bytes, - &prot_iter, exp_data_len, - &data_iter))) { + ret =vhost_scsi_mapal (cmd, prot_bytes, &prot_iter, + exp_data_len, &data_iter); +if (unlikely (ret)) {vq_err (vq,"Failed to map iov to sgl\n" );vhost_scsi_release_cmd_res (&cmd->tvc_se_cmd); goto err;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 259/486 vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines
In reply to Sasha LevinFrom: Konstantin Shkolnyy <[email protected]>
[ Upstream commit 439252e167ac45a5d46f573aac1da7d8f3e051ad ]
mlx5_vdpa_dev_add() doesn’t initialize mvdev->actual_features. It’s initialized later by mlx5_vdpa_set_driver_features(). However, mlx5_vdpa_get_config() depends on the VIRTIO_F_VERSION_1 flag in actual_features, to return data with correct endianness. When it’s called before mlx5_vdpa_set_driver_features(), the data are incorrectly returned as big-endian on big-endian machines, while QEMU then interprets them as little-endian.
The fix is to initialize this VIRTIO_F_VERSION_1 as early as possible, especially considering that mlx5_vdpa_dev_add() insists on this flag to always be set anyway.
Message-Id: <[email protected]>
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +3 -0
@@ -3884,6 +3884,9 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, ndev->mvdev.max_vqs = max_vqs; mvdev = &ndev->mvdev; mvdev->mdev = mdev; +/* cpu_to_mlx5vdpa16() below depends on this flag */ + mvdev->actual_features = + (device_features &BIT_ULL (VIRTIO_F_VERSION_1 )); ndev->vqs =kcalloc (max_vqs,sizeof (*ndev->vqs),GFP_KERNEL ); ndev->event_cbs =kcalloc (max_vqs +1 ,sizeof (*ndev->event_cbs),GFP_KERNEL );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 260/486 cpuidle: menu: Avoid discarding useful information
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 85975daeaa4d6ec560bfcd354fc9c08ad7f38888 ]
When giving up on making a high-confidence prediction, get_typical_interval() always returns UINT_MAX which means that the next idle interval prediction will be based entirely on the time till the next timer. However, the information represented by the most recent intervals may not be completely useless in those cases.
Namely, the largest recent idle interval is an upper bound on the recently observed idle duration, so it is reasonable to assume that the next idle duration is unlikely to exceed it. Moreover, this is still true after eliminating the suspected outliers if the sample set still under consideration is at least as large as 50% of the maximum sample set size.
Accordingly, make get_typical_interval() return the current maximum recent interval value in that case instead of UINT_MAX.
--- drivers/cpuidle/governors/menu.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/cpuidle/governors/menu.c +12 -1
@@ -239,8 +239,19 @@ static unsigned int get_typical_interval(struct menu_device *data)* This can deal with workloads that have long pauses interspersed * with sporadic activity with a bunch of short pauses. */ -if ((divisor *4 ) <=INTERVALS *3 ) +if (divisor *4 <=INTERVALS *3 ) { +/* +* If there are sufficiently many data points still under +* consideration after the outliers have been eliminated, +* returning without a prediction would be a mistake because it +* is likely that the next interval will not exceed the current +* maximum, so return the latter in that case. +*/ +if (divisor >=INTERVALS /2 ) +return max; +return UINT_MAX ; + } thresh = max -1 ; goto again;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 261/486 media: adv7180: Disable test-pattern control on adv7180
In reply to Sasha LevinFrom: Niklas Söderlund <[email protected]>
[ Upstream commit a980bc5f56b0292336e408f657f79e574e8067c0 ]
The register that enables selecting a test-pattern to be outputted in free-run mode (FREE_RUN_PAT_SEL[2:0]) is only available on adv7280 based devices, not the adv7180 based ones.
Add a flag to mark devices that are capable of generating test-patterns, and those that are not. And only register the control on supported devices.
--- drivers/media/i2c/adv7180.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/media/i2c/adv7180.c +22 -12
@@ -195,6 +195,7 @@ struct adv7180_state;#define ADV7180_FLAG_V2 BIT(1)#define ADV7180_FLAG_MIPI_CSI2 BIT(2)#define ADV7180_FLAG_I2P BIT(3) +#define ADV7180_FLAG_TEST_PATTERN BIT(4)struct adv7180_chip_info {unsigned int flags;
@@ -682,11 +683,15 @@ static int adv7180_init_controls(struct adv7180_state *state) ADV7180_HUE_MAX, 1, ADV7180_HUE_DEF);v4l2_ctrl_new_custom (&state->ctrl_hdl, &adv7180_ctrl_fast_switch,NULL ); -v4l2_ctrl_new_std_menu_items (&state->ctrl_hdl, &adv7180_ctrl_ops, -V4L2_CID_TEST_PATTERN , -ARRAY_SIZE (test_pattern_menu) -1 , -0 ,ARRAY_SIZE (test_pattern_menu) -1 , - test_pattern_menu); +if (state->chip_info->flags &ADV7180_FLAG_TEST_PATTERN ) { +v4l2_ctrl_new_std_menu_items (&state->ctrl_hdl, + &adv7180_ctrl_ops, +V4L2_CID_TEST_PATTERN , +ARRAY_SIZE (test_pattern_menu) -1 , +0 , +ARRAY_SIZE (test_pattern_menu) -1 , + test_pattern_menu); + } state->sd.ctrl_handler = &state->ctrl_hdl;if (state->ctrl_hdl.error) {
@@ -1221,7 +1226,7 @@ static const struct adv7180_chip_info adv7182_info = { };static const struct adv7180_chip_info adv7280_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_I2P , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_I2P |ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1235,7 +1240,8 @@ static const struct adv7180_chip_info adv7280_info = { };static const struct adv7180_chip_info adv7280_m_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 |ADV7180_FLAG_I2P , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 |ADV7180_FLAG_I2P | +ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1256,7 +1262,8 @@ static const struct adv7180_chip_info adv7280_m_info = { };static const struct adv7180_chip_info adv7281_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 | +ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN7) |
@@ -1271,7 +1278,8 @@ static const struct adv7180_chip_info adv7281_info = { };static const struct adv7180_chip_info adv7281_m_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 | +ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1291,7 +1299,8 @@ static const struct adv7180_chip_info adv7281_m_info = { };static const struct adv7180_chip_info adv7281_ma_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 | +ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1316,7 +1325,7 @@ static const struct adv7180_chip_info adv7281_ma_info = { };static const struct adv7180_chip_info adv7282_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_I2P , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_I2P |ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN7) |
@@ -1331,7 +1340,8 @@ static const struct adv7180_chip_info adv7282_info = { };static const struct adv7180_chip_info adv7282_m_info = { - .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 |ADV7180_FLAG_I2P , + .flags =ADV7180_FLAG_V2 |ADV7180_FLAG_MIPI_CSI2 |ADV7180_FLAG_I2P | +ADV7180_FLAG_TEST_PATTERN , .valid_input_mask =BIT (ADV7182_INPUT_CVBS_AIN1 ) |BIT (ADV7182_INPUT_CVBS_AIN2 ) | BIT(ADV7182_INPUT_CVBS_AIN3) |
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 262/486 media: tc358746: improve calculation of the D-PHY timing registers
In reply to Sasha LevinFrom: Matthias Fend <[email protected]>
[ Upstream commit 78d7265e2e1ce349e7f3c6a085f2b66d7b73f4ca ]
When calculating D-PHY registers, using data rates that are not multiples of 16 can lead to precision loss in division operations. This can result in register values that produce timing violations against the MIPI standard.
An example:cfg->hs_clk_rate = 294MHzhf_clk = 18
If the desired value in cfg->init is 100us, which is the minimum allowed value, then the LINEINITCNT register is calculated as 1799. But since the actual clock is 18.375MHz instead of 18MHz, this setting results in a time that is shorter than 100us and thus violates the standard. The correct value for LINEINITCNT would be 1837.
Improve the precision of calculations by using Hz instead of MHz as unit.
--- drivers/media/i2c/tc358746.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/media/i2c/tc358746.c +7 -12
@@ -460,24 +460,20 @@ static int tc358746_apply_misc_config(struct tc358746 *tc358746)return err; } -/* Use MHz as base so the div needs no u64 */ -static u32 tc358746_cfg_to_cnt (unsigned int cfg_val, -unsigned int clk_mhz, -unsigned int time_base) +static u32 tc358746_cfg_to_cnt (unsigned long cfg_val,unsigned long clk_hz, +unsigned long long time_base) { -return DIV_ROUND_UP (cfg_val * clk_mhz, time_base); +return div64_u64 ((u64 )cfg_val * clk_hz + time_base -1 , time_base); } -static u32 tc358746_ps_to_cnt (unsigned int cfg_val, -unsigned int clk_mhz) +static u32 tc358746_ps_to_cnt (unsigned long cfg_val,unsigned long clk_hz) { -return tc358746_cfg_to_cnt (cfg_val, clk_mhz,USEC_PER_SEC ); +return tc358746_cfg_to_cnt (cfg_val, clk_hz,PSEC_PER_SEC ); } -static u32 tc358746_us_to_cnt (unsigned int cfg_val, -unsigned int clk_mhz) +static u32 tc358746_us_to_cnt (unsigned long cfg_val,unsigned long clk_hz) { -return tc358746_cfg_to_cnt (cfg_val, clk_mhz,1 ); +return tc358746_cfg_to_cnt (cfg_val, clk_hz,USEC_PER_SEC ); }static int tc358746_apply_dphy_config (struct tc358746 *tc358746)
@@ -492,7 +488,6 @@ static int tc358746_apply_dphy_config(struct tc358746 *tc358746)/* The hs_byte_clk is also called SYSCLK in the excel sheet */ hs_byte_clk = cfg->hs_clk_rate /8 ; - hs_byte_clk /=HZ_PER_MHZ ; hf_clk = hs_byte_clk /2 ; val =tc358746_us_to_cnt (cfg->init, hf_clk) -1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 263/486 net/mlx5e: Add correct match to check IPSec syndromes for switchdev mode
In reply to Sasha LevinFrom: Jianbo Liu <[email protected]>
[ Upstream commit 85e4a808af2545fefaf18c8fe50071b06fcbdabc ]
In commit dddb49b63d86 ("net/mlx5e: Add IPsec and ASO syndromes check in HW"), IPSec and ASO syndromes checks after decryption for the specified ASO object were added. But they are correct only for eswith in legacy mode. For switchdev mode, metadata register c1 is used to save the mapped id (not ASO object id). So, need to change the match accordingly for the check rules in status table.
--- .../mellanox/mlx5/core/en_accel/ipsec_fs.c | 28 ++++++++++++++----- .../mellanox/mlx5/core/esw/ipsec_fs.c | 13 +++++++++ .../mellanox/mlx5/core/esw/ipsec_fs.h | 5 ++++ include/linux/mlx5/eswitch.h | 2 ++ 4 files changed, 41 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c +21 -7
@@ -165,6 +165,25 @@ static void ipsec_rx_status_pass_destroy(struct mlx5e_ipsec *ipsec,#endif } +static void ipsec_rx_rule_add_match_obj (struct mlx5e_ipsec_sa_entry *sa_entry, +struct mlx5e_ipsec_rx *rx, +struct mlx5_flow_spec *spec) +{ +struct mlx5e_ipsec *ipsec = sa_entry->ipsec; + +if (rx == ipsec->rx_esw) { +mlx5_esw_ipsec_rx_rule_add_match_obj (sa_entry, spec); + }else { +MLX5_SET_TO_ONES (fte_match_param, spec->match_criteria, + misc_parameters_2.metadata_reg_c_2); +MLX5_SET (fte_match_param, spec->match_value, + misc_parameters_2.metadata_reg_c_2, + sa_entry->ipsec_obj_id |BIT (31 )); + + spec->match_criteria_enable |=MLX5_MATCH_MISC_PARAMETERS_2 ; + } +} +static int rx_add_rule_drop_auth_trailer (struct mlx5e_ipsec_sa_entry *sa_entry,struct mlx5e_ipsec_rx *rx) {
@@ -200,11 +219,8 @@ static int rx_add_rule_drop_auth_trailer(struct mlx5e_ipsec_sa_entry *sa_entry,MLX5_SET_TO_ONES (fte_match_param, spec->match_criteria, misc_parameters_2.ipsec_syndrome);MLX5_SET (fte_match_param, spec->match_value, misc_parameters_2.ipsec_syndrome,1 ); -MLX5_SET_TO_ONES (fte_match_param, spec->match_criteria, misc_parameters_2.metadata_reg_c_2); -MLX5_SET (fte_match_param, spec->match_value, - misc_parameters_2.metadata_reg_c_2, - sa_entry->ipsec_obj_id |BIT (31 )); spec->match_criteria_enable =MLX5_MATCH_MISC_PARAMETERS_2 ; +ipsec_rx_rule_add_match_obj (sa_entry, rx, spec); rule =mlx5_add_flow_rules (ft, spec, &flow_act, &dest,1 );if (IS_ERR (rule)) { err =PTR_ERR (rule);
@@ -281,10 +297,8 @@ static int rx_add_rule_drop_replay(struct mlx5e_ipsec_sa_entry *sa_entry, structMLX5_SET_TO_ONES (fte_match_param, spec->match_criteria, misc_parameters_2.metadata_reg_c_4);MLX5_SET (fte_match_param, spec->match_value, misc_parameters_2.metadata_reg_c_4,1 ); -MLX5_SET_TO_ONES (fte_match_param, spec->match_criteria, misc_parameters_2.metadata_reg_c_2); -MLX5_SET (fte_match_param, spec->match_value, misc_parameters_2.metadata_reg_c_2, - sa_entry->ipsec_obj_id |BIT (31 )); spec->match_criteria_enable =MLX5_MATCH_MISC_PARAMETERS_2 ; +ipsec_rx_rule_add_match_obj (sa_entry, rx, spec); rule =mlx5_add_flow_rules (ft, spec, &flow_act, &dest,1 );if (IS_ERR (rule)) { err =PTR_ERR (rule);
drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c +13 -0
@@ -85,6 +85,19 @@ int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,return err; } +void mlx5_esw_ipsec_rx_rule_add_match_obj (struct mlx5e_ipsec_sa_entry *sa_entry, +struct mlx5_flow_spec *spec) +{ +MLX5_SET (fte_match_param, spec->match_criteria, + misc_parameters_2.metadata_reg_c_1, +ESW_IPSEC_RX_MAPPED_ID_MATCH_MASK ); +MLX5_SET (fte_match_param, spec->match_value, + misc_parameters_2.metadata_reg_c_1, + sa_entry->rx_mapped_id <<ESW_ZONE_ID_BITS ); + + spec->match_criteria_enable |=MLX5_MATCH_MISC_PARAMETERS_2 ; +} +void mlx5_esw_ipsec_rx_id_mapping_remove (struct mlx5e_ipsec_sa_entry *sa_entry) {struct mlx5e_ipsec *ipsec = sa_entry->ipsec;
drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h +5 -0
@@ -20,6 +20,8 @@ int mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv *priv, u32 id,void mlx5_esw_ipsec_tx_create_attr_set (struct mlx5e_ipsec *ipsec,struct mlx5e_ipsec_tx_create_attr *attr);void mlx5_esw_ipsec_restore_dest_uplink (struct mlx5_core_dev *mdev); +void mlx5_esw_ipsec_rx_rule_add_match_obj (struct mlx5e_ipsec_sa_entry *sa_entry, +struct mlx5_flow_spec *spec);#else static inline void mlx5_esw_ipsec_rx_create_attr_set (struct mlx5e_ipsec *ipsec,struct mlx5e_ipsec_rx_create_attr *attr) {}
@@ -48,5 +50,8 @@ static inline void mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec *ipsec, struct mlx5e_ipsec_tx_create_attr *attr) {}static inline void mlx5_esw_ipsec_restore_dest_uplink (struct mlx5_core_dev *mdev) {} +static inline void +mlx5_esw_ipsec_rx_rule_add_match_obj (struct mlx5e_ipsec_sa_entry *sa_entry, +struct mlx5_flow_spec *spec) {}#endif /* CONFIG_MLX5_ESWITCH */ #endif /* __MLX5_ESW_IPSEC_FS_H__ */
include/linux/mlx5/eswitch.h +2 -0
@@ -147,6 +147,8 @@ u32 mlx5_eswitch_get_vport_metadata_for_set(struct mlx5_eswitch *esw,/* reuse tun_opts for the mapped ipsec obj id when tun_id is 0 (invalid) */ #define ESW_IPSEC_RX_MAPPED_ID_MASK GENMASK(ESW_TUN_OPTS_BITS - 1, 0) +#define ESW_IPSEC_RX_MAPPED_ID_MATCH_MASK \ + GENMASK(31 - ESW_RESERVED_BITS, ESW_ZONE_ID_BITS)u8 mlx5_eswitch_mode (const struct mlx5_core_dev *dev);u16 mlx5_eswitch_get_total_vports (const struct mlx5_core_dev *dev);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 264/486 scsi: mpi3mr: Update timestamp only for supervisor IOCs
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 83a9d30d29f275571f6e8f879f04b2379be7eb6c ]
The driver issues the time stamp update command periodically. Even if the command fails with supervisor only IOC Status.
Instead check the Non-Supervisor capability bit reported by IOC as part of IOC Facts.
--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +4 -1
@@ -2744,7 +2744,10 @@ static void mpi3mr_watchdog_work(struct work_struct *work)return ; } -if (mrioc->ts_update_counter++ >= mrioc->ts_update_interval) { +if (!(mrioc->facts.ioc_capabilities & +MPI3_IOCFACTS_CAPABILITY_NON_SUPERVISOR_IOC ) && + (mrioc->ts_update_counter++ >= mrioc->ts_update_interval)) { + mrioc->ts_update_counter =0 ;mpi3mr_sync_timestamp (mrioc); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 265/486 loop: check in LO_FLAGS_DIRECT_IO in loop_default_blocksize
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit f6f9e32fe1e454ae8ac0190b2c2bd6074914beec ]
We can't go below the minimum direct I/O size no matter if direct I/O is enabled by passing in an O_DIRECT file descriptor or due to the explicit flag. Now that LO_FLAGS_DIRECT_IO is set earlier after assigning a backing file, loop_default_blocksize can check it instead of the O_DIRECT flag to handle both conditions.
--- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/loop.c +1 -1
@@ -905,7 +905,7 @@ static unsigned int loop_default_blocksize(struct loop_device *lo, struct block_device *backing_bdev) {/* In case of direct I/O, match underlying block size */ -if ((lo->lo_backing_file->f_flags &O_DIRECT ) && backing_bdev) +if ((lo->lo_flags &LO_FLAGS_DIRECT_IO ) && backing_bdev)return bdev_logical_block_size (backing_bdev);return SECTOR_SIZE ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 266/486 libbpf: Fix out-of-bound read
In reply to Sasha LevinFrom: Nandakumar Edamana <[email protected]>
[ Upstream commit 236d3910117e9f97ebf75e511d8bcc950f1a4e5f ]
In set_kcfg_value_str, an untrusted string is accessed with the assumption that it will be at least two characters long due to the presence of checks for opening and closing quotes. But the check for the closing quote (value[len - 1] != '"') misses the fact that it could be checking the opening quote itself in case of an invalid input that consists of just the opening quote.
This commit adds an explicit check to make sure the string is at least two characters long.
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
@@ -2074,7 +2074,7 @@ static int set_kcfg_value_str(struct extern_desc *ext, char *ext_val, } len =strlen (value); -if (value[len -1 ] !='"' ) { +if (len <2 || value[len -1 ] !='"' ) {pr_warn ("extern (kcfg) '%s': invalid string config '%s'\n" , ext->name, value);return -EINVAL ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 267/486 dm: fix unconditional IO throttle caused by REQ_PREFLUSH
In reply to Sasha LevinFrom: Jinliang Zheng <[email protected]>
[ Upstream commit 88f7f56d16f568f19e1a695af34a7f4a6ce537a6 ]
When a bio with REQ_PREFLUSH is submitted to dm, __send_empty_flush() generates a flush_bio with REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC, which causes the flush_bio to be throttled by wbt_wait().
An example from v5.4, similar problem also exists in upstream:
crash> bt 2091206
PID: 2091206 TASK: ffff2050df92a300 CPU: 109 COMMAND: "kworker/u260:0"
#0 [ffff800084a2f7f0] __switch_to at ffff80004008aeb8
#1 [ffff800084a2f820] __schedule at ffff800040bfa0c4
#2 [ffff800084a2f880] schedule at ffff800040bfa4b4
#3 [ffff800084a2f8a0] io_schedule at ffff800040bfa9c4
#4 [ffff800084a2f8c0] rq_qos_wait at ffff8000405925bc
#5 [ffff800084a2f940] wbt_wait at ffff8000405bb3a0
#6 [ffff800084a2f9a0] __rq_qos_throttle at ffff800040592254
#7 [ffff800084a2f9c0] blk_mq_make_request at ffff80004057cf38
#8 [ffff800084a2fa60] generic_make_request at ffff800040570138
#9 [ffff800084a2fae0] submit_bio at ffff8000405703b4
#10 [ffff800084a2fb50] xlog_write_iclog at ffff800001280834 [xfs]
#11 [ffff800084a2fbb0] xlog_sync at ffff800001280c3c [xfs]
#12 [ffff800084a2fbf0] xlog_state_release_iclog at ffff800001280df4 [xfs]
#13 [ffff800084a2fc10] xlog_write at ffff80000128203c [xfs]
#14 [ffff800084a2fcd0] xlog_cil_push at ffff8000012846dc [xfs]
#15 [ffff800084a2fda0] xlog_cil_push_work at ffff800001284a2c [xfs]
#16 [ffff800084a2fdb0] process_one_work at ffff800040111d08
#17 [ffff800084a2fe00] worker_thread at ffff8000401121cc
#18 [ffff800084a2fe70] kthread at ffff800040118de4After commit 2def2845cc33 ("xfs: don't allow log IO to be throttled"), the metadata submitted by xlog_write_iclog() should not be throttled. But due to the existence of the dm layer, throttling flush_bio indirectly causes the metadata bio to be throttled.
Fix this by conditionally adding REQ_IDLE to flush_bio.bi_opf, which makes wbt_should_throttle() return false to avoid wbt_wait().
--- drivers/md/dm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/dm.c +6 -2
@@ -1541,14 +1541,18 @@ static void __send_empty_flush(struct clone_info *ci) {struct dm_table *t = ci->map;struct bio flush_bio; +blk_opf_t opf =REQ_OP_WRITE |REQ_PREFLUSH |REQ_SYNC ; + +if ((ci->io->orig_bio->bi_opf & (REQ_IDLE |REQ_SYNC )) == + (REQ_IDLE |REQ_SYNC )) + opf |=REQ_IDLE ;/* * Use an on-stack bio for this, it's safe since we don't * need to reference it after submit. It's just used as * the basis for the clone(s). */ -bio_init (&flush_bio, ci->io->md->disk->part0,NULL ,0 , -REQ_OP_WRITE |REQ_PREFLUSH |REQ_SYNC ); +bio_init (&flush_bio, ci->io->md->disk->part0,NULL ,0 , opf); ci->bio = &flush_bio; ci->sector_count =0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 268/486 fs/mpage: avoid negative shift for large blocksize
In reply to Sasha LevinFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 86c60efd7c0ede43bd677f2eee1d84200528df1e ]
For large blocksizes the number of block bits is larger than PAGE_SHIFT, so calculate the sector number from the byte offset instead. This is required to enable large folios with buffer-heads.
--- fs/mpage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/mpage.c +2 -2
@@ -181,7 +181,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args)if (folio_buffers (folio)) goto confused; - block_in_file = (sector_t )folio->index << (PAGE_SHIFT - blkbits); + block_in_file =folio_pos (folio) >> blkbits; last_block = block_in_file + args->nr_pages * blocks_per_page; last_block_in_file = (i_size_read (inode) + blocksize -1 ) >> blkbits;if (last_block > last_block_in_file)
@@ -527,7 +527,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc,* The page has no buffers: map it to disk */ BUG_ON (!folio_test_uptodate (folio)); - block_in_file = (sector_t )folio->index << (PAGE_SHIFT - blkbits); + block_in_file =folio_pos (folio) >> blkbits;/* * Whole page beyond EOF? Skip allocating blocks to avoid leaking * space.
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 269/486 scsi: scsi_debug: First fixes for tapes
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit f69da85d5d5cc5b7dfb963a6c6c1ac0dd9002341 ]
Patch includes the following:
- Enable MODE SENSE/SELECT without actual page (to read/write only the Block Descriptor)
- Store the density code and block size in the Block Descriptor (only short version for tapes)
- Fix REWIND not to use the wrong page filling function
--- drivers/scsi/scsi_debug.c | 55 ++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-)
drivers/scsi/scsi_debug.c +49 -6
@@ -173,6 +173,10 @@ static const char *sdebug_version_date = "20210520";#define DEF_ZBC_MAX_OPEN_ZONES 8#define DEF_ZBC_NR_CONV_ZONES 1 +/* Default parameters for tape drives */ +#define TAPE_DEF_DENSITY 0x0 +#define TAPE_DEF_BLKSIZE 0 +#define SDEBUG_LUN_0_VAL 0/* bit mask values for sdebug_opts */
@@ -363,6 +367,10 @@ struct sdebug_dev_info {ktime_t create_ts;/* time since bootup that this device was created */ struct sdeb_zone_state *zstate; +/* For tapes */ +unsigned int tape_blksize; +unsigned int tape_density; +struct dentry *debugfs_entry;struct spinlock list_lock;struct list_head inject_err_list;
@@ -773,7 +781,7 @@ static const struct opcode_info_t opcode_info_arr[SDEB_I_LAST_ELEM_P1 + 1] = {/* 20 */ {0 ,0x1e ,0 ,0 ,NULL ,NULL ,/* ALLOW REMOVAL */ {6, 0, 0, 0, 0x3, 0xc7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, - {0, 0x1, 0, 0, resp_start_stop, NULL, /* REWIND ?? */ + {0, 0x1, 0, 0, NULL, NULL, /* REWIND ?? */ {6, 0x1, 0, 0, 0, 0xc7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, {0, 0, 0, F_INV_OP | FF_RESPOND, NULL, NULL, /* ATA_PT */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
@@ -2742,7 +2750,7 @@ static int resp_mode_sense(struct scsi_cmnd *scp,unsigned char *ap; unsigned char *arr __free(kfree);unsigned char *cmd = scp->cmnd; -bool dbd, llbaa, msense_6, is_disk, is_zbc; +bool dbd, llbaa, msense_6, is_disk, is_zbc, is_tape; arr =kzalloc (SDEBUG_MAX_MSENSE_SZ ,GFP_ATOMIC );if (!arr)
@@ -2755,7 +2763,8 @@ static int resp_mode_sense(struct scsi_cmnd *scp, llbaa = msense_6 ? false : !!(cmd[1 ] &0x10 ); is_disk = (sdebug_ptype ==TYPE_DISK ); is_zbc = devip->zoned; -if ((is_disk || is_zbc) && !dbd) + is_tape = (sdebug_ptype ==TYPE_TAPE ); +if ((is_disk || is_zbc || is_tape) && !dbd) bd_len = llbaa ?16 :8 ;else bd_len =0 ;
@@ -2793,15 +2802,25 @@ static int resp_mode_sense(struct scsi_cmnd *scp,put_unaligned_be32 (0xffffffff , ap +0 ); else put_unaligned_be32(sdebug_capacity, ap + 0); -put_unaligned_be16 (sdebug_sector_size, ap +6 ); +if (is_tape) { + ap[0 ] = devip->tape_density; +put_unaligned_be16 (devip->tape_blksize, ap +6 ); + }else +put_unaligned_be16 (sdebug_sector_size, ap +6 ); offset += bd_len; ap = arr + offset; }else if (16 == bd_len) { +if (is_tape) { +mk_sense_invalid_fld (scp,SDEB_IN_DATA ,1 ,4 ); +return check_condition_result; + }put_unaligned_be64 ((u64 )sdebug_capacity, ap +0 );put_unaligned_be32 (sdebug_sector_size, ap +12 ); offset += bd_len; ap = arr + offset; } +if (cmd[2 ] ==0 ) + goto only_bd;/* Only block descriptor requested */ /* * N.B. If len>0 before resp_*_pg() call, then form of that call should be:
@@ -2902,6 +2921,7 @@ static int resp_mode_sense(struct scsi_cmnd *scp,default : goto bad_pcode; } +only_bd:if (msense_6) arr[0 ] = offset -1 ;else
@@ -2945,8 +2965,27 @@ static int resp_mode_select(struct scsi_cmnd *scp, __func__, param_len, res); md_len = mselect6 ? (arr[0 ] +1 ) : (get_unaligned_be16 (arr +0 ) +2 ); bd_len = mselect6 ? arr[3 ] :get_unaligned_be16 (arr +6 ); - off = bd_len + (mselect6 ?4 :8 ); -if (md_len >2 || off >= res) { + off = (mselect6 ?4 :8 ); +if (sdebug_ptype ==TYPE_TAPE ) { +int blksize; + +if (bd_len !=8 ) { +mk_sense_invalid_fld (scp,SDEB_IN_DATA , + mselect6 ?3 :6 ,-1 ); +return check_condition_result; + } + blksize =get_unaligned_be16 (arr + off +6 ); +if ((blksize %4 ) !=0 ) { +mk_sense_invalid_fld (scp,SDEB_IN_DATA , off +6 ,-1 ); +return check_condition_result; + } + devip->tape_density = arr[off]; + devip->tape_blksize = blksize; + } + off += bd_len; +if (off >= res) +return 0 ;/* No page written, just descriptors */ +if (md_len >2 ) {mk_sense_invalid_fld (scp,SDEB_IN_DATA ,0 ,-1 );return check_condition_result; }
@@ -5835,6 +5874,10 @@ static struct sdebug_dev_info *sdebug_device_create( }else { devip->zoned = false; } +if (sdebug_ptype ==TYPE_TAPE ) { + devip->tape_density =TAPE_DEF_DENSITY ; + devip->tape_blksize =TAPE_DEF_BLKSIZE ; + } devip->create_ts =ktime_get_boottime ();atomic_set (&devip->stopped, (sdeb_tur_ms_to_ready >0 ?2 :0 ));spin_lock_init (&devip->list_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 270/486 net/mlx5: Change POOL_NEXT_SIZE define value and make it global
In reply to Sasha LevinFrom: Patrisious Haddad <[email protected]>
[ Upstream commit 80df31f384b4146a62a01b3d4beb376cc7b9a89e ]
Change POOL_NEXT_SIZE define value from 0 to BIT(30), since this define is used to request the available maximum sized flow table, and zero doesn't make sense for it, whereas some places in the driver use zero explicitly expecting the smallest table size possible but instead due to this define they end up allocating the biggest table size unawarely.
In addition move the definition to "include/linux/mlx5/fs.h" to expose the define to IB driver as well, while appropriately renaming it.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c | 6 ++++-- drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h | 2 -- drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c | 3 ++- include/linux/mlx5/fs.h | 2 ++ 5 files changed, 9 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +1 -1
@@ -96,7 +96,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw)if (!flow_group_in)return -ENOMEM ; - ft_attr.max_fte =POOL_NEXT_SIZE ; + ft_attr.max_fte =MLX5_FS_MAX_POOL_SIZE ; ft_attr.prio =LEGACY_FDB_PRIO ; fdb =mlx5_create_flow_table (root_ns, &ft_attr);if (IS_ERR (fdb)) {
drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c +4 -2
@@ -50,10 +50,12 @@ mlx5_ft_pool_get_avail_sz(struct mlx5_core_dev *dev, enum fs_flow_table_type tabint i, found_i =-1 ;for (i =ARRAY_SIZE (FT_POOLS ) -1 ; i >=0 ; i--) { -if (dev->priv.ft_pool->ft_left[i] &&FT_POOLS [i] >= desired_size && +if (dev->priv.ft_pool->ft_left[i] && + (FT_POOLS [i] >= desired_size || + desired_size ==MLX5_FS_MAX_POOL_SIZE ) &&FT_POOLS [i] <= max_ft_size) { found_i = i; -if (desired_size !=POOL_NEXT_SIZE ) +if (desired_size !=MLX5_FS_MAX_POOL_SIZE )break ; } }
drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h +0 -2
@@ -7,8 +7,6 @@#include <linux/mlx5/driver.h> #include "fs_core.h" -#define POOL_NEXT_SIZE 0 -int mlx5_ft_pool_init (struct mlx5_core_dev *dev);void mlx5_ft_pool_destroy (struct mlx5_core_dev *dev);
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +2 -1
@@ -161,7 +161,8 @@ mlx5_chains_create_table(struct mlx5_fs_chains *chains, ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |MLX5_FLOW_TABLE_TUNNEL_EN_DECAP ); - sz = (chain ==mlx5_chains_get_nf_ft_chain (chains)) ?FT_TBL_SZ :POOL_NEXT_SIZE ; + sz = (chain ==mlx5_chains_get_nf_ft_chain (chains)) ? +FT_TBL_SZ :MLX5_FS_MAX_POOL_SIZE ; ft_attr.max_fte = sz;/* We use chains_default_ft(chains) as the table's next_ft till
include/linux/mlx5/fs.h +2 -0
@@ -40,6 +40,8 @@#define MLX5_SET_CFG (p, f, v) MLX5_SET(create_flow_group_in, p, f, v) +#define MLX5_FS_MAX_POOL_SIZE BIT(30) +enum mlx5_flow_destination_type {MLX5_FLOW_DESTINATION_TYPE_NONE ,MLX5_FLOW_DESTINATION_TYPE_VPORT ,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 271/486 x86/kaslr: Reduce KASLR entropy on most x86 systems
In reply to Sasha LevinFrom: Balbir Singh <[email protected]>
[ Upstream commit 7ffb791423c7c518269a9aad35039ef824a40adb ]
When CONFIG_PCI_P2PDMA=y (which is basically enabled on all large x86 distros), it maps the PFN's via a ZONE_DEVICE mapping using devm_memremap_pages(). The mapped virtual address range corresponds to the pci_resource_start() of the BAR address and size corresponding to the BAR length.
When KASLR is enabled, the direct map range of the kernel is reduced to the size of physical memory plus additional padding. If the BAR address is beyond this limit, PCI peer to peer DMA mappings fail.
Fix this by not shrinking the size of the direct map when CONFIG_PCI_P2PDMA=y.
This reduces the total available entropy, but it's better than the current work around of having to disable KASLR completely.
[ mingo: Clarified the changelog to point out the broad impact ... ]
--
arch/x86/mm/kaslr.c | 10 ++++++++-- drivers/pci/Kconfig | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
--- arch/x86/mm/kaslr.c | 10 ++++++++-- drivers/pci/Kconfig | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
arch/x86/mm/kaslr.c +8 -2
@@ -109,8 +109,14 @@ void __init kernel_randomize_memory(void) memory_tb =DIV_ROUND_UP (max_pfn <<PAGE_SHIFT ,1UL <<TB_SHIFT ) +CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING ; -/* Adapt physical memory region size based on available memory */ -if (memory_tb < kaslr_regions[0 ].size_tb) +/* +* Adapt physical memory region size based on available memory, +* except when CONFIG_PCI_P2PDMA is enabled. P2PDMA exposes the +* device BAR space assuming the direct map space is large enough +* for creating a ZONE_DEVICE mapping in the direct map corresponding +* to the physical BAR address. +*/ +if (!IS_ENABLED (CONFIG_PCI_P2PDMA ) && (memory_tb < kaslr_regions[0 ].size_tb)) kaslr_regions[0 ].size_tb = memory_tb;/*
drivers/pci/Kconfig +6 -0
@@ -194,6 +194,12 @@ config PCI_P2PDMA P2P DMA transactions must be between devices behind the same root port. + Enabling this option will reduce the entropy of x86 KASLR memory + regions. For example - on a 46 bit system, the entropy goes down + from 16 bits to 15 bits. The actual reduction in entropy depends + on the physical address bits, on processor features, kernel config + (5 level page table) and physical memory present on the system. + If unsure, say N. config PCI_LABEL
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 272/486 crypto: ahash - Set default reqsize from ahash_alg
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
[ Upstream commit 9e01aaa1033d6e40f8d7cf4f20931a61ce9e3f04 ]
Add a reqsize field to struct ahash_alg and use it to set the default reqsize so that algorithms with a static reqsize are not forced to create an init_tfm function.
--- crypto/ahash.c | 4 ++++ include/crypto/hash.h | 3 +++ 2 files changed, 7 insertions(+)
crypto/ahash.c +4 -0
@@ -473,6 +473,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)struct ahash_alg *alg =crypto_ahash_alg (hash);crypto_ahash_set_statesize (hash, alg->halg.statesize); +crypto_ahash_set_reqsize (hash, alg->reqsize);if (tfm->__crt_alg->cra_type == &crypto_shash_type)return crypto_init_ahash_using_shash (tfm);
@@ -638,6 +639,9 @@ static int ahash_prepare_alg(struct ahash_alg *alg)if (alg->halg.statesize ==0 )return -EINVAL ; +if (alg->reqsize && alg->reqsize < alg->halg.statesize) +return -EINVAL ; + err =hash_prepare_alg (&alg->halg);if (err)return err;
include/crypto/hash.h +3 -0
@@ -132,6 +132,7 @@ struct ahash_request {* This is a counterpart to @init_tfm, used to remove * various changes set in @init_tfm. * @clone_tfm: Copy transform into new object, may allocate memory. +* @reqsize: Size of the request context. * @halg: see struct hash_alg_common */ struct ahash_alg {
@@ -148,6 +149,8 @@ struct ahash_alg {void (*exit_tfm)(struct crypto_ahash *tfm);int (*clone_tfm)(struct crypto_ahash *dst,struct crypto_ahash *src); +unsigned int reqsize; +struct hash_alg_common halg; };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 273/486 crypto: skcipher - Zap type in crypto_alloc_sync_skcipher
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
[ Upstream commit ee509efc74ddbc59bb5d6fd6e050f9ef25f74bff ]
The type needs to be zeroed as otherwise the user could use it to allocate an asynchronous sync skcipher.
--- crypto/skcipher.c | 1 + 1 file changed, 1 insertion(+)
crypto/skcipher.c +1 -0
@@ -844,6 +844,7 @@ struct crypto_sync_skcipher *crypto_alloc_sync_skcipher(/* Only sync algorithms allowed. */ mask |=CRYPTO_ALG_ASYNC |CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE ; + type &= ~(CRYPTO_ALG_ASYNC |CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE ); tfm =crypto_alloc_tfm (alg_name, &crypto_skcipher_type, type, mask);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 274/486 net: ipv6: Init tunnel link-netns before registering dev
In reply to Sasha LevinFrom: Xiao Liang <[email protected]>
[ Upstream commit db014522f35606031d8ac58b4aed6b1ed84f03d1 ]
Currently some IPv6 tunnel drivers set tnl->net to dev_net(dev) in ndo_init(), which is called in register_netdevice(). However, it lacks the context of link-netns when we enable cross-net tunnels at device registration time.
Let's move the init of tunnel link-netns before register_netdevice().
ip6_gre has already initialized netns, so just remove the redundant assignment.
--- net/ipv6/ip6_gre.c | 2 -- net/ipv6/ip6_tunnel.c | 3 ++- net/ipv6/ip6_vti.c | 3 ++- net/ipv6/sit.c | 8 +++++--- 4 files changed, 9 insertions(+), 7 deletions(-)
net/ipv6/ip6_gre.c +0 -2
@@ -1498,7 +1498,6 @@ static int ip6gre_tunnel_init_common(struct net_device *dev) tunnel =netdev_priv (dev); tunnel->dev = dev; - tunnel->net =dev_net (dev);strcpy (tunnel->parms.name, dev->name); ret =dst_cache_init (&tunnel->dst_cache,GFP_KERNEL );
@@ -1882,7 +1881,6 @@ static int ip6erspan_tap_init(struct net_device *dev) tunnel =netdev_priv (dev); tunnel->dev = dev; - tunnel->net =dev_net (dev);strcpy (tunnel->parms.name, dev->name); ret =dst_cache_init (&tunnel->dst_cache,GFP_KERNEL );
net/ipv6/ip6_tunnel.c +2 -1
@@ -1878,7 +1878,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev)int t_hlen; t->dev = dev; - t->net =dev_net (dev); ret =dst_cache_init (&t->dst_cache,GFP_KERNEL );if (ret)
@@ -1940,6 +1939,7 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)struct net *net =dev_net (dev);struct ip6_tnl_net *ip6n =net_generic (net, ip6_tnl_net_id); + t->net = net; t->parms.proto =IPPROTO_IPV6 ;rcu_assign_pointer (ip6n->tnls_wc[0 ], t);
@@ -2013,6 +2013,7 @@ static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev,int err; nt =netdev_priv (dev); + nt->net = net;if (ip_tunnel_netlink_encap_parms (data, &ipencap)) { err =ip6_tnl_encap_setup (nt, &ipencap);
net/ipv6/ip6_vti.c +2 -1
@@ -925,7 +925,6 @@ static inline int vti6_dev_init_gen(struct net_device *dev)struct ip6_tnl *t =netdev_priv (dev); t->dev = dev; - t->net =dev_net (dev);netdev_hold (dev, &t->dev_tracker,GFP_KERNEL );netdev_lockdep_set_classes (dev);return 0 ;
@@ -958,6 +957,7 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev)struct net *net =dev_net (dev);struct vti6_net *ip6n =net_generic (net, vti6_net_id); + t->net = net; t->parms.proto =IPPROTO_IPV6 ;rcu_assign_pointer (ip6n->tnls_wc[0 ], t);
@@ -1008,6 +1008,7 @@ static int vti6_newlink(struct net *src_net, struct net_device *dev,vti6_netlink_parms (data, &nt->parms); nt->parms.proto =IPPROTO_IPV6 ; + nt->net = net;if (vti6_locate (net, &nt->parms,0 ))return -EEXIST ;
net/ipv6/sit.c +5 -3
@@ -269,6 +269,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, nt =netdev_priv (dev); + nt->net = net; nt->parms = *parms;if (ipip6_tunnel_create (dev) <0 ) goto failed_free;
@@ -1449,7 +1450,6 @@ static int ipip6_tunnel_init(struct net_device *dev)int err; tunnel->dev = dev; - tunnel->net =dev_net (dev);strcpy (tunnel->parms.name, dev->name);ipip6_tunnel_bind_dev (dev);
@@ -1563,6 +1563,7 @@ static int ipip6_newlink(struct net *src_net, struct net_device *dev,int err; nt =netdev_priv (dev); + nt->net = net;if (ip_tunnel_netlink_encap_parms (data, &ipencap)) { err =ip_tunnel_encap_setup (nt, &ipencap);
@@ -1858,6 +1859,9 @@ static int __net_init sit_init_net(struct net *net)*/ sitn->fb_tunnel_dev->netns_local = true; + t =netdev_priv (sitn->fb_tunnel_dev); + t->net = net; + err =register_netdev (sitn->fb_tunnel_dev);if (err) goto err_reg_dev;
@@ -1865,8 +1869,6 @@ static int __net_init sit_init_net(struct net *net)ipip6_tunnel_clone_6rd (sitn->fb_tunnel_dev, sitn);ipip6_fb_tunnel_init (sitn->fb_tunnel_dev); - t =netdev_priv (sitn->fb_tunnel_dev); -strcpy (t->parms.name, sitn->fb_tunnel_dev->name);return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 275/486 drm/xe/oa: Ensure that polled read returns latest data
In reply to Sasha LevinFrom: Umesh Nerlige Ramappa <[email protected]>
[ Upstream commit 98c9d27ab30aa9c6451d3a34e6e297171f273e51 ]
In polled mode, user calls poll() for read data to be available before performing a read(). In the duration between these 2 calls, there may be new data available in the OA buffer. To ensure user reads all available data, check for latest data in the OA buffer in polled read.
--- drivers/gpu/drm/xe/xe_oa.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_oa.c +1 -0
@@ -535,6 +535,7 @@ static ssize_t xe_oa_read(struct file *file, char __user *buf,mutex_unlock (&stream->stream_lock); }while (!offset && !ret); }else { +xe_oa_buffer_check_unlocked (stream);mutex_lock (&stream->stream_lock); ret =__xe_oa_read (stream, buf, count, &offset);mutex_unlock (&stream->stream_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 276/486 MIPS: Use arch specific syscall name match function
In reply to Sasha LevinFrom: Bibo Mao <[email protected]>
[ Upstream commit 756276ce78d5624dc814f9d99f7d16c8fd51076e ]
On MIPS system, most of the syscall function name begin with prefix sys_. Some syscalls are special such as clone/fork, function name of these begin with __sys_. Since scratch registers need be saved in stack when these system calls happens.
With ftrace system call method, system call functions are declared with SYSCALL_DEFINEx, metadata of the system call symbol name begins with sys_. Here mips specific function arch_syscall_match_sym_name is used to compare function name between sys_call_table[] and metadata of syscall symbol.
--- arch/mips/include/asm/ftrace.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/mips/include/asm/ftrace.h +16 -0
@@ -91,4 +91,20 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,#endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ + +#ifdef CONFIG_FTRACE_SYSCALLS +#ifndef __ASSEMBLY__ +/* +* Some syscall entry functions on mips start with "__sys_" (fork and clone, +* for instance). We should also match the sys_ variant with those. +*/ +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +return !strcmp (sym, name) || + (!strncmp (sym,"__sys_" ,6 ) && !strcmp (sym +6 , name +4 )); +} +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_FTRACE_SYSCALLS */ #endif /* _ASM_MIPS_FTRACE_H */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 277/486 drm/amdgpu: remove all KFD fences from the BO on release
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit cb0de06d1b0afb2d0c600ad748069f5ce27730ec ]
Remove all KFD BOs from the private dma_resv object.
This prevents the KFD from being evict unecessarily when an exported BO is released.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 5 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 52 ++++++++----------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 38 ++++++++------ 3 files changed, 47 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +2 -3
@@ -192,7 +192,7 @@ int kfd_debugfs_kfd_mem_limits(struct seq_file *m, void *data);#if IS_ENABLED (CONFIG_HSA_AMD )bool amdkfd_fence_check_mm (struct dma_fence *f,struct mm_struct *mm);struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence (struct dma_fence *f); -int amdgpu_amdkfd_remove_fence_on_pt_pd_bos (struct amdgpu_bo *bo); +void amdgpu_amdkfd_remove_all_eviction_fences (struct amdgpu_bo *bo);int amdgpu_amdkfd_evict_userptr (struct mmu_interval_notifier *mni,unsigned long cur_seq,struct kgd_mem *mem); int amdgpu_amdkfd_bo_validate_and_fence(struct amdgpu_bo *bo,
@@ -212,9 +212,8 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f) }static inline -int amdgpu_amdkfd_remove_fence_on_pt_pd_bos (struct amdgpu_bo *bo) +void amdgpu_amdkfd_remove_all_eviction_fences (struct amdgpu_bo *bo) { -return 0 ; } static inline
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +22 -30
62 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +23 -15
@@ -1246,28 +1246,36 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo)if (abo->kfd_bo)amdgpu_amdkfd_release_notify (abo); -/* We only remove the fence if the resv has individualized. */ -WARN_ON_ONCE (bo->type == ttm_bo_type_kernel - && bo->base.resv != &bo->base._resv); -if (bo->base.resv == &bo->base._resv) -amdgpu_amdkfd_remove_fence_on_pt_pd_bos (abo); +/* +* We lock the private dma_resv object here and since the BO is about to +* be released nobody else should have a pointer to it. +* So when this locking here fails something is wrong with the reference +* counting. +*/ +if (WARN_ON_ONCE (!dma_resv_trylock (&bo->base._resv))) +return ; + +amdgpu_amdkfd_remove_all_eviction_fences (abo);if (!bo->resource || bo->resource->mem_type !=TTM_PL_VRAM || !(abo->flags &AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE ) || adev->in_suspend ||drm_dev_is_unplugged (adev_to_drm (adev))) -return ; + goto out; -if (WARN_ON_ONCE (!dma_resv_trylock (bo->base.resv))) -return ; + r =dma_resv_reserve_fences (&bo->base._resv,1 ); +if (r) + goto out; - r =amdgpu_fill_buffer (abo,0 , bo->base.resv, &fence, true); -if (!WARN_ON (r)) { -amdgpu_vram_mgr_set_cleared (bo->resource); -amdgpu_bo_fence (abo, fence, false); -dma_fence_put (fence); - } + r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true); +if (WARN_ON (r)) + goto out; + +amdgpu_vram_mgr_set_cleared (bo->resource); +dma_resv_add_fence (&bo->base._resv, fence,DMA_RESV_USAGE_KERNEL ); +dma_fence_put (fence); -dma_resv_unlock (bo->base.resv); +out: +dma_resv_unlock (&bo->base._resv); }/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 278/486 x86/locking: Use ALT_OUTPUT_SP() for percpu_{,try_}cmpxchg{64,128}_op()
In reply to Sasha LevinFrom: Uros Bizjak <[email protected]>
[ Upstream commit 4087e16b033140cf2ce509ec23503bddec818a16 ]
percpu_{,try_}cmpxchg{64,128}() macros use CALL instruction inside asm statement in one of their alternatives. Use ALT_OUTPUT_SP() macro to add required dependence on %esp register.
ALT_OUTPUT_SP() implements the above dependence by adding ASM_CALL_CONSTRAINT to its arguments. This constraint should be used for any inline asm which has a CALL instruction, otherwise the compiler may schedule the asm before the frame pointer gets set up by the containing function, causing objtool to print a "call without frame pointer save/setup" warning.
--- arch/x86/include/asm/percpu.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
arch/x86/include/asm/percpu.h +14 -14
@@ -349,9 +349,9 @@ do { \ \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \ "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \ - : [var] "+m" (__my_cpu_var(_var)), \ - "+a" (old__.low), \ - "+d" (old__.high) \ + : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \ + "+a" (old__.low), \ + "+d" (old__.high)) \ : "b" (new__.low), \"c" (new__.high), \"S" (&(_var)) \
@@ -380,10 +380,10 @@ do { \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \ "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \ CC_SET(z) \ - : CC_OUT(z) (success), \ - [var] "+m" (__my_cpu_var(_var)), \ -" +a" (old__.low), \ -" +d" (old__.high) \ + : ALT_OUTPUT_SP(CC_OUT(z) (success), \ + [var] "+m" (__my_cpu_var(_var)), \ +" +a" (old__.low), \ +" +d" (old__.high)) \ : " b" (new__.low), \ " c" (new__.high), \ "S" (&(_var)) \
@@ -420,9 +420,9 @@ do { \ \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg16b_emu", \ "cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \ - : [var] "+m" (__my_cpu_var(_var)), \ - "+a" (old__.low), \ - "+d" (old__.high) \ + : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \ + "+a" (old__.low), \ + "+d" (old__.high)) \ : "b" (new__.low), \"c" (new__.high), \"S" (&(_var)) \
@@ -451,10 +451,10 @@ do { \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg16b_emu", \ "cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \ CC_SET(z) \ - : CC_OUT(z) (success), \ - [var] "+m" (__my_cpu_var(_var)), \ -" +a" (old__.low), \ -" +d" (old__.high) \ + : ALT_OUTPUT_SP(CC_OUT(z) (success), \ + [var] "+m" (__my_cpu_var(_var)), \ +" +a" (old__.low), \ +" +d" (old__.high)) \ : " b" (new__.low), \ " c" (new__.high), \ "S" (&(_var)) \
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 279/486 genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 1f7df3a691740a7736bbc99dc4ed536120eb4746 ]
The IOMMU translation for MSI message addresses has been a 2-step process, separated in time:
1) iommu_dma_prepare_msi(): A cookie pointer containing the IOVA address is stored in the MSI descriptor when an MSI interrupt is allocated.
2) iommu_dma_compose_msi_msg(): this cookie pointer is used to compute a translated message address.
This has an inherent lifetime problem for the pointer stored in the cookie that must remain valid between the two steps. However, there is no locking at the irq layer that helps protect the lifetime. Today, this works under the assumption that the iommu domain is not changed while MSI interrupts being programmed. This is true for normal DMA API users within the kernel, as the iommu domain is attached before the driver is probed and cannot be changed while a driver is attached.
Classic VFIO type1 also prevented changing the iommu domain while VFIO was running as it does not support changing the "container" after starting up.
However, iommufd has improved this so that the iommu domain can be changed during VFIO operation. This potentially allows userspace to directly race VFIO_DEVICE_ATTACH_IOMMUFD_PT (which calls iommu_attach_group()) and VFIO_DEVICE_SET_IRQS (which calls into iommu_dma_compose_msi_msg()).
This potentially causes both the cookie pointer and the unlocked call to iommu_get_domain_for_dev() on the MSI translation path to become UAFs.
Fix the MSI cookie UAF by removing the cookie pointer. The translated IOVA address is already known during iommu_dma_prepare_msi() and cannot change. Thus, it can simply be stored as an integer in the MSI descriptor.
The other UAF related to iommu_get_domain_for_dev() will be addressed in patch "iommu: Make iommu_dma_prepare_msi() into a generic operation" by using the IOMMU group mutex.
--- drivers/iommu/dma-iommu.c | 28 +++++++++++++--------------- include/linux/msi.h | 33 ++++++++++++--------------------- 2 files changed, 25 insertions(+), 36 deletions(-)
drivers/iommu/dma-iommu.c +13 -15
@@ -1815,7 +1815,7 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)static DEFINE_MUTEX (msi_prepare_lock);/* see below */ if (!domain || !domain->iova_cookie) { - desc->iommu_cookie =NULL ; +msi_desc_set_iommu_msi_iova (desc,0 ,0 );return 0 ; }
@@ -1827,11 +1827,12 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)mutex_lock (&msi_prepare_lock); msi_page =iommu_dma_get_msi_page (dev, msi_addr, domain);mutex_unlock (&msi_prepare_lock); - -msi_desc_set_iommu_cookie (desc, msi_page); -if (!msi_page)return -ENOMEM ; + +msi_desc_set_iommu_msi_iova ( + desc, msi_page->iova, +ilog2 (cookie_msi_granule (domain->iova_cookie)));return 0 ; }
@@ -1842,18 +1843,15 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)*/ void iommu_dma_compose_msi_msg (struct msi_desc *desc,struct msi_msg *msg) { -struct device *dev =msi_desc_to_dev (desc); -const struct iommu_domain *domain =iommu_get_domain_for_dev (dev); -const struct iommu_dma_msi_page *msi_page; +#ifdef CONFIG_IRQ_MSI_IOMMU +if (desc->iommu_msi_shift) { +u64 msi_iova = desc->iommu_msi_iova << desc->iommu_msi_shift; - msi_page =msi_desc_get_iommu_cookie (desc); - -if (!domain || !domain->iova_cookie ||WARN_ON (!msi_page)) -return ; - - msg->address_hi =upper_32_bits (msi_page->iova); - msg->address_lo &=cookie_msi_granule (domain->iova_cookie) -1 ; - msg->address_lo +=lower_32_bits (msi_page->iova); + msg->address_hi =upper_32_bits (msi_iova); + msg->address_lo =lower_32_bits (msi_iova) | + (msg->address_lo & ((1 << desc->iommu_msi_shift) -1 )); + } +#endif }static int iommu_dma_init (void )
include/linux/msi.h +12 -21
@@ -165,6 +165,10 @@ struct msi_desc_data {* @dev: Pointer to the device which uses this descriptor * @msg: The last set MSI message cached for reuse * @affinity: Optional pointer to a cpu affinity mask for this descriptor +* @iommu_msi_iova: Optional shifted IOVA from the IOMMU to override the msi_addr. +* Only used if iommu_msi_shift != 0 +* @iommu_msi_shift: Indicates how many bits of the original address should be +* preserved when using iommu_msi_iova. * @sysfs_attr: Pointer to sysfs device attribute * * @write_msi_msg: Callback that may be called when the MSI message
@@ -183,7 +187,8 @@ struct msi_desc {struct msi_msg msg;struct irq_affinity_desc *affinity;#ifdef CONFIG_IRQ_MSI_IOMMU -const void *iommu_cookie; + u64 iommu_msi_iova : 58; + u64 iommu_msi_shift : 6;#endif #ifdef CONFIG_SYSFS struct device_attribute *sysfs_attrs;
@@ -284,28 +289,14 @@ struct msi_desc *msi_next_desc(struct device *dev, unsigned int domid,#define msi_desc_to_dev (desc) ((desc)->dev) -#ifdef CONFIG_IRQ_MSI_IOMMU -static inline const void *msi_desc_get_iommu_cookie (struct msi_desc *desc) -{ -return desc->iommu_cookie; -} - -static inline void msi_desc_set_iommu_cookie (struct msi_desc *desc, -const void *iommu_cookie) -{ - desc->iommu_cookie = iommu_cookie; -} -#else -static inline const void *msi_desc_get_iommu_cookie (struct msi_desc *desc) +static inline void msi_desc_set_iommu_msi_iova (struct msi_desc *desc,u64 msi_iova, +unsigned int msi_shift) { -return NULL ; -} - -static inline void msi_desc_set_iommu_cookie (struct msi_desc *desc, -const void *iommu_cookie) -{ -} +#ifdef CONFIG_IRQ_MSI_IOMMU + desc->iommu_msi_iova = msi_iova >> msi_shift; + desc->iommu_msi_shift = msi_shift;#endif +}int msi_domain_insert_msi_desc (struct device *dev,unsigned int domid,struct msi_desc *init_desc);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 280/486 MIPS: pm-cps: Use per-CPU variables as per-CPU, not per-core
In reply to Sasha LevinFrom: Paul Burton <[email protected]>
[ Upstream commit 00a134fc2bb4a5f8fada58cf7ff4259149691d64 ]
The pm-cps code has up until now used per-CPU variables indexed by core, rather than CPU number, in order to share data amongst sibling CPUs (ie. VPs/threads in a core). This works fine for single cluster systems, but with multi-cluster systems a core number is no longer unique in the system, leading to sharing between CPUs that are not actually siblings.
Avoid this issue by using per-CPU variables as they are more generally used - ie. access them using CPU numbers rather than core numbers. Sharing between siblings is then accomplished by:
- Assigning the same pointer to entries for each sibling CPU for the nc_asm_enter & ready_count variables, which allow this by virtue of being per-CPU pointers.
- Indexing by the first CPU set in a CPUs cpu_sibling_map in the case of pm_barrier, for which we can't use the previous approach because the per-CPU variable is not a pointer.
--- arch/mips/kernel/pm-cps.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
arch/mips/kernel/pm-cps.c +17 -13
@@ -57,10 +57,7 @@ static DEFINE_PER_CPU_ALIGNED(u32*, ready_count);/* Indicates online CPUs coupled with the current CPU */ static DEFINE_PER_CPU_ALIGNED(cpumask_t, online_coupled); -/* -* Used to synchronize entry to deep idle states. Actually per-core rather -* than per-CPU. -*/ +/* Used to synchronize entry to deep idle states */ static DEFINE_PER_CPU_ALIGNED(atomic_t, pm_barrier);/* Saved CPU state across the CPS_PM_POWER_GATED state */
@@ -112,9 +109,10 @@ int cps_pm_enter_state(enum cps_pm_state state)cps_nc_entry_fn entry;struct core_boot_config *core_cfg;struct vpe_boot_config *vpe_cfg; +atomic_t *barrier;/* Check that there is an entry function for this state */ - entry =per_cpu (nc_asm_enter, core)[state]; + entry =per_cpu (nc_asm_enter, cpu)[state];if (!entry)return -EINVAL ;
@@ -150,7 +148,7 @@ int cps_pm_enter_state(enum cps_pm_state state)smp_mb__after_atomic ();/* Create a non-coherent mapping of the core ready_count */ - core_ready_count =per_cpu (ready_count, core); + core_ready_count =per_cpu (ready_count, cpu); nc_addr =kmap_noncoherent (virt_to_page (core_ready_count), (unsigned long )core_ready_count); nc_addr += ((unsigned long )core_ready_count & ~PAGE_MASK );
@@ -158,7 +156,8 @@ int cps_pm_enter_state(enum cps_pm_state state)/* Ensure ready_count is zero-initialised before the assembly runs */ WRITE_ONCE (*nc_core_ready_count,0 ); -coupled_barrier (&per_cpu (pm_barrier, core), online); + barrier = &per_cpu (pm_barrier,cpumask_first (&cpu_sibling_map[cpu])); +coupled_barrier (barrier, online);/* Run the generated entry code */ left =entry (online, nc_core_ready_count);
@@ -629,12 +628,14 @@ static void *cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)static int cps_pm_online_cpu (unsigned int cpu) { -enum cps_pm_state state; -unsigned core =cpu_core (&cpu_data[cpu]); +unsigned int sibling, core;void *entry_fn, *core_rc; +enum cps_pm_state state; + + core =cpu_core (&cpu_data[cpu]);for (state =CPS_PM_NC_WAIT ; state <CPS_PM_STATE_COUNT ; state++) { -if (per_cpu (nc_asm_enter, core)[state]) +if (per_cpu (nc_asm_enter, cpu)[state])continue ;if (!test_bit (state, state_support))continue ;
@@ -646,16 +647,19 @@ static int cps_pm_online_cpu(unsigned int cpu)clear_bit (state, state_support); } -per_cpu (nc_asm_enter, core)[state] = entry_fn; +for_each_cpu (sibling, &cpu_sibling_map[cpu]) +per_cpu (nc_asm_enter, sibling)[state] = entry_fn; } -if (!per_cpu (ready_count, core)) { +if (!per_cpu (ready_count, cpu)) { core_rc =kmalloc (sizeof (u32),GFP_KERNEL );if (!core_rc) {pr_err ("Failed allocate core %u ready_count\n" , core);return -ENOMEM ; } -per_cpu (ready_count, core) = core_rc; + +for_each_cpu (sibling, &cpu_sibling_map[cpu]) +per_cpu (ready_count, sibling) = core_rc; }return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 281/486 clocksource: mips-gic-timer: Enable counter when CPUs start
In reply to Sasha LevinFrom: Paul Burton <[email protected]>
[ Upstream commit 3128b0a2e0cf6e07aa78e5f8cf7dd9cd59dc8174 ]
In multi-cluster MIPS I6500 systems there is a GIC in each cluster, each with its own counter. When a cluster powers up the counter will be stopped, with the COUNTSTOP bit set in the GIC_CONFIG register.
In single cluster systems, it has been fine to clear COUNTSTOP once in gic_clocksource_of_init() to start the counter. In multi-cluster systems, this will only have started the counter in the boot cluster, and any CPUs in other clusters will find their counter stopped which will break the GIC clock_event_device.
Resolve this by having CPUs clear the COUNTSTOP bit when they come online, using the existing gic_starting_cpu() CPU hotplug callback. This will allow CPUs in secondary clusters to ensure that the cluster's GIC counter is running as expected.
--- drivers/clocksource/mips-gic-timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clocksource/mips-gic-timer.c +3 -3
@@ -115,6 +115,9 @@ static void gic_update_frequency(void *data)static int gic_starting_cpu (unsigned int cpu) { +/* Ensure the GIC counter is running */ +clear_gic_config (GIC_CONFIG_COUNTSTOP ); +gic_clockevent_cpu_init (cpu,this_cpu_ptr (&gic_clockevent_device));return 0 ; }
@@ -252,9 +255,6 @@ static int __init gic_clocksource_of_init(struct device_node *node)pr_warn ("Unable to register clock notifier\n" ); } -/* And finally start the counter */ -clear_gic_config (GIC_CONFIG_COUNTSTOP ); -/* * It's safe to use the MIPS GIC timer as a sched clock source only if * its ticks are stable, which is true on either the platforms with
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 282/486 PCI: epf-mhi: Update device ID for SA8775P
In reply to Sasha LevinFrom: Mrinmay Sarkar <[email protected]>
[ Upstream commit 4f13dd9e2b1d2b317bb36704f8a7bd1d3017f7a2 ]
Update device ID for the Qcom SA8775P SoC.
--- drivers/pci/endpoint/functions/pci-epf-mhi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-mhi.c +1 -1
@@ -125,7 +125,7 @@ static const struct pci_epf_mhi_ep_info sm8450_info = {static struct pci_epf_header sa8775p_header = { .vendorid =PCI_VENDOR_ID_QCOM , - .deviceid =0x0306 ,/* FIXME: Update deviceid for sa8775p EP */ + .deviceid =0x0116 , .baseclass_code =PCI_CLASS_OTHERS , .interrupt_pin =PCI_INTERRUPT_INTA , };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 283/486 scsi: mpt3sas: Send a diag reset if target reset fails
In reply to Sasha LevinFrom: Shivasharan S <[email protected]>
[ Upstream commit 5612d6d51ed2634a033c95de2edec7449409cbb9 ]
When an IOCTL times out and driver issues a target reset, if firmware fails the task management elevate the recovery by issuing a diag reset to controller.
--- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_ctl.c +10 -2
@@ -679,6 +679,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,size_t data_in_sz =0 ;long ret;u16 device_handle =MPT3SAS_INVALID_DEVICE_HANDLE ; +int tm_ret; issue_reset =0 ;
@@ -1120,18 +1121,25 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,if (pcie_device && (!ioc->tm_custom_handling) && (!(mpt3sas_scsih_is_pcie_scsi_device ( pcie_device->device_info)))) -mpt3sas_scsih_issue_locked_tm (ioc, + tm_ret =mpt3sas_scsih_issue_locked_tm (ioc,le16_to_cpu (mpi_request->FunctionDependent1),0 ,0 ,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 , pcie_device->reset_timeout,MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE );else -mpt3sas_scsih_issue_locked_tm (ioc, + tm_ret =mpt3sas_scsih_issue_locked_tm (ioc,le16_to_cpu (mpi_request->FunctionDependent1),0 ,0 ,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 ,30 ,MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET ); + +if (tm_ret !=SUCCESS ) { +ioc_info (ioc, +"target reset failed, issue hard reset: handle (0x%04x)\n" , +le16_to_cpu (mpi_request->FunctionDependent1)); +mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); + } }else mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 284/486 wifi: rtw88: Fix rtw_init_vht_cap() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 6be7544d19fcfcb729495e793bc6181f85bb8949 ]
Set the MCS maps and the highest rates according to the number of spatial streams the chip has. For RTL8814AU that is 3.
--- drivers/net/wireless/realtek/rtw88/main.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +9 -14
@@ -1579,8 +1579,9 @@ static void rtw_init_vht_cap(struct rtw_dev *rtwdev, struct ieee80211_sta_vht_cap *vht_cap) {struct rtw_efuse *efuse = &rtwdev->efuse; -u16 mcs_map; +u16 mcs_map =0 ;__le16 highest; +int i;if (efuse->hw_cap.ptcl !=EFUSE_HW_CAP_IGNORE && efuse->hw_cap.ptcl !=EFUSE_HW_CAP_PTCL_VHT )
@@ -1603,21 +1604,15 @@ static void rtw_init_vht_cap(struct rtw_dev *rtwdev,if (rtw_chip_has_rx_ldpc (rtwdev)) vht_cap->cap |=IEEE80211_VHT_CAP_RXLDPC ; - mcs_map =IEEE80211_VHT_MCS_SUPPORT_0_9 <<0 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<4 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<6 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<8 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<10 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<12 | -IEEE80211_VHT_MCS_NOT_SUPPORTED <<14 ; -if (efuse->hw_cap.nss >1 ) { - highest =cpu_to_le16 (780 ); - mcs_map |=IEEE80211_VHT_MCS_SUPPORT_0_9 <<2 ; - }else { - highest =cpu_to_le16 (390 ); - mcs_map |=IEEE80211_VHT_MCS_NOT_SUPPORTED <<2 ; +for (i =0 ; i <8 ; i++) { +if (i < efuse->hw_cap.nss) + mcs_map |=IEEE80211_VHT_MCS_SUPPORT_0_9 << (i *2 ); +else + mcs_map |=IEEE80211_VHT_MCS_NOT_SUPPORTED << (i *2 ); } + highest =cpu_to_le16 (390 * efuse->hw_cap.nss); + vht_cap->vht_mcs.rx_mcs_map =cpu_to_le16 (mcs_map); vht_cap->vht_mcs.tx_mcs_map =cpu_to_le16 (mcs_map); vht_cap->vht_mcs.rx_highest = highest;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 285/486 wifi: rtw88: Fix rtw_init_ht_cap() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit c7eea1ba05ca5b0dbf77a27cf2e1e6e2fb3c0043 ]
Set the RX mask and the highest RX rate according to the number of spatial streams the chip can receive. For RTL8814AU that is 3.
--- drivers/net/wireless/realtek/rtw88/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +6 -11
@@ -1543,6 +1543,7 @@ static void rtw_init_ht_cap(struct rtw_dev *rtwdev, {const struct rtw_chip_info *chip = rtwdev->chip;struct rtw_efuse *efuse = &rtwdev->efuse; +int i; ht_cap->ht_supported = true; ht_cap->cap =0 ;
@@ -1562,17 +1563,11 @@ static void rtw_init_ht_cap(struct rtw_dev *rtwdev, ht_cap->ampdu_factor =IEEE80211_HT_MAX_AMPDU_64K ; ht_cap->ampdu_density = chip->ampdu_density; ht_cap->mcs.tx_params =IEEE80211_HT_MCS_TX_DEFINED ; -if (efuse->hw_cap.nss >1 ) { - ht_cap->mcs.rx_mask[0 ] =0xFF ; - ht_cap->mcs.rx_mask[1 ] =0xFF ; - ht_cap->mcs.rx_mask[4 ] =0x01 ; - ht_cap->mcs.rx_highest =cpu_to_le16 (300 ); - }else { - ht_cap->mcs.rx_mask[0 ] =0xFF ; - ht_cap->mcs.rx_mask[1 ] =0x00 ; - ht_cap->mcs.rx_mask[4 ] =0x01 ; - ht_cap->mcs.rx_highest =cpu_to_le16 (150 ); - } + +for (i =0 ; i < efuse->hw_cap.nss; i++) + ht_cap->mcs.rx_mask[i] =0xFF ; + ht_cap->mcs.rx_mask[4 ] =0x01 ; + ht_cap->mcs.rx_highest =cpu_to_le16 (150 * efuse->hw_cap.nss); } static void rtw_init_vht_cap(struct rtw_dev *rtwdev,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 286/486 wifi: rtw88: Fix rtw_desc_to_mcsrate() to handle MCS16-31
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 86d04f8f991a0509e318fe886d5a1cf795736c7d ]
This function translates the rate number reported by the hardware into something mac80211 can understand. It was ignoring the 3SS and 4SS HT rates. Translate them too.
Also set *nss to 0 for the HT rates, just to make sure it's initialised.
--- drivers/net/wireless/realtek/rtw88/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/util.c +2 -1
@@ -101,7 +101,8 @@ void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) *nss =4 ; *mcs = rate -DESC_RATEVHT4SS_MCS0 ; }else if (rate >=DESC_RATEMCS0 && - rate <=DESC_RATEMCS15 ) { + rate <=DESC_RATEMCS31 ) { + *nss =0 ; *mcs = rate -DESC_RATEMCS0 ; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 287/486 wifi: rtw89: fw: propagate error code from rtw89_h2c_tx()
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 56e1acaa0f80620b8e2c3410db35b4b975782b0a ]
The error code should be propagated to callers during downloading firmware header and body. Remove unnecessary assignment of -1.
--- drivers/net/wireless/realtek/rtw89/fw.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +0 -2
@@ -1234,7 +1234,6 @@ static int __rtw89_fw_download_hdr(struct rtw89_dev *rtwdev, ret =rtw89_h2c_tx (rtwdev, skb, false);if (ret) {rtw89_err (rtwdev,"failed to send h2c\n" ); - ret =-1 ; goto fail; }
@@ -1311,7 +1310,6 @@ static int __rtw89_fw_download_main(struct rtw89_dev *rtwdev, ret =rtw89_h2c_tx (rtwdev, skb, true);if (ret) {rtw89_err (rtwdev,"failed to send h2c\n" ); - ret =-1 ; goto fail; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 288/486 wifi: rtw89: fw: get sb_sel_ver via get_unaligned_le32()
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 2f9da853f4d848d23bade4c22931ea0f5a011674 ]
The sb_sel_ver is selection version for secure boot recorded in firmware binary data, and its size is 4 and offset is 58 (not natural alignment). Use get_unaligned_le32() to get this value safely. Find this by reviewing.
--- drivers/net/wireless/realtek/rtw89/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/fw.c +1 -1
@@ -285,7 +285,7 @@ static int __parse_formatted_mssc(struct rtw89_dev *rtwdev,if (!sec->secure_boot) goto out; - sb_sel_ver =le32_to_cpu (section_content->sb_sel_ver.v); + sb_sel_ver =get_unaligned_le32 (§ion_content->sb_sel_ver.v);if (sb_sel_ver && sb_sel_ver != sec->sb_sel_mgn) goto ignore;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 289/486 wifi: rtw89: fw: add blacklist to avoid obsolete secure firmware
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit f11d042b3a2e92ab1aa10e0da8e290bcdcf31d39 ]
To ensure secure chip only runs expected secure firmware, stop using obsolete firmware in blacklist which weakness or flaw was found.
--- drivers/net/wireless/realtek/rtw89/core.h | 2 + drivers/net/wireless/realtek/rtw89/fw.c | 52 ++++++++++++++++++- drivers/net/wireless/realtek/rtw89/fw.h | 12 +++++ drivers/net/wireless/realtek/rtw89/rtw8851b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852b.c | 1 + .../net/wireless/realtek/rtw89/rtw8852bt.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852c.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8922a.c | 1 + 9 files changed, 71 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.h +2 -0
@@ -17,6 +17,7 @@ struct rtw89_dev;struct rtw89_pci_info ;struct rtw89_mac_gen_def ;struct rtw89_phy_gen_def ; +struct rtw89_fw_blacklist ;struct rtw89_efuse_block_cfg ;struct rtw89_h2c_rf_tssi ;struct rtw89_fw_txpwr_track_cfg ;
@@ -4232,6 +4233,7 @@ struct rtw89_chip_info {bool try_ce_fw;u8 bbmcu_nr;u32 needed_fw_elms; +const struct rtw89_fw_blacklist *fw_blacklist;u32 fifo_size;bool small_fifo_size;u32 dle_scc_rsvd_size;
drivers/net/wireless/realtek/rtw89/fw.c +51 -1
70 lines not on this page · raw message
drivers/net/wireless/realtek/rtw89/fw.h +12 -0
@@ -639,6 +639,11 @@ struct rtw89_fw_mss_pool_hdr { } __packed;union rtw89_fw_section_mssc_content { +struct { +u8 pad[0x20 ]; +u8 bit_in_chip_list; +u8 ver; + } __packed blacklist;struct {u8 pad[58 ];__le32 v;
@@ -649,6 +654,13 @@ union rtw89_fw_section_mssc_content { }__packed key_sign_len; } __packed; +struct rtw89_fw_blacklist { +u8 ver; +u8 list[32 ]; +}; + +extern const struct rtw89_fw_blacklist rtw89_fw_blacklist_default; +static inline void SET_CTRL_INFO_MACID (void *table,u32 val) {le32p_replace_bits ((__le32 *)(table) +0 , val,GENMASK (6 ,0 ));
drivers/net/wireless/realtek/rtw89/rtw8851b.c +1 -0
@@ -2443,6 +2443,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = { .try_ce_fw = true, .bbmcu_nr = 0, .needed_fw_elms = 0, + .fw_blacklist = NULL, .fifo_size = 196608, .small_fifo_size = true, .dle_scc_rsvd_size = 98304,
drivers/net/wireless/realtek/rtw89/rtw8852a.c +1 -0
@@ -2159,6 +2159,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = { .try_ce_fw = false, .bbmcu_nr = 0, .needed_fw_elms = 0, + .fw_blacklist = NULL, .fifo_size = 458752, .small_fifo_size = false, .dle_scc_rsvd_size = 0,
drivers/net/wireless/realtek/rtw89/rtw8852b.c +1 -0
@@ -797,6 +797,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = { .try_ce_fw = true, .bbmcu_nr = 0, .needed_fw_elms = 0, + .fw_blacklist = &rtw89_fw_blacklist_default, .fifo_size = 196608, .small_fifo_size = true, .dle_scc_rsvd_size = 98304,
drivers/net/wireless/realtek/rtw89/rtw8852bt.c +1 -0
@@ -731,6 +731,7 @@ const struct rtw89_chip_info rtw8852bt_chip_info = { .try_ce_fw = true, .bbmcu_nr = 0, .needed_fw_elms = RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ, + .fw_blacklist = &rtw89_fw_blacklist_default, .fifo_size = 458752, .small_fifo_size = true, .dle_scc_rsvd_size = 98304,
drivers/net/wireless/realtek/rtw89/rtw8852c.c +1 -0
@@ -2936,6 +2936,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = { .try_ce_fw = false, .bbmcu_nr = 0, .needed_fw_elms = 0, + .fw_blacklist = &rtw89_fw_blacklist_default, .fifo_size = 458752, .small_fifo_size = false, .dle_scc_rsvd_size = 0,
drivers/net/wireless/realtek/rtw89/rtw8922a.c +1 -0
@@ -2632,6 +2632,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = { .try_ce_fw = false, .bbmcu_nr = 1, .needed_fw_elms = RTW89_BE_GEN_DEF_NEEDED_FW_ELEMENTS, + .fw_blacklist = &rtw89_fw_blacklist_default, .fifo_size = 589824, .small_fifo_size = false, .dle_scc_rsvd_size = 0,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 290/486 wifi: rtw89: 8922a: fix incorrect STA-ID in EHT MU PPDU
In reply to Sasha LevinFrom: Kuan-Chung Chen <[email protected]>
[ Upstream commit bdce0574243b43b3bb2064f609c0c326df44c4c6 ]
EHT MU PPDU contains user field of EHT-SIG field with STA-ID that must match AID subfield in the Associate Response. Add a necessary setting to prevent these from being inconsistent.
--- drivers/net/wireless/realtek/rtw89/fw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +3 -2
@@ -3128,9 +3128,10 @@ int rtw89_fw_h2c_assoc_cmac_tbl_g7(struct rtw89_dev *rtwdev,CCTLINFO_G7_W5_NOMINAL_PKT_PADDING3 | CCTLINFO_G7_W5_NOMINAL_PKT_PADDING4); - h2c->w6 =le32_encode_bits (vif->type ==NL80211_IFTYPE_STATION ?1 :0 , + h2c->w6 =le32_encode_bits (vif->cfg.aid,CCTLINFO_G7_W6_AID12_PAID ) | +le32_encode_bits (vif->type ==NL80211_IFTYPE_STATION ?1 :0 ,CCTLINFO_G7_W6_ULDL ); - h2c->m6 =cpu_to_le32 (CCTLINFO_G7_W6_ULDL ); + h2c->m6 =cpu_to_le32 (CCTLINFO_G7_W6_AID12_PAID |CCTLINFO_G7_W6_ULDL );if (rtwsta_link) { h2c->w8 = le32_encode_bits(link_sta->he_cap.has_he,
Signature · 1 line
2.39.5