wifi: mac80211: don't use rate mask for scanning
Subsystems (11)
Sasha Levin
maintainerPATCH 1/19 wifi: mac80211: don't use rate mask for scanning
From: Johannes Berg <[email protected]>
[ Upstream commit ab9177d83c040eba58387914077ebca56f14fae6 ]
The rate mask is intended for use during operation, and can be set to only have masks for the currently active band. As such, it cannot be used for scanning which can be on other bands as well.
Simply ignore the rate masks during scanning to avoid warnings from incorrect settings.
--- include/net/mac80211.h | 3 +++ net/mac80211/rate.c | 6 +++++- net/mac80211/scan.c | 1 + net/mac80211/tx.c | 13 +++++++++---- 4 files changed, 18 insertions(+), 5 deletions(-)
include/net/mac80211.h +3 -0
@@ -936,6 +936,8 @@ enum mac80211_tx_info_flags {* of their QoS TID or other priority field values. * @IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX: first MLO TX, used mostly internally * for sequence number assignment +* @IEEE80211_TX_CTRL_SCAN_TX: Indicates that this frame is transmitted +* due to scanning, not in normal operation on the interface. * @IEEE80211_TX_CTRL_MLO_LINK: If not @IEEE80211_LINK_UNSPECIFIED, this * frame should be transmitted on the specific link. This really is * only relevant for frames that do not have data present, and is
@@ -956,6 +958,7 @@ enum mac80211_tx_control_flags {IEEE80211_TX_CTRL_NO_SEQNO =BIT (7 ),IEEE80211_TX_CTRL_DONT_REORDER =BIT (8 ),IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX =BIT (9 ), +IEEE80211_TX_CTRL_SCAN_TX =BIT (10 ), IEEE80211_TX_CTRL_MLO_LINK = 0xf0000000, };
net/mac80211/rate.c +5 -1
@@ -877,6 +877,7 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,struct ieee80211_sub_if_data *sdata;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_supported_band *sband; +u32 mask = ~0 ;rate_control_fill_sta_table (sta, info, dest, max_rates);
@@ -889,9 +890,12 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,if (ieee80211_is_tx_data (skb))rate_control_apply_mask (sdata, sta, sband, dest, max_rates); +if (!(info->control.flags &IEEE80211_TX_CTRL_SCAN_TX )) + mask = sdata->rc_rateidx_mask[info->band]; +if (dest[0 ].idx <0 )__rate_control_send_low (&sdata->local->hw, sband, sta, info, - sdata->rc_rateidx_mask[info->band]); + mask);if (sta)rate_fixup_ratelist (vif, sband, info, dest, max_rates);
net/mac80211/scan.c +1 -0
@@ -636,6 +636,7 @@ static void ieee80211_send_scan_probe_req(struct ieee80211_sub_if_data *sdata,cpu_to_le16 (IEEE80211_SN_TO_SEQ (sn)); }IEEE80211_SKB_CB (skb)->flags |= tx_flags; +IEEE80211_SKB_CB (skb)->control.flags |=IEEE80211_TX_CTRL_SCAN_TX ;ieee80211_tx_skb_tid_band (sdata, skb,7 , channel->band); } }
net/mac80211/tx.c +9 -4
@@ -705,11 +705,16 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) txrc.bss_conf = &tx->sdata->vif.bss_conf; txrc.skb = tx->skb; txrc.reported_rate.idx =-1 ; - txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band]; -if (tx->sdata->rc_has_mcs_mask[info->band]) - txrc.rate_idx_mcs_mask = - tx->sdata->rc_rateidx_mcs_mask[info->band]; +if (unlikely (info->control.flags &IEEE80211_TX_CTRL_SCAN_TX )) { + txrc.rate_idx_mask = ~0 ; + }else { + txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band]; + +if (tx->sdata->rc_has_mcs_mask[info->band]) + txrc.rate_idx_mcs_mask = + tx->sdata->rc_rateidx_mcs_mask[info->band]; + } txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/19 wifi: mac80211: ensure beacon is non-S1G prior to extracting the beacon timestamp field
From: Richard Kinder <[email protected]>
[ Upstream commit d12b9779cc9ba29d65fbfc728eb8a037871dd331 ]
Logic inside ieee80211_rx_mgmt_beacon accesses the mgmt->u.beacon.timestamp field without first checking whether the beacon received is non-S1G format.
Fix the problem by checking the beacon is non-S1G format to avoid access of the mgmt->u.beacon.timestamp field.
--- net/mac80211/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +2 -1
@@ -5979,7 +5979,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, link->u.mgd.dtim_period = elems->dtim_period; link->u.mgd.have_beacon = true; ifmgd->assoc_data->need_beacon = false; -if (ieee80211_hw_check (&local->hw,TIMING_BEACON_ONLY )) { +if (ieee80211_hw_check (&local->hw,TIMING_BEACON_ONLY ) && + !ieee80211_is_s1g_beacon (hdr->frame_control)) { link->conf->sync_tsf =le64_to_cpu (mgmt->u.beacon.timestamp); link->conf->sync_device_ts =
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/19 wifi: cfg80211: fix the order of arguments for trace events of the tx_rx_evt class
In reply to Sasha LevinFrom: Igor Artemiev <[email protected]>
[ Upstream commit 9ef369973cd2c97cce3388d2c0c7e3c056656e8a ]
The declarations of the tx_rx_evt class and the rdev_set_antenna event use the wrong order of arguments in the TP_ARGS macro.
Fix the order of arguments in the TP_ARGS macro.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/wireless/trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/trace.h +2 -2
@@ -1747,7 +1747,7 @@ TRACE_EVENT(rdev_return_void_tx_rx, DECLARE_EVENT_CLASS(tx_rx_evt, TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx), - TP_ARGS(wiphy, rx, tx), + TP_ARGS(wiphy, tx, rx), TP_STRUCT__entry( WIPHY_ENTRY __field(u32, tx)
@@ -1764,7 +1764,7 @@ DECLARE_EVENT_CLASS(tx_rx_evt,DEFINE_EVENT (tx_rx_evt, rdev_set_antenna, TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx), -TP_ARGS (wiphy, rx, tx) +TP_ARGS (wiphy, tx, rx) ); DECLARE_EVENT_CLASS(wiphy_netdev_id_evt,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/19 dt-bindings: rockchip: grf: Add missing type to 'pcie-phy' node
In reply to Sasha LevinFrom: Rob Herring <[email protected]>
[ Upstream commit d41201c90f825f19a46afbfb502f22f612d8ccc4 ]
'pcie-phy' is missing any type. Add 'type: object' to indicate it's a node.
--- Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/soc/rockchip/grf.yaml +1 -0
@@ -163,6 +163,7 @@ allOf: unevaluatedProperties: false pcie-phy: + type: object description: Documentation/devicetree/bindings/phy/rockchip-pcie-phy.txt
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/19 HID: mcp-2221: cancel delayed_work only when CONFIG_IIO is enabled
In reply to Sasha LevinFrom: Abdelrahman Morsy <[email protected]>
[ Upstream commit 3cba9cfcc1520a2307a29f6fab887bcfc121c417 ]
If the device is unplugged and CONFIG_IIO is not supported, this will result in a warning message at kernel/workqueue.
Only cancel delayed work in mcp2221_remove(), when CONFIG_IIO is enabled.
--- drivers/hid/hid-mcp2221.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-mcp2221.c +2 -0
@@ -922,9 +922,11 @@ static void mcp2221_hid_unregister(void *ptr)/* This is needed to be sure hid_hw_stop() isn't called twice by the subsystem */ static void mcp2221_remove (struct hid_device *hdev) { +#if IS_REACHABLE (CONFIG_IIO )struct mcp2221 *mcp =hid_get_drvdata (hdev);cancel_delayed_work_sync (&mcp->init_work); +#endif }#if IS_REACHABLE (CONFIG_IIO )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/19 net: usb: qmi_wwan: add Telit FN920C04 compositions
In reply to Sasha LevinFrom: Daniele Palmas <[email protected]>
[ Upstream commit 0b8fe5bd73249dc20be2e88a12041f8920797b59 ]
Add the following Telit FN920C04 compositions:
0x10a0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 5 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a0 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10a4: rmnet + tty (AT) + tty (AT) + tty (diag)
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 8 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a4 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10a9: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
T: Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 9 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a9 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=92c4c4d8 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/net/usb/qmi_wwan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/qmi_wwan.c +3 -0
@@ -1368,6 +1368,9 @@ static const struct usb_device_id products[] = { {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1070, 2)}, /* Telit FN990 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1080, 2)}, /* Telit FE990 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a0, 0)}, /* Telit FN920C04 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a4, 0)}, /* Telit FN920C04 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a9, 0)}, /* Telit FN920C04 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/19 drm/amd/display: Set color_mgmt_changed to true on unsuspend
In reply to Sasha LevinFrom: Joshua Ashton <[email protected]>
[ Upstream commit 2eb9dd497a698dc384c0dd3e0311d541eb2e13dd ]
Otherwise we can end up with a frame on unsuspend where color management is not applied when userspace has not committed themselves.
Fixes re-applying color management on Steam Deck/Gamescope on S3 resume.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -2956,6 +2956,7 @@ static int dm_resume(void *handle)dc_stream_release (dm_new_crtc_state->stream); dm_new_crtc_state->stream =NULL ; } + dm_new_crtc_state->base.color_mgmt_changed = true; }for_each_new_plane_in_state (dm->cached_state, plane, new_plane_state, i) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/19 drm/amdgpu: Update BO eviction priorities
In reply to Sasha LevinFrom: Felix Kuehling <[email protected]>
[ Upstream commit b0b13d532105e0e682d95214933bb8483a063184 ]
Make SVM BOs more likely to get evicted than other BOs. These BOs opportunistically use available VRAM, but can fall back relatively seamlessly to system memory. It also avoids SVM migrations evicting other, more important BOs as they will evict other SVM allocations first.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
@@ -613,6 +613,8 @@ int amdgpu_bo_create(struct amdgpu_device *adev,else amdgpu_bo_placement_from_domain (bo, bp->domain);if (bp->type == ttm_bo_type_kernel) + bo->tbo.priority =2 ; +else if (!(bp->flags &AMDGPU_GEM_CREATE_DISCARDABLE )) bo->tbo.priority =1 ;if (!bp->destroy)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/19 drm/amd/pm: Restore config space after reset
In reply to Sasha LevinFrom: Lijo Lazar <[email protected]>
[ Upstream commit 30d1cda8ce31ab49051ff7159280c542a738b23d ]
During mode-2 reset, pci config space registers are affected at device side. However, certain platforms have switches which assign virtual BAR addresses and returns the same even after device is reset. This affects pci_restore_state() as it doesn't issue another config write, if the value read is same as the saved value.
Add a workaround to write saved config space values from driver side. Presently, these switches are in platforms with SMU v13.0.6 SOCs, hence restrict the workaround only to those.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +25 -0
@@ -2039,6 +2039,17 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **tablereturn sizeof (struct gpu_metrics_v1_3 ); } +static void smu_v13_0_6_restore_pci_config (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; +int i; + +for (i =0 ; i <16 ; i++) +pci_write_config_dword (adev->pdev, i *4 , + adev->pdev->saved_config_space[i]); +pci_restore_msi_state (adev->pdev); +} +static int smu_v13_0_6_mode2_reset (struct smu_context *smu) {int ret =0 , index;
@@ -2060,6 +2071,20 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu)/* Restore the config space saved during init */ amdgpu_device_load_pci_state (adev->pdev); +/* Certain platforms have switches which assign virtual BAR values to +* devices. OS uses the virtual BAR values and device behind the switch +* is assgined another BAR value. When device's config space registers +* are queried, switch returns the virtual BAR values. When mode-2 reset +* is performed, switch is unaware of it, and will continue to return +* the same virtual values to the OS.This affects +* pci_restore_config_space() API as it doesn't write the value saved if +* the current value read from config space is the same as what is +* saved. As a workaround, make sure the config space is restored +* always. +*/ +if (!(adev->flags &AMD_IS_APU )) +smu_v13_0_6_restore_pci_config (smu); +dev_dbg (smu->adev->dev,"wait for reset ack\n" ); do { ret = smu_cmn_wait_for_response(smu);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/19 drm/amdkfd: Add VRAM accounting for SVM migration
In reply to Sasha LevinFrom: Mukul Joshi <[email protected]>
[ Upstream commit 1e214f7faaf5d842754cd5cfcd76308bfedab3b5 ]
Do VRAM accounting when doing migrations to vram to make sure there is enough available VRAM and migrating to VRAM doesn't evict other possible non-unified memory BOs. If migrating to VRAM fails, driver can fall back to using system memory seamlessly.
--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 16 +++++++++++++++- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +15 -1
@@ -516,10 +516,19 @@ svm_migrate_ram_to_vram(struct svm_range *prange, uint32_t best_loc, start = prange->start <<PAGE_SHIFT ; end = (prange->last +1 ) <<PAGE_SHIFT ; + r =amdgpu_amdkfd_reserve_mem_limit (node->adev, + prange->npages *PAGE_SIZE , +KFD_IOC_ALLOC_MEM_FLAGS_VRAM , + node->xcp ? node->xcp->id :0 ); +if (r) { +dev_dbg (node->adev->dev,"failed to reserve VRAM, r: %ld\n" , r); +return -ENOSPC ; + } + r =svm_range_vram_node_new (node, prange, true);if (r) {dev_dbg (node->adev->dev,"fail %ld to alloc vram\n" , r); -return r; + goto out; } ttm_res_offset = prange->offset <<PAGE_SHIFT ;
@@ -549,6 +558,11 @@ svm_migrate_ram_to_vram(struct svm_range *prange, uint32_t best_loc,svm_range_vram_node_free (prange); } +out: +amdgpu_amdkfd_unreserve_mem_limit (node->adev, + prange->npages *PAGE_SIZE , +KFD_IOC_ALLOC_MEM_FLAGS_VRAM , + node->xcp ? node->xcp->id :0 );return r <0 ? r :0 ; }
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
@@ -3416,7 +3416,7 @@ svm_range_trigger_migration(struct mm_struct *mm, struct svm_range *prange, r =svm_migrate_to_vram (prange, best_loc, mm,KFD_MIGRATE_TRIGGER_PREFETCH ); *migrated = !r; -return r; +return 0 ; }int svm_range_schedule_evict_svm_bo (struct amdgpu_amdkfd_fence *fence)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/19 drm/amdgpu: Fix the ring buffer size for queue VM flush
In reply to Sasha LevinFrom: Prike Liang <[email protected]>
[ Upstream commit fe93b0927bc58cb1d64230f45744e527d9d8482c ]
Here are the corrections needed for the queue ring buffer size calculation for the following cases:
- Remove the KIQ VM flush ring usage.
- Add the invalidate TLBs packet for gfx10 and gfx11 queue.
- There's no VM flush and PFP sync, so remove the gfx9 real ring and compute ring buffer usage.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 +-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -2
@@ -9157,7 +9157,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {7 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG *5 +SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT *7 + -2 +/* VM_FLUSH */ +4 +/* VM_FLUSH */ 8 +/* FENCE for VM_FLUSH */ 20 +/* GDS switch */ 4 +/* double SWITCH_BUFFER,
@@ -9248,7 +9248,6 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_kiq = {7 +/* gfx_v10_0_ring_emit_pipeline_sync */ SOC15_FLUSH_GPU_TLB_NUM_WREG *5 +SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT *7 + -2 +/* gfx_v10_0_ring_emit_vm_flush */ 8 + 8 + 8, /* gfx_v10_0_ring_emit_fence_kiq x3 for user fence, vm fence */ .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_compute */ .emit_ib = gfx_v10_0_ring_emit_ib_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -2
@@ -6102,7 +6102,7 @@ static const struct amdgpu_ring_funcs gfx_v11_0_ring_funcs_gfx = {7 +/* PIPELINE_SYNC */ SOC15_FLUSH_GPU_TLB_NUM_WREG *5 +SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT *7 + -2 +/* VM_FLUSH */ +4 +/* VM_FLUSH */ 8 +/* FENCE for VM_FLUSH */ 20 +/* GDS switch */ 5 + /* COND_EXEC */
@@ -6187,7 +6187,6 @@ static const struct amdgpu_ring_funcs gfx_v11_0_ring_funcs_kiq = {7 +/* gfx_v11_0_ring_emit_pipeline_sync */ SOC15_FLUSH_GPU_TLB_NUM_WREG *5 +SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT *7 + -2 +/* gfx_v11_0_ring_emit_vm_flush */ 8 + 8 + 8, /* gfx_v11_0_ring_emit_fence_kiq x3 for user fence, vm fence */ .emit_ib_size = 7, /* gfx_v11_0_ring_emit_ib_compute */ .emit_ib = gfx_v11_0_ring_emit_ib_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
@@ -6988,7 +6988,6 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {7 +/* gfx_v9_0_ring_emit_pipeline_sync */ SOC15_FLUSH_GPU_TLB_NUM_WREG *5 +SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT *7 + -2 +/* gfx_v9_0_ring_emit_vm_flush */ 8 +8 +8 +/* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */ 7 +/* gfx_v9_0_emit_mem_sync */ 5 + /* gfx_v9_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */
@@ -7026,7 +7025,6 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {7 +/* gfx_v9_0_ring_emit_pipeline_sync */ SOC15_FLUSH_GPU_TLB_NUM_WREG *5 +SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT *7 + -2 +/* gfx_v9_0_ring_emit_vm_flush */ 8 + 8 + 8, /* gfx_v9_0_ring_emit_fence_kiq x3 for user fence, vm fence */ .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */ .emit_fence = gfx_v9_0_ring_emit_fence_kiq,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/19 drm/amdgpu/mes: fix use-after-free issue
In reply to Sasha LevinFrom: Jack Xiao <[email protected]>
[ Upstream commit 948255282074d9367e01908b3f5dcf8c10fc9c3d ]
Delete fence fallback timer to fix the ramdom use-after-free issue.
v2: move to amdgpu_mes.c
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -0
@@ -1098,6 +1098,7 @@ void amdgpu_mes_remove_ring(struct amdgpu_device *adev,return ;amdgpu_mes_remove_hw_queue (adev, ring->hw_queue_id); +del_timer_sync (&ring->fence_drv.fallback_timer);amdgpu_ring_fini (ring);kfree (ring); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/19 Revert "net: txgbe: fix i2c dev name cannot match clkdev"
In reply to Sasha LevinFrom: Duanqiang Wen <[email protected]>
[ Upstream commit 8d6bf83f6740ba52a59e25dad360e1e87ef47666 ]
This reverts commit c644920ce9220d83e070f575a4df711741c07f07. when register i2c dev, txgbe shorten "i2c_designware" to "i2c_dw", will cause this i2c dev can't match platfom driver i2c_designware_platform.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c +3 -5
@@ -20,8 +20,6 @@#include "txgbe_phy.h" #include "txgbe_hw.h" -#define TXGBE_I2C_CLK_DEV_NAME "i2c_dw" -static int txgbe_swnodes_register (struct txgbe *txgbe) {struct txgbe_nodes *nodes = &txgbe->nodes;
@@ -553,8 +551,8 @@ static int txgbe_clock_register(struct txgbe *txgbe)char clk_name[32 ];struct clk *clk; -snprintf (clk_name,sizeof (clk_name),"%s.%d" , -TXGBE_I2C_CLK_DEV_NAME ,pci_dev_id (pdev)); +snprintf (clk_name,sizeof (clk_name),"i2c_dw.%d" , +pci_dev_id (pdev)); clk =clk_register_fixed_rate (NULL , clk_name,NULL ,0 ,156250000 );if (IS_ERR (clk))
@@ -616,7 +614,7 @@ static int txgbe_i2c_register(struct txgbe *txgbe) info.parent = &pdev->dev; info.fwnode =software_node_fwnode (txgbe->nodes.group[SWNODE_I2C ]); - info.name =TXGBE_I2C_CLK_DEV_NAME ; + info.name ="i2c_designware" ; info.id =pci_dev_id (pdev); info.res = &DEFINE_RES_IRQ (pdev->irq);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/19 Revert "net: txgbe: fix clk_name exceed MAX_DEV_ID limits"
In reply to Sasha LevinFrom: Duanqiang Wen <[email protected]>
[ Upstream commit edd2d250fb3bb5d70419ae82c1f9dbb9684dffd3 ]
This reverts commit e30cef001da259e8df354b813015d0e5acc08740. commit 99f4570cfba1 ("clkdev: Update clkdev id usage to allow for longer names") can fix clk_name exceed MAX_DEV_ID limits, so this commit is meaningless.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c +1 -1
@@ -551,7 +551,7 @@ static int txgbe_clock_register(struct txgbe *txgbe)char clk_name[32 ];struct clk *clk; -snprintf (clk_name,sizeof (clk_name),"i2c_dw.%d" , +snprintf (clk_name,sizeof (clk_name),"i2c_designware.%d" ,pci_dev_id (pdev)); clk =clk_register_fixed_rate (NULL , clk_name,NULL ,0 ,156250000 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/19 cpu: Ignore "mitigations" kernel parameter if CPU_MITIGATIONS=n
In reply to Sasha LevinFrom: Sean Christopherson <[email protected]>
[ Upstream commit ce0abef6a1d540acef85068e0e82bdf1fbeeb0e9 ]
Explicitly disallow enabling mitigations at runtime for kernels that were built with CONFIG_CPU_MITIGATIONS=n, as some architectures may omit code entirely if mitigations are disabled at compile time.
E.g. on x86, a large pile of Kconfigs are buried behind CPU_MITIGATIONS, and trying to provide sane behavior for retroactively enabling mitigations is extremely difficult, bordering on impossible. E.g. page table isolation and call depth tracking require build-time support, BHI mitigations will still be off without additional kernel parameters, etc.
[ bp: Touchups. ]
--- Documentation/admin-guide/kernel-parameters.txt | 3 +++ arch/x86/Kconfig | 8 ++++++-- include/linux/cpu.h | 11 +++++++++++ kernel/cpu.c | 14 ++++++++++---- 4 files changed, 30 insertions(+), 6 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +3 -0
@@ -3323,6 +3323,9 @@ arch-independent options, each of which is an aggregation of existing arch-specific options. + Note, "mitigations" is supported if and only if the + kernel was built with CPU_MITIGATIONS=y. + off Disable all optional CPU mitigations. This improves system performance, but it may also
arch/x86/Kconfig +6 -2
@@ -2428,9 +2428,13 @@ menuconfig CPU_MITIGATIONS help Say Y here to enable options which enable mitigations for hardware vulnerabilities (usually related to speculative execution). + Mitigations can be disabled or restricted to SMT systems at runtime + via the "mitigations" kernel parameter. - If you say N, all mitigations will be disabled. You really - should know what you are doing to say so. + If you say N, all mitigations will be disabled. This CANNOT be + overridden at runtime. + + Say 'Y', unless you really know what you are doing. if CPU_MITIGATIONS
include/linux/cpu.h +11 -0
@@ -214,7 +214,18 @@ void cpuhp_report_idle_dead(void);static inline void cpuhp_report_idle_dead (void ) { }#endif /* #ifdef CONFIG_HOTPLUG_CPU */ +#ifdef CONFIG_CPU_MITIGATIONS extern bool cpu_mitigations_off (void );extern bool cpu_mitigations_auto_nosmt (void ); +#else +static inline bool cpu_mitigations_off (void ) +{ +return true; +} +static inline bool cpu_mitigations_auto_nosmt (void ) +{ +return false; +} +#endif #endif /* _LINUX_CPU_H_ */
kernel/cpu.c +10 -4
@@ -3197,6 +3197,7 @@ void __init boot_cpu_hotplug_init(void)this_cpu_write (cpuhp_state.target,CPUHP_ONLINE ); } +#ifdef CONFIG_CPU_MITIGATIONS /* * These are used for a global "mitigations=" cmdline option for toggling * optional CPU mitigations.
@@ -3207,9 +3208,7 @@ enum cpu_mitigations { CPU_MITIGATIONS_AUTO_NOSMT, }; -static enum cpu_mitigations cpu_mitigations__ro_after_init = -IS_ENABLED (CONFIG_CPU_MITIGATIONS ) ?CPU_MITIGATIONS_AUTO : -CPU_MITIGATIONS_OFF ; +static enum cpu_mitigations cpu_mitigations__ro_after_init =CPU_MITIGATIONS_AUTO ;static int __init mitigations_parse_cmdline (char *arg) {
@@ -3225,7 +3224,6 @@ static int __init mitigations_parse_cmdline(char *arg)return 0 ; } -early_param ("mitigations" , mitigations_parse_cmdline);/* mitigations=off */ bool cpu_mitigations_off (void )
@@ -3240,3 +3238,11 @@ bool cpu_mitigations_auto_nosmt(void) return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT; }EXPORT_SYMBOL_GPL (cpu_mitigations_auto_nosmt); +#else +static int __init mitigations_parse_cmdline (char *arg) +{ +pr_crit ("Kernel compiled without mitigations, ignoring 'mitigations'; system may still be vulnerable\n" ); +return 0 ; +} +#endif +early_param ("mitigations" , mitigations_parse_cmdline);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/19 LoongArch: Lately init pmu after smp is online
In reply to Sasha LevinFrom: Bibo Mao <[email protected]>
[ Upstream commit f3334ebb8a2a1841c2824594dd992e66de19deb2 ]
There is an smp function call named reset_counters() to init PMU registers of every CPU in PMU initialization state. It requires that all CPUs are online. However there is an early_initcall() wrapper for the PMU init funciton init_hw_perf_events(), so that pmu init funciton is called in do_pre_smp_initcalls() which before function smp_init(). Function reset_counters() cannot work on other CPUs since they haven't boot up still.
Here replace the wrapper early_initcall() with pure_initcall(), so that the PMU init function is called after every cpu is online.
--- arch/loongarch/kernel/perf_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/perf_event.c +1 -1
@@ -884,4 +884,4 @@ static int __init init_hw_perf_events(void)return 0 ; } -early_initcall (init_hw_perf_events); +pure_initcall (init_hw_perf_events);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/19 drm/etnaviv: fix tx clock gating on some GC7000 variants
In reply to Sasha LevinFrom: Derek Foreman <[email protected]>
[ Upstream commit d7a5c9de99b3a9a43dce49f2084eb69b5f6a9752 ]
commit 4bce244272513 ("drm/etnaviv: disable tx clock gating for GC7000 rev6203") accidentally applied the fix for i.MX8MN errata ERR050226 to GC2000 instead of GC7000, failing to disable tx clock gating for GC7000 rev 0x6023 as intended.
Additional clean-up further propagated this issue, partially breaking the clock gating fixes added for GC7000 rev 6202 in commit 432f51e7deeda ("drm/etnaviv: add clock gating workaround for GC7000 r6202").
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +2 -2
@@ -632,8 +632,8 @@ static void etnaviv_gpu_enable_mlcg(struct etnaviv_gpu *gpu)/* Disable TX clock gating on affected core revisions. */ if (etnaviv_is_model_rev (gpu,GC4000 ,0x5222 ) ||etnaviv_is_model_rev (gpu,GC2000 ,0x5108 ) || -etnaviv_is_model_rev (gpu,GC2000 ,0x6202 ) || -etnaviv_is_model_rev (gpu,GC2000 ,0x6203 )) +etnaviv_is_model_rev (gpu,GC7000 ,0x6202 ) || +etnaviv_is_model_rev (gpu,GC7000 ,0x6203 )) pmc |=VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_TX ;/* Disable SE and RA clock gating on affected core revisions. */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/19 selftests: sud_test: return correct emulated syscall value on RISC-V
In reply to Sasha LevinFrom: Clément Léger <[email protected]>
[ Upstream commit 17c67ed752d6a456602b3dbb25c5ae4d3de5deab ]
Currently, the sud_test expects the emulated syscall to return the emulated syscall number. This assumption only works on architectures were the syscall calling convention use the same register for syscall number/syscall return value. This is not the case for RISC-V and thus the return value must be also emulated using the provided ucontext.
--- .../selftests/syscall_user_dispatch/sud_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/testing/selftests/syscall_user_dispatch/sud_test.c +14 -0
@@ -158,6 +158,20 @@ static void handle_sigsys(int sig, siginfo_t *info, void *ucontext)/* In preparation for sigreturn. */ SYSCALL_DISPATCH_OFF (glob_sel); + +/* +* The tests for argument handling assume that `syscall(x) == x`. This +* is a NOP on x86 because the syscall number is passed in %rax, which +* happens to also be the function ABI return register. Other +* architectures may need to swizzle the arguments around. +*/ +#if defined(__riscv) +/* REG_A7 is not defined in libc headers */ +# define REG_A7 (REG_A0 + 7) + + ((ucontext_t *)ucontext)->uc_mcontext.__gregs[REG_A0 ] = + ((ucontext_t *)ucontext)->uc_mcontext.__gregs[REG_A7 ]; +#endif }TEST (dispatch_and_return)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/19 sched/isolation: Fix boot crash when maxcpus < first housekeeping CPU
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit 257bf89d84121280904800acd25cc2c444c717ae ]
housekeeping_setup() checks cpumask_intersects(present, online) to ensure that the kernel will have at least one housekeeping CPU after smp_init(), but this doesn't work if the maxcpus= kernel parameter limits the number of processors available after bootup.
For example, a kernel with "maxcpus=2 nohz_full=0-2" parameters crashes at boot time on a virtual machine with 4 CPUs.
Change housekeeping_setup() to use cpumask_first_and() and check that the returned CPU number is valid and less than setup_max_cpus.
Another corner case is "nohz_full=0" on a machine with a single CPU or with the maxcpus=1 kernel argument. In this case non_housekeeping_mask is empty and tick_nohz_full_setup() makes no sense. And indeed, the kernel hits the WARN_ON(tick_nohz_full_running) in tick_sched_do_timer().
And how should the kernel interpret the "nohz_full=" parameter? It should be silently ignored, but currently cpulist_parse() happily returns the empty cpumask and this leads to the same problem.
Change housekeeping_setup() to check cpumask_empty(non_housekeeping_mask) and do nothing in this case.
--- kernel/sched/isolation.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/sched/isolation.c +6 -1
@@ -109,6 +109,7 @@ static void __init housekeeping_setup_type(enum hk_type type,static int __init housekeeping_setup (char *str,unsigned long flags) {cpumask_var_t non_housekeeping_mask, housekeeping_staging; +unsigned int first_cpu;int err =0 ;if ((flags &HK_FLAG_TICK ) && !(housekeeping.flags &HK_FLAG_TICK )) {
@@ -129,7 +130,8 @@ static int __init housekeeping_setup(char *str, unsigned long flags)cpumask_andnot (housekeeping_staging, cpu_possible_mask, non_housekeeping_mask); -if (!cpumask_intersects (cpu_present_mask, housekeeping_staging)) { + first_cpu =cpumask_first_and (cpu_present_mask, housekeeping_staging); +if (first_cpu >= nr_cpu_ids || first_cpu >= setup_max_cpus) {__cpumask_set_cpu (smp_processor_id (), housekeeping_staging);__cpumask_clear_cpu (smp_processor_id (), non_housekeeping_mask);if (!housekeeping.flags) {
@@ -138,6 +140,9 @@ static int __init housekeeping_setup(char *str, unsigned long flags) } } +if (cpumask_empty (non_housekeeping_mask)) + goto free_housekeeping_staging; +if (!housekeeping.flags) {/* First setup call ("nohz_full=" or "isolcpus=") */ enum hk_type type;
Signature · 1 line
2.43.0