kconfig: merge_config: use an empty file as initfile
Subsystems (82)
Sasha Levin
maintainerPATCH 495/642 wifi: ath12k: use arvif instead of link_conf in ath12k_mac_set_key()
In reply to Sasha LevinFrom: Aditya Kumar Singh <[email protected]>
[ Upstream commit 00e4dc11695d48322780812b503314682659e98b ]
Currently, in ath12k_mac_set_key(), if sta is not present, the address is retrieved from link_conf's bssid or addr member, depending on the interface type.
When operating as an ML station and during shutdown, link_conf will not be available. This can result in the following error:
ath12k_pci 0004:01:00.0: unable to access bss link conf in set key for vif AA:BB:CC:DD:EE:FF link 1
The primary purpose of accessing link_conf is to obtain the address for finding the peer. However, since arvif is always valid in this call, it can be used instead.
Add change to use arvif instead of link_conf.
A subsequent change will expose this issue but since tear down will give error, this is included first.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1.97421.5 # Nicolas Escande
--- drivers/net/wireless/ath/ath12k/mac.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +1 -13
@@ -4534,9 +4534,6 @@ static int ath12k_mac_set_key(struct ath12k *ar, enum set_key_cmd cmd,struct ath12k_link_sta *arsta, struct ieee80211_key_conf *key) { - struct ath12k_vif *ahvif = arvif->ahvif; -struct ieee80211_vif *vif =ath12k_ahvif_to_vif (ahvif); -struct ieee80211_bss_conf *link_conf; struct ieee80211_sta *sta = NULL;struct ath12k_base *ab = ar->ab;struct ath12k_peer *peer;
@@ -4553,19 +4550,10 @@ static int ath12k_mac_set_key(struct ath12k *ar, enum set_key_cmd cmd,if (test_bit (ATH12K_FLAG_HW_CRYPTO_DISABLED , &ab->dev_flags))return 1 ; - link_conf =ath12k_mac_get_link_bss_conf (arvif); -if (!link_conf) { -ath12k_warn (ab,"unable to access bss link conf in set key for vif %pM link %u\n" , - vif->addr, arvif->link_id); -return -ENOLINK ; - } -if (sta) peer_addr = arsta->addr; -else if (ahvif->vdev_type ==WMI_VDEV_TYPE_STA ) - peer_addr = link_conf->bssid;else - peer_addr = link_conf->addr; + peer_addr = arvif->bssid; key->hw_key_idx = key->keyidx;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 496/642 wifi: ath12k: fix the ampdu id fetch in the HAL_RX_MPDU_START TLV
In reply to Sasha LevinFrom: P Praneesh <[email protected]>
[ Upstream commit dff4f278ee1ef12d822b7ed2a1048d27037209bb ]
Currently, ampdu id is update with peer id mask which is incorrect. Therefore, update the ampdu id with PPDU id mask value. Also move the ampdu_id field inside the user stats since it is a user id based statistics.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/dp_mon.c | 16 ++++++++++------ drivers/net/wireless/ath/ath12k/hal_rx.h | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath12k/dp_mon.c +10 -6
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "dp_mon.h"
@@ -655,6 +655,11 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab,if (userid <HAL_MAX_UL_MU_USERS ) {struct hal_rx_user_status *rxuser_stats = &ppdu_info->userstats[userid]; + +if (ppdu_info->num_mpdu_fcs_ok >1 || + ppdu_info->num_mpdu_fcs_err >1 ) + ppdu_info->userstats[userid].ampdu_present = true; + ppdu_info->num_users +=1 ;ath12k_dp_mon_rx_handle_ofdma_info (eu_stats, rxuser_stats);
@@ -755,8 +760,8 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab,if (userid <HAL_MAX_UL_MU_USERS ) { info[0 ] =__le32_to_cpu (mpdu_start->info0); ppdu_info->userid = userid; - ppdu_info->ampdu_id[userid] = -u32_get_bits (info[0 ],HAL_RX_MPDU_START_INFO1_PEERID ); + ppdu_info->userstats[userid].ampdu_id = +u32_get_bits (info[0 ],HAL_RX_MPDU_START_INFO0_PPDU_ID ); }break ;
@@ -956,15 +961,14 @@ static void ath12k_dp_mon_update_radiotap(struct ath12k *ar, {struct ieee80211_supported_band *sband;u8 *ptr =NULL ; -u16 ampdu_id = ppduinfo->ampdu_id[ppduinfo->userid]; rxs->flag |=RX_FLAG_MACTIME_START ; rxs->signal = ppduinfo->rssi_comb +ATH12K_DEFAULT_NOISE_FLOOR ; rxs->nss = ppduinfo->nss +1 ; -if (ampdu_id) { +if (ppduinfo->userstats[ppduinfo->userid].ampdu_present) { rxs->flag |=RX_FLAG_AMPDU_DETAILS ; - rxs->ampdu_reference = ampdu_id; + rxs->ampdu_reference = ppduinfo->userstats[ppduinfo->userid].ampdu_id; }if (ppduinfo->he_mu_flags) {
drivers/net/wireless/ath/ath12k/hal_rx.h +2 -1
@@ -146,6 +146,8 @@ struct hal_rx_user_status {u32 mpdu_fcs_ok_bitmap[HAL_RX_NUM_WORDS_PER_PPDU_BITMAP ];u32 mpdu_ok_byte_count;u32 mpdu_err_byte_count; +bool ampdu_present; +u16 ampdu_id; };#define HAL_MAX_UL_MU_USERS 37
@@ -230,7 +232,6 @@ struct hal_rx_mon_ppdu_info {u8 addr4[ETH_ALEN ];struct hal_rx_user_status userstats[HAL_MAX_UL_MU_USERS ];u8 userid; -u16 ampdu_id[HAL_MAX_UL_MU_USERS ];bool first_msdu_in_mpdu;bool is_ampdu;u8 medium_prot_type;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 497/642 wifi: ath12k: Update the peer id in PPDU end user stats TLV
In reply to Sasha LevinFrom: Karthikeyan Periyasamy <[email protected]>
[ Upstream commit 0cded0e413468183a3b2dd445ab3bdc4d4375967 ]
Currently, peer id get reported in the PPDU end user TLV tag. But the monitor status handler is inherited from ath11k, but it was not updated to incorporate the changes made to ath12k 802.11be hardware architecture. Therefore, update the peer id from the PPDU end user TLV data to get latest peer id update, it helps to populate accurate peer information on the statistics data.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/dp_mon.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath12k/dp_mon.c +3 -0
@@ -638,6 +638,9 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k_base *ab, ppdu_info->num_mpdu_fcs_err =u32_get_bits (info[0 ],HAL_RX_PPDU_END_USER_STATS_INFO0_MPDU_CNT_FCS_ERR ); + ppdu_info->peer_id = +u32_get_bits (info[0 ],HAL_RX_PPDU_END_USER_STATS_INFO0_PEER_ID ); +switch (ppdu_info->preamble_type) {case HAL_RX_PREAMBLE_11N : ppdu_info->ht_flags =1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 498/642 mptcp: pm: userspace: flags: clearer msg if no remote addr
In reply to Sasha LevinFrom: "Matthieu Baerts (NGI0)" <[email protected]>
[ Upstream commit 58b21309f97b08b6b9814d1ee1419249eba9ef08 ]
Since its introduction in commit 892f396c8e68 ("mptcp: netlink: issue MP_PRIO signals from userspace PMs"), it was mandatory to specify the remote address, because of the 'if (rem->addr.family == AF_UNSPEC)' check done later one.
In theory, this attribute can be optional, but it sounds better to be precise to avoid sending the MP_PRIO on the wrong subflow, e.g. if there are multiple subflows attached to the same local ID. This can be relaxed later on if there is a need to act on multiple subflows with one command.
For the moment, the check to see if attr_rem is NULL can be removed, because mptcp_pm_parse_entry() will do this check as well, no need to do that differently here.
--- net/mptcp/pm_userspace.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/mptcp/pm_userspace.c +3 -5
@@ -583,11 +583,9 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)if (ret <0 ) goto set_flags_err; -if (attr_rem) { - ret =mptcp_pm_parse_entry (attr_rem, info, false, &rem); -if (ret <0 ) - goto set_flags_err; - } + ret =mptcp_pm_parse_entry (attr_rem, info, false, &rem); +if (ret <0 ) + goto set_flags_err;if (loc.addr.family ==AF_UNSPEC || rem.addr.family ==AF_UNSPEC ) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 499/642 wifi: iwlwifi: use correct IMR dump variable
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 21e4d29ac0def546d57bacebe4a51cbed1209b03 ]
We shouldn't dump the reg_data here which dumps the last entry again, it should use the imr_reg_data.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2005-2014, 2018-2024 Intel Corporation +* Copyright (C) 2005-2014, 2018-2025 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2015-2017 Intel Deutschland GmbH */
@@ -2691,7 +2691,7 @@ static u32 iwl_dump_ini_trigger(struct iwl_fw_runtime *fwrt, }/* collect DRAM_IMR region in the last */ if (imr_reg_data.reg_tlv) - size +=iwl_dump_ini_mem (fwrt, list, ®_data, + size +=iwl_dump_ini_mem (fwrt, list, &imr_reg_data, &iwl_dump_ini_region_ops[IWL_FW_INI_REGION_DRAM_IMR ]);if (size) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 500/642 wifi: iwlwifi: don't warn during reprobe
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit 696cca64308dc641d0bbe4aa2c09dd9752aa288d ]
During reprobe, the sw state is being destroyd, and so is the connection. When the peer STA is being removed, the opmode sends a command to flush the TXQs of the STA and uses iwl_trans_wait_txq_empty.
This one warns if the FW is not alive, but it really shouldn't if there is a FW error - and return silently instead, just like we do when sending a hcmd.
--- drivers/net/wireless/intel/iwlwifi/iwl-trans.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-trans.c +3 -0
@@ -676,6 +676,9 @@ IWL_EXPORT_SYMBOL(iwl_trans_txq_enable_cfg);int iwl_trans_wait_txq_empty (struct iwl_trans *trans,int queue) { +if (unlikely (test_bit (STATUS_FW_ERROR , &trans->status))) +return -EIO ; +if (WARN_ONCE (trans->state !=IWL_TRANS_FW_ALIVE ,"bad state = %d\n" , trans->state))return -EIO ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 501/642 wifi: mac80211: always send max agg subframe num in strict mode
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 3fca951123b68df8d1b47bbf90409f8a3671362b ]
Instead of only sending the correct number for EHT and up, always send the correct number as it should be in strict mode.
--- net/mac80211/agg-tx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/mac80211/agg-tx.c +3 -2
@@ -9,7 +9,7 @@* Copyright 2007, Michael Wu <[email protected]> * Copyright 2007-2010, Intel Corporation * Copyright(c) 2015-2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2023 Intel Corporation +* Copyright (C) 2018 - 2024 Intel Corporation */ #include <linux/ieee80211.h>
@@ -464,7 +464,8 @@ static void ieee80211_send_addba_with_timeout(struct sta_info *sta, sta->ampdu_mlme.addba_req_num[tid]++;spin_unlock_bh (&sta->lock); -if (sta->sta.deflink.eht_cap.has_eht) { +if (sta->sta.deflink.eht_cap.has_eht || +ieee80211_hw_check (&local->hw,STRICT )) { buf_size = local->hw.max_tx_aggregation_subframes; }else if (sta->sta.deflink.he_cap.has_he) { buf_size = min_t(u16, local->hw.max_tx_aggregation_subframes,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 502/642 wifi: mac80211: don't unconditionally call drv_mgd_complete_tx()
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 1798271b3604b902d45033ec569f2bf77e94ecc2 ]
We might not have called drv_mgd_prepare_tx(), so only call drv_mgd_complete_tx() under the same conditions.
--- net/mac80211/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +2 -1
@@ -3832,7 +3832,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,if (tx)ieee80211_flush_queues (local, sdata, false); -drv_mgd_complete_tx (sdata->local, sdata, &info); +if (tx || frame_buf) +drv_mgd_complete_tx (sdata->local, sdata, &info);/* clear AP addr only after building the needed mgmt frames */ eth_zero_addr (sdata->deflink.u.mgd.bssid);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 503/642 wifi: mac80211: remove misplaced drv_mgd_complete_tx() call
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit f4995cdc4d02d0abc8e9fcccad5c71ce676c1e3f ]
In the original commit 15fae3410f1d ("mac80211: notify driver on mgd TX completion") I evidently made a mistake and placed the call in the "associated" if, rather than the "assoc_data". Later I noticed the missing call and placed it in commit c042600c17d8 ("wifi: mac80211: adding missing drv_mgd_complete_tx() call"), but didn't remove the wrong one. Remove it now.
--- net/mac80211/mlme.c | 1 - 1 file changed, 1 deletion(-)
net/mac80211/mlme.c +0 -1
@@ -9508,7 +9508,6 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,ieee80211_report_disconnect (sdata, frame_buf,sizeof (frame_buf), true, req->reason_code, false); -drv_mgd_complete_tx (sdata->local, sdata, &info);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 504/642 wifi: mac80211: set ieee80211_prep_tx_info::link_id upon Auth Rx
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 8c60179b64434894eac1ffab7396bac131bc8b6e ]
This will be used by the low level driver.
Note that link_id will be 0 in case of a non-MLO authentication. Also fix a call-site of mgd_prepare_tx() where the link_id was not populated.
Update the documentation to reflect the current state ieee80211_prep_tx_info::link_id is also available in mgd_complete_tx().
--- include/net/mac80211.h | 4 ++-- net/mac80211/driver-ops.h | 3 ++- net/mac80211/mlme.c | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-)
include/net/mac80211.h +2 -2
@@ -7,7 +7,7 @@* Copyright 2007-2010 Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2024 Intel Corporation +* Copyright (C) 2018 - 2025 Intel Corporation */ #ifndef MAC80211_H
@@ -3829,7 +3829,7 @@ enum ieee80211_reconfig_type {* @was_assoc: set if this call is due to deauth/disassoc * while just having been associated * @link_id: the link id on which the frame will be TX'ed. -* Only used with the mgd_prepare_tx() method. +* 0 for a non-MLO connection. */ struct ieee80211_prep_tx_info {u16 duration;
net/mac80211/driver-ops.h +2 -1
@@ -2,7 +2,7 @@/* * Portions of this file * Copyright(c) 2016 Intel Deutschland GmbH -* Copyright (C) 2018-2019, 2021-2024 Intel Corporation +* Copyright (C) 2018-2019, 2021-2025 Intel Corporation */ #ifndef __MAC80211_DRIVER_OPS
@@ -955,6 +955,7 @@ static inline void drv_mgd_complete_tx(struct ieee80211_local *local,return ;WARN_ON_ONCE (sdata->vif.type !=NL80211_IFTYPE_STATION ); + info->link_id = info->link_id <0 ?0 : info->link_id;trace_drv_mgd_complete_tx (local, sdata, info->duration, info->subtype, info->success);if (local->ops->mgd_complete_tx)
net/mac80211/mlme.c +3 -1
@@ -8,7 +8,7 @@* Copyright 2007, Michael Wu <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2024 Intel Corporation +* Copyright (C) 2018 - 2025 Intel Corporation */ #include <linux/delay.h>
@@ -4579,6 +4579,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, auth_transaction =le16_to_cpu (mgmt->u.auth.auth_transaction); status_code =le16_to_cpu (mgmt->u.auth.status_code); + info.link_id = ifmgd->auth_data->link_id; + if (auth_alg != ifmgd->auth_data->algorithm || (auth_alg != WLAN_AUTH_SAE && auth_transaction != ifmgd->auth_data->expected_transaction) ||
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 505/642 wifi: mac80211: add HT and VHT basic set verification
In reply to Sasha LevinFrom: Benjamin Berg <[email protected]>
[ Upstream commit 574faa0e936d12718e2cadad11ce1e184d9e5a32 ]
So far we did not verify the HT and VHT basic MCS set. However, in P802.11REVme/D7.0 (6.5.4.2.4) says that the MLME-JOIN.request shall return an error if the VHT and HT basic set requirements are not met.
Given broken APs, apply VHT basic MCS/NSS set checks only in strict mode.
--- net/mac80211/mlme.c | 129 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+)
net/mac80211/mlme.c +129 -0
@@ -345,6 +345,115 @@ ieee80211_determine_ap_chan(struct ieee80211_sub_if_data *sdata,return IEEE80211_CONN_MODE_EHT ; } +static bool +ieee80211_verify_sta_ht_mcs_support (struct ieee80211_sub_if_data *sdata, +struct ieee80211_supported_band *sband, +const struct ieee80211_ht_operation *ht_op) +{ +struct ieee80211_sta_ht_cap sta_ht_cap; +int i; + +if (sband->band ==NL80211_BAND_6GHZ ) +return true; + +if (!ht_op) +return false; + +memcpy (&sta_ht_cap, &sband->ht_cap,sizeof (sta_ht_cap)); +ieee80211_apply_htcap_overrides (sdata, &sta_ht_cap); + +/* +* P802.11REVme/D7.0 - 6.5.4.2.4 +* ... +* If the MLME of an HT STA receives an MLME-JOIN.request primitive +* with the SelectedBSS parameter containing a Basic HT-MCS Set field +* in the HT Operation parameter that contains any unsupported MCSs, +* the MLME response in the resulting MLME-JOIN.confirm primitive shall +* contain a ResultCode parameter that is not set to the value SUCCESS. +* ... +*/ + +/* Simply check that all basic rates are in the STA RX mask */ +for (i =0 ; i <IEEE80211_HT_MCS_MASK_LEN ; i++) { +if ((ht_op->basic_set[i] & sta_ht_cap.mcs.rx_mask[i]) != + ht_op->basic_set[i]) +return false; + } + +return true; +} + +static bool +ieee80211_verify_sta_vht_mcs_support (struct ieee80211_sub_if_data *sdata, +int link_id, +struct ieee80211_supported_band *sband, +const struct ieee80211_vht_operation *vht_op) +{ +struct ieee80211_sta_vht_cap sta_vht_cap; +u16 ap_min_req_set, sta_rx_mcs_map, sta_tx_mcs_map; +int nss; + +if (sband->band !=NL80211_BAND_5GHZ ) +return true; + +if (!vht_op) +return false; + +memcpy (&sta_vht_cap, &sband->vht_cap,sizeof (sta_vht_cap)); +ieee80211_apply_vhtcap_overrides (sdata, &sta_vht_cap); + + ap_min_req_set =le16_to_cpu (vht_op->basic_mcs_set); + sta_rx_mcs_map =le16_to_cpu (sta_vht_cap.vht_mcs.rx_mcs_map); + sta_tx_mcs_map =le16_to_cpu (sta_vht_cap.vht_mcs.tx_mcs_map); + +/* +* Many APs are incorrectly advertising an all-zero value here, +* which really means MCS 0-7 are required for 1-8 streams, but +* they don't really mean it that way. +* Some other APs are incorrectly advertising 3 spatial streams +* with MCS 0-7 are required, but don't really mean it that way +* and we'll connect only with HT, rather than even HE. +* As a result, unfortunately the VHT basic MCS/NSS set cannot +* be used at all, so check it only in strict mode. +*/ +if (!ieee80211_hw_check (&sdata->local->hw,STRICT )) +return true; + +/* +* P802.11REVme/D7.0 - 6.5.4.2.4 +* ... +* If the MLME of a VHT STA receives an MLME-JOIN.request primitive +* with a SelectedBSS parameter containing a Basic VHT-MCS And NSS Set +* field in the VHT Operation parameter that contains any unsupported +* <VHT-MCS, NSS> tuple, the MLME response in the resulting +* MLME-JOIN.confirm primitive shall contain a ResultCode parameter +* that is not set to the value SUCCESS. +* ... +*/ +for (nss =8 ; nss >0 ; nss--) { +u8 ap_op_val = (ap_min_req_set >> (2 * (nss -1 ))) &3 ; +u8 sta_rx_val; +u8 sta_tx_val; + +if (ap_op_val ==IEEE80211_HE_MCS_NOT_SUPPORTED ) +continue ; + + sta_rx_val = (sta_rx_mcs_map >> (2 * (nss -1 ))) &3 ; + sta_tx_val = (sta_tx_mcs_map >> (2 * (nss -1 ))) &3 ; + +if (sta_rx_val ==IEEE80211_HE_MCS_NOT_SUPPORTED || + sta_tx_val ==IEEE80211_HE_MCS_NOT_SUPPORTED || + sta_rx_val < ap_op_val || sta_tx_val < ap_op_val) { +link_id_info (sdata, link_id, +"Missing mandatory rates for %d Nss, rx %d, tx %d oper %d, disable VHT\n" , + nss, sta_rx_val, sta_tx_val, ap_op_val); +return false; + } + } + +return true; +} + static bool ieee80211_verify_peer_he_mcs_support(struct ieee80211_sub_if_data *sdata, int link_id,
@@ -1042,6 +1151,26 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,link_id_info (sdata, link_id,"regulatory prevented using AP config, downgraded\n" ); +if (conn->mode >=IEEE80211_CONN_MODE_HT && + !ieee80211_verify_sta_ht_mcs_support (sdata, sband, + elems->ht_operation)) { + conn->mode =IEEE80211_CONN_MODE_LEGACY ; + conn->bw_limit =IEEE80211_CONN_BW_LIMIT_20 ; +link_id_info (sdata, link_id, +"required MCSes not supported, disabling HT\n" ); + } + +if (conn->mode >=IEEE80211_CONN_MODE_VHT && + !ieee80211_verify_sta_vht_mcs_support (sdata, link_id, sband, + elems->vht_operation)) { + conn->mode =IEEE80211_CONN_MODE_HT ; + conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, + conn->bw_limit, +IEEE80211_CONN_BW_LIMIT_40 ); +link_id_info (sdata, link_id, +"required MCSes not supported, disabling VHT\n" ); + } + if (conn->mode >= IEEE80211_CONN_MODE_HE && (!ieee80211_verify_peer_he_mcs_support(sdata, link_id, (void *)elems->he_cap,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 506/642 wifi: mac80211: Drop cooked monitor support
In reply to Sasha LevinFrom: Alexander Wetzel <[email protected]>
[ Upstream commit 286e696770654d79b34bd15953e7101a1c4784c7 ]
Hostapd switched from cooked monitor interfaces to nl80211 Dec 2011. Drop support for the outdated cooked monitor interfaces and fix creating the virtual monitor interfaces in the following cases:
1) We have one non-monitor and one monitor interface with %MONITOR_FLAG_ACTIVE enabled and then delete the non-monitor interface.
2) We only have monitor interfaces enabled on resume while at least one has %MONITOR_FLAG_ACTIVE set.
--- include/net/dropreason.h | 6 -- net/mac80211/cfg.c | 9 +- net/mac80211/drop.h | 21 ++-- net/mac80211/ieee80211_i.h | 11 +-- net/mac80211/iface.c | 50 ++++------ net/mac80211/main.c | 16 +-- net/mac80211/rx.c | 194 ++++++++++--------------------------- net/mac80211/status.c | 34 +------ net/mac80211/tx.c | 2 +- 9 files changed, 94 insertions(+), 249 deletions(-)
include/net/dropreason.h +0 -6
@@ -17,12 +17,6 @@ enum skb_drop_reason_subsys {*/ SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE, -/** -* @SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR: mac80211 drop reasons -* for frames still going to monitor, see net/mac80211/drop.h -*/ - SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR, -/** * @SKB_DROP_REASON_SUBSYS_OPENVSWITCH: openvswitch drop reasons, * see net/openvswitch/drop.h
net/mac80211/cfg.c +4 -5
@@ -89,15 +89,14 @@ static int ieee80211_set_mon_options(struct ieee80211_sub_if_data *sdata,/* check flags first */ if (params->flags &&ieee80211_sdata_running (sdata)) { -u32 mask =MONITOR_FLAG_COOK_FRAMES |MONITOR_FLAG_ACTIVE ; +u32 mask =MONITOR_FLAG_ACTIVE ;/* -* Prohibit MONITOR_FLAG_COOK_FRAMES and -* MONITOR_FLAG_ACTIVE to be changed while the -* interface is up. +* Prohibit MONITOR_FLAG_ACTIVE to be changed +* while the interface is up. * Else we would need to add a lot of cruft * to update everything: -* cooked_mntrs, monitor and all fif_* counters +* monitor and all fif_* counters * reconfigure hardware */ if ((params->flags & mask) != (sdata->u.mntr.flags & mask))
net/mac80211/drop.h +7 -14
@@ -11,12 +11,6 @@typedef unsigned int __bitwise ieee80211_rx_result ; -#define MAC80211_DROP_REASONS_MONITOR (R ) \ - R(RX_DROP_M_UNEXPECTED_4ADDR_FRAME) \ - R(RX_DROP_M_BAD_BCN_KEYIDX) \ - R(RX_DROP_M_BAD_MGMT_KEYIDX) \ -/* this line for the trailing \ - add before this */ -#define MAC80211_DROP_REASONS_UNUSABLE (R ) \/* 0x00 == ___RX_DROP_UNUSABLE */ \ R(RX_DROP_U_MIC_FAIL) \
@@ -66,6 +60,10 @@ typedef unsigned int __bitwise ieee80211_rx_result; R(RX_DROP_U_UNEXPECTED_STA_4ADDR) \ R(RX_DROP_U_UNEXPECTED_VLAN_MCAST) \ R(RX_DROP_U_NOT_PORT_CONTROL) \ + R(RX_DROP_U_UNEXPECTED_4ADDR_FRAME) \ + R(RX_DROP_U_BAD_BCN_KEYIDX) \ + /* 0x30 */ \ + R(RX_DROP_U_BAD_MGMT_KEYIDX) \ R(RX_DROP_U_UNKNOWN_ACTION_REJECTED) \/* this line for the trailing \ - add before this */
@@ -78,10 +76,6 @@ enum ___mac80211_drop_reason { ___RX_QUEUED = SKB_NOT_DROPPED_YET,#define ENUM (x) ___ ## x, - ___RX_DROP_MONITOR =SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR << -SKB_DROP_REASON_SUBSYS_SHIFT , - MAC80211_DROP_REASONS_MONITOR(ENUM) - ___RX_DROP_UNUSABLE =SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE <<SKB_DROP_REASON_SUBSYS_SHIFT ,MAC80211_DROP_REASONS_UNUSABLE (ENUM )
@@ -89,11 +83,10 @@ enum ___mac80211_drop_reason { };enum mac80211_drop_reason { -RX_CONTINUE = (__force ieee80211_rx_result )___RX_CONTINUE, -RX_QUEUED = (__force ieee80211_rx_result )___RX_QUEUED, -RX_DROP_MONITOR = (__force ieee80211_rx_result )___RX_DROP_MONITOR, +RX_CONTINUE = (__force ieee80211_rx_result )___RX_CONTINUE, +RX_QUEUED = (__force ieee80211_rx_result )___RX_QUEUED, +RX_DROP = (__force ieee80211_rx_result )___RX_DROP_UNUSABLE, #define DEF(x) x = (__force ieee80211_rx_result)___ ## x, - MAC80211_DROP_REASONS_MONITOR(DEF) MAC80211_DROP_REASONS_UNUSABLE(DEF)#undef DEF };
net/mac80211/ieee80211_i.h +4 -7
@@ -200,7 +200,6 @@ enum ieee80211_packet_rx_flags {/** * enum ieee80211_rx_flags - RX data flags * -* @IEEE80211_RX_CMNTR: received on cooked monitor already * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported * to cfg80211_report_obss_beacon(). *
@@ -208,8 +207,7 @@ enum ieee80211_packet_rx_flags {* for a single frame. */ enum ieee80211_rx_flags { -IEEE80211_RX_CMNTR =BIT (0 ), -IEEE80211_RX_BEACON_REPORTED =BIT (1 ), +IEEE80211_RX_BEACON_REPORTED =BIT (0 ), };struct ieee80211_rx_data {
@@ -1380,7 +1378,7 @@ struct ieee80211_local {spinlock_t queue_stop_reason_lock;int open_count; -int monitors, cooked_mntrs, tx_mntrs; +int monitors, tx_mntrs;/* number of interfaces with corresponding FIF_ flags */ int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, fif_probe_req;
@@ -1492,7 +1490,7 @@ struct ieee80211_local {/* see iface.c */ struct list_head interfaces; -struct list_head mon_list;/* only that are IFF_UP && !cooked */ +struct list_head mon_list;/* only that are IFF_UP */ struct mutex iflist_mtx;/* Scanning and BSS list */
@@ -2090,8 +2088,7 @@ struct sk_buff * ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, u32 info_flags);void ieee80211_tx_monitor (struct ieee80211_local *local,struct sk_buff *skb, -int retry_count,bool send_to_cooked, -struct ieee80211_tx_status *status); +int retry_count,struct ieee80211_tx_status *status);void ieee80211_check_fast_xmit (struct sta_info *sta);void ieee80211_check_fast_xmit_all (struct ieee80211_local *local);
net/mac80211/iface.c +21 -29
82 lines not on this page · raw message
net/mac80211/main.c +1 -15
@@ -1744,18 +1744,7 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)wiphy_free (local->hw.wiphy); }EXPORT_SYMBOL (ieee80211_free_hw); - -static const char *const drop_reasons_monitor[] = { -#define V(x) #x, - [0 ] ="RX_DROP_MONITOR" , -MAC80211_DROP_REASONS_MONITOR (V ) -}; - -static struct drop_reason_list drop_reason_list_monitor = { - .reasons = drop_reasons_monitor, - .n_reasons =ARRAY_SIZE (drop_reasons_monitor), -}; - +#define V (x) #x,static const char *const drop_reasons_unusable[] = { [0 ] ="RX_DROP_UNUSABLE" ,MAC80211_DROP_REASONS_UNUSABLE (V )
@@ -1784,8 +1773,6 @@ static int __init ieee80211_init(void)if (ret) goto err_netdev; -drop_reasons_register_subsys (SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR , - &drop_reason_list_monitor);drop_reasons_register_subsys (SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE , &drop_reason_list_unusable);
@@ -1804,7 +1791,6 @@ static void __exit ieee80211_exit(void)ieee80211_iface_exit (); -drop_reasons_unregister_subsys (SKB_DROP_REASON_SUBSYS_MAC80211_MONITOR );drop_reasons_unregister_subsys (SKB_DROP_REASON_SUBSYS_MAC80211_UNUSABLE );rcu_barrier ();
net/mac80211/rx.c +51 -143
450 lines not on this page · raw message
net/mac80211/status.c +5 -29
@@ -895,8 +895,7 @@ static int ieee80211_tx_get_rates(struct ieee80211_hw *hw, }void ieee80211_tx_monitor (struct ieee80211_local *local,struct sk_buff *skb, -int retry_count,bool send_to_cooked, -struct ieee80211_tx_status *status) +int retry_count,struct ieee80211_tx_status *status) {struct sk_buff *skb2;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);
@@ -930,10 +929,6 @@ void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,if (sdata->u.mntr.flags &MONITOR_FLAG_SKIP_TX )continue ; -if ((sdata->u.mntr.flags &MONITOR_FLAG_COOK_FRAMES ) && - !send_to_cooked) -continue ; -if (prev_dev) { skb2 =skb_clone (skb,GFP_ATOMIC );if (skb2) {
@@ -964,7 +959,6 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,struct ieee80211_tx_info *info = status->info;struct sta_info *sta;__le16 fc; -bool send_to_cooked;bool acked;bool noack_success;struct ieee80211_bar *bar;
@@ -1091,28 +1085,10 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,ieee80211_report_used_skb (local, skb, false, status->ack_hwtstamp); -/* this was a transmitted frame, but now we want to reuse it */ -skb_orphan (skb); - -/* Need to make a copy before skb->cb gets cleared */ - send_to_cooked = !!(info->flags &IEEE80211_TX_CTL_INJECTED ) || - !(ieee80211_is_data (fc)); - -/* -* This is a bit racy but we can avoid a lot of work -* with this test... -*/ -if (!local->tx_mntrs && (!send_to_cooked || !local->cooked_mntrs)) { -if (status->free_list) -list_add_tail (&skb->list, status->free_list); -else -dev_kfree_skb (skb); -return ; - } - -/* send to monitor interfaces */ -ieee80211_tx_monitor (local, skb, retry_count, - send_to_cooked, status); +if (status->free_list) +list_add_tail (&skb->list, status->free_list); +else +dev_kfree_skb (skb); }void ieee80211_tx_status_skb (struct ieee80211_hw *hw,struct sk_buff *skb)
net/mac80211/tx.c +1 -1
@@ -5617,7 +5617,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,if (!copy)return bcn; -ieee80211_tx_monitor (hw_to_local (hw), copy,1 , false,NULL ); +ieee80211_tx_monitor (hw_to_local (hw), copy,1 ,NULL );return bcn; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 507/642 net: fec: Refactor MAC reset to function
In reply to Sasha LevinFrom: Csókás, Bence <[email protected]>
[ Upstream commit 67800d296191d0a9bde0a7776f99ca1ddfa0fc26 ]
The core is reset both in fec_restart() (called on link-up) and fec_stop() (going to sleep, driver remove etc.). These two functions had their separate implementations, which was at first only a register write and a udelay() (and the accompanying block comment). However, since then we got soft-reset (MAC disable) and Wake-on-LAN support, which meant that these implementations diverged, often causing bugs.
For instance, as of now, fec_stop() does not check for FEC_QUIRK_NO_HARD_RESET, meaning the MII/RMII mode is cleared on eg. a PM power-down event; and fec_restart() missed the refactor renaming the "magic" constant 1 to FEC_ECR_RESET.
To harmonize current implementations, and eliminate this source of potential future bugs, refactor implementation to a common function.
--- drivers/net/ethernet/freescale/fec_main.c | 52 +++++++++++------------ 1 file changed, 25 insertions(+), 27 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +25 -27
@@ -1093,6 +1093,29 @@ static void fec_enet_enable_ring(struct net_device *ndev) } } +/* Whack a reset. We should wait for this. +* For i.MX6SX SOC, enet use AXI bus, we use disable MAC +* instead of reset MAC itself. +*/ +static void fec_ctrl_reset (struct fec_enet_private *fep,bool allow_wol) +{ +u32 val; + +if (!allow_wol || !(fep->wol_flag &FEC_WOL_FLAG_SLEEP_ON )) { +if (fep->quirks &FEC_QUIRK_HAS_MULTI_QUEUES || + ((fep->quirks &FEC_QUIRK_NO_HARD_RESET ) && fep->link)) { +writel (0 , fep->hwp +FEC_ECNTRL ); + }else { +writel (FEC_ECR_RESET , fep->hwp +FEC_ECNTRL ); +udelay (10 ); + } + }else { + val =readl (fep->hwp +FEC_ECNTRL ); + val |= (FEC_ECR_MAGICEN |FEC_ECR_SLEEP ); +writel (val, fep->hwp +FEC_ECNTRL ); + } +} +/* * This function is called to start or restart the FEC during a link * change, transmit timeout, or to reconfigure the FEC. The network
@@ -1109,17 +1132,7 @@ fec_restart(struct net_device *ndev)if (fep->bufdesc_ex)fec_ptp_save_state (fep); -/* Whack a reset. We should wait for this. -* For i.MX6SX SOC, enet use AXI bus, we use disable MAC -* instead of reset MAC itself. -*/ -if (fep->quirks &FEC_QUIRK_HAS_MULTI_QUEUES || - ((fep->quirks &FEC_QUIRK_NO_HARD_RESET ) && fep->link)) { -writel (0 , fep->hwp +FEC_ECNTRL ); - }else { -writel (1 , fep->hwp +FEC_ECNTRL ); -udelay (10 ); - } +fec_ctrl_reset (fep, false);/* * enet-mac reset will reset mac address registers too,
@@ -1373,22 +1386,7 @@ fec_stop(struct net_device *ndev)if (fep->bufdesc_ex)fec_ptp_save_state (fep); -/* Whack a reset. We should wait for this. -* For i.MX6SX SOC, enet use AXI bus, we use disable MAC -* instead of reset MAC itself. -*/ -if (!(fep->wol_flag &FEC_WOL_FLAG_SLEEP_ON )) { -if (fep->quirks &FEC_QUIRK_HAS_MULTI_QUEUES ) { -writel (0 , fep->hwp +FEC_ECNTRL ); - }else { -writel (FEC_ECR_RESET , fep->hwp +FEC_ECNTRL ); -udelay (10 ); - } - }else { - val =readl (fep->hwp +FEC_ECNTRL ); - val |= (FEC_ECR_MAGICEN |FEC_ECR_SLEEP ); -writel (val, fep->hwp +FEC_ECNTRL ); - } +fec_ctrl_reset (fep, true);writel (fep->phy_speed, fep->hwp +FEC_MII_SPEED );writel (FEC_DEFAULT_IMASK , fep->hwp +FEC_IMASK );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 508/642 powerpc/pseries/iommu: memory notifier incorrectly adds TCEs for pmemory
In reply to Sasha LevinFrom: Gaurav Batra <[email protected]>
[ Upstream commit 6aa989ab2bd0d37540c812b4270006ff794662e7 ]
iommu_mem_notifier() is invoked when RAM is dynamically added/removed. This notifier call is responsible to add/remove TCEs from the Dynamic DMA Window (DDW) when TCEs are pre-mapped. TCEs are pre-mapped only for RAM and not for persistent memory (pmemory). For DMA buffers in pmemory, TCEs are dynamically mapped when the device driver instructs to do so.
The issue is 'daxctl' command is capable of adding pmemory as "System RAM" after LPAR boot. The command to do so is -
daxctl reconfigure-device --mode=system-ram dax0.0 --force
This will dynamically add pmemory range to LPAR RAM eventually invoking iommu_mem_notifier(). The address range of pmemory is way beyond the Max RAM that the LPAR can have. Which means, this range is beyond the DDW created for the device, at device initialization time.
As a result when TCEs are pre-mapped for the pmemory range, by iommu_mem_notifier(), PHYP HCALL returns H_PARAMETER. This failed the command, daxctl, to add pmemory as RAM.
The solution is to not pre-map TCEs for pmemory.
--- arch/powerpc/include/asm/mmzone.h | 1 + arch/powerpc/mm/numa.c | 2 +- arch/powerpc/platforms/pseries/iommu.c | 29 ++++++++++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-)
arch/powerpc/include/asm/mmzone.h +1 -0
@@ -29,6 +29,7 @@ extern cpumask_var_t node_to_cpumask_map[];#ifdef CONFIG_MEMORY_HOTPLUG extern unsigned long max_pfn;u64 memory_hotplug_max (void ); +u64 hot_add_drconf_memory_max (void );#else #define memory_hotplug_max () memblock_end_of_DRAM()#endif
arch/powerpc/mm/numa.c +1 -1
@@ -1336,7 +1336,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)return nid; } -static u64 hot_add_drconf_memory_max (void ) +u64 hot_add_drconf_memory_max (void ) {struct device_node *memory =NULL ;struct device_node *dn =NULL ;
arch/powerpc/platforms/pseries/iommu.c +16 -13
@@ -1284,17 +1284,13 @@ static LIST_HEAD(failed_ddw_pdn_list);static phys_addr_t ddw_memory_hotplug_max (void ) { -resource_size_t max_addr =memory_hotplug_max (); -struct device_node *memory; +resource_size_t max_addr; -for_each_node_by_type (memory,"memory" ) { -struct resource res; - -if (of_address_to_resource (memory,0 , &res)) -continue ; - - max_addr =max_t (resource_size_t, max_addr, res.end +1 ); - } +#if defined(CONFIG_NUMA ) && defined(CONFIG_MEMORY_HOTPLUG ) + max_addr =hot_add_drconf_memory_max (); +#else + max_addr =memblock_end_of_DRAM (); +#endif return max_addr; }
@@ -1600,7 +1596,7 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)if (direct_mapping) {/* DDW maps the whole partition, so enable direct DMA mapping */ - ret =walk_system_ram_range (0 ,memblock_end_of_DRAM () >>PAGE_SHIFT , + ret =walk_system_ram_range (0 ,ddw_memory_hotplug_max () >>PAGE_SHIFT , win64->value, tce_setrange_multi_pSeriesLP_walk);if (ret) { dev_info(&dev->dev, "failed to map DMA window for %pOF: %d\n",
@@ -2349,11 +2345,17 @@ static int iommu_mem_notifier(struct notifier_block *nb, unsigned long action,struct memory_notify *arg = data;int ret =0 ; +/* This notifier can get called when onlining persistent memory as well. +* TCEs are not pre-mapped for persistent memory. Persistent memory will +* always be above ddw_memory_hotplug_max() +*/ +switch (action) {case MEM_GOING_ONLINE :spin_lock (&dma_win_list_lock);list_for_each_entry (window, &dma_win_list, list) { -if (window->direct) { +if (window->direct && (arg->start_pfn <<PAGE_SHIFT ) < +ddw_memory_hotplug_max ()) { ret |=tce_setrange_multi_pSeriesLP (arg->start_pfn, arg->nr_pages, window->prop); }
@@ -2365,7 +2367,8 @@ static int iommu_mem_notifier(struct notifier_block *nb, unsigned long action,case MEM_OFFLINE :spin_lock (&dma_win_list_lock);list_for_each_entry (window, &dma_win_list, list) { -if (window->direct) { +if (window->direct && (arg->start_pfn <<PAGE_SHIFT ) < +ddw_memory_hotplug_max ()) { ret |=tce_clearrange_multi_pSeriesLP (arg->start_pfn, arg->nr_pages, window->prop); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 509/642 powerpc/pseries/iommu: create DDW for devices with DMA mask less than 64-bits
In reply to Sasha LevinFrom: Gaurav Batra <[email protected]>
[ Upstream commit 67dfc11982f7e3c37f0977e74671da2391b29181 ]
Starting with PAPR level 2.13, platform supports placing PHB in limited address mode. Devices that support DMA masks less that 64-bit but greater than 32-bits are placed in limited address mode. In this mode, the starting DMA address returned by the DDW is 4GB.
When the device driver calls dma_supported, with mask less then 64-bit, the PowerPC IOMMU driver places PHB in the Limited Addressing Mode before creating DDW.
--- arch/powerpc/platforms/pseries/iommu.c | 110 +++++++++++++++++++++---- 1 file changed, 94 insertions(+), 16 deletions(-)
arch/powerpc/platforms/pseries/iommu.c +94 -16
@@ -52,7 +52,8 @@ enum {enum {DDW_EXT_SIZE =0 ,DDW_EXT_RESET_DMA_WIN =1 , -DDW_EXT_QUERY_OUT_SIZE =2 +DDW_EXT_QUERY_OUT_SIZE =2 , +DDW_EXT_LIMITED_ADDR_MODE =3 };static struct iommu_table *iommu_pseries_alloc_table (int node)
@@ -1327,6 +1328,54 @@ static void reset_dma_window(struct pci_dev *dev, struct device_node *par_dn) ret); } +/* +* Platforms support placing PHB in limited address mode starting with LoPAR +* level 2.13 implement. In this mode, the DMA address returned by DDW is over +* 4GB but, less than 64-bits. This benefits IO adapters that don't support +* 64-bits for DMA addresses. +*/ +static int limited_dma_window (struct pci_dev *dev,struct device_node *par_dn) +{ +int ret; +u32 cfg_addr, reset_dma_win, las_supported; +u64 buid; +struct device_node *dn; +struct pci_dn *pdn; + + ret =ddw_read_ext (par_dn,DDW_EXT_RESET_DMA_WIN , &reset_dma_win); +if (ret) + goto out; + + ret =ddw_read_ext (par_dn,DDW_EXT_LIMITED_ADDR_MODE , &las_supported); + +/* Limited Address Space extension available on the platform but DDW in +* limited addressing mode not supported +*/ +if (!ret && !las_supported) + ret = -EPROTO ; + +if (ret) { +dev_info (&dev->dev,"Limited Address Space for DDW not Supported, err: %d" , ret); + goto out; + } + + dn =pci_device_to_OF_node (dev); + pdn =PCI_DN (dn); + buid = pdn->phb->buid; + cfg_addr = (pdn->busno <<16 ) | (pdn->devfn <<8 ); + + ret =rtas_call (reset_dma_win,4 ,1 ,NULL , cfg_addr,BUID_HI (buid), +BUID_LO (buid),1 ); +if (ret) +dev_info (&dev->dev, +"ibm,reset-pe-dma-windows(%x) for Limited Addr Support: %x %x %x returned %d " , + reset_dma_win, cfg_addr,BUID_HI (buid),BUID_LO (buid), + ret); + +out: +return ret; +} +/* Return largest page shift based on "IO Page Sizes" output of ibm,query-pe-dma-window. */ static int iommu_get_page_shift (u32 query_page_size) {
@@ -1394,7 +1443,7 @@ static struct property *ddw_property_create(const char *propname, u32 liobn, u64* * returns true if can map all pages (direct mapping), false otherwise.. */ -static bool enable_ddw (struct pci_dev *dev,struct device_node *pdn) +static bool enable_ddw (struct pci_dev *dev,struct device_node *pdn,u64 dma_mask) {int len =0 , ret;int max_ram_len =order_base_2 (ddw_memory_hotplug_max ());
@@ -1413,6 +1462,9 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)bool pmem_present;struct pci_dn *pci =PCI_DN (pdn);struct property *default_win =NULL ; +bool limited_addr_req = false, limited_addr_enabled = false; +int dev_max_ddw; +int ddw_sz; dn =of_find_node_by_type (NULL ,"ibm,pmemory" ); pmem_present = dn !=NULL ;
@@ -1439,7 +1491,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)* the ibm,ddw-applicable property holds the tokens for: * ibm,query-pe-dma-window * ibm,create-pe-dma-window -* ibm,remove-pe-dma-window * for the given node in that order. * the property is actually in the parent, not the PE */
@@ -1459,6 +1510,20 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)if (ret !=0 ) goto out_failed; +/* DMA Limited Addressing required? This is when the driver has +* requested to create DDW but supports mask which is less than 64-bits +*/ + limited_addr_req = (dma_mask !=DMA_BIT_MASK (64 )); + +/* place the PHB in Limited Addressing mode */ +if (limited_addr_req) { +if (limited_dma_window (dev, pdn)) + goto out_failed; + +/* PHB is in Limited address mode */ + limited_addr_enabled = true; + } +/* * If there is no window available, remove the default DMA window, * if it's present. This will make all the resources available to the
@@ -1505,6 +1570,15 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) goto out_failed; } +/* Maximum DMA window size that the device can address (in log2) */ + dev_max_ddw =fls64 (dma_mask); + +/* If the device DMA mask is less than 64-bits, make sure the DMA window +* size is not bigger than what the device can access +*/ + ddw_sz =min (order_base_2 (query.largest_available_block << page_shift), + dev_max_ddw); +/* * The "ibm,pmemory" can appear anywhere in the address space. * Assuming it is still backed by page structs, try MAX_PHYSMEM_BITS
@@ -1513,23 +1587,21 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)*/ len = max_ram_len;if (pmem_present) { -if (query.largest_available_block >= - (1ULL << (MAX_PHYSMEM_BITS - page_shift))) +if (ddw_sz >=MAX_PHYSMEM_BITS ) len =MAX_PHYSMEM_BITS ;else dev_info (&dev->dev,"Skipping ibm,pmemory" ); }/* check if the available block * number of ptes will map everything */ -if (query.largest_available_block < (1ULL << (len - page_shift))) { +if (ddw_sz < len) {dev_dbg (&dev->dev,"can't map partition max 0x%llx with %llu %llu-sized pages\n" ,1ULL << len, query.largest_available_block,1ULL << page_shift); - len =order_base_2 (query.largest_available_block << page_shift); - + len = ddw_sz; dynamic_mapping = true; }else { direct_mapping = !default_win_removed ||
@@ -1543,8 +1615,9 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)*/ if (default_win_removed && pmem_present && !direct_mapping) {/* DDW is big enough to be split */ -if ((query.largest_available_block << page_shift) >= -MIN_DDW_VPMEM_DMA_WINDOW + (1ULL << max_ram_len)) { +if ((1ULL << ddw_sz) >= +MIN_DDW_VPMEM_DMA_WINDOW + (1ULL << max_ram_len)) { + direct_mapping = true;/* offset of the Dynamic part of DDW */
@@ -1555,8 +1628,7 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) dynamic_mapping = true;/* create max size DDW possible */ - len =order_base_2 (query.largest_available_block - << page_shift); + len = ddw_sz; } }
@@ -1685,7 +1757,7 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)__remove_dma_window (pdn, ddw_avail, create.liobn); out_failed: -if (default_win_removed) +if (default_win_removed || limited_addr_enabled)reset_dma_window (dev, pdn); fpdn =kzalloc (sizeof (*fpdn),GFP_KERNEL );
@@ -1704,6 +1776,9 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn) dev->dev.bus_dma_limit = dev->dev.archdata.dma_offset + (1ULL << max_ram_len); +dev_info (&dev->dev,"lsa_required: %x, lsa_enabled: %x, direct mapping: %x\n" , + limited_addr_req, limited_addr_enabled, direct_mapping); +return direct_mapping; }
@@ -1829,8 +1904,11 @@ static bool iommu_bypass_supported_pSeriesLP(struct pci_dev *pdev, u64 dma_mask) {struct device_node *dn =pci_device_to_OF_node (pdev), *pdn; -/* only attempt to use a new window if 64-bit DMA is requested */ -if (dma_mask <DMA_BIT_MASK (64 )) +/* For DDW, DMA mask should be more than 32-bits. For mask more then +* 32-bits but less then 64-bits, DMA addressing is supported in +* Limited Addressing mode. +*/ +if (dma_mask <=DMA_BIT_MASK (32 ))return false;dev_dbg (&pdev->dev,"node is %pOF\n" , dn);
@@ -1843,7 +1921,7 @@ static bool iommu_bypass_supported_pSeriesLP(struct pci_dev *pdev, u64 dma_mask)*/ pdn =pci_dma_find (dn,NULL );if (pdn &&PCI_DN (pdn)) -return enable_ddw (pdev, pdn); +return enable_ddw (pdev, pdn, dma_mask);return false; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 510/642 arch/powerpc/perf: Check the instruction type before creating sample with perf_mem_data_src
In reply to Sasha LevinFrom: Athira Rajeev <[email protected]>
[ Upstream commit 2ffb26afa64261139e608bf087a0c1fe24d76d4d ]
perf mem report aborts as below sometimes (during some corner case) in powerpc:
# ./perf mem report 1>out *** stack smashing detected ***: terminated Aborted (core dumped)
The backtrace is as below:
__pthread_kill_implementation ()
raise ()
abort ()
__libc_message
__fortify_fail
__stack_chk_fail
hist_entry.lvl_snprintf
__sort__hpp_entry
__hist_entry__snprintf
hists.fprintf
cmd_report
cmd_mem
Snippet of code which triggers the issue
from tools/perf/util/sort.c
static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
char out[64]; perf_mem__lvl_scnprintf(out, sizeof(out), he->mem_info);
return repsep_snprintf(bf, size, "%-*s", width, out);}
The value of "out" is filled from perf_mem_data_src value. Debugging this further showed that for some corner cases, the value of "data_src" was pointing to wrong value. This resulted in bigger size of string and causing stack check fail.
The perf mem data source values are captured in the sample via isa207_get_mem_data_src function. The initial check is to fetch the type of sampled instruction. If the type of instruction is not valid (not a load/store instruction), the function returns.
Since 'commit e16fd7f2cb1a ("perf: Use sample_flags for data_src")', data_src field is not initialized by the perf_sample_data_init() function. If the PMU driver doesn't set the data_src value to zero if type is not valid, this will result in uninitailised value for data_src. The uninitailised value of data_src resulted in stack check fail followed by abort for "perf mem report".
When requesting for data source information in the sample, the instruction type is expected to be load or store instruction. In ISA v3.0, due to hardware limitation, there are corner cases where the instruction type other than load or store is observed. In ISA v3.0 and before values "0" and "7" are considered reserved. In ISA v3.1, value "7" has been used to indicate "larx/stcx". Drop the sample if instruction type has reserved values for this field with a ISA version check. Initialize data_src to zero in isa207_get_mem_data_src if the instruction type is not load/store.
--- arch/powerpc/perf/core-book3s.c | 20 ++++++++++++++++++++ arch/powerpc/perf/isa207-common.c | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +20 -0
@@ -2226,6 +2226,10 @@ static struct pmu power_pmu = {#define PERF_SAMPLE_ADDR_TYPE (PERF_SAMPLE_ADDR | \ PERF_SAMPLE_PHYS_ADDR | \ PERF_SAMPLE_DATA_PAGE_SIZE) + +#define SIER_TYPE_SHIFT 15 +#define SIER_TYPE_MASK (0x7ull << SIER_TYPE_SHIFT) +/* * A counter has overflowed; update its count and record * things if requested. Note that interrupts are hard-disabled
@@ -2294,6 +2298,22 @@ static void record_and_restart(struct perf_event *event, unsigned long val, is_kernel_addr(mfspr(SPRN_SIAR))) record =0 ; +/* +* SIER[46-48] presents instruction type of the sampled instruction. +* In ISA v3.0 and before values "0" and "7" are considered reserved. +* In ISA v3.1, value "7" has been used to indicate "larx/stcx". +* Drop the sample if "type" has reserved values for this field with a +* ISA version check. +*/ +if (event->attr.sample_type &PERF_SAMPLE_DATA_SRC && + ppmu->get_mem_data_src) { + val = (regs->dar &SIER_TYPE_MASK ) >>SIER_TYPE_SHIFT ; +if (val ==0 || (val ==7 && !cpu_has_feature (CPU_FTR_ARCH_31 ))) { + record =0 ; +atomic64_inc (&event->lost_samples); + } + } +/* * Finally record data if requested. */
arch/powerpc/perf/isa207-common.c +3 -1
@@ -321,8 +321,10 @@ void isa207_get_mem_data_src(union perf_mem_data_src *dsrc, u32 flags, sier =mfspr (SPRN_SIER ); val = (sier &ISA207_SIER_TYPE_MASK ) >>ISA207_SIER_TYPE_SHIFT ; -if (val !=1 && val !=2 && !(val ==7 &&cpu_has_feature (CPU_FTR_ARCH_31 ))) +if (val !=1 && val !=2 && !(val ==7 &&cpu_has_feature (CPU_FTR_ARCH_31 ))) { + dsrc->val =0 ;return ; + } idx = (sier &ISA207_SIER_LDST_MASK ) >>ISA207_SIER_LDST_SHIFT ; sub_idx = (sier &ISA207_SIER_DATA_SRC_MASK ) >>ISA207_SIER_DATA_SRC_SHIFT ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 511/642 ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure().
In reply to Sasha LevinFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d ]
The following patch will not set skb->sk from VRF path.
Let's fetch net from fib_rule->fr_net instead of sock_net(skb->sk) in fib[46]_rule_configure().
--- net/ipv4/fib_rules.c | 4 ++-- net/ipv6/fib6_rules.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/fib_rules.c +2 -2
@@ -245,9 +245,9 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { - struct net *net = sock_net(skb->sk); + struct fib4_rule *rule4 = (struct fib4_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct fib4_rule *rule4 = (struct fib4_rule *) rule;if (tb[FRA_FLOWLABEL ] || tb[FRA_FLOWLABEL_MASK ]) { NL_SET_ERR_MSG(extack,
net/ipv6/fib6_rules.c +2 -2
@@ -399,9 +399,9 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { + struct fib6_rule *rule6 = (struct fib6_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct net *net =sock_net (skb->sk); -struct fib6_rule *rule6 = (struct fib6_rule *) rule;if (!inet_validate_dscp (frh->tos)) { NL_SET_ERR_MSG(extack,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 512/642 r8152: add vendor/device ID pair for Dell Alienware AW1022z
In reply to Sasha LevinFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 848b09d53d923b4caee5491f57a5c5b22d81febc ]
The Dell AW1022z is an RTL8156B based 2.5G Ethernet controller.
Add the vendor and product ID values to the driver. This makes Ethernet work with the adapter.
--- drivers/net/usb/r8152.c | 1 + include/linux/usb/r8152.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/usb/r8152.c +1 -0
@@ -10085,6 +10085,7 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) }, { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) }, + { USB_DEVICE(VENDOR_ID_DELL, 0xb097) }, { USB_DEVICE(VENDOR_ID_ASUS, 0x1976) }, {} };
include/linux/usb/r8152.h +1 -0
@@ -30,6 +30,7 @@#define VENDOR_ID_NVIDIA 0x0955#define VENDOR_ID_TPLINK 0x2357#define VENDOR_ID_DLINK 0x2001 +#define VENDOR_ID_DELL 0x413c#define VENDOR_ID_ASUS 0x0b05#if IS_REACHABLE (CONFIG_USB_RTL8152 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 513/642 s390/crash: Use note name macros
In reply to Sasha LevinFrom: Akihiko Odaki <[email protected]>
[ Upstream commit d4a760fb77fdac07efa3da4fa4a18f49f178d048 ]
Use note name macros to match with the userspace's expectation.
--- arch/s390/kernel/crash_dump.c | 62 +++++++++++++---------------------- 1 file changed, 23 insertions(+), 39 deletions(-)
arch/s390/kernel/crash_dump.c +23 -39
@@ -246,15 +246,6 @@ bool is_kdump_kernel(void) }EXPORT_SYMBOL_GPL (is_kdump_kernel); -static const char *nt_name (Elf64_Word type) -{ -const char *name ="LINUX" ; - -if (type ==NT_PRPSINFO || type ==NT_PRSTATUS || type ==NT_PRFPREG ) - name =KEXEC_CORE_NOTE_NAME ; -return name; -} -/* * Initialize ELF note */
@@ -279,10 +270,8 @@ static void *nt_init_name(void *buf, Elf64_Word type, void *desc, int d_len,return PTR_ADD (buf, len); } -static inline void *nt_init (void *buf,Elf64_Word type,void *desc,int d_len) -{ -return nt_init_name (buf, type, desc, d_len,nt_name (type)); -} +#define nt_init (buf, type, desc) \ + nt_init_name(buf, NT_ ## type, &(desc), sizeof(desc), NN_ ## type)/* * Calculate the size of ELF note
@@ -298,10 +287,7 @@ static size_t nt_size_name(int d_len, const char *name)return size; } -static inline size_t nt_size (Elf64_Word type,int d_len) -{ -return nt_size_name (d_len,nt_name (type)); -} +#define nt_size (type, desc) nt_size_name(sizeof(desc), NN_ ## type)/* * Fill ELF notes for one CPU with save area registers
@@ -322,18 +308,16 @@ static void *fill_cpu_elf_notes(void *ptr, int cpu, struct save_area *sa)memcpy (&nt_fpregset.fpc, &sa->fpc,sizeof (sa->fpc));memcpy (&nt_fpregset.fprs, &sa->fprs,sizeof (sa->fprs));/* Create ELF notes for the CPU */ - ptr =nt_init (ptr,NT_PRSTATUS , &nt_prstatus,sizeof (nt_prstatus)); - ptr =nt_init (ptr,NT_PRFPREG , &nt_fpregset,sizeof (nt_fpregset)); - ptr =nt_init (ptr,NT_S390_TIMER , &sa->timer,sizeof (sa->timer)); - ptr =nt_init (ptr,NT_S390_TODCMP , &sa->todcmp,sizeof (sa->todcmp)); - ptr =nt_init (ptr,NT_S390_TODPREG , &sa->todpreg,sizeof (sa->todpreg)); - ptr =nt_init (ptr,NT_S390_CTRS , &sa->ctrs,sizeof (sa->ctrs)); - ptr =nt_init (ptr,NT_S390_PREFIX , &sa->prefix,sizeof (sa->prefix)); + ptr =nt_init (ptr,PRSTATUS , nt_prstatus); + ptr =nt_init (ptr,PRFPREG , nt_fpregset); + ptr =nt_init (ptr,S390_TIMER , sa->timer); + ptr =nt_init (ptr,S390_TODCMP , sa->todcmp); + ptr =nt_init (ptr,S390_TODPREG , sa->todpreg); + ptr =nt_init (ptr,S390_CTRS , sa->ctrs); + ptr =nt_init (ptr,S390_PREFIX , sa->prefix);if (cpu_has_vx ()) { - ptr =nt_init (ptr,NT_S390_VXRS_HIGH , - &sa->vxrs_high,sizeof (sa->vxrs_high)); - ptr =nt_init (ptr,NT_S390_VXRS_LOW , - &sa->vxrs_low,sizeof (sa->vxrs_low)); + ptr =nt_init (ptr,S390_VXRS_HIGH , sa->vxrs_high); + ptr =nt_init (ptr,S390_VXRS_LOW , sa->vxrs_low); }return ptr; }
@@ -346,16 +330,16 @@ static size_t get_cpu_elf_notes_size(void)struct save_area *sa =NULL ;size_t size; - size =nt_size (NT_PRSTATUS ,sizeof (struct elf_prstatus )); - size +=nt_size (NT_PRFPREG ,sizeof (elf_fpregset_t)); - size +=nt_size (NT_S390_TIMER ,sizeof (sa->timer)); - size +=nt_size (NT_S390_TODCMP ,sizeof (sa->todcmp)); - size +=nt_size (NT_S390_TODPREG ,sizeof (sa->todpreg)); - size +=nt_size (NT_S390_CTRS ,sizeof (sa->ctrs)); - size +=nt_size (NT_S390_PREFIX ,sizeof (sa->prefix)); + size = nt_size(PRSTATUS, struct elf_prstatus); + size +=nt_size (PRFPREG , elf_fpregset_t); + size +=nt_size (S390_TIMER , sa->timer); + size +=nt_size (S390_TODCMP , sa->todcmp); + size +=nt_size (S390_TODPREG , sa->todpreg); + size +=nt_size (S390_CTRS , sa->ctrs); + size +=nt_size (S390_PREFIX , sa->prefix);if (cpu_has_vx ()) { - size +=nt_size (NT_S390_VXRS_HIGH ,sizeof (sa->vxrs_high)); - size +=nt_size (NT_S390_VXRS_LOW ,sizeof (sa->vxrs_low)); + size +=nt_size (S390_VXRS_HIGH , sa->vxrs_high); + size +=nt_size (S390_VXRS_LOW , sa->vxrs_low); }return size;
@@ -371,7 +355,7 @@ static void *nt_prpsinfo(void *ptr)memset (&prpsinfo,0 ,sizeof (prpsinfo)); prpsinfo.pr_sname ='R' ;strcpy (prpsinfo.pr_fname,"vmlinux" ); -return nt_init (ptr,NT_PRPSINFO , &prpsinfo,sizeof (prpsinfo)); +return nt_init (ptr,PRPSINFO , prpsinfo); }/*
@@ -610,7 +594,7 @@ static size_t get_elfcorehdr_size(int phdr_count)/* PT_NOTES */ size +=sizeof (Elf64_Phdr);/* nt_prpsinfo */ - size +=nt_size (NT_PRPSINFO ,sizeof (struct elf_prpsinfo )); + size += nt_size(PRPSINFO, struct elf_prpsinfo);/* regsets */ size +=get_cpu_cnt () *get_cpu_elf_notes_size ();/* nt_vmcoreinfo */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 514/642 iio: adc: ad7944: don't use storagebits for sizing
In reply to Sasha LevinFrom: David Lechner <[email protected]>
[ Upstream commit 503d20ed8cf7c7b40ec0bd94f53c490c1d91c31b ]
Replace use of storagebits with realbits for determining the number of bytes needed for SPI transfers.
When adding SPI offload support, storagebits will always be 32 rather than 16 for 16-bit 16-bit chips so we can no longer rely on storagebits being the correct size expected by the SPI framework (it always uses 4 bytes for > 16-bit xfers and 2 bytes for > 8-bit xfers). Instead, derive the correct size from realbits since it will always be correct even when SPI offloading is used.
Reviewed-vy: Nuno Sa <[email protected]>
--- drivers/iio/adc/ad7944.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/iio/adc/ad7944.c +9 -7
@@ -98,6 +98,9 @@ struct ad7944_chip_info {const struct iio_chan_spec channels[2 ]; }; +/* get number of bytes for SPI xfer */ +#define AD7944_SPI_BYTES (scan_type) ((scan_type).realbits > 16 ? 4 : 2) +/* * AD7944_DEFINE_CHIP_INFO - Define a chip info structure for a specific chip * @_name: The name of the chip
@@ -164,7 +167,7 @@ static int ad7944_3wire_cs_mode_init_msg(struct device *dev, struct ad7944_adc */* Then we can read the data during the acquisition phase */ xfers[2 ].rx_buf = &adc->sample.raw; - xfers[2 ].len =BITS_TO_BYTES (chan->scan_type.storagebits); + xfers[2 ].len =AD7944_SPI_BYTES (chan->scan_type); xfers[2 ].bits_per_word = chan->scan_type.realbits;spi_message_init_with_transfers (&adc->msg, xfers,3 );
@@ -193,7 +196,7 @@ static int ad7944_4wire_mode_init_msg(struct device *dev, struct ad7944_adc *adc xfers[0 ].delay.unit =SPI_DELAY_UNIT_NSECS ; xfers[1 ].rx_buf = &adc->sample.raw; - xfers[1 ].len =BITS_TO_BYTES (chan->scan_type.storagebits); + xfers[1 ].len =AD7944_SPI_BYTES (chan->scan_type); xfers[1 ].bits_per_word = chan->scan_type.realbits;spi_message_init_with_transfers (&adc->msg, xfers,2 );
@@ -228,7 +231,7 @@ static int ad7944_chain_mode_init_msg(struct device *dev, struct ad7944_adc *adc xfers[0 ].delay.unit =SPI_DELAY_UNIT_NSECS ; xfers[1 ].rx_buf = adc->chain_mode_buf; - xfers[1 ].len =BITS_TO_BYTES (chan->scan_type.storagebits) * n_chain_dev; + xfers[1 ].len =AD7944_SPI_BYTES (chan->scan_type) * n_chain_dev; xfers[1 ].bits_per_word = chan->scan_type.realbits;spi_message_init_with_transfers (&adc->msg, xfers,2 );
@@ -274,12 +277,12 @@ static int ad7944_single_conversion(struct ad7944_adc *adc,return ret;if (adc->spi_mode ==AD7944_SPI_MODE_CHAIN ) { -if (chan->scan_type.storagebits >16 ) +if (chan->scan_type.realbits >16 ) *val = ((u32 *)adc->chain_mode_buf)[chan->scan_index];else *val = ((u16 *)adc->chain_mode_buf)[chan->scan_index]; }else { -if (chan->scan_type.storagebits >16 ) +if (chan->scan_type.realbits >16 ) *val = adc->sample.raw.u32;else *val = adc->sample.raw.u16;
@@ -409,8 +412,7 @@ static int ad7944_chain_mode_alloc(struct device *dev,/* 1 word for each voltage channel + aligned u64 for timestamp */ chain_mode_buf_size =ALIGN (n_chain_dev * -BITS_TO_BYTES (chan[0 ].scan_type.storagebits),sizeof (u64)) - +sizeof (u64); +AD7944_SPI_BYTES (chan[0 ].scan_type),sizeof (u64)) +sizeof (u64); buf =devm_kzalloc (dev, chain_mode_buf_size,GFP_KERNEL );if (!buf)return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 515/642 igc: Avoid unnecessary link down event in XDP_SETUP_PROG process
In reply to Sasha LevinFrom: Song Yoong Siang <[email protected]>
[ Upstream commit be324b790368c1522f07c6bb5654122e07b5e588 ]
The igc_close()/igc_open() functions are too drastic for installing a new XDP prog because they cause undesirable link down event and device reset.
To avoid delays in Ethernet traffic, improve the XDP_SETUP_PROG process by using the same sequence as igc_xdp_setup_pool(), which performs only the necessary steps, as follows:
1. stop the traffic and clean buffer
2. stop NAPI
3. install the XDP program
4. resume NAPI
5. allocate buffer and resume the traffic
This patch has been tested using the 'ip link set xdpdrv' command to attach a simple XDP prog that always returns XDP_PASS.
Before this patch, attaching xdp program will cause ptp4l to lose sync for few seconds, as shown in ptp4l log below:
ptp4l[198.082]: rms 4 max 8 freq +906 +/- 2 delay 12 +/- 0 ptp4l[199.082]: rms 3 max 4 freq +906 +/- 3 delay 12 +/- 0 ptp4l[199.536]: port 1 (enp2s0): link down ptp4l[199.536]: port 1 (enp2s0): SLAVE to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED) ptp4l[199.600]: selected local clock 22abbc.fffe.bb1234 as best master ptp4l[199.600]: port 1 (enp2s0): assuming the grand master role ptp4l[199.600]: port 1 (enp2s0): master state recommended in slave only mode ptp4l[199.600]: port 1 (enp2s0): defaultDS.priority1 probably misconfigured ptp4l[202.266]: port 1 (enp2s0): link up ptp4l[202.300]: port 1 (enp2s0): FAULTY to LISTENING on INIT_COMPLETE ptp4l[205.558]: port 1 (enp2s0): new foreign master 44abbc.fffe.bb2144-1 ptp4l[207.558]: selected best master clock 44abbc.fffe.bb2144 ptp4l[207.559]: port 1 (enp2s0): LISTENING to UNCALIBRATED on RS_SLAVE ptp4l[208.308]: port 1 (enp2s0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED ptp4l[208.933]: rms 742 max 1303 freq -195 +/- 682 delay 12 +/- 0 ptp4l[209.933]: rms 178 max 274 freq +387 +/- 243 delay 12 +/- 0
After this patch, attaching xdp program no longer cause ptp4l to lose sync, as shown in ptp4l log below:
ptp4l[201.183]: rms 1 max 3 freq +959 +/- 1 delay 8 +/- 0 ptp4l[202.183]: rms 1 max 3 freq +961 +/- 2 delay 8 +/- 0 ptp4l[203.183]: rms 2 max 3 freq +958 +/- 2 delay 8 +/- 0 ptp4l[204.183]: rms 3 max 5 freq +961 +/- 3 delay 8 +/- 0 ptp4l[205.183]: rms 2 max 4 freq +964 +/- 3 delay 8 +/- 0
Besides, before this patch, attaching xdp program will causes flood ping to lose 10 packets, as shown in ping statistics below:
--- 169.254.1.2 ping statistics ---
100000 packets transmitted, 99990 received, +6 errors, 0.01% packet loss, time 34001ms rtt min/avg/max/mdev = 0.028/0.301/3104.360/13.838 ms, pipe 10, ipg/ewma 0.340/0.243 ms
After this patch, attaching xdp program no longer cause flood ping to loss any packets, as shown in ping statistics below:
--- 169.254.1.2 ping statistics ---
100000 packets transmitted, 100000 received, 0% packet loss, time 32326ms rtt min/avg/max/mdev = 0.027/0.231/19.589/0.155 ms, pipe 2, ipg/ewma 0.323/0.322 ms
On the other hand, this patch has been tested with tools/testing/selftests/ bpf/xdp_hw_metadata app to make sure AF_XDP zero-copy is working fine with XDP Tx and Rx metadata. Below is the result of last packet after received 10000 UDP packets with interval 1 ms:
poll: 1 (0) skip=0 fail=0 redir=10000
xsk_ring_cons__peek: 1
0x55881c7ef7a8: rx_desc[9999]->addr=8f110 addr=8f110 comp_addr=8f110 EoP
rx_hash: 0xFB9BB6A3 with RSS type:0x1
HW RX-time: 1733923136269470866 (sec:1733923136.2695) delta to User RX-time sec:0.0000 (43.280 usec)
XDP RX-time: 1733923136269482482 (sec:1733923136.2695) delta to User RX-time sec:0.0000 (31.664 usec)
No rx_vlan_tci or rx_vlan_proto, err=-95
0x55881c7ef7a8: ping-pong with csum=ab19 (want 315b) csum_start=34 csum_offset=6 0x55881c7ef7a8: complete tx idx=9999 addr=f010
HW TX-complete-time: 1733923136269591637 (sec:1733923136.2696) delta to User TX-complete-time sec:0.0001 (108.571 usec)
XDP RX-time: 1733923136269482482 (sec:1733923136.2695) delta to User TX-complete-time sec:0.0002 (217.726 usec)
HW RX-time: 1733923136269470866 (sec:1733923136.2695) delta to HW TX-complete-time sec:0.0001 (120.771 usec)
0x55881c7ef7a8: complete rx idx=10127 addr=8f110
--- drivers/net/ethernet/intel/igc/igc_xdp.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc_xdp.c +15 -4
@@ -14,6 +14,7 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog,bool if_running =netif_running (dev);struct bpf_prog *old_prog;bool need_update; +unsigned int i;if (dev->mtu >ETH_DATA_LEN ) {/* For now, the driver doesn't support XDP functionality with
@@ -24,8 +25,13 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog, } need_update = !!adapter->xdp_prog != !!prog; -if (if_running && need_update) -igc_close (dev); +if (if_running && need_update) { +for (i =0 ; i < adapter->num_rx_queues; i++) { +igc_disable_rx_ring (adapter->rx_ring[i]); +igc_disable_tx_ring (adapter->tx_ring[i]); +napi_disable (&adapter->rx_ring[i]->q_vector->napi); + } + } old_prog =xchg (&adapter->xdp_prog, prog);if (old_prog)
@@ -36,8 +42,13 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog,else xdp_features_clear_redirect_target (dev); -if (if_running && need_update) -igc_open (dev); +if (if_running && need_update) { +for (i =0 ; i < adapter->num_rx_queues; i++) { +napi_enable (&adapter->rx_ring[i]->q_vector->napi); +igc_enable_tx_ring (adapter->tx_ring[i]); +igc_enable_rx_ring (adapter->rx_ring[i]); + } + }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 516/642 pstore: Change kmsg_bytes storage size to u32
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 5674609535bafa834ab014d90d9bbe8e89223a0b ]
The types around kmsg_bytes were inconsistent. The global was unsigned long, the argument to pstore_set_kmsg_bytes() was int, and the filesystem option was u32. Given other internal limits, there's not much sense in making a single pstore record larger than INT_MAX and it can't be negative, so use u32 everywhere. Additionally, use READ/WRITE_ONCE and a local variable in pstore_dump() to avoid kmsg_bytes changing during a dump.
--- fs/pstore/inode.c | 2 +- fs/pstore/internal.h | 4 ++-- fs/pstore/platform.c | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-)
fs/pstore/inode.c +1 -1
@@ -265,7 +265,7 @@ static void parse_options(char *options)static int pstore_show_options (struct seq_file *m,struct dentry *root) {if (kmsg_bytes !=CONFIG_PSTORE_DEFAULT_KMSG_BYTES ) -seq_printf (m,",kmsg_bytes=%lu" , kmsg_bytes); +seq_printf (m,",kmsg_bytes=%u" , kmsg_bytes);return 0 ; }
fs/pstore/internal.h +2 -2
@@ -6,7 +6,7 @@#include <linux/time.h> #include <linux/pstore.h> -extern unsigned long kmsg_bytes; +extern unsigned int kmsg_bytes;#ifdef CONFIG_PSTORE_FTRACE extern void pstore_register_ftrace (void );
@@ -35,7 +35,7 @@ static inline void pstore_unregister_pmsg(void) {}extern struct pstore_info *psinfo; -extern void pstore_set_kmsg_bytes (int ); +extern void pstore_set_kmsg_bytes (unsigned int bytes);extern void pstore_get_records (int );extern void pstore_get_backend_records (struct pstore_info *psi,struct dentry *root,int quiet);
fs/pstore/platform.c +6 -5
@@ -92,8 +92,8 @@ module_param(compress, charp, 0444);MODULE_PARM_DESC (compress,"compression to use" );/* How much of the kernel log to snapshot */ -unsigned long kmsg_bytes =CONFIG_PSTORE_DEFAULT_KMSG_BYTES ; -module_param (kmsg_bytes, ulong,0444 ); +unsigned int kmsg_bytes =CONFIG_PSTORE_DEFAULT_KMSG_BYTES ; +module_param (kmsg_bytes, uint,0444 );MODULE_PARM_DESC (kmsg_bytes,"amount of kernel log to snapshot (in bytes)" );static void *compress_workspace;
@@ -107,9 +107,9 @@ static void *compress_workspace;static char *big_oops_buf;static size_t max_compressed_size; -void pstore_set_kmsg_bytes (int bytes) +void pstore_set_kmsg_bytes (unsigned int bytes) { - kmsg_bytes = bytes; +WRITE_ONCE (kmsg_bytes, bytes); }/* Tag each group of saved records with a sequence number */
@@ -278,6 +278,7 @@ static void pstore_dump(struct kmsg_dumper *dumper, struct kmsg_dump_detail *detail) {struct kmsg_dump_iter iter; +unsigned int remaining =READ_ONCE (kmsg_bytes);unsigned long total =0 ;const char *why;unsigned int part =1 ;
@@ -300,7 +301,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,kmsg_dump_rewind (&iter); oopscount++; -while (total < kmsg_bytes) { +while (total < remaining) {char *dst;size_t dst_size;int header_size;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 517/642 leds: trigger: netdev: Configure LED blink interval for HW offload
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit c629c972b310af41e9e072febb6dae9a299edde6 ]
In case a PHY LED implements .blink_set callback to set LED blink interval, call it even if .hw_control is already set, as that LED blink interval likely controls the blink rate of that HW offloaded LED. For PHY LEDs, that can be their activity blinking interval.
The software blinking is not affected by this change.
With this change, the LED interval setting looks something like this:
$ echo netdev > /sys/class/leds/led:green:lan/trigger $ echo 1 > /sys/class/leds/led:green:lan/brightness $ echo 250 > /sys/class/leds/led:green:lan/interval
--- drivers/leds/trigger/ledtrig-netdev.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/leds/trigger/ledtrig-netdev.c +13 -3
@@ -68,6 +68,7 @@ struct led_netdev_data {unsigned int last_activity;unsigned long mode; +unsigned long blink_delay;int link_speed;__ETHTOOL_DECLARE_LINK_MODE_MASK (supported_link_modes);u8 duplex;
@@ -86,6 +87,10 @@ static void set_baseline_state(struct led_netdev_data *trigger_data)/* Already validated, hw control is possible with the requested mode */ if (trigger_data->hw_control) { led_cdev->hw_control_set (led_cdev, trigger_data->mode); +if (led_cdev->blink_set) { + led_cdev->blink_set (led_cdev, &trigger_data->blink_delay, + &trigger_data->blink_delay); + }return ; }
@@ -454,10 +459,11 @@ static ssize_t interval_store(struct device *dev, size_t size) {struct led_netdev_data *trigger_data =led_trigger_get_drvdata (dev); +struct led_classdev *led_cdev = trigger_data->led_cdev;unsigned long value;int ret; -if (trigger_data->hw_control) +if (trigger_data->hw_control && !led_cdev->blink_set)return -EINVAL ; ret =kstrtoul (buf,0 , &value);
@@ -466,9 +472,13 @@ static ssize_t interval_store(struct device *dev,/* impose some basic bounds on the timer interval */ if (value >=5 && value <=10000 ) { -cancel_delayed_work_sync (&trigger_data->work); +if (trigger_data->hw_control) { + trigger_data->blink_delay = value; + }else { +cancel_delayed_work_sync (&trigger_data->work); -atomic_set (&trigger_data->interval,msecs_to_jiffies (value)); +atomic_set (&trigger_data->interval,msecs_to_jiffies (value)); + }set_baseline_state (trigger_data);/* resets timer */ }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 518/642 ice: Don't check device type when checking GNSS presence
In reply to Sasha LevinFrom: Karol Kolacinski <[email protected]>
[ Upstream commit e2c6737e6e82e9991646cd5389391bb6d3572a68 ]
Don't check if the device type is E810T as non-E810T devices can support GNSS too and PCA9575 check is enough to determine if GNSS is present or not.
Rename ice_gnss_is_gps_present() to ice_gnss_is_module_present() because GNSS module supports multiple GNSS providers, not only GPS.
Move functions related to PCA9575 from ice_ptp_hw.c to ice_common.c to be able to access them when PTP is disabled in the kernel, but GNSS is enabled.
Remove logical AND with ICE_AQC_LINK_TOPO_NODE_TYPE_M in ice_get_pca9575_handle(), which has no effect, and reorder device type checks to check the device_id first, then set other variables.
--- drivers/net/ethernet/intel/ice/ice_common.c | 90 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_common.h | 2 + drivers/net/ethernet/intel/ice/ice_gnss.c | 29 +++---- drivers/net/ethernet/intel/ice/ice_gnss.h | 4 +- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 93 --------------------- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 1 - 7 files changed, 105 insertions(+), 116 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +90 -0
@@ -5765,6 +5765,96 @@ ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,return ice_aq_send_cmd (hw, &desc,NULL ,0 , cd); } +/** +* ice_get_pca9575_handle - find and return the PCA9575 controller +* @hw: pointer to the hw struct +* @pca9575_handle: GPIO controller's handle +* +* Find and return the GPIO controller's handle in the netlist. +* When found - the value will be cached in the hw structure and following calls +* will return cached value. +* +* Return: 0 on success, -ENXIO when there's no PCA9575 present. +*/ +int ice_get_pca9575_handle (struct ice_hw *hw,u16 *pca9575_handle) +{ +struct ice_aqc_get_link_topo *cmd; +struct ice_aq_desc desc; +int err; +u8 idx; + +/* If handle was read previously return cached value */ +if (hw->io_expander_handle) { + *pca9575_handle = hw->io_expander_handle; +return 0 ; + } + +#define SW_PCA9575_SFP_TOPO_IDX 2 +#define SW_PCA9575_QSFP_TOPO_IDX 1 + +/* Check if the SW IO expander controlling SMA exists in the netlist. */ +if (hw->device_id ==ICE_DEV_ID_E810C_SFP ) + idx =SW_PCA9575_SFP_TOPO_IDX ; +else if (hw->device_id ==ICE_DEV_ID_E810C_QSFP ) + idx =SW_PCA9575_QSFP_TOPO_IDX ; +else +return -ENXIO ; + +/* If handle was not detected read it from the netlist */ +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_get_link_topo); + cmd = &desc.params.get_link_topo; + cmd->addr.topo_params.node_type_ctx = +ICE_AQC_LINK_TOPO_NODE_TYPE_GPIO_CTRL ; + cmd->addr.topo_params.index = idx; + + err =ice_aq_send_cmd (hw, &desc,NULL ,0 ,NULL ); +if (err) +return -ENXIO ; + +/* Verify if we found the right IO expander type */ +if (desc.params.get_link_topo.node_part_num != +ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 ) +return -ENXIO ; + +/* If present save the handle and return it */ + hw->io_expander_handle = +le16_to_cpu (desc.params.get_link_topo.addr.handle); + *pca9575_handle = hw->io_expander_handle; + +return 0 ; +} + +/** +* ice_read_pca9575_reg - read the register from the PCA9575 controller +* @hw: pointer to the hw struct +* @offset: GPIO controller register offset +* @data: pointer to data to be read from the GPIO controller +* +* Return: 0 on success, negative error code otherwise. +*/ +int ice_read_pca9575_reg (struct ice_hw *hw,u8 offset,u8 *data) +{ +struct ice_aqc_link_topo_addr link_topo; +__le16 addr; +u16 handle; +int err; + +memset (&link_topo,0 ,sizeof (link_topo)); + + err =ice_get_pca9575_handle (hw, &handle); +if (err) +return err; + + link_topo.handle =cpu_to_le16 (handle); + link_topo.topo_params.node_type_ctx = +FIELD_PREP (ICE_AQC_LINK_TOPO_NODE_CTX_M , +ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED ); + + addr =cpu_to_le16 ((u16 )offset); + +return ice_aq_read_i2c (hw, link_topo,0 , addr,1 , data,NULL ); +} +/** * ice_aq_set_gpio * @hw: pointer to the hw struct
drivers/net/ethernet/intel/ice/ice_common.h +2 -0
@@ -306,5 +306,7 @@ int ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr, u16 bus_addr, __le16 addr, u8 params, const u8 *data, struct ice_sq_cd *cd); +int ice_get_pca9575_handle (struct ice_hw *hw,u16 *pca9575_handle); +int ice_read_pca9575_reg (struct ice_hw *hw,u8 offset,u8 *data);bool ice_fw_supports_report_dflt_cfg (struct ice_hw *hw);#endif /* _ICE_COMMON_H_ */
drivers/net/ethernet/intel/ice/ice_gnss.c +10 -19
@@ -381,32 +381,23 @@ void ice_gnss_exit(struct ice_pf *pf) }/** -* ice_gnss_is_gps_present - Check if GPS HW is present +* ice_gnss_is_module_present - Check if GNSS HW is present * @hw: pointer to HW struct +* +* Return: true when GNSS is present, false otherwise. */ -bool ice_gnss_is_gps_present (struct ice_hw *hw) +bool ice_gnss_is_module_present (struct ice_hw *hw) { -if (!hw->func_caps.ts_func_info.src_tmr_owned) -return false; +int err; +u8 data; -if (!ice_is_gps_in_netlist (hw)) +if (!hw->func_caps.ts_func_info.src_tmr_owned || + !ice_is_gps_in_netlist (hw))return false; -#if IS_ENABLED (CONFIG_PTP_1588_CLOCK ) -if (ice_is_e810t (hw)) { -int err; -u8 data; - - err =ice_read_pca9575_reg (hw,ICE_PCA9575_P0_IN , &data); -if (err || !!(data &ICE_P0_GNSS_PRSNT_N )) -return false; - }else { -return false; - } -#else -if (!ice_is_e810t (hw)) + err =ice_read_pca9575_reg (hw,ICE_PCA9575_P0_IN , &data); +if (err || !!(data &ICE_P0_GNSS_PRSNT_N ))return false; -#endif /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ return true; }
drivers/net/ethernet/intel/ice/ice_gnss.h +2 -2
@@ -37,11 +37,11 @@ struct gnss_serial {#if IS_ENABLED (CONFIG_GNSS )void ice_gnss_init (struct ice_pf *pf);void ice_gnss_exit (struct ice_pf *pf); -bool ice_gnss_is_gps_present (struct ice_hw *hw); +bool ice_gnss_is_module_present (struct ice_hw *hw);#else static inline void ice_gnss_init (struct ice_pf *pf) { }static inline void ice_gnss_exit (struct ice_pf *pf) { } -static inline bool ice_gnss_is_gps_present (struct ice_hw *hw) +static inline bool ice_gnss_is_module_present (struct ice_hw *hw) {return false; }
drivers/net/ethernet/intel/ice/ice_lib.c +1 -1
@@ -3882,7 +3882,7 @@ void ice_init_feature_support(struct ice_pf *pf)ice_set_feature_support (pf,ICE_F_CGU );if (ice_is_clock_mux_in_netlist (&pf->hw))ice_set_feature_support (pf,ICE_F_SMA_CTRL ); -if (ice_gnss_is_gps_present (&pf->hw)) +if (ice_gnss_is_module_present (&pf->hw))ice_set_feature_support (pf,ICE_F_GNSS );break ;default :
drivers/net/ethernet/intel/ice/ice_ptp_hw.c +0 -93
105 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +0 -1
@@ -395,7 +395,6 @@ int ice_phy_cfg_intr_e82x(struct ice_hw *hw, u8 quad, bool ena, u8 threshold);/* E810 family functions */ int ice_read_sma_ctrl (struct ice_hw *hw,u8 *data);int ice_write_sma_ctrl (struct ice_hw *hw,u8 data); -int ice_read_pca9575_reg (struct ice_hw *hw,u8 offset,u8 *data);int ice_ptp_read_sdp_ac (struct ice_hw *hw,__le16 *entries,uint *num_entries);int ice_cgu_get_num_pins (struct ice_hw *hw,bool input);enum dpll_pin_type ice_cgu_get_pin_type (struct ice_hw *hw,u8 pin,bool input);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 519/642 net: ethtool: prevent flow steering to RSS contexts which don't exist
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit de7f7582dff292832fbdeaeff34e6b2ee6f9f95f ]
Since commit 42dc431f5d0e ("ethtool: rss: prevent rss ctx deletion when in use") we prevent removal of RSS contexts pointed to by existing flow rules. Core should also prevent creation of rules which point to RSS context which don't exist in the first place.
--- net/ethtool/ioctl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ethtool/ioctl.c +8 -4
@@ -993,10 +993,14 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,return rc;/* Nonzero ring with RSS only makes sense if NIC adds them together */ -if (cmd ==ETHTOOL_SRXCLSRLINS && info.fs.flow_type &FLOW_RSS && - !ops->cap_rss_rxnfc_adds && -ethtool_get_flow_spec_ring (info.fs.ring_cookie)) -return -EINVAL ; +if (cmd ==ETHTOOL_SRXCLSRLINS && info.fs.flow_type &FLOW_RSS ) { +if (!ops->cap_rss_rxnfc_adds && +ethtool_get_flow_spec_ring (info.fs.ring_cookie)) +return -EINVAL ; + +if (!xa_load (&dev->ethtool->rss_ctx, info.rss_context)) +return -EINVAL ; + }if (cmd ==ETHTOOL_SRXFH && ops->get_rxfh) {struct ethtool_rxfh_param rxfh = {};
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.14 519/642] net: ethtool: prevent flow steering to RSS contexts which don't exist
Quoted 9 lines · Sasha Levin
From: Jakub Kicinski <[email protected]>
[ Upstream commit
de7f7582dff292832fbdeaeff34e6b2ee6f9f95f]Since commit
42dc431f5d0e("ethtool: rss: prevent rss ctx deletion when in use") we prevent removal of RSS contexts pointed to by existing flow rules. Core should also prevent creation of rules which point to RSS context which don't exist in the first place.
Quoted 4 lines
Reviewed-by Joe Damato <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
This patch caused a user-visible regression, I don't recommend taking it to stable.
FWIW, I tried to fix it:
https://lore.kernel.org/netdev/[email protected]/
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 519/642] net: ethtool: prevent flow steering to RSS contexts which don't exist
Quoted 15 lines · Gal Pressman
Quoted 9 lines · Sasha Levin
From: Jakub Kicinski <[email protected]>
[ Upstream commit
de7f7582dff292832fbdeaeff34e6b2ee6f9f95f]Since commit
42dc431f5d0e("ethtool: rss: prevent rss ctx deletion when in use") we prevent removal of RSS contexts pointed to by existing flow rules. Core should also prevent creation of rules which point to RSS context which don't exist in the first place.Quoted 4 lines
Reviewed-by Joe Damato <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 5 lines
This patch caused a user-visible regression, I don't recommend taking it to stable.
FWIW, I tried to fix it:
https://lore.kernel.org/netdev/[email protected]/
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 520/642 ext4: don't write back data before punch hole in nojournal mode
In reply to Sasha LevinFrom: Zhang Yi <[email protected]>
[ Upstream commit 43d0105e2c7523cc6b14cad65e2044e829c0a07a ]
There is no need to write back all data before punching a hole in non-journaled mode since it will be dropped soon after removing space. Therefore, the call to filemap_write_and_wait_range() can be eliminated. Besides, similar to ext4_zero_range(), we must address the case of partially punched folios when block size < page size. It is essential to remove writable userspace mappings to ensure that the folio can be faulted again during subsequent mmap write access.
In journaled mode, we need to write dirty pages out before discarding page cache in case of crash before committing the freeing data transaction, which could expose old, stale data, even if synchronization has been performed.
--- fs/ext4/inode.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
fs/ext4/inode.c +5 -13
@@ -3957,17 +3957,6 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)trace_ext4_punch_hole (inode, offset, length,0 ); -/* -* Write out all dirty pages to avoid race conditions -* Then release them. -*/ -if (mapping_tagged (mapping,PAGECACHE_TAG_DIRTY )) { - ret =filemap_write_and_wait_range (mapping, offset, - offset + length -1 ); -if (ret) -return ret; - } -inode_lock (inode);/* No need to punch hole beyond i_size */
@@ -4029,8 +4018,11 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) ret =ext4_update_disksize_before_punch (inode, offset, length);if (ret) goto out_dio; -truncate_pagecache_range (inode, first_block_offset, - last_block_offset); + + ret =ext4_truncate_page_cache_block_range (inode, + first_block_offset, last_block_offset +1 ); +if (ret) + goto out_dio; }if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 521/642 ext4: remove writable userspace mappings before truncating page cache
In reply to Sasha LevinFrom: Zhang Yi <[email protected]>
[ Upstream commit 17207d0bb209e8b40f27d7f3f96e82a78af0bf2c ]
When zeroing a range of folios on the filesystem which block size is less than the page size, the file's mapped blocks within one page will be marked as unwritten, we should remove writable userspace mappings to ensure that ext4_page_mkwrite() can be called during subsequent write access to these partial folios. Otherwise, data written by subsequent mmap writes may not be saved to disk.
$mkfs.ext4 -b 1024 /dev/vdb
$mount /dev/vdb /mnt
$xfs_io -t -f -c "pwrite -S 0x58 0 4096" -c "mmap -rw 0 4096" \
-c "mwrite -S 0x5a 2048 2048" -c "fzero 2048 2048" \
-c "mwrite -S 0x59 2048 2048" -c "close" /mnt/foo $od -Ax -t x1z /mnt/foo
000000 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 *
000800 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 *
001000
$umount /mnt && mount /dev/vdb /mnt
$od -Ax -t x1z /mnt/foo
000000 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 *
000800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 *
001000
Fix this by introducing ext4_truncate_page_cache_block_range() to remove writable userspace mappings when truncating a partial folio range. Additionally, move the journal data mode-specific handlers and truncate_pagecache_range() into this function, allowing it to serve as a common helper that correctly manages the page cache in preparation for block range manipulations.
--- fs/ext4/ext4.h | 2 ++ fs/ext4/extents.c | 19 ++++---------- fs/ext4/inode.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 14 deletions(-)
fs/ext4/ext4.h +2 -0
@@ -3011,6 +3011,8 @@ extern int ext4_inode_attach_jinode(struct inode *inode);extern int ext4_can_truncate (struct inode *inode);extern int ext4_truncate (struct inode *);extern int ext4_break_layouts (struct inode *); +extern int ext4_truncate_page_cache_block_range (struct inode *inode, +loff_t start,loff_t end);extern int ext4_punch_hole (struct file *file,loff_t offset,loff_t length);extern void ext4_set_inode_flags (struct inode *,bool init);extern int ext4_alloc_da_blocks (struct inode *inode);
fs/ext4/extents.c +5 -14
@@ -4667,22 +4667,13 @@ static long ext4_zero_range(struct file *file, loff_t offset, goto out_mutex; } -/* -* For journalled data we need to write (and checkpoint) pages -* before discarding page cache to avoid inconsitent data on -* disk in case of crash before zeroing trans is committed. -*/ -if (ext4_should_journal_data (inode)) { - ret =filemap_write_and_wait_range (mapping, start, - end -1 ); -if (ret) { -filemap_invalidate_unlock (mapping); - goto out_mutex; - } +/* Now release the pages and zero block aligned part of pages */ + ret =ext4_truncate_page_cache_block_range (inode, start, end); +if (ret) { +filemap_invalidate_unlock (mapping); + goto out_mutex; } -/* Now release the pages and zero block aligned part of pages */ -truncate_pagecache_range (inode, start, end -1 );inode_set_mtime_to_ts (inode,inode_set_ctime_current (inode)); ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
fs/ext4/inode.c +63 -0
75 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 522/642 wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 9f00e2218e15a2ea3c284567424a100c10b6fb85 ]
This function tells the firmware what rates it can use.
Put the 3SS and 4SS HT rates supported by the other station into the rate mask.
Remove the 3SS and 4SS rates from the rate mask if the hardware only has 2 spatial streams.
And finally, select the right rate ID (a parameter for the firmware) when the hardware has 3 spatial streams.
--- drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +9 -5
@@ -1234,7 +1234,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,if (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_RXLDPC ) ldpc_en =VHT_LDPC_EN ; }else if (sta->deflink.ht_cap.ht_supported) { - ra_mask |= (sta->deflink.ht_cap.mcs.rx_mask[1 ] <<20 ) | + ra_mask |= ((u64 )sta->deflink.ht_cap.mcs.rx_mask[3 ] <<36 ) | + ((u64 )sta->deflink.ht_cap.mcs.rx_mask[2 ] <<28 ) | + (sta->deflink.ht_cap.mcs.rx_mask[1 ] <<20 ) | (sta->deflink.ht_cap.mcs.rx_mask[0 ] <<12 );if (sta->deflink.ht_cap.cap &IEEE80211_HT_CAP_RX_STBC ) stbc_en =HT_STBC_EN ;
@@ -1244,6 +1246,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,if (efuse->hw_cap.nss ==1 || rtwdev->hal.txrx_1ss) ra_mask &=RA_MASK_VHT_RATES_1SS |RA_MASK_HT_RATES_1SS ; +else if (efuse->hw_cap.nss ==2 ) + ra_mask &=RA_MASK_VHT_RATES_2SS |RA_MASK_HT_RATES_2SS | +RA_MASK_VHT_RATES_1SS |RA_MASK_HT_RATES_1SS ;if (hal->current_band_type ==RTW_BAND_5G ) { ra_mask |= (u64 )sta->deflink.supp_rates[NL80211_BAND_5GHZ ] <<4 ;
@@ -1302,10 +1307,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,break ; } -if (sta->deflink.vht_cap.vht_supported && ra_mask &0xffc00000 ) - tx_num =2 ; -else if (sta->deflink.ht_cap.ht_supported && ra_mask &0xfff00000 ) - tx_num =2 ; +if (sta->deflink.vht_cap.vht_supported || + sta->deflink.ht_cap.ht_supported) + tx_num = efuse->hw_cap.nss; rate_id =get_rate_id (wireless_set, bw_mode, tx_num);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 523/642 wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 8f0076726b66a70727a1bef5c087c60291e90ad8 ]
The existing code is suitable for chips with up to 2 spatial streams. Inform the firmware about the rates it's allowed to use when transmitting 3 spatial streams.
--- drivers/net/wireless/realtek/rtw88/fw.c | 15 +++++++++++++++ drivers/net/wireless/realtek/rtw88/fw.h | 1 + drivers/net/wireless/realtek/rtw88/main.h | 1 + 3 files changed, 17 insertions(+)
drivers/net/wireless/realtek/rtw88/fw.c +15 -0
@@ -735,6 +735,7 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, {u8 h2c_pkt[H2C_PKT_SIZE ] = {0 };bool disable_pt = true; +u32 mask_hi;SET_H2C_CMD_ID_CLASS (h2c_pkt,H2C_CMD_RA_INFO );
@@ -755,6 +756,20 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, si->init_ra_lv =0 ;rtw_fw_send_h2c_command (rtwdev, h2c_pkt); + +if (rtwdev->chip->id !=RTW_CHIP_TYPE_8814A ) +return ; + +SET_H2C_CMD_ID_CLASS (h2c_pkt,H2C_CMD_RA_INFO_HI ); + + mask_hi = si->ra_mask >>32 ; + +SET_RA_INFO_RA_MASK0 (h2c_pkt, (mask_hi &0xff )); +SET_RA_INFO_RA_MASK1 (h2c_pkt, (mask_hi &0xff00 ) >>8 ); +SET_RA_INFO_RA_MASK2 (h2c_pkt, (mask_hi &0xff0000 ) >>16 ); +SET_RA_INFO_RA_MASK3 (h2c_pkt, (mask_hi &0xff000000 ) >>24 ); + +rtw_fw_send_h2c_command (rtwdev, h2c_pkt); }void rtw_fw_media_status_report (struct rtw_dev *rtwdev,u8 mac_id,bool connect)
drivers/net/wireless/realtek/rtw88/fw.h +1 -0
@@ -557,6 +557,7 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id)#define H2C_CMD_DEFAULT_PORT 0x2c#define H2C_CMD_RA_INFO 0x40#define H2C_CMD_RSSI_MONITOR 0x42 +#define H2C_CMD_RA_INFO_HI 0x46#define H2C_CMD_BCN_FILTER_OFFLOAD_P0 0x56#define H2C_CMD_BCN_FILTER_OFFLOAD_P1 0x57#define H2C_CMD_WL_PHY_INFO 0x58
drivers/net/wireless/realtek/rtw88/main.h +1 -0
@@ -191,6 +191,7 @@ enum rtw_chip_type {RTW_CHIP_TYPE_8703B ,RTW_CHIP_TYPE_8821A ,RTW_CHIP_TYPE_8812A , + RTW_CHIP_TYPE_8814A, }; enum rtw_tx_queue_type {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 524/642 wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 9e8243025cc06abc975c876dffda052073207ab3 ]
After the firmware is uploaded, download_firmware_validate() checks some bits in REG_MCUFW_CTRL to see if everything went okay. The RTL8814AU power on sequence sets bits 13 and 12 to 2, which this function does not expect, so it thinks the firmware upload failed.
Make download_firmware_validate() ignore bits 13 and 12.
--- drivers/net/wireless/realtek/rtw88/reg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/reg.h +2 -1
@@ -130,6 +130,7 @@#define BIT_SHIFT_ROM_PGE 16#define BIT_FW_INIT_RDY BIT(15)#define BIT_FW_DW_RDY BIT(14) +#define BIT_CPU_CLK_SEL (BIT(12) | BIT(13))#define BIT_RPWM_TOGGLE BIT(7)#define BIT_RAM_DL_SEL BIT(7)/* legacy only */ #define BIT_DMEM_CHKSUM_OK BIT(6)
@@ -147,7 +148,7 @@ BIT_CHECK_SUM_OK)#define FW_READY_LEGACY (BIT_MCUFWDL_RDY | BIT_FWDL_CHK_RPT | \ BIT_WINTINI_RDY | BIT_RAM_DL_SEL) -#define FW_READY_MASK 0xffff +#define FW_READY_MASK (0xffff & ~BIT_CPU_CLK_SEL)#define REG_MCU_TST_CFG 0x84#define VAL_FW_TRIGGER 0x1
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 525/642 wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 8425f5c8f04dbcf11ade78f984a494fc0b90e7a0 ]
Don't call ltecoex_read_reg() and ltecoex_reg_write() when the ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU doesn't have this feature.
--- drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/mac.c +4 -2
@@ -785,7 +785,8 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev,if (!check_firmware_size (data, size))return -EINVAL ; -if (!ltecoex_read_reg (rtwdev,0x38 , <ecoex_bckp)) +if (rtwdev->chip->ltecoex_addr && + !ltecoex_read_reg (rtwdev,0x38 , <ecoex_bckp))return -EBUSY ;wlan_cpu_enable (rtwdev, false);
@@ -803,7 +804,8 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev,wlan_cpu_enable (rtwdev, true); -if (!ltecoex_reg_write (rtwdev,0x38 , ltecoex_bckp)) { +if (rtwdev->chip->ltecoex_addr && + !ltecoex_reg_write (rtwdev,0x38 , ltecoex_bckp)) { ret = -EBUSY ; goto dlfw_fail; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 526/642 wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang
In reply to Sasha LevinFrom: Ching-Te Ku <[email protected]>
[ Upstream commit 2e4c4717b3f6f019c71af984564b6e4d0ae8d0bd ]
If the slot duration is 0, the firmware timer will trigger timer hang at the timer initializing state in a low rate due to hardware algorithm.
--- drivers/net/wireless/realtek/rtw89/coex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +3 -3
@@ -89,10 +89,10 @@ static const struct rtw89_btc_fbtc_slot s_def[] = { [CXST_B4] = __DEF_FBTC_SLOT(50, 0xe5555555, SLOT_MIX), [CXST_LK] = __DEF_FBTC_SLOT(20, 0xea5a5a5a, SLOT_ISO), [CXST_BLK] = __DEF_FBTC_SLOT(500, 0x55555555, SLOT_MIX), - [CXST_E2G] = __DEF_FBTC_SLOT(0, 0xea5a5a5a, SLOT_MIX), - [CXST_E5G] = __DEF_FBTC_SLOT(0, 0xffffffff, SLOT_ISO), + [CXST_E2G] = __DEF_FBTC_SLOT(5, 0xea5a5a5a, SLOT_MIX), + [CXST_E5G] = __DEF_FBTC_SLOT(5, 0xffffffff, SLOT_ISO), [CXST_EBT] = __DEF_FBTC_SLOT(5, 0xe5555555, SLOT_MIX), - [CXST_ENULL] = __DEF_FBTC_SLOT(0, 0xaaaaaaaa, SLOT_ISO), + [CXST_ENULL] = __DEF_FBTC_SLOT(5, 0xaaaaaaaa, SLOT_ISO), [CXST_WLK] = __DEF_FBTC_SLOT(250, 0xea5a5a5a, SLOT_MIX), [CXST_W1FDD] = __DEF_FBTC_SLOT(50, 0xffffffff, SLOT_ISO), [CXST_B1FDD] = __DEF_FBTC_SLOT(50, 0xffffdfff, SLOT_ISO),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 527/642 wifi: rtw89: fw: validate multi-firmware header before getting its size
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 2b8bdc5237014cc61784b3676cbaca5325959f3d ]
To access firmware elements appended after multi-firmware, add its size as offset to get start address of firmware elements.
+-----+-------+------+---------+--------------+ --
| sig | fw_nr | rsvd | version | reserved | \
+---------------------------------------------+ |
fw 0 | cv | type | mp | rsvd | shift | size | rsvd | |
+---------------------------------------------+ |
fw 1 | cv | type | mp | rsvd | shift | size | rsvd | |
+---------------------------------------------+ |
fw N-1 | ... | |
+=============================================+ | mfw size
| fw 0 content | |
+=============================================+ |
| fw 1 content | |
+=============================================+ |
| ... | |
+=============================================+ |
| fw N -1 content | |
+=============================================+ --/
| fw element TLV X |
+=============================================+
| fw element TLV Y |
+=============================================+
| fw element TLV Z |
+=============================================+To avoid Coverity warning when getting mfw size, validate it header ahead.
Addresses-Coverity-ID: 1544385 ("Untrusted array index read")
--- drivers/net/wireless/realtek/rtw89/fw.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtw89/fw.c +5 -0
@@ -601,12 +601,17 @@ static u32 rtw89_mfw_get_size(struct rtw89_dev *rtwdev) (const struct rtw89_mfw_hdr *)firmware->data;const struct rtw89_mfw_info *mfw_info;u32 size; +int ret;if (mfw_hdr->sig !=RTW89_MFW_SIG ) {rtw89_warn (rtwdev,"not mfw format\n" );return 0 ; } + ret =rtw89_mfw_validate_hdr (rtwdev, firmware, mfw_hdr); +if (ret) +return ret; + mfw_info = &mfw_hdr->info[mfw_hdr->fw_nr -1 ]; size =le32_to_cpu (mfw_info->shift) +le32_to_cpu (mfw_info->size);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 528/642 wifi: rtw89: fw: validate multi-firmware header before accessing
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 1f0efffd597893404aea5c3d4f1bdaa1c61d4434 ]
A firmeware file contains multi-firmware with a header to represent contents. The mfw_hdr->fw_nr is to define number of firmware in file.
+-----+-------+------+---------+--------------+
| sig | fw_nr | rsvd | version | reserved |
+---------------------------------------------+ --
fw 0 | cv | type | mp | rsvd | shift | size | rsvd | \
+---------------------------------------------+ |
fw 1 | cv | type | mp | rsvd | shift | size | rsvd | | mfw_hdr->fw_nr
+---------------------------------------------+ |
fw N-1 | ... | /
+=============================================+ --
| fw 0 content |
| (pointed by fw0 shift/size) |
+=============================================+To avoid Coverity warning, validate header is in range of firmware size, and also validate the range of actual firmware content is in range.
Addresses-Coverity-ID: 1494046 ("Untrusted loop bound")
--- drivers/net/wireless/realtek/rtw89/fw.c | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/net/wireless/realtek/rtw89/fw.c +35 -0
@@ -539,6 +539,30 @@ static int rtw89_fw_hdr_parser(struct rtw89_dev *rtwdev, } } +static int rtw89_mfw_validate_hdr (struct rtw89_dev *rtwdev, +const struct firmware *firmware, +const struct rtw89_mfw_hdr *mfw_hdr) +{ +const void *mfw = firmware->data; +u32 mfw_len = firmware->size; +u8 fw_nr = mfw_hdr->fw_nr; +const void *ptr; + +if (fw_nr ==0 ) { +rtw89_err (rtwdev,"mfw header has no fw entry\n" ); +return -ENOENT ; + } + + ptr = &mfw_hdr->info[fw_nr]; + +if (ptr > mfw + mfw_len) { +rtw89_err (rtwdev,"mfw header out of address\n" ); +return -EFAULT ; + } + +return 0 ; +} +static int rtw89_mfw_recognize (struct rtw89_dev *rtwdev,enum rtw89_fw_type type,struct rtw89_fw_suit *fw_suit,bool nowarn)
@@ -549,6 +573,7 @@ int rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,u32 mfw_len = firmware->size;const struct rtw89_mfw_hdr *mfw_hdr = (const struct rtw89_mfw_hdr *)mfw;const struct rtw89_mfw_info *mfw_info =NULL , *tmp; +int ret;int i;if (mfw_hdr->sig !=RTW89_MFW_SIG ) {
@@ -561,6 +586,10 @@ int rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,return 0 ; } + ret =rtw89_mfw_validate_hdr (rtwdev, firmware, mfw_hdr); +if (ret) +return ret; +for (i =0 ; i < mfw_hdr->fw_nr; i++) { tmp = &mfw_hdr->info[i];if (tmp->type != type)
@@ -590,6 +619,12 @@ int rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type, found: fw_suit->data = mfw +le32_to_cpu (mfw_info->shift); fw_suit->size =le32_to_cpu (mfw_info->size); + +if (fw_suit->data + fw_suit->size > mfw + mfw_len) { +rtw89_err (rtwdev,"fw_suit %d out of address\n" , type); +return -EFAULT ; + } +return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 529/642 wifi: rtw89: call power_on ahead before selecting firmware
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit d078f5857a00c06fa0ddee26d3cb722e938e1688 ]
Driver selects firmware by hardware version, which normally can be read from registers before selecting firmware. However, certain chips such as RTL8851B, it needs to read hardware version from efuse while doing power_on, but do power_on after selecting firmware in current flow.
To resolve this flow problem, move power_on out from rtw89_mac_partial_init(), and call rtw89_mac_pwr_on() separately at proper places to have expected flow.
--- drivers/net/wireless/realtek/rtw89/core.c | 23 +++++++++++------- drivers/net/wireless/realtek/rtw89/mac.c | 29 ++++++++++++++++------- drivers/net/wireless/realtek/rtw89/mac.h | 1 + 3 files changed, 36 insertions(+), 17 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +15 -8
@@ -5086,8 +5086,6 @@ static int rtw89_chip_efuse_info_setup(struct rtw89_dev *rtwdev)rtw89_hci_mac_pre_deinit (rtwdev); -rtw89_mac_pwr_off (rtwdev); -return 0 ; }
@@ -5168,36 +5166,45 @@ int rtw89_chip_info_setup(struct rtw89_dev *rtwdev)rtw89_read_chip_ver (rtwdev); + ret =rtw89_mac_pwr_on (rtwdev); +if (ret) { +rtw89_err (rtwdev,"failed to power on\n" ); +return ret; + } + ret =rtw89_wait_firmware_completion (rtwdev);if (ret) {rtw89_err (rtwdev,"failed to wait firmware completion\n" ); -return ret; + goto out; } ret =rtw89_fw_recognize (rtwdev);if (ret) {rtw89_err (rtwdev,"failed to recognize firmware\n" ); -return ret; + goto out; } ret =rtw89_chip_efuse_info_setup (rtwdev);if (ret) -return ret; + goto out; ret =rtw89_fw_recognize_elements (rtwdev);if (ret) {rtw89_err (rtwdev,"failed to recognize firmware elements\n" ); -return ret; + goto out; } ret =rtw89_chip_board_info_setup (rtwdev);if (ret) -return ret; + goto out;rtw89_core_setup_rfe_parms (rtwdev); rtwdev->ps_mode =rtw89_update_ps_mode (rtwdev); -return 0 ; +out: +rtw89_mac_pwr_off (rtwdev); + +return ret; }EXPORT_SYMBOL (rtw89_chip_info_setup);
drivers/net/wireless/realtek/rtw89/mac.c +20 -9
@@ -1495,6 +1495,21 @@ static int rtw89_mac_power_switch(struct rtw89_dev *rtwdev, bool on)#undef PWR_ACT } +int rtw89_mac_pwr_on (struct rtw89_dev *rtwdev) +{ +int ret; + + ret =rtw89_mac_power_switch (rtwdev, true); +if (ret) { +rtw89_mac_power_switch (rtwdev, false); + ret =rtw89_mac_power_switch (rtwdev, true); +if (ret) +return ret; + } + +return 0 ; +} +void rtw89_mac_pwr_off (struct rtw89_dev *rtwdev) {rtw89_mac_power_switch (rtwdev, false);
@@ -3996,14 +4011,6 @@ int rtw89_mac_partial_init(struct rtw89_dev *rtwdev, bool include_bb) {int ret; - ret =rtw89_mac_power_switch (rtwdev, true); -if (ret) { -rtw89_mac_power_switch (rtwdev, false); - ret =rtw89_mac_power_switch (rtwdev, true); -if (ret) -return ret; - } -rtw89_mac_ctrl_hci_dma_trx (rtwdev, true);if (include_bb) {
@@ -4036,6 +4043,10 @@ int rtw89_mac_init(struct rtw89_dev *rtwdev)bool include_bb = !!chip->bbmcu_nr;int ret; + ret =rtw89_mac_pwr_on (rtwdev); +if (ret) +return ret; + ret =rtw89_mac_partial_init (rtwdev, include_bb);if (ret) goto fail;
@@ -4067,7 +4078,7 @@ int rtw89_mac_init(struct rtw89_dev *rtwdev)return ret; fail: -rtw89_mac_power_switch (rtwdev, false); +rtw89_mac_pwr_off (rtwdev);return ret; }
drivers/net/wireless/realtek/rtw89/mac.h +1 -0
@@ -1145,6 +1145,7 @@ rtw89_write32_port_set(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_lrtw89_write32_set (rtwdev, reg, bit); } +int rtw89_mac_pwr_on (struct rtw89_dev *rtwdev);void rtw89_mac_pwr_off (struct rtw89_dev *rtwdev);int rtw89_mac_partial_init (struct rtw89_dev *rtwdev,bool include_bb);int rtw89_mac_init (struct rtw89_dev *rtwdev);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 530/642 iio: dac: ad3552r-hs: use instruction mode for configuration
In reply to Sasha LevinFrom: Angelo Dureghello <[email protected]>
[ Upstream commit 21889245fb538123ac9968eea0018f878b44c8c8 ]
Use "instruction" mode over initial configuration and all other non-streaming operations.
DAC boots in streaming mode as default, and the driver is not changing this mode.
Instruction r/w is still working because instruction is processed from the DAC after chip select is deasserted, this works until loop mode is 0 or greater than the instruction size.
All initial operations should be more safely done in instruction mode, a mode provided for this.
--- drivers/iio/dac/ad3552r-hs.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/iio/dac/ad3552r-hs.c +28 -1
@@ -137,13 +137,20 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev)if (ret)return ret; +/* Primary region access, set streaming mode (now in SPI + SDR). */ + ret =ad3552r_qspi_update_reg_bits (st, +AD3552R_REG_ADDR_INTERFACE_CONFIG_B , +AD3552R_MASK_SINGLE_INST ,0 ,1 ); +if (ret) +return ret; +/* Inform DAC chip to switch into DDR mode */ ret =ad3552r_qspi_update_reg_bits (st,AD3552R_REG_ADDR_INTERFACE_CONFIG_D ,AD3552R_MASK_SPI_CONFIG_DDR ,AD3552R_MASK_SPI_CONFIG_DDR ,1 );if (ret) -return ret; + goto exit_err_ddr;/* Inform DAC IP to go for DDR mode from now on */ ret =iio_backend_ddr_enable (st->back);
@@ -174,6 +181,11 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev)iio_backend_ddr_disable (st->back); +exit_err_ddr: +ad3552r_qspi_update_reg_bits (st,AD3552R_REG_ADDR_INTERFACE_CONFIG_B , +AD3552R_MASK_SINGLE_INST , +AD3552R_MASK_SINGLE_INST ,1 ); +return ret; }
@@ -198,6 +210,14 @@ static int ad3552r_hs_buffer_predisable(struct iio_dev *indio_dev)if (ret)return ret; +/* Back to single instruction mode, disabling loop. */ + ret =ad3552r_qspi_update_reg_bits (st, +AD3552R_REG_ADDR_INTERFACE_CONFIG_B , +AD3552R_MASK_SINGLE_INST , +AD3552R_MASK_SINGLE_INST ,1 ); +if (ret) +return ret; +return 0 ; }
@@ -308,6 +328,13 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st)if (ret)return ret; + ret = st->data->bus_reg_write (st->back, +AD3552R_REG_ADDR_INTERFACE_CONFIG_B , +AD3552R_MASK_SINGLE_INST | +AD3552R_MASK_SHORT_INSTRUCTION ,1 ); +if (ret) +return ret; + ret =ad3552r_hs_scratch_pad_test (st);if (ret)return ret;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 531/642 iio: dac: adi-axi-dac: add bus mode setup
In reply to Sasha LevinFrom: Angelo Dureghello <[email protected]>
[ Upstream commit 8ab67b37b81dfaa00a25e95a5f5a020f374848bb ]
The ad354xr requires DSPI mode (2 data lanes) to work in buffering mode, so, depending on the DAC type, target TRANSFER_REGISTER "MULTI_IO_MODE" bitfield can be set between:
SPI (configuration, entire ad35xxr family),
DSPI (ad354xr),
QSPI (ad355xr).Also bus IO_MODE must be set accordingly.
About removal of AXI_DAC_CUSTOM_CTRL_SYNCED_TRANSFER, according to the HDL history the flag has never been used. So looks like the driver was including it by mistake or in anticipation for something that was never implemented on HDL side.
Current HDL updated documentation confirm it is actually not in use anymore and replaced by the IO_MODE bits.
--- drivers/iio/dac/ad3552r-hs.h | 8 ++++++++ drivers/iio/dac/adi-axi-dac.c | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-)
drivers/iio/dac/ad3552r-hs.h +8 -0
@@ -8,11 +8,19 @@struct iio_backend ; +enum ad3552r_io_mode { +AD3552R_IO_MODE_SPI , +AD3552R_IO_MODE_DSPI , +AD3552R_IO_MODE_QSPI , +}; +struct ad3552r_hs_platform_data {int (*bus_reg_read)(struct iio_backend *back,u32 reg,u32 *val,size_t data_size);int (*bus_reg_write)(struct iio_backend *back,u32 reg,u32 val,size_t data_size); +int (*bus_set_io_mode)(struct iio_backend *back, +enum ad3552r_io_mode mode);u32 bus_sample_data_clock_hz; };
drivers/iio/dac/adi-axi-dac.c +21 -1
@@ -64,7 +64,7 @@#define AXI_DAC_UI_STATUS_IF_BUSY BIT(4)#define AXI_DAC_CUSTOM_CTRL_REG 0x008C#define AXI_DAC_CUSTOM_CTRL_ADDRESS GENMASK(31, 24) -#define AXI_DAC_CUSTOM_CTRL_SYNCED_TRANSFER BIT(2) +#define AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE GENMASK(3, 2)#define AXI_DAC_CUSTOM_CTRL_STREAM BIT(1)#define AXI_DAC_CUSTOM_CTRL_TRANSFER_DATA BIT(0)
@@ -722,6 +722,25 @@ static int axi_dac_bus_reg_read(struct iio_backend *back, u32 reg, u32 *val,return regmap_read (st->regmap,AXI_DAC_CUSTOM_RD_REG , val); } +static int axi_dac_bus_set_io_mode (struct iio_backend *back, +enum ad3552r_io_mode mode) +{ +struct axi_dac_state *st =iio_backend_get_priv (back); +int ival, ret; + +guard (mutex)(&st->lock); + + ret =regmap_update_bits (st->regmap,AXI_DAC_CUSTOM_CTRL_REG , +AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE , +FIELD_PREP (AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE , mode)); +if (ret) +return ret; + +return regmap_read_poll_timeout (st->regmap,AXI_DAC_UI_STATUS_REG , ival, +FIELD_GET (AXI_DAC_UI_STATUS_IF_BUSY , ival) ==0 ,10 , +100 *KILO ); +} +static void axi_dac_child_remove (void *data) {platform_device_unregister (data);
@@ -733,6 +752,7 @@ static int axi_dac_create_platform_device(struct axi_dac_state *st,struct ad3552r_hs_platform_data pdata = { .bus_reg_read = axi_dac_bus_reg_read, .bus_reg_write = axi_dac_bus_reg_write, + .bus_set_io_mode = axi_dac_bus_set_io_mode, .bus_sample_data_clock_hz = st->dac_clk_rate, };struct platform_device_info pi = {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 532/642 clk: qcom: camcc-sm8250: Use clk_rcg2_shared_ops for some RCGs
In reply to Sasha LevinFrom: Jordan Crouse <[email protected]>
[ Upstream commit 52b10b591f83dc6d9a1d6c2dc89433470a787ecd ]
Update some RCGs on the sm8250 camera clock controller to use clk_rcg2_shared_ops. The shared_ops ensure the RCGs get parked to the XO during clock disable to prevent the clocks from locking up when the GDSC is enabled. These mirror similar fixes for other controllers such as commit e5c359f70e4b ("clk: qcom: camcc: Update the clock ops for the SC7180").
--- drivers/clk/qcom/camcc-sm8250.c | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/clk/qcom/camcc-sm8250.c +28 -28
@@ -411,7 +411,7 @@ static struct clk_rcg2 cam_cc_bps_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -433,7 +433,7 @@ static struct clk_rcg2 cam_cc_camnoc_axi_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -454,7 +454,7 @@ static struct clk_rcg2 cam_cc_cci_0_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -469,7 +469,7 @@ static struct clk_rcg2 cam_cc_cci_1_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -490,7 +490,7 @@ static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -511,7 +511,7 @@ static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -526,7 +526,7 @@ static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -556,7 +556,7 @@ static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -571,7 +571,7 @@ static struct clk_rcg2 cam_cc_csi4phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -586,7 +586,7 @@ static struct clk_rcg2 cam_cc_csi5phytimer_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -611,7 +611,7 @@ static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -634,7 +634,7 @@ static struct clk_rcg2 cam_cc_fd_core_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -649,7 +649,7 @@ static struct clk_rcg2 cam_cc_icp_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -673,7 +673,7 @@ static struct clk_rcg2 cam_cc_ife_0_clk_src = { .parent_data = cam_cc_parent_data_2, .num_parents = ARRAY_SIZE(cam_cc_parent_data_2), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -710,7 +710,7 @@ static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -734,7 +734,7 @@ static struct clk_rcg2 cam_cc_ife_1_clk_src = { .parent_data = cam_cc_parent_data_3, .num_parents = ARRAY_SIZE(cam_cc_parent_data_3), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -749,7 +749,7 @@ static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -771,7 +771,7 @@ static struct clk_rcg2 cam_cc_ife_lite_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -786,7 +786,7 @@ static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -810,7 +810,7 @@ static struct clk_rcg2 cam_cc_ipe_0_clk_src = { .parent_data = cam_cc_parent_data_4, .num_parents = ARRAY_SIZE(cam_cc_parent_data_4), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -825,7 +825,7 @@ static struct clk_rcg2 cam_cc_jpeg_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -847,7 +847,7 @@ static struct clk_rcg2 cam_cc_mclk0_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -862,7 +862,7 @@ static struct clk_rcg2 cam_cc_mclk1_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -877,7 +877,7 @@ static struct clk_rcg2 cam_cc_mclk2_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -892,7 +892,7 @@ static struct clk_rcg2 cam_cc_mclk3_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -907,7 +907,7 @@ static struct clk_rcg2 cam_cc_mclk4_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -922,7 +922,7 @@ static struct clk_rcg2 cam_cc_mclk5_clk_src = { .parent_data = cam_cc_parent_data_1, .num_parents = ARRAY_SIZE(cam_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -993,7 +993,7 @@ static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { .parent_data = cam_cc_parent_data_0, .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 533/642 netdevsim: allow normal queue reset while down
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 285b3f78eabd951e59e98f01f86abaaa6c76cd44 ]
Resetting queues while the device is down should be legal. Allow it, test it. Ideally we'd test this with a real device supporting devmem but I don't have access to such devices.
--- drivers/net/netdevsim/netdev.c | 10 ++++------ tools/testing/selftests/net/nl_netdev.py | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-)
drivers/net/netdevsim/netdev.c +4 -6
@@ -664,8 +664,11 @@ nsim_queue_mem_alloc(struct net_device *dev, void *per_queue_mem, int idx)if (ns->rq_reset_mode >3 )return -EINVAL ; -if (ns->rq_reset_mode ==1 ) +if (ns->rq_reset_mode ==1 ) { +if (!netif_running (ns->netdev)) +return -ENETDOWN ;return nsim_create_page_pool (&qmem->pp, &ns->rq[idx]->napi); + } qmem->rq =nsim_queue_alloc ();if (!qmem->rq)
@@ -773,11 +776,6 @@ nsim_qreset_write(struct file *file, const char __user *data,return -EINVAL ;rtnl_lock (); -if (!netif_running (ns->netdev)) { - ret = -ENETDOWN ; - goto exit_unlock; - } -if (queue >= ns->netdev->real_num_rx_queues) { ret = -EINVAL ; goto exit_unlock;
tools/testing/selftests/net/nl_netdev.py +17 -1
@@ -35,6 +35,21 @@ def napi_list_check(nf) -> None: comment=f"queue count after reset queue {q} mode {i}") +def nsim_rxq_reset_down(nf) -> None: + """ + Test that the queue API supports resetting a queue + while the interface is down. We should convert this + test to testing real HW once more devices support + queue API. + """ + with NetdevSimDev(queue_count=4) as nsimdev: + nsim = nsimdev.nsims[0] + + ip(f"link set dev {nsim.ifname} down") + for i in [0, 2, 3]: + nsim.dfs_write("queue_reset", f"1 {i}") + + def page_pool_check(nf) -> None: with NetdevSimDev() as nsimdev: nsim = nsimdev.nsims[0]
@@ -106,7 +121,8 @@ def page_pool_check(nf) -> None: def main() -> None: nf = NetdevFamily() - ksft_run([empty_check, lo_check, page_pool_check, napi_list_check], + ksft_run([empty_check, lo_check, page_pool_check, napi_list_check, + nsim_rxq_reset_down], args=(nf, )) ksft_exit()
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 534/642 net: page_pool: avoid false positive warning if NAPI was never added
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit c1e00bc4be06cacee6307cedb9b55bbaddb5044d ]
We expect NAPI to be in disabled state when page pool is torn down. But it is also legal if the NAPI is completely uninitialized.
--- net/core/dev.h | 12 ++++++++++++ net/core/page_pool.c | 7 ++----- 2 files changed, 14 insertions(+), 5 deletions(-)
net/core/dev.h +12 -0
@@ -299,6 +299,18 @@ void xdp_do_check_flushed(struct napi_struct *napi);static inline void xdp_do_check_flushed (struct napi_struct *napi) { }#endif +/* Best effort check that NAPI is not idle (can't be scheduled to run) */ +static inline void napi_assert_will_not_race (const struct napi_struct *napi) +{ +/* uninitialized instance, can't race */ +if (!napi->poll_list.next) +return ; + +/* SCHED bit is set on disabled instances */ +WARN_ON (!test_bit (NAPI_STATE_SCHED , &napi->state)); +WARN_ON (READ_ONCE (napi->list_owner) !=-1 ); +} +void kick_defer_list_purge (struct softnet_data *sd,unsigned int cpu);#define XMIT_RECURSION_LIMIT 8
net/core/page_pool.c +2 -5
@@ -25,6 +25,7 @@#include <trace/events/page_pool.h> +#include "dev.h" #include "mp_dmabuf_devmem.h" #include "netmem_priv.h" #include "page_pool_priv.h"
@@ -1146,11 +1147,7 @@ void page_pool_disable_direct_recycling(struct page_pool *pool)if (!pool->p.napi)return ; -/* To avoid races with recycling and additional barriers make sure -* pool and NAPI are unlinked when NAPI is disabled. -*/ -WARN_ON (!test_bit (NAPI_STATE_SCHED , &pool->p.napi->state)); -WARN_ON (READ_ONCE (pool->p.napi->list_owner) !=-1 ); +napi_assert_will_not_race (pool->p.napi);mutex_lock (&page_pools_lock);WRITE_ONCE (pool->p.napi,NULL );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 535/642 tools/power turbostat: Clustered Uncore MHz counters should honor show/hide options
In reply to Sasha LevinFrom: Len Brown <[email protected]>
[ Upstream commit 1c7c7388e6c31f46b26a884d80b45efbad8237b2 ]
The clustered uncore frequency counters, UMHz*.* should honor the --show and --hide options.
All non-specified counters should be implicityly hidden. But when --show was used, UMHz*.* showed up anyway:
$ sudo turbostat -q -S --show Busy% Busy% UMHz0.0 UMHz1.0 UMHz2.0 UMHz3.0 UMHz4.0
Indeed, there was no string that can be used to explicitly show or hide clustered uncore counters.
Even through they are dynamically probed and added, group the clustered UMHz*.* counters with the legacy built-in-counter "UncMHz" for show/hide.
turbostat --show Busy%
does not show UMHz*.*.
turbostat --show UncMHz
shows either UncMHz or UMHz*.*, if present
turbostat --hide UncMHz
hides either UncMHz or UMHz*.*, if present
--- tools/power/x86/turbostat/turbostat.8 | 1 + tools/power/x86/turbostat/turbostat.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.8 +1 -0
@@ -201,6 +201,7 @@ The system configuration dump (if --quiet is not used) is followed by statistics \fBUncMHz\fP per-package uncore MHz, instantaneous sample. .PP \fBUMHz1.0\fP per-package uncore MHz for domain=1 and fabric_cluster=0, instantaneous sample. System summary is the average of all packages. +For the "--show" and "--hide" options, use "UncMHz" to operate on all UMHz*.* as a group. .SH TOO MUCH INFORMATION EXAMPLE By default, turbostat dumps all possible information -- a system configuration header, followed by columns for all counters. This is ideal for remote debugging, use the "--out" option to save everything to a text file, and get that file to the expert helping you debug.
tools/power/x86/turbostat/turbostat.c +12 -1
@@ -6713,7 +6713,18 @@ static void probe_intel_uncore_frequency_cluster(void)sprintf (path,"%s/current_freq_khz" , path_base);sprintf (name_buf,"UMHz%d.%d" , domain_id, cluster_id); -add_counter (0 , path, name_buf,0 ,SCOPE_PACKAGE ,COUNTER_K2M ,FORMAT_AVERAGE ,0 , package_id); +/* +* Once add_couter() is called, that counter is always read +* and reported -- So it is effectively (enabled & present). +* Only call add_counter() here if legacy BIC_UNCORE_MHZ (UncMHz) +* is (enabled). Since we are in this routine, we +* know we will not probe and set (present) the legacy counter. +* +* This allows "--show/--hide UncMHz" to be effective for +* the clustered MHz counters, as a group. +*/ + if BIC_IS_ENABLED(BIC_UNCORE_MHZ) + add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id);if (quiet)continue ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 536/642 exit: change the release_task() paths to call flush_sigqueue() lockless
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit fb3bbcfe344e64a46574a638b051ffd78762c12d ]
A task can block a signal, accumulate up to RLIMIT_SIGPENDING sigqueues, and exit. In this case __exit_signal()->flush_sigqueue() called with irqs disabled can trigger a hard lockup, see
https://lore.kernel.org/all/[email protected]/
Fortunately, after the recent posixtimer changes sys_timer_delete() paths no longer try to clear SIGQUEUE_PREALLOC and/or free tmr->sigq, and after the exiting task passes __exit_signal() lock_task_sighand() can't succeed and pid_task(tmr->it_pid) will return NULL.
This means that after __exit_signal(tsk) nobody can play with tsk->pending or (if group_dead) with tsk->signal->shared_pending, so release_task() can safely call flush_sigqueue() after write_unlock_irq(&tasklist_lock).
TODO:
- we can probably shift posix_cpu_timers_exit() as well
- do_sigaction() can hit the similar problem
--- kernel/exit.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
kernel/exit.c +11 -8
@@ -200,20 +200,13 @@ static void __exit_signal(struct task_struct *tsk)__unhash_process (tsk, group_dead);write_sequnlock (&sig->stats_lock); -/* -* Do this under ->siglock, we can race with another thread -* doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. -*/ -flush_sigqueue (&tsk->pending); tsk->sighand =NULL ;spin_unlock (&sighand->siglock);__cleanup_sighand (sighand);clear_tsk_thread_flag (tsk,TIF_SIGPENDING ); -if (group_dead) { -flush_sigqueue (&sig->shared_pending); +if (group_dead)tty_kref_put (tty); - } }static void delayed_put_task_struct (struct rcu_head *rhp)
@@ -282,6 +275,16 @@ void release_task(struct task_struct *p)proc_flush_pid (thread_pid);put_pid (thread_pid);release_thread (p); +/* +* This task was already removed from the process/thread/pid lists +* and lock_task_sighand(p) can't succeed. Nobody else can touch +* ->pending or, if group dead, signal->shared_pending. We can call +* flush_sigqueue() lockless. +*/ +flush_sigqueue (&p->pending); +if (thread_group_leader (p)) +flush_sigqueue (&p->signal->shared_pending); +put_task_struct_rcu_user (p); p = leader;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 537/642 hwmon: (xgene-hwmon) use appropriate type for the latency value
In reply to Sasha LevinFrom: Andrey Vatoropin <[email protected]>
[ Upstream commit 8df0f002827e18632dcd986f7546c1abf1953a6f ]
The expression PCC_NUM_RETRIES * pcc_chan->latency is currently being evaluated using 32-bit arithmetic.
Since a value of type 'u64' is used to store the eventual result, and this result is later sent to the function usecs_to_jiffies with input parameter unsigned int, the current data type is too wide to store the value of ctx->usecs_lat.
Change the data type of "usecs_lat" to a more suitable (narrower) type.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/xgene-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/xgene-hwmon.c +1 -1
@@ -105,7 +105,7 @@ struct xgene_hwmon_dev {phys_addr_t comm_base_addr;void *pcc_comm_addr; -u64 usecs_lat; +unsigned int usecs_lat; };/*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 538/642 drm/xe: Fix PVC RPe and RPa information
In reply to Sasha LevinFrom: Rodrigo Vivi <[email protected]>
[ Upstream commit 8a734b9359cfa1bdb805f5ca23e20bd99dd18a0a ]
A simple lazy buggy copy and paste of the PVC comment has brought the attention to the incorrect masks of the PVC register for RPa and RPe. So, let's fix them all.
--- drivers/gpu/drm/xe/xe_guc_pc.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_guc_pc.c +12 -10
@@ -371,16 +371,17 @@ static void tgl_update_rpa_value(struct xe_guc_pc *pc)u32 reg;/* -* For PVC we still need to use fused RP1 as the approximation for RPe -* For other platforms than PVC we get the resolved RPe directly from +* For PVC we still need to use fused RP0 as the approximation for RPa +* For other platforms than PVC we get the resolved RPa directly from * PCODE at a different register */ -if (xe->info.platform ==XE_PVC ) +if (xe->info.platform ==XE_PVC ) { reg =xe_mmio_read32 (>->mmio,PVC_RP_STATE_CAP ); -else + pc->rpa_freq =REG_FIELD_GET (RP0_MASK , reg) *GT_FREQUENCY_MULTIPLIER ; + }else { reg =xe_mmio_read32 (>->mmio,FREQ_INFO_REC ); - - pc->rpa_freq =REG_FIELD_GET (RPA_MASK , reg) *GT_FREQUENCY_MULTIPLIER ; + pc->rpa_freq =REG_FIELD_GET (RPA_MASK , reg) *GT_FREQUENCY_MULTIPLIER ; + } }static void tgl_update_rpe_value (struct xe_guc_pc *pc)
@@ -394,12 +395,13 @@ static void tgl_update_rpe_value(struct xe_guc_pc *pc)* For other platforms than PVC we get the resolved RPe directly from * PCODE at a different register */ -if (xe->info.platform ==XE_PVC ) +if (xe->info.platform ==XE_PVC ) { reg =xe_mmio_read32 (>->mmio,PVC_RP_STATE_CAP ); -else + pc->rpe_freq =REG_FIELD_GET (RP1_MASK , reg) *GT_FREQUENCY_MULTIPLIER ; + }else { reg =xe_mmio_read32 (>->mmio,FREQ_INFO_REC ); - - pc->rpe_freq =REG_FIELD_GET (RPE_MASK , reg) *GT_FREQUENCY_MULTIPLIER ; + pc->rpe_freq =REG_FIELD_GET (RPE_MASK , reg) *GT_FREQUENCY_MULTIPLIER ; + } }static void pc_update_rp_values (struct xe_guc_pc *pc)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 539/642 f2fs: introduce f2fs_base_attr for global sysfs entries
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 21925ede449e038ed6f9efdfe0e79f15bddc34bc ]
In /sys/fs/f2fs/features, there's no f2fs_sb_info, so let's avoid to get the pointer.
--- fs/f2fs/sysfs.c | 74 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 22 deletions(-)
fs/f2fs/sysfs.c +52 -22
@@ -61,6 +61,12 @@ struct f2fs_attr {int id; }; +struct f2fs_base_attr { +struct attribute attr; +ssize_t (*show)(struct f2fs_base_attr *a,char *buf); +ssize_t (*store)(struct f2fs_base_attr *a,const char *buf,size_t len); +}; +static ssize_t f2fs_sbi_show (struct f2fs_attr *a,struct f2fs_sb_info *sbi,char *buf);
@@ -862,6 +868,25 @@ static void f2fs_sb_release(struct kobject *kobj)complete (&sbi->s_kobj_unregister); } +static ssize_t f2fs_base_attr_show (struct kobject *kobj, +struct attribute *attr,char *buf) +{ +struct f2fs_base_attr *a =container_of (attr, + struct f2fs_base_attr, attr); + +return a->show ? a->show (a, buf) :0 ; +} + +static ssize_t f2fs_base_attr_store (struct kobject *kobj, +struct attribute *attr, +const char *buf,size_t len) +{ +struct f2fs_base_attr *a =container_of (attr, + struct f2fs_base_attr, attr); + +return a->store ? a->store (a, buf, len) :0 ; +} +/* * Note that there are three feature list entries: * 1) /sys/fs/f2fs/features
@@ -880,14 +905,13 @@ static void f2fs_sb_release(struct kobject *kobj)* please add new on-disk feature in this list only. * - ref. F2FS_SB_FEATURE_RO_ATTR() */ -static ssize_t f2fs_feature_show (struct f2fs_attr *a, -struct f2fs_sb_info *sbi,char *buf) +static ssize_t f2fs_feature_show (struct f2fs_base_attr *a,char *buf) {return sysfs_emit (buf,"supported\n" ); }#define F2FS_FEATURE_RO_ATTR (_name) \ -static struct f2fs_attr f2fs_attr_##_name = { \ +static struct f2fs_base_attr f2fs_base_attr_##_name = { \ .attr = {.name = __stringify(_name), .mode = 0444 }, \ .show = f2fs_feature_show, \ }
@@ -1256,37 +1280,38 @@ static struct attribute *f2fs_attrs[] = { };ATTRIBUTE_GROUPS (f2fs); +#define BASE_ATTR_LIST (name) (&f2fs_base_attr_##name.attr) static struct attribute *f2fs_feat_attrs[] = {#ifdef CONFIG_FS_ENCRYPTION -ATTR_LIST (encryption), -ATTR_LIST (test_dummy_encryption_v2), +BASE_ATTR_LIST (encryption), +BASE_ATTR_LIST (test_dummy_encryption_v2), #if IS_ENABLED(CONFIG_UNICODE) -ATTR_LIST (encrypted_casefold), +BASE_ATTR_LIST (encrypted_casefold), #endif #endif /* CONFIG_FS_ENCRYPTION */ #ifdef CONFIG_BLK_DEV_ZONED -ATTR_LIST (block_zoned), +BASE_ATTR_LIST (block_zoned), #endif -ATTR_LIST (atomic_write), -ATTR_LIST (extra_attr), -ATTR_LIST (project_quota), -ATTR_LIST (inode_checksum), -ATTR_LIST (flexible_inline_xattr), -ATTR_LIST (quota_ino), -ATTR_LIST (inode_crtime), -ATTR_LIST (lost_found), +BASE_ATTR_LIST (atomic_write), +BASE_ATTR_LIST (extra_attr), +BASE_ATTR_LIST (project_quota), +BASE_ATTR_LIST (inode_checksum), +BASE_ATTR_LIST (flexible_inline_xattr), +BASE_ATTR_LIST (quota_ino), +BASE_ATTR_LIST (inode_crtime), +BASE_ATTR_LIST (lost_found), #ifdef CONFIG_FS_VERITY -ATTR_LIST (verity), +BASE_ATTR_LIST (verity), #endif -ATTR_LIST (sb_checksum), +BASE_ATTR_LIST (sb_checksum), #if IS_ENABLED(CONFIG_UNICODE) -ATTR_LIST (casefold), +BASE_ATTR_LIST (casefold), #endif -ATTR_LIST (readonly), +BASE_ATTR_LIST (readonly), #ifdef CONFIG_F2FS_FS_COMPRESSION -ATTR_LIST (compression), +BASE_ATTR_LIST (compression), #endif -ATTR_LIST (pin_file), +BASE_ATTR_LIST (pin_file), NULL, };ATTRIBUTE_GROUPS (f2fs_feat);
@@ -1362,9 +1387,14 @@ static struct kset f2fs_kset = { .kobj = {.ktype = &f2fs_ktype}, }; +static const struct sysfs_ops f2fs_feat_attr_ops = { + .show = f2fs_base_attr_show, + .store = f2fs_base_attr_store, +}; +static const struct kobj_type f2fs_feat_ktype = { .default_groups = f2fs_feat_groups, - .sysfs_ops = &f2fs_attr_ops, + .sysfs_ops = &f2fs_feat_attr_ops, };static struct kobject f2fs_feat = {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 540/642 media: qcom: camss: csid: Only add TPG v4l2 ctrl if TPG hardware is available
In reply to Sasha LevinFrom: Depeng Shao <[email protected]>
[ Upstream commit 2f1361f862a68063f37362f1beb400e78e289581 ]
There is no CSID TPG on some SoCs, so the v4l2 ctrl in CSID driver shouldn't be registered. Checking the supported TPG modes to indicate if the TPG hardware exists or not and only registering v4l2 ctrl for CSID only when the TPG hardware is present.
--- .../media/platform/qcom/camss/camss-csid.c | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-)
drivers/media/platform/qcom/camss/camss-csid.c +35 -25
@@ -683,11 +683,13 @@ static int csid_set_stream(struct v4l2_subdev *sd, int enable)int ret;if (enable) { - ret =v4l2_ctrl_handler_setup (&csid->ctrls); -if (ret <0 ) { -dev_err (csid->camss->dev, -"could not sync v4l2 controls: %d\n" , ret); -return ret; +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) { + ret =v4l2_ctrl_handler_setup (&csid->ctrls); +if (ret <0 ) { +dev_err (csid->camss->dev, +"could not sync v4l2 controls: %d\n" , ret); +return ret; + } } if (!csid->testgen.enabled &&
@@ -761,7 +763,8 @@ static void csid_try_format(struct csid_device *csid,break ;case MSM_CSID_PAD_SRC : -if (csid->testgen_mode->cur.val ==0 ) { +if (csid->testgen.nmodes ==CSID_PAYLOAD_MODE_DISABLED || + csid->testgen_mode->cur.val ==0 ) {/* Test generator is disabled, */ /* keep pad formats in sync */ u32 code = fmt->code;
@@ -811,7 +814,8 @@ static int csid_enum_mbus_code(struct v4l2_subdev *sd, code->code = csid->res->formats->formats[code->index].code; }else { -if (csid->testgen_mode->cur.val ==0 ) { +if (csid->testgen.nmodes ==CSID_PAYLOAD_MODE_DISABLED || + csid->testgen_mode->cur.val ==0 ) {struct v4l2_mbus_framefmt *sink_fmt; sink_fmt = __csid_get_format(csid, sd_state,
@@ -1190,7 +1194,8 @@ static int csid_link_setup(struct media_entity *entity,/* If test generator is enabled */ /* do not allow a link from CSIPHY to CSID */ -if (csid->testgen_mode->cur.val !=0 ) +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED && + csid->testgen_mode->cur.val !=0 )return -EBUSY ; sd =media_entity_to_v4l2_subdev (remote->entity);
@@ -1283,24 +1288,27 @@ int msm_csid_register_entity(struct csid_device *csid, MSM_CSID_NAME, csid->id);v4l2_set_subdevdata (sd, csid); - ret =v4l2_ctrl_handler_init (&csid->ctrls,1 ); -if (ret <0 ) { -dev_err (dev,"Failed to init ctrl handler: %d\n" , ret); -return ret; - } +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) { + ret =v4l2_ctrl_handler_init (&csid->ctrls,1 ); +if (ret <0 ) { +dev_err (dev,"Failed to init ctrl handler: %d\n" , ret); +return ret; + } - csid->testgen_mode =v4l2_ctrl_new_std_menu_items (&csid->ctrls, - &csid_ctrl_ops,V4L2_CID_TEST_PATTERN , - csid->testgen.nmodes,0 ,0 , - csid->testgen.modes); + csid->testgen_mode = +v4l2_ctrl_new_std_menu_items (&csid->ctrls, + &csid_ctrl_ops,V4L2_CID_TEST_PATTERN , + csid->testgen.nmodes,0 ,0 , + csid->testgen.modes); -if (csid->ctrls.error) { -dev_err (dev,"Failed to init ctrl: %d\n" , csid->ctrls.error); - ret = csid->ctrls.error; - goto free_ctrl; - } +if (csid->ctrls.error) { +dev_err (dev,"Failed to init ctrl: %d\n" , csid->ctrls.error); + ret = csid->ctrls.error; + goto free_ctrl; + } - csid->subdev.ctrl_handler = &csid->ctrls; + csid->subdev.ctrl_handler = &csid->ctrls; + } ret =csid_init_formats (sd,NULL );if (ret <0 ) {
@@ -1331,7 +1339,8 @@ int msm_csid_register_entity(struct csid_device *csid, media_cleanup:media_entity_cleanup (&sd->entity); free_ctrl: -v4l2_ctrl_handler_free (&csid->ctrls); +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) +v4l2_ctrl_handler_free (&csid->ctrls);return ret; }
@@ -1344,7 +1353,8 @@ void msm_csid_unregister_entity(struct csid_device *csid) {v4l2_device_unregister_subdev (&csid->subdev);media_entity_cleanup (&csid->subdev.entity); -v4l2_ctrl_handler_free (&csid->ctrls); +if (csid->testgen.nmodes !=CSID_PAYLOAD_MODE_DISABLED ) +v4l2_ctrl_handler_free (&csid->ctrls); }inline bool csid_is_lite (struct csid_device *csid)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 541/642 media: qcom: camss: Add default case in vfe_src_pad_code
In reply to Sasha LevinFrom: Depeng Shao <[email protected]>
[ Upstream commit 2f4204bb00b32eca3391a468d3b37e87feb96fa9 ]
Add a default case in vfe_src_pad_code to get rid of a compile warning if a new hw enum is added.
--- drivers/media/platform/qcom/camss/camss-vfe.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/platform/qcom/camss/camss-vfe.c +4 -0
@@ -400,6 +400,10 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,return sink_code; }break ; +default : +WARN (1 ,"Unsupported HW version: %x\n" , + vfe->camss->res->version); +break ; }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 542/642 drm/rockchip: vop2: Improve display modes handling on RK3588 HDMI0
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 2c1268e7aad0819f38e56134bbc2095fd95fde1b ]
The RK3588 specific implementation is currently quite limited in terms of handling the full range of display modes supported by the connected screens, e.g. 2560x1440@75Hz, 2048x1152@60Hz, 1024x768@60Hz are just a few of them.
Additionally, it doesn't cope well with non-integer refresh rates like 59.94, 29.97, 23.98, etc.
Make use of HDMI0 PHY PLL as a more accurate DCLK source to handle all display modes up to 4K@60Hz.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +34 -0
@@ -159,6 +159,7 @@ struct vop2_video_port {struct drm_crtc crtc;struct vop2 *vop2;struct clk *dclk; +struct clk *dclk_src;unsigned int id;const struct vop2_video_port_data *data;
@@ -214,6 +215,7 @@ struct vop2 {struct clk *hclk;struct clk *aclk;struct clk *pclk; +struct clk *pll_hdmiphy0;/* optional internal rgb encoder */ struct rockchip_rgb *rgb;
@@ -222,6 +224,8 @@ struct vop2 {struct vop2_win win[]; }; +#define VOP2_MAX_DCLK_RATE 600000000 +#define vop2_output_if_is_hdmi (x) ((x) == ROCKCHIP_VOP2_EP_HDMI0 || \ (x) == ROCKCHIP_VOP2_EP_HDMI1)
@@ -1155,6 +1159,9 @@ static void vop2_crtc_atomic_disable(struct drm_crtc *crtc,vop2_crtc_disable_irq (vp,VP_INT_DSP_HOLD_VALID ); +if (vp->dclk_src) +clk_set_parent (vp->dclk, vp->dclk_src); +clk_disable_unprepare (vp->dclk); vop2->enable_count--;
@@ -2257,6 +2264,27 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc,vop2_vp_write (vp,RK3568_VP_MIPI_CTRL ,0 ); +/* +* Switch to HDMI PHY PLL as DCLK source for display modes up +* to 4K@60Hz, if available, otherwise keep using the system CRU. +*/ +if (vop2->pll_hdmiphy0 && clock <=VOP2_MAX_DCLK_RATE ) { +drm_for_each_encoder_mask (encoder, crtc->dev, crtc_state->encoder_mask) { +struct rockchip_encoder *rkencoder =to_rockchip_encoder (encoder); + +if (rkencoder->crtc_endpoint_id ==ROCKCHIP_VOP2_EP_HDMI0 ) { +if (!vp->dclk_src) + vp->dclk_src =clk_get_parent (vp->dclk); + + ret =clk_set_parent (vp->dclk, vop2->pll_hdmiphy0); +if (ret <0 ) +drm_warn (vop2->drm, +"Could not switch to HDMI0 PHY PLL: %d\n" , ret); +break ; + } + } + } +clk_set_rate (vp->dclk, clock);vop2_post_config (crtc);
@@ -3697,6 +3725,12 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)return PTR_ERR (vop2->pclk); } + vop2->pll_hdmiphy0 =devm_clk_get_optional (vop2->dev,"pll_hdmiphy0" ); +if (IS_ERR (vop2->pll_hdmiphy0)) { +drm_err (vop2->drm,"failed to get pll_hdmiphy0\n" ); +return PTR_ERR (vop2->pll_hdmiphy0); + } + vop2->irq =platform_get_irq (pdev,0 );if (vop2->irq <0 ) {drm_err (vop2->drm,"cannot find irq for vop2\n" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 543/642 eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs
In reply to Sasha LevinFrom: Alexander Duyck <[email protected]>
[ Upstream commit 09717c28b76c30b1dc8c261c855ffb2406abab2e ]
I realized when we were adding unicast addresses we were enabling promiscuous mode. I did a bit of digging and realized we had overlooked setting the driver private flag to indicate we supported unicast filtering.
Example below shows the table with 00deadbeef01 as the main NIC address, and 5 additional addresses in the 00deadbeefX0 format.
# cat $dbgfs/mac_addr
Idx S TCAM Bitmap Addr/Mask
----------------------------------
00 0 00000000,00000000 000000000000
000000000000
01 0 00000000,00000000 000000000000
000000000000
02 0 00000000,00000000 000000000000
000000000000
...
24 0 00000000,00000000 000000000000
000000000000
25 1 00100000,00000000 00deadbeef50
000000000000
26 1 00100000,00000000 00deadbeef40
000000000000
27 1 00100000,00000000 00deadbeef30
000000000000
28 1 00100000,00000000 00deadbeef20
000000000000
29 1 00100000,00000000 00deadbeef10
000000000000
30 1 00100000,00000000 00deadbeef01
000000000000
31 0 00000000,00000000 000000000000
000000000000Before rule 31 would be active. With this change it correctly sticks to just the unicast filters.
--- drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +2 -0
@@ -628,6 +628,8 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd)fbnic_rss_key_fill (fbn->rss_key);fbnic_rss_init_en_mask (fbn); + netdev->priv_flags |=IFF_UNICAST_FLT ; + netdev->features |=NETIF_F_RXHASH | NETIF_F_SG |
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 544/642 tools: ynl-gen: don't output external constants
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 7e8b24e24ac46038e48c9a042e7d9b31855cbca5 ]
A definition with a "header" property is an "external" definition for C code, as in it is defined already in another C header file. Other languages will need the exact value but C codegen should not recreate it. So don't output those definitions in the uAPI header.
--- tools/net/ynl/pyynl/ynl_gen_c.py | 3 +++ 1 file changed, 3 insertions(+)
tools/net/ynl/pyynl/ynl_gen_c.py +3 -0
@@ -2549,6 +2549,9 @@ def render_uapi(family, cw): defines = [] for const in family['definitions']: + if const.get('header'): + continue + if const['type'] != 'const': cw.writes_defines(defines) defines = []
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 545/642 net/mlx5e: Avoid WARN_ON when configuring MQPRIO with HTB offload enabled
In reply to Sasha LevinFrom: Carolina Jubran <[email protected]>
[ Upstream commit 689805dcc474c2accb5cffbbcea1c06ee4a54570 ]
When attempting to enable MQPRIO while HTB offload is already configured, the driver currently returns -EINVAL and triggers a WARN_ON, leading to an unnecessary call trace.
Update the code to handle this case more gracefully by returning -EOPNOTSUPP instead, while also providing a helpful user message.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +5 -2
@@ -3787,8 +3787,11 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,/* MQPRIO is another toplevel qdisc that can't be attached * simultaneously with the offloaded HTB. */ -if (WARN_ON (mlx5e_selq_is_htb_enabled (&priv->selq))) -return -EINVAL ; +if (mlx5e_selq_is_htb_enabled (&priv->selq)) { +NL_SET_ERR_MSG_MOD (mqprio->extack, +"MQPRIO cannot be configured when HTB offload is enabled." ); +return -EOPNOTSUPP ; + }switch (mqprio->mode) {case TC_MQPRIO_MODE_DCB :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 546/642 cpufreq: amd-pstate: Remove unnecessary driver_lock in set_boost
In reply to Sasha LevinFrom: Dhananjay Ugwekar <[email protected]>
[ Upstream commit db1cafc77aaaf871509da06f4a864e9af6d6791f ]
set_boost is a per-policy function call, hence a driver wide lock is unnecessary. Also this mutex_acquire can collide with the mutex_acquire from the mode-switch path in status_store(), which can lead to a deadlock. So, remove it.
--- drivers/cpufreq/amd-pstate.c | 1 - 1 file changed, 1 deletion(-)
drivers/cpufreq/amd-pstate.c +0 -1
@@ -746,7 +746,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)pr_err ("Boost mode is not supported by this processor or SBIOS\n" );return -EOPNOTSUPP ; } -guard (mutex)(&amd_pstate_driver_lock); ret =amd_pstate_cpu_boost_update (policy, state);refresh_frequency_limits (policy);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 547/642 vxlan: Annotate FDB data races
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit f6205f8215f12a96518ac9469ff76294ae7bd612 ]
The 'used' and 'updated' fields in the FDB entry structure can be accessed concurrently by multiple threads, leading to reports such as [1]. Can be reproduced using [2].
Suppress these reports by annotating these accesses using READ_ONCE() / WRITE_ONCE().
[1]
BUG: KCSAN: data-race in vxlan_xmit / vxlan_xmit
write to 0xffff942604d263a8 of 8 bytes by task 286 on cpu 0:
vxlan_xmit+0xb29/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
read to 0xffff942604d263a8 of 8 bytes by task 287 on cpu 2:
vxlan_xmit+0xadf/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
value changed: 0x00000000fffbac6e -> 0x00000000fffbac6f
Reported by Kernel Concurrency Sanitizer on:
CPU: 2 UID: 0 PID: 287 Comm: mausezahn Not tainted 6.13.0-rc7-01544-gb4b270f11a02 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
[2]
#!/bin/bash
set +H
echo whitelist > /sys/kernel/debug/kcsan
echo !vxlan_xmit > /sys/kernel/debug/kcsan
ip link add name vx0 up type vxlan id 10010 dstport 4789 local 192.0.2.1 bridge fdb add 00:11:22:33:44:55 dev vx0 self static dst 198.51.100.1 taskset -c 0 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q & taskset -c 2 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q &
--- drivers/net/vxlan/vxlan_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/vxlan/vxlan_core.c +9 -9
@@ -227,9 +227,9 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, be32_to_cpu(fdb->vni))) goto nla_put_failure; - ci.ndm_used =jiffies_to_clock_t (now - fdb->used); + ci.ndm_used =jiffies_to_clock_t (now -READ_ONCE (fdb->used)); ci.ndm_confirmed =0 ; - ci.ndm_updated =jiffies_to_clock_t (now - fdb->updated); + ci.ndm_updated =jiffies_to_clock_t (now -READ_ONCE (fdb->updated)); ci.ndm_refcnt =0 ;if (nla_put (skb,NDA_CACHEINFO ,sizeof (ci), &ci))
@@ -434,8 +434,8 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,struct vxlan_fdb *f; f =__vxlan_find_mac (vxlan, mac, vni); -if (f && f->used != jiffies) - f->used = jiffies; +if (f &&READ_ONCE (f->used) != jiffies) +WRITE_ONCE (f->used, jiffies);return f; }
@@ -1009,12 +1009,12 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, !(f->flags & NTF_VXLAN_ADDED_BY_USER)) {if (f->state != state) { f->state = state; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; }if (f->flags != fdb_flags) { f->flags = fdb_flags; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; } }
@@ -1048,7 +1048,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, }if (ndm_flags &NTF_USE ) - f->used = jiffies; +WRITE_ONCE (f->used, jiffies);if (notify) {if (rd ==NULL )
@@ -1481,7 +1481,7 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev, src_mac, &rdst->remote_ip.sa, &src_ip->sa); rdst->remote_ip = *src_ip; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies);vxlan_fdb_notify (vxlan, f, rdst,RTM_NEWNEIGH , true,NULL ); }else {u32 hash_index =fdb_head_index (vxlan, src_mac, vni);
@@ -2852,7 +2852,7 @@ static void vxlan_cleanup(struct timer_list *t)if (f->flags &NTF_EXT_LEARNED )continue ; - timeout = f->used + vxlan->cfg.age_interval *HZ ; + timeout =READ_ONCE (f->used) + vxlan->cfg.age_interval *HZ ;if (time_before_eq (timeout, jiffies)) { netdev_dbg(vxlan->dev, "garbage collect %pM\n",
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 548/642 ipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 50f37fc2a39c4a8cc4813629b4cf239b71c6097d ]
if CONFIG_NET_IPGRE is enabled, but CONFIG_IPV6 is disabled:
net/ipv4/ip_gre.c: In function ‘ipgre_err’:
net/ipv4/ip_gre.c:144:22: error: variable ‘data_len’ set but not used [-Werror=unused-but-set-variable]
144 | unsigned int data_len = 0;
| ^~~~~~~~
Fix this by moving all data_len processing inside the IPV6-only section that uses its result.
--- net/ipv4/ip_gre.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/ipv4/ip_gre.c +10 -6
@@ -141,7 +141,6 @@ static int ipgre_err(struct sk_buff *skb, u32 info,const struct iphdr *iph;const int type =icmp_hdr (skb)->type;const int code =icmp_hdr (skb)->code; -unsigned int data_len =0 ;struct ip_tunnel *t;if (tpi->proto ==htons (ETH_P_TEB ))
@@ -182,7 +181,6 @@ static int ipgre_err(struct sk_buff *skb, u32 info,case ICMP_TIME_EXCEEDED :if (code !=ICMP_EXC_TTL )return 0 ; - data_len =icmp_hdr (skb)->un.reserved[1 ] *4 ;/* RFC 4884 4.1 */ break ;case ICMP_REDIRECT :
@@ -190,10 +188,16 @@ static int ipgre_err(struct sk_buff *skb, u32 info, }#if IS_ENABLED (CONFIG_IPV6 ) -if (tpi->proto ==htons (ETH_P_IPV6 ) && - !ip6_err_gen_icmpv6_unreach (skb, iph->ihl *4 + tpi->hdr_len, - type, data_len)) -return 0 ; +if (tpi->proto ==htons (ETH_P_IPV6 )) { +unsigned int data_len =0 ; + +if (type ==ICMP_TIME_EXCEEDED ) + data_len =icmp_hdr (skb)->un.reserved[1 ] *4 ;/* RFC 4884 4.1 */ + +if (!ip6_err_gen_icmpv6_unreach (skb, iph->ihl *4 + tpi->hdr_len, + type, data_len)) +return 0 ; + }#endif if (t->parms.iph.daddr == 0 ||
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 549/642 r8169: don't scan PHY addresses > 0
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit faac69a4ae5abb49e62c79c66b51bb905c9aa5ec ]
The PHY address is a dummy, because r8169 PHY access registers don't support a PHY address. Therefore scan address 0 only.
--- drivers/net/ethernet/realtek/r8169_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/realtek/r8169_main.c +1 -0
@@ -5250,6 +5250,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->priv = tp; new_bus->parent = &pdev->dev; new_bus->irq[0 ] =PHY_MAC_INTERRUPT ; + new_bus->phy_mask =GENMASK (31 ,1 );snprintf (new_bus->id,MII_BUS_ID_SIZE ,"r8169-%x-%x" ,pci_domain_nr (pdev->bus),pci_dev_id (pdev));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 550/642 net: flush_backlog() small changes
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit cbe08724c18078564abefbf6591078a7c98e5e0f ]
Add READ_ONCE() around reads of skb->dev->reg_state, because this field can be changed from other threads/cpus.
Instead of calling dev_kfree_skb_irq() and kfree_skb() while interrupts are masked and locks held, use a temporary list and use __skb_queue_purge_reason()
Use SKB_DROP_REASON_DEV_READY drop reason to better describe why these skbs are dropped.
--- net/core/dev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/core/dev.c +8 -4
@@ -6187,16 +6187,18 @@ EXPORT_SYMBOL(netif_receive_skb_list);static void flush_backlog (struct work_struct *work) {struct sk_buff *skb, *tmp; +struct sk_buff_head list;struct softnet_data *sd; +__skb_queue_head_init (&list);local_bh_disable (); sd =this_cpu_ptr (&softnet_data);backlog_lock_irq_disable (sd); skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { -if (skb->dev->reg_state ==NETREG_UNREGISTERING ) { +if (READ_ONCE (skb->dev->reg_state) ==NETREG_UNREGISTERING ) {__skb_unlink (skb, &sd->input_pkt_queue); -dev_kfree_skb_irq (skb); +__skb_queue_tail (&list, skb);rps_input_queue_head_incr (sd); } }
@@ -6204,14 +6206,16 @@ static void flush_backlog(struct work_struct *work)local_lock_nested_bh (&softnet_data.process_queue_bh_lock); skb_queue_walk_safe(&sd->process_queue, skb, tmp) { -if (skb->dev->reg_state ==NETREG_UNREGISTERING ) { +if (READ_ONCE (skb->dev->reg_state) ==NETREG_UNREGISTERING ) {__skb_unlink (skb, &sd->process_queue); -kfree_skb (skb); +__skb_queue_tail (&list, skb);rps_input_queue_head_incr (sd); } }local_unlock_nested_bh (&softnet_data.process_queue_bh_lock);local_bh_enable (); + +__skb_queue_purge_reason (&list,SKB_DROP_REASON_DEV_READY ); }static bool flush_required (int cpu)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 551/642 bridge: mdb: Allow replace of a host-joined group
In reply to Sasha LevinFrom: Petr Machata <[email protected]>
[ Upstream commit d9e9f6d7b7d0c520bb87f19d2cbc57aeeb2091d5 ]
Attempts to replace an MDB group membership of the host itself are currently bounced:
# ip link add name br up type bridge vlan_filtering 1 # bridge mdb replace dev br port br grp 239.0.0.1 vid 2 # bridge mdb replace dev br port br grp 239.0.0.1 vid 2 Error: bridge: Group is already joined by host.
A similar operation done on a member port would succeed. Ignore the check for replacement of host group memberships as well.
The bit of code that this enables is br_multicast_host_join(), which, for already-joined groups only refreshes the MC group expiration timer, which is desirable; and a userspace notification, also desirable.
Change a selftest that exercises this code path from expecting a rejection to expecting a pass. The rest of MDB selftests pass without modification.
--- net/bridge/br_mdb.c | 2 +- tools/testing/selftests/net/forwarding/bridge_mdb.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/bridge/br_mdb.c +1 -1
@@ -1040,7 +1040,7 @@ static int br_mdb_add_group(const struct br_mdb_config *cfg,/* host join */ if (!port) { -if (mp->host_joined) { +if (mp->host_joined && !(cfg->nlflags &NLM_F_REPLACE )) {NL_SET_ERR_MSG_MOD (extack,"Group is already joined by host" );return -EEXIST ; }
tools/testing/selftests/net/forwarding/bridge_mdb.sh +1 -1
@@ -149,7 +149,7 @@ cfg_test_host_common() check_err $? "Failed to add $name host entry" bridge mdb replace dev br0 port br0 grp $grp $state vid 10 &> /dev/null - check_fail $? "Managed to replace $name host entry" + check_err $? "Failed to replace $name host entry" bridge mdb del dev br0 port br0 grp $grp $state vid 10 bridge mdb get dev br0 grp $grp vid 10 &> /dev/null
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 552/642 net-sysfs: remove rtnl_trylock from queue attributes
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit b0b6fcfa6ad8433e22b050c72cfbeec2548744b9 ]
Similar to the commit removing remove rtnl_trylock from device attributes we here apply the same technique to networking queues.
--- net/core/net-sysfs.c | 147 ++++++++++++++++++++++++++----------------- 1 file changed, 89 insertions(+), 58 deletions(-)
net/core/net-sysfs.c +89 -58
@@ -1244,9 +1244,11 @@ static int net_rx_queue_change_owner(struct net_device *dev, int num,*/ struct netdev_queue_attribute {struct attribute attr; -ssize_t (*show)(struct netdev_queue *queue,char *buf); -ssize_t (*store)(struct netdev_queue *queue, -const char *buf,size_t len); +ssize_t (*show)(struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf); +ssize_t (*store)(struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf, +size_t len); };#define to_netdev_queue_attr (_attr) \ container_of(_attr, struct netdev_queue_attribute, attr)
@@ -1263,7 +1265,7 @@ static ssize_t netdev_queue_attr_show(struct kobject *kobj,if (!attribute->show)return -EIO ; -return attribute->show (queue, buf); +return attribute->show (kobj, attr, queue, buf); } static ssize_t netdev_queue_attr_store(struct kobject *kobj,
@@ -1277,7 +1279,7 @@ static ssize_t netdev_queue_attr_store(struct kobject *kobj,if (!attribute->store)return -EIO ; -return attribute->store (queue, buf, count); +return attribute->store (kobj, attr, queue, buf, count); }static const struct sysfs_ops netdev_queue_sysfs_ops = {
@@ -1285,7 +1287,8 @@ static const struct sysfs_ops netdev_queue_sysfs_ops = { .store = netdev_queue_attr_store, }; -static ssize_t tx_timeout_show (struct netdev_queue *queue,char *buf) +static ssize_t tx_timeout_show (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {unsigned long trans_timeout =atomic_long_read (&queue->trans_timeout);
@@ -1303,18 +1306,18 @@ static unsigned int get_netdev_queue_index(struct netdev_queue *queue)return i; } -static ssize_t traffic_class_show (struct netdev_queue *queue, -char *buf) +static ssize_t traffic_class_show (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct net_device *dev = queue->dev; -int num_tc, tc; -int index; +int num_tc, tc, index, ret;if (!netif_is_multiqueue (dev))return -ENOENT ; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (kobj, attr, queue->dev); +if (ret) +return ret; index =get_netdev_queue_index (queue);
@@ -1341,24 +1344,25 @@ static ssize_t traffic_class_show(struct netdev_queue *queue, }#ifdef CONFIG_XPS -static ssize_t tx_maxrate_show (struct netdev_queue *queue, -char *buf) +static ssize_t tx_maxrate_show (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {return sysfs_emit (buf,"%lu\n" , queue->tx_maxrate); } -static ssize_t tx_maxrate_store (struct netdev_queue *queue, -const char *buf,size_t len) +static ssize_t tx_maxrate_store (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf, +size_t len) { -struct net_device *dev = queue->dev;int err, index =get_netdev_queue_index (queue); +struct net_device *dev = queue->dev;u32 rate =0 ;if (!capable (CAP_NET_ADMIN ))return -EPERM ;/* The check is also done later; this helps returning early without -* hitting the trylock/restart below. +* hitting the locking section below. */ if (!dev->netdev_ops->ndo_set_tx_maxrate)return -EOPNOTSUPP ;
@@ -1367,18 +1371,21 @@ static ssize_t tx_maxrate_store(struct netdev_queue *queue,if (err <0 )return err; -if (!rtnl_trylock ()) -return restart_syscall (); + err =sysfs_rtnl_lock (kobj, attr, dev); +if (err) +return err; err = -EOPNOTSUPP ;if (dev->netdev_ops->ndo_set_tx_maxrate) err = dev->netdev_ops->ndo_set_tx_maxrate (dev, index, rate); -rtnl_unlock ();if (!err) { queue->tx_maxrate = rate; +rtnl_unlock ();return len; } + +rtnl_unlock ();return err; }
@@ -1422,16 +1429,17 @@ static ssize_t bql_set(const char *buf, const size_t count,return count; } -static ssize_t bql_show_hold_time (struct netdev_queue *queue, -char *buf) +static ssize_t bql_show_hold_time (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct dql *dql = &queue->dql;return sysfs_emit (buf,"%u\n" ,jiffies_to_msecs (dql->slack_hold_time)); } -static ssize_t bql_set_hold_time (struct netdev_queue *queue, -const char *buf,size_t len) +static ssize_t bql_set_hold_time (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf, +size_t len) {struct dql *dql = &queue->dql;unsigned int value;
@@ -1450,15 +1458,17 @@ static struct netdev_queue_attribute bql_hold_time_attribute __ro_after_init = __ATTR(hold_time, 0644, bql_show_hold_time, bql_set_hold_time); -static ssize_t bql_show_stall_thrs (struct netdev_queue *queue,char *buf) +static ssize_t bql_show_stall_thrs (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct dql *dql = &queue->dql;return sysfs_emit (buf,"%u\n" ,jiffies_to_msecs (dql->stall_thrs)); } -static ssize_t bql_set_stall_thrs (struct netdev_queue *queue, -const char *buf,size_t len) +static ssize_t bql_set_stall_thrs (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf, +size_t len) {struct dql *dql = &queue->dql;unsigned int value;
@@ -1484,13 +1494,15 @@ static ssize_t bql_set_stall_thrs(struct netdev_queue *queue,static struct netdev_queue_attribute bql_stall_thrs_attribute__ro_after_init =__ATTR (stall_thrs,0644 , bql_show_stall_thrs, bql_set_stall_thrs); -static ssize_t bql_show_stall_max (struct netdev_queue *queue,char *buf) +static ssize_t bql_show_stall_max (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {return sysfs_emit (buf,"%u\n" ,READ_ONCE (queue->dql.stall_max)); } -static ssize_t bql_set_stall_max (struct netdev_queue *queue, -const char *buf,size_t len) +static ssize_t bql_set_stall_max (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf, +size_t len) {WRITE_ONCE (queue->dql.stall_max,0 );return len;
@@ -1499,7 +1511,8 @@ static ssize_t bql_set_stall_max(struct netdev_queue *queue,static struct netdev_queue_attribute bql_stall_max_attribute__ro_after_init =__ATTR (stall_max,0644 , bql_show_stall_max, bql_set_stall_max); -static ssize_t bql_show_stall_cnt (struct netdev_queue *queue,char *buf) +static ssize_t bql_show_stall_cnt (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct dql *dql = &queue->dql;
@@ -1509,8 +1522,8 @@ static ssize_t bql_show_stall_cnt(struct netdev_queue *queue, char *buf)static struct netdev_queue_attribute bql_stall_cnt_attribute__ro_after_init =__ATTR (stall_cnt,0444 , bql_show_stall_cnt,NULL ); -static ssize_t bql_show_inflight (struct netdev_queue *queue, -char *buf) +static ssize_t bql_show_inflight (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct dql *dql = &queue->dql;
@@ -1521,13 +1534,16 @@ static struct netdev_queue_attribute bql_inflight_attribute __ro_after_init =__ATTR (inflight,0444 , bql_show_inflight,NULL );#define BQL_ATTR (NAME ,FIELD ) \ -static ssize_t bql_show_ ## NAME(struct netdev_queue *queue, \ - char *buf) \ +static ssize_t bql_show_ ## NAME(struct kobject *kobj, \ + struct attribute *attr, \ + struct netdev_queue *queue, char *buf) \ { \ return bql_show(buf, queue->dql.FIELD); \ } \ \ -static ssize_t bql_set_ ## NAME(struct netdev_queue *queue, \ +static ssize_t bql_set_ ## NAME(struct kobject *kobj, \ + struct attribute *attr, \ + struct netdev_queue *queue, \ const char *buf, size_t len) \ { \ return bql_set(buf, len, &queue->dql.FIELD); \
@@ -1613,19 +1629,21 @@ static ssize_t xps_queue_show(struct net_device *dev, unsigned int index,return len <PAGE_SIZE ? len : -EINVAL ; } -static ssize_t xps_cpus_show (struct netdev_queue *queue,char *buf) +static ssize_t xps_cpus_show (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct net_device *dev = queue->dev;unsigned int index; -int len, tc; +int len, tc, ret;if (!netif_is_multiqueue (dev))return -ENOENT ; index =get_netdev_queue_index (queue); -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (kobj, attr, queue->dev); +if (ret) +return ret;/* If queue belongs to subordinate dev use its map */ dev =netdev_get_tx_queue (dev, index)->sb_dev ? : dev;
@@ -1636,18 +1654,21 @@ static ssize_t xps_cpus_show(struct netdev_queue *queue, char *buf)return -EINVAL ; } -/* Make sure the subordinate device can't be freed */ -get_device (&dev->dev); +/* Increase the net device refcnt to make sure it won't be freed while +* xps_queue_show is running. +*/ +dev_hold (dev);rtnl_unlock (); len =xps_queue_show (dev, index, tc, buf,XPS_CPUS ); -put_device (&dev->dev); +dev_put (dev);return len; } -static ssize_t xps_cpus_store (struct netdev_queue *queue, -const char *buf,size_t len) +static ssize_t xps_cpus_store (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf, +size_t len) {struct net_device *dev = queue->dev;unsigned int index;
@@ -1671,9 +1692,10 @@ static ssize_t xps_cpus_store(struct netdev_queue *queue,return err; } -if (!rtnl_trylock ()) { + err =sysfs_rtnl_lock (kobj, attr, dev); +if (err) {free_cpumask_var (mask); -return restart_syscall (); +return err; } err =netif_set_xps_queue (dev, mask, index);
@@ -1687,26 +1709,34 @@ static ssize_t xps_cpus_store(struct netdev_queue *queue,static struct netdev_queue_attribute xps_cpus_attribute__ro_after_init =__ATTR_RW (xps_cpus); -static ssize_t xps_rxqs_show (struct netdev_queue *queue,char *buf) +static ssize_t xps_rxqs_show (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,char *buf) {struct net_device *dev = queue->dev;unsigned int index; -int tc; +int tc, ret; index =get_netdev_queue_index (queue); -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (kobj, attr, dev); +if (ret) +return ret; tc =netdev_txq_to_tc (dev, index); + +/* Increase the net device refcnt to make sure it won't be freed while +* xps_queue_show is running. +*/ +dev_hold (dev);rtnl_unlock (); -if (tc <0 ) -return -EINVAL ; -return xps_queue_show (dev, index, tc, buf,XPS_RXQS ); + ret = tc >=0 ?xps_queue_show (dev, index, tc, buf,XPS_RXQS ) : -EINVAL ; +dev_put (dev); +return ret; } -static ssize_t xps_rxqs_store (struct netdev_queue *queue,const char *buf, +static ssize_t xps_rxqs_store (struct kobject *kobj,struct attribute *attr, +struct netdev_queue *queue,const char *buf,size_t len) {struct net_device *dev = queue->dev;
@@ -1730,9 +1760,10 @@ static ssize_t xps_rxqs_store(struct netdev_queue *queue, const char *buf,return err; } -if (!rtnl_trylock ()) { + err =sysfs_rtnl_lock (kobj, attr, dev); +if (err) {bitmap_free (mask); -return restart_syscall (); +return err; }cpus_read_lock ();
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 553/642 net-sysfs: prevent uncleared queues from being re-added
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit 7e54f85c60828842be27e0149f3533357225090e ]
With the (upcoming) removal of the rtnl_trylock/restart_syscall logic and because of how Tx/Rx queues are implemented (and their requirements), it might happen that a queue is re-added before having the chance to be cleared. In such rare case, do not complete the queue addition operation.
--- net/core/net-sysfs.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
net/core/net-sysfs.c +32 -0
@@ -1131,6 +1131,22 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)struct kobject *kobj = &queue->kobj;int error =0 ; +/* Rx queues are cleared in rx_queue_release to allow later +* re-registration. This is triggered when their kobj refcount is +* dropped. +* +* If a queue is removed while both a read (or write) operation and a +* the re-addition of the same queue are pending (waiting on rntl_lock) +* it might happen that the re-addition will execute before the read, +* making the initial removal to never happen (queue's kobj refcount +* won't drop enough because of the pending read). In such rare case, +* return to allow the removal operation to complete. +*/ +if (unlikely (kobj->state_initialized)) { +netdev_warn_once (dev,"Cannot re-add rx queues before their removal completed" ); +return -EAGAIN ; + } +/* Kobject_put later will trigger rx_queue_release call which * decreases dev refcount: Take that reference here */
@@ -1842,6 +1858,22 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)struct kobject *kobj = &queue->kobj;int error =0 ; +/* Tx queues are cleared in netdev_queue_release to allow later +* re-registration. This is triggered when their kobj refcount is +* dropped. +* +* If a queue is removed while both a read (or write) operation and a +* the re-addition of the same queue are pending (waiting on rntl_lock) +* it might happen that the re-addition will execute before the read, +* making the initial removal to never happen (queue's kobj refcount +* won't drop enough because of the pending read). In such rare case, +* return to allow the removal operation to complete. +*/ +if (unlikely (kobj->state_initialized)) { +netdev_warn_once (dev,"Cannot re-add tx queues before their removal completed" ); +return -EAGAIN ; + } +/* Kobject_put later will trigger netdev_queue_release call * which decreases dev refcount: Take that reference here */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 554/642 net-sysfs: remove rtnl_trylock from device attributes
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit 79c61899b5eee317907efd1b0d06a1ada0cc00d8 ]
There is an ABBA deadlock between net device unregistration and sysfs files being accessed[1][2]. To prevent this from happening all paths taking the rtnl lock after the sysfs one (actually kn->active refcount) use rtnl_trylock and return early (using restart_syscall)[3], which can make syscalls to spin for a long time when there is contention on the rtnl lock[4].
There are not many possibilities to improve the above:
- Rework the entire net/ locking logic.
- Invert two locks in one of the paths — not possible.
But here it's actually possible to drop one of the locks safely: the kernfs_node refcount. More details in the code itself, which comes with lots of comments.
Note that we check the device is alive in the added sysfs_rtnl_lock helper to disallow sysfs operations to run after device dismantle has started. This also help keeping the same behavior as before. Because of this calls to dev_isalive in sysfs ops were removed.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
[4] https://lore.kernel.org/all/[email protected]/T/
--- include/linux/rtnetlink.h | 1 + net/core/net-sysfs.c | 186 +++++++++++++++++++++++++++----------- net/core/rtnetlink.c | 5 + 3 files changed, 139 insertions(+), 53 deletions(-)
include/linux/rtnetlink.h +1 -0
@@ -43,6 +43,7 @@ extern void rtnl_lock(void);extern void rtnl_unlock (void );extern int rtnl_trylock (void );extern int rtnl_is_locked (void ); +extern int rtnl_lock_interruptible (void );extern int rtnl_lock_killable (void );extern bool refcount_dec_and_rtnl_lock (refcount_t *r);
net/core/net-sysfs.c +133 -53
292 lines not on this page · raw message
net/core/rtnetlink.c +5 -0
@@ -80,6 +80,11 @@ void rtnl_lock(void) }EXPORT_SYMBOL (rtnl_lock); +int rtnl_lock_interruptible (void ) +{ +return mutex_lock_interruptible (&rtnl_mutex); +} +int rtnl_lock_killable (void ) {return mutex_lock_killable (&rtnl_mutex);
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.14 554/642] net-sysfs: remove rtnl_trylock from device attributes
Hello,
Quoted 29 lines · Sasha Levin
From: Antoine Tenart <[email protected]>
[ Upstream commit
79c61899b5eee317907efd1b0d06a1ada0cc00d8]There is an ABBA deadlock between net device unregistration and sysfs files being accessed[1][2]. To prevent this from happening all paths taking the rtnl lock after the sysfs one (actually
kn->activerefcount) usertnl_trylockand return early (using restart_syscall)[3], which can make syscalls to spin for a long time when there is contention on the rtnl lock[4].There are not many possibilities to improve the above:
- Rework the entirenet/locking logic.
- Invert two locks in one of the paths — not possible.But here it's actually possible to drop one of the locks safely: the
kernfs_noderefcount. More details in the code itself, which comes with lots of comments.Note that we check the device is alive in the added
sysfs_rtnl_lockhelper to disallow sysfs operations to run after device dismantle has started. This also help keeping the same behavior as before. Because of this calls todev_isalivein sysfs ops were removed.[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
[4] https://lore.kernel.org/all/[email protected]/T/
Quoted 4 lines
Signed-off-by Antoine Tenart <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I'm not sure why commits from this series were flagged for stable trees, but I would not advise to take them. They are not fixing a bug, only improving performances by reducing lock contention.
The commits are:
79c61899b5ee net-sysfs: remove rtnl_trylock from device attributes b7ecc1de51ca net-sysfs: move queue attribute groups outside the default groups [It seems this one was missed?]7e54f85c6082 net-sysfs: prevent uncleared queues from being re-added [My guess is this looks like a real fix, but it's only preventing an issue after the changes made in the series]b0b6fcfa6ad8 net-sysfs: remove rtnl_trylock from queue attributes
Same applies for the other stable backport requests.
Thanks,
Antoine
Quoted 344 lines
--- include/linux/rtnetlink.h | 1 + net/core/net-sysfs.c | 186 +++++++++++++++++++++++++++----------- net/core/rtnetlink.c | 5 + 3 files changed, 139 insertions(+), 53 deletions(-)include/linux/rtnetlink.h +1
-0@@ -43,6 +43,7 @@ extern void rtnl_lock(void);extern void rtnl_unlock (void );extern int rtnl_trylock (void );extern int rtnl_is_locked (void ); +extern int rtnl_lock_interruptible (void );extern int rtnl_lock_killable (void );extern bool refcount_dec_and_rtnl_lock (refcount_t *r);net/core/net-sysfs.c +133
-53@@ -42,6 +42,87 @@ static inline int dev_isalive(const struct net_device *dev)return READ_ONCE (dev->reg_state) <=NETREG_REGISTERED ; } +/* There is a possible ABBA deadlock between rtnl_lock and kernfs_node->active, +* when unregistering a net device and accessing associated sysfs files. The +* potential deadlock is as follow: +* +* CPU 0 CPU 1 +* +* rtnl_lock vfs_read +* unregister_netdevice_many kernfs_seq_start +* device_del / kobject_put kernfs_get_active (kn->active++) +* kernfs_drain sysfs_kf_seq_show +* wait_event( rtnl_lock +* kn->active == KN_DEACTIVATED_BIAS) -> waits on CPU 0 to release +* -> waits on CPU 1 to decrease kn->active the rtnl lock. +* +* The historical fix was to use rtnl_trylock with restart_syscall to bail out +* of sysfs operations when the lock couldn't be taken. This fixed the above +* issue as it allowed CPU 1 to bail out of the ABBA situation. +* +* But it came with performances issues, as syscalls are being restarted in +* loops when there was contention on the rtnl lock, with huge slow downs in +* specific scenarios (e.g. lots of virtual interfaces created and userspace +* daemons querying their attributes). +* +* The idea below is to bail out of the active kernfs_node protection +* (kn->active) while trying to take the rtnl lock. +* +* This replaces rtnl_lock() and still has to be used with rtnl_unlock(). The +* net device is guaranteed to be alive if this returns successfully. +*/ +static int sysfs_rtnl_lock (struct kobject *kobj,struct attribute *attr, +struct net_device *ndev) +{ +struct kernfs_node *kn; +int ret =0 ; + +/* First, we hold a reference to the net device as the unregistration +* path might run in parallel. This will ensure the net device and the +* associated sysfs objects won't be freed while we try to take the rtnl +* lock. +*/ +dev_hold (ndev); +/* sysfs_break_active_protection was introduced to allow self-removal of +* devices and their associated sysfs files by bailing out of the +* sysfs/kernfs protection. We do this here to allow the unregistration +* path to complete in parallel. The following takes a reference on the +* kobject and the kernfs_node being accessed. +* +* This works because we hold a reference onto the net device and the +* unregistration path will wait for us eventually in netdev_run_todo +* (outside an rtnl lock section). +*/ + kn =sysfs_break_active_protection (kobj, attr); +/* We can now try to take the rtnl lock. This can't deadlock us as the +* unregistration path is able to drain sysfs files (kernfs_node) thanks +* to the above dance. +*/ +if (rtnl_lock_interruptible ()) { + ret = -ERESTARTSYS ; + goto unbreak; + } +/* Check dismantle on the device hasn't started, otherwise deny the +* operation. +*/ +if (!dev_isalive (ndev)) { +rtnl_unlock (); + ret = -ENODEV ; + goto unbreak; + } +/* We are now sure the device dismantle hasn't started nor that it can +* start before we exit the locking section as we hold the rtnl lock. +* There's no need to keep unbreaking the sysfs protection nor to hold +* a net device reference from that point; that was only needed to take +* the rtnl lock. +*/ +unbreak: +sysfs_unbreak_active_protection (kn); +dev_put (ndev); + +return ret; +} +/* use same locking rules as GIF* ioctl's */ static ssize_t netdev_show(const struct device *dev, struct device_attribute *attr, char *buf,@@ -95,14 +176,14 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,if (ret) goto err; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) + goto err; + + ret = (*set)(netdev, new); +if (ret ==0 ) + ret = len; -if (dev_isalive (netdev)) { - ret = (*set)(netdev, new); -if (ret ==0 ) - ret = len; - }rtnl_unlock (); err:return ret;@@ -220,7 +301,7 @@ static ssize_t carrier_store(struct device *dev, struct device_attribute *attr,struct net_device *netdev =to_net_dev (dev);/* The check is also done in change_carrier; this helps returning early -* without hitting the trylock/restart in netdev_store. +* without hitting the locking section in netdev_store. */ if (!netdev->netdev_ops->ndo_change_carrier)return -EOPNOTSUPP ;@@ -234,8 +315,9 @@ static ssize_t carrier_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);int ret = -EINVAL ; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret;if (netif_running (netdev)) {/* Synchronize carrier state with link watch, @@ -245,8 +327,8 @@ static ssize_t carrier_show(struct device *dev, ret =sysfs_emit (buf, fmt_dec, !!netif_carrier_ok (netdev)); } -rtnl_unlock (); +rtnl_unlock ();return ret; }static DEVICE_ATTR_RW (carrier);@@ -258,13 +340,14 @@ static ssize_t speed_show(struct device *dev,int ret = -EINVAL ;/* The check is also done in __ethtool_get_link_ksettings; this helps -* returning early without hitting the trylock/restart below. +* returning early without hitting the locking section below. */ if (!netdev->ethtool_ops->get_link_ksettings)return ret; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret;if (netif_running (netdev)) {struct ethtool_link_ksettings cmd;@@ -284,13 +367,14 @@ static ssize_t duplex_show(struct device *dev,int ret = -EINVAL ;/* The check is also done in __ethtool_get_link_ksettings; this helps -* returning early without hitting the trylock/restart below. +* returning early without hitting the locking section below. */ if (!netdev->ethtool_ops->get_link_ksettings)return ret; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret;if (netif_running (netdev)) {struct ethtool_link_ksettings cmd;@@ -490,16 +574,15 @@ static ssize_t ifalias_store(struct device *dev, struct device_attribute *attr,if (len >0 && buf[len -1 ] =='\n' ) --count; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret; -if (dev_isalive (netdev)) { - ret =dev_set_alias (netdev, buf, count); -if (ret <0 ) - goto err; - ret = len; -netdev_state_change (netdev); - } + ret =dev_set_alias (netdev, buf, count); +if (ret <0 ) + goto err; + ret = len; +netdev_state_change (netdev); err:rtnl_unlock ();@@ -551,24 +634,23 @@ static ssize_t phys_port_id_show(struct device *dev, struct device_attribute *attr, char *buf) { struct net_device *netdev = to_net_dev(dev); +struct netdev_phys_item_id ppid;ssize_t ret = -EINVAL ;/* The check is also done in dev_get_phys_port_id; this helps returning -* early without hitting the trylock/restart below. +* early without hitting the locking section below. */ if (!netdev->netdev_ops->ndo_get_phys_port_id)return -EOPNOTSUPP ; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret; -if (dev_isalive (netdev)) { -struct netdev_phys_item_id ppid; + ret =dev_get_phys_port_id (netdev, &ppid); +if (!ret) + ret =sysfs_emit (buf,"%*phN\n" , ppid.id_len, ppid.id); - ret =dev_get_phys_port_id (netdev, &ppid); -if (!ret) - ret =sysfs_emit (buf,"%*phN\n" , ppid.id_len, ppid.id); - }rtnl_unlock ();return ret;@@ -580,24 +662,23 @@ static ssize_t phys_port_name_show(struct device *dev, {struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +char name[IFNAMSIZ ];/* The checks are also done in dev_get_phys_port_name; this helps -* returning early without hitting the trylock/restart below. +* returning early without hitting the locking section below. */ if (!netdev->netdev_ops->ndo_get_phys_port_name && !netdev->devlink_port)return -EOPNOTSUPP ; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret; -if (dev_isalive (netdev)) { -char name[IFNAMSIZ ]; + ret =dev_get_phys_port_name (netdev, name,sizeof (name)); +if (!ret) + ret =sysfs_emit (buf,"%s\n" , name); - ret =dev_get_phys_port_name (netdev, name,sizeof (name)); -if (!ret) - ret =sysfs_emit (buf,"%s\n" , name); - }rtnl_unlock ();return ret;@@ -608,26 +689,25 @@ static ssize_t phys_switch_id_show(struct device *dev, struct device_attribute *attr, char *buf) { struct net_device *netdev = to_net_dev(dev); +struct netdev_phys_item_id ppid = { };ssize_t ret = -EINVAL ;/* The checks are also done in dev_get_phys_port_name; this helps -* returning early without hitting the trylock/restart below. This works +* returning early without hitting the locking section below. This works * because recurse is false when calling dev_get_port_parent_id. */ if (!netdev->netdev_ops->ndo_get_port_parent_id && !netdev->devlink_port)return -EOPNOTSUPP ; -if (!rtnl_trylock ()) -return restart_syscall (); + ret =sysfs_rtnl_lock (&dev->kobj, &attr->attr, netdev); +if (ret) +return ret; -if (dev_isalive (netdev)) { -struct netdev_phys_item_id ppid = { }; + ret =dev_get_port_parent_id (netdev, &ppid, false); +if (!ret) + ret =sysfs_emit (buf,"%*phN\n" , ppid.id_len, ppid.id); - ret =dev_get_port_parent_id (netdev, &ppid, false); -if (!ret) - ret =sysfs_emit (buf,"%*phN\n" , ppid.id_len, ppid.id); - }rtnl_unlock ();return ret;net/core/rtnetlink.c +5
-0@@ -80,6 +80,11 @@ void rtnl_lock(void) }EXPORT_SYMBOL (rtnl_lock); +int rtnl_lock_interruptible (void ) +{ +return mutex_lock_interruptible (&rtnl_mutex); +} +int rtnl_lock_killable (void ) {return mutex_lock_killable (&rtnl_mutex);Signature · 1 line
2.39.5
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 554/642] net-sysfs: remove rtnl_trylock from device attributes
Quoted 51 lines · Antoine Tenart
Hello,
Quoted 29 lines · Sasha Levin
From: Antoine Tenart <[email protected]>
[ Upstream commit
79c61899b5eee317907efd1b0d06a1ada0cc00d8]There is an ABBA deadlock between net device unregistration and sysfs files being accessed[1][2]. To prevent this from happening all paths taking the rtnl lock after the sysfs one (actually
kn->activerefcount) usertnl_trylockand return early (using restart_syscall)[3], which can make syscalls to spin for a long time when there is contention on the rtnl lock[4].There are not many possibilities to improve the above:
- Rework the entirenet/locking logic.
- Invert two locks in one of the paths — not possible.But here it's actually possible to drop one of the locks safely: the
kernfs_noderefcount. More details in the code itself, which comes with lots of comments.Note that we check the device is alive in the added
sysfs_rtnl_lockhelper to disallow sysfs operations to run after device dismantle has started. This also help keeping the same behavior as before. Because of this calls todev_isalivein sysfs ops were removed.[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
[4] https://lore.kernel.org/all/[email protected]/T/Quoted 4 lines
Signed-off-by Antoine Tenart <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Sasha Levin <[email protected]>I'm not sure why commits from this series were flagged for stable trees, but I would not advise to take them. They are not fixing a bug, only improving performances by reducing lock contention.
The commits are:
79c61899b5eenet-sysfs: removertnl_trylockfrom device attributesb7ecc1de51canet-sysfs: move queue attribute groups outside the default groups [It seems this one was missed?]7e54f85c6082net-sysfs: prevent uncleared queues from being re-added [My guess is this looks like a real fix, but it's only preventing an issue after the changes made in the series]b0b6fcfa6ad8net-sysfs: removertnl_trylockfrom queue attributes
Quoted 1 line
Same applies for the other stable backport requests.
I'll drop them, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 555/642 ice: init flow director before RDMA
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit d67627e7b53203ca150e54723abbed81a0716286 ]
Flow director needs only one MSI-X. Load it before RDMA to save MSI-X for it.
--- drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +4 -2
@@ -5186,11 +5186,12 @@ int ice_load(struct ice_pf *pf)ice_napi_add (vsi); +ice_init_features (pf); + err =ice_init_rdma (pf);if (err) goto err_init_rdma; -ice_init_features (pf);ice_service_task_restart (pf);clear_bit (ICE_DOWN , pf->state);
@@ -5198,6 +5199,7 @@ int ice_load(struct ice_pf *pf)return 0 ; err_init_rdma: +ice_deinit_features (pf);ice_tc_indir_block_unregister (vsi); err_tc_indir_block_register:ice_unregister_netdev (vsi);
@@ -5221,8 +5223,8 @@ void ice_unload(struct ice_pf *pf)devl_assert_locked (priv_to_devlink (pf)); -ice_deinit_features (pf);ice_deinit_rdma (pf); +ice_deinit_features (pf);ice_tc_indir_block_unregister (vsi);ice_unregister_netdev (vsi);ice_devlink_destroy_pf_port (pf);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 556/642 ice: treat dyn_allowed only as suggestion
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit a8c2d3932c1106af2764cc6869b29bcf3cb5bc47 ]
It can be needed to have some MSI-X allocated as static and rest as dynamic. For example on PF VSI. We want to always have minimum one MSI-X on it, because of that it is allocated as a static one, rest can be dynamic if it is supported.
Change the ice_get_irq_res() to allow using static entries if they are free even if caller wants dynamic one.
Adjust limit values to the new approach. Min and max in limit means the values that are valid, so decrease max and num_static by one.
Set vsi::irq_dyn_alloc if dynamic allocation is supported.
--- drivers/net/ethernet/intel/ice/ice_irq.c | 25 ++++++++++++------------ drivers/net/ethernet/intel/ice/ice_lib.c | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/ice/ice_irq.c +13 -12
@@ -45,7 +45,7 @@ static void ice_free_irq_res(struct ice_pf *pf, u16 index)/** * ice_get_irq_res - get an interrupt resource * @pf: board private structure -* @dyn_only: force entry to be dynamically allocated +* @dyn_allowed: allow entry to be dynamically allocated * * Allocate new irq entry in the free slot of the tracker. Since xarray * is used, always allocate new entry at the lowest possible index. Set
@@ -53,11 +53,12 @@ static void ice_free_irq_res(struct ice_pf *pf, u16 index)* * Returns allocated irq entry or NULL on failure. */ -static struct ice_irq_entry *ice_get_irq_res (struct ice_pf *pf,bool dyn_only) +static struct ice_irq_entry *ice_get_irq_res (struct ice_pf *pf, +bool dyn_allowed) { -struct xa_limit limit = { .max = pf->irq_tracker.num_entries, +struct xa_limit limit = { .max = pf->irq_tracker.num_entries -1 , .min =0 }; -unsigned int num_static = pf->irq_tracker.num_static; +unsigned int num_static = pf->irq_tracker.num_static -1 ;struct ice_irq_entry *entry;unsigned int index;int ret;
@@ -66,9 +67,9 @@ static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf, bool dyn_only)if (!entry)return NULL ; -/* skip preallocated entries if the caller says so */ -if (dyn_only) - limit.min = num_static; +/* only already allocated if the caller says so */ +if (!dyn_allowed) + limit.max = num_static; ret =xa_alloc (&pf->irq_tracker.entries, &index, entry, limit,GFP_KERNEL );
@@ -78,7 +79,7 @@ static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf, bool dyn_only) entry =NULL ; }else { entry->index = index; - entry->dynamic = index >= num_static; + entry->dynamic = index > num_static; }return entry;
@@ -272,7 +273,7 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)/** * ice_alloc_irq - Allocate new interrupt vector * @pf: board private structure -* @dyn_only: force dynamic allocation of the interrupt +* @dyn_allowed: allow dynamic allocation of the interrupt * * Allocate new interrupt vector for a given owner id. * return struct msi_map with interrupt details and track
@@ -285,20 +286,20 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)* interrupt will be allocated with pci_msix_alloc_irq_at. * * Some callers may only support dynamically allocated interrupts. -* This is indicated with dyn_only flag. +* This is indicated with dyn_allowed flag. * * On failure, return map with negative .index. The caller * is expected to check returned map index. * */ -struct msi_map ice_alloc_irq (struct ice_pf *pf,bool dyn_only) +struct msi_map ice_alloc_irq (struct ice_pf *pf,bool dyn_allowed) {int sriov_base_vector = pf->sriov_base_vector;struct msi_map map = { .index = -ENOENT };struct device *dev =ice_pf_to_dev (pf);struct ice_irq_entry *entry; - entry =ice_get_irq_res (pf, dyn_only); + entry =ice_get_irq_res (pf, dyn_allowed);if (!entry)return map;
drivers/net/ethernet/intel/ice/ice_lib.c +2 -0
@@ -567,6 +567,8 @@ ice_vsi_alloc_def(struct ice_vsi *vsi, struct ice_channel *ch)return -ENOMEM ; } + vsi->irq_dyn_alloc =pci_msix_can_alloc_dyn (vsi->back->pdev); +switch (vsi->type) {case ICE_VSI_PF :case ICE_VSI_SF :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 557/642 rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit 83b28cfe796464ebbde1cf7916c126da6d572685 ]
With PREEMPT_RCU=n, cond_resched() provides urgently needed quiescent states for read-side critical sections via rcu_all_qs(). One reason why this was needed: lacking preempt-count, the tick handler has no way of knowing whether it is executing in a read-side critical section or not.
With (PREEMPT_LAZY=y, PREEMPT_DYNAMIC=n), we get (PREEMPT_COUNT=y, PREEMPT_RCU=n). In this configuration cond_resched() is a stub and does not provide quiescent states via rcu_all_qs(). (PREEMPT_RCU=y provides this information via rcu_read_unlock() and its nesting counter.)
So, use the availability of preempt_count() to report quiescent states in rcu_flavor_sched_clock_irq().
--- kernel/rcu/tree_plugin.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +7 -4
@@ -975,13 +975,16 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)*/ static void rcu_flavor_sched_clock_irq (int user) { -if (user ||rcu_is_cpu_rrupt_from_idle ()) { +if (user ||rcu_is_cpu_rrupt_from_idle () || + (IS_ENABLED (CONFIG_PREEMPT_COUNT ) && + (preempt_count () ==HARDIRQ_OFFSET ))) {/* * Get here if this CPU took its interrupt from user -* mode or from the idle loop, and if this is not a -* nested interrupt. In this case, the CPU is in -* a quiescent state, so note it. +* mode, from the idle loop without this being a nested +* interrupt, or while not holding the task preempt count +* (with PREEMPT_COUNT=y). In this case, the CPU is in a +* quiescent state, so note it. * * No memory barrier is required here because rcu_qs() * references only CPU-local variables that other CPUs
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 558/642 rcu: handle unstable rdp in rcu_read_unlock_strict()
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit fcf0e25ad4c8d14d2faab4d9a17040f31efce205 ]
rcu_read_unlock_strict() can be called with preemption enabled which can make for an unstable rdp and a racy norm value.
Fix this by dropping the preempt-count in __rcu_read_unlock() after the call to rcu_read_unlock_strict(), adjusting the preempt-count check appropriately.
--- include/linux/rcupdate.h | 2 +- kernel/rcu/tree_plugin.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
include/linux/rcupdate.h +1 -1
@@ -95,9 +95,9 @@ static inline void __rcu_read_lock(void)static inline void __rcu_read_unlock (void ) { -preempt_enable ();if (IS_ENABLED (CONFIG_RCU_STRICT_GRACE_PERIOD ))rcu_read_unlock_strict (); +preempt_enable (); }static inline int rcu_preempt_depth (void )
kernel/rcu/tree_plugin.h +10 -1
@@ -833,8 +833,17 @@ void rcu_read_unlock_strict(void) {struct rcu_data *rdp; -if (irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread) +if (irqs_disabled () ||in_atomic_preempt_off () || !rcu_state.gp_kthread)return ; + +/* +* rcu_report_qs_rdp() can only be invoked with a stable rdp and +* from the local CPU. +* +* The in_atomic_preempt_off() check ensures that we come here holding +* the last preempt_count (which will get dropped once we return to +* __rcu_read_unlock(). +*/ rdp =this_cpu_ptr (&rcu_data); rdp->cpu_no_qs.b.norm = false;rcu_report_qs_rdp (rdp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 559/642 rcu: fix header guard for rcu_all_qs()
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit ad6b5b73ff565e88aca7a7d1286788d80c97ba71 ]
rcu_all_qs() is defined for !CONFIG_PREEMPT_RCU but the declaration is conditioned on CONFIG_PREEMPTION.
With CONFIG_PREEMPT_LAZY, CONFIG_PREEMPTION=y does not imply CONFIG_PREEMPT_RCU=y.
Decouple the two.
--- include/linux/rcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcutree.h +1 -1
@@ -103,7 +103,7 @@ extern int rcu_scheduler_active;void rcu_end_inkernel_boot (void );bool rcu_inkernel_boot_has_ended (void );bool rcu_is_watching (void ); -#ifndef CONFIG_PREEMPTION +#ifndef CONFIG_PREEMPT_RCU void rcu_all_qs (void );#endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 560/642 perf: Avoid the read if the count is already updated
In reply to Sasha LevinFrom: "Peter Zijlstra (Intel)" <[email protected]>
[ Upstream commit 8ce939a0fa194939cc1f92dbd8bc1a7806e7d40a ]
The event may have been updated in the PMU-specific implementation, e.g., Intel PEBS counters snapshotting. The common code should not read and overwrite the value.
The PERF_SAMPLE_READ in the data->sample_type can be used to detect whether the PMU-specific value is available. If yes, avoid the pmu->read() in the common code. Add a new flag, skip_read, to track the case.
Factor out a perf_pmu_read() to clean up the code.
--- include/linux/perf_event.h | 8 +++++++- kernel/events/core.c | 33 ++++++++++++++++----------------- kernel/events/ring_buffer.c | 1 + 3 files changed, 24 insertions(+), 18 deletions(-)
include/linux/perf_event.h +7 -1
@@ -1098,7 +1098,13 @@ struct perf_output_handle {struct perf_buffer *rb;unsigned long wakeup;unsigned long size; -u64 aux_flags; +union { +u64 flags;/* perf_output*() */ +u64 aux_flags;/* perf_aux_output*() */ +struct { +u64 skip_read :1 ; + }; + };union {void *addr;unsigned long head;
kernel/events/core.c +16 -17
@@ -1191,6 +1191,12 @@ static void perf_assert_pmu_disabled(struct pmu *pmu)WARN_ON_ONCE (*this_cpu_ptr (pmu->pmu_disable_count) ==0 ); } +static inline void perf_pmu_read (struct perf_event *event) +{ +if (event->state ==PERF_EVENT_STATE_ACTIVE ) + event->pmu->read (event); +} +static void get_ctx (struct perf_event_context *ctx) {refcount_inc (&ctx->refcount);
@@ -3478,8 +3484,7 @@ static void __perf_event_sync_stat(struct perf_event *event,* we know the event must be on the current CPU, therefore we * don't need to use it. */ -if (event->state ==PERF_EVENT_STATE_ACTIVE ) - event->pmu->read (event); +perf_pmu_read (event);perf_event_update_time (event);
@@ -4625,15 +4630,8 @@ static void __perf_event_read(void *info) pmu->read (event); -for_each_sibling_event (sub, event) { -if (sub->state ==PERF_EVENT_STATE_ACTIVE ) { -/* -* Use sibling's PMU rather than @event's since -* sibling could be on different (eg: software) PMU. -*/ - sub->pmu->read (sub); - } - } +for_each_sibling_event (sub, event) +perf_pmu_read (sub); data->ret = pmu->commit_txn (pmu);
@@ -7451,9 +7449,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; -if ((leader != event) && - (leader->state ==PERF_EVENT_STATE_ACTIVE )) - leader->pmu->read (leader); +if ((leader != event) && !handle->skip_read) +perf_pmu_read (leader); values[n++] =perf_event_count (leader, self);if (read_format &PERF_FORMAT_ID )
@@ -7466,9 +7463,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,for_each_sibling_event (sub, leader) { n =0 ; -if ((sub != event) && - (sub->state ==PERF_EVENT_STATE_ACTIVE )) - sub->pmu->read (sub); +if ((sub != event) && !handle->skip_read) +perf_pmu_read (sub); values[n++] =perf_event_count (sub, self);if (read_format &PERF_FORMAT_ID )
@@ -7527,6 +7523,9 @@ void perf_output_sample(struct perf_output_handle *handle, {u64 sample_type = data->type; +if (data->sample_flags &PERF_SAMPLE_READ ) + handle->skip_read =1 ; +perf_output_put (handle, *header);if (sample_type &PERF_SAMPLE_IDENTIFIER )
kernel/events/ring_buffer.c +1 -0
@@ -185,6 +185,7 @@ __perf_output_begin(struct perf_output_handle *handle, handle->rb = rb; handle->event = event; + handle->flags =0 ; have_lost =local_read (&rb->lost);if (unlikely (have_lost)) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 561/642 ice: count combined queues using Rx/Tx count
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit c3a392bdd31adc474f1009ee85c13fdd01fe800d ]
Previous implementation assumes that there is 1:1 matching between vectors and queues. It isn't always true.
Get minimum value from Rx/Tx queues to determine combined queues number.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -2
@@ -3817,8 +3817,7 @@ static u32 ice_get_combined_cnt(struct ice_vsi *vsi)ice_for_each_q_vector (vsi, q_idx) {struct ice_q_vector *q_vector = vsi->q_vectors[q_idx]; -if (q_vector->rx.rx_ring && q_vector->tx.tx_ring) - combined++; + combined +=min (q_vector->num_ring_tx, q_vector->num_ring_rx); }return combined;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 562/642 drm/xe/relay: Don't use GFP_KERNEL for new transactions
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit 78d5d1e20d1de9422f013338a0f2311448588ba7 ]
VFs use a relay transaction during the resume/reset flow and use of the GFP_KERNEL flag may conflict with the reclaim:
-> #0 (fs_reclaim){+.+.}-{0:0}:
[ ] __lock_acquire+0x1874/0x2bc0
[ ] lock_acquire+0xd2/0x310
[ ] fs_reclaim_acquire+0xc5/0x100
[ ] mempool_alloc_noprof+0x5c/0x1b0
[ ] __relay_get_transaction+0xdc/0xa10 [xe]
[ ] relay_send_to+0x251/0xe50 [xe]
[ ] xe_guc_relay_send_to_pf+0x79/0x3a0 [xe]
[ ] xe_gt_sriov_vf_connect+0x90/0x4d0 [xe]
[ ] xe_uc_init_hw+0x157/0x3b0 [xe]
[ ] do_gt_restart+0x1ae/0x650 [xe]
[ ] xe_gt_resume+0xb6/0x120 [xe]
[ ] xe_pm_runtime_resume+0x15b/0x370 [xe]
[ ] xe_pci_runtime_resume+0x73/0x90 [xe]
[ ] pci_pm_runtime_resume+0xa0/0x100
[ ] __rpm_callback+0x4d/0x170
[ ] rpm_callback+0x64/0x70
[ ] rpm_resume+0x594/0x790
[ ] __pm_runtime_resume+0x4e/0x90
[ ] xe_pm_runtime_get_ioctl+0x9c/0x160 [xe]Since we have a preallocated pool of relay transactions, which should cover all our normal relay use cases, we may use the GFP_NOWAIT flag when allocating new outgoing transactions.
--- drivers/gpu/drm/xe/xe_guc_relay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_guc_relay.c +1 -1
@@ -225,7 +225,7 @@ __relay_get_transaction(struct xe_guc_relay *relay, bool incoming, u32 remote, u* with CTB lock held which is marked as used in the reclaim path. * Btw, that's one of the reason why we use mempool here! */ - txn =mempool_alloc (&relay->pool, incoming ?GFP_ATOMIC :GFP_KERNEL ); + txn =mempool_alloc (&relay->pool, incoming ?GFP_ATOMIC :GFP_NOWAIT );if (!txn)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 563/642 net/mana: fix warning in the writer of client oob
In reply to Sasha LevinFrom: Konstantin Taranov <[email protected]>
[ Upstream commit 5ec7e1c86c441c46a374577bccd9488abea30037 ]
Do not warn on missing pad_data when oob is in sgl.
--- drivers/net/ethernet/microsoft/mana/gdma_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microsoft/mana/gdma_main.c +1 -1
@@ -1047,7 +1047,7 @@ static u32 mana_gd_write_client_oob(const struct gdma_wqe_request *wqe_req, header->inline_oob_size_div4 = client_oob_size /sizeof (u32);if (oob_in_sgl) { -WARN_ON_ONCE (!pad_data || wqe_req->num_sge <2 ); +WARN_ON_ONCE (wqe_req->num_sge <2 ); header->client_oob_in_sgl =1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 564/642 scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit 56c3d809b7b450379162d0b8a70bbe71ab8db706 ]
After a port swap between separate fabrics, there may be multiple nodes in the vport's fc_nodes list with the same fabric well known address. Duplication is temporary and eventually resolves itself after dev_loss_tmo expires, but nameserver queries may still occur before dev_loss_tmo. This possibly results in returning stale fabric ndlp objects. Fix by adding an nlp_state check to ensure the ndlp search routine returns the correct newer allocated ndlp fabric object.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -5
@@ -5564,6 +5564,7 @@ static struct lpfc_nodelist * __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) {struct lpfc_nodelist *ndlp; +struct lpfc_nodelist *np =NULL ;uint32_t data1;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {
@@ -5578,14 +5579,20 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) ndlp, ndlp->nlp_DID, ndlp->nlp_flag, data1, ndlp->nlp_rpi, ndlp->active_rrqs_xri_bitmap); -return ndlp; + +/* Check for new or potentially stale node */ +if (ndlp->nlp_state !=NLP_STE_UNUSED_NODE ) +return ndlp; + np = ndlp; } } -/* FIND node did <did> NOT FOUND */ -lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , -"0932 FIND node did x%x NOT FOUND.\n" , did); -return NULL ; +if (!np) +/* FIND node did <did> NOT FOUND */ +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , +"0932 FIND node did x%x NOT FOUND.\n" , did); + +return np; } struct lpfc_nodelist *
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 565/642 scsi: lpfc: Ignore ndlp rport mismatch in dev_loss_tmo callbk
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit 23ed62897746f49f195d819ce6edeb1db27d1b72 ]
With repeated port swaps between separate fabrics, there can be multiple registrations for fabric well known address 0xfffffe. This can cause ndlp reference confusion due to the usage of a single ndlp ptr that stores the rport object in fc_rport struct private storage during transport registration. Subsequent registrations update the ndlp->rport field with the newer rport, so when transport layer triggers dev_loss_tmo for the earlier registered rport the ndlp->rport private storage is referencing the newer rport instead of the older rport in dev_loss_tmo callbk.
Because the older ndlp->rport object is already cleaned up elsewhere in driver code during the time of fabric swap, check that the rport provided in dev_loss_tmo callbk actually matches the rport stored in the LLDD's ndlp->rport field. Otherwise, skip dev_loss_tmo work on a stale rport.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +9 -3
@@ -228,10 +228,16 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)if (ndlp->nlp_state ==NLP_STE_MAPPED_NODE )return ; -/* check for recovered fabric node */ -if (ndlp->nlp_state ==NLP_STE_UNMAPPED_NODE && - ndlp->nlp_DID == Fabric_DID) +/* Ignore callback for a mismatched (stale) rport */ +if (ndlp->rport != rport) { +lpfc_vlog_msg (vport,KERN_WARNING ,LOG_NODE , +"6788 fc rport mismatch: d_id x%06x ndlp x%px " +"fc rport x%px node rport x%px state x%x " +"refcnt %u\n" , + ndlp->nlp_DID, ndlp, rport, ndlp->rport, + ndlp->nlp_state,kref_read (&ndlp->kref));return ; + }if (rport->port_name !=wwn_to_u64 (ndlp->nlp_portname.u.wwn)) lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 566/642 scsi: lpfc: Free phba irq in lpfc_sli4_enable_msi() when pci_irq_vector() fails
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit f0842902b383982d1f72c490996aa8fc29a7aa0d ]
Fix smatch warning regarding missed calls to free_irq(). Free the phba IRQ in the failed pci_irq_vector cases.
lpfc_init.c: lpfc_sli4_enable_msi() warn: 'phba->pcidev->irq' from
request_irq() not released.
--- drivers/scsi/lpfc/lpfc_init.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_init.c +2 -0
@@ -13170,6 +13170,7 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba) eqhdl =lpfc_get_eq_hdl (0 ); rc =pci_irq_vector (phba->pcidev,0 );if (rc <0 ) { +free_irq (phba->pcidev->irq, phba);pci_free_irq_vectors (phba->pcidev);lpfc_printf_log (phba,KERN_WARNING ,LOG_INIT ,"0496 MSI pci_irq_vec failed (%d)\n" , rc);
@@ -13250,6 +13251,7 @@ lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) eqhdl =lpfc_get_eq_hdl (0 ); retval =pci_irq_vector (phba->pcidev,0 );if (retval <0 ) { +free_irq (phba->pcidev->irq, phba);lpfc_printf_log (phba,KERN_WARNING ,LOG_INIT ,"0502 INTR pci_irq_vec failed (%d)\n" , retval);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 567/642 scsi: lpfc: Reduce log message generation during ELS ring clean up
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit 8eccc58d71eafbd2635077916b68fda15791d270 ]
A clean up log message is output from lpfc_els_flush_cmd() for each outstanding ELS I/O and repeated for every NPIV instance. The log message should only be generated for active I/Os matching the NPIV vport. Thus, move the vport check to before logging the message.
--- drivers/scsi/lpfc/lpfc_els.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +4 -6
@@ -9569,18 +9569,16 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) mbx_tmo_err =test_bit (MBX_TMO_ERR , &phba->bit_flags);/* First we need to issue aborts to outstanding cmds on txcmpl */ list_for_each_entry_safe (piocb, tmp_iocb, &pring->txcmplq, list) { +if (piocb->vport != vport) +continue ; +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS ,"2243 iotag = 0x%x cmd_flag = 0x%x " -"ulp_command = 0x%x this_vport %x " -"sli_flag = 0x%x\n" , +"ulp_command = 0x%x sli_flag = 0x%x\n" , piocb->iotag, piocb->cmd_flag,get_job_cmnd (phba, piocb), - (piocb->vport == vport), phba->sli.sli_flag); -if (piocb->vport != vport) -continue ; -if ((phba->sli.sli_flag &LPFC_SLI_ACTIVE ) && !mbx_tmo_err) {if (piocb->cmd_flag &LPFC_IO_LIBDFC )continue ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 568/642 scsi: st: Restore some drive settings after reset
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit 7081dc75df79696d8322d01821c28e53416c932c ]
Some of the allowed operations put the tape into a known position to continue operation assuming only the tape position has changed. But reset sets partition, density and block size to drive default values. These should be restored to the values before reset.
Normally the current block size and density are stored by the drive. If the settings have been changed, the changed values have to be saved by the driver across reset.
--- drivers/scsi/st.c | 24 +++++++++++++++++++++--- drivers/scsi/st.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-)
drivers/scsi/st.c +21 -3
@@ -952,7 +952,6 @@ static void reset_state(struct scsi_tape *STp) STp->partition =find_partition (STp);if (STp->partition <0 ) STp->partition =0 ; - STp->new_partition = STp->partition; } }
@@ -2929,14 +2928,17 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lonif (cmd_in ==MTSETDENSITY ) { (STp->buffer)->b_data[4 ] = arg; STp->density_changed =1 ;/* At least we tried ;-) */ + STp->changed_density = arg; }else if (cmd_in ==SET_DENS_AND_BLK ) (STp->buffer)->b_data[4 ] = arg >>24 ;else (STp->buffer)->b_data[4 ] = STp->density;if (cmd_in ==MTSETBLK || cmd_in ==SET_DENS_AND_BLK ) { ltmp = arg &MT_ST_BLKSIZE_MASK ; -if (cmd_in ==MTSETBLK ) +if (cmd_in ==MTSETBLK ) { STp->blksize_changed =1 ;/* At least we tried ;-) */ + STp->changed_blksize = arg; + } }else ltmp = STp->block_size; (STp->buffer)->b_data[9 ] = (ltmp >>16 );
@@ -3637,9 +3639,25 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) retval = (-EIO ); goto out; } -reset_state (STp); +reset_state (STp);/* Clears pos_unknown */ /* remove this when the midlevel properly clears was_reset */ STp->device->was_reset =0 ; + +/* Fix the device settings after reset, ignore errors */ +if (mtc.mt_op ==MTREW || mtc.mt_op ==MTSEEK || + mtc.mt_op ==MTEOM ) { +if (STp->can_partitions) { +/* STp->new_partition contains the +* latest partition set +*/ + STp->partition =0 ; +switch_partition (STp); + } +if (STp->density_changed) +st_int_ioctl (STp,MTSETDENSITY , STp->changed_density); +if (STp->blksize_changed) +st_int_ioctl (STp,MTSETBLK , STp->changed_blksize); + } } if (mtc.mt_op != MTNOP && mtc.mt_op != MTSETBLK &&
drivers/scsi/st.h +2 -0
@@ -165,6 +165,7 @@ struct scsi_tape {unsigned char compression_changed;unsigned char drv_buffer;unsigned char density; +unsigned char changed_density;unsigned char door_locked;unsigned char autorew_dev;/* auto-rewind device */ unsigned char rew_at_close;/* rewind necessary at close */
@@ -172,6 +173,7 @@ struct scsi_tape {unsigned char cleaning_req;/* cleaning requested? */ unsigned char first_tur;/* first TEST UNIT READY */ int block_size; +int changed_blksize;int min_block;int max_block;int recover_count;/* From tape opening */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 569/642 wifi: ath12k: Avoid napi_sync() before napi_enable()
In reply to Sasha LevinFrom: Avula Sri Charan <[email protected]>
[ Upstream commit 268c73d470a5790a492a2fc2ded084b909d144f3 ]
In case of MHI error a reset work will be queued which will try napi_disable() after napi_synchronize().
As the napi will be only enabled after qmi_firmware_ready event, trying napi_synchronize() before napi_enable() will result in indefinite sleep in case of a firmware crash in QMI init sequence.
To avoid this, introduce napi_enabled flag to check if napi is enabled or not before calling napi_synchronize().
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/core.h | 1 + drivers/net/wireless/ath/ath12k/pci.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +1 -0
@@ -166,6 +166,7 @@ struct ath12k_ext_irq_grp {u32 num_irq;u32 grp_id;u64 timestamp; +bool napi_enabled;struct napi_struct napi;struct net_device *napi_ndev; };
drivers/net/wireless/ath/ath12k/pci.c +10 -3
@@ -483,8 +483,11 @@ static void __ath12k_pci_ext_irq_disable(struct ath12k_base *ab)ath12k_pci_ext_grp_disable (irq_grp); -napi_synchronize (&irq_grp->napi); -napi_disable (&irq_grp->napi); +if (irq_grp->napi_enabled) { +napi_synchronize (&irq_grp->napi); +napi_disable (&irq_grp->napi); + irq_grp->napi_enabled = false; + } } }
@@ -1114,7 +1117,11 @@ void ath12k_pci_ext_irq_enable(struct ath12k_base *ab)for (i =0 ; i <ATH12K_EXT_IRQ_GRP_NUM_MAX ; i++) {struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; -napi_enable (&irq_grp->napi); +if (!irq_grp->napi_enabled) { +napi_enable (&irq_grp->napi); + irq_grp->napi_enabled = true; + } +ath12k_pci_ext_grp_enable (irq_grp); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 570/642 HID: usbkbd: Fix the bit shift number for LED_KANA
In reply to Sasha LevinFrom: junan <[email protected]>
[ Upstream commit d73a4bfa2881a6859b384b75a414c33d4898b055 ]
Since "LED_KANA" was defined as "0x04", the shift number should be "4".
--- drivers/hid/usbhid/usbkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/usbkbd.c +1 -1
@@ -160,7 +160,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type,return -1 ;spin_lock_irqsave (&kbd->leds_lock, flags); - kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<3 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | + kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<4 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | (!!test_bit (LED_SCROLLL , dev->led) <<2 ) | (!!test_bit (LED_CAPSL , dev->led) <<1 ) | (!!test_bit (LED_NUML , dev->led));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 571/642 arm64: zynqmp: add clock-output-names property in clock nodes
In reply to Sasha LevinFrom: Naman Trivedi <[email protected]>
[ Upstream commit 385a59e7f7fb3438466a0712cc14672c708bbd57 ]
Add clock-output-names property to clock nodes, so that the resulting clock name do not change when clock node name is changed. Also, replace underscores with hyphens in the clock node names as per dt-schema rule.
--- arch/arm64/boot/dts/xilinx/zynqmp-clk-ccf.dtsi | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp-clk-ccf.dtsi +10 -5
@@ -10,39 +10,44 @@ #include <dt-bindings/clock/xlnx-zynqmp-clk.h> / { - pss_ref_clk: pss_ref_clk { + pss_ref_clk: pss-ref-clk { bootph-all; compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <33333333>; + clock-output-names = "pss_ref_clk"; }; - video_clk: video_clk { + video_clk: video-clk { bootph-all; compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <27000000>; + clock-output-names = "video_clk"; }; - pss_alt_ref_clk: pss_alt_ref_clk { + pss_alt_ref_clk: pss-alt-ref-clk { bootph-all; compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <0>; + clock-output-names = "pss_alt_ref_clk"; }; - gt_crx_ref_clk: gt_crx_ref_clk { + gt_crx_ref_clk: gt-crx-ref-clk { bootph-all; compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <108000000>; + clock-output-names = "gt_crx_ref_clk"; }; - aux_ref_clk: aux_ref_clk { + aux_ref_clk: aux-ref-clk { bootph-all; compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <27000000>; + clock-output-names = "aux_ref_clk"; }; };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 572/642 ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode
In reply to Sasha LevinFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 7d92a38d67e5d937b64b20aa4fd14451ee1772f3 ]
As per codec device specification, 24-bit is allowed in provider mode. Update the code to reflect that.
--- sound/soc/codecs/pcm3168a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/pcm3168a.c +3 -3
@@ -493,9 +493,9 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, }break ;case 24 : -if (provider_mode || (format ==SND_SOC_DAIFMT_DSP_A ) || - (format ==SND_SOC_DAIFMT_DSP_B )) { -dev_err (component->dev,"24-bit slots not supported in provider mode, or consumer mode using DSP\n" ); +if (!provider_mode && ((format ==SND_SOC_DAIFMT_DSP_A ) || + (format ==SND_SOC_DAIFMT_DSP_B ))) { +dev_err (component->dev,"24-bit slots not supported in consumer mode using DSP\n" );return -EINVAL ; }break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 573/642 ASoC: soc-core: Stop using of_property_read_bool() for non-boolean properties
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 6eab7034579917f207ca6d8e3f4e11e85e0ab7d5 ]
On R-Car:
OF: /sound: Read of boolean property 'simple-audio-card,bitclock-master' with a value.
OF: /sound: Read of boolean property 'simple-audio-card,frame-master' with a value.
or:
OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'bitclock-master' with a value.
OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'frame-master' with a value.
The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.
Replace testing for presence before calling of_property_read_u32() by testing for an -EINVAL return value from the latter, to simplify the code.
--- sound/soc/soc-core.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
sound/soc/soc-core.c +13 -19
@@ -3046,7 +3046,7 @@ int snd_soc_of_parse_pin_switches(struct snd_soc_card *card, const char *prop)unsigned int i, nb_controls;int ret; -if (!of_property_read_bool (dev->of_node, prop)) +if (!of_property_present (dev->of_node, prop))return 0 ; strings = devm_kcalloc(dev, nb_controls_max,
@@ -3120,23 +3120,17 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,if (rx_mask)snd_soc_of_get_slot_mask (np,"dai-tdm-slot-rx-mask" , rx_mask); -if (of_property_read_bool (np,"dai-tdm-slot-num" )) { - ret =of_property_read_u32 (np,"dai-tdm-slot-num" , &val); -if (ret) -return ret; - -if (slots) - *slots = val; - } - -if (of_property_read_bool (np,"dai-tdm-slot-width" )) { - ret =of_property_read_u32 (np,"dai-tdm-slot-width" , &val); -if (ret) -return ret; + ret =of_property_read_u32 (np,"dai-tdm-slot-num" , &val); +if (ret && ret != -EINVAL ) +return ret; +if (!ret && slots) + *slots = val; -if (slot_width) - *slot_width = val; - } + ret =of_property_read_u32 (np,"dai-tdm-slot-width" , &val); +if (ret && ret != -EINVAL ) +return ret; +if (!ret && slot_width) + *slot_width = val;return 0 ; }
@@ -3403,12 +3397,12 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np,* check "[prefix]frame-master" */ snprintf (prop,sizeof (prop),"%sbitclock-master" , prefix); - bit =of_property_read_bool (np, prop); + bit =of_property_present (np, prop);if (bit && bitclkmaster) *bitclkmaster =of_parse_phandle (np, prop,0 );snprintf (prop,sizeof (prop),"%sframe-master" , prefix); - frame =of_property_read_bool (np, prop); + frame =of_property_present (np, prop);if (frame && framemaster) *framemaster =of_parse_phandle (np, prop,0 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 574/642 ASoC: rt722-sdca: Add some missing readable registers
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit f9a5c4b6afc79073491acdab7f1e943ee3a19fbb ]
Add a few missing registers from the readable register callback.
--- sound/soc/codecs/rt722-sdca-sdw.c | 49 +++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-)
sound/soc/codecs/rt722-sdca-sdw.c +46 -3
@@ -28,9 +28,50 @@ static bool rt722_sdca_readable_register(struct device *dev, unsigned int reg) 0):case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_GE49 ,RT722_SDCA_CTL_DETECTED_MODE ,0 ): -case SDW_SDCA_CTL (FUNC_NUM_HID ,RT722_SDCA_ENT_HID01 ,RT722_SDCA_CTL_HIDTX_CURRENT_OWNER , - 0) ... SDW_SDCA_CTL(FUNC_NUM_HID, RT722_SDCA_ENT_HID01, -RT722_SDCA_CTL_HIDTX_MESSAGE_LENGTH ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_XU03 ,RT722_SDCA_CTL_SELECTED_MODE , +0 ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_USER_FU05 , + RT722_SDCA_CTL_FU_MUTE, CH_L) ... +SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_USER_FU05 , +RT722_SDCA_CTL_FU_MUTE ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_XU0D , +RT722_SDCA_CTL_SELECTED_MODE ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_USER_FU0F , + RT722_SDCA_CTL_FU_MUTE, CH_L) ... +SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_USER_FU0F , +RT722_SDCA_CTL_FU_MUTE ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_PDE40 , +RT722_SDCA_CTL_REQ_POWER_STATE ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_PDE12 , +RT722_SDCA_CTL_REQ_POWER_STATE ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_CS01 , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_CS11 , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT722_SDCA_ENT_USER_FU1E , + RT722_SDCA_CTL_FU_MUTE, CH_01) ... +SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT722_SDCA_ENT_USER_FU1E , +RT722_SDCA_CTL_FU_MUTE ,CH_04 ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT722_SDCA_ENT_IT26 , +RT722_SDCA_CTL_VENDOR_DEF ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT722_SDCA_ENT_PDE2A , +RT722_SDCA_CTL_REQ_POWER_STATE ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT722_SDCA_ENT_CS1F , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_HID ,RT722_SDCA_ENT_HID01 , + RT722_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... +SDW_SDCA_CTL (FUNC_NUM_HID ,RT722_SDCA_ENT_HID01 , +RT722_SDCA_CTL_HIDTX_MESSAGE_LENGTH ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_USER_FU06 , + RT722_SDCA_CTL_FU_MUTE, CH_L) ... +SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_USER_FU06 , +RT722_SDCA_CTL_FU_MUTE ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_OT23 , +RT722_SDCA_CTL_VENDOR_DEF ,CH_08 ): +case SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_PDE23 , +RT722_SDCA_CTL_REQ_POWER_STATE ,0 ): +case SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_CS31 , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ): case RT722_BUF_ADDR_HID1 ... RT722_BUF_ADDR_HID2:return true;default :
@@ -74,6 +115,7 @@ static bool rt722_sdca_mbq_readable_register(struct device *dev, unsigned int re case 0x5600000 ... 0x5600007: case 0x5700000 ... 0x5700004: case 0x5800000 ... 0x5800004: +case 0x5810000 :case 0x5b00003 :case 0x5c00011 :case 0x5d00006 :
@@ -81,6 +123,7 @@ static bool rt722_sdca_mbq_readable_register(struct device *dev, unsigned int recase 0x5f00030 : case 0x6100000 ... 0x6100051: case 0x6100055 ... 0x6100057: +case 0x6100060 :case 0x6100062 : case 0x6100064 ... 0x6100065:case 0x6100067 :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 575/642 irqchip/riscv-aplic: Add support for hart indexes
In reply to Sasha LevinFrom: Vladimir Kondratiev <[email protected]>
[ Upstream commit b93afe8a3ac53ae52296d65acfaa9c5f582a48cc ]
RISC-V APLIC specification defines "hart index" in:
https://github.com/riscv/riscv-aia
Within a given interrupt domain, each of the domain’s harts has a unique index number in the range 0 to 2^14 − 1 (= 16,383). The index number a domain associates with a hart may or may not have any relationship to the unique hart identifier (“hart ID”) that the RISC-V Privileged Architecture assigns to the hart. Two different interrupt domains may employ entirely different index numbers for the same set of harts.
Further, this document says in "4.5 Memory-mapped control region for an interrupt domain":
The array of IDC structures may include some for potential hart index numbers that are not actual hart index numbers in the domain. For example, the first IDC structure is always for hart index 0, but 0 is not necessarily a valid index number for any hart in the domain.
Support arbitrary hart indices specified in an optional APLIC property "riscv,hart-indexes" which is specified as an array of u32 elements, one per interrupt target. If this property is not specified, fallback to use logical hart indices within the domain.
--- drivers/irqchip/irq-riscv-aplic-direct.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-aplic-direct.c +21 -3
@@ -31,7 +31,7 @@ struct aplic_direct { };struct aplic_idc { -unsigned int hart_index; +u32 hart_index;void __iomem *regs;struct aplic_direct *direct; };
@@ -219,6 +219,20 @@ static int aplic_direct_parse_parent_hwirq(struct device *dev, u32 index,return 0 ; } +static int aplic_direct_get_hart_index (struct device *dev,u32 logical_index, +u32 *hart_index) +{ +const char *prop_hart_index ="riscv,hart-indexes" ; +struct device_node *np =to_of_node (dev->fwnode); + +if (!np || !of_property_present (np, prop_hart_index)) { + *hart_index = logical_index; +return 0 ; + } + +return of_property_read_u32_index (np, prop_hart_index, logical_index, hart_index); +} +int aplic_direct_setup (struct device *dev,void __iomem *regs) {int i, j, rc, cpu, current_cpu, setup_count =0 ;
@@ -265,8 +279,12 @@ int aplic_direct_setup(struct device *dev, void __iomem *regs)cpumask_set_cpu (cpu, &direct->lmask); idc =per_cpu_ptr (&aplic_idcs, cpu); - idc->hart_index = i; - idc->regs = priv->regs +APLIC_IDC_BASE + i *APLIC_IDC_SIZE ; + rc =aplic_direct_get_hart_index (dev, i, &idc->hart_index); +if (rc) { +dev_warn (dev,"hart index not found for IDC%d\n" , i); +continue ; + } + idc->regs = priv->regs +APLIC_IDC_BASE + idc->hart_index *APLIC_IDC_SIZE ; idc->direct = direct;aplic_idc_set_delivery (idc, true);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 576/642 dm vdo vio-pool: allow variable-sized metadata vios
In reply to Sasha LevinFrom: Ken Raeburn <[email protected]>
[ Upstream commit f979da512553a41a657f2c1198277e84d66f8ce3 ]
With larger-sized metadata vio pools, vdo will sometimes need to issue I/O with a smaller size than the allocated size. Since vio_reset_bio is where the bvec array and I/O size are initialized, this reset interface must now specify what I/O size to use.
--- drivers/md/dm-vdo/io-submitter.c | 6 ++++-- drivers/md/dm-vdo/io-submitter.h | 18 +++++++++++++--- drivers/md/dm-vdo/types.h | 3 +++ drivers/md/dm-vdo/vio.c | 36 +++++++++++++++++++------------- drivers/md/dm-vdo/vio.h | 2 ++ 5 files changed, 46 insertions(+), 19 deletions(-)
drivers/md/dm-vdo/io-submitter.c +4 -2
@@ -327,6 +327,7 @@ void vdo_submit_data_vio(struct data_vio *data_vio)* @error_handler: the handler for submission or I/O errors (may be NULL) * @operation: the type of I/O to perform * @data: the buffer to read or write (may be NULL) +* @size: the I/O amount in bytes * * The vio is enqueued on a vdo bio queue so that bio submission (which may block) does not block * other vdo threads.
@@ -338,7 +339,7 @@ void vdo_submit_data_vio(struct data_vio *data_vio)*/ void __submit_metadata_vio (struct vio *vio,physical_block_number_t physical,bio_end_io_t callback,vdo_action_fn error_handler, -blk_opf_t operation,char *data) +blk_opf_t operation,char *data,int size) {int result;struct vdo_completion *completion = &vio->completion;
@@ -349,7 +350,8 @@ void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical,vdo_reset_completion (completion); completion->error_handler = error_handler; - result =vio_reset_bio (vio, data, callback, operation |REQ_META , physical); + result =vio_reset_bio_with_size (vio, data, size, callback, operation |REQ_META , + physical);if (result !=VDO_SUCCESS ) {continue_vio (vio, result);return ;
drivers/md/dm-vdo/io-submitter.h +15 -3
@@ -8,6 +8,7 @@#include <linux/bio.h> +#include "constants.h" #include "types.h" struct io_submitter ;
@@ -26,14 +27,25 @@ void vdo_submit_data_vio(struct data_vio *data_vio);void __submit_metadata_vio (struct vio *vio,physical_block_number_t physical,bio_end_io_t callback,vdo_action_fn error_handler, -blk_opf_t operation,char *data); +blk_opf_t operation,char *data,int size);static inline void vdo_submit_metadata_vio (struct vio *vio,physical_block_number_t physical,bio_end_io_t callback,vdo_action_fn error_handler,blk_opf_t operation) {__submit_metadata_vio (vio, physical, callback, error_handler, - operation, vio->data); + operation, vio->data, vio->block_count *VDO_BLOCK_SIZE ); +} + +static inline void vdo_submit_metadata_vio_with_size (struct vio *vio, +physical_block_number_t physical, +bio_end_io_t callback, +vdo_action_fn error_handler, +blk_opf_t operation, +int size) +{ +__submit_metadata_vio (vio, physical, callback, error_handler, + operation, vio->data, size); } static inline void vdo_submit_flush_vio(struct vio *vio, bio_end_io_t callback,
@@ -41,7 +53,7 @@ static inline void vdo_submit_flush_vio(struct vio *vio, bio_end_io_t callback, {/* FIXME: Can we just use REQ_OP_FLUSH? */ __submit_metadata_vio (vio,0 , callback, error_handler, -REQ_OP_WRITE |REQ_PREFLUSH ,NULL ); +REQ_OP_WRITE |REQ_PREFLUSH ,NULL ,0 ); }#endif /* VDO_IO_SUBMITTER_H */
drivers/md/dm-vdo/types.h +3 -0
@@ -376,6 +376,9 @@ struct vio {/* The size of this vio in blocks */ unsigned int block_count; +/* The amount of data to be read or written, in bytes */ +unsigned int io_size; +/* The data being read or written. */ char *data;
drivers/md/dm-vdo/vio.c +22 -14
@@ -188,14 +188,23 @@ void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callb/* * Prepares the bio to perform IO with the specified buffer. May only be used on a VDO-allocated -* bio, as it assumes the bio wraps a 4k buffer that is 4k aligned, but there does not have to be a -* vio associated with the bio. +* bio, as it assumes the bio wraps a 4k-multiple buffer that is 4k aligned, but there does not +* have to be a vio associated with the bio. */ int vio_reset_bio (struct vio *vio,char *data,bio_end_io_t callback,blk_opf_t bi_opf,physical_block_number_t pbn) { -int bvec_count, offset, len, i; +return vio_reset_bio_with_size (vio, data, vio->block_count *VDO_BLOCK_SIZE , + callback, bi_opf, pbn); +} + +int vio_reset_bio_with_size (struct vio *vio,char *data,int size,bio_end_io_t callback, +blk_opf_t bi_opf,physical_block_number_t pbn) +{ +int bvec_count, offset, i;struct bio *bio = vio->bio; +int vio_size = vio->block_count *VDO_BLOCK_SIZE ; +int remaining;bio_reset (bio, bio->bi_bdev, bi_opf);vdo_set_bio_properties (bio, vio, callback, bi_opf, pbn);
@@ -205,22 +214,21 @@ int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback, bio->bi_ioprio =0 ; bio->bi_io_vec = bio->bi_inline_vecs; bio->bi_max_vecs = vio->block_count +1 ; - len =VDO_BLOCK_SIZE * vio->block_count; +if (VDO_ASSERT (size <= vio_size,"specified size %d is not greater than allocated %d" , + size, vio_size) !=VDO_SUCCESS ) + size = vio_size; + vio->io_size = size; offset =offset_in_page (data); - bvec_count =DIV_ROUND_UP (offset + len,PAGE_SIZE ); + bvec_count =DIV_ROUND_UP (offset + size,PAGE_SIZE ); + remaining = size; -/* -* If we knew that data was always on one page, or contiguous pages, we wouldn't need the -* loop. But if we're using vmalloc, it's not impossible that the data is in different -* pages that can't be merged in bio_add_page... -*/ -for (i =0 ; (i < bvec_count) && (len >0 ); i++) { +for (i =0 ; (i < bvec_count) && (remaining >0 ); i++) {struct page *page;int bytes_added;int bytes =PAGE_SIZE - offset; -if (bytes > len) - bytes = len; +if (bytes > remaining) + bytes = remaining; page =is_vmalloc_addr (data) ?vmalloc_to_page (data) :virt_to_page (data); bytes_added =bio_add_page (bio, page, bytes, offset);
@@ -232,7 +240,7 @@ int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback, } data += bytes; - len -= bytes; + remaining -= bytes; offset =0 ; }
drivers/md/dm-vdo/vio.h +2 -0
@@ -123,6 +123,8 @@ void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callbint vio_reset_bio (struct vio *vio,char *data,bio_end_io_t callback,blk_opf_t bi_opf,physical_block_number_t pbn); +int vio_reset_bio_with_size (struct vio *vio,char *data,int size,bio_end_io_t callback, +blk_opf_t bi_opf,physical_block_number_t pbn); void update_vio_error_stats(struct vio *vio, const char *format, ...) __printf(2, 3);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 577/642 dm vdo indexer: prevent unterminated string warning
In reply to Sasha LevinFrom: Chung Chung <[email protected]>
[ Upstream commit f4e99b846c90163d350c69d6581ac38dd5818eb8 ]
Fix array initialization that triggers a warning:
error: initializer-string for array of ‘unsigned char’ is too long
[-Werror=unterminated-string-initialization]
--- drivers/md/dm-vdo/indexer/index-layout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm-vdo/indexer/index-layout.c +3 -2
@@ -54,7 +54,6 @@* Each save also has a unique nonce. */ -#define MAGIC_SIZE 32#define NONCE_INFO_SIZE 32#define MAX_SAVES 2
@@ -98,9 +97,11 @@ enum region_type {#define SUPER_VERSION_CURRENT 3#define SUPER_VERSION_MAXIMUM 7 -static const u8 LAYOUT_MAGIC [MAGIC_SIZE ] ="*ALBIREO*SINGLE*FILE*LAYOUT*001*" ; +static const u8 LAYOUT_MAGIC [] ="*ALBIREO*SINGLE*FILE*LAYOUT*001*" ;static const u64 REGION_MAGIC =0x416c6252676e3031 ;/* 'AlbRgn01' */ +#define MAGIC_SIZE (sizeof(LAYOUT_MAGIC) - 1) +struct region_header {u64 magic;u64 region_blocks;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 578/642 dm vdo: use a short static string for thread name prefix
In reply to Sasha LevinFrom: Matthew Sakai <[email protected]>
[ Upstream commit 3280c9313c9adce01550cc9f00edfb1dc7c744da ]
Also remove MODULE_NAME and a BUG_ON check, both unneeded.
This fixes a warning about string truncation in snprintf that will never happen in practice:
drivers/md/dm-vdo/vdo.c: In function ‘vdo_make’:drivers/md/dm-vdo/vdo.c:564:5: error: ‘%s’ directive output may be truncated writing up to 55 bytes into a region of size 16 [-Werror=format-truncation=]
"%s%u", MODULE_NAME, instance);
^~
drivers/md/dm-vdo/vdo.c:563:2: note: ‘snprintf’ output between 2 and 66 bytes into a destination of size 16
snprintf(vdo->thread_name_prefix, sizeof(vdo->thread_name_prefix),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s%u", MODULE_NAME, instance);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/md/dm-vdo/vdo.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/md/dm-vdo/vdo.c +1 -10
@@ -31,9 +31,7 @@#include <linux/completion.h> #include <linux/device-mapper.h> -#include <linux/kernel.h> #include <linux/lz4.h> -#include <linux/module.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/types.h>
@@ -142,12 +140,6 @@ static void finish_vdo_request_queue(void *ptr)vdo_unregister_allocating_thread (); } -#ifdef MODULE -#define MODULE_NAME THIS_MODULE->name -#else -#define MODULE_NAME "dm-vdo" -#endif /* MODULE */ -static const struct vdo_work_queue_type default_queue_type = { .start = start_vdo_request_queue, .finish = finish_vdo_request_queue,
@@ -559,8 +551,7 @@ int vdo_make(unsigned int instance, struct device_config *config, char **reason, *vdo_ptr = vdo;snprintf (vdo->thread_name_prefix,sizeof (vdo->thread_name_prefix), -"%s%u" ,MODULE_NAME , instance); -BUG_ON (vdo->thread_name_prefix[0 ] =='\0' ); +"vdo%u" , instance); result =vdo_allocate (vdo->thread_config.thread_count, struct vdo_thread, __func__, &vdo->threads);if (result !=VDO_SUCCESS ) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 579/642 drm/ast: Find VBIOS mode from regular display size
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit c81202906b5cd56db403e95db3d29c9dfc8c74c1 ]
The ast driver looks up supplied display modes from an internal list of display modes supported by the VBIOS.
Do not use the crtc_-prefixed display values from struct drm_display_mode for looking up the VBIOS mode. The fields contain raw values that the driver programs to hardware. They are affected by display settings like double-scan or interlace.
Instead use the regular vdisplay and hdisplay fields for lookup. As the programmed values can now differ from the values used for lookup, set struct drm_display_mode.crtc_vdisplay and .crtc_hdisplay from the VBIOS mode.
--- drivers/gpu/drm/ast/ast_mode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +6 -4
@@ -131,7 +131,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format,return false; } -switch (mode->crtc_hdisplay) { +switch (mode->hdisplay) {case 640 : vbios_mode->enh_table = &res_640x480[refresh_rate_index];break ;
@@ -145,7 +145,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1152x864[refresh_rate_index];break ;case 1280 : -if (mode->crtc_vdisplay ==800 ) +if (mode->vdisplay ==800 ) vbios_mode->enh_table = &res_1280x800[refresh_rate_index];else vbios_mode->enh_table = &res_1280x1024[refresh_rate_index];
@@ -157,7 +157,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1440x900[refresh_rate_index];break ;case 1600 : -if (mode->crtc_vdisplay ==900 ) +if (mode->vdisplay ==900 ) vbios_mode->enh_table = &res_1600x900[refresh_rate_index];else vbios_mode->enh_table = &res_1600x1200[refresh_rate_index];
@@ -166,7 +166,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table = &res_1680x1050[refresh_rate_index];break ;case 1920 : -if (mode->crtc_vdisplay ==1080 ) +if (mode->vdisplay ==1080 ) vbios_mode->enh_table = &res_1920x1080[refresh_rate_index];else vbios_mode->enh_table = &res_1920x1200[refresh_rate_index];
@@ -210,6 +210,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, hborder = (vbios_mode->enh_table->flags & HBorder) ?8 :0 ; vborder = (vbios_mode->enh_table->flags & VBorder) ?8 :0 ; + adjusted_mode->crtc_hdisplay = vbios_mode->enh_table->hde; adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht; adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder; adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
@@ -219,6 +220,7 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, vbios_mode->enh_table->hfp + vbios_mode->enh_table->hsync); + adjusted_mode->crtc_vdisplay = vbios_mode->enh_table->vde; adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt; adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder; adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 580/642 bpf: Use kallsyms to find the function name of a struct_ops's stub function
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit 12fdd29d5d71d2987a1aec434b704d850a4d7fcb ]
In commit 1611603537a4 ("bpf: Create argument information for nullable arguments."), it introduced a "__nullable" tagging at the argument name of a
stub function. Some background on the commit:
it requires to tag the stub function instead of directly tagging
the "ops" of a struct. This is because the btf func_proto of the "ops" does not have the argument name and the "__nullable" is tagged at
the argument name.
To find the stub function of a "ops", it currently relies on a naming convention on the stub function "st_ops__ops_name".
e.g. tcp_congestion_ops__ssthresh. However, the new kernel sub system implementing bpf_struct_ops have missed this and have been surprised that the "__nullable" and the to-be-landed "__ref" tagging was not effective.
One option would be to give a warning whenever the stub function does not follow the naming convention, regardless if it requires arg tagging or not.
Instead, this patch uses the kallsyms_lookup approach and removes the requirement on the naming convention. The st_ops->cfi_stubs has all the stub function kernel addresses. kallsyms_lookup() is used to lookup the function name. With the function name, BTF can be used to find the BTF func_proto. The existing "__nullable" arg name searching logic will then fall through.
One notable change is,
if it failed in kallsyms_lookup or it failed in looking up the stub function name from the BTF, the bpf_struct_ops registration will fail. This is different from the previous behavior that it silently ignored the "st_ops__ops_name" function not found error.
The "tcp_congestion_ops", "sched_ext_ops", and "hid_bpf_ops" can still be registered successfully after this patch. There is struct_ops_maybe_null selftest to cover the "__nullable" tagging.
Other minor changes:
1. Removed the "%s__%s" format from the pr_warn because the naming convention is removed.
2. The existing bpf_struct_ops_supported() is also moved earlier because prepare_arg_info needs to use it to decide if the stub function is NULL before calling the prepare_arg_info.
--- kernel/bpf/bpf_struct_ops.c | 98 +++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 54 deletions(-)
kernel/bpf/bpf_struct_ops.c +44 -54
@@ -146,39 +146,6 @@ void bpf_struct_ops_image_free(void *image) }#define MAYBE_NULL_SUFFIX "__nullable" -#define MAX_STUB_NAME 128 - -/* Return the type info of a stub function, if it exists. -* -* The name of a stub function is made up of the name of the struct_ops and -* the name of the function pointer member, separated by "__". For example, -* if the struct_ops type is named "foo_ops" and the function pointer -* member is named "bar", the stub function name would be "foo_ops__bar". -*/ -static const struct btf_type * -find_stub_func_proto (const struct btf *btf,const char *st_op_name, -const char *member_name) -{ -char stub_func_name[MAX_STUB_NAME ]; -const struct btf_type *func_type; -s32 btf_id; -int cp; - - cp =snprintf (stub_func_name,MAX_STUB_NAME ,"%s__%s" , - st_op_name, member_name); -if (cp >=MAX_STUB_NAME ) { -pr_warn ("Stub function name too long\n" ); -return NULL ; - } - btf_id =btf_find_by_name_kind (btf, stub_func_name,BTF_KIND_FUNC ); -if (btf_id <0 ) -return NULL ; - func_type =btf_type_by_id (btf, btf_id); -if (!func_type) -return NULL ; - -return btf_type_by_id (btf, func_type->type);/* FUNC_PROTO */ -}/* Prepare argument info for every nullable argument of a member of a * struct_ops type.
@@ -203,27 +170,42 @@ find_stub_func_proto(const struct btf *btf, const char *st_op_name,static int prepare_arg_info (struct btf *btf,const char *st_ops_name,const char *member_name, -const struct btf_type *func_proto, +const struct btf_type *func_proto,void *stub_func_addr,struct bpf_struct_ops_arg_info *arg_info) {const struct btf_type *stub_func_proto, *pointed_type;const struct btf_param *stub_args, *args;struct bpf_ctx_arg_aux *info, *info_buf;u32 nargs, arg_no, info_cnt =0 ; +char ksym[KSYM_SYMBOL_LEN ]; +const char *stub_fname; +s32 stub_func_id;u32 arg_btf_id;int offset; - stub_func_proto =find_stub_func_proto (btf, st_ops_name, member_name); -if (!stub_func_proto) -return 0 ; + stub_fname =kallsyms_lookup ((unsigned long )stub_func_addr,NULL ,NULL ,NULL , ksym); +if (!stub_fname) { +pr_warn ("Cannot find the stub function name for the %s in struct %s\n" , + member_name, st_ops_name); +return -ENOENT ; + } + + stub_func_id =btf_find_by_name_kind (btf, stub_fname,BTF_KIND_FUNC ); +if (stub_func_id <0 ) { +pr_warn ("Cannot find the stub function %s in btf\n" , stub_fname); +return -ENOENT ; + } + + stub_func_proto =btf_type_by_id (btf, stub_func_id); + stub_func_proto =btf_type_by_id (btf, stub_func_proto->type);/* Check if the number of arguments of the stub function is the same * as the number of arguments of the function pointer. */ nargs =btf_type_vlen (func_proto);if (nargs !=btf_type_vlen (stub_func_proto)) { -pr_warn ("the number of arguments of the stub function %s__%s does not match the number of arguments of the member %s of struct %s\n" , - st_ops_name, member_name, member_name, st_ops_name); +pr_warn ("the number of arguments of the stub function %s does not match the number of arguments of the member %s of struct %s\n" , + stub_fname, member_name, st_ops_name);return -EINVAL ; }
@@ -253,21 +235,21 @@ static int prepare_arg_info(struct btf *btf, &arg_btf_id);if (!pointed_type || !btf_type_is_struct (pointed_type)) { -pr_warn ("stub function %s__%s has %s tagging to an unsupported type\n" , - st_ops_name, member_name,MAYBE_NULL_SUFFIX ); +pr_warn ("stub function %s has %s tagging to an unsupported type\n" , + stub_fname,MAYBE_NULL_SUFFIX ); goto err_out; } offset =btf_ctx_arg_offset (btf, func_proto, arg_no);if (offset <0 ) { -pr_warn ("stub function %s__%s has an invalid trampoline ctx offset for arg#%u\n" , - st_ops_name, member_name, arg_no); +pr_warn ("stub function %s has an invalid trampoline ctx offset for arg#%u\n" , + stub_fname, arg_no); goto err_out; }if (args[arg_no].type != stub_args[arg_no].type) { -pr_warn ("arg#%u type in stub function %s__%s does not match with its original func_proto\n" , - arg_no, st_ops_name, member_name); +pr_warn ("arg#%u type in stub function %s does not match with its original func_proto\n" , + arg_no, stub_fname); goto err_out; }
@@ -324,6 +306,13 @@ static bool is_module_member(const struct btf *btf, u32 id)return !strcmp (btf_name_by_offset (btf, t->name_off),"module" ); } +int bpf_struct_ops_supported (const struct bpf_struct_ops *st_ops,u32 moff) +{ +void *func_ptr = *(void **)(st_ops->cfi_stubs + moff); + +return func_ptr ?0 : -ENOTSUPP ; +} +int bpf_struct_ops_desc_init (struct bpf_struct_ops_desc *st_ops_desc,struct btf *btf,struct bpf_verifier_log *log)
@@ -387,7 +376,10 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,for_each_member (i, t, member) {const struct btf_type *func_proto; +void **stub_func_addr; +u32 moff; + moff =__btf_member_bit_offset (t, member) /8 ; mname =btf_name_by_offset (btf, member->name_off);if (!*mname) { pr_warn("anon member in struct %s is not supported\n",
@@ -413,7 +405,11 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc, func_proto =btf_type_resolve_func_ptr (btf, member->type,NULL ); -if (!func_proto) + +/* The member is not a function pointer or +* the function pointer is not supported. +*/ +if (!func_proto ||bpf_struct_ops_supported (st_ops, moff))continue ; if (btf_distill_func_proto(log, btf,
@@ -425,8 +421,9 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc, goto errout; } + stub_func_addr = *(void **)(st_ops->cfi_stubs + moff); err =prepare_arg_info (btf, st_ops->name, mname, - func_proto, + func_proto, stub_func_addr, arg_info + i);if (err) goto errout;
@@ -1152,13 +1149,6 @@ void bpf_struct_ops_put(const void *kdata)bpf_map_put (&st_map->map); } -int bpf_struct_ops_supported (const struct bpf_struct_ops *st_ops,u32 moff) -{ -void *func_ptr = *(void **)(st_ops->cfi_stubs + moff); - -return func_ptr ?0 : -ENOTSUPP ; -} -static bool bpf_struct_ops_valid_to_reg (struct bpf_map *map) {struct bpf_struct_ops_map *st_map = (struct bpf_struct_ops_map *)map;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 581/642 bpftool: Fix readlink usage in get_fd_type
In reply to Sasha LevinFrom: Viktor Malik <[email protected]>
[ Upstream commit 0053f7d39d491b6138d7c526876d13885cbb65f1 ]
The readlink(path, buf, sizeof(buf)) call reads at most sizeof(buf) bytes and *does not* append null-terminator to buf. With respect to that, fix two pieces in get_fd_type:
1. Change the truncation check to contain sizeof(buf) rather than sizeof(path).
2. Append null-terminator to buf.
Reported by Coverity.
--- tools/bpf/bpftool/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/bpf/bpftool/common.c +2 -1
@@ -461,10 +461,11 @@ int get_fd_type(int fd)p_err ("can't read link type: %s" ,strerror (errno));return -1 ; } -if (n ==sizeof (path)) { +if (n ==sizeof (buf)) {p_err ("can't read link type: path too long!" );return -1 ; } + buf[n] ='\0' ;if (strstr (buf,"bpf-map" ))return BPF_OBJ_MAP ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 582/642 firmware: arm_scmi: Relax duplicate name constraint across protocol ids
In reply to Sasha LevinFrom: Sudeep Holla <[email protected]>
[ Upstream commit 21ee965267bcbdd733be0f35344fa0f0226d7861 ]
Currently in scmi_protocol_device_request(), no duplicate scmi device name is allowed across any protocol. However scmi_dev_match_id() first matches the protocol id and then the name. So, there is no strict requirement to keep this scmi device name unique across all the protocols.
Relax the constraint on the duplicate name across the protocols and inhibit only within the same protocol id.
Message-Id: <[email protected]>
--- drivers/firmware/arm_scmi/bus.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/firmware/arm_scmi/bus.c +6 -13
@@ -42,7 +42,7 @@ static atomic_t scmi_syspower_registered = ATOMIC_INIT(0);* This helper let an SCMI driver request specific devices identified by the * @id_table to be created for each active SCMI instance. * -* The requested device name MUST NOT be already existent for any protocol; +* The requested device name MUST NOT be already existent for this protocol; * at first the freshly requested @id_table is annotated in the IDR table * @scmi_requested_devices and then the requested device is advertised to any * registered party via the @scmi_requested_devices_nh notification chain.
@@ -52,7 +52,6 @@ static atomic_t scmi_syspower_registered = ATOMIC_INIT(0);static int scmi_protocol_device_request (const struct scmi_device_id *id_table) {int ret =0 ; -unsigned int id =0 ;struct list_head *head, *phead =NULL ;struct scmi_requested_dev *rdev;
@@ -67,19 +66,13 @@ static int scmi_protocol_device_request(const struct scmi_device_id *id_table) }/* -* Search for the matching protocol rdev list and then search -* of any existent equally named device...fails if any duplicate found. +* Find the matching protocol rdev list and then search of any +* existent equally named device...fails if any duplicate found. */ mutex_lock (&scmi_requested_devices_mtx); -idr_for_each_entry (&scmi_requested_devices, head, id) { -if (!phead) { -/* A list found registered in the IDR is never empty */ - rdev = list_first_entry(head, struct scmi_requested_dev, - node); -if (rdev->id_table->protocol_id == - id_table->protocol_id) - phead = head; - } + phead =idr_find (&scmi_requested_devices, id_table->protocol_id); +if (phead) { + head = phead;list_for_each_entry (rdev, head, node) {if (!strcmp (rdev->id_table->name, id_table->name)) { pr_err("Ignoring duplicate request [%d] %s\n",
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 583/642 perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 46dcf85566170d4528b842bf83ffc350d71771fa ]
IBS Op uses two counters: MaxCnt and CurCnt. MaxCnt is programmed with the desired sample period. IBS hw generates sample when CurCnt reaches to MaxCnt. The size of these counter used to be 20 bits but later they were extended to 27 bits. The 7 bit extension is indicated by CPUID Fn8000_001B_EAX[6 / OpCntExt].
perf_ibs->cnt_mask variable contains bit masks for MaxCnt and CurCnt. But IBS driver does not set upper 7 bits of CurCnt in cnt_mask even when OpCntExt CPUID bit is set. Fix this.
IBS driver uses cnt_mask[CurCnt] bits only while disabling an event. Fortunately, CurCnt bits are not read from MSR while re-enabling the event, instead MaxCnt is programmed with desired period and CurCnt is set to 0. Hence, we did not see any issues so far.
--- arch/x86/events/amd/ibs.c | 3 ++- arch/x86/include/asm/perf_event.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/events/amd/ibs.c +2 -1
@@ -1318,7 +1318,8 @@ static __init int perf_ibs_op_init(void)if (ibs_caps &IBS_CAPS_OPCNTEXT ) { perf_ibs_op.max_period |=IBS_OP_MAX_CNT_EXT_MASK ; perf_ibs_op.config_mask |=IBS_OP_MAX_CNT_EXT_MASK ; - perf_ibs_op.cnt_mask |=IBS_OP_MAX_CNT_EXT_MASK ; + perf_ibs_op.cnt_mask |= (IBS_OP_MAX_CNT_EXT_MASK | +IBS_OP_CUR_CNT_EXT_MASK ); }if (ibs_caps &IBS_CAPS_ZEN4 )
arch/x86/include/asm/perf_event.h +1 -0
@@ -536,6 +536,7 @@ struct pebs_xmm {*/ #define IBS_OP_CUR_CNT (0xFFF80ULL<<32)#define IBS_OP_CUR_CNT_RAND (0x0007FULL<<32) +#define IBS_OP_CUR_CNT_EXT_MASK (0x7FULL<<52)#define IBS_OP_CNT_CTL (1ULL<<19)#define IBS_OP_VAL (1ULL<<18)#define IBS_OP_ENABLE (1ULL<<17)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 584/642 perf/amd/ibs: Fix ->config to sample period calculation for OP PMU
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 598bdf4fefff5af4ce6d26d16f7b2a20808fc4cb ]
Instead of using standard perf_event_attr->freq=0 and ->sample_period fields, IBS event in 'sample period mode' can also be opened by setting period value directly in perf_event_attr->config in a MaxCnt bit-field format.
IBS OP MaxCnt bits are defined as:
(high bits) IbsOpCtl[26:20] = IbsOpMaxCnt[26:20] (low bits) IbsOpCtl[15:0] = IbsOpMaxCnt[19:4]
Perf event sample period can be derived from MaxCnt bits as:
sample_period = (high bits) | ((low_bits) << 4);
However, current code just masks MaxCnt bits and shifts all of them, including high bits, which is incorrect. Fix it.
--- arch/x86/events/amd/ibs.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
arch/x86/events/amd/ibs.c +13 -4
@@ -274,7 +274,7 @@ static int perf_ibs_init(struct perf_event *event) {struct hw_perf_event *hwc = &event->hw;struct perf_ibs *perf_ibs; -u64 max_cnt, config; +u64 config;int ret; perf_ibs =get_ibs_pmu (event->attr.type);
@@ -321,10 +321,19 @@ static int perf_ibs_init(struct perf_event *event)if (!hwc->sample_period) hwc->sample_period =0x10 ; }else { - max_cnt = config & perf_ibs->cnt_mask; +u64 period =0 ; + +if (perf_ibs == &perf_ibs_op) { + period = (config &IBS_OP_MAX_CNT ) <<4 ; +if (ibs_caps &IBS_CAPS_OPCNTEXT ) + period |= config &IBS_OP_MAX_CNT_EXT_MASK ; + }else { + period = (config &IBS_FETCH_MAX_CNT ) <<4 ; + } + config &= ~perf_ibs->cnt_mask; - event->attr.sample_period = max_cnt <<4 ; - hwc->sample_period = event->attr.sample_period; + event->attr.sample_period = period; + hwc->sample_period = period; }if (!hwc->sample_period)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 585/642 clk: renesas: rzg2l-cpg: Refactor Runtime PM clock validation
In reply to Sasha LevinFrom: Lad Prabhakar <[email protected]>
[ Upstream commit f6f73b891bf6beff069fcacc7b4a796e1009bf26 ]
Refactor rzg2l_cpg_attach_dev to delegate clock validation for Runtime PM to the updated rzg2l_cpg_is_pm_clk function. Ensure validation of clocks associated with the power domain while excluding external and core clocks. Prevent incorrect Runtime PM management for clocks outside the domain's scope.
Update rzg2l_cpg_is_pm_clk to operate on a per-power-domain basis. Verify clkspec.np against the domain's device node, check argument validity, and validate clock type (CPG_MOD). Use the no_pm_mod_clks array to exclude specific clocks from PM management.
--- drivers/clk/renesas/rzg2l-cpg.c | 102 +++++++++++++++++--------------- 1 file changed, 54 insertions(+), 48 deletions(-)
drivers/clk/renesas/rzg2l-cpg.c +54 -48
@@ -1549,28 +1549,6 @@ static int rzg2l_cpg_reset_controller_register(struct rzg2l_cpg_priv *priv)return devm_reset_controller_register (priv->dev, &priv->rcdev); } -static bool rzg2l_cpg_is_pm_clk (struct rzg2l_cpg_priv *priv, -const struct of_phandle_args *clkspec) -{ -const struct rzg2l_cpg_info *info = priv->info; -unsigned int id; -unsigned int i; - -if (clkspec->args_count !=2 ) -return false; - -if (clkspec->args[0 ] !=CPG_MOD ) -return false; - - id = clkspec->args[1 ] + info->num_total_core_clks; -for (i =0 ; i < info->num_no_pm_mod_clks; i++) { -if (info->no_pm_mod_clks[i] == id) -return false; - } - -return true; -} -/** * struct rzg2l_cpg_pm_domains - RZ/G2L PM domains data structure * @onecell_data: cell data
@@ -1595,45 +1573,73 @@ struct rzg2l_cpg_pd {u16 id; }; +static bool rzg2l_cpg_is_pm_clk (struct rzg2l_cpg_pd *pd, +const struct of_phandle_args *clkspec) +{ +if (clkspec->np != pd->genpd.dev.of_node || clkspec->args_count !=2 ) +return false; + +switch (clkspec->args[0 ]) { +case CPG_MOD : { +struct rzg2l_cpg_priv *priv = pd->priv; +const struct rzg2l_cpg_info *info = priv->info; +unsigned int id = clkspec->args[1 ]; + +if (id >= priv->num_mod_clks) +return false; + + id += info->num_total_core_clks; + +for (unsigned int i =0 ; i < info->num_no_pm_mod_clks; i++) { +if (info->no_pm_mod_clks[i] == id) +return false; + } + +return true; + } + +case CPG_CORE : +default : +return false; + } +} +static int rzg2l_cpg_attach_dev (struct generic_pm_domain *domain,struct device *dev) { struct rzg2l_cpg_pd *pd = container_of(domain, struct rzg2l_cpg_pd, genpd); -struct rzg2l_cpg_priv *priv = pd->priv;struct device_node *np = dev->of_node;struct of_phandle_args clkspec;bool once = true;struct clk *clk; +unsigned int i;int error; -int i =0 ; - -while (!of_parse_phandle_with_args (np,"clocks" ,"#clock-cells" , i, - &clkspec)) { -if (rzg2l_cpg_is_pm_clk (priv, &clkspec)) { -if (once) { - once = false; - error =pm_clk_create (dev); -if (error) { -of_node_put (clkspec.np); - goto err; - } - } - clk =of_clk_get_from_provider (&clkspec); + +for (i =0 ; !of_parse_phandle_with_args (np,"clocks" ,"#clock-cells" , i, &clkspec); i++) { +if (!rzg2l_cpg_is_pm_clk (pd, &clkspec)) {of_node_put (clkspec.np); -if (IS_ERR (clk)) { - error =PTR_ERR (clk); - goto fail_destroy; - } +continue ; + } - error =pm_clk_add_clk (dev, clk); +if (once) { + once = false; + error =pm_clk_create (dev);if (error) { -dev_err (dev,"pm_clk_add_clk failed %d\n" , - error); - goto fail_put; +of_node_put (clkspec.np); + goto err; } - }else { -of_node_put (clkspec.np); } - i++; + clk =of_clk_get_from_provider (&clkspec); +of_node_put (clkspec.np); +if (IS_ERR (clk)) { + error =PTR_ERR (clk); + goto fail_destroy; + } + + error =pm_clk_add_clk (dev, clk); +if (error) { +dev_err (dev,"pm_clk_add_clk failed %d\n" , error); + goto fail_put; + } }return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 586/642 wifi: rtl8xxxu: retry firmware download on error
In reply to Sasha LevinFrom: Soeren Moch <[email protected]>
[ Upstream commit 3d3e28feca7ac8c6cf2a390dbbe1f97e3feb7f36 ]
Occasionally there is an EPROTO error during firmware download. This error is converted to EAGAIN in the download function. But nobody tries again and so device probe fails.
Implement download retry to fix this.
This error was observed (and fix tested) on a tbs2910 board [1] with an embedded RTL8188EU (0bda:8179) device behind a USB hub.
[1] arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/core.c +12 -5
@@ -860,9 +860,10 @@ rtl8xxxu_writeN(struct rtl8xxxu_priv *priv, u16 addr, u8 *buf, u16 len)return len; write_error: -dev_info (&udev->dev, -"%s: Failed to write block at addr: %04x size: %04x\n" , - __func__, addr, blocksize); +if (rtl8xxxu_debug &RTL8XXXU_DEBUG_REG_WRITE ) +dev_info (&udev->dev, +"%s: Failed to write block at addr: %04x size: %04x\n" , + __func__, addr, blocksize);return -EAGAIN ; }
@@ -4064,8 +4065,14 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)*/ rtl8xxxu_write16 (priv,REG_TRXFF_BNDY +2 , fops->trxff_boundary); - ret =rtl8xxxu_download_firmware (priv); -dev_dbg (dev,"%s: download_firmware %i\n" , __func__, ret); +for (int retry =5 ; retry >=0 ; retry--) { + ret =rtl8xxxu_download_firmware (priv); +dev_dbg (dev,"%s: download_firmware %i\n" , __func__, ret); +if (ret != -EAGAIN ) +break ; +if (retry) +dev_dbg (dev,"%s: retry firmware download\n" , __func__); + }if (ret) goto exit; ret =rtl8xxxu_start_firmware (priv);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 587/642 wifi: rtw88: Don't use static local variable in rtw8822b_set_tx_power_index_by_rate
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 00451eb3bec763f708e7e58326468c1e575e5a66 ]
Some users want to plug two identical USB devices at the same time. This static variable could theoretically cause them to use incorrect TX power values.
Move the variable to the caller and pass a pointer to it to rtw8822b_set_tx_power_index_by_rate().
--- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822b.c +8 -6
@@ -935,11 +935,11 @@ static void query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status, }static void -rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path,u8 rs) +rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path, +u8 rs,u32 *phy_pwr_idx) {struct rtw_hal *hal = &rtwdev->hal;static const u32 offset_txagc[2 ] = {0x1d00 ,0x1d80 }; -static u32 phy_pwr_idx;u8 rate, rate_idx, pwr_index, shift;int j;
@@ -947,12 +947,12 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs) rate = rtw_rate_section[rs][j]; pwr_index = hal->tx_pwr_tbl[path][rate]; shift = rate &0x3 ; - phy_pwr_idx |= ((u32 )pwr_index << (shift *8 )); + *phy_pwr_idx |= ((u32 )pwr_index << (shift *8 ));if (shift ==0x3 ) { rate_idx = rate &0xfc ;rtw_write32 (rtwdev, offset_txagc[path] + rate_idx, - phy_pwr_idx); - phy_pwr_idx =0 ; + *phy_pwr_idx); + *phy_pwr_idx =0 ; } } }
@@ -960,11 +960,13 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs)static void rtw8822b_set_tx_power_index (struct rtw_dev *rtwdev) {struct rtw_hal *hal = &rtwdev->hal; +u32 phy_pwr_idx =0 ;int rs, path;for (path =0 ; path < hal->rf_path_num; path++) {for (rs =0 ; rs <RTW_RATE_SECTION_MAX ; rs++) -rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs); +rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs, + &phy_pwr_idx); } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 588/642 wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit ebfc9199df05d37b67f4d1b7ee997193f3d2e7c8 ]
To ensure where are protected by driver mutex can also be protected by wiphy_lock(), so afterward we can remove driver mutex safely.
--- drivers/net/wireless/realtek/rtw89/regd.c | 2 ++ drivers/net/wireless/realtek/rtw89/ser.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/net/wireless/realtek/rtw89/regd.c +2 -0
@@ -720,6 +720,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *requeststruct ieee80211_hw *hw =wiphy_to_ieee80211_hw (wiphy);struct rtw89_dev *rtwdev = hw->priv; +wiphy_lock (wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_ps_mode (rtwdev);
@@ -737,6 +738,7 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request exit:mutex_unlock (&rtwdev->mutex); +wiphy_unlock (wiphy); }/* Maximum Transmit Power field (@raw) can be EIRP or PSD.
drivers/net/wireless/realtek/rtw89/ser.c +4 -0
@@ -156,9 +156,11 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt)rtw89_debug (rtwdev,RTW89_DBG_SER ,"ser: %s receive %s\n" ,ser_st_name (ser),ser_ev_name (ser, evt)); +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);rtw89_leave_lps (rtwdev);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy); ser->st_tbl[ser->state].st_func (ser, evt); }
@@ -708,9 +710,11 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)switch (evt) {case SER_EV_STATE_IN : +wiphy_lock (rtwdev->hw->wiphy);mutex_lock (&rtwdev->mutex);ser_l2_reset_st_pre_hdl (ser);mutex_unlock (&rtwdev->mutex); +wiphy_unlock (rtwdev->hw->wiphy);ieee80211_restart_hw (rtwdev->hw);ser_set_alarm (ser,SER_RECFG_TIMEOUT ,SER_EV_L2_RECFG_TIMEOUT );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 589/642 spi: zynqmp-gqspi: Always acknowledge interrupts
In reply to Sasha LevinFrom: Sean Anderson <[email protected]>
[ Upstream commit 89785306453ce6d949e783f6936821a0b7649ee2 ]
RXEMPTY can cause an IRQ, even though we may not do anything about it (such as if we are waiting for more received data). We must still handle these IRQs because we can tell they were caused by the device.
--- drivers/spi/spi-zynqmp-gqspi.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/spi/spi-zynqmp-gqspi.c +8 -12
@@ -799,7 +799,6 @@ static void zynqmp_process_dma_irq(struct zynqmp_qspi *xqspi)static irqreturn_t zynqmp_qspi_irq (int irq,void *dev_id) {struct zynqmp_qspi *xqspi = (struct zynqmp_qspi *)dev_id; -irqreturn_t ret =IRQ_NONE ;u32 status, mask, dma_status =0 ; status =zynqmp_gqspi_read (xqspi,GQSPI_ISR_OFST );
@@ -814,27 +813,24 @@ static irqreturn_t zynqmp_qspi_irq(int irq, void *dev_id) dma_status); } -if (mask &GQSPI_ISR_TXNOT_FULL_MASK ) { +if (!mask && !dma_status) +return IRQ_NONE ; + +if (mask &GQSPI_ISR_TXNOT_FULL_MASK )zynqmp_qspi_filltxfifo (xqspi,GQSPI_TX_FIFO_FILL ); - ret =IRQ_HANDLED ; - } -if (dma_status &GQSPI_QSPIDMA_DST_I_STS_DONE_MASK ) { +if (dma_status &GQSPI_QSPIDMA_DST_I_STS_DONE_MASK )zynqmp_process_dma_irq (xqspi); - ret =IRQ_HANDLED ; - }else if (!(mask &GQSPI_IER_RXEMPTY_MASK ) && - (mask &GQSPI_IER_GENFIFOEMPTY_MASK )) { +else if (!(mask &GQSPI_IER_RXEMPTY_MASK ) && + (mask &GQSPI_IER_GENFIFOEMPTY_MASK ))zynqmp_qspi_readrxfifo (xqspi,GQSPI_RX_FIFO_FILL ); - ret =IRQ_HANDLED ; - }if (xqspi->bytes_to_receive ==0 && xqspi->bytes_to_transfer ==0 && ((status &GQSPI_IRQ_MASK ) ==GQSPI_IRQ_MASK )) {zynqmp_gqspi_write (xqspi,GQSPI_IDR_OFST ,GQSPI_ISR_IDR_MASK );complete (&xqspi->data_completion); - ret =IRQ_HANDLED ; } -return ret; +return IRQ_HANDLED ; }/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 590/642 regulator: ad5398: Add device tree support
In reply to Sasha LevinFrom: Isaac Scott <[email protected]>
[ Upstream commit 5a6a461079decea452fdcae955bccecf92e07e97 ]
Previously, the ad5398 driver used only platform_data, which is deprecated in favour of device tree. This caused the AD5398 to fail to probe as it could not load its init_data. If the AD5398 has a device tree node, pull the init_data from there using of_get_regulator_init_data.
--- drivers/regulator/ad5398.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/regulator/ad5398.c +9 -3
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <linux/regulator/of_regulator.h> #define AD5398_CURRENT_EN_MASK 0x8000
@@ -221,15 +222,20 @@ static int ad5398_probe(struct i2c_client *client)const struct ad5398_current_data_format *df = (struct ad5398_current_data_format *)id->driver_data; -if (!init_data) -return -EINVAL ; - chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ; config.dev = &client->dev; +if (client->dev.of_node) + init_data =of_get_regulator_init_data (&client->dev, + client->dev.of_node, + &ad5398_reg); +if (!init_data) +return -EINVAL ; + config.init_data = init_data; + config.of_node = client->dev.of_node; config.driver_data = chip; chip->client = client;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 591/642 ASoC: cpcap: Implement .set_bias_level
In reply to Sasha LevinFrom: Ivaylo Dimitrov <[email protected]>
[ Upstream commit 5b4288792ff246cf2bda0c81cebcc02d1f631ca3 ]
With VAUDIO regulator being always on, we have to put it in low-power mode when codec is not in use to decrease power usage.
Do so by implementing driver .set_bias_level callback.
--- sound/soc/codecs/cpcap.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
sound/soc/codecs/cpcap.c +29 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/regmap.h> #include <linux/platform_device.h> +#include <linux/regulator/consumer.h> #include <linux/mfd/motorola-cpcap.h> #include <sound/core.h> #include <sound/soc.h>
@@ -260,6 +261,7 @@ struct cpcap_audio {int codec_clk_id;int codec_freq;int codec_format; +struct regulator *vaudio; }; static int cpcap_st_workaround(struct snd_soc_dapm_widget *w,
@@ -1637,6 +1639,11 @@ static int cpcap_soc_probe(struct snd_soc_component *component)snd_soc_component_set_drvdata (component, cpcap); cpcap->component = component; + cpcap->vaudio =devm_regulator_get (component->dev,"VAUDIO" ); +if (IS_ERR (cpcap->vaudio)) +return dev_err_probe (component->dev,PTR_ERR (cpcap->vaudio), +"Cannot get VAUDIO regulator\n" ); + cpcap->regmap =dev_get_regmap (component->dev->parent,NULL );if (!cpcap->regmap)return -ENODEV ;
@@ -1649,6 +1656,27 @@ static int cpcap_soc_probe(struct snd_soc_component *component)return cpcap_audio_reset (component, false); } +static int cpcap_set_bias_level (struct snd_soc_component *component, +enum snd_soc_bias_level level) +{ +struct cpcap_audio *cpcap =snd_soc_component_get_drvdata (component); + +switch (level) { +case SND_SOC_BIAS_OFF : +break ; +case SND_SOC_BIAS_PREPARE : +regulator_set_mode (cpcap->vaudio,REGULATOR_MODE_NORMAL ); +break ; +case SND_SOC_BIAS_STANDBY : +regulator_set_mode (cpcap->vaudio,REGULATOR_MODE_STANDBY ); +break ; +case SND_SOC_BIAS_ON : +break ; + } + +return 0 ; +} +static const struct snd_soc_component_driver soc_codec_dev_cpcap = { .probe = cpcap_soc_probe, .controls = cpcap_snd_controls,
@@ -1657,6 +1685,7 @@ static const struct snd_soc_component_driver soc_codec_dev_cpcap = { .num_dapm_widgets = ARRAY_SIZE(cpcap_dapm_widgets), .dapm_routes = intercon, .num_dapm_routes = ARRAY_SIZE(intercon), + .set_bias_level = cpcap_set_bias_level, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1,
Signature · 1 line
2.39.5
Mark Brown
maintainerRe: [PATCH AUTOSEL 6.14 591/642] ASoC: cpcap: Implement .set_bias_level
Quoted 8 lines · Sasha Levin
From: Ivaylo Dimitrov <[email protected]>
[ Upstream commit
5b4288792ff246cf2bda0c81cebcc02d1f631ca3]With VAUDIO regulator being always on, we have to put it in low-power mode when codec is not in use to decrease power usage.
Do so by implementing driver .set_bias_level callback.
This is clearly a performance improvement not a bug fix.
Sasha Levin
maintainerPATCH 592/642 wifi: ath12k: fix ath12k_hal_tx_cmd_ext_desc_setup() info1 override
In reply to Sasha LevinFrom: Nicolas Escande <[email protected]>
[ Upstream commit df11edfba49e5fb69f4c9e7cb76082b89c417f78 ]
Since inception there is an obvious typo laying around in ath12k_hal_tx_cmd_ext_desc_setup(). Instead of initializing + adding flags to tcl_ext_cmd->info1, we initialize + override. This will be needed in the future to make broadcast frames work with ethernet encapsulation.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp_tx.c +1 -1
@@ -117,7 +117,7 @@ static void ath12k_hal_tx_cmd_ext_desc_setup(struct ath12k_base *ab,le32_encode_bits (ti->data_len,HAL_TX_MSDU_EXT_INFO1_BUF_LEN ); - tcl_ext_cmd->info1 =le32_encode_bits (1 ,HAL_TX_MSDU_EXT_INFO1_EXTN_OVERRIDE ) | + tcl_ext_cmd->info1 |=le32_encode_bits (1 ,HAL_TX_MSDU_EXT_INFO1_EXTN_OVERRIDE ) |le32_encode_bits (ti->encap_type,HAL_TX_MSDU_EXT_INFO1_ENCAP_TYPE ) | le32_encode_bits(ti->encrypt_type,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 593/642 accel/qaic: Mask out SR-IOV PCI resources
In reply to Sasha LevinFrom: Youssef Samir <[email protected]>
[ Upstream commit 8685520474bfc0fe4be83c3cbfe3fb3e1ca1514a ]
During the initialization of the qaic device, pci_select_bars() is used to fetch a bitmask of the BARs exposed by the device. On devices that have Virtual Functions capabilities, the bitmask includes SR-IOV BARs.
Use a mask to filter out SR-IOV BARs if they exist.
--- drivers/accel/qaic/qaic_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/qaic/qaic_drv.c +1 -1
@@ -431,7 +431,7 @@ static int init_pci(struct qaic_device *qdev, struct pci_dev *pdev)int bars;int ret; - bars =pci_select_bars (pdev,IORESOURCE_MEM ); + bars =pci_select_bars (pdev,IORESOURCE_MEM ) &0x3f ;/* make sure the device has the expected BARs */ if (bars != (BIT (0 ) |BIT (2 ) |BIT (4 ))) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 594/642 drm/xe/pf: Reset GuC VF config when unprovisioning critical resource
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit 33f17e2cbd930a2a00eb007d9b241b6db010a880 ]
GuC firmware counts received VF configuration KLVs and may start validation of the complete VF config even if some resources where unprovisioned in the meantime, leading to unexpected errors like:
$ echo 1 | sudo tee /sys/kernel/debug/dri/0000:00:02.0/gt0/vf1/contexts_quota $ echo 0 | sudo tee /sys/kernel/debug/dri/0000:00:02.0/gt0/vf1/contexts_quota $ echo 1 | sudo tee /sys/kernel/debug/dri/0000:00:02.0/gt0/vf1/doorbells_quota $ echo 0 | sudo tee /sys/kernel/debug/dri/0000:00:02.0/gt0/vf1/doorbells_quota $ echo 1 | sudo tee /sys/kernel/debug/dri/0000:00:02.0/gt0/vf1/ggtt_quota tee: '/sys/kernel/debug/dri/0000:00:02.0/gt0/vf1/ggtt_quota': Input/output error
To mitigate this problem trigger explicit VF config reset after unprovisioning any of the critical resources (GGTT, context or doorbell IDs) that GuC is monitoring.
--- drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 37 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c +33 -4
@@ -336,6 +336,26 @@ static int pf_push_full_vf_config(struct xe_gt *gt, unsigned int vfid)return err; } +static int pf_push_vf_cfg (struct xe_gt *gt,unsigned int vfid,bool reset) +{ +int err =0 ; + +xe_gt_assert (gt, vfid); +lockdep_assert_held (xe_gt_sriov_pf_master_mutex (gt)); + +if (reset) + err =pf_send_vf_cfg_reset (gt, vfid); +if (!err) + err =pf_push_full_vf_config (gt, vfid); + +return err; +} + +static int pf_refresh_vf_cfg (struct xe_gt *gt,unsigned int vfid) +{ +return pf_push_vf_cfg (gt, vfid, true); +} +static u64 pf_get_ggtt_alignment (struct xe_gt *gt) {struct xe_device *xe =gt_to_xe (gt);
@@ -432,6 +452,10 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)return err;pf_release_vf_config_ggtt (gt, config); + + err =pf_refresh_vf_cfg (gt, vfid); +if (unlikely (err)) +return err; }xe_gt_assert (gt, !xe_ggtt_node_allocated (config->ggtt_region));
@@ -757,6 +781,10 @@ static int pf_provision_vf_ctxs(struct xe_gt *gt, unsigned int vfid, u32 num_ctxreturn ret;pf_release_config_ctxs (gt, config); + + ret =pf_refresh_vf_cfg (gt, vfid); +if (unlikely (ret)) +return ret; }if (!num_ctxs)
@@ -1054,6 +1082,10 @@ static int pf_provision_vf_dbs(struct xe_gt *gt, unsigned int vfid, u32 num_dbs)return ret;pf_release_config_dbs (gt, config); + + ret =pf_refresh_vf_cfg (gt, vfid); +if (unlikely (ret)) +return ret; }if (!num_dbs)
@@ -2085,10 +2117,7 @@ int xe_gt_sriov_pf_config_push(struct xe_gt *gt, unsigned int vfid, bool refreshxe_gt_assert (gt, vfid);mutex_lock (xe_gt_sriov_pf_master_mutex (gt)); -if (refresh) - err =pf_send_vf_cfg_reset (gt, vfid); -if (!err) - err =pf_push_full_vf_config (gt, vfid); + err =pf_push_vf_cfg (gt, vfid, refresh);mutex_unlock (xe_gt_sriov_pf_master_mutex (gt));if (unlikely (err)) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 595/642 wifi: ath9k: return by of_get_mac_address
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit dfffb317519f88534bb82797f055f0a2fd867e7b ]
When using nvmem, ath9k could potentially be loaded before nvmem, which loads after mtd. This is an issue if DT contains an nvmem mac address.
If nvmem is not ready in time for ath9k, -EPROBE_DEFER is returned. Pass it to _probe so that ath9k can properly grab a potentially present MAC address.
--- drivers/net/wireless/ath/ath9k/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/init.c +3 -1
@@ -647,7 +647,9 @@ static int ath9k_of_init(struct ath_softc *sc) ah->ah_flags |=AH_NO_EEP_SWAP ; } -of_get_mac_address (np, common->macaddr); + ret =of_get_mac_address (np, common->macaddr); +if (ret == -EPROBE_DEFER ) +return ret;return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 596/642 wifi: ath12k: Fetch regdb.bin file from board-2.bin
In reply to Sasha LevinFrom: Aaradhana Sahu <[email protected]>
[ Upstream commit 24f587572acf7509127dbdfcbf1b681ef84eeba0 ]
Currently, ath12k_core_fetch_regdb() finds regdb.bin file through board id's but in board-2.bin file regdb.bin file is present with default board id because of which regdb.bin is not fetched.
Add support to fetch regdb.bin file from board-2.bin through default board id.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +7 -5
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(ath12k_core_resume);static int __ath12k_core_create_board_name (struct ath12k_base *ab,char *name,size_t name_len,bool with_variant, -bool bus_type_mode) +bool bus_type_mode,bool with_default) {/* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ char variant[9 +ATH12K_QMI_BDF_EXT_STR_LENGTH ] = {0 };
@@ -204,7 +204,9 @@ static int __ath12k_core_create_board_name(struct ath12k_base *ab, char *name,"bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s" ,ath12k_bus_str (ab->hif.bus), ab->qmi.target.chip_id, - ab->qmi.target.board_id, variant); + with_default ? +ATH12K_BOARD_ID_DEFAULT : ab->qmi.target.board_id, + variant);break ; }
@@ -216,19 +218,19 @@ static int __ath12k_core_create_board_name(struct ath12k_base *ab, char *name,static int ath12k_core_create_board_name (struct ath12k_base *ab,char *name,size_t name_len) { -return __ath12k_core_create_board_name (ab, name, name_len, true, false); +return __ath12k_core_create_board_name (ab, name, name_len, true, false, false); }static int ath12k_core_create_fallback_board_name (struct ath12k_base *ab,char *name,size_t name_len) { -return __ath12k_core_create_board_name (ab, name, name_len, false, false); +return __ath12k_core_create_board_name (ab, name, name_len, false, false, true); }static int ath12k_core_create_bus_type_board_name (struct ath12k_base *ab,char *name,size_t name_len) { -return __ath12k_core_create_board_name (ab, name, name_len, false, true); +return __ath12k_core_create_board_name (ab, name, name_len, false, true, true); } const struct firmware *ath12k_core_firmware_request(struct ath12k_base *ab,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 597/642 drm/xe/pf: Move VFs reprovisioning to worker
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit a4d1c5d0b99b75263a5626d2e52d569db3844b33 ]
Since the GuC is reset during GT reset, we need to re-send the entire SR-IOV provisioning configuration to the GuC. But since this whole configuration is protected by the PF master mutex and we can't avoid making allocations under this mutex (like during LMEM provisioning), we can't do this reprovisioning from gt-reset path if we want to be reclaim-safe. Move VFs reprovisioning to a async worker that we will start from the gt-reset path.
--- drivers/gpu/drm/xe/xe_gt_sriov_pf.c | 43 +++++++++++++++++++++-- drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h | 10 ++++++ 2 files changed, 51 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_gt_sriov_pf.c +41 -2
@@ -15,7 +15,11 @@#include "xe_gt_sriov_pf_helpers.h" #include "xe_gt_sriov_pf_migration.h" #include "xe_gt_sriov_pf_service.h" +#include "xe_gt_sriov_printk.h" #include "xe_mmio.h" +#include "xe_pm.h" + +static void pf_worker_restart_func (struct work_struct *w);/* * VF's metadata is maintained in the flexible array where:
@@ -41,6 +45,11 @@ static int pf_alloc_metadata(struct xe_gt *gt)return 0 ; } +static void pf_init_workers (struct xe_gt *gt) +{ +INIT_WORK (>->sriov.pf.workers.restart, pf_worker_restart_func); +} +/** * xe_gt_sriov_pf_init_early - Prepare SR-IOV PF data structures on PF. * @gt: the &xe_gt to initialize
@@ -65,6 +74,8 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt)if (err)return err; +pf_init_workers (gt); +return 0 ; }
@@ -161,6 +172,35 @@ void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid)pf_clear_vf_scratch_regs (gt, vfid); } +static void pf_restart (struct xe_gt *gt) +{ +struct xe_device *xe =gt_to_xe (gt); + +xe_pm_runtime_get (xe); +xe_gt_sriov_pf_config_restart (gt); +xe_gt_sriov_pf_control_restart (gt); +xe_pm_runtime_put (xe); + +xe_gt_sriov_dbg (gt,"restart completed\n" ); +} + +static void pf_worker_restart_func (struct work_struct *w) +{ +struct xe_gt *gt =container_of (w,typeof (*gt), sriov.pf.workers.restart); + +pf_restart (gt); +} + +static void pf_queue_restart (struct xe_gt *gt) +{ +struct xe_device *xe =gt_to_xe (gt); + +xe_gt_assert (gt,IS_SRIOV_PF (xe)); + +if (!queue_work (xe->sriov.wq, >->sriov.pf.workers.restart)) +xe_gt_sriov_dbg (gt,"restart already in queue!\n" ); +} +/** * xe_gt_sriov_pf_restart - Restart SR-IOV support after a GT reset. * @gt: the &xe_gt
@@ -169,6 +209,5 @@ void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid)*/ void xe_gt_sriov_pf_restart (struct xe_gt *gt) { -xe_gt_sriov_pf_config_restart (gt); -xe_gt_sriov_pf_control_restart (gt); +pf_queue_restart (gt); }
drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h +10 -0
@@ -35,8 +35,17 @@ struct xe_gt_sriov_metadata {struct xe_gt_sriov_state_snapshot snapshot; }; +/** +* struct xe_gt_sriov_pf_workers - GT level workers used by the PF. +*/ +struct xe_gt_sriov_pf_workers { +/** @restart: worker that executes actions post GT reset */ +struct work_struct restart; +}; +/** * struct xe_gt_sriov_pf - GT level PF virtualization data. +* @workers: workers data. * @service: service data. * @control: control data. * @policy: policy data.
@@ -45,6 +54,7 @@ struct xe_gt_sriov_metadata {* @vfs: metadata for all VFs. */ struct xe_gt_sriov_pf { +struct xe_gt_sriov_pf_workers workers;struct xe_gt_sriov_pf_service service;struct xe_gt_sriov_pf_control control;struct xe_gt_sriov_pf_policy policy;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 598/642 wifi: ath12k: Fix end offset bit definition in monitor ring descriptor
In reply to Sasha LevinFrom: P Praneesh <[email protected]>
[ Upstream commit 6788a666000d600bd8f2e9f991cad9cc805e7f01 ]
End offset for the monitor destination ring descriptor is defined as 16 bits, while the firmware definition specifies only 12 bits. The remaining bits (bit 12 to bit 15) are reserved and may contain junk values, leading to invalid information retrieval. Fix this issue by updating the correct genmask values.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/hal_desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/hal_desc.h +1 -1
@@ -2968,7 +2968,7 @@ struct hal_mon_buf_ring {#define HAL_MON_DEST_COOKIE_BUF_ID GENMASK(17, 0) -#define HAL_MON_DEST_INFO0_END_OFFSET GENMASK(15, 0) +#define HAL_MON_DEST_INFO0_END_OFFSET GENMASK(11, 0)#define HAL_MON_DEST_INFO0_FLUSH_DETECTED BIT(16)#define HAL_MON_DEST_INFO0_END_OF_PPDU BIT(17)#define HAL_MON_DEST_INFO0_INITIATOR BIT(18)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 599/642 wifi: ath12k: report station mode receive rate for IEEE 802.11be
In reply to Sasha LevinFrom: Lingbo Kong <[email protected]>
[ Upstream commit 5e73276c814fc1a5a1bce6be743e1a07baa6d4bc ]
Currently, the receive rate of EHT of "iw dev xxx station dump" command always show an invalid value.
This is because ath12k does not pass information about the rx_status of EHT to mac80211. So, mac80211 not calculate the receive rate.
To address this issue, add logic for handling rx_status of EHT to the ath12k_dp_rx_h_rate() function.
After that, "iw dev xxx station dump" show the correct receive rate. Such as:
Station 00:03:7f:12:03:03 (on wlo1)
inactive time: 48 ms
rx bytes: 59226
rx packets: 320
tx bytes: 26556
tx packets: 191
tx retries: 99
tx failed: 0
beacon loss: 0
beacon rx: 79
rx drop misc: 68
signal: -95 dBm beacon signal avg: -20 dBm
tx bitrate: 688.2 MBit/s 40MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0
tx duration: 0 us
rx bitrate: 619.5 MBit/s 40MHz EHT-MCS 8 EHT-NSS 3 EHT-GI 0
This patch affects the station mode of WCN7850 and QCN9274.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp_rx.c | 22 ++++++++++++++++++++-- drivers/net/wireless/ath/ath12k/rx_desc.h | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/dp_rx.c +20 -2
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/ieee80211.h>
@@ -2392,6 +2392,23 @@ static void ath12k_dp_rx_h_rate(struct ath12k *ar, struct hal_rx_desc *rx_desc, rx_status->he_gi =ath12k_he_gi_to_nl80211_he_gi (sgi); rx_status->bw =ath12k_mac_bw_to_mac80211_bw (bw);break ; +case RX_MSDU_START_PKT_TYPE_11BE : + rx_status->rate_idx = rate_mcs; + +if (rate_mcs >ATH12K_EHT_MCS_MAX ) { +ath12k_warn (ar->ab, +"Received with invalid mcs in EHT mode %d\n" , + rate_mcs); +break ; + } + + rx_status->encoding =RX_ENC_EHT ; + rx_status->nss = nss; + rx_status->eht.gi =ath12k_mac_eht_gi_to_nl80211_eht_gi (sgi); + rx_status->bw =ath12k_mac_bw_to_mac80211_bw (bw); +break ; +default : +break ; } }
@@ -2486,7 +2503,7 @@ static void ath12k_dp_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *napspin_unlock_bh (&ab->base_lock); ath12k_dbg(ab, ATH12K_DBG_DATA, - "rx skb %p len %u peer %pM %d %s sn %u %s%s%s%s%s%s%s%s%s rate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", + "rx skb %p len %u peer %pM %d %s sn %u %s%s%s%s%s%s%s%s%s%s rate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", msdu, msdu->len, peer ? peer->addr : NULL,
@@ -2497,6 +2514,7 @@ static void ath12k_dp_rx_deliver_msdu(struct ath12k *ar, struct napi_struct *nap (status->encoding ==RX_ENC_HT ) ?"ht" :"" , (status->encoding ==RX_ENC_VHT ) ?"vht" :"" , (status->encoding ==RX_ENC_HE ) ?"he" :"" , + (status->encoding ==RX_ENC_EHT ) ?"eht" :"" , (status->bw ==RATE_INFO_BW_40 ) ?"40" :"" , (status->bw ==RATE_INFO_BW_80 ) ?"80" :"" , (status->bw == RATE_INFO_BW_160) ? "160" : "",
drivers/net/wireless/ath/ath12k/rx_desc.h +2 -0
@@ -637,6 +637,8 @@ enum rx_msdu_start_pkt_type {RX_MSDU_START_PKT_TYPE_11N ,RX_MSDU_START_PKT_TYPE_11AC ,RX_MSDU_START_PKT_TYPE_11AX , +RX_MSDU_START_PKT_TYPE_11BA , + RX_MSDU_START_PKT_TYPE_11BE, }; enum rx_msdu_start_sgi {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 600/642 wifi: ath12k: report station mode transmit rate
In reply to Sasha LevinFrom: Lingbo Kong <[email protected]>
[ Upstream commit 8a9c06b40882ebea45563059ddc5d57acdec9dda ]
Currently, the transmit rate of "iw dev xxx station dump" command always show an invalid value.
To address this issue, ath12k parse the info of transmit complete report from firmware and indicate the transmit rate to mac80211.
This patch affects the station mode of WCN7850 and QCN9274.
After that, "iw dev xxx station dump" show the correct transmit rate. Such as:
Station 00:03:7f:12:03:03 (on wlo1)
inactive time: 872 ms
rx bytes: 219111
rx packets: 1133
tx bytes: 53767
tx packets: 462
tx retries: 51
tx failed: 0
beacon loss: 0
beacon rx: 403
rx drop misc: 74
signal: -95 dBm beacon signal avg: -18 dBm
tx bitrate: 1441.1 MBit/s 80MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/core.h | 2 + drivers/net/wireless/ath/ath12k/dp_rx.h | 5 +- drivers/net/wireless/ath/ath12k/dp_tx.c | 139 +++++++++++++++++++++- drivers/net/wireless/ath/ath12k/hal_rx.h | 5 +- drivers/net/wireless/ath/ath12k/hal_tx.h | 10 +- drivers/net/wireless/ath/ath12k/mac.c | 79 ++++++++++++ drivers/net/wireless/ath/ath12k/mac.h | 5 +- drivers/net/wireless/ath/ath12k/rx_desc.h | 3 +- 8 files changed, 238 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +2 -0
@@ -87,6 +87,7 @@ enum wme_ac {#define ATH12K_HT_MCS_MAX 7#define ATH12K_VHT_MCS_MAX 9#define ATH12K_HE_MCS_MAX 11 +#define ATH12K_EHT_MCS_MAX 15enum ath12k_crypt_mode {/* Only use hardware crypto engine */
@@ -501,6 +502,7 @@ struct ath12k_link_sta {struct ath12k_rx_peer_stats *rx_stats;struct ath12k_wbm_tx_stats *wbm_tx_stats;u32 bw_prev; +u32 peer_nss;/* For now the assoc link will be considered primary */ bool is_assoc_link;
drivers/net/wireless/ath/ath12k/dp_rx.h +4 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_DP_RX_H #define ATH12K_DP_RX_H
@@ -79,6 +79,9 @@ static inline u32 ath12k_he_gi_to_nl80211_he_gi(u8 sgi)case RX_MSDU_START_SGI_3_2_US : ret =NL80211_RATE_INFO_HE_GI_3_2 ;break ; +default : + ret =NL80211_RATE_INFO_HE_GI_0_8 ; +break ; }return ret;
drivers/net/wireless/ath/ath12k/dp_tx.c +135 -4
169 lines not on this page · raw message
drivers/net/wireless/ath/ath12k/hal_rx.h +4 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_HAL_RX_H
@@ -666,6 +666,9 @@ enum nl80211_he_ru_alloc ath12k_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones)case RU_996 : ret =NL80211_RATE_INFO_HE_RU_ALLOC_996 ;break ; +case RU_2X996 : + ret = NL80211_RATE_INFO_HE_RU_ALLOC_2x996; +break ;case RU_26 : fallthrough;default :
drivers/net/wireless/ath/ath12k/hal_tx.h +8 -2
@@ -1,7 +1,8 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. +* All rights reserved. */ #ifndef ATH12K_HAL_TX_H
@@ -63,7 +64,12 @@ struct hal_tx_status {u8 try_cnt;u8 tid;u16 peer_id; -u32 rate_stats; +enum hal_tx_rate_stats_pkt_type pkt_type; +enum hal_tx_rate_stats_sgi sgi; +enum ath12k_supported_bw bw; +u8 mcs; +u16 tones; +u8 ofdma; };#define HAL_TX_PHY_DESC_INFO0_BF_TYPE GENMASK(17, 16)
drivers/net/wireless/ath/ath12k/mac.c +79 -0
97 lines not on this page · raw message
drivers/net/wireless/ath/ath12k/mac.h +4 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_MAC_H
@@ -108,5 +108,8 @@ int ath12k_mac_vdev_stop(struct ath12k_link_vif *arvif);void ath12k_mac_get_any_chanctx_conf_iter (struct ieee80211_hw *hw,struct ieee80211_chanctx_conf *conf,void *data); +u16 ath12k_mac_he_convert_tones_to_ru_tones (u16 tones); +enum nl80211_eht_ru_alloc ath12k_mac_eht_ru_tones_to_nl80211_eht_ru_alloc (u16 ru_tones); +enum nl80211_eht_gi ath12k_mac_eht_gi_to_nl80211_eht_gi (u8 sgi);#endif
drivers/net/wireless/ath/ath12k/rx_desc.h +2 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_RX_DESC_H #define ATH12K_RX_DESC_H
@@ -1548,5 +1548,6 @@ struct hal_rx_desc {#define RU_242 9#define RU_484 18#define RU_996 37 +#define RU_2X996 74#endif /* ATH12K_RX_DESC_H */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 601/642 ASoC: hdmi-codec: allow to refine formats actually supported
In reply to Sasha LevinFrom: Olivier Moysan <[email protected]>
[ Upstream commit 038f79638e0676359e44c5db458d52994f9b5ac1 ]
Currently the hdmi-codec driver registers all the formats that are allowed on the I2S bus. Add i2s_formats field to codec data, to allow the hdmi codec client to refine the list of the audio I2S formats actually supported.
--- include/sound/hdmi-codec.h | 1 + sound/soc/codecs/hdmi-codec.c | 4 ++++ 2 files changed, 5 insertions(+)
include/sound/hdmi-codec.h +1 -0
@@ -120,6 +120,7 @@ struct hdmi_codec_ops {/* HDMI codec initalization data */ struct hdmi_codec_pdata {const struct hdmi_codec_ops *ops; +u64 i2s_formats;uint i2s:1 ;uint no_i2s_playback:1 ;uint no_i2s_capture:1 ;
sound/soc/codecs/hdmi-codec.c +4 -0
@@ -1077,6 +1077,10 @@ static int hdmi_codec_probe(struct platform_device *pdev)if (hcd->i2s) { daidrv[i] = hdmi_i2s_dai; daidrv[i].playback.channels_max = hcd->max_i2s_channels; +if (hcd->i2s_formats) { + daidrv[i].playback.formats = hcd->i2s_formats; + daidrv[i].capture.formats = hcd->i2s_formats; + }if (hcd->no_i2s_playback)memset (&daidrv[i].playback,0 ,sizeof (daidrv[i].playback));
Signature · 1 line
2.39.5
Mark Brown
maintainerRe: [PATCH AUTOSEL 6.14 601/642] ASoC: hdmi-codec: allow to refine formats actually supported
Quoted 8 lines · Sasha Levin
From: Olivier Moysan <[email protected]>
[ Upstream commit
038f79638e0676359e44c5db458d52994f9b5ac1]Currently the hdmi-codec driver registers all the formats that are allowed on the I2S bus. Add
i2s_formatsfield to codec data, to allow the hdmi codec client to refine the list of the audio I2S formats actually supported.
This is clearly a new feature which won't do anything without further work in the drivers.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 601/642] ASoC: hdmi-codec: allow to refine formats actually supported
Quoted 5 lines · Mark Brown
Quoted 4 lines · Sasha Levin
From: Olivier Moysan <[email protected]>
[ Upstream commit
038f79638e0676359e44c5db458d52994f9b5ac1]
Quoted 7 lines
Quoted 4 lines
Currently the hdmi-codec driver registers all the formats that are allowed on the I2S bus. Add
i2s_formatsfield to codec data, to allow the hdmi codec client to refine the list of the audio I2S formats actually supported.This is clearly a new feature which won't do anything without further work in the drivers.
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 602/642 drm: bridge: adv7511: fill stream capabilities
In reply to Sasha LevinFrom: Olivier Moysan <[email protected]>
[ Upstream commit c852646f12d4cd5b4f19eeec2976c5d98c0382f8 ]
Set no_i2s_capture and no_spdif_capture flags in hdmi_codec_pdata structure to report that the ADV7511 HDMI bridge does not support i2s or spdif audio capture.
--- drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +2 -0
@@ -245,7 +245,9 @@ static const struct hdmi_codec_pdata codec_data = { .ops = &adv7511_codec_ops, .max_i2s_channels = 2, .i2s = 1, + .no_i2s_capture = 1, .spdif = 1, + .no_spdif_capture = 1, };int adv7511_audio_init (struct device *dev,struct adv7511 *adv7511)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 603/642 drm/nouveau: fix the broken marco GSP_MSG_MAX_SIZE
In reply to Sasha LevinFrom: Zhi Wang <[email protected]>
[ Upstream commit bbae6680cfe38b033250b483722e60ccd865976f ]
The macro GSP_MSG_MAX_SIZE refers to another macro that doesn't exist. It represents the max GSP message element size.
Fix the broken marco so it can be used to replace some magic numbers in the code.
--- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1 -1
@@ -61,7 +61,7 @@extern struct dentry *nouveau_debugfs_root;#define GSP_MSG_MIN_SIZE GSP_PAGE_SIZE -#define GSP_MSG_MAX_SIZE GSP_PAGE_MIN_SIZE * 16 +#define GSP_MSG_MAX_SIZE (GSP_MSG_MIN_SIZE * 16)struct r535_gsp_msg {u8 auth_tag_buffer[16 ];
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 604/642 wifi: ath11k: Use dma_alloc_noncoherent for rx_tid buffer allocation
In reply to Sasha LevinFrom: P Praneesh <[email protected]>
[ Upstream commit eeadc6baf8b3dcd32787cc84f0473dc2a2850370 ]
Currently, the driver allocates cacheable DMA buffers for the rx_tid structure using kzalloc() and dma_map_single(). These buffers are long-lived and can persist for the lifetime of the peer, which is not advisable. Instead of using kzalloc() and dma_map_single() for allocating cacheable DMA buffers, utilize the dma_alloc_noncoherent() helper for the allocation of long-lived cacheable DMA buffers, such as the peer's rx_tid. Since dma_alloc_noncoherent() returns unaligned physical and virtual addresses, align them internally before use within the driver. This ensures proper allocation of non-coherent memory through the kernel helper.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
--- drivers/net/wireless/ath/ath11k/dp.h | 6 +- drivers/net/wireless/ath/ath11k/dp_rx.c | 117 +++++++++++------------- 2 files changed, 58 insertions(+), 65 deletions(-)
drivers/net/wireless/ath/ath11k/dp.h +4 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH11K_DP_H
@@ -20,7 +20,6 @@ struct ath11k_ext_irq_grp;struct dp_rx_tid {u8 tid; -u32 *vaddr;dma_addr_t paddr;u32 size;u32 ba_win_sz;
@@ -37,6 +36,9 @@ struct dp_rx_tid {/* Timer info related to fragments */ struct timer_list frag_timer;struct ath11k_base *ab; +u32 *vaddr_unaligned; +dma_addr_t paddr_unaligned; +u32 unaligned_size; };#define DP_REO_DESC_FREE_THRESHOLD 64
drivers/net/wireless/ath/ath11k/dp_rx.c +54 -63
196 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 605/642 drm/ast: Hide Gens 1 to 3 TX detection in branch
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit 87478ba50a05a1f44508316ae109622e8a85adc9 ]
Gen7 only supports ASTDP. Gens 4 to 6 support various TX chips, except ASTDP. These boards detect the TX chips by reading the SoC scratch register as VGACRD1.
Gens 1 to 3 only support SIL164. These boards read the DVO bit from VGACRA3. Hence move this test behind a branch, so that it does not run on later generations.
--- drivers/gpu/drm/ast/ast_main.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/ast/ast_main.c +15 -15
@@ -96,21 +96,21 @@ static void ast_detect_tx_chip(struct ast_device *ast, bool need_post)/* Check 3rd Tx option (digital output afaik) */ ast->tx_chip =AST_TX_NONE ; -/* -* VGACRA3 Enhanced Color Mode Register, check if DVO is already -* enabled, in that case, assume we have a SIL164 TMDS transmitter -* -* Don't make that assumption if we the chip wasn't enabled and -* is at power-on reset, otherwise we'll incorrectly "detect" a -* SIL164 when there is none. -*/ -if (!need_post) { - jreg =ast_get_index_reg_mask (ast,AST_IO_VGACRI ,0xa3 ,0xff ); -if (jreg &0x80 ) - ast->tx_chip =AST_TX_SIL164 ; - } - -if (IS_AST_GEN4 (ast) ||IS_AST_GEN5 (ast) ||IS_AST_GEN6 (ast)) { +if (AST_GEN (ast) <=3 ) { +/* +* VGACRA3 Enhanced Color Mode Register, check if DVO is already +* enabled, in that case, assume we have a SIL164 TMDS transmitter +* +* Don't make that assumption if we the chip wasn't enabled and +* is at power-on reset, otherwise we'll incorrectly "detect" a +* SIL164 when there is none. +*/ +if (!need_post) { + jreg =ast_get_index_reg_mask (ast,AST_IO_VGACRI ,0xa3 ,0xff ); +if (jreg &0x80 ) + ast->tx_chip =AST_TX_SIL164 ; + } + }else if (IS_AST_GEN4 (ast) ||IS_AST_GEN5 (ast) ||IS_AST_GEN6 (ast)) {/* * On AST GEN4+, look the configuration set by the SoC in * the SOC scratch register #1 bits 11:8 (interestingly marked
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 606/642 drm/xe: Move suballocator init to after display init
In reply to Sasha LevinFrom: Maarten Lankhorst <[email protected]>
[ Upstream commit 380b0cdaa76bc8f5c16db16eaf48751e792ff041 ]
No allocations should be done before we have had a chance to preserve the display fb.
--- drivers/gpu/drm/xe/xe_device.c | 6 ++++++ drivers/gpu/drm/xe/xe_tile.c | 12 ++++++++---- drivers/gpu/drm/xe/xe_tile.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_device.c +6 -0
@@ -736,6 +736,12 @@ int xe_device_probe(struct xe_device *xe)if (err) goto err; +for_each_tile (tile, xe, id) { + err =xe_tile_init (tile); +if (err) + goto err; + } +for_each_gt (gt, xe, id) { last_gt = id;
drivers/gpu/drm/xe/xe_tile.c +8 -4
@@ -170,15 +170,19 @@ int xe_tile_init_noalloc(struct xe_tile *tile)if (err)return err; - tile->mem.kernel_bb_pool =xe_sa_bo_manager_init (tile,SZ_1M ,16 ); -if (IS_ERR (tile->mem.kernel_bb_pool)) -return PTR_ERR (tile->mem.kernel_bb_pool); -xe_wa_apply_tile_workarounds (tile);return xe_tile_sysfs_init (tile); } +int xe_tile_init (struct xe_tile *tile) +{ + tile->mem.kernel_bb_pool =xe_sa_bo_manager_init (tile,SZ_1M ,16 ); +if (IS_ERR (tile->mem.kernel_bb_pool)) +return PTR_ERR (tile->mem.kernel_bb_pool); + +return 0 ; +}void xe_tile_migrate_wait (struct xe_tile *tile) {xe_migrate_wait (tile->migrate);
drivers/gpu/drm/xe/xe_tile.h +1 -0
@@ -12,6 +12,7 @@ struct xe_tile;int xe_tile_init_early (struct xe_tile *tile,struct xe_device *xe,u8 id);int xe_tile_init_noalloc (struct xe_tile *tile); +int xe_tile_init (struct xe_tile *tile);void xe_tile_migrate_wait (struct xe_tile *tile);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 607/642 drm/xe: Do not attempt to bootstrap VF in execlists mode
In reply to Sasha LevinFrom: Maarten Lankhorst <[email protected]>
[ Upstream commit f3b59457808f61d88178b0afa67cbd017d7ce79e ]
It was mentioned in a review that there is a possibility of choosing to load the module with VF in execlists mode.
Of course this doesn't work, just bomb out as hard as possible.
--- drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/xe_gt_sriov_vf.c +3 -0
@@ -236,6 +236,9 @@ int xe_gt_sriov_vf_bootstrap(struct xe_gt *gt) {int err; +if (!xe_device_uc_enabled (gt_to_xe (gt))) +return -ENODEV ; + err =vf_reset_guc_state (gt);if (unlikely (err))return err;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 608/642 wifi: rtw89: coex: Separated Wi-Fi connecting event from Wi-Fi scan event
In reply to Sasha LevinFrom: Ching-Te Ku <[email protected]>
[ Upstream commit 4a57346652154bb339c48b41166df9154cff33f5 ]
Wi-Fi connecting process don't need to assign to firmware slot control, if assign firmware slot control for Wi-Fi connecting event, firmware will not toggle slots because driver don't tell the slot schedule to firmware. Wi-Fi connecting event end should also cancel the 4way handshake status.
--- drivers/net/wireless/realtek/rtw89/coex.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +6 -2
@@ -5406,7 +5406,8 @@ static void _action_wl_scan(struct rtw89_dev *rtwdev)struct rtw89_btc_wl_info *wl = &btc->cx.wl;struct rtw89_btc_wl_dbcc_info *wl_dinfo = &wl->dbcc_info; -if (RTW89_CHK_FW_FEATURE (SCAN_OFFLOAD , &rtwdev->fw)) { +if (btc->cx.state_map !=BTC_WLINKING && +RTW89_CHK_FW_FEATURE (SCAN_OFFLOAD , &rtwdev->fw)) {_action_wl_25g_mcc (rtwdev);rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC], Scan offload!\n" ); }else if (rtwdev->dbcc_en) {
@@ -7221,6 +7222,8 @@ void rtw89_btc_ntfy_scan_finish(struct rtw89_dev *rtwdev, u8 phy_idx)_fw_set_drv_info (rtwdev,CXDRVINFO_DBCC ); } + btc->dm.tdma_instant_excute =1 ; +_run_coex (rtwdev,BTC_RSN_NTFY_SCAN_FINISH ); }
@@ -7669,7 +7672,8 @@ void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev,else wl->status.map.connecting =0 ; -if (state ==BTC_ROLE_MSTS_STA_DIS_CONN ) +if (state ==BTC_ROLE_MSTS_STA_DIS_CONN || + state ==BTC_ROLE_MSTS_STA_CONN_END ) wl->status.map._4way = false;_run_coex (rtwdev,BTC_RSN_NTFY_ROLE_INFO );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 609/642 wifi: rtw89: coex: Add protect to avoid A2DP lag while Wi-Fi connecting
In reply to Sasha LevinFrom: Ching-Te Ku <[email protected]>
[ Upstream commit 5251fd321684b591245a072b765d01a6c22a112c ]
To get a well Wi-Fi RF quality, Wi-Fi need to do RF calibrations. While Wi-Fi is doing RF calibrations, driver will pause the Bluetooth traffic to make sure the RF calibration will not be interfered by Bluetooth. However, if the RF calibrations take too much time, Bluetooth audio will perform a lag sound. Add a function to make Bluetooth can do traffic between the individual calibrations to avoid Bluetooth sound lag. And patch related A2DP coexistence mechanism actions.
--- drivers/net/wireless/realtek/rtw89/coex.c | 90 +++++++++++-------- drivers/net/wireless/realtek/rtw89/coex.h | 2 + drivers/net/wireless/realtek/rtw89/core.h | 3 +- drivers/net/wireless/realtek/rtw89/rtw8851b.c | 6 ++ drivers/net/wireless/realtek/rtw89/rtw8852a.c | 6 ++ drivers/net/wireless/realtek/rtw89/rtw8852b.c | 6 ++ .../net/wireless/realtek/rtw89/rtw8852bt.c | 6 ++ drivers/net/wireless/realtek/rtw89/rtw8852c.c | 6 ++ 8 files changed, 85 insertions(+), 40 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +51 -39
@@ -4587,17 +4587,16 @@ static void _action_bt_a2dp(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); +if (a2dp.vendor_id ==0x4c || dm->leak_ap || bt_linfo->slave_role) + dm->slot_dur[CXST_W1 ] =20 ; +else + dm->slot_dur[CXST_W1 ] =40 ; + + dm->slot_dur[CXST_B1 ] =BTC_B1_MAX ; +switch (btc->cx.state_map) {case BTC_WBUSY_BNOSCAN :/* wl-busy + bt-A2DP */ -if (a2dp.vendor_id ==0x4c || dm->leak_ap) { - dm->slot_dur[CXST_W1 ] =40 ; - dm->slot_dur[CXST_B1 ] =200 ; -_set_policy (rtwdev, -BTC_CXP_PAUTO_TDW1B1 ,BTC_ACT_BT_A2DP ); - }else { -_set_policy (rtwdev, -BTC_CXP_PAUTO_TD50B1 ,BTC_ACT_BT_A2DP ); - } +_set_policy (rtwdev,BTC_CXP_PAUTO_TDW1B1 ,BTC_ACT_BT_A2DP );break ;case BTC_WBUSY_BSCAN :/* wl-busy + bt-inq + bt-A2DP */ _set_policy (rtwdev,BTC_CXP_PAUTO2_TD3050 ,BTC_ACT_BT_A2DP );
@@ -4607,15 +4606,10 @@ static void _action_bt_a2dp(struct rtw89_dev *rtwdev)break ;case BTC_WSCAN_BNOSCAN :/* wl-scan + bt-A2DP */ case BTC_WLINKING :/* wl-connecting + bt-A2DP */ -if (a2dp.vendor_id ==0x4c || dm->leak_ap) { - dm->slot_dur[CXST_W1 ] =40 ; - dm->slot_dur[CXST_B1 ] =200 ; -_set_policy (rtwdev,BTC_CXP_AUTO_TDW1B1 , -BTC_ACT_BT_A2DP ); - }else { -_set_policy (rtwdev,BTC_CXP_AUTO_TD50B1 , -BTC_ACT_BT_A2DP ); - } +if (btc->cx.wl.rfk_info.con_rfk) +_set_policy (rtwdev,BTC_CXP_OFF_BT ,BTC_ACT_BT_A2DP ); +else +_set_policy (rtwdev,BTC_CXP_AUTO_TDW1B1 ,BTC_ACT_BT_A2DP );break ;case BTC_WIDLE :/* wl-idle + bt-A2DP */ _set_policy (rtwdev,BTC_CXP_AUTO_TD20B1 ,BTC_ACT_BT_A2DP );
@@ -4643,7 +4637,10 @@ static void _action_bt_a2dpsink(struct rtw89_dev *rtwdev)_set_policy (rtwdev,BTC_CXP_FIX_TD2060 ,BTC_ACT_BT_A2DPSINK );break ;case BTC_WLINKING :/* wl-connecting + bt-A2dp_Sink */ -_set_policy (rtwdev,BTC_CXP_FIX_TD3030 ,BTC_ACT_BT_A2DPSINK ); +if (btc->cx.wl.rfk_info.con_rfk) +_set_policy (rtwdev,BTC_CXP_OFF_BT ,BTC_ACT_BT_A2DPSINK ); +else +_set_policy (rtwdev,BTC_CXP_FIX_TD3030 ,BTC_ACT_BT_A2DPSINK );break ;case BTC_WIDLE :/* wl-idle + bt-A2dp_Sink */ _set_policy (rtwdev,BTC_CXP_FIX_TD2080 ,BTC_ACT_BT_A2DPSINK );
@@ -4697,21 +4694,20 @@ static void _action_bt_a2dp_hid(struct rtw89_dev *rtwdev)_set_ant (rtwdev,NM_EXEC ,BTC_PHY_ALL ,BTC_ANT_W2G ); +if (a2dp.vendor_id ==0x4c || dm->leak_ap || bt_linfo->slave_role) + dm->slot_dur[CXST_W1 ] =20 ; +else + dm->slot_dur[CXST_W1 ] =40 ; + + dm->slot_dur[CXST_B1 ] =BTC_B1_MAX ; +switch (btc->cx.state_map) {case BTC_WBUSY_BNOSCAN :/* wl-busy + bt-A2DP+HID */ case BTC_WIDLE :/* wl-idle + bt-A2DP */ -if (a2dp.vendor_id ==0x4c || dm->leak_ap) { - dm->slot_dur[CXST_W1 ] =40 ; - dm->slot_dur[CXST_B1 ] =200 ; -_set_policy (rtwdev, -BTC_CXP_PAUTO_TDW1B1 ,BTC_ACT_BT_A2DP_HID ); - }else { -_set_policy (rtwdev, -BTC_CXP_PAUTO_TD50B1 ,BTC_ACT_BT_A2DP_HID ); - } +_set_policy (rtwdev,BTC_CXP_PAUTO_TDW1B1 ,BTC_ACT_BT_A2DP_HID );break ;case BTC_WBUSY_BSCAN :/* wl-busy + bt-inq + bt-A2DP+HID */ -_set_policy (rtwdev,BTC_CXP_PAUTO2_TD3050 ,BTC_ACT_BT_A2DP_HID ); +_set_policy (rtwdev,BTC_CXP_PAUTO2_TD3070 ,BTC_ACT_BT_A2DP_HID );break ;case BTC_WSCAN_BSCAN :/* wl-scan + bt-inq + bt-A2DP+HID */
@@ -4719,15 +4715,10 @@ static void _action_bt_a2dp_hid(struct rtw89_dev *rtwdev)break ;case BTC_WSCAN_BNOSCAN :/* wl-scan + bt-A2DP+HID */ case BTC_WLINKING :/* wl-connecting + bt-A2DP+HID */ -if (a2dp.vendor_id ==0x4c || dm->leak_ap) { - dm->slot_dur[CXST_W1 ] =40 ; - dm->slot_dur[CXST_B1 ] =200 ; -_set_policy (rtwdev,BTC_CXP_AUTO_TDW1B1 , -BTC_ACT_BT_A2DP_HID ); - }else { -_set_policy (rtwdev,BTC_CXP_AUTO_TD50B1 , -BTC_ACT_BT_A2DP_HID ); - } +if (btc->cx.wl.rfk_info.con_rfk) +_set_policy (rtwdev,BTC_CXP_OFF_BT ,BTC_ACT_BT_A2DP_HID ); +else +_set_policy (rtwdev,BTC_CXP_AUTO_TDW1B1 ,BTC_ACT_BT_A2DP_HID );break ; } }
@@ -7001,7 +6992,7 @@ void _run_coex(struct rtw89_dev *rtwdev, enum btc_reason_and_action reason) goto exit; } -if (wl->status.val & btc_scanning_map.val) { +if (wl->status.val & btc_scanning_map.val && !wl->rfk_info.con_rfk) {_action_wl_scan (rtwdev); bt->scan_rx_low_pri = true; goto exit;
@@ -11040,3 +11031,24 @@ void rtw89_coex_recognize_ver(struct rtw89_dev *rtwdev)rtw89_debug (rtwdev,RTW89_DBG_BTC ,"[BTC] use version def[%d] = 0x%08x\n" , (int )(btc->ver - rtw89_btc_ver_defs), btc->ver->fw_ver_code); } + +void rtw89_btc_ntfy_preserve_bt_time (struct rtw89_dev *rtwdev,u32 ms) +{ +struct rtw89_btc_bt_link_info *bt_linfo = &rtwdev->btc.cx.bt.link_info; +struct rtw89_btc_bt_a2dp_desc a2dp = bt_linfo->a2dp_desc; + +if (test_bit (RTW89_FLAG_SER_HANDLING , rtwdev->flags)) +return ; + +if (!a2dp.exist) +return ; + +fsleep (ms *1000 ); +} +EXPORT_SYMBOL (rtw89_btc_ntfy_preserve_bt_time); + +void rtw89_btc_ntfy_conn_rfk (struct rtw89_dev *rtwdev,bool state) +{ + rtwdev->btc.cx.wl.rfk_info.con_rfk = state; +} +EXPORT_SYMBOL (rtw89_btc_ntfy_conn_rfk);
drivers/net/wireless/realtek/rtw89/coex.h +2 -0
@@ -290,6 +290,8 @@ void rtw89_coex_power_on(struct rtw89_dev *rtwdev);void rtw89_btc_set_policy (struct rtw89_dev *rtwdev,u16 policy_type);void rtw89_btc_set_policy_v1 (struct rtw89_dev *rtwdev,u16 policy_type);void rtw89_coex_recognize_ver (struct rtw89_dev *rtwdev); +void rtw89_btc_ntfy_preserve_bt_time (struct rtw89_dev *rtwdev,u32 ms); +void rtw89_btc_ntfy_conn_rfk (struct rtw89_dev *rtwdev,bool state); static inline u8 rtw89_btc_phymap(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
drivers/net/wireless/realtek/rtw89/core.h +2 -1
@@ -1762,7 +1762,8 @@ struct rtw89_btc_wl_rfk_info { u32 phy_map: 2; u32 band: 2; u32 type: 8; - u32 rsvd: 14; + u32 con_rfk: 1; + u32 rsvd: 13;u32 start_time;u32 proc_time;
drivers/net/wireless/realtek/rtw89/rtw8851b.c +6 -0
@@ -1596,10 +1596,16 @@ static void rtw8851b_rfk_channel(struct rtw89_dev *rtwdev,enum rtw89_chanctx_idx chanctx_idx = rtwvif_link->chanctx_idx;enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx; +rtw89_btc_ntfy_conn_rfk (rtwdev, true); +rtw8851b_rx_dck (rtwdev, phy_idx, chanctx_idx);rtw8851b_iqk (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8851b_tssi (rtwdev, phy_idx, true, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8851b_dpk (rtwdev, phy_idx, chanctx_idx); + +rtw89_btc_ntfy_conn_rfk (rtwdev, false); } static void rtw8851b_rfk_band_changed(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/rtw8852a.c +6 -0
@@ -1356,10 +1356,16 @@ static void rtw8852a_rfk_channel(struct rtw89_dev *rtwdev,enum rtw89_chanctx_idx chanctx_idx = rtwvif_link->chanctx_idx;enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx; +rtw89_btc_ntfy_conn_rfk (rtwdev, true); +rtw8852a_rx_dck (rtwdev, phy_idx, true, chanctx_idx);rtw8852a_iqk (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852a_tssi (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852a_dpk (rtwdev, phy_idx, chanctx_idx); + +rtw89_btc_ntfy_conn_rfk (rtwdev, false); } static void rtw8852a_rfk_band_changed(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/rtw8852b.c +6 -0
@@ -568,10 +568,16 @@ static void rtw8852b_rfk_channel(struct rtw89_dev *rtwdev,enum rtw89_chanctx_idx chanctx_idx = rtwvif_link->chanctx_idx;enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx; +rtw89_btc_ntfy_conn_rfk (rtwdev, true); +rtw8852b_rx_dck (rtwdev, phy_idx, chanctx_idx);rtw8852b_iqk (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852b_tssi (rtwdev, phy_idx, true, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852b_dpk (rtwdev, phy_idx, chanctx_idx); + +rtw89_btc_ntfy_conn_rfk (rtwdev, false); } static void rtw8852b_rfk_band_changed(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/rtw8852bt.c +6 -0
@@ -541,10 +541,16 @@ static void rtw8852bt_rfk_channel(struct rtw89_dev *rtwdev,enum rtw89_chanctx_idx chanctx_idx = rtwvif_link->chanctx_idx;enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx; +rtw89_btc_ntfy_conn_rfk (rtwdev, true); +rtw8852bt_rx_dck (rtwdev, phy_idx, chanctx_idx);rtw8852bt_iqk (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852bt_tssi (rtwdev, phy_idx, true, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852bt_dpk (rtwdev, phy_idx, chanctx_idx); + +rtw89_btc_ntfy_conn_rfk (rtwdev, false); } static void rtw8852bt_rfk_band_changed(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/rtw8852c.c +6 -0
@@ -1853,10 +1853,16 @@ static void rtw8852c_rfk_channel(struct rtw89_dev *rtwdev,enum rtw89_phy_idx phy_idx = rtwvif_link->phy_idx;rtw8852c_mcc_get_ch_info (rtwdev, phy_idx); +rtw89_btc_ntfy_conn_rfk (rtwdev, true); +rtw8852c_rx_dck (rtwdev, phy_idx, false);rtw8852c_iqk (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852c_tssi (rtwdev, phy_idx, chanctx_idx); +rtw89_btc_ntfy_preserve_bt_time (rtwdev,30 );rtw8852c_dpk (rtwdev, phy_idx, chanctx_idx); + +rtw89_btc_ntfy_conn_rfk (rtwdev, false);rtw89_fw_h2c_rf_ntfy_mcc (rtwdev); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 610/642 drm/xe/sa: Always call drm_suballoc_manager_fini()
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit 9cd3f4efc870463f17f6c29114c61fb6bfcaa291 ]
After successful call to drm_suballoc_manager_init() we should make sure to call drm_suballoc_manager_fini() as it may include some cleanup code even if we didn't start using it for real.
As we can abort init() early due to kvzalloc() failure, we should either explicitly call drm_suballoc_manager_fini() or, even better, postpone drm_suballoc_manager_init() once we finish all other preparation steps, so we can rely on fini() that will do cleanup.
--- drivers/gpu/drm/xe/xe_sa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_sa.c +1 -2
@@ -57,8 +57,6 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32 } sa_manager->bo = bo; sa_manager->is_iomem = bo->vmap.is_iomem; - -drm_suballoc_manager_init (&sa_manager->base, managed_size, align); sa_manager->gpu_addr =xe_bo_ggtt_addr (bo);if (bo->vmap.is_iomem) {
@@ -72,6 +70,7 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32memset (sa_manager->cpu_ptr,0 , bo->ttm.base.size); } +drm_suballoc_manager_init (&sa_manager->base, managed_size, align); ret =drmm_add_action_or_reset (&xe->drm, xe_sa_bo_manager_fini, sa_manager);if (ret)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 611/642 drm/xe/vf: Perform early GT MMIO initialization to read GMDID
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit 13265fe7426ec9ba5aa86baab913417ca361e8a4 ]
VFs need to communicate with the GuC to obtain the GMDID value and existing GuC functions used for that assume that the GT has it's MMIO members already setup. However, due to recent refactoring the gt->mmio is initialized later, and any attempt by the VF to use xe_mmio_read|write() from GuC functions will lead to NPD crash due to unset MMIO register address:
[] xe 0000:00:02.1: [drm] Running in SR-IOV VF mode
[] xe 0000:00:02.1: [drm] GT0: sending H2G MMIO 0x5507 [] BUG: unable to handle page fault for address: 0000000000190240
Since we are already tweaking the id and type of the primary GT to mimic it's a Media GT before initializing the GuC communication, we can also call xe_gt_mmio_init() to perform early setup of the gt->mmio which will make those GuC functions work again.
--- drivers/gpu/drm/xe/xe_pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_pci.c +1 -0
@@ -490,6 +490,7 @@ static void read_gmdid(struct xe_device *xe, enum xe_gmdid_type type, u32 *ver, gt->info.type =XE_GT_TYPE_MAIN ; } +xe_gt_mmio_init (gt);xe_guc_comm_init_early (>->uc.guc);/* Don't bother with GMDID if failed to negotiate the GuC ABI */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 612/642 drm/xe: Always setup GT MMIO adjustment data
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit bbd8429264baf8bc3c40cefda048560ae0eb7890 ]
While we believed that xe_gt_mmio_init() will be called just once per GT, this might not be a case due to some tweaks that need to performed by the VF driver during early probe. To avoid leaving any stale data in case of the re-run, reset the GT MMIO adjustment data for the non-media GT case.
--- drivers/gpu/drm/xe/xe_gt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +3 -0
@@ -650,6 +650,9 @@ void xe_gt_mmio_init(struct xe_gt *gt)if (gt->info.type ==XE_GT_TYPE_MEDIA ) { gt->mmio.adj_offset =MEDIA_GT_GSI_OFFSET ; gt->mmio.adj_limit =MEDIA_GT_GSI_LENGTH ; + }else { + gt->mmio.adj_offset =0 ; + gt->mmio.adj_limit =0 ; }if (IS_SRIOV_VF (gt_to_xe (gt)))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 613/642 drm/xe/guc: Drop error messages about missing GuC logs
In reply to Sasha LevinFrom: John Harrison <[email protected]>
[ Upstream commit 174e9ce0daf6af791386e96e76e743eb59e8a401 ]
The GuC log snapshot code would complain loudly if there was no GuC log to take a snapshot of or if the snapshot alloc failed. Originally, this code was only called on demand when a user (or developer) explicitly requested a dump of the log. Hence an error message was useful.
However, it is now part of the general devcoredump file and is called for any GPU hang. Most people don't care about GuC logs and GPU hangs do not generally mean a kernel/GuC bug. More importantly, there are valid situations where there is no GuC log, e.g. SRIOV VFs.
So drop the error message.
--- drivers/gpu/drm/xe/xe_guc_log.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_guc_log.c +2 -6
@@ -149,16 +149,12 @@ struct xe_guc_log_snapshot *xe_guc_log_snapshot_capture(struct xe_guc_log *log,size_t remain;int i; -if (!log->bo) { -xe_gt_err (gt,"GuC log buffer not allocated\n" ); +if (!log->bo)return NULL ; - } snapshot =xe_guc_log_snapshot_alloc (log, atomic); -if (!snapshot) { -xe_gt_err (gt,"GuC log snapshot not allocated\n" ); +if (!snapshot)return NULL ; - } remain = snapshot->size;for (i =0 ; i < snapshot->num_chunks; i++) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 614/642 drm/xe: Reject BO eviction if BO is bound to current VM
In reply to Sasha LevinFrom: Oak Zeng <[email protected]>
[ Upstream commit 0af944f0e3082ff517958b1cea76fb9b8cb379dd ]
This is a follow up fix for
https://patchwork.freedesktop.org/patch/msgid/[email protected]
The overall goal is to fail vm_bind when there is memory pressure. See more details in the commit message of above patch. Abbove patch fixes the issue when user pass in a vm_id parameter during gem_create. If user doesn't pass in a vm_id during gem_create, above patch doesn't help.
This patch further reject BO eviction (which could be triggered by bo validation) if BO is bound to the current VM. vm_bind could fail due to the eviction failure. The BO to VM reverse mapping structure is used to determine whether BO is bound to VM.
v2:
Move vm_bo definition from function scope to if(evict) clause (Thomas) Further constraint the condition by adding ctx->resv (Thomas) Add a short comment describe the change.
--- drivers/gpu/drm/xe/xe_bo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/xe/xe_bo.c +15 -0
@@ -713,6 +713,21 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, goto out; } +/* Reject BO eviction if BO is bound to current VM. */ +if (evict && ctx->resv) { +struct drm_gpuvm_bo *vm_bo; + +drm_gem_for_each_gpuvm_bo (vm_bo, &bo->ttm.base) { +struct xe_vm *vm =gpuvm_to_vm (vm_bo->vm); + +if (xe_vm_resv (vm) == ctx->resv && +xe_vm_in_preempt_fence_mode (vm)) { + ret = -EBUSY ; + goto out; + } + } + } +/* * Failed multi-hop where the old_mem is still marked as * TTM_PL_FLAG_TEMPORARY, should just be a dummy move.
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 615/642 drm/atomic: clarify the rules around drm_atomic_state->allow_modeset
In reply to Sasha LevinFrom: Simona Vetter <[email protected]>
[ Upstream commit c5e3306a424b52e38ad2c28c7f3399fcd03e383d ]
msm is automagically upgrading normal commits to full modesets, and that's a big no-no:
- for one this results in full on->off->on transitions on all these crtc, at least if you're using the usual helpers. Which seems to be the case, and is breaking uapi
- further even if the ctm change itself would not result in flicker, this can hide modesets for other reasons. Which again breaks the uapi
v2: I forgot the case of adding unrelated crtc state. Add that case and link to the existing kerneldoc explainers. This has come up in an irc discussion with Manasi and Ville about intel's bigjoiner mode. Also cc everyone involved in the msm irc discussion, more people joined after I sent out v1.
v3: Wording polish from Pekka and Thomas
--- include/drm/drm_atomic.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
include/drm/drm_atomic.h +21 -2
@@ -376,8 +376,27 @@ struct drm_atomic_state {* * Allow full modeset. This is used by the ATOMIC IOCTL handler to * implement the DRM_MODE_ATOMIC_ALLOW_MODESET flag. Drivers should -* never consult this flag, instead looking at the output of -* drm_atomic_crtc_needs_modeset(). +* generally not consult this flag, but instead look at the output of +* drm_atomic_crtc_needs_modeset(). The detailed rules are: +* +* - Drivers must not consult @allow_modeset in the atomic commit path. +* Use drm_atomic_crtc_needs_modeset() instead. +* +* - Drivers must consult @allow_modeset before adding unrelated struct +* drm_crtc_state to this commit by calling +* drm_atomic_get_crtc_state(). See also the warning in the +* documentation for that function. +* +* - Drivers must never change this flag, it is under the exclusive +* control of userspace. +* +* - Drivers may consult @allow_modeset in the atomic check path, if +* they have the choice between an optimal hardware configuration +* which requires a modeset, and a less optimal configuration which +* can be committed without a modeset. An example would be suboptimal +* scanout FIFO allocation resulting in increased idle power +* consumption. This allows userspace to avoid flickering and delays +* for the normal composition loop at reasonable cost. */ bool allow_modeset : 1;/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 616/642 drm/buddy: fix issue that force_merge cannot free all roots
In reply to Sasha LevinFrom: "Lin.Cao" <[email protected]>
[ Upstream commit 467dce3817bd2b62ccd6fcfd7aae76f242ac907e ]
If buddy manager have more than one roots and each root have sub-block need to be free. When drm_buddy_fini called, the first loop of force_merge will merge and free all of the sub block of first root, which offset is 0x0 and size is biggest(more than have of the mm size). In subsequent force_merge rounds, if we use 0 as start and use remaining mm size as end, the block of other roots will be skipped in __force_merge function. It will cause the other roots can not be freed.
Solution: use roots' offset as the start could fix this issue.
--- drivers/gpu/drm/drm_buddy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_buddy.c +3 -2
@@ -324,7 +324,7 @@ EXPORT_SYMBOL(drm_buddy_init);*/ void drm_buddy_fini (struct drm_buddy *mm) { -u64 root_size, size; +u64 root_size, size, start;unsigned int order;int i;
@@ -332,7 +332,8 @@ void drm_buddy_fini(struct drm_buddy *mm)for (i =0 ; i < mm->n_roots; ++i) { order =ilog2 (size) -ilog2 (mm->chunk_size); -__force_merge (mm,0 , size, order); + start =drm_buddy_block_offset (mm->roots[i]); +__force_merge (mm, start, start + size, order);WARN_ON (!drm_buddy_block_is_free (mm->roots[i]));drm_block_free (mm, mm->roots[i]);
Signature · 1 line
2.39.5