Bluetooth: hci_sock: purge socket queues in the destruct() callback
Subsystems (37)
Sasha Levin
maintainerPATCH 147/217 crypto: hisilicon/hpre - fix memory leak in hpre_curve25519_src_init()
In reply to Sasha LevinFrom: Weili Qian <[email protected]>
[ Upstream commit 51fa916b81e5f406a74f14a31a3a228c3cc060ad ]
hpre_curve25519_src_init() allocates memory for 'ptr' before calling memcmp(). If memcmp() returns 0, the function will return '-EINVAL' without freeing memory.
--- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/hpre/hpre_crypto.c +1 -1
@@ -1865,7 +1865,7 @@ static int hpre_curve25519_src_init(struct hpre_asym_request *hpre_req,*/ if (memcmp (ptr, p, ctx->key_sz) ==0 ) {dev_err (dev,"gx is p!\n" ); -return -EINVAL ; + goto err; }else if (memcmp (ptr, p, ctx->key_sz) >0 ) {hpre_curve25519_src_modulo_p (ptr); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 148/217 crypto: hisilicon/qm - fix deadlock for remove driver
In reply to Sasha LevinFrom: Yang Shen <[email protected]>
[ Upstream commit fc6c01f0cd10b89c4b01dd2940e0b0cda1bd82fb ]
When remove the driver and executing the task occur at the same time, the following deadlock will be triggered:
Chain exists of:
sva_lock --> uacce_mutex --> &qm->qps_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&qm->qps_lock);
lock(uacce_mutex);
lock(&qm->qps_lock);
lock(sva_lock);And the lock 'qps_lock' is used to protect qp. Therefore, it's reasonable cycle is to continue until the qp memory is released. So move the release lock infront of 'uacce_remove'.
--- drivers/crypto/hisilicon/qm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/hisilicon/qm.c +1 -2
@@ -3399,6 +3399,7 @@ void hisi_qm_uninit(struct hisi_qm *qm)dma_free_coherent (dev, qm->qdma.size, qm->qdma.va, qm->qdma.dma); } +up_write (&qm->qps_lock);qm_irq_unregister (qm);hisi_qm_pci_uninit (qm);
@@ -3406,8 +3407,6 @@ void hisi_qm_uninit(struct hisi_qm *qm)uacce_remove (qm->uacce); qm->uacce =NULL ; } - -up_write (&qm->qps_lock); }EXPORT_SYMBOL_GPL (hisi_qm_uninit);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 149/217 PM: runtime: Add safety net to supplier device release
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit d1579e61192e0e686faa4208500ef4c3b529b16c ]
Because refcount_dec_not_one() returns true if the target refcount becomes saturated, it is generally unsafe to use its return value as a loop termination condition, but that is what happens when a device link's supplier device is released during runtime PM suspend operations and on device link removal.
To address this, introduce pm_runtime_release_supplier() to be used in the above cases which will check the supplier device's runtime PM usage counter in addition to the refcount_dec_not_one() return value, so the loop can be terminated in case the rpm_active refcount value becomes invalid, and update the code in question to use it as appropriate.
This change is not expected to have any visible functional impact.
--- drivers/base/core.c | 3 +-- drivers/base/power/runtime.c | 41 ++++++++++++++++++++++++++---------- include/linux/pm_runtime.h | 3 +++ 3 files changed, 34 insertions(+), 13 deletions(-)
drivers/base/core.c +1 -2
@@ -485,8 +485,7 @@ static void device_link_release_fn(struct work_struct *work)/* Ensure that all references to the link object have been dropped. */ device_link_synchronize_removal (); -while (refcount_dec_not_one (&link->rpm_active)) -pm_runtime_put (link->supplier); +pm_runtime_release_supplier (link, true);put_device (link->consumer);put_device (link->supplier);
drivers/base/power/runtime.c +30 -11
58 lines not on this page · raw message
include/linux/pm_runtime.h +3 -0
@@ -58,6 +58,7 @@ extern void pm_runtime_get_suppliers(struct device *dev);extern void pm_runtime_put_suppliers (struct device *dev);extern void pm_runtime_new_link (struct device *dev);extern void pm_runtime_drop_link (struct device_link *link); +extern void pm_runtime_release_supplier (struct device_link *link,bool check_idle);extern int devm_pm_runtime_enable (struct device *dev);
@@ -283,6 +284,8 @@ static inline void pm_runtime_get_suppliers(struct device *dev) {}static inline void pm_runtime_put_suppliers (struct device *dev) {}static inline void pm_runtime_new_link (struct device *dev) {}static inline void pm_runtime_drop_link (struct device_link *link) {} +static inline void pm_runtime_release_supplier (struct device_link *link, +bool check_idle) {}#endif /* !CONFIG_PM */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 150/217 cpufreq: Fix initialization of min and max frequency QoS requests
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 521223d8b3ec078f670c7c35a1a04b1b2af07966 ]
The min and max frequency QoS requests in the cpufreq core are initialized to whatever the current min and max frequency values are at the init time, but if any of these values change later (for example, cpuinfo.max_freq is updated by the driver), these initial request values will be limiting the CPU frequency unnecessarily unless they are changed by user space via sysfs.
To address this, initialize min_freq_req and max_freq_req to FREQ_QOS_MIN_DEFAULT_VALUE and FREQ_QOS_MAX_DEFAULT_VALUE, respectively, so they don't really limit anything until user space updates them.
--- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +2 -2
@@ -1403,7 +1403,7 @@ static int cpufreq_online(unsigned int cpu) ret =freq_qos_add_request (&policy->constraints, policy->min_freq_req,FREQ_QOS_MIN , - policy->min); +FREQ_QOS_MIN_DEFAULT_VALUE );if (ret <0 ) {/* * So we don't call freq_qos_remove_request() for an
@@ -1423,7 +1423,7 @@ static int cpufreq_online(unsigned int cpu) ret =freq_qos_add_request (&policy->constraints, policy->max_freq_req,FREQ_QOS_MAX , - policy->max); +FREQ_QOS_MAX_DEFAULT_VALUE );if (ret <0 ) { policy->max_freq_req =NULL ; goto out_destroy_policy;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 151/217 usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 00558586382891540c59c9febc671062425a6e47 ]
When a new USB device gets plugged to nested hubs, the affected hub, which connects to usb 2-1.4-port2, doesn't report there's any change, hence the nested hubs go back to runtime suspend like nothing happened:
[ 281.032951] usb usb2: usb wakeup-resume [ 281.032959] usb usb2: usb auto-resume [ 281.032974] hub 2-0:1.0: hub_resume [ 281.033011] usb usb2-port1: status 0263 change 0000 [ 281.033077] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.049797] usb 2-1: usb wakeup-resume [ 281.069800] usb 2-1: Waited 0ms for CONNECT [ 281.069810] usb 2-1: finish resume [ 281.070026] hub 2-1:1.0: hub_resume [ 281.070250] usb 2-1-port4: status 0203 change 0000 [ 281.070272] usb usb2-port1: resume, status 0 [ 281.070282] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.089813] usb 2-1.4: usb wakeup-resume [ 281.109792] usb 2-1.4: Waited 0ms for CONNECT [ 281.109801] usb 2-1.4: finish resume [ 281.109991] hub 2-1.4:1.0: hub_resume [ 281.110147] usb 2-1.4-port2: status 0263 change 0000 [ 281.110234] usb 2-1-port4: resume, status 0 [ 281.110239] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.110266] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.110426] hub 2-1.4:1.0: hub_suspend [ 281.110565] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.130998] hub 2-1:1.0: hub_suspend [ 281.137788] usb 2-1: usb auto-suspend, wakeup 1 [ 281.142935] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.177828] usb 2-1: usb wakeup-resume [ 281.197839] usb 2-1: Waited 0ms for CONNECT [ 281.197850] usb 2-1: finish resume [ 281.197984] hub 2-1:1.0: hub_resume [ 281.198203] usb 2-1-port4: status 0203 change 0000 [ 281.198228] usb usb2-port1: resume, status 0 [ 281.198237] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.217835] usb 2-1.4: usb wakeup-resume [ 281.237834] usb 2-1.4: Waited 0ms for CONNECT [ 281.237845] usb 2-1.4: finish resume [ 281.237990] hub 2-1.4:1.0: hub_resume [ 281.238067] usb 2-1.4-port2: status 0263 change 0000 [ 281.238148] usb 2-1-port4: resume, status 0 [ 281.238152] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.238166] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.238385] hub 2-1.4:1.0: hub_suspend [ 281.238523] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.258076] hub 2-1:1.0: hub_suspend [ 281.265744] usb 2-1: usb auto-suspend, wakeup 1 [ 281.285976] hub 2-0:1.0: hub_suspend [ 281.285988] usb usb2: bus auto-suspend, wakeup 1
USB 3.2 spec, 9.2.5.4 "Changing Function Suspend State" says that "If the link is in a non-U0 state, then the device must transition the link to U0 prior to sending the remote wake message", but the hub only transits the link to U0 after signaling remote wakeup.
So be more forgiving and use a 20ms delay to let the link transit to U0 for remote wakeup.
--- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +4 -1
@@ -1110,7 +1110,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) }else {hub_power_on (hub, true); } - } +/* Give some time on remote wakeup to let links to transit to U0 */ + }else if (hub_is_superspeed (hub->hdev)) +msleep (20 ); + init2:/*
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 152/217 mt76: mt7615: fix possible deadlock while mt7615_register_ext_phy()
In reply to Sasha LevinFrom: Peter Chiu <[email protected]>
[ Upstream commit 8c55516de3f9b76b9d9444e7890682ec2efc809f ]
ieee80211_register_hw() is called with rtnl_lock held, and this could be caused lockdep from a work item that's on a workqueue that is flushed with the rtnl held.
Move mt7615_register_ext_phy() outside the init_work().
--- drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c +6 -2
@@ -28,8 +28,6 @@ static void mt7615_pci_init_work(struct work_struct *work)return ;mt7615_init_work (dev); -if (dev->dbdc_support) -mt7615_register_ext_phy (dev); }static int mt7615_init_hardware (struct mt7615_dev *dev)
@@ -160,6 +158,12 @@ int mt7615_register_device(struct mt7615_dev *dev)mt7615_init_txpower (dev, &dev->mphy.sband_2g.sband);mt7615_init_txpower (dev, &dev->mphy.sband_5g.sband); +if (dev->dbdc_support) { + ret =mt7615_register_ext_phy (dev); +if (ret) +return ret; + } +return mt7615_init_debugfs (dev); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 153/217 mt76: mt7915: fix SMPS operation fail
In reply to Sasha LevinFrom: Ryder Lee <[email protected]>
[ Upstream commit 8f05835425ce3f669e4b6d7c2c39a9aa22e1506c ]
TGn fails sending SM power save mode action frame to the AP to switch from dynamic SMPS mode to static mode.
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 81 ++++++++++++------- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 8 ++ 2 files changed, 61 insertions(+), 28 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +53 -28
@@ -1752,33 +1752,6 @@ int mt7915_mcu_sta_update_hdr_trans(struct mt7915_dev *dev, true); } -int mt7915_mcu_add_smps (struct mt7915_dev *dev,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; -struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; -struct wtbl_req_hdr *wtbl_hdr; -struct tlv *sta_wtbl; -struct sk_buff *skb; - - skb =mt7915_mcu_alloc_sta_req (dev, mvif, msta, -MT7915_STA_UPDATE_MAX_SIZE ); -if (IS_ERR (skb)) -return PTR_ERR (skb); - - sta_wtbl =mt7915_mcu_add_tlv (skb,STA_REC_WTBL ,sizeof (struct tlv )); - - wtbl_hdr =mt7915_mcu_alloc_wtbl_req (dev, msta,WTBL_SET , sta_wtbl, - &skb); -if (IS_ERR (wtbl_hdr)) -return PTR_ERR (wtbl_hdr); - -mt7915_mcu_wtbl_smps_tlv (skb, sta, sta_wtbl, wtbl_hdr); - -return mt76_mcu_skb_send_msg (&dev->mt76, skb, -MCU_EXT_CMD (STA_REC_UPDATE ), true); -} -static inline bool mt7915_is_ebf_supported (struct mt7915_phy *phy,struct ieee80211_vif *vif,struct ieee80211_sta *sta,bool bfee)
@@ -2049,6 +2022,21 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb, bfee->fb_identity_matrix = (nrow ==1 && tx_ant ==2 ); } +static enum mcu_mmps_mode +mt7915_mcu_get_mmps_mode (enum ieee80211_smps_mode smps) +{ +switch (smps) { +case IEEE80211_SMPS_OFF : +return MCU_MMPS_DISABLE ; +case IEEE80211_SMPS_STATIC : +return MCU_MMPS_STATIC ; +case IEEE80211_SMPS_DYNAMIC : +return MCU_MMPS_DYNAMIC ; +default : +return MCU_MMPS_DISABLE ; + } +} + int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
@@ -2076,7 +2064,11 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,case RATE_PARAM_FIXED_MCS :case RATE_PARAM_FIXED_GI :case RATE_PARAM_FIXED_HE_LTF : - ra->phy = *phy; +if (phy) + ra->phy = *phy; +break ; +case RATE_PARAM_MMPS_UPDATE : + ra->mmps_mode =mt7915_mcu_get_mmps_mode (sta->smps_mode);break ;default :break ;
@@ -2087,6 +2079,39 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev, MCU_EXT_CMD(STA_REC_UPDATE), true); } +int mt7915_mcu_add_smps (struct mt7915_dev *dev,struct ieee80211_vif *vif, +struct ieee80211_sta *sta) +{ +struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; +struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; +struct wtbl_req_hdr *wtbl_hdr; +struct tlv *sta_wtbl; +struct sk_buff *skb; +int ret; + + skb =mt7915_mcu_alloc_sta_req (dev, mvif, msta, +MT7915_STA_UPDATE_MAX_SIZE ); +if (IS_ERR (skb)) +return PTR_ERR (skb); + + sta_wtbl =mt7915_mcu_add_tlv (skb,STA_REC_WTBL ,sizeof (struct tlv )); + + wtbl_hdr =mt7915_mcu_alloc_wtbl_req (dev, msta,WTBL_SET , sta_wtbl, + &skb); +if (IS_ERR (wtbl_hdr)) +return PTR_ERR (wtbl_hdr); + +mt7915_mcu_wtbl_smps_tlv (skb, sta, sta_wtbl, wtbl_hdr); + + ret =mt76_mcu_skb_send_msg (&dev->mt76, skb, +MCU_EXT_CMD (STA_REC_UPDATE ), true); +if (ret) +return ret; + +return mt7915_mcu_set_fixed_rate_ctrl (dev, vif, sta,NULL , +RATE_PARAM_MMPS_UPDATE ); +} + static int mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, struct ieee80211_vif *vif,
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +8 -0
@@ -365,6 +365,13 @@ enum { MCU_PHY_STATE_OFDMLQ_CNINFO, }; +enum mcu_mmps_mode { +MCU_MMPS_STATIC , +MCU_MMPS_DYNAMIC , +MCU_MMPS_RSV , +MCU_MMPS_DISABLE , +}; +#define STA_TYPE_STA BIT(0)#define STA_TYPE_AP BIT(1)#define STA_TYPE_ADHOC BIT(2)
@@ -960,6 +967,7 @@ struct sta_rec_ra_fixed {enum {RATE_PARAM_FIXED =3 , +RATE_PARAM_MMPS_UPDATE =5 ,RATE_PARAM_FIXED_HE_LTF =7 ,RATE_PARAM_FIXED_MCS ,RATE_PARAM_FIXED_GI =11 ,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 154/217 mt76: connac: fix a theoretical NULL pointer dereference in mt76_connac_get_phy_mode
In reply to Sasha LevinFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit c9dbeac4988f6d4c4211b3747ec9c9c75ea87967 ]
Even if it is not a real bug since mt76_connac_get_phy_mode runs just for mt7921 where only STA is supported, fix a theoretical NULL pointer dereference if new added modes do not support HE
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +2 -2
@@ -1179,7 +1179,7 @@ mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,if (ht_cap->ht_supported) mode |=PHY_MODE_GN ; -if (he_cap->has_he) +if (he_cap && he_cap->has_he) mode |=PHY_MODE_AX_24G ; }else if (band ==NL80211_BAND_5GHZ || band ==NL80211_BAND_6GHZ ) { mode |=PHY_MODE_A ;
@@ -1190,7 +1190,7 @@ mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,if (vht_cap->vht_supported) mode |=PHY_MODE_AC ; -if (he_cap->has_he) { +if (he_cap && he_cap->has_he) {if (band ==NL80211_BAND_6GHZ ) mode |=PHY_MODE_AX_6G ;else
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 155/217 mt76: do not pass the received frame with decryption error
In reply to Sasha LevinFrom: Xing Song <[email protected]>
[ Upstream commit dd28dea52ad9376d2b243a8981726646e1f60b1a ]
MAC80211 doesn't care any decryption error in 802.3 path, so received frame will be dropped if HW tell us that the cipher configuration is not matched as well as the header has been translated to 802.3. This case only appears when IEEE80211_FCTL_PROTECTED is 0 and cipher suit is not none in the corresponding HW entry.
The received frame is only reported to monitor interface if HW decryption block tell us there is ICV error or CCMP/BIP/WPI MIC error. Note in this case the reported frame is decrypted 802.11 frame and the payload may be malformed due to mismatched key.
--- drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 9 ++++++++- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 9 ++++++++- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 9 ++++++++- 4 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7603/mac.c +4 -0
@@ -525,6 +525,10 @@ mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb)if (rxd2 &MT_RXD2_NORMAL_TKIP_MIC_ERR ) status->flag |=RX_FLAG_MMIC_ERROR ; +/* ICV error or CCMP/BIP/WPI MIC error */ +if (rxd2 &MT_RXD2_NORMAL_ICV_ERR ) + status->flag |=RX_FLAG_ONLY_MONITOR ; +if (FIELD_GET (MT_RXD2_NORMAL_SEC_MODE , rxd2) !=0 && !(rxd2 & (MT_RXD2_NORMAL_CLM |MT_RXD2_NORMAL_CM ))) { status->flag |=RX_FLAG_DECRYPTED ;
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +8 -1
@@ -286,9 +286,16 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)if (rxd2 &MT_RXD2_NORMAL_AMSDU_ERR )return -EINVAL ; + hdr_trans = rxd1 &MT_RXD1_NORMAL_HDR_TRANS ; +if (hdr_trans && (rxd2 &MT_RXD2_NORMAL_CM )) +return -EINVAL ; + +/* ICV error or CCMP/BIP/WPI MIC error */ +if (rxd2 &MT_RXD2_NORMAL_ICV_ERR ) + status->flag |=RX_FLAG_ONLY_MONITOR ; + unicast = (rxd1 &MT_RXD1_NORMAL_ADDR_TYPE ) ==MT_RXD1_NORMAL_U2M ; idx =FIELD_GET (MT_RXD2_NORMAL_WLAN_IDX , rxd2); - hdr_trans = rxd1 &MT_RXD1_NORMAL_HDR_TRANS ; status->wcid =mt7615_rx_get_wcid (dev, idx, unicast);if (status->wcid) {
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +8 -1
@@ -426,9 +426,16 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb)if (rxd2 &MT_RXD2_NORMAL_AMSDU_ERR )return -EINVAL ; + hdr_trans = rxd2 &MT_RXD2_NORMAL_HDR_TRANS ; +if (hdr_trans && (rxd1 &MT_RXD1_NORMAL_CM )) +return -EINVAL ; + +/* ICV error or CCMP/BIP/WPI MIC error */ +if (rxd1 &MT_RXD1_NORMAL_ICV_ERR ) + status->flag |=RX_FLAG_ONLY_MONITOR ; + unicast =FIELD_GET (MT_RXD3_NORMAL_ADDR_TYPE , rxd3) ==MT_RXD3_NORMAL_U2M ; idx =FIELD_GET (MT_RXD1_NORMAL_WLAN_IDX , rxd1); - hdr_trans = rxd2 &MT_RXD2_NORMAL_HDR_TRANS ; status->wcid =mt7915_rx_get_wcid (dev, idx, unicast);if (status->wcid) {
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +8 -1
@@ -428,10 +428,17 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)if (rxd2 &MT_RXD2_NORMAL_AMSDU_ERR )return -EINVAL ; + hdr_trans = rxd2 &MT_RXD2_NORMAL_HDR_TRANS ; +if (hdr_trans && (rxd1 &MT_RXD1_NORMAL_CM )) +return -EINVAL ; + +/* ICV error or CCMP/BIP/WPI MIC error */ +if (rxd1 &MT_RXD1_NORMAL_ICV_ERR ) + status->flag |=RX_FLAG_ONLY_MONITOR ; + chfreq =FIELD_GET (MT_RXD3_NORMAL_CH_FREQ , rxd3); unicast =FIELD_GET (MT_RXD3_NORMAL_ADDR_TYPE , rxd3) ==MT_RXD3_NORMAL_U2M ; idx =FIELD_GET (MT_RXD1_NORMAL_WLAN_IDX , rxd1); - hdr_trans = rxd2 &MT_RXD2_NORMAL_HDR_TRANS ; status->wcid =mt7921_rx_get_wcid (dev, idx, unicast);if (status->wcid) {
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 156/217 mt76: mt7615: improve wmm index allocation
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 70fb028707c8871ef9e56b3ffa3d895e14956cc4 ]
Typically all AP interfaces on a PHY will share the same WMM settings, while sta/mesh interfaces will usually inherit the settings from a remote device. In order minimize the likelihood of conflicting WMM settings, make all AP interfaces share one slot, and all non-AP interfaces another one.
This also fixes running multiple AP interfaces on MT7613, which only has 3 WMM slots.
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -5
@@ -211,11 +211,9 @@ static int mt7615_add_interface(struct ieee80211_hw *hw, mvif->mt76.omac_idx = idx; mvif->mt76.band_idx = ext_phy; -if (mt7615_ext_phy (dev)) - mvif->mt76.wmm_idx = ext_phy * (MT7615_MAX_WMM_SETS /2 ) + - mvif->mt76.idx % (MT7615_MAX_WMM_SETS /2 ); -else - mvif->mt76.wmm_idx = mvif->mt76.idx %MT7615_MAX_WMM_SETS ; + mvif->mt76.wmm_idx = vif->type !=NL80211_IFTYPE_AP ; +if (ext_phy) + mvif->mt76.wmm_idx +=2 ; dev->mt76.vif_mask |=BIT (mvif->mt76.idx); dev->omac_mask |=BIT_ULL (mvif->mt76.omac_idx);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 157/217 mt76: mt7921: fix network buffer leak by txs missing
In reply to Sasha LevinFrom: Deren Wu <[email protected]>
[ Upstream commit e0bf699ad8e52330d848144a9624a067ad588bd6 ]
TXS in mt7921 may be forwared to tx_done event. Should try to catch TXS information in tx_done event as well.
--- .../net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 14 ++++++++++ .../net/wireless/mediatek/mt76/mt7921/mcu.h | 27 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/mt7921.h | 1 + 4 files changed, 43 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -1
@@ -1072,7 +1072,7 @@ mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,return !!skb; } -static void mt7921_mac_add_txs (struct mt7921_dev *dev,void *data) +void mt7921_mac_add_txs (struct mt7921_dev *dev,void *data) {struct mt7921_sta *msta =NULL ;struct mt76_wcid *wcid;
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +14 -0
@@ -418,6 +418,17 @@ mt7921_mcu_low_power_event(struct mt7921_dev *dev, struct sk_buff *skb)trace_lp_event (dev, event->state); } +static void +mt7921_mcu_tx_done_event (struct mt7921_dev *dev,struct sk_buff *skb) +{ +struct mt7921_mcu_tx_done_event *event; + +skb_pull (skb,sizeof (struct mt7921_mcu_rxd )); + event = (struct mt7921_mcu_tx_done_event *)skb->data; + +mt7921_mac_add_txs (dev, event->txs); +} +static void mt7921_mcu_rx_unsolicited_event (struct mt7921_dev *dev,struct sk_buff *skb) {
@@ -445,6 +456,9 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb)case MCU_EVENT_LP_INFO :mt7921_mcu_low_power_event (dev, skb);break ; +case MCU_EVENT_TX_DONE : +mt7921_mcu_tx_done_event (dev, skb); +break ;default :break ; }
drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +27 -0
@@ -91,6 +91,33 @@ enum { MCU_EVENT_COREDUMP = 0xf0, }; +struct mt7921_mcu_tx_done_event { +u8 pid; +u8 status; +__le16 seq; + +u8 wlan_idx; +u8 tx_cnt; +__le16 tx_rate; + +u8 flag; +u8 tid; +u8 rsp_rate; +u8 mcs; + +u8 bw; +u8 tx_pwr; +u8 reason; +u8 rsv0[1 ]; + +__le32 delay; +__le32 timestamp; +__le32 applied_flag; +u8 txs[28 ]; + +u8 rsv1[32 ]; +} __packed; +/* ext event table */ enum {MCU_EXT_EVENT_RATE_REPORT =0x87 ,
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +1 -0
@@ -463,4 +463,5 @@ int mt7921s_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, struct mt76_tx_info *tx_info);void mt7921s_tx_complete_skb (struct mt76_dev *mdev,struct mt76_queue_entry *e);bool mt7921s_tx_status_data (struct mt76_dev *mdev,u8 *update); +void mt7921_mac_add_txs (struct mt7921_dev *dev,void *data);#endif
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 158/217 ath9k_htc: fix NULL pointer dereference at ath9k_htc_rxep()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit b0ec7e55fce65f125bd1d7f02e2dc4de62abee34 ]
syzbot is reporting lockdep warning followed by kernel panic at ath9k_htc_rxep() [1], for ath9k_htc_rxep() depends on ath9k_rx_init() being already completed.
Since ath9k_htc_rxep() is set by ath9k_htc_connect_svc(WMI_BEACON_SVC)
from ath9k_init_htc_services(), it is possible that ath9k_htc_rxep() is
called via timer interrupt before ath9k_rx_init() from ath9k_init_device() is called.
Since we can't call ath9k_init_device() before ath9k_init_htc_services(), let's hold ath9k_htc_rxep() no-op until ath9k_rx_init() completes.
--- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 8 ++++++++ 2 files changed, 9 insertions(+)
drivers/net/wireless/ath/ath9k/htc.h +1 -0
@@ -281,6 +281,7 @@ struct ath9k_htc_rxbuf {struct ath9k_htc_rx {struct list_head rxbuf;spinlock_t rxbuflock; +bool initialized; };#define ATH9K_HTC_TX_CLEANUP_INTERVAL 50/* ms */
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +8 -0
@@ -1130,6 +1130,10 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,struct ath9k_htc_rxbuf *rxbuf =NULL , *tmp_buf =NULL ;unsigned long flags; +/* Check if ath9k_rx_init() completed. */ +if (!data_race (priv->rx.initialized)) + goto err; +spin_lock_irqsave (&priv->rx.rxbuflock, flags);list_for_each_entry (tmp_buf, &priv->rx.rxbuf, list) {if (!tmp_buf->in_process) {
@@ -1185,6 +1189,10 @@ int ath9k_rx_init(struct ath9k_htc_priv *priv)list_add_tail (&rxbuf->list, &priv->rx.rxbuf); } +/* Allow ath9k_htc_rxep() to operate. */ +smp_wmb (); + priv->rx.initialized = true; +return 0 ; err:
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 159/217 ath9k_htc: fix NULL pointer dereference at ath9k_htc_tx_get_packet()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 8b3046abc99eefe11438090bcc4ec3a3994b55d0 ]
syzbot is reporting lockdep warning at ath9k_wmi_event_tasklet() followed by kernel panic at get_htc_epid_queue() from ath9k_htc_tx_get_packet() from ath9k_htc_txstatus() [1], for ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) depends on spin_lock_init() from ath9k_init_priv() being already completed.
Since ath9k_wmi_event_tasklet() is set by ath9k_init_wmi() from ath9k_htc_probe_device(), it is possible that ath9k_wmi_event_tasklet() is called via tasklet interrupt before spin_lock_init() from ath9k_init_priv()
from ath9k_init_device() from ath9k_htc_probe_device() is called.
Let's hold ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) no-op until ath9k_tx_init() completes.
--- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +++++ drivers/net/wireless/ath/ath9k/wmi.c | 4 ++++ 3 files changed, 10 insertions(+)
drivers/net/wireless/ath/ath9k/htc.h +1 -0
@@ -306,6 +306,7 @@ struct ath9k_htc_tx {DECLARE_BITMAP (tx_slot,MAX_TX_BUF_NUM );struct timer_list cleanup_timer;spinlock_t tx_lock; +bool initialized; };struct ath9k_htc_tx_ctl {
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +5 -0
@@ -813,6 +813,11 @@ int ath9k_tx_init(struct ath9k_htc_priv *priv)skb_queue_head_init (&priv->tx.data_vi_queue);skb_queue_head_init (&priv->tx.data_vo_queue);skb_queue_head_init (&priv->tx.tx_failed); + +/* Allow ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) to operate. */ +smp_wmb (); + priv->tx.initialized = true; +return 0 ; }
drivers/net/wireless/ath/ath9k/wmi.c +4 -0
@@ -169,6 +169,10 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t) &wmi->drv_priv->fatal_work);break ;case WMI_TXSTATUS_EVENTID : +/* Check if ath9k_tx_init() completed. */ +if (!data_race (priv->tx.initialized)) +break ; +spin_lock_bh (&priv->tx.tx_lock);if (priv->tx.flags &ATH9K_HTC_OP_TX_DRAIN ) {spin_unlock_bh (&priv->tx.tx_lock);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 160/217 ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream
In reply to Sasha LevinFrom: Zekun Shen <[email protected]>
[ Upstream commit 6ce708f54cc8d73beca213cec66ede5ce100a781 ]
Large pkt_len can lead to out-out-bound memcpy. Current ath9k_hif_usb_rx_stream allows combining the content of two urb inputs to one pkt. The first input can indicate the size of the pkt. Any remaining size is saved in hif_dev->rx_remain_len. While processing the next input, memcpy is used with rx_remain_len.
4-byte pkt_len can go up to 0xffff, while a single input is 0x4000 maximum in size (MAX_RX_BUF_SIZE). Thus, the patch adds a check for pkt_len which must not exceed 2 * MAX_RX_BUG_SIZE.
BUG: KASAN: slab-out-of-bounds in ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] Read of size 46393 at addr ffff888018798000 by task kworker/0:1/23 CPU: 0 PID: 23 Comm: kworker/0:1 Not tainted 5.6.0 #63 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014 Workqueue: events request_firmware_work_func Call Trace: <IRQ> dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] __kasan_report.cold+0x37/0x7c ? ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] kasan_report+0xe/0x20 check_memory_region+0x15a/0x1d0 memcpy+0x20/0x50 ath9k_hif_usb_rx_cb+0x490/0xed7 [ath9k_htc] ? hif_usb_mgmt_cb+0x2d9/0x2d9 [ath9k_htc] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __usb_unanchor_urb+0x12f/0x210 __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20
I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU.
After fixing the value of pkt_tag to ATH_USB_RX_STREAM_MODE_TAG in QEMU emulation, I found the KASAN report. The bug is triggerable whenever pkt_len is above two MAX_RX_BUG_SIZE. I used the same input that crashes to test the driver works when applying the patch.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +7 -0
@@ -590,6 +590,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,return ; } +if (pkt_len >2 *MAX_RX_BUF_SIZE ) { +dev_err (&hif_dev->udev->dev, +"ath9k_htc: invalid pkt_len (%x)\n" , pkt_len); +RX_STAT_INC (skb_dropped); +return ; + } + pad_len =4 - (pkt_len &0x3 );if (pad_len ==4 ) pad_len =0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 161/217 rtw88: 8822c: update rx settings to prevent potential hw deadlock
In reply to Sasha LevinFrom: Po-Hao Huang <[email protected]>
[ Upstream commit c1afb26727d9e507d3e17a9890e7aaf7fc85cd55 ]
These settings enables mac to detect and recover when rx fifo circuit deadlock occurs. Previous version missed this, so we fix it.
--- drivers/net/wireless/realtek/rtw88/main.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8821c.h | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +1 -1
@@ -1868,7 +1868,7 @@ int rtw_core_init(struct rtw_dev *rtwdev)/* default rx filter setting */ rtwdev->hal.rcr =BIT_APP_FCS |BIT_APP_MIC |BIT_APP_ICV | -BIT_HTC_LOC_CTRL |BIT_APP_PHYSTS | +BIT_PKTCTL_DLEN |BIT_HTC_LOC_CTRL |BIT_APP_PHYSTS |BIT_AB |BIT_AM |BIT_APM ; ret =rtw_load_firmware (rtwdev,RTW_NORMAL_FW );
drivers/net/wireless/realtek/rtw88/rtw8821c.h +1 -1
@@ -131,7 +131,7 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)#define WLAN_TX_FUNC_CFG2 0x30#define WLAN_MAC_OPT_NORM_FUNC1 0x98#define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0x30810041 +#define WLAN_MAC_OPT_FUNC2 0xb0810041#define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ (WLAN_SIFS_OFDM_CONT_TX << BIT_SHIFT_SIFS_OFDM_CTX) | \
drivers/net/wireless/realtek/rtw88/rtw8822b.c +1 -1
@@ -205,7 +205,7 @@ static void rtw8822b_phy_set_param(struct rtw_dev *rtwdev)#define WLAN_TX_FUNC_CFG2 0x30#define WLAN_MAC_OPT_NORM_FUNC1 0x98#define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0x30810041 +#define WLAN_MAC_OPT_FUNC2 0xb0810041#define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ (WLAN_SIFS_OFDM_CONT_TX << BIT_SHIFT_SIFS_OFDM_CTX) | \
drivers/net/wireless/realtek/rtw88/rtw8822c.c +1 -1
@@ -1962,7 +1962,7 @@ static void rtw8822c_phy_set_param(struct rtw_dev *rtwdev)#define WLAN_TX_FUNC_CFG2 0x30#define WLAN_MAC_OPT_NORM_FUNC1 0x98#define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0x30810041 +#define WLAN_MAC_OPT_FUNC2 0xb0810041#define WLAN_MAC_INT_MIG_CFG 0x33330000#define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 162/217 PM: AVS: qcom-cpr: Use div64_ul instead of do_div
In reply to Sasha LevinFrom: Changcheng Deng <[email protected]>
[ Upstream commit 92c550f9ffd2884bb5def52b5c0485a35e452784 ]
do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation.
--- drivers/soc/qcom/cpr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/cpr.c +1 -1
@@ -1010,7 +1010,7 @@ static int cpr_interpolate(const struct corner *corner, int step_volt,return corner->uV; temp = f_diff * (uV_high - uV_low); -do_div (temp, f_high - f_low); + temp =div64_ul (temp, f_high - f_low);/* * max_volt_scale has units of uV/MHz while freq values
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 163/217 iwlwifi: recognize missing PNVM data and then log filename
In reply to Sasha LevinFrom: Luca Coelho <[email protected]>
[ Upstream commit 1db385c668d3ccb04ccdb5f0f190fd17b2db29c6 ]
We can detect that a FW SYSASSERT is due to missing PNVM data by checking the assertion code. When this happens, it's is useful for the user if we print the filename where the driver is looking for the data.
Add the PNVM missing assertion code to the dump list and print out the name of the file we're looking for when this happens.
--- drivers/net/wireless/intel/iwlwifi/fw/dump.c | 9 +++++++++ drivers/net/wireless/intel/iwlwifi/fw/img.c | 6 +++--- drivers/net/wireless/intel/iwlwifi/fw/img.h | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dump.c +9 -0
@@ -12,6 +12,7 @@#include "iwl-io.h" #include "iwl-prph.h" #include "iwl-csr.h" +#include "pnvm.h" /* * Note: This structure is read from the device with IO accesses,
@@ -147,6 +148,7 @@ static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_runtime *fwrt)struct iwl_trans *trans = fwrt->trans;struct iwl_umac_error_event_table table = {};u32 base = fwrt->trans->dbg.umac_error_event_table; +char pnvm_name[MAX_PNVM_NAME ]; if (!base && !(fwrt->trans->dbg.error_event_table_tlv_status &
@@ -164,6 +166,13 @@ static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_runtime *fwrt) fwrt->trans->status, table.valid); } +if ((table.error_id & ~FW_SYSASSERT_CPU_MASK ) == +FW_SYSASSERT_PNVM_MISSING ) { +iwl_pnvm_get_fs_name (trans, pnvm_name,sizeof (pnvm_name)); +IWL_ERR (fwrt,"PNVM data is missing, please install %s\n" , + pnvm_name); + } +IWL_ERR (fwrt,"0x%08X | %s\n" , table.error_id,iwl_fw_lookup_assert_desc (table.error_id));IWL_ERR (fwrt,"0x%08X | umac branchlink1\n" , table.blink1);
drivers/net/wireless/intel/iwlwifi/fw/img.c +3 -3
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright(c) 2019 - 2020 Intel Corporation +* Copyright(c) 2019 - 2021 Intel Corporation */ #include "img.h"
@@ -49,10 +49,9 @@ u8 iwl_fw_lookup_notif_ver(const struct iwl_fw *fw, u8 grp, u8 cmd, u8 def) }EXPORT_SYMBOL_GPL (iwl_fw_lookup_notif_ver); -#define FW_SYSASSERT_CPU_MASK 0xf0000000static const struct {const char *name; -u8 num; +u32 num; } advanced_lookup[] = { {"NMI_INTERRUPT_WDG" ,0x34 }, {"SYSASSERT" ,0x35 },
@@ -73,6 +72,7 @@ static const struct { { "NMI_INTERRUPT_ACTION_PT", 0x7C }, { "NMI_INTERRUPT_UNKNOWN", 0x84 }, { "NMI_INTERRUPT_INST_ACTION_PT", 0x86 }, + { "PNVM_MISSING", FW_SYSASSERT_PNVM_MISSING }, { "ADVANCED_SYSASSERT", 0 }, };
drivers/net/wireless/intel/iwlwifi/fw/img.h +4 -0
@@ -279,4 +279,8 @@ u8 iwl_fw_lookup_cmd_ver(const struct iwl_fw *fw, u8 grp, u8 cmd, u8 def);u8 iwl_fw_lookup_notif_ver (const struct iwl_fw *fw,u8 grp,u8 cmd,u8 def);const char *iwl_fw_lookup_assert_desc (u32 num); + +#define FW_SYSASSERT_CPU_MASK 0xf0000000 +#define FW_SYSASSERT_PNVM_MISSING 0x0010070d +#endif /* __iwl_fw_img_h__ */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 164/217 iwlwifi: fix leaks/bad data after failed firmware load
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit ab07506b0454bea606095951e19e72c282bfbb42 ]
If firmware load fails after having loaded some parts of the firmware, e.g. the IML image, then this would leak. For the host command list we'd end up running into a WARN on the next attempt to load another firmware image.
Fix this by calling iwl_dealloc_ucode() on failures, and make that also clear the data so we start fresh on the next round.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +8 -0
@@ -130,6 +130,9 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv)for (i =0 ; i <IWL_UCODE_TYPE_MAX ; i++)iwl_free_fw_img (drv, drv->fw.img + i); + +/* clear the data for the aborted load case */ +memset (&drv->fw,0 ,sizeof (drv->fw)); } static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc,
@@ -1375,6 +1378,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)int i;bool load_module = false;bool usniffer_images = false; +bool failure = true; fw->ucode_capa.max_probe_length =IWL_DEFAULT_MAX_PROBE_LENGTH ; fw->ucode_capa.standard_phy_calibration_size =
@@ -1644,6 +1648,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) op->name, err);#endif } + failure = false; goto free; try_again:
@@ -1659,6 +1664,9 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)complete (&drv->request_firmware_complete);device_release_driver (drv->trans->dev); free: +if (failure) +iwl_dealloc_ucode (drv); +if (pieces) {for (i =0 ; i <ARRAY_SIZE (pieces->img); i++)kfree (pieces->img[i].sec);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 165/217 iwlwifi: remove module loading failure message
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 6518f83ffa51131daaf439b66094f684da3fb0ae ]
When CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, iwlwifi crashes when the opmode module cannot be loaded, due to completing the completion before using drv->dev, which can then already be freed.
Fix this by removing the (fairly useless) message. Moving the completion later causes a deadlock instead, so that's not an option.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +1 -8
@@ -1639,15 +1639,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)* else from proceeding if the module fails to load * or hangs loading. */ -if (load_module) { +if (load_module)request_module ("%s" , op->name); -#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR -if (err) -IWL_ERR (drv, -"failed to load module %s (error %d), is dynamic loading enabled?\n" , - op->name, err); -#endif - } failure = false; goto free;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 166/217 iwlwifi: mvm: Fix calculation of frame length
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 40a0b38d7a7f91a6027287e0df54f5f547e8d27e ]
The RADA might include in the Rx frame the MIC and CRC bytes. These bytes should be removed for non monitor interfaces and should not be passed to mac80211.
Fix the Rx processing to remove the extra bytes on non monitor cases.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +27 -0
@@ -121,12 +121,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb,struct iwl_rx_mpdu_desc *desc = (void *)pkt->data;unsigned int headlen, fraglen, pad_len =0 ;unsigned int hdrlen =ieee80211_hdrlen (hdr->frame_control); +u8 mic_crc_len =u8_get_bits (desc->mac_flags1, +IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK ) <<1 ;if (desc->mac_flags2 &IWL_RX_MPDU_MFLG2_PAD ) { len -=2 ; pad_len =2 ; } +/* +* For non monitor interface strip the bytes the RADA might not have +* removed. As monitor interface cannot exist with other interfaces +* this removal is safe. +*/ +if (mic_crc_len && !ieee80211_hw_check (mvm->hw,RX_INCLUDES_FCS )) { +u32 pkt_flags =le32_to_cpu (pkt->len_n_flags); + +/* +* If RADA was not enabled then decryption was not performed so +* the MIC cannot be removed. +*/ +if (!(pkt_flags &FH_RSCSR_RADA_EN )) { +if (WARN_ON (crypt_len > mic_crc_len)) +return -EINVAL ; + + mic_crc_len -= crypt_len; + } + +if (WARN_ON (mic_crc_len > len)) +return -EINVAL ; + + len -= mic_crc_len; + } +/* If frame is small enough to fit in skb->head, pull it completely. * If not, only pull ieee80211_hdr (including crypto if present, and * an additional 8 bytes for SNAP/ethertype, see below) so that
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 167/217 iwlwifi: mvm: fix AUX ROC removal
In reply to Sasha LevinFrom: Avraham Stern <[email protected]>
[ Upstream commit f0337cb48f3bf5f0bbccc985d8a0a8c4aa4934b7 ]
When IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD is set, removing a time event always tries to cancel session protection. However, AUX ROC does not use session protection so it was never removed. As a result, if the driver tries to allocate another AUX ROC event right after cancelling the first one, it will fail with a warning.
In addition, the time event data passed to iwl_mvm_remove_aux_roc_te() is incorrect. Fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +6 -3
@@ -687,11 +687,14 @@ static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm,iwl_mvm_te_clear_data (mvm, te_data);spin_unlock_bh (&mvm->time_event_lock); -/* When session protection is supported, the te_data->id field +/* When session protection is used, the te_data->id field * is reused to save session protection's configuration. +* For AUX ROC, HOT_SPOT_CMD is used and the te_data->id field is set +* to HOT_SPOT_CMD. */ if (fw_has_capa (&mvm->fw->ucode_capa, -IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD )) { +IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD ) && + id !=HOT_SPOT_CMD ) {if (mvmvif && id <SESSION_PROTECT_CONF_MAX_ID ) {/* Session protection is still ongoing. Cancel it */ iwl_mvm_cancel_session_protection (mvm, mvmvif, id);
@@ -1027,7 +1030,7 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif)iwl_mvm_p2p_roc_finished (mvm); }else {iwl_mvm_remove_aux_roc_te (mvm, mvmvif, - &mvmvif->time_event_data); + &mvmvif->hs_time_event_data);iwl_mvm_roc_finished (mvm); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 168/217 iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ
In reply to Sasha LevinFrom: Luca Coelho <[email protected]>
[ Upstream commit 459fc0f2c6b0f6e280bfa0f230c100c9dfe3a199 ]
In some rare cases when the HW is in a bad state, we may get this interrupt when prph_info is not set yet. Then we will try to dereference it to check the sleep_notif element, which will cause an oops.
Fix that by ignoring the interrupt if prph_info is not set yet.
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +6 -1
@@ -2266,7 +2266,12 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id) } } -if (inta_hw &MSIX_HW_INT_CAUSES_REG_WAKEUP ) { +/* +* In some rare cases when the HW is in a bad state, we may +* get this interrupt too early, when prph_info is still NULL. +* So make sure that it's not NULL to prevent crashing. +*/ +if (inta_hw &MSIX_HW_INT_CAUSES_REG_WAKEUP && trans_pcie->prph_info) {u32 sleep_notif =le32_to_cpu (trans_pcie->prph_info->sleep_notif); if (sleep_notif == IWL_D3_SLEEP_STATUS_SUSPEND ||
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 169/217 mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms
In reply to Sasha LevinFrom: Hector Martin <[email protected]>
[ Upstream commit 189f1d9bc3a5ea3e442e119e4a5deda63da8c462 ]
This is required on some Apple ARM64 laptops using this controller. As is typical on DT platforms, pull these quirks from the device tree using the standard mmc bindings.
See Documentation/devicetree/bindings/mmc/mmc-controller.yaml
--- drivers/mmc/host/sdhci-pci-gli.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/mmc/host/sdhci-pci-gli.c +11 -0
@@ -12,6 +12,7 @@#include <linux/pci.h> #include <linux/mmc/mmc.h> #include <linux/delay.h> +#include <linux/of.h> #include "sdhci.h" #include "sdhci-pci.h" #include "cqhci.h"
@@ -116,6 +117,8 @@#define PCI_GLI_9755_PECONF 0x44#define PCI_GLI_9755_LFCLK GENMASK(14, 12)#define PCI_GLI_9755_DMACLK BIT(29) +#define PCI_GLI_9755_INVERT_CD BIT(30) +#define PCI_GLI_9755_INVERT_WP BIT(31)#define PCI_GLI_9755_CFG2 0x48#define PCI_GLI_9755_CFG2_L1DLY GENMASK(28, 24)
@@ -570,6 +573,14 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot)gl9755_wt_on (pdev);pci_read_config_dword (pdev,PCI_GLI_9755_PECONF , &value); +/* +* Apple ARM64 platforms using these chips may have +* inverted CD/WP detection. +*/ +if (of_property_read_bool (pdev->dev.of_node,"cd-inverted" )) + value |=PCI_GLI_9755_INVERT_CD ; +if (of_property_read_bool (pdev->dev.of_node,"wp-inverted" )) + value |=PCI_GLI_9755_INVERT_WP ; value &= ~PCI_GLI_9755_LFCLK ; value &= ~PCI_GLI_9755_DMACLK ;pci_write_config_dword (pdev,PCI_GLI_9755_PECONF , value);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 170/217 block: check minor range in device_add_disk()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit e338924bd05d6e71574bc13e310c89e10e49a8a5 ]
ioctl(fd, LOOP_CTL_ADD, 1048576) causes
sysfs: cannot create duplicate filename '/dev/block/7:0'
message because such request is treated as if ioctl(fd, LOOP_CTL_ADD, 0) due to MINORMASK == 1048575. Verify that all minor numbers for that device fit in the minor range.
--- block/genhd.c | 2 ++ 1 file changed, 2 insertions(+)
block/genhd.c +2 -0
@@ -425,6 +425,8 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, DISK_MAX_PARTS); disk->minors =DISK_MAX_PARTS ; } +if (disk->first_minor + disk->minors >MINORMASK +1 ) +return -EINVAL ; }else {if (WARN_ON (disk->minors))return -EINVAL ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 171/217 um: registers: Rename function names to avoid conflicts and build problems
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 077b7320942b64b0da182aefd83c374462a65535 ]
The function names init_registers() and restore_registers() are used in several net/ethernet/ and gpu/drm/ drivers for other purposes (not calls to UML functions), so rename them.
This fixes multiple build errors.
--- arch/um/include/shared/registers.h | 4 ++-- arch/um/os-Linux/registers.c | 4 ++-- arch/um/os-Linux/start_up.c | 2 +- arch/x86/um/syscalls_64.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-)
arch/um/include/shared/registers.h +2 -2
@@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs);extern int save_fpx_registers (int pid,unsigned long *fp_regs);extern int restore_fpx_registers (int pid,unsigned long *fp_regs);extern int save_registers (int pid,struct uml_pt_regs *regs); -extern int restore_registers (int pid,struct uml_pt_regs *regs); -extern int init_registers (int pid); +extern int restore_pid_registers (int pid,struct uml_pt_regs *regs); +extern int init_pid_registers (int pid);extern void get_safe_registers (unsigned long *regs,unsigned long *fp_regs);extern unsigned long get_thread_reg (int reg,jmp_buf *buf);extern int get_fp_registers (int pid,unsigned long *regs);
arch/um/os-Linux/registers.c +2 -2
@@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs)return 0 ; } -int restore_registers (int pid,struct uml_pt_regs *regs) +int restore_pid_registers (int pid,struct uml_pt_regs *regs) {int err;
@@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs)static unsigned long exec_regs[MAX_REG_NR ];static unsigned long exec_fp_regs[FP_SIZE ]; -int init_registers (int pid) +int init_pid_registers (int pid) {int err;
arch/um/os-Linux/start_up.c +1 -1
@@ -368,7 +368,7 @@ void __init os_early_checks(void)check_tmpexec (); pid =start_ptraced_child (); -if (init_registers (pid)) +if (init_pid_registers (pid))fatal ("Failed to initialize default registers" );stop_ptraced_child (pid,1 ,1 ); }
arch/x86/um/syscalls_64.c +2 -1
@@ -11,6 +11,7 @@#include <linux/uaccess.h> #include <asm/prctl.h> /* XXX This should get the constants from libc */ #include <os.h> +#include <registers.h> long arch_prctl (struct task_struct *task,int option,unsigned long __user *arg2)
@@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option,switch (option) {case ARCH_SET_FS :case ARCH_SET_GS : - ret =restore_registers (pid, ¤t->thread.regs.regs); + ret =restore_pid_registers (pid, ¤t->thread.regs.regs);if (ret)return ret;break ;
Signature · 7 lines
2.34.1 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Sasha Levin
maintainerPATCH 172/217 ath11k: Fix napi related hang
In reply to Sasha LevinFrom: Ben Greear <[email protected]>
[ Upstream commit d943fdad7589653065be0e20aadc6dff37725ed4 ]
Similar to the same bug in ath10k, a napi disable w/out it being enabled will hang forever. I believe I saw this while trying rmmod after driver had some failure on startup. Fix it by keeping state on whether napi is enabled or not.
And, remove un-used napi pointer in ath11k driver base struct.
--- drivers/net/wireless/ath/ath11k/ahb.c | 12 +++++++++--- drivers/net/wireless/ath/ath11k/core.h | 2 +- drivers/net/wireless/ath/ath11k/pci.c | 12 +++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +9 -3
@@ -175,8 +175,11 @@ static void __ath11k_ahb_ext_irq_disable(struct ath11k_base *ab)ath11k_ahb_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; + } } }
@@ -300,7 +303,10 @@ static void ath11k_ahb_ext_irq_enable(struct ath11k_base *ab)for (i =0 ; i <ATH11K_EXT_IRQ_GRP_NUM_MAX ; i++) {struct ath11k_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; + }ath11k_ahb_ext_grp_enable (irq_grp); } }
drivers/net/wireless/ath/ath11k/core.h +1 -1
@@ -136,6 +136,7 @@ struct ath11k_ext_irq_grp {u32 num_irq;u32 grp_id;u64 timestamp; +bool napi_enabled;struct napi_struct napi;struct net_device napi_ndev; };
@@ -713,7 +714,6 @@ struct ath11k_base {u32 wlan_init_status;int irq_num[ATH11K_IRQ_NUM_MAX ];struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX ]; -struct napi_struct *napi;struct ath11k_targ_cap target_caps;u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE ];bool pdevs_macaddr_valid;
drivers/net/wireless/ath/ath11k/pci.c +9 -3
@@ -634,8 +634,11 @@ static void __ath11k_pci_ext_irq_disable(struct ath11k_base *sc)ath11k_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; + } } }
@@ -654,7 +657,10 @@ static void ath11k_pci_ext_irq_enable(struct ath11k_base *ab)for (i =0 ; i <ATH11K_EXT_IRQ_GRP_NUM_MAX ; i++) {struct ath11k_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; + }ath11k_pci_ext_grp_enable (irq_grp); } }
Signature · 7 lines
2.34.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 173/217 Bluetooth: btintel: Add missing quirks and msft ext for legacy bootloader
In reply to Sasha LevinFrom: Tedd Ho-Jeong An <[email protected]>
[ Upstream commit 3547a008c8962df2175db1e78b80f27e027ec549 ]
This patch add missing HCI quirks and MSFT extension for legacy bootloader when it is running in the operational firmware.
--- drivers/bluetooth/btintel.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/bluetooth/btintel.c +22 -4
@@ -2492,10 +2492,14 @@ static int btintel_setup_combined(struct hci_dev *hdev)case 0x12 :/* ThP */ case 0x13 :/* HrP */ case 0x14 :/* CcP */ -/* Some legacy bootloader devices from JfP supports both old -* and TLV based HCI_Intel_Read_Version command. But we don't -* want to use the TLV based setup routines for those legacy -* bootloader device. +/* Some legacy bootloader devices starting from JfP, +* the operational firmware supports both old and TLV based +* HCI_Intel_Read_Version command based on the command +* parameter. +* +* For upgrading firmware case, the TLV based version cannot +* be used because the firmware filename for legacy bootloader +* is based on the old format. * * Also, it is not easy to convert TLV based version from the * legacy version format.
@@ -2507,6 +2511,20 @@ static int btintel_setup_combined(struct hci_dev *hdev) err =btintel_read_version (hdev, &ver);if (err)return err; + +/* Apply the device specific HCI quirks +* +* All Legacy bootloader devices support WBS +*/ +set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks); + +/* Valid LE States quirk for JfP/ThP familiy */ +if (ver.hw_variant ==0x11 || ver.hw_variant ==0x12 ) +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); + +/* Setup MSFT Extension support */ +btintel_set_msft_opcode (hdev, ver.hw_variant); + err =btintel_bootloader_setup (hdev, &ver);break ;case 0x17 :
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 174/217 cpufreq: intel_pstate: Update cpuinfo.max_freq on HWP_CAP changes
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit dfeeedc1bf5772226bddf51ed3f853e5a6707bf1 ]
With HWP enabled, when the turbo range of performance levels is disabled by the platform firmware, the CPU capacity is given by the "guaranteed performance" field in MSR_HWP_CAPABILITIES which is generally dynamic. When it changes, the kernel receives an HWP notification interrupt handled by notify_hwp_interrupt().
When the "guaranteed performance" value changes in the above configuration, the CPU performance scaling needs to be adjusted so as to use the new CPU capacity in computations, which means that the cpuinfo.max_freq value needs to be updated for that CPU.
Accordingly, modify intel_pstate_notify_work() to read MSR_HWP_CAPABILITIES and update cpuinfo.max_freq to reflect the new configuration (this update can be carried out even if the configuration doesn't actually change, because it simply doesn't matter then and it takes less time to update it than to do extra checks to decide whether or not a change has really occurred).
--- drivers/cpufreq/intel_pstate.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/cpufreq/intel_pstate.c +17 -7
@@ -1124,19 +1124,22 @@ static void intel_pstate_update_policies(void)cpufreq_update_policy (cpu); } +static void __intel_pstate_update_max_freq (struct cpudata *cpudata, +struct cpufreq_policy *policy) +{ + policy->cpuinfo.max_freq = global.turbo_disabled_mf ? + cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; +refresh_frequency_limits (policy); +} +static void intel_pstate_update_max_freq (unsigned int cpu) {struct cpufreq_policy *policy =cpufreq_cpu_acquire (cpu); -struct cpudata *cpudata;if (!policy)return ; - cpudata = all_cpu_data[cpu]; - policy->cpuinfo.max_freq = global.turbo_disabled_mf ? - cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; - -refresh_frequency_limits (policy); +__intel_pstate_update_max_freq (all_cpu_data[cpu], policy);cpufreq_cpu_release (policy); }
@@ -1584,8 +1587,15 @@ static void intel_pstate_notify_work(struct work_struct *work) {struct cpudata *cpudata = container_of(to_delayed_work(work), struct cpudata, hwp_notify_work); +struct cpufreq_policy *policy =cpufreq_cpu_acquire (cpudata->cpu); + +if (policy) { +intel_pstate_get_hwp_cap (cpudata); +__intel_pstate_update_max_freq (cpudata, policy); + +cpufreq_cpu_release (policy); + } -cpufreq_update_policy (cpudata->cpu);wrmsrl_on_cpu (cpudata->cpu,MSR_HWP_STATUS ,0 ); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 175/217 Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit cfb4c313be670fd4bd09650216620fa4514cdb93 ]
This set HCI_QUIRK_VALID_LE_STATES quirk which is required for the likes of experimental LE simultaneous roles.
--- drivers/bluetooth/hci_vhci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/hci_vhci.c +2 -0
@@ -237,6 +237,8 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)if (opcode &0x80 )set_bit (HCI_QUIRK_RAW_DEVICE , &hdev->quirks); +set_bit (HCI_QUIRK_VALID_LE_STATES , &hdev->quirks); +if (hci_register_dev (hdev) <0 ) {BT_ERR ("Can't register HCI device" );hci_free_dev (hdev);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 176/217 xfrm: rate limit SA mapping change message to user space
In reply to Sasha LevinFrom: Antony Antony <[email protected]>
[ Upstream commit 4e484b3e969b52effd95c17f7a86f39208b2ccf4 ]
Kernel generates mapping change message, XFRM_MSG_MAPPING, when a source port chage is detected on a input state with UDP encapsulation set. Kernel generates a message for each IPsec packet with new source port. For a high speed flow per packet mapping change message can be excessive, and can overload the user space listener.
Introduce rate limiting for XFRM_MSG_MAPPING message to the user space.
The rate limiting is configurable via netlink, when adding a new SA or updating it. Use the new attribute XFRMA_MTIMER_THRESH in seconds.
v1->v2 change:
update xfrm_sa_len()
v2->v3 changes:
use u32 insted unsigned long to reduce size of struct xfrm_state fix xfrm_ompat size Reported-by: kernel test robot <[email protected]> accept XFRM_MSG_MAPPING only when XFRMA_ENCAP is present
--- include/net/xfrm.h | 5 +++++ include/uapi/linux/xfrm.h | 1 + net/xfrm/xfrm_compat.c | 6 ++++-- net/xfrm/xfrm_state.c | 23 ++++++++++++++++++++++- net/xfrm/xfrm_user.c | 18 +++++++++++++++++- 5 files changed, 49 insertions(+), 4 deletions(-)
include/net/xfrm.h +5 -0
@@ -200,6 +200,11 @@ struct xfrm_state {struct xfrm_algo_aead *aead;const char *geniv; +/* mapping change rate limiting */ +__be16 new_mapping_sport; +u32 new_mapping;/* seconds */ +u32 mapping_maxage;/* seconds for input SA */ +/* Data for encapsulator */ struct xfrm_encap_tmpl *encap;struct sock __rcu *encap_sk;
include/uapi/linux/xfrm.h +1 -0
@@ -313,6 +313,7 @@ enum xfrm_attr_type_t {XFRMA_SET_MARK ,/* __u32 */ XFRMA_SET_MARK_MASK ,/* __u32 */ XFRMA_IF_ID ,/* __u32 */ +XFRMA_MTIMER_THRESH ,/* __u32 in seconds for input SA */ __XFRMA_MAX#define XFRMA_OUTPUT_MARK XFRMA_SET_MARK/* Compatibility */
net/xfrm/xfrm_compat.c +4 -2
@@ -127,6 +127,7 @@ static const struct nla_policy compat_policy[XFRMA_MAX+1] = { [XFRMA_SET_MARK] = { .type = NLA_U32 }, [XFRMA_SET_MARK_MASK] = { .type = NLA_U32 }, [XFRMA_IF_ID] = { .type = NLA_U32 }, + [XFRMA_MTIMER_THRESH] = { .type = NLA_U32 }, }; static struct nlmsghdr *xfrm_nlmsg_put_compat(struct sk_buff *skb,
@@ -274,9 +275,10 @@ static int xfrm_xlate64_attr(struct sk_buff *dst, const struct nlattr *src)case XFRMA_SET_MARK :case XFRMA_SET_MARK_MASK :case XFRMA_IF_ID : +case XFRMA_MTIMER_THRESH :return xfrm_nla_cpy (dst, src,nla_len (src));default : -BUILD_BUG_ON (XFRMA_MAX !=XFRMA_IF_ID ); +BUILD_BUG_ON (XFRMA_MAX !=XFRMA_MTIMER_THRESH );pr_warn_once ("unsupported nla_type %d\n" , src->nla_type);return -EOPNOTSUPP ; }
@@ -431,7 +433,7 @@ static int xfrm_xlate32_attr(void *dst, const struct nlattr *nla,int err;if (type >XFRMA_MAX ) { -BUILD_BUG_ON (XFRMA_MAX !=XFRMA_IF_ID ); +BUILD_BUG_ON (XFRMA_MAX !=XFRMA_MTIMER_THRESH );NL_SET_ERR_MSG (extack,"Bad attribute" );return -EOPNOTSUPP ; }
net/xfrm/xfrm_state.c +22 -1
@@ -1593,6 +1593,9 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, x->km.seq = orig->km.seq; x->replay = orig->replay; x->preplay = orig->preplay; + x->mapping_maxage = orig->mapping_maxage; + x->new_mapping =0 ; + x->new_mapping_sport =0 ;return x;
@@ -2242,7 +2245,7 @@ int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol) }EXPORT_SYMBOL (km_query); -int km_new_mapping (struct xfrm_state *x,xfrm_address_t *ipaddr,__be16 sport) +static int __km_new_mapping (struct xfrm_state *x,xfrm_address_t *ipaddr,__be16 sport) {int err = -EINVAL ;struct xfrm_mgr *km;
@@ -2257,6 +2260,24 @@ int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport)rcu_read_unlock ();return err; } + +int km_new_mapping (struct xfrm_state *x,xfrm_address_t *ipaddr,__be16 sport) +{ +int ret =0 ; + +if (x->mapping_maxage) { +if ((jiffies /HZ - x->new_mapping) > x->mapping_maxage || + x->new_mapping_sport != sport) { + x->new_mapping_sport = sport; + x->new_mapping = jiffies /HZ ; + ret =__km_new_mapping (x, ipaddr, sport); + } + }else { + ret =__km_new_mapping (x, ipaddr, sport); + } + +return ret; +}EXPORT_SYMBOL (km_new_mapping);void km_policy_expired (struct xfrm_policy *pol,int dir,int hard,u32 portid)
net/xfrm/xfrm_user.c +17 -1
@@ -282,6 +282,10 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, err =0 ; +if (attrs[XFRMA_MTIMER_THRESH ]) +if (!attrs[XFRMA_ENCAP ]) + err = -EINVAL ; + out:return err; }
@@ -521,6 +525,7 @@ static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs,struct nlattr *lt = attrs[XFRMA_LTIME_VAL ];struct nlattr *et = attrs[XFRMA_ETIMER_THRESH ];struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH ]; +struct nlattr *mt = attrs[XFRMA_MTIMER_THRESH ];if (re) {struct xfrm_replay_state_esn *replay_esn;
@@ -552,6 +557,9 @@ static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs,if (rt) x->replay_maxdiff =nla_get_u32 (rt); + +if (mt) + x->mapping_maxage =nla_get_u32 (mt); }static void xfrm_smark_init (struct nlattr **attrs,struct xfrm_mark *m)
@@ -1024,8 +1032,13 @@ static int copy_to_user_state_extra(struct xfrm_state *x,if (ret) goto out; } -if (x->security) +if (x->security) { ret =copy_sec_ctx (x->security, skb); +if (ret) + goto out; + } +if (x->mapping_maxage) + ret =nla_put_u32 (skb,XFRMA_MTIMER_THRESH , x->mapping_maxage); out:return ret; }
@@ -3069,6 +3082,9 @@ static inline unsigned int xfrm_sa_len(struct xfrm_state *x)/* Must count x->lastused as it may become non-zero behind our back. */ l +=nla_total_size_64bit (sizeof (u64)); +if (x->mapping_maxage) + l +=nla_total_size (sizeof (x->mapping_maxage)); +return l; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 177/217 drm/etnaviv: consider completed fence seqno in hang check
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit cdd156955f946beaa5f3a00d8ccf90e5a197becc ]
Some GPU heavy test programs manage to trigger the hangcheck quite often. If there are no other GPU users in the system and the test program exhibits a very regular structure in the commandstreams that are being submitted, we can end up with two distinct submits managing to trigger the hangcheck with the FE in a very similar address range. This leads the hangcheck to believe that the GPU is stuck, while in reality the GPU is already busy working on a different job. To avoid those spurious GPU resets, also remember and consider the last completed fence seqno in the hang check.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 + drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.h +1 -0
@@ -130,6 +130,7 @@ struct etnaviv_gpu {/* hang detection */ u32 hangcheck_dma_addr; +u32 hangcheck_fence;void __iomem *mmio;int irq;
drivers/gpu/drm/etnaviv/etnaviv_sched.c +3 -1
@@ -107,8 +107,10 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job*/ dma_addr =gpu_read (gpu,VIVS_FE_DMA_ADDRESS ); change = dma_addr - gpu->hangcheck_dma_addr; -if (change <0 || change >16 ) { +if (gpu->completed_fence != gpu->hangcheck_fence || + change <0 || change >16 ) { gpu->hangcheck_dma_addr = dma_addr; + gpu->hangcheck_fence = gpu->completed_fence; goto out_no_timeout; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 178/217 jffs2: GC deadlock reading a page that is used in jffs2_write_begin()
In reply to Sasha LevinFrom: Kyeong Yoo <[email protected]>
[ Upstream commit aa39cc675799bc92da153af9a13d6f969c348e82 ]
GC task can deadlock in read_cache_page() because it may attempt to release a page that is actually allocated by another task in jffs2_write_begin().
The reason is that in jffs2_write_begin() there is a small window a cache page is allocated for use but not set Uptodate yet.
This ends up with a deadlock between two tasks:
1) A task (e.g. file copy)
- jffs2_write_begin() locks a cache page
- jffs2_write_end() tries to lock "alloc_sem" from
jffs2_reserve_space() <-- STUCK
2) GC task (jffs2_gcd_mtd3)
- jffs2_garbage_collect_pass() locks "alloc_sem"
- try to lock the same cache page in read_cache_page() <-- STUCK
So to avoid this deadlock, hold "alloc_sem" in jffs2_write_begin() while reading data in a cache page.
--- fs/jffs2/file.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-)
fs/jffs2/file.c +25 -15
@@ -136,20 +136,15 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,struct page *pg;struct inode *inode = mapping->host;struct jffs2_inode_info *f =JFFS2_INODE_INFO (inode); +struct jffs2_sb_info *c =JFFS2_SB_INFO (inode->i_sb);pgoff_t index = pos >>PAGE_SHIFT ;uint32_t pageofs = index <<PAGE_SHIFT ;int ret =0 ; - pg =grab_cache_page_write_begin (mapping, index, flags); -if (!pg) -return -ENOMEM ; - *pagep = pg; -jffs2_dbg (1 ,"%s()\n" , __func__);if (pageofs > inode->i_size) {/* Make new hole frag from old EOF to new page */ -struct jffs2_sb_info *c =JFFS2_SB_INFO (inode->i_sb);struct jffs2_raw_inode ri;struct jffs2_full_dnode *fn;uint32_t alloc_len;
@@ -160,7 +155,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, ret =jffs2_reserve_space (c,sizeof (ri), &alloc_len,ALLOC_NORMAL ,JFFS2_SUMMARY_INODE_SIZE );if (ret) - goto out_page; + goto out_err;mutex_lock (&f->sem);memset (&ri,0 ,sizeof (ri));
@@ -190,7 +185,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, ret =PTR_ERR (fn);jffs2_complete_reservation (c);mutex_unlock (&f->sem); - goto out_page; + goto out_err; } ret =jffs2_add_full_dnode_to_inode (c, f, fn);if (f->metadata) {
@@ -205,13 +200,26 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,jffs2_free_full_dnode (fn);jffs2_complete_reservation (c);mutex_unlock (&f->sem); - goto out_page; + goto out_err; }jffs2_complete_reservation (c); inode->i_size = pageofs;mutex_unlock (&f->sem); } +/* +* While getting a page and reading data in, lock c->alloc_sem until +* the page is Uptodate. Otherwise GC task may attempt to read the same +* page in read_cache_page(), which causes a deadlock. +*/ +mutex_lock (&c->alloc_sem); + pg =grab_cache_page_write_begin (mapping, index, flags); +if (!pg) { + ret = -ENOMEM ; + goto release_sem; + } + *pagep = pg; +/* * Read in the page if it wasn't already present. Cannot optimize away * the whole page write case until jffs2_write_end can handle the
@@ -221,15 +229,17 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,mutex_lock (&f->sem); ret =jffs2_do_readpage_nolock (inode, pg);mutex_unlock (&f->sem); -if (ret) - goto out_page; +if (ret) { +unlock_page (pg); +put_page (pg); + goto release_sem; + } }jffs2_dbg (1 ,"end write_begin(). pg->flags %lx\n" , pg->flags); -return ret; -out_page: -unlock_page (pg); -put_page (pg); +release_sem: +mutex_unlock (&c->alloc_sem); +out_err:return ret; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 179/217 ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions
In reply to Sasha LevinFrom: Mark Langsdorf <[email protected]>
[ Upstream commit f81bdeaf816142e0729eea0cc84c395ec9673151 ]
ACPICA commit bc02c76d518135531483dfc276ed28b7ee632ce1
The current ACPI_ACCESS_*_WIDTH defines do not provide a way to test that size is small enough to not cause an overflow when applied to a 32-bit integer.
Rather than adding more magic numbers, add ACPI_ACCESS_*_SHIFT, ACPI_ACCESS_*_MAX, and ACPI_ACCESS_*_DEFAULT #defines and redefine ACPI_ACCESS_*_WIDTH in terms of the new #defines.
This was inititally reported on Linux where a size of 102 in ACPI_ACCESS_BIT_WIDTH caused an overflow error in the SPCR initialization code.
--- include/acpi/actypes.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/acpi/actypes.h +8 -2
@@ -536,8 +536,14 @@ typedef u64 acpi_integer;* Can be used with access_width of struct acpi_generic_address and access_size of * struct acpi_resource_generic_register. */ -#define ACPI_ACCESS_BIT_WIDTH (size) (1 << ((size) + 2)) -#define ACPI_ACCESS_BYTE_WIDTH (size) (1 << ((size) - 1)) +#define ACPI_ACCESS_BIT_SHIFT 2 +#define ACPI_ACCESS_BYTE_SHIFT -1 +#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_WIDTH (size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) +#define ACPI_ACCESS_BYTE_WIDTH (size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT))/******************************************************************************* *
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 180/217 ACPICA: Utilities: Avoid deleting the same object twice in a row
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 1cdfe9e346b4c5509ffe19ccde880fd259d9f7a3 ]
ACPICA commit c11af67d8f7e3d381068ce7771322f2b5324d687
If original_count is 0 in acpi_ut_update_ref_count (), acpi_ut_delete_internal_obj () is invoked for the target object, which is incorrect, because that object has been deleted once already and the memory allocated to store it may have been reclaimed and allocated for a different purpose by the host OS. Moreover, a confusing debug message following the "Reference Count is already zero, cannot decrement" warning is printed in that case.
To fix this issue, make acpi_ut_update_ref_count () return after finding that original_count is 0 and printing the above warning.
--- drivers/acpi/acpica/utdelete.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpica/utdelete.c +1 -0
@@ -422,6 +422,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)ACPI_WARNING ((AE_INFO ,"Obj %p, Reference Count is already zero, cannot decrement\n" , object)); +return ; } ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 181/217 ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R()
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 24ea5f90ec9548044a6209685c5010edd66ffe8f ]
ACPICA commit d984f12041392fa4156b52e2f7e5c5e7bc38ad9e
If Operand[0] is a reference of the ACPI_REFCLASS_REFOF class, acpi_ex_opcode_1A_0T_1R () calls acpi_ns_get_attached_object () to obtain return_desc which may require additional resolution with the help of acpi_ex_read_data_from_field (). If the latter fails, the reference counter of the original return_desc is decremented which is incorrect, because acpi_ns_get_attached_object () does not increment the reference counter of the object returned by it.
This issue may lead to premature deletion of the attached object while it is still attached and a use-after-free and crash in the host OS. For example, this may happen when on evaluation of ref_of() a local region field where there is no registered handler for the given Operation Region.
Fix it by making acpi_ex_opcode_1A_0T_1R () return Status right away after a acpi_ex_read_data_from_field () failure.
--- drivers/acpi/acpica/exoparg1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/acpica/exoparg1.c +2 -1
@@ -1007,7 +1007,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) (walk_state, return_desc, &temp_desc);if (ACPI_FAILURE (status)) { - goto cleanup; +return_ACPI_STATUS + (status); } return_desc = temp_desc;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 182/217 ACPICA: Fix wrong interpretation of PCC address
In reply to Sasha LevinFrom: Sudeep Holla <[email protected]>
[ Upstream commit 9a3b8655db1ada31c82189ae13f40eb25da48c35 ]
ACPICA commit 41be6afacfdaec2dba3a5ed368736babc2a7aa5c
With the PCC Opregion in the firmware and we are hitting below kernel crash:
-->8
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 Workqueue: pm pm_runtime_work pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __memcpy+0x54/0x260 lr : acpi_ex_write_data_to_field+0xb8/0x194 Call trace: __memcpy+0x54/0x260 acpi_ex_store_object_to_node+0xa4/0x1d4 acpi_ex_store+0x44/0x164 acpi_ex_opcode_1A_1T_1R+0x25c/0x508 acpi_ds_exec_end_op+0x1b4/0x44c acpi_ps_parse_loop+0x3a8/0x614 acpi_ps_parse_aml+0x90/0x2f4 acpi_ps_execute_method+0x11c/0x19c acpi_ns_evaluate+0x1ec/0x2b0 acpi_evaluate_object+0x170/0x2b0 acpi_device_set_power+0x118/0x310 acpi_dev_suspend+0xd4/0x180 acpi_subsys_runtime_suspend+0x28/0x38 __rpm_callback+0x74/0x328 rpm_suspend+0x2d8/0x624 pm_runtime_work+0xa4/0xb8 process_one_work+0x194/0x25c worker_thread+0x260/0x49c kthread+0x14c/0x30c ret_from_fork+0x10/0x20 Code: f9000006 f81f80a7 d65f03c0 361000c2 (b9400026) ---[ end trace 24d8a032fa77b68a ]---
The reason for the crash is that the PCC channel index passed via region.address in acpi_ex_store_object_to_node is interpreted as the channel subtype incorrectly.
Assuming the PCC op_region support is not used by any other type, let us remove the subtype check as the AML has no access to the subtype information. Once we remove it, the kernel crash disappears and correctly complains about missing PCC Opregion handler.
ACPI Error: No handler for Region [PFRM] ((____ptrval____)) [PCC] (20210730/evregion-130) ACPI Error: Region PCC (ID=10) has no handler (20210730/exfldio-261)
ACPI Error: Aborting method \_SB.ETH0._PS3 due to previous error (AE_NOT_EXIST) (20210730/psparse-531)
--- drivers/acpi/acpica/exfield.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/acpi/acpica/exfield.c +1 -6
@@ -330,12 +330,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, obj_desc->field.base_byte_offset, source_desc->buffer.pointer, data_length); -if ((obj_desc->field.region_obj->region.address == -PCC_MASTER_SUBSPACE - &&MASTER_SUBSPACE_COMMAND (obj_desc->field. - base_byte_offset)) - ||GENERIC_SUBSPACE_COMMAND (obj_desc->field. - base_byte_offset)) { +if (MASTER_SUBSPACE_COMMAND (obj_desc->field.base_byte_offset)) {/* Perform the write */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 183/217 ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5
In reply to Sasha LevinFrom: "Kirill A. Shutemov" <[email protected]>
[ Upstream commit 1d4e0b3abb168b2ee1eca99c527cffa1b80b6161 ]
ACPICA commit 3dd7e1f3996456ef81bfe14cba29860e8d42949e
According to ACPI 6.4, Section 16.2, the CPU cache flushing is required on entering to S1, S2, and S3, but the ACPICA code flushes the CPU cache regardless of the sleep state.
Blind cache flush on entering S5 causes problems for TDX.
Flushing happens with WBINVD that is not supported in the TDX environment.
TDX only supports S5 and adjusting ACPICA code to conform to the spec more strictly fixes the issue.
--- drivers/acpi/acpica/hwesleep.c | 4 +++- drivers/acpi/acpica/hwsleep.c | 4 +++- drivers/acpi/acpica/hwxfsleep.c | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/acpi/acpica/hwesleep.c +3 -1
@@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)/* Flush caches, as per ACPI specification */ -ACPI_FLUSH_CPU_CACHE (); +if (sleep_state <ACPI_STATE_S4 ) { +ACPI_FLUSH_CPU_CACHE (); + } status =acpi_os_enter_sleep (sleep_state, sleep_control,0 );if (status ==AE_CTRL_TERMINATE ) {
drivers/acpi/acpica/hwsleep.c +3 -1
@@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)/* Flush caches, as per ACPI specification */ -ACPI_FLUSH_CPU_CACHE (); +if (sleep_state <ACPI_STATE_S4 ) { +ACPI_FLUSH_CPU_CACHE (); + } status =acpi_os_enter_sleep (sleep_state, pm1a_control, pm1b_control);if (status ==AE_CTRL_TERMINATE ) {
drivers/acpi/acpica/hwxfsleep.c +0 -2
@@ -162,8 +162,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void)return_ACPI_STATUS (status); } -ACPI_FLUSH_CPU_CACHE (); - status =acpi_hw_write_port (acpi_gbl_FADT.smi_command, (u32 )acpi_gbl_FADT.s4_bios_request,8 );if (ACPI_FAILURE (status)) {
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 184/217 mmc: mtk-sd: Use readl_poll_timeout instead of open-coded polling
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit ffaea6ebfe9ce06ebb3a54811a47688f2b0893cd ]
Replace all instances of open-coded while loops for polling registers with calls to readl_poll_timeout() and, while at it, also fix some possible infinite loop instances.
--- drivers/mmc/host/mtk-sd.c | 64 ++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 25 deletions(-)
drivers/mmc/host/mtk-sd.c +39 -25
@@ -636,12 +636,11 @@ static void msdc_reset_hw(struct msdc_host *host)u32 val;sdr_set_bits (host->base +MSDC_CFG ,MSDC_CFG_RST ); -while (readl (host->base +MSDC_CFG ) &MSDC_CFG_RST ) -cpu_relax (); +readl_poll_timeout (host->base +MSDC_CFG , val, !(val &MSDC_CFG_RST ),0 ,0 );sdr_set_bits (host->base +MSDC_FIFOCS ,MSDC_FIFOCS_CLR ); -while (readl (host->base +MSDC_FIFOCS ) &MSDC_FIFOCS_CLR ) -cpu_relax (); +readl_poll_timeout (host->base +MSDC_FIFOCS , val, + !(val &MSDC_FIFOCS_CLR ),0 ,0 ); val =readl (host->base +MSDC_INT );writel (val, host->base +MSDC_INT );
@@ -814,8 +813,9 @@ static void msdc_gate_clock(struct msdc_host *host)clk_disable_unprepare (host->h_clk); } -static void msdc_ungate_clock (struct msdc_host *host) +static int msdc_ungate_clock (struct msdc_host *host) { +u32 val;int ret;clk_prepare_enable (host->h_clk);
@@ -825,11 +825,11 @@ static void msdc_ungate_clock(struct msdc_host *host) ret =clk_bulk_prepare_enable (MSDC_NR_CLOCKS , host->bulk_clks);if (ret) {dev_err (host->dev,"Cannot enable pclk/axi/ahb clock gates\n" ); -return ; +return ret; } -while (!(readl (host->base +MSDC_CFG ) &MSDC_CFG_CKSTB )) -cpu_relax (); +return readl_poll_timeout (host->base +MSDC_CFG , val, + (val &MSDC_CFG_CKSTB ),1 ,20000 ); }static void msdc_set_mclk (struct msdc_host *host,unsigned char timing,u32 hz)
@@ -840,6 +840,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)u32 div;u32 sclk;u32 tune_reg = host->dev_comp->pad_tune_reg; +u32 val;if (!hz) {dev_dbg (host->dev,"set mclk to 0\n" );
@@ -920,8 +921,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)else clk_prepare_enable (clk_get_parent (host->src_clk)); -while (!(readl (host->base +MSDC_CFG ) &MSDC_CFG_CKSTB )) -cpu_relax (); +readl_poll_timeout (host->base +MSDC_CFG , val, (val &MSDC_CFG_CKSTB ),0 ,0 );sdr_set_bits (host->base +MSDC_CFG ,MSDC_CFG_CKPDN ); mmc->actual_clock = sclk; host->mclk = hz;
@@ -1231,13 +1231,13 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,static inline bool msdc_cmd_is_ready (struct msdc_host *host,struct mmc_request *mrq,struct mmc_command *cmd) { -/* The max busy time we can endure is 20ms */ -unsigned long tmo = jiffies +msecs_to_jiffies (20 ); +u32 val; +int ret; -while ((readl (host->base +SDC_STS ) &SDC_STS_CMDBUSY ) && -time_before (jiffies, tmo)) -cpu_relax (); -if (readl (host->base +SDC_STS ) &SDC_STS_CMDBUSY ) { +/* The max busy time we can endure is 20ms */ + ret =readl_poll_timeout_atomic (host->base +SDC_STS , val, + !(val &SDC_STS_CMDBUSY ),1 ,20000 ); +if (ret) {dev_err (host->dev,"CMD bus busy detected\n" ); host->error |=REQ_CMD_BUSY ;msdc_cmd_done (host,MSDC_INT_CMDTMO , mrq, cmd);
@@ -1245,12 +1245,10 @@ static inline bool msdc_cmd_is_ready(struct msdc_host *host, }if (mmc_resp_type (cmd) ==MMC_RSP_R1B || cmd->data) { - tmo = jiffies +msecs_to_jiffies (20 );/* R1B or with data, should check SDCBUSY */ -while ((readl (host->base +SDC_STS ) &SDC_STS_SDCBUSY ) && -time_before (jiffies, tmo)) -cpu_relax (); -if (readl (host->base +SDC_STS ) &SDC_STS_SDCBUSY ) { + ret =readl_poll_timeout_atomic (host->base +SDC_STS , val, + !(val &SDC_STS_SDCBUSY ),1 ,20000 ); +if (ret) {dev_err (host->dev,"Controller busy detected\n" ); host->error |=REQ_CMD_BUSY ;msdc_cmd_done (host,MSDC_INT_CMDTMO , mrq, cmd);
@@ -1376,6 +1374,8 @@ static bool msdc_data_xfer_done(struct msdc_host *host, u32 events, (MSDC_INT_XFER_COMPL |MSDC_INT_DATCRCERR |MSDC_INT_DATTMO |MSDC_INT_DMA_BDCSERR |MSDC_INT_DMA_GPDCSERR |MSDC_INT_DMA_PROTECT ); +u32 val; +int ret;spin_lock_irqsave (&host->lock, flags); done = !host->data;
@@ -1392,8 +1392,14 @@ static bool msdc_data_xfer_done(struct msdc_host *host, u32 events, readl(host->base + MSDC_DMA_CFG));sdr_set_field (host->base +MSDC_DMA_CTRL ,MSDC_DMA_CTRL_STOP ,1 ); -while (readl (host->base +MSDC_DMA_CFG ) &MSDC_DMA_CFG_STS ) -cpu_relax (); + + ret =readl_poll_timeout_atomic (host->base +MSDC_DMA_CFG , val, + !(val &MSDC_DMA_CFG_STS ),1 ,20000 ); +if (ret) { +dev_dbg (host->dev,"DMA stop timed out\n" ); +return false; + } +sdr_clr_bits (host->base +MSDC_INTEN , data_ints_mask);dev_dbg (host->dev,"DMA stop\n" );
@@ -2674,7 +2680,11 @@ static int msdc_drv_probe(struct platform_device *pdev)spin_lock_init (&host->lock);platform_set_drvdata (pdev, mmc); -msdc_ungate_clock (host); + ret =msdc_ungate_clock (host); +if (ret) { +dev_err (&pdev->dev,"Cannot ungate clocks!\n" ); + goto release_mem; + }msdc_init_hw (host);if (mmc->caps2 &MMC_CAP2_CQE ) {
@@ -2833,8 +2843,12 @@ static int __maybe_unused msdc_runtime_resume(struct device *dev) {struct mmc_host *mmc =dev_get_drvdata (dev);struct msdc_host *host =mmc_priv (mmc); +int ret; + + ret =msdc_ungate_clock (host); +if (ret) +return ret; -msdc_ungate_clock (host);msdc_restore_reg (host);return 0 ; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 185/217 drm/amdgpu: Don't inherit GEM object VMAs in child process
In reply to Sasha LevinFrom: Rajneesh Bhardwaj <[email protected]>
[ Upstream commit fbcdbfde87509d523132b59f661a355c731139d0 ]
When an application having open file access to a node forks, its shared mappings also get reflected in the address space of child process even though it cannot access them with the object permissions applied. With the existing permission checks on the gem objects, it might be reasonable to also create the VMAs with VM_DONTCOPY flag so a user space application doesn't need to explicitly call the madvise(addr, len, MADV_DONTFORK) system call to prevent the pages in the mapped range to appear in the address space of the child process. It also prevents the memory leaks due to additional reference counts on the mapped BOs in the child process that prevented freeing the memory in the parent for which we had worked around earlier in the user space inside the thunk library.
Additionally, we faced this issue when using CRIU to checkpoint restore an application that had such inherited mappings in the child which confuse CRIU when it mmaps on restore. Having this flag set for the render node VMAs helps. VMAs mapped via KFD already take care of this so this is needed only for the render nodes.
To limit the impact of the change to user space consumers such as OpenGL etc, limit it to KFD BOs only.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -0
@@ -264,6 +264,9 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_str !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) vma->vm_flags &= ~VM_MAYWRITE; +if (bo->kfd_bo) + vma->vm_flags |=VM_DONTCOPY ; +return drm_gem_ttm_mmap (obj, vma); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 186/217 drm/amdgpu: fixup bad vram size on gmc v8
In reply to Sasha LevinFrom: Zongmin Zhou <[email protected]>
[ Upstream commit 11544d77e3974924c5a9c8a8320b996a3e9b2f8b ]
Some boards(like RX550) seem to have garbage in the upper 16 bits of the vram size register. Check for this and clamp the size properly. Fixes
boards reporting bogus amounts of vram.
after add this patch,the maximum GPU VRAM size is 64GB, otherwise only 64GB vram size will be used.
--- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +10 -3
@@ -515,10 +515,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev)static int gmc_v8_0_mc_init (struct amdgpu_device *adev) {int r; +u32 tmp; adev->gmc.vram_width =amdgpu_atombios_get_vram_width (adev);if (!adev->gmc.vram_width) { -u32 tmp;int chansize, numchan;/* Get VRAM informations */
@@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) adev->gmc.vram_width = numchan * chansize; }/* size in MB on si */ - adev->gmc.mc_vram_size =RREG32 (mmCONFIG_MEMSIZE) *1024ULL *1024ULL ; - adev->gmc.real_vram_size =RREG32 (mmCONFIG_MEMSIZE) *1024ULL *1024ULL ; + tmp =RREG32 (mmCONFIG_MEMSIZE); +/* some boards may have garbage in the upper 16 bits */ +if (tmp &0xffff0000 ) { +DRM_INFO ("Probable bad vram size: 0x%08x\n" , tmp); +if (tmp &0xffff ) + tmp &=0xffff ; + } + adev->gmc.mc_vram_size = tmp *1024ULL *1024ULL ; + adev->gmc.real_vram_size = adev->gmc.mc_vram_size;if (!(adev->flags &AMD_IS_APU )) { r =amdgpu_device_resize_fb_bar (adev);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 187/217 mfd: intel_soc_pmic: Use CPU-id check instead of _HRV check to differentiate variants
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 5b78223f55a0f516a1639dbe11cd4324d4aaee20 ]
The Intel Crystal Cove PMIC has 2 different variants, one for use with Bay Trail (BYT) SoCs and one for use with Cherry Trail (CHT) SoCs.
So far we have been using an ACPI _HRV check to differentiate between the 2, but at least on the Microsoft Surface 3, which is a CHT device, the wrong _HRV value is reported by ACPI.
So instead switch to a CPU-ID check which prevents us from relying on the possibly wrong ACPI _HRV value.
--- drivers/mfd/intel_soc_pmic_core.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
drivers/mfd/intel_soc_pmic_core.c +3 -25
@@ -14,15 +14,12 @@#include <linux/module.h> #include <linux/mfd/core.h> #include <linux/mfd/intel_soc_pmic.h> +#include <linux/platform_data/x86/soc.h> #include <linux/pwm.h> #include <linux/regmap.h> #include "intel_soc_pmic_core.h" -/* Crystal Cove PMIC shares same ACPI ID between different platforms */ -#define BYT_CRC_HRV 2 -#define CHT_CRC_HRV 3 -/* PWM consumed by the Intel GFX */ static struct pwm_lookup crc_pwm_lookup[] = {PWM_LOOKUP ("crystal_cove_pwm" ,0 ,"0000:00:02.0" ,"pwm_pmic_backlight" ,0 ,PWM_POLARITY_NORMAL ),
@@ -34,31 +31,12 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,struct device *dev = &i2c->dev;struct intel_soc_pmic_config *config;struct intel_soc_pmic *pmic; -unsigned long long hrv; -acpi_status status;int ret; -/* -* There are 2 different Crystal Cove PMICs a Bay Trail and Cherry -* Trail version, use _HRV to differentiate between the 2. -*/ - status =acpi_evaluate_integer (ACPI_HANDLE (dev),"_HRV" ,NULL , &hrv); -if (ACPI_FAILURE (status)) { -dev_err (dev,"Failed to get PMIC hardware revision\n" ); -return -ENODEV ; - } - -switch (hrv) { -case BYT_CRC_HRV : +if (soc_intel_is_byt ()) config = &intel_soc_pmic_config_byt_crc; -break ; -case CHT_CRC_HRV : +else config = &intel_soc_pmic_config_cht_crc; -break ; -default : -dev_warn (dev,"Unknown hardware rev %llu, assuming BYT\n" , hrv); - config = &intel_soc_pmic_config_byt_crc; - } pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL );if (!pmic)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 188/217 amdgpu/pm: Make sysfs pm attributes as read-only for VFs
In reply to Sasha LevinFrom: Marina Nikolic <[email protected]>
[ Upstream commit 11c9cc95f818f0f187e9b579a7f136f532b42445 ]
== Description ==
Setting values of pm attributes through sysfs should not be allowed in SRIOV mode.
These calls will not be processed by FW anyway, but error handling on sysfs level should be improved.
== Changes ==
This patch prohibits performing of all set commands in SRIOV mode on sysfs level.
It offers better error handling as calls that are not allowed will not be propagated further.
== Test ==
Writing to any sysfs file in passthrough mode will succeed. Writing to any sysfs file in ONEVF mode will yield error:
"calling process does not have sufficient permission to execute a command".
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -0
@@ -2123,6 +2123,12 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ } } +/* setting should not be allowed from VF */ +if (amdgpu_sriov_vf (adev)) { + dev_attr->attr.mode &= ~S_IWUGO ; + dev_attr->store =NULL ; + } +#undef DEVICE_ATTR_ISreturn 0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 189/217 ACPI: battery: Add the ThinkPad "Not Charging" quirk
In reply to Sasha LevinFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit e96c1197aca628f7d2480a1cc3214912b40b3414 ]
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
--- drivers/acpi/battery.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/acpi/battery.c +22 -0
@@ -53,6 +53,7 @@ static int battery_bix_broken_package;static int battery_notification_delay_ms;static int battery_ac_is_broken;static int battery_check_pmic =1 ; +static int battery_quirk_notcharging;static unsigned int cache_time =1000 ;module_param (cache_time, uint,0644 );MODULE_PARM_DESC (cache_time,"cache time in milliseconds" );
@@ -217,6 +218,8 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval =POWER_SUPPLY_STATUS_CHARGING ; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; + else if (battery_quirk_notcharging) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval = POWER_SUPPLY_STATUS_UNKNOWN; break;
@@ -1111,6 +1114,12 @@ battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init battery_quirk_not_charging (const struct dmi_system_id *d) +{ + battery_quirk_notcharging =1 ; +return 0 ; +} +static const struct dmi_system_id bat_dmi_table[]__initconst = { {/* NEC LZ750/LS */
@@ -1155,6 +1164,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), }, }, + { + /* + * On Lenovo ThinkPads the BIOS specification defines + * a state when the bits for charging and discharging + * are both set to 0. That state is "Not Charging". + */ + .callback = battery_quirk_not_charging, + .ident = "Lenovo ThinkPad", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, };
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 190/217 ACPI: CPPC: Check present CPUs for determining _CPC is valid
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 2aeca6bd02776d7f56a49a32be0dd184f204d888 ]
As this is a static check, it should be based upon what is currently present on the system. This makes probeing more deterministic.
While local APIC flags field (lapic_flags) of cpu core in MADT table is 0, then the cpu core won't be enabled. In this case, _CPC won't be found in this core, and return back to _CPC invalid with walking through possible cpus (include disable cpus). This is not expected, so switch to check present CPUs instead.
--- drivers/acpi/cppc_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +1 -1
@@ -411,7 +411,7 @@ bool acpi_cpc_valid(void)struct cpc_desc *cpc_ptr;int cpu; -for_each_possible_cpu (cpu) { +for_each_present_cpu (cpu) { cpc_ptr =per_cpu (cpc_desc_ptr, cpu);if (!cpc_ptr)return false;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 191/217 net/mlx5: DR, Fix error flow in creating matcher
In reply to Sasha LevinFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 84dfac39c61fde04126e23723138128b50cd036f ]
The error code of nic matcher init functions wasn't checked. This patch improves the matcher init function and fix error flow bug:
the handling of match parameter is moved into a separate function and error flow is simplified.
--- .../mellanox/mlx5/core/steering/dr_matcher.c | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +32 -21
@@ -872,13 +872,12 @@ static int dr_matcher_init_fdb(struct mlx5dr_matcher *matcher)return ret; } -static int dr_matcher_init (struct mlx5dr_matcher *matcher, -struct mlx5dr_match_parameters *mask) +static int dr_matcher_copy_param (struct mlx5dr_matcher *matcher, +struct mlx5dr_match_parameters *mask) { +struct mlx5dr_domain *dmn = matcher->tbl->dmn;struct mlx5dr_match_parameters consumed_mask; -struct mlx5dr_table *tbl = matcher->tbl; -struct mlx5dr_domain *dmn = tbl->dmn; -int i, ret; +int i, ret =0 ;if (matcher->match_criteria >=DR_MATCHER_CRITERIA_MAX ) {mlx5dr_err (dmn,"Invalid match criteria attribute\n" );
@@ -898,10 +897,36 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher, consumed_mask.match_sz = mask->match_sz;memcpy (consumed_mask.match_buf, mask->match_buf, mask->match_sz);mlx5dr_ste_copy_param (matcher->match_criteria, - &matcher->mask, &consumed_mask, - true); + &matcher->mask, &consumed_mask, true); + +/* Check that all mask data was consumed */ +for (i =0 ; i < consumed_mask.match_sz; i++) { +if (!((u8 *)consumed_mask.match_buf)[i]) +continue ; + +mlx5dr_dbg (dmn, +"Match param mask contains unsupported parameters\n" ); + ret = -EOPNOTSUPP ; +break ; + } + +kfree (consumed_mask.match_buf); } +return ret; +} + +static int dr_matcher_init (struct mlx5dr_matcher *matcher, +struct mlx5dr_match_parameters *mask) +{ +struct mlx5dr_table *tbl = matcher->tbl; +struct mlx5dr_domain *dmn = tbl->dmn; +int ret; + + ret =dr_matcher_copy_param (matcher, mask); +if (ret) +return ret; +switch (dmn->type) {case MLX5DR_DOMAIN_TYPE_NIC_RX : matcher->rx.nic_tbl = &tbl->rx;
@@ -919,22 +944,8 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher,default :WARN_ON (true); ret = -EINVAL ; - goto free_consumed_mask; - } - -/* Check that all mask data was consumed */ -for (i =0 ; i < consumed_mask.match_sz; i++) { -if (!((u8 *)consumed_mask.match_buf)[i]) -continue ; - -mlx5dr_dbg (dmn,"Match param mask contains unsupported parameters\n" ); - ret = -EOPNOTSUPP ; - goto free_consumed_mask; } - ret =0 ; -free_consumed_mask: -kfree (consumed_mask.match_buf);return ret; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 192/217 btrfs: remove BUG_ON() in find_parent_nodes()
In reply to Sasha LevinFrom: Josef Bacik <[email protected]>
[ Upstream commit fcba0120edf88328524a4878d1d6f4ad39f2ec81 ]
We search for an extent entry with .offset = -1, which shouldn't be a thing, but corruption happens. Add an ASSERT() for the developers, return -EUCLEAN for mortals.
--- fs/btrfs/backref.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/btrfs/backref.c +6 -1
@@ -1214,7 +1214,12 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ret =btrfs_search_slot (NULL , fs_info->extent_root, &key, path,0 ,0 );if (ret <0 ) goto out; -BUG_ON (ret ==0 ); +if (ret ==0 ) { +/* This shouldn't happen, indicates a bug or fs corruption. */ +ASSERT (ret !=0 ); + ret = -EUCLEAN ; + goto out; + }#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS if (trans && likely(trans->type != __TRANS_DUMMY) &&
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 193/217 btrfs: remove BUG_ON(!eie) in find_parent_nodes
In reply to Sasha LevinFrom: Josef Bacik <[email protected]>
[ Upstream commit 9f05c09d6baef789726346397438cca4ec43c3ee ]
If we're looking for leafs that point to a data extent we want to record the extent items that point at our bytenr. At this point we have the reference and we know for a fact that this leaf should have a reference to our bytenr. However if there's some sort of corruption we may not find any references to our leaf, and thus could end up with eie == NULL. Replace this BUG_ON() with an ASSERT() and then return -EUCLEAN for the mortals.
--- fs/btrfs/backref.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/btrfs/backref.c +11 -3
@@ -1365,10 +1365,18 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, goto out;if (!ret && extent_item_pos) {/* -* we've recorded that parent, so we must extend -* its inode list here +* We've recorded that parent, so we must extend +* its inode list here. +* +* However if there was corruption we may not +* have found an eie, return an error in this +* case. */ -BUG_ON (!eie); +ASSERT (eie); +if (!eie) { + ret = -EUCLEAN ; + goto out; + }while (eie->next) eie = eie->next; eie->next = ref->inode_list;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 194/217 net: mdio: Demote probed message to debug print
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit 7590fc6f80ac2cbf23e6b42b668bbeded070850b ]
On systems with large numbers of MDIO bus/muxes the message indicating that a given MDIO bus has been successfully probed is repeated for as many buses we have, which can eat up substantial boot time for no reason, demote to a debug print.
--- drivers/net/phy/mdio_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/mdio_bus.c +1 -1
@@ -594,7 +594,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)mdiobus_setup_mdiodev_from_board_info (bus, mdiobus_create_device); bus->state =MDIOBUS_REGISTERED ; -pr_info ("%s: probed\n" , bus->name); +dev_dbg (&bus->dev,"probed\n" );return 0 ; error:
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 195/217 mac80211: allow non-standard VHT MCS-10/11
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 04be6d337d37400ad5b3d5f27ca87645ee5a18a3 ]
Some AP can possibly try non-standard VHT rate and mac80211 warns and drops packets, and leads low TCP throughput.
Rate marked as a VHT rate but data is invalid: MCS: 10, NSS: 2
WARNING: CPU: 1 PID: 7817 at net/mac80211/rx.c:4856 ieee80211_rx_list+0x223/0x2f0 [mac8021
Since commit c27aa56a72b8 ("cfg80211: add VHT rate entries for MCS-10 and MCS-11") has added, mac80211 adds this support as well.
After this patch, throughput is good and iw can get the bitrate:
rx bitrate: 975.1 MBit/s VHT-MCS 10 80MHz short GI VHT-NSS 2
or
rx bitrate: 1083.3 MBit/s VHT-MCS 11 80MHz short GI VHT-NSS 2
--- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rx.c +1 -1
@@ -4924,7 +4924,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, goto drop;break ;case RX_ENC_VHT : - if (WARN_ONCE(status->rate_idx > 9 || + if (WARN_ONCE(status->rate_idx > 11 || !status->nss || status->nss > 8, "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n",
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 196/217 dm btree: add a defensive bounds check to insert_at()
In reply to Sasha LevinFrom: Joe Thornber <[email protected]>
[ Upstream commit 85bca3c05b6cca31625437eedf2060e846c4bbad ]
Corrupt metadata could trigger an out of bounds write.
--- drivers/md/persistent-data/dm-btree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/md/persistent-data/dm-btree.c +5 -3
@@ -81,14 +81,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, }static int insert_at (size_t value_size,struct btree_node *node,unsigned index, -uint64_t key,void *value) -__dm_written_to_disk (value) +uint64_t key,void *value) +__dm_written_to_disk (value) {uint32_t nr_entries =le32_to_cpu (node->header.nr_entries); +uint32_t max_entries =le32_to_cpu (node->header.max_entries);__le64 key_le =cpu_to_le64 (key);if (index > nr_entries || - index >=le32_to_cpu (node->header.max_entries)) { + index >= max_entries || + nr_entries >= max_entries) {DMERR ("too many entries in btree node for insert" );__dm_unbless_for_disk (value);return -ENOMEM ;
Signature · 7 lines
2.34.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Sasha Levin
maintainerPATCH 197/217 dm space map common: add bounds check to sm_ll_lookup_bitmap()
In reply to Sasha LevinFrom: Joe Thornber <[email protected]>
[ Upstream commit cba23ac158db7f3cd48a923d6861bee2eb7a2978 ]
Corrupted metadata could warrant returning error from sm_ll_lookup_bitmap().
--- drivers/md/persistent-data/dm-space-map-common.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/persistent-data/dm-space-map-common.c +5 -0
@@ -283,6 +283,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result)struct disk_index_entry ie_disk;struct dm_block *blk; +if (b >= ll->nr_blocks) { +DMERR_LIMIT ("metadata block out of bounds" ); +return -EINVAL ; + } + b =do_div (index, ll->entries_per_block); r = ll->load_ie (ll, index, &ie_disk);if (r <0 )
Signature · 7 lines
2.34.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Sasha Levin
maintainerPATCH 198/217 can: do not increase rx statistics when generating a CAN rx error message frame
In reply to Sasha LevinFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 676068db69b847f06fe054fca15bf6b107bd24da ]
The CAN error message frames (i.e. error skb) are an interface specific to socket CAN. The payload of the CAN error message frames does not correspond to any actual data sent on the wire. Only an error flag and a delimiter are transmitted when an error occurs (c.f. ISO 11898-1 section 10.4.4.2 "Error flag").
For this reason, it makes no sense to increment the rx_packets and rx_bytes fields of struct net_device_stats because no actual payload were transmitted on the wire.
This patch fixes all the CAN drivers.
--- drivers/net/can/at91_can.c | 6 ------ drivers/net/can/c_can/c_can_main.c | 5 ----- drivers/net/can/cc770/cc770.c | 3 --- drivers/net/can/dev/dev.c | 4 ---- drivers/net/can/dev/rx-offload.c | 6 ++++-- drivers/net/can/ifi_canfd/ifi_canfd.c | 5 ----- drivers/net/can/kvaser_pciefd.c | 5 ----- drivers/net/can/m_can/m_can.c | 7 ------- drivers/net/can/mscan/mscan.c | 9 +++++---- drivers/net/can/pch_can.c | 3 --- drivers/net/can/peak_canfd/peak_canfd.c | 4 ---- drivers/net/can/rcar/rcar_can.c | 6 +----- drivers/net/can/rcar/rcar_canfd.c | 4 ---- drivers/net/can/sja1000/sja1000.c | 2 -- drivers/net/can/sun4i_can.c | 7 ++----- drivers/net/can/usb/ems_usb.c | 2 -- drivers/net/can/usb/esd_usb2.c | 2 -- drivers/net/can/usb/etas_es58x/es58x_core.c | 7 ------- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 -- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 8 -------- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 4 ---- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 -- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 3 --- drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 2 -- drivers/net/can/usb/ucan.c | 6 ++++-- drivers/net/can/usb/usb_8dev.c | 2 -- drivers/net/can/xilinx_can.c | 9 +-------- 27 files changed, 17 insertions(+), 108 deletions(-)
drivers/net/can/at91_can.c +0 -6
@@ -553,8 +553,6 @@ static void at91_rx_overflow_err(struct net_device *dev) cf->can_id |=CAN_ERR_CRTL ; cf->data[1 ] =CAN_ERR_CRTL_RX_OVERFLOW ; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb); }
@@ -779,8 +777,6 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr)at91_poll_err_frame (dev, cf, reg_sr); - dev->stats.rx_packets++; - dev->stats.rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
@@ -1037,8 +1033,6 @@ static void at91_irq_err(struct net_device *dev)at91_irq_err_state (dev, cf, new_state); - dev->stats.rx_packets++; - dev->stats.rx_bytes += cf->len;netif_rx (skb); priv->can.state = new_state;
drivers/net/can/c_can/c_can_main.c +0 -5
@@ -920,7 +920,6 @@ static int c_can_handle_state_change(struct net_device *dev,unsigned int reg_err_counter;unsigned int rx_err_passive;struct c_can_priv *priv =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct can_frame *cf;struct sk_buff *skb;struct can_berr_counter bec;
@@ -996,8 +995,6 @@ static int c_can_handle_state_change(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
@@ -1064,8 +1061,6 @@ static int c_can_handle_bus_err(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ; }
drivers/net/can/cc770/cc770.c +0 -3
@@ -499,7 +499,6 @@ static void cc770_rx(struct net_device *dev, unsigned int mo, u8 ctrl1)static int cc770_err (struct net_device *dev,u8 status) {struct cc770_priv *priv =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct can_frame *cf;struct sk_buff *skb;u8 lec;
@@ -571,8 +570,6 @@ static int cc770_err(struct net_device *dev, u8 status) } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/dev/dev.c +0 -4
@@ -136,7 +136,6 @@ EXPORT_SYMBOL_GPL(can_change_state);static void can_restart (struct net_device *dev) {struct can_priv *priv =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct sk_buff *skb;struct can_frame *cf;int err;
@@ -155,9 +154,6 @@ static void can_restart(struct net_device *dev) cf->can_id |=CAN_ERR_RESTARTED ; - stats->rx_packets++; - stats->rx_bytes += cf->len; -netif_rx_ni (skb); restart:
drivers/net/can/dev/rx-offload.c +4 -2
@@ -54,8 +54,10 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota)struct can_frame *cf = (struct can_frame *)skb->data; work_done++; - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (!(cf->can_id &CAN_ERR_FLAG )) { + stats->rx_packets++; + stats->rx_bytes += cf->len; + }netif_receive_skb (skb); }
drivers/net/can/ifi_canfd/ifi_canfd.c +0 -5
@@ -430,8 +430,6 @@ static int ifi_canfd_handle_lec_err(struct net_device *ndev) priv->base + IFI_CANFD_INTERRUPT);writel (IFI_CANFD_ERROR_CTR_ER_ENABLE , priv->base +IFI_CANFD_ERROR_CTR ); - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
@@ -456,7 +454,6 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev, enum can_state new_state) {struct ifi_canfd_priv *priv =netdev_priv (ndev); -struct net_device_stats *stats = &ndev->stats;struct can_frame *cf;struct sk_buff *skb;struct can_berr_counter bec;
@@ -522,8 +519,6 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
drivers/net/can/kvaser_pciefd.c +0 -5
@@ -1310,9 +1310,6 @@ static int kvaser_pciefd_rx_error_frame(struct kvaser_pciefd_can *can, cf->data[6 ] = bec.txerr; cf->data[7 ] = bec.rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len; -netif_rx (skb);return 0 ; }
@@ -1510,8 +1507,6 @@ static void kvaser_pciefd_handle_nack_packet(struct kvaser_pciefd_can *can,if (skb) { cf->can_id |=CAN_ERR_BUSERROR ; - stats->rx_bytes += cf->len; - stats->rx_packets++;netif_rx (skb); }else { stats->rx_dropped++;
drivers/net/can/m_can/m_can.c +0 -7
@@ -647,9 +647,6 @@ static int m_can_handle_lec_err(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len; -if (cdev->is_peripheral) timestamp =m_can_get_timestamp (cdev);
@@ -706,7 +703,6 @@ static int m_can_handle_state_change(struct net_device *dev, enum can_state new_state) {struct m_can_classdev *cdev =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct can_frame *cf;struct sk_buff *skb;struct can_berr_counter bec;
@@ -771,9 +767,6 @@ static int m_can_handle_state_change(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len; -if (cdev->is_peripheral) timestamp =m_can_get_timestamp (cdev);
drivers/net/can/mscan/mscan.c +5 -4
@@ -401,13 +401,14 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)continue ; } -if (canrflg &MSCAN_RXF ) +if (canrflg &MSCAN_RXF ) {mscan_get_rx_frame (dev, frame); -else if (canrflg &MSCAN_ERR_IF ) + stats->rx_packets++; + stats->rx_bytes += frame->len; + }else if (canrflg &MSCAN_ERR_IF ) {mscan_get_err_frame (dev, frame, canrflg); + } - stats->rx_packets++; - stats->rx_bytes += frame->len; work_done++;netif_receive_skb (skb); }
drivers/net/can/pch_can.c +0 -3
@@ -561,9 +561,6 @@ static void pch_can_error(struct net_device *ndev, u32 status) priv->can.state = state;netif_receive_skb (skb); - - stats->rx_packets++; - stats->rx_bytes += cf->len; }static irqreturn_t pch_can_interrupt (int irq,void *dev_id)
drivers/net/can/peak_canfd/peak_canfd.c +0 -4
@@ -409,8 +409,6 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,return -ENOMEM ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;pucan_netif_rx (skb, msg->ts_low, msg->ts_high);return 0 ;
@@ -438,8 +436,6 @@ static int pucan_handle_cache_critical(struct peak_canfd_priv *priv) cf->data[6 ] = priv->bec.txerr; cf->data[7 ] = priv->bec.rxerr; - stats->rx_bytes += cf->len; - stats->rx_packets++;netif_rx (skb);return 0 ;
drivers/net/can/rcar/rcar_can.c +1 -5
@@ -223,7 +223,6 @@ static void tx_failure_cleanup(struct net_device *ndev)static void rcar_can_error (struct net_device *ndev) {struct rcar_can_priv *priv =netdev_priv (ndev); -struct net_device_stats *stats = &ndev->stats;struct can_frame *cf;struct sk_buff *skb;u8 eifr, txerr =0 , rxerr =0 ;
@@ -362,11 +361,8 @@ static void rcar_can_error(struct net_device *ndev) } } -if (skb) { - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (skb)netif_rx (skb); - } }static void rcar_can_tx_done (struct net_device *ndev)
drivers/net/can/rcar/rcar_canfd.c +0 -4
@@ -1033,8 +1033,6 @@ static void rcar_canfd_error(struct net_device *ndev, u32 cerfl,/* Clear channel error interrupts that are handled */ rcar_canfd_write (priv->base,RCANFD_CERFL (ch),RCANFD_CERFL_ERR (~cerfl)); - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
@@ -1174,8 +1172,6 @@ static void rcar_canfd_state_change(struct net_device *ndev, rx_state = txerr <= rxerr ? state :0 ;can_change_state (ndev, cf, tx_state, rx_state); - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); } }
drivers/net/can/sja1000/sja1000.c +0 -2
@@ -487,8 +487,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)can_bus_off (dev); } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/sun4i_can.c +2 -5
@@ -622,13 +622,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)can_bus_off (dev); } -if (likely (skb)) { - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (likely (skb))netif_rx (skb); - }else { +else return -ENOMEM ; - }return 0 ; }
drivers/net/can/usb/ems_usb.c +0 -2
@@ -397,8 +397,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) stats->rx_errors++; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/usb/esd_usb2.c +0 -2
@@ -293,8 +293,6 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, priv->bec.txerr = txerr; priv->bec.rxerr = rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); } }
drivers/net/can/usb/etas_es58x/es58x_core.c +0 -7
@@ -849,13 +849,6 @@ int es58x_rx_err_msg(struct net_device *netdev, enum es58x_err error,break ; } -/* driver/net/can/dev.c:can_restart() takes in account error -* messages in the RX stats. Doing the same here for -* consistency. -*/ - netdev->stats.rx_packets++; - netdev->stats.rx_bytes +=CAN_ERR_DLC ; -if (cf) {if (cf->data[1 ]) cf->can_id |=CAN_ERR_CRTL ;
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +0 -2
@@ -279,8 +279,6 @@ int kvaser_usb_can_rx_over_error(struct net_device *netdev) cf->can_id |=CAN_ERR_CRTL ; cf->data[1 ] =CAN_ERR_CRTL_RX_OVERFLOW ; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +0 -8
@@ -869,7 +869,6 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv,struct net_device *netdev = priv->netdev;struct can_frame *cf;struct sk_buff *skb; -struct net_device_stats *stats;enum can_state new_state, old_state; old_state = priv->can.state;
@@ -919,9 +918,6 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv, cf->data[6 ] = bec->txerr; cf->data[7 ] = bec->rxerr; - stats = &netdev->stats; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
@@ -1074,8 +1070,6 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, cf->data[6 ] = bec.txerr; cf->data[7 ] = bec.rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); priv->bec.txerr = bec.txerr;
@@ -1109,8 +1103,6 @@ static void kvaser_usb_hydra_one_shot_fail(struct kvaser_usb_net_priv *priv, } stats->tx_errors++; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +0 -4
@@ -641,8 +641,6 @@ static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,if (skb) { cf->can_id |=CAN_ERR_RESTARTED ; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }else { netdev_err(priv->netdev,
@@ -843,8 +841,6 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev, cf->data[6 ] = es->txerr; cf->data[7 ] = es->rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/usb/peak_usb/pcan_usb.c +0 -2
@@ -520,8 +520,6 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, &hwts->hwtstamp); } - mc->netdev->stats.rx_packets++; - mc->netdev->stats.rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +0 -3
@@ -577,9 +577,6 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,if (!skb)return -ENOMEM ; - netdev->stats.rx_packets++; - netdev->stats.rx_bytes += cf->len; -peak_usb_netif_rx_64 (skb,le32_to_cpu (sm->ts_low),le32_to_cpu (sm->ts_high));
drivers/net/can/usb/peak_usb/pcan_usb_pro.c +0 -2
@@ -660,8 +660,6 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, hwts =skb_hwtstamps (skb);peak_usb_get_ts_time (&usb_if->time_ref,le32_to_cpu (er->ts32), &hwts->hwtstamp); - netdev->stats.rx_packets++; - netdev->stats.rx_bytes += can_frame->len;netif_rx (skb);return 0 ;
drivers/net/can/usb/ucan.c +4 -2
@@ -621,8 +621,10 @@ static void ucan_rx_can_msg(struct ucan_priv *up, struct ucan_message_in *m)memcpy (cf->data, m->msg.can_msg.data, cf->len);/* don't count error frames as real packets */ - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (!(cf->can_id &CAN_ERR_FLAG )) { + stats->rx_packets++; + stats->rx_bytes += cf->len; + }/* pass it to Linux */ netif_rx (skb);
drivers/net/can/usb/usb_8dev.c +0 -2
@@ -449,8 +449,6 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, priv->bec.txerr = txerr; priv->bec.rxerr = rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/xilinx_can.c +1 -8
@@ -965,13 +965,8 @@ static void xcan_update_error_state_after_rxtx(struct net_device *ndev)xcan_set_error_state (ndev, new_state, skb ? cf :NULL ); -if (skb) { -struct net_device_stats *stats = &ndev->stats; - - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (skb)netif_rx (skb); - } } }
@@ -1095,8 +1090,6 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)if (skb) { skb_cf->can_id |= cf.can_id;memcpy (skb_cf->data, cf.data,CAN_ERR_DLC ); - stats->rx_packets++; - stats->rx_bytes +=CAN_ERR_DLC ;netif_rx (skb); } }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 199/217 bpf/selftests: Fix namespace mount setup in tc_redirect
In reply to Sasha LevinFrom: Jiri Olsa <[email protected]>
[ Upstream commit 5e22dd18626726028a93ff1350a8a71a00fd843d ]
The tc_redirect umounts /sys in the new namespace, which can be mounted as shared and cause global umount. The lazy umount also takes down mounted trees under /sys like debugfs, which won't be available after sysfs mounts again and could cause fails in other tests.
# cat /proc/self/mountinfo | grep debugfs 34 23 0:7 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:14 - debugfs debugfs rw # cat /proc/self/mountinfo | grep sysfs 23 86 0:22 / /sys rw,nosuid,nodev,noexec,relatime shared:2 - sysfs sysfs rw # mount | grep debugfs debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
# ./test_progs -t tc_redirect #164 tc_redirect:OK Summary: 1/4 PASSED, 0 SKIPPED, 0 FAILED
# mount | grep debugfs # cat /proc/self/mountinfo | grep debugfs # cat /proc/self/mountinfo | grep sysfs 25 86 0:22 / /sys rw,relatime shared:2 - sysfs sysfs rw
Making the sysfs private under the new namespace so the umount won't trigger the global sysfs umount.
--- tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/bpf/prog_tests/tc_redirect.c +7 -0
@@ -105,6 +105,13 @@ static int setns_by_fd(int nsfd)if (!ASSERT_OK (err,"unshare" ))return err; +/* Make our /sys mount private, so the following umount won't +* trigger the global umount in case it's shared. +*/ + err =mount ("none" ,"/sys" ,NULL ,MS_PRIVATE ,NULL ); +if (!ASSERT_OK (err,"remount private /sys" )) +return err; + err =umount2 ("/sys" ,MNT_DETACH );if (!ASSERT_OK (err,"umount2 /sys" ))return err;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 200/217 mlxsw: pci: Avoid flow control for EMAD packets
In reply to Sasha LevinFrom: Danielle Ratson <[email protected]>
[ Upstream commit d43e4271747ace01a27a49a97a397cb4219f6487 ]
Locally generated packets ingress the device through its CPU port. When the CPU port is congested and there are not enough credits in its headroom buffer, packets can be dropped.
While this might be acceptable for data packets that traverse the network, configuration packets exchanged between the host and the device (EMADs) should not be subjected to this flow control.
The "sdq_lp" bit in the SDQ (Send Descriptor Queue) context allows the host to instruct the device to treat packets sent on this queue as "local processing" and always process them, regardless of the state of the CPU port's headroom.
Add the definition of this bit and set it for the dedicated SDQ reserved for the transmission of EMAD packets. This makes the "local processing" bit in the WQE (Work Queue Element) redundant, so clear it.
--- drivers/net/ethernet/mellanox/mlxsw/cmd.h | 12 ++++++++++++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/cmd.h +12 -0
@@ -935,6 +935,18 @@ static inline int mlxsw_cmd_sw2hw_rdq(struct mlxsw_core *mlxsw_core,*/ MLXSW_ITEM32 (cmd_mbox, sw2hw_dq, cq,0x00 ,24 ,8 ); +enum mlxsw_cmd_mbox_sw2hw_dq_sdq_lp { +MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE , +MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE , +}; + +/* cmd_mbox_sw2hw_dq_sdq_lp +* SDQ local Processing +* 0: local processing by wqe.lp +* 1: local processing (ignoring wqe.lp) +*/ +MLXSW_ITEM32 (cmd_mbox, sw2hw_dq, sdq_lp,0x00 ,23 ,1 ); +/* cmd_mbox_sw2hw_dq_sdq_tclass * SDQ: CPU Egress TClass * RDQ: Reserved
drivers/net/ethernet/mellanox/mlxsw/pci.c +5 -1
@@ -285,6 +285,7 @@ static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, struct mlxsw_pci_queue *q) {int tclass; +int lp;int i;int err;
@@ -292,9 +293,12 @@ static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, q->consumer_counter =0 ; tclass = q->num ==MLXSW_PCI_SDQ_EMAD_INDEX ?MLXSW_PCI_SDQ_EMAD_TC :MLXSW_PCI_SDQ_CTL_TC ; + lp = q->num ==MLXSW_PCI_SDQ_EMAD_INDEX ?MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE : +MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE ;/* Set CQ of same number of this SDQ. */ mlxsw_cmd_mbox_sw2hw_dq_cq_set (mbox, q->num); +mlxsw_cmd_mbox_sw2hw_dq_sdq_lp_set (mbox, lp);mlxsw_cmd_mbox_sw2hw_dq_sdq_tclass_set (mbox, tclass);mlxsw_cmd_mbox_sw2hw_dq_log2_dq_sz_set (mbox,3 );/* 8 pages */ for (i =0 ; i <MLXSW_PCI_AQ_PAGES ; i++) {
@@ -1678,7 +1682,7 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, wqe = elem_info->elem;mlxsw_pci_wqe_c_set (wqe,1 );/* always report completion */ -mlxsw_pci_wqe_lp_set (wqe, !!tx_info->is_emad); +mlxsw_pci_wqe_lp_set (wqe,0 );mlxsw_pci_wqe_type_set (wqe,MLXSW_PCI_WQE_TYPE_ETHERNET ); err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb->data,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 201/217 net: phy: marvell: configure RGMII delays for 88E1118
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit f22725c95ececb703c3f741e8f946d23705630b7 ]
Corentin Labbe reports that the SSI 1328 does not work when allowing the PHY to operate at gigabit speeds, but does work with the generic PHY driver.
This appears to be because m88e1118_config_init() writes a fixed value to the MSCR register, claiming that this is to enable 1G speeds. However, this always sets bits 4 and 5, enabling RGMII transmit and receive delays. The suspicion is that the original board this was added for required the delays to make 1G speeds work.
Add the necessary configuration for RGMII delays for the 88E1118 to bring this into line with the requirements for RGMII support, and thus make the SSI 1328 work.
Corentin Labbe has tested this on gemini-ssi1328 and gemini-ns2502.
--- drivers/net/phy/marvell.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/phy/marvell.c +6 -0
@@ -1242,6 +1242,12 @@ static int m88e1118_config_init(struct phy_device *phydev)if (err <0 )return err; +if (phy_interface_is_rgmii (phydev)) { + err =m88e1121_config_aneg_rgmii_delays (phydev); +if (err <0 ) +return err; + } +/* Adjust LED Control */ if (phydev->dev_flags &MARVELL_PHY_M1118_DNS323_LEDS ) err =phy_write (phydev,0x10 ,0x1100 );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 202/217 net: gemini: allow any RGMII interface mode
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit 4e4f325a0a55907b14f579e6b1a38c53755e3de2 ]
The four RGMII interface modes take care of the required RGMII delay configuration at the PHY and should not be limited by the network MAC driver. Sadly, gemini was only permitting RGMII mode with no delays, which would require the required delay to be inserted via PCB tracking or by the MAC.
However, there are designs that require the PHY to add the delay, which is impossible without Gemini permitting the other three PHY interface modes. Fix the driver to allow these.
--- drivers/net/ethernet/cortina/gemini.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/cortina/gemini.c +6 -3
@@ -305,21 +305,21 @@ static void gmac_speed_set(struct net_device *netdev)switch (phydev->speed) {case 1000 : status.bits.speed =GMAC_SPEED_1000 ; -if (phydev->interface ==PHY_INTERFACE_MODE_RGMII ) +if (phy_interface_mode_is_rgmii (phydev->interface)) status.bits.mii_rmii =GMAC_PHY_RGMII_1000 ;netdev_dbg (netdev,"connect %s to RGMII @ 1Gbit\n" ,phydev_name (phydev));break ;case 100 : status.bits.speed =GMAC_SPEED_100 ; -if (phydev->interface ==PHY_INTERFACE_MODE_RGMII ) +if (phy_interface_mode_is_rgmii (phydev->interface)) status.bits.mii_rmii =GMAC_PHY_RGMII_100_10 ;netdev_dbg (netdev,"connect %s to RGMII @ 100 Mbit\n" ,phydev_name (phydev));break ;case 10 : status.bits.speed =GMAC_SPEED_10 ; -if (phydev->interface ==PHY_INTERFACE_MODE_RGMII ) +if (phy_interface_mode_is_rgmii (phydev->interface)) status.bits.mii_rmii =GMAC_PHY_RGMII_100_10 ;netdev_dbg (netdev,"connect %s to RGMII @ 10 Mbit\n" ,phydev_name (phydev));
@@ -389,6 +389,9 @@ static int gmac_setup_phy(struct net_device *netdev) status.bits.mii_rmii =GMAC_PHY_GMII ;break ;case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_RGMII_ID : +case PHY_INTERFACE_MODE_RGMII_TXID : +case PHY_INTERFACE_MODE_RGMII_RXID :netdev_dbg (netdev,"RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n" ); status.bits.mii_rmii =GMAC_PHY_RGMII_100_10 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 203/217 net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit c146f9bc195a9dc3ad7fd000a14540e7c9df952d ]
DSA needs to simulate master tracking events when a binding is first with a DSA master established and torn down, in order to give drivers the simplifying guarantee that ->master_state_change calls are made only when the master's readiness state to pass traffic changes. master_state_change() provide a operational bool that DSA driver can use to understand if DSA master is operational or not.
To avoid races, we need to block the reception of NETDEV_UP/NETDEV_CHANGE/NETDEV_GOING_DOWN events in the netdev notifier chain while we are changing the master's dev->dsa_ptr (this changes what netdev_uses_dsa(dev) reports).
The dsa_master_setup() and dsa_master_teardown() functions optionally require the rtnl_mutex to be held, if the tagger needs the master to be promiscuous, these functions call dev_set_promiscuity(). Move the rtnl_lock() from that function and make it top-level.
--- net/dsa/dsa2.c | 8 ++++++++ net/dsa/master.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-)
net/dsa/dsa2.c +8 -0
@@ -997,6 +997,8 @@ static int dsa_tree_setup_master(struct dsa_switch_tree *dst)struct dsa_port *dp;int err; +rtnl_lock (); +list_for_each_entry (dp, &dst->ports, list) {if (dsa_port_is_cpu (dp)) { err =dsa_master_setup (dp->master, dp);
@@ -1005,6 +1007,8 @@ static int dsa_tree_setup_master(struct dsa_switch_tree *dst) } } +rtnl_unlock (); +return 0 ; }
@@ -1012,9 +1016,13 @@ static void dsa_tree_teardown_master(struct dsa_switch_tree *dst) {struct dsa_port *dp; +rtnl_lock (); +list_for_each_entry (dp, &dst->ports, list)if (dsa_port_is_cpu (dp))dsa_master_teardown (dp->master); + +rtnl_unlock (); }static int dsa_tree_setup_lags (struct dsa_switch_tree *dst)
net/dsa/master.c +2 -2
@@ -267,9 +267,9 @@ static void dsa_master_set_promiscuity(struct net_device *dev, int inc)if (!ops->promisc_on_master)return ; -rtnl_lock (); +ASSERT_RTNL (); +dev_set_promiscuity (dev, inc); -rtnl_unlock (); } static ssize_t tagging_show(struct device *d, struct device_attribute *attr,
Signature · 1 line
2.34.1
Re: [PATCH AUTOSEL 5.16 203/217] net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}
Hi Sasha,
Quoted 20 lines · Sasha Levin
From: Vladimir Oltean <[email protected]>
[ Upstream commit
c146f9bc195a9dc3ad7fd000a14540e7c9df952d]DSA needs to simulate master tracking events when a binding is first with a DSA master established and torn down, in order to give drivers the simplifying guarantee that ->master_state_change calls are made only when the master's readiness state to pass traffic changes.
master_state_change()provide a operational bool that DSA driver can use to understand if DSA master is operational or not.
To avoid races, we need to block the reception of NETDEV_UP/NETDEV_CHANGE/NETDEV_GOING_DOWN events in the netdev notifier chain while we are changing the master'sdev->dsa_ptr(this changes whatnetdev_uses_dsa(dev)reports).The
dsa_master_setup()anddsa_master_teardown()functions optionally require thertnl_mutexto be held, if the tagger needs the master to be promiscuous, these functions calldev_set_promiscuity(). Move thertnl_lock()from that function and make it top-level.
Quoted 5 lines
Signed-off-by Vladimir Oltean <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Please drop this patch from all stable branches (5.16, 5.15, 5.10). Thanks.
Quoted 59 lines
net/dsa/dsa2.c | 8 ++++++++ net/dsa/master.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-)net/dsa/dsa2.c +8
-0@@ -997,6 +997,8 @@ static int dsa_tree_setup_master(struct dsa_switch_tree *dst)struct dsa_port *dp;int err; +rtnl_lock (); +list_for_each_entry (dp, &dst->ports, list) {if (dsa_port_is_cpu (dp)) { err =dsa_master_setup (dp->master, dp);@@ -1005,6 +1007,8 @@ static int dsa_tree_setup_master(struct dsa_switch_tree *dst) } } +rtnl_unlock (); +return 0 ; }@@ -1012,9 +1016,13 @@ static void dsa_tree_teardown_master(struct dsa_switch_tree *dst) {struct dsa_port *dp; +rtnl_lock (); +list_for_each_entry (dp, &dst->ports, list)if (dsa_port_is_cpu (dp))dsa_master_teardown (dp->master); + +rtnl_unlock (); }static int dsa_tree_setup_lags (struct dsa_switch_tree *dst)net/dsa/master.c +2
-2@@ -267,9 +267,9 @@ static void dsa_master_set_promiscuity(struct net_device *dev, int inc)if (!ops->promisc_on_master)return ; -rtnl_lock (); +ASSERT_RTNL (); +dev_set_promiscuity (dev, inc); -rtnl_unlock (); } static ssize_t tagging_show(struct device *d, struct device_attribute *attr,Signature · 1 line
2.34.1
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.16 203/217] net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}
Quoted 23 lines · Vladimir Oltean
Hi Sasha,
Quoted 20 lines · Sasha Levin
From: Vladimir Oltean <[email protected]>
[ Upstream commit
c146f9bc195a9dc3ad7fd000a14540e7c9df952d]DSA needs to simulate master tracking events when a binding is first with a DSA master established and torn down, in order to give drivers the simplifying guarantee that ->master_state_change calls are made only when the master's readiness state to pass traffic changes.
master_state_change()provide a operational bool that DSA driver can use to understand if DSA master is operational or not.
To avoid races, we need to block the reception of NETDEV_UP/NETDEV_CHANGE/NETDEV_GOING_DOWN events in the netdev notifier chain while we are changing the master'sdev->dsa_ptr(this changes whatnetdev_uses_dsa(dev)reports).The
dsa_master_setup()anddsa_master_teardown()functions optionally require thertnl_mutexto be held, if the tagger needs the master to be promiscuous, these functions calldev_set_promiscuity(). Move thertnl_lock()from that function and make it top-level.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Vladimir Oltean <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Please drop this patch from all stable branches (5.16, 5.15, 5.10). Thanks.
Dropped, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 204/217 regulator: qcom_smd: Align probe function with rpmh-regulator
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 14e2976fbabdacb01335d7f91eeebbc89c67ddb1 ]
The RPMh regulator driver is much newer and gets more attention, which in consequence makes it do a few things better. Update qcom_smd-regulator's probe function to mimic what rpmh-regulator does to address a couple of issues:
- Probe defer now works correctly, before it used to, well, kinda just die.. This fixes reliable probing on (at least) PM8994, because Linux apparently cannot deal with supply map dependencies yet..
- Regulator data is now matched more sanely: regulator data is matched against each individual regulator node name and throwing an -EINVAL if data is missing, instead of just assuming everything is fine and iterating over all subsequent array members.
- status = "disabled" will now work for disabling individual regulators in DT. Previously it didn't seem to do much if anything at all.
--- drivers/regulator/qcom_smd-regulator.c | 100 +++++++++++++++++-------- 1 file changed, 70 insertions(+), 30 deletions(-)
drivers/regulator/qcom_smd-regulator.c +70 -30
@@ -9,6 +9,7 @@#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> +#include <linux/regulator/of_regulator.h> #include <linux/soc/qcom/smd-rpm.h> struct qcom_rpm_reg {
@@ -1239,52 +1240,91 @@ static const struct of_device_id rpm_of_match[] = { };MODULE_DEVICE_TABLE (of, rpm_of_match); -static int rpm_reg_probe (struct platform_device *pdev) +/** +* rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-regulator +* @vreg: Pointer to the individual qcom_smd-regulator resource +* @dev: Pointer to the top level qcom_smd-regulator PMIC device +* @node: Pointer to the individual qcom_smd-regulator resource +* device node +* @rpm: Pointer to the rpm bus node +* @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator +* resources defined for the top level PMIC device +* +* Return: 0 on success, errno on failure +*/ +static int rpm_regulator_init_vreg (struct qcom_rpm_reg *vreg,struct device *dev, +struct device_node *node,struct qcom_smd_rpm *rpm, +const struct rpm_regulator_data *pmic_rpm_data) { -const struct rpm_regulator_data *reg; -const struct of_device_id *match; -struct regulator_config config = { }; +struct regulator_config config = {}; +const struct rpm_regulator_data *rpm_data;struct regulator_dev *rdev; +int ret; + +for (rpm_data = pmic_rpm_data; rpm_data->name; rpm_data++) +if (of_node_name_eq (node, rpm_data->name)) +break ; + +if (!rpm_data->name) { +dev_err (dev,"Unknown regulator %pOFn\n" , node); +return -EINVAL ; + } + + vreg->dev = dev; + vreg->rpm = rpm; + vreg->type = rpm_data->type; + vreg->id = rpm_data->id; + +memcpy (&vreg->desc, rpm_data->desc,sizeof (vreg->desc)); + vreg->desc.name = rpm_data->name; + vreg->desc.supply_name = rpm_data->supply; + vreg->desc.owner =THIS_MODULE ; + vreg->desc.type =REGULATOR_VOLTAGE ; + vreg->desc.of_match = rpm_data->name; + + config.dev = dev; + config.of_node = node; + config.driver_data = vreg; + + rdev =devm_regulator_register (dev, &vreg->desc, &config); +if (IS_ERR (rdev)) { + ret =PTR_ERR (rdev); +dev_err (dev,"%pOFn: devm_regulator_register() failed, ret=%d\n" , node, ret); +return ret; + } + +return 0 ; +} + +static int rpm_reg_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +const struct rpm_regulator_data *vreg_data; +struct device_node *node;struct qcom_rpm_reg *vreg;struct qcom_smd_rpm *rpm; +int ret; rpm =dev_get_drvdata (pdev->dev.parent);if (!rpm) { -dev_err (&pdev->dev,"unable to retrieve handle to rpm\n" ); +dev_err (&pdev->dev,"Unable to retrieve handle to rpm\n" );return -ENODEV ; } - match =of_match_device (rpm_of_match, &pdev->dev); -if (!match) { -dev_err (&pdev->dev,"failed to match device\n" ); + vreg_data =of_device_get_match_data (dev); +if (!vreg_data)return -ENODEV ; - } -for (reg = match->data; reg->name; reg++) { +for_each_available_child_of_node (dev->of_node, node) { vreg =devm_kzalloc (&pdev->dev,sizeof (*vreg),GFP_KERNEL );if (!vreg)return -ENOMEM ; - vreg->dev = &pdev->dev; - vreg->type = reg->type; - vreg->id = reg->id; - vreg->rpm = rpm; - -memcpy (&vreg->desc, reg->desc,sizeof (vreg->desc)); - - vreg->desc.id =-1 ; - vreg->desc.owner =THIS_MODULE ; - vreg->desc.type =REGULATOR_VOLTAGE ; - vreg->desc.name = reg->name; - vreg->desc.supply_name = reg->supply; - vreg->desc.of_match = reg->name; - - config.dev = &pdev->dev; - config.driver_data = vreg; - rdev =devm_regulator_register (&pdev->dev, &vreg->desc, &config); -if (IS_ERR (rdev)) { -dev_err (&pdev->dev,"failed to register %s\n" , reg->name); -return PTR_ERR (rdev); + ret =rpm_regulator_init_vreg (vreg, dev, node, rpm, vreg_data); + +if (ret <0 ) { +of_node_put (node); +return ret; } }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 205/217 serial: pl010: Drop CR register reset on set_termios
In reply to Sasha LevinFrom: Lukas Wunner <[email protected]>
[ Upstream commit 08a0c6dff91c965e39905cf200d22db989203ccb ]
pl010_set_termios() briefly resets the CR register to zero.
Where does this register write come from?
The PL010 driver's IRQ handler ambauart_int() originally modified the CR register without holding the port spinlock. ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. That is achieved by writing zero to the CR register.
However in 2004 the PL010 driver was amended to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios():
https://git.kernel.org/history/history/c/157c0342e591
That rendered the CR register write obsolete. Drop it.
--- drivers/tty/serial/amba-pl010.c | 3 --- 1 file changed, 3 deletions(-)
drivers/tty/serial/amba-pl010.c +0 -3
@@ -446,14 +446,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios,if ((termios->c_cflag &CREAD ) ==0 ) uap->port.ignore_status_mask |=UART_DUMMY_RSR_RX ; -/* first, disable everything */ old_cr =readb (uap->port.membase +UART010_CR ) & ~UART010_CR_MSIE ;if (UART_ENABLE_MS (port, termios->c_cflag)) old_cr |=UART010_CR_MSIE ; -writel (0 , uap->port.membase +UART010_CR ); -/* Set baud rate */ quot -=1 ;writel ((quot &0xf00 ) >>8 , uap->port.membase +UART010_LCRM );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 206/217 serial: pl011: Drop CR register reset on set_termios
In reply to Sasha LevinFrom: Lukas Wunner <[email protected]>
[ Upstream commit e368cc656fd6d0075f1c3ab9676e2001451e3e04 ]
pl011_set_termios() briefly resets the CR register to zero, thereby glitching DTR/RTS signals. With rs485 this may result in the bus being occupied for no reason.
Where does this register write originate from?
The PL011 driver was forked from the PL010 driver in 2004:
https://git.kernel.org/history/history/c/157c0342e591
Until this commit, the PL010 driver's IRQ handler ambauart_int() modified the CR register without holding the port spinlock.
ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. On the PL010, that is achieved by writing zero to the CR register.
However, on the PL011, interrupts are disabled in the IMSC register, not in the CR register.
Additionally, the commit amended both the PL010 and PL011 driver to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios().
So the CR register write is obsolete for two reasons. Drop it.
--- drivers/tty/serial/amba-pl011.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/amba-pl011.c +0 -2
@@ -2105,9 +2105,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,if (port->rs485.flags &SER_RS485_ENABLED ) termios->c_cflag &= ~CRTSCTS ; -/* first, disable everything */ old_cr =pl011_read (uap,REG_CR ); -pl011_write (0 , uap,REG_CR );if (termios->c_cflag &CRTSCTS ) {if (old_cr &UART011_CR_RTS )
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 207/217 serial: core: Keep mctrl register state and cached copy in sync
In reply to Sasha LevinFrom: Lukas Wunner <[email protected]>
[ Upstream commit 93a770b7e16772530196674ffc79bb13fa927dc6 ]
struct uart_port contains a cached copy of the Modem Control signals. It is used to skip register writes in uart_update_mctrl() if the new signal state equals the old signal state. It also avoids a register read to obtain the current state of output signals.
When a uart_port is registered, uart_configure_port() changes signal state but neglects to keep the cached copy in sync. That may cause a subsequent register write to be incorrectly skipped. Fix it before it trips somebody up.
This behavior has been present ever since the serial core was introduced in 2002:
https://git.kernel.org/history/history/c/33c0d1b0c3eb
So far it was never an issue because the cached copy is initialized to 0 by kzalloc() and when uart_configure_port() is executed, at most DTR has been set by uart_set_options() or sunsu_console_setup(). Therefore, a stable designation seems unnecessary.
--- drivers/tty/serial/serial_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +2 -1
@@ -2393,7 +2393,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,* We probably don't need a spinlock around this, but */ spin_lock_irqsave (&port->lock, flags); - port->ops->set_mctrl (port, port->mctrl &TIOCM_DTR ); + port->mctrl &=TIOCM_DTR ; + port->ops->set_mctrl (port, port->mctrl);spin_unlock_irqrestore (&port->lock, flags);/*
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 208/217 random: do not throw away excess input to crng_fast_load
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit 73c7733f122e8d0107f88655a12011f68f69e74b ]
When crng_fast_load() is called by add_hwgenerator_randomness(), we currently will advance to crng_init==1 once we've acquired 64 bytes, and then throw away the rest of the buffer. Usually, that is not a problem:
When add_hwgenerator_randomness() gets called via EFI or DT during setup_arch(), there won't be any IRQ randomness. Therefore, the 64 bytes passed by EFI exactly matches what is needed to advance to crng_init==1. Usually, DT seems to pass 64 bytes as well -- with one notable exception being kexec, which hands over 128 bytes of entropy to the kexec'd kernel. In that case, we'll advance to crng_init==1 once 64 of those bytes are consumed by crng_fast_load(), but won't continue onward feeding in bytes to progress to crng_init==2. This commit fixes the issue by feeding any leftover bytes into the next phase in add_hwgenerator_randomness().
--- drivers/char/random.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/char/random.c +12 -7
@@ -863,12 +863,14 @@ static void numa_crng_init(void) {}/* * crng_fast_load() can be called by code in the interrupt service -* path. So we can't afford to dilly-dally. +* path. So we can't afford to dilly-dally. Returns the number of +* bytes processed from cp. */ -static int crng_fast_load (const char *cp,size_t len) +static size_t crng_fast_load (const char *cp,size_t len) {unsigned long flags;char *p; +size_t ret =0 ;if (!spin_trylock_irqsave (&primary_crng.lock, flags))return 0 ;
@@ -879,7 +881,7 @@ static int crng_fast_load(const char *cp, size_t len) p = (unsigned char *) &primary_crng.state[4 ];while (len >0 && crng_init_cnt <CRNG_INIT_CNT_THRESH ) { p[crng_init_cnt %CHACHA_KEY_SIZE ] ^= *cp; - cp++; crng_init_cnt++; len--; + cp++; crng_init_cnt++; len--; ret++; }spin_unlock_irqrestore (&primary_crng.lock, flags);if (crng_init_cnt >=CRNG_INIT_CNT_THRESH ) {
@@ -887,7 +889,7 @@ static int crng_fast_load(const char *cp, size_t len) crng_init =1 ;pr_notice ("fast init done\n" ); } -return 1 ; +return ret; }/*
@@ -1269,7 +1271,7 @@ void add_interrupt_randomness(int irq, int irq_flags)if (unlikely (crng_init ==0 )) {if ((fast_pool->count >=64 ) &&crng_fast_load ((char *) fast_pool->pool, -sizeof (fast_pool->pool))) { +sizeof (fast_pool->pool)) >0 ) { fast_pool->count =0 ; fast_pool->last = now; }
@@ -2275,8 +2277,11 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,struct entropy_store *poolp = &input_pool;if (unlikely (crng_init ==0 )) { -crng_fast_load (buffer, count); -return ; +size_t ret =crng_fast_load (buffer, count); + count -= ret; + buffer += ret; +if (!count || crng_init ==0 ) +return ; }/* Suspend writing if we're above the trickle threshold.
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 209/217 net/mlx5: Update log_max_qp value to FW max capability
In reply to Sasha LevinFrom: Maher Sanalla <[email protected]>
[ Upstream commit f79a609ea6bf54ad2d2c24e4de4524288b221666 ]
log_max_qp in driver's default profile #2 was set to 18, but FW actually supports 17 at the most - a situation that led to the concerning print when the driver is loaded:
"log_max_qp value in current profile is 18, changing to HCA capabaility limit (17)"
The expected behavior from mlx5_profile #2 is to match the maximum FW capability in regards to log_max_qp. Thus, log_max_qp in profile #2 is initialized to a defined static value (0xff) - which basically means that when loading this profile, log_max_qp value will be what the currently installed FW supports at most.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +6 -2
@@ -98,6 +98,8 @@ enum { MLX5_ATOMIC_REQ_MODE_HOST_ENDIANNESS = 0x1, }; +#define LOG_MAX_SUPPORTED_QPS 0xff +static struct mlx5_profile profile[] = { [0 ] = { .mask =0 ,
@@ -109,7 +111,7 @@ static struct mlx5_profile profile[] = { [2] = { .mask =MLX5_PROF_MASK_QP_SIZE | MLX5_PROF_MASK_MR_CACHE, - .log_max_qp = 18, + .log_max_qp = LOG_MAX_SUPPORTED_QPS, .mr_cache[0] = { .size = 500, .limit =250
@@ -507,7 +509,9 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) to_fw_pkey_sz(dev, 128));/* Check log_max_qp from HCA caps to set in current profile */ -if (MLX5_CAP_GEN_MAX (dev, log_max_qp) < prof->log_max_qp) { +if (prof->log_max_qp ==LOG_MAX_SUPPORTED_QPS ) { + prof->log_max_qp =MLX5_CAP_GEN_MAX (dev, log_max_qp); + }else if (MLX5_CAP_GEN_MAX (dev, log_max_qp) < prof->log_max_qp) {mlx5_core_warn (dev,"log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n" , prof->log_max_qp,MLX5_CAP_GEN_MAX (dev, log_max_qp));
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 210/217 net/mlx5e: Unblock setting vid 0 for VF in case PF isn't eswitch manager
In reply to Sasha LevinFrom: Maor Dickman <[email protected]>
[ Upstream commit 7846665d3504812acaebf920d1141851379a7f37 ]
When using libvirt to passthrough VF to VM it will always set the VF vlan to 0 even if user didn’t request it, this will cause libvirt to fail to boot in case the PF isn't eswitch owner.
Example of such case is the DPU host PF which isn't eswitch manager, so any attempt to passthrough VF of it using libvirt will fail.
Fix it by not returning error in case set VF vlan is called with vid 0.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +1 -1
@@ -431,7 +431,7 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,int err =0 ;if (!mlx5_esw_allowed (esw)) -return -EPERM ; +return vlan ? -EPERM :0 ;if (vlan || qos) set_flags =SET_VLAN_STRIP |SET_VLAN_INSERT ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 211/217 parisc: Avoid calling faulthandler_disabled() twice
In reply to Sasha LevinFrom: John David Anglin <[email protected]>
[ Upstream commit 9e9d4b460f23bab61672eae397417d03917d116c ]
In handle_interruption(), we call faulthandler_disabled() to check whether the fault handler is not disabled. If the fault handler is disabled, we immediately call do_page_fault(). It then calls faulthandler_disabled(). If disabled, do_page_fault() attempts to fixup the exception by jumping to no_context:
no_context:
if (!user_mode(regs) && fixup_exception(regs)) {
return;
}
parisc_terminate("Bad Address (null pointer deref?)", regs, code, address);Apart from the error messages, the two blocks of code perform the same function.
We can avoid two calls to faulthandler_disabled() by a simple revision to the code in handle_interruption().
Note: I didn't try to fix the formatting of this code block.
--- arch/parisc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/traps.c +1 -1
@@ -785,7 +785,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)* unless pagefault_disable() was called before. */ -if (fault_space ==0 && !faulthandler_disabled ()) +if (faulthandler_disabled () || fault_space ==0 ) {/* Clean up and return if in exception table. */ if (fixup_exception (regs))
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 212/217 scripts: sphinx-pre-install: Fix ctex support on Debian
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 87d6576ddf8ac25f36597bc93ca17f6628289c16 ]
The name of the package with ctexhook.sty is different on Debian/Ubuntu.
--- scripts/sphinx-pre-install | 3 +++ 1 file changed, 3 insertions(+)
scripts/sphinx-pre-install +3 -0
@@ -369,6 +369,9 @@ sub give_debian_hints() ); if ($pdf) { + check_missing_file(["/usr/share/texlive/texmf-dist/tex/latex/ctex/ctexhook.sty"], + "texlive-lang-chinese", 2); + check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"], "fonts-dejavu", 2);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 213/217 can: flexcan: allow to change quirks at runtime
In reply to Sasha LevinFrom: Dario Binacchi <[email protected]>
[ Upstream commit 01bb4dccd92b4dc21f6af3312e5696924e371111 ]
This is a preparation patch for the upcoming support to change the rx-rtr capability via the ethtool API.
--- drivers/net/can/flexcan.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
drivers/net/can/flexcan.c +27 -27
@@ -369,7 +369,7 @@ struct flexcan_priv {struct clk *clk_ipg;struct clk *clk_per; -const struct flexcan_devtype_data *devtype_data; +struct flexcan_devtype_data devtype_data;struct regulator *reg_xceiver;struct flexcan_stop_mode stm;
@@ -600,7 +600,7 @@ static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) priv->write (reg_mcr, ®s->mcr);/* enable stop request */ -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW ) { ret =flexcan_stop_mode_enable_scfw (priv, true);if (ret <0 )return ret;
@@ -619,7 +619,7 @@ static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv)int ret;/* remove stop request */ -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW ) { ret =flexcan_stop_mode_enable_scfw (priv, false);if (ret <0 )return ret;
@@ -1022,7 +1022,7 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, mb =flexcan_get_mb (priv, n); -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) {u32 code; do {
@@ -1087,7 +1087,7 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, } mark_as_read: -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP )flexcan_write64 (priv,FLEXCAN_IFLAG_MB (n), ®s->iflag1);else priv->write (FLEXCAN_IFLAG_RX_FIFO_AVAILABLE , ®s->iflag1);
@@ -1113,7 +1113,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)enum can_state last_state = priv->can.state;/* reception interrupt */ -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) {u64 reg_iflag_rx;int ret;
@@ -1173,7 +1173,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)/* state change interrupt or broken error state quirk fix is enabled */ if ((reg_esr &FLEXCAN_ESR_ERR_STATE ) || - (priv->devtype_data->quirks & (FLEXCAN_QUIRK_BROKEN_WERR_STATE | + (priv->devtype_data.quirks & (FLEXCAN_QUIRK_BROKEN_WERR_STATE |FLEXCAN_QUIRK_BROKEN_PERR_STATE )))flexcan_irq_state (dev, reg_esr);
@@ -1195,11 +1195,11 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)* (1): enabled if FLEXCAN_QUIRK_BROKEN_WERR_STATE is enabled */ if ((last_state != priv->can.state) && - (priv->devtype_data->quirks &FLEXCAN_QUIRK_BROKEN_PERR_STATE ) && + (priv->devtype_data.quirks &FLEXCAN_QUIRK_BROKEN_PERR_STATE ) && !(priv->can.ctrlmode &CAN_CTRLMODE_BERR_REPORTING )) {switch (priv->can.state) {case CAN_STATE_ERROR_ACTIVE : -if (priv->devtype_data->quirks & +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_BROKEN_WERR_STATE )flexcan_error_irq_enable (priv);else
@@ -1423,13 +1423,13 @@ static int flexcan_rx_offload_setup(struct net_device *dev)else priv->mb_size =sizeof (struct flexcan_mb ) +CAN_MAX_DLEN ; -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_NR_MB_16 ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_MB_16 ) priv->mb_count =16 ;else priv->mb_count = (sizeof (priv->regs->mb[0 ]) / priv->mb_size) + (sizeof (priv->regs->mb[1 ]) / priv->mb_size); -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) priv->tx_mb_reserved =flexcan_get_mb (priv,FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP );else
@@ -1441,7 +1441,7 @@ static int flexcan_rx_offload_setup(struct net_device *dev) priv->offload.mailbox_read = flexcan_mailbox_read; -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { priv->offload.mb_first =FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST ; priv->offload.mb_last = priv->mb_count -2 ;
@@ -1506,7 +1506,7 @@ static int flexcan_chip_start(struct net_device *dev)if (err) goto out_chip_disable; -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_SUPPORT_ECC ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SUPPORT_ECC )flexcan_ram_init (dev);flexcan_set_bittiming (dev);
@@ -1535,7 +1535,7 @@ static int flexcan_chip_start(struct net_device *dev)* - disable for timestamp mode * - enable for FIFO mode */ -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) reg_mcr &= ~FLEXCAN_MCR_FEN ;else reg_mcr |=FLEXCAN_MCR_FEN ;
@@ -1586,7 +1586,7 @@ static int flexcan_chip_start(struct net_device *dev)* on most Flexcan cores, too. Otherwise we don't get * any error warning or passive interrupts. */ -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_BROKEN_WERR_STATE || +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_BROKEN_WERR_STATE || priv->can.ctrlmode &CAN_CTRLMODE_BERR_REPORTING ) reg_ctrl |=FLEXCAN_CTRL_ERR_MSK ;else
@@ -1599,7 +1599,7 @@ static int flexcan_chip_start(struct net_device *dev)netdev_dbg (dev,"%s: writing ctrl=0x%08x" , __func__, reg_ctrl); priv->write (reg_ctrl, ®s->ctrl); -if ((priv->devtype_data->quirks &FLEXCAN_QUIRK_ENABLE_EACEN_RRS )) { +if ((priv->devtype_data.quirks &FLEXCAN_QUIRK_ENABLE_EACEN_RRS )) { reg_ctrl2 = priv->read (®s->ctrl2); reg_ctrl2 |=FLEXCAN_CTRL2_EACEN |FLEXCAN_CTRL2_RRS ; priv->write (reg_ctrl2, ®s->ctrl2);
@@ -1631,7 +1631,7 @@ static int flexcan_chip_start(struct net_device *dev) priv->write (reg_fdctrl, ®s->fdctrl); } -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) {for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) { mb =flexcan_get_mb (priv, i); priv->write(FLEXCAN_MB_CODE_RX_EMPTY,
@@ -1659,7 +1659,7 @@ static int flexcan_chip_start(struct net_device *dev) priv->write (0x0 , ®s->rx14mask); priv->write (0x0 , ®s->rx15mask); -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_DISABLE_RXFG ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_DISABLE_RXFG ) priv->write (0x0 , ®s->rxfgmask);/* clear acceptance filters */
@@ -1673,7 +1673,7 @@ static int flexcan_chip_start(struct net_device *dev)* This also works around errata e5295 which generates false * positive memory errors and put the device in freeze mode. */ -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_DISABLE_MECR ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_DISABLE_MECR ) {/* Follow the protocol as described in "Detection * and Correction of Memory Errors" to write to * MECR register (step 1 - 5)
@@ -1799,7 +1799,7 @@ static int flexcan_open(struct net_device *dev)if (err) goto out_can_rx_offload_disable; -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) { err =request_irq (priv->irq_boff, flexcan_irq,IRQF_SHARED , dev->name, dev);if (err)
@@ -1845,7 +1845,7 @@ static int flexcan_close(struct net_device *dev)netif_stop_queue (dev);flexcan_chip_interrupts_disable (dev); -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) {free_irq (priv->irq_err, dev);free_irq (priv->irq_boff, dev); }
@@ -2051,9 +2051,9 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) priv =netdev_priv (dev); -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW ) ret =flexcan_setup_stop_mode_scfw (pdev); -else if (priv->devtype_data->quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR ) +else if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR ) ret =flexcan_setup_stop_mode_gpr (pdev);else /* return 0 directly if doesn't support stop mode feature */
@@ -2181,9 +2181,10 @@ static int flexcan_probe(struct platform_device *pdev) dev->flags |=IFF_ECHO ; priv =netdev_priv (dev); + priv->devtype_data = *devtype_data;if (of_property_read_bool (pdev->dev.of_node,"big-endian" ) || - devtype_data->quirks &FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN ) { + priv->devtype_data.quirks &FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN ) { priv->read = flexcan_read_be; priv->write = flexcan_write_be; }else {
@@ -2202,10 +2203,9 @@ static int flexcan_probe(struct platform_device *pdev) priv->clk_ipg = clk_ipg; priv->clk_per = clk_per; priv->clk_src = clk_src; - priv->devtype_data = devtype_data; priv->reg_xceiver = reg_xceiver; -if (devtype_data->quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_NR_IRQ_3 ) { priv->irq_boff =platform_get_irq (pdev,1 );if (priv->irq_boff <=0 ) { err = -ENODEV ;
@@ -2218,7 +2218,7 @@ static int flexcan_probe(struct platform_device *pdev) } } -if (priv->devtype_data->quirks &FLEXCAN_QUIRK_SUPPORT_FD ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_SUPPORT_FD ) { priv->can.ctrlmode_supported |=CAN_CTRLMODE_FD |CAN_CTRLMODE_FD_NON_ISO ; priv->can.bittiming_const = &flexcan_fd_bittiming_const;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 214/217 can: flexcan: rename RX modes
In reply to Sasha LevinFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit 34ea4e1c99f1f177f87e4ae7896caef238dd741a ]
Most flexcan IP cores support 2 RX modes:
- FIFO
- mailbox
The names for these modes were chosen to reflect the name of the rx-offload mode they are using.
The name of the RX modes should better reflect their difference with regards the flexcan IP core. So this patch renames the various occurrences of OFF_FIFO to RX_FIFO and OFF_TIMESTAMP to RX_MAILBOX:
| FLEXCAN_TX_MB_RESERVED_OFF_FIFO -> FLEXCAN_TX_MB_RESERVED_RX_FIFO | FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP -> FLEXCAN_TX_MB_RESERVED_RX_MAILBOX | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP -> FLEXCAN_QUIRK_USE_RX_MAILBOX
--- drivers/net/can/flexcan.c | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/can/flexcan.c +24 -24
@@ -173,9 +173,9 @@/* FLEXCAN interrupt flag register (IFLAG) bits */ /* Errata ERR005829 step7: Reserve first valid MB */ -#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 -#define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 -#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1) +#define FLEXCAN_TX_MB_RESERVED_RX_FIFO 8 +#define FLEXCAN_TX_MB_RESERVED_RX_MAILBOX 0 +#define FLEXCAN_RX_MB_RX_MAILBOX_FIRST (FLEXCAN_TX_MB_RESERVED_RX_MAILBOX + 1)#define FLEXCAN_IFLAG_MB (x) BIT_ULL(x)#define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7)#define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6)
@@ -234,8 +234,8 @@#define FLEXCAN_QUIRK_ENABLE_EACEN_RRS BIT(3)/* Disable non-correctable errors interrupt and freeze mode */ #define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) -/* Use timestamp based offloading */ -#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) +/* Use mailboxes (not FIFO) for RX path */ +#define FLEXCAN_QUIRK_USE_RX_MAILBOX BIT(5)/* No interrupt for error passive */ #define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6)/* default to BE register access */
@@ -406,38 +406,38 @@ static const struct flexcan_devtype_data fsl_imx28_devtype_data = {static const struct flexcan_devtype_data fsl_imx6q_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |FLEXCAN_QUIRK_BROKEN_PERR_STATE | +FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR , };static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |FLEXCAN_QUIRK_BROKEN_PERR_STATE | +FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW , };static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | +FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR |FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SUPPORT_ECC , };static const struct flexcan_devtype_data fsl_vf610_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | +FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SUPPORT_ECC , };static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_USE_OFF_TIMESTAMP , +FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_USE_RX_MAILBOX , };static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS |FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_BROKEN_PERR_STATE | -FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |FLEXCAN_QUIRK_SUPPORT_FD | +FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SUPPORT_ECC , };
@@ -1022,7 +1022,7 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, mb =flexcan_get_mb (priv, n); -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX ) {u32 code; do {
@@ -1087,7 +1087,7 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload, } mark_as_read: -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX )flexcan_write64 (priv,FLEXCAN_IFLAG_MB (n), ®s->iflag1);else priv->write (FLEXCAN_IFLAG_RX_FIFO_AVAILABLE , ®s->iflag1);
@@ -1113,7 +1113,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)enum can_state last_state = priv->can.state;/* reception interrupt */ -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX ) {u64 reg_iflag_rx;int ret;
@@ -1429,20 +1429,20 @@ static int flexcan_rx_offload_setup(struct net_device *dev) priv->mb_count = (sizeof (priv->regs->mb[0 ]) / priv->mb_size) + (sizeof (priv->regs->mb[1 ]) / priv->mb_size); -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX ) priv->tx_mb_reserved = -flexcan_get_mb (priv,FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP ); +flexcan_get_mb (priv,FLEXCAN_TX_MB_RESERVED_RX_MAILBOX );else priv->tx_mb_reserved = -flexcan_get_mb (priv,FLEXCAN_TX_MB_RESERVED_OFF_FIFO ); +flexcan_get_mb (priv,FLEXCAN_TX_MB_RESERVED_RX_FIFO ); priv->tx_mb_idx = priv->mb_count -1 ; priv->tx_mb =flexcan_get_mb (priv, priv->tx_mb_idx); priv->tx_mask =FLEXCAN_IFLAG_MB (priv->tx_mb_idx); priv->offload.mailbox_read = flexcan_mailbox_read; -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { - priv->offload.mb_first =FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST ; +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX ) { + priv->offload.mb_first =FLEXCAN_RX_MB_RX_MAILBOX_FIRST ; priv->offload.mb_last = priv->mb_count -2 ; priv->rx_mask = GENMASK_ULL(priv->offload.mb_last,
@@ -1532,10 +1532,10 @@ static int flexcan_chip_start(struct net_device *dev)/* MCR * * FIFO: -* - disable for timestamp mode +* - disable for mailbox mode * - enable for FIFO mode */ -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX ) reg_mcr &= ~FLEXCAN_MCR_FEN ;else reg_mcr |=FLEXCAN_MCR_FEN ;
@@ -1631,7 +1631,7 @@ static int flexcan_chip_start(struct net_device *dev) priv->write (reg_fdctrl, ®s->fdctrl); } -if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP ) { +if (priv->devtype_data.quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX ) {for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) { mb =flexcan_get_mb (priv, i); priv->write(FLEXCAN_MB_CODE_RX_EMPTY,
@@ -1639,7 +1639,7 @@ static int flexcan_chip_start(struct net_device *dev) } }else {/* clear and invalidate unused mailboxes first */ -for (i =FLEXCAN_TX_MB_RESERVED_OFF_FIFO ; i < priv->mb_count; i++) { +for (i =FLEXCAN_TX_MB_RESERVED_RX_FIFO ; i < priv->mb_count; i++) { mb =flexcan_get_mb (priv, i); priv->write (FLEXCAN_MB_CODE_RX_INACTIVE , &mb->can_ctrl);
@@ -2164,7 +2164,7 @@ static int flexcan_probe(struct platform_device *pdev)return -ENODEV ;if ((devtype_data->quirks &FLEXCAN_QUIRK_SUPPORT_FD ) && - !(devtype_data->quirks &FLEXCAN_QUIRK_USE_OFF_TIMESTAMP )) { + !(devtype_data->quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX )) {dev_err (&pdev->dev,"CAN-FD mode doesn't work with FIFO mode!\n" );return -EINVAL ; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 215/217 can: flexcan: add more quirks to describe RX path capabilities
In reply to Sasha LevinFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit c5c88591040ee7d84d037328eed9019d3ffab821 ]
Most flexcan IP cores support 2 RX modes:
- FIFO
- mailbox
Some IP core versions cannot receive CAN RTR messages via mailboxes. This patch adds quirks to document this.
This information will be used in a later patch to switch from FIFO to more performant mailbox mode at the expense of losing the ability to receive RTR messages. This trade off is beneficial in certain use cases.
--- drivers/net/can/flexcan.c | 66 ++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 12 deletions(-)
drivers/net/can/flexcan.c +54 -12
@@ -252,6 +252,12 @@#define FLEXCAN_QUIRK_NR_IRQ_3 BIT(12)/* Setup 16 mailboxes */ #define FLEXCAN_QUIRK_NR_MB_16 BIT(13) +/* Device supports RX via mailboxes */ +#define FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX BIT(14) +/* Device supports RTR reception via mailboxes */ +#define FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR BIT(15) +/* Device supports RX via FIFO */ +#define FLEXCAN_QUIRK_SUPPPORT_RX_FIFO BIT(16)/* Structure of the message buffer */ struct flexcan_mb {
@@ -386,59 +392,78 @@ struct flexcan_priv {static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = { .quirks =FLEXCAN_QUIRK_BROKEN_PERR_STATE | -FLEXCAN_QUIRK_NR_IRQ_3 |FLEXCAN_QUIRK_NR_MB_16 , +FLEXCAN_QUIRK_NR_IRQ_3 |FLEXCAN_QUIRK_NR_MB_16 | +FLEXCAN_QUIRK_SUPPPORT_RX_FIFO , };static const struct flexcan_devtype_data fsl_p1010_devtype_data = { .quirks =FLEXCAN_QUIRK_BROKEN_WERR_STATE |FLEXCAN_QUIRK_BROKEN_PERR_STATE | -FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN , +FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_FIFO , };static const struct flexcan_devtype_data fsl_imx25_devtype_data = { .quirks =FLEXCAN_QUIRK_BROKEN_WERR_STATE | -FLEXCAN_QUIRK_BROKEN_PERR_STATE , +FLEXCAN_QUIRK_BROKEN_PERR_STATE | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_FIFO , };static const struct flexcan_devtype_data fsl_imx28_devtype_data = { - .quirks =FLEXCAN_QUIRK_BROKEN_PERR_STATE , + .quirks =FLEXCAN_QUIRK_BROKEN_PERR_STATE | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_FIFO , };static const struct flexcan_devtype_data fsl_imx6q_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS |FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE | -FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR , +FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR , };static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS |FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE | -FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW , +FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SETUP_STOP_MODE_SCFW | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR , };static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS |FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | -FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SUPPORT_ECC , +FLEXCAN_QUIRK_SUPPORT_FD |FLEXCAN_QUIRK_SUPPORT_ECC | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR , };static const struct flexcan_devtype_data fsl_vf610_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS |FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_USE_RX_MAILBOX | -FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SUPPORT_ECC , +FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_SUPPORT_ECC | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR , };static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_USE_RX_MAILBOX , +FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_USE_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR , };static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { .quirks =FLEXCAN_QUIRK_DISABLE_RXFG |FLEXCAN_QUIRK_ENABLE_EACEN_RRS |FLEXCAN_QUIRK_DISABLE_MECR |FLEXCAN_QUIRK_BROKEN_PERR_STATE |FLEXCAN_QUIRK_USE_RX_MAILBOX |FLEXCAN_QUIRK_SUPPORT_FD | -FLEXCAN_QUIRK_SUPPORT_ECC , +FLEXCAN_QUIRK_SUPPORT_ECC | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR , };static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -2164,8 +2189,25 @@ static int flexcan_probe(struct platform_device *pdev)return -ENODEV ;if ((devtype_data->quirks &FLEXCAN_QUIRK_SUPPORT_FD ) && - !(devtype_data->quirks &FLEXCAN_QUIRK_USE_RX_MAILBOX )) { -dev_err (&pdev->dev,"CAN-FD mode doesn't work with FIFO mode!\n" ); + !((devtype_data->quirks & + (FLEXCAN_QUIRK_USE_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR | +FLEXCAN_QUIRK_SUPPPORT_RX_FIFO )) == + (FLEXCAN_QUIRK_USE_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR ))) { +dev_err (&pdev->dev,"CAN-FD mode doesn't work in RX-FIFO mode!\n" ); +return -EINVAL ; + } + +if ((devtype_data->quirks & + (FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR )) == +FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR ) { +dev_err (&pdev->dev, +"Quirks (0x%08x) inconsistent: RX_MAILBOX_RX supported but not RX_MAILBOX\n" , + devtype_data->quirks);return -EINVAL ; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 216/217 x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs
In reply to Sasha LevinFrom: Ingo Molnar <[email protected]>
[ Upstream commit b6aa86cff44cf099299d3a5e66348cb709cd7964 ]
Most distro kernels have this option enabled, to improve debug output.
Lockdep also selects it.
Enable this in the defconfig kernel as well, to make it more representative of what people are using on x86.
--- arch/x86/configs/i386_defconfig | 1 + arch/x86/configs/x86_64_defconfig | 1 + 2 files changed, 2 insertions(+)
arch/x86/configs/i386_defconfig +1 -0
@@ -262,3 +262,4 @@ CONFIG_BLK_DEV_IO_TRACE=y CONFIG_PROVIDE_OHCI1394_DMA_INIT=y CONFIG_EARLY_PRINTK_DBGP=y CONFIG_DEBUG_BOOT_PARAMS=y +CONFIG_KALLSYMS_ALL=y
arch/x86/configs/x86_64_defconfig +1 -0
@@ -258,3 +258,4 @@ CONFIG_BLK_DEV_IO_TRACE=y CONFIG_PROVIDE_OHCI1394_DMA_INIT=y CONFIG_EARLY_PRINTK_DBGP=y CONFIG_DEBUG_BOOT_PARAMS=y +CONFIG_KALLSYMS_ALL=y
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 217/217 ext4: allow to change s_last_trim_minblks via sysfs
In reply to Sasha LevinFrom: Lukas Czerner <[email protected]>
[ Upstream commit 4a69aecbfb30a3fc85bf8028386c047d5607a97a ]
Ext4 has an optimization mechanism for batched disacrd (FITRIM) that should help speed up subsequent calls of FITRIM ioctl by skipping the groups that were previously trimmed. However because the FITRIM allows to set the minimum size of an extent to trim, ext4 stores the last minimum extent size and only avoids trimming the group if it was previously trimmed with minimum extent size equal to, or smaller than the current call.
There is currently no way to bypass the optimization without umount/mount cycle. This becomes a problem when the file system is live migrated to a different storage, because the optimization will prevent possibly useful discard calls to the storage.
Fix it by exporting the s_last_trim_minblks via sysfs interface which will allow us to set the minimum size to the number of blocks larger than subsequent FITRIM call, effectively bypassing the optimization.
By setting the s_last_trim_minblks to ULONG_MAX the optimization will be effectively cleared regardless of the previous state, or file system configuration.
For example:
getconf ULONG_MAX > /sys/fs/ext4/dm-1/last_trim_minblks
--- fs/ext4/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/sysfs.c +2 -0
@@ -245,6 +245,7 @@ EXT4_ATTR(last_error_time, 0444, last_error_time);EXT4_ATTR (journal_task,0444 , journal_task);EXT4_RW_ATTR_SBI_UI (mb_prefetch, s_mb_prefetch);EXT4_RW_ATTR_SBI_UI (mb_prefetch_limit, s_mb_prefetch_limit); +EXT4_RW_ATTR_SBI_UL (last_trim_minblks, s_last_trim_minblks);static unsigned int old_bump_val =128 ;EXT4_ATTR_PTR (max_writeback_mb_bump,0444 , pointer_ui, &old_bump_val);
@@ -295,6 +296,7 @@ static struct attribute *ext4_attrs[] = {#endif ATTR_LIST (mb_prefetch),ATTR_LIST (mb_prefetch_limit), +ATTR_LIST (last_trim_minblks),NULL , };ATTRIBUTE_GROUPS (ext4);
Signature · 1 line
2.34.1