5.12.4-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 442/677 RDMA/mlx5: Zero out ODP related items in the mlx5_ib_mr
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit a639e66703ee45745dc4057c7c2013ed9e1963a7 ]
All of the ODP code assumes when it calls mlx5_mr_cache_alloc() the ODP related fields are zero'd. This is true if the MR was just allocated, but if the MR is recycled through the cache then the values are never zero'd.
This causes a bug in the odp_stats, they don't reset when the MR is reallocated, also is_odp_implicit is never 0'd.
So we can use memset on a block of the mlx5_ib_mr reorganize the structure to put all the data that can be zero'd by the cache at the end.
It is organized as an anonymous struct because the next patch will make this a union.
Delete the unused smr_info. Don't set the kernel only desc_size on the user path. No longer any need to zero mr->parent before freeing it, the memset() will get it now.
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 103 ++++++++++++++++----------- drivers/infiniband/hw/mlx5/mr.c | 14 ++-- drivers/infiniband/hw/mlx5/odp.c | 1 - 3 files changed, 66 insertions(+), 52 deletions(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +60 -43
@@ -547,11 +547,6 @@ static inline const struct mlx5_umr_wr *umr_wr(const struct ib_send_wr *wr) return container_of(wr, struct mlx5_umr_wr, wr); } -struct mlx5_shared_mr_info { -int mr_id; -struct ib_umem *umem; -}; -enum mlx5_ib_cq_pr_flags {MLX5_IB_CQ_PR_FLAGS_CQE_128_PAD =1 <<0 , };
@@ -654,47 +649,69 @@ struct mlx5_ib_dm { atomic64_add(value, &((mr)->odp_stats.counter_name))struct mlx5_ib_mr { -struct ib_mr ibmr; -void *descs; -dma_addr_t desc_map; -int ndescs; -int data_length; -int meta_ndescs; -int meta_length; -int max_descs; -int desc_size; -int access_mode; -unsigned int page_shift; -struct mlx5_core_mkey mmkey; -struct ib_umem *umem; -struct mlx5_shared_mr_info *smr_info; -struct list_head list; -struct mlx5_cache_ent *cache_ent; -u32 out[MLX5_ST_SZ_DW (create_mkey_out)]; -struct mlx5_core_sig_ctx *sig; -void *descs_alloc; -int access_flags;/* Needed for rereg MR */ - -struct mlx5_ib_mr *parent; -/* Needed for IB_MR_TYPE_INTEGRITY */ -struct mlx5_ib_mr *pi_mr; -struct mlx5_ib_mr *klm_mr; -struct mlx5_ib_mr *mtt_mr; -u64 data_iova; -u64 pi_iova; - -/* For ODP and implicit */ -struct xarray implicit_children; -union { -struct list_head elm; -struct work_struct work; - } odp_destroy; -struct ib_odp_counters odp_stats; -bool is_odp_implicit; +struct ib_mr ibmr; +struct mlx5_core_mkey mmkey; -struct mlx5_async_work cb_work; +/* User MR data */ +struct mlx5_cache_ent *cache_ent; +struct ib_umem *umem; + +/* This is zero'd when the MR is allocated */ +struct { +/* Used only while the MR is in the cache */ +struct { +u32 out[MLX5_ST_SZ_DW (create_mkey_out)]; +struct mlx5_async_work cb_work; +/* Cache list element */ +struct list_head list; + }; + +/* Used only by kernel MRs (umem == NULL) */ +struct { +void *descs; +void *descs_alloc; +dma_addr_t desc_map; +int max_descs; +int ndescs; +int desc_size; +int access_mode; + +/* For Kernel IB_MR_TYPE_INTEGRITY */ +struct mlx5_core_sig_ctx *sig; +struct mlx5_ib_mr *pi_mr; +struct mlx5_ib_mr *klm_mr; +struct mlx5_ib_mr *mtt_mr; +u64 data_iova; +u64 pi_iova; +int meta_ndescs; +int meta_length; +int data_length; + }; + +/* Used only by User MRs (umem != NULL) */ +struct { +unsigned int page_shift; +/* Current access_flags */ +int access_flags; + +/* For User ODP */ +struct mlx5_ib_mr *parent; +struct xarray implicit_children; +union { +struct work_struct work; + } odp_destroy; +struct ib_odp_counters odp_stats; +bool is_odp_implicit; + }; + }; }; +/* Zero the fields in the mr that are variant depending on usage */ +static inline void mlx5_clear_mr (struct mlx5_ib_mr *mr) +{ +memset (mr->out,0 ,sizeof (*mr) - offsetof(struct mlx5_ib_mr , out)); +} +static inline bool is_odp_mr (struct mlx5_ib_mr *mr) { return IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING) && mr->umem &&
drivers/infiniband/hw/mlx5/mr.c +6 -8
@@ -590,6 +590,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, ent->available_mrs--;queue_adjust_cache_locked (ent);spin_unlock_irq (&ent->lock); + +mlx5_clear_mr (mr); } mr->access_flags = access_flags;return mr;
@@ -615,16 +617,14 @@ static struct mlx5_ib_mr *get_cache_mr(struct mlx5_cache_ent *req_ent) ent->available_mrs--;queue_adjust_cache_locked (ent);spin_unlock_irq (&ent->lock); -break ; +mlx5_clear_mr (mr); +return mr; }queue_adjust_cache_locked (ent);spin_unlock_irq (&ent->lock); } - -if (!mr) - req_ent->miss++; - -return mr; + req_ent->miss++; +return NULL ; }static void detach_mr_from_cache (struct mlx5_ib_mr *mr)
@@ -993,8 +993,6 @@ static struct mlx5_ib_mr *alloc_cacheable_mr(struct ib_pd *pd, mr->ibmr.pd = pd; mr->umem = umem; - mr->access_flags = access_flags; - mr->desc_size =sizeof (struct mlx5_mtt ); mr->mmkey.iova = iova; mr->mmkey.size = umem->length; mr->mmkey.pd =to_mpd (pd)->pdn;
drivers/infiniband/hw/mlx5/odp.c +0 -1
@@ -227,7 +227,6 @@ static void free_implicit_child_mr(struct mlx5_ib_mr *mr, bool need_imr_xlt)dma_fence_odp_mr (mr); - mr->parent =NULL ;mlx5_mr_cache_free (mr_to_mdev (mr), mr);ib_umem_odp_release (odp); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 443/677 RDMA/mlx5: Fix query RoCE port
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 7852546f524595245382a919e752468f73421451 ]
mlx5_is_roce_enabled returns the devlink RoCE init value, therefore it should be used only when driver is loaded. Instead we just need to read the roce_en field.
In addition, rename mlx5_is_roce_enabled to mlx5_is_roce_init_enabled.
--- drivers/infiniband/hw/mlx5/main.c | 6 +++--- include/linux/mlx5/driver.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/main.c +3 -3
@@ -499,7 +499,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,translate_eth_proto_oper (eth_prot_oper, &props->active_speed, &props->active_width, ext); -if (!dev->is_rep &&mlx5_is_roce_enabled (mdev)) { +if (!dev->is_rep && dev->mdev->roce.roce_en) {u16 qkey_viol_cntr; props->port_cap_flags |=IB_PORT_CM_SUP ;
@@ -4174,7 +4174,7 @@ static int mlx5_ib_roce_init(struct mlx5_ib_dev *dev)/* Register only for native ports */ err =mlx5_add_netdev_notifier (dev, port_num); -if (err || dev->is_rep || !mlx5_is_roce_enabled (mdev)) +if (err || dev->is_rep || !mlx5_is_roce_init_enabled (mdev))/* * We don't enable ETH interface for * 1. IB representors
@@ -4711,7 +4711,7 @@ static int mlx5r_probe(struct auxiliary_device *adev, dev->mdev = mdev; dev->num_ports = num_ports; -if (ll ==IB_LINK_LAYER_ETHERNET && !mlx5_is_roce_enabled (mdev)) +if (ll ==IB_LINK_LAYER_ETHERNET && !mlx5_is_roce_init_enabled (mdev)) profile = &raw_eth_profile;else profile = &pf_profile;
include/linux/mlx5/driver.h +1 -1
@@ -1226,7 +1226,7 @@ enum { MLX5_TRIGGERED_CMD_COMP = (u64)1 << 32, }; -static inline bool mlx5_is_roce_enabled (struct mlx5_core_dev *dev) +static inline bool mlx5_is_roce_init_enabled (struct mlx5_core_dev *dev) {struct devlink *devlink =priv_to_devlink (dev);union devlink_param_value val;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 444/677 RDMA/mlx5: Fix mlx5 rates to IB rates map
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit 6fe6e568639859db960c8fcef19a2ece1c2d7eae ]
Correct the map between mlx5 rates and corresponding ib rates, as they don't always have a fixed offset between them.
--- drivers/infiniband/hw/mlx5/qp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +14 -1
@@ -3146,6 +3146,19 @@ enum { MLX5_PATH_FLAG_COUNTER = 1 << 2, }; +static int mlx5_to_ib_rate_map (u8 rate) +{ +static const int rates[] = {IB_RATE_PORT_CURRENT ,IB_RATE_56_GBPS , +IB_RATE_25_GBPS ,IB_RATE_100_GBPS , +IB_RATE_200_GBPS ,IB_RATE_50_GBPS , +IB_RATE_400_GBPS }; + +if (rate <ARRAY_SIZE (rates)) +return rates[rate]; + +return rate -MLX5_STAT_RATE_OFFSET ; +} +static int ib_to_mlx5_rate_map (u8 rate) {switch (rate) {
@@ -4485,7 +4498,7 @@ static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev,rdma_ah_set_path_bits (ah_attr,MLX5_GET (ads, path, mlid)); static_rate =MLX5_GET (ads, path, stat_rate); -rdma_ah_set_static_rate (ah_attr, static_rate ? static_rate -5 :0 ); +rdma_ah_set_static_rate (ah_attr,mlx5_to_ib_rate_map (static_rate));if (MLX5_GET (ads, path, grh) || ah_attr->type ==RDMA_AH_ATTR_TYPE_ROCE ) { rdma_ah_set_grh(ah_attr, NULL, MLX5_GET(ads, path, flow_label),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 445/677 net/mlx5: DR, Add missing vhca_id consume from STEv1
In reply to Greg Kroah-HartmanFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit cc82a2e6c8af956d894fa58a040dc0d532dd9978 ]
The field source_eswitch_owner_vhca_id was not consumed in the same way as in STEv0. Added the missing set.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +1 -0
@@ -1532,6 +1532,7 @@ static void dr_ste_v1_build_src_gvmi_qpn_bit_mask(struct mlx5dr_match_param *valDR_STE_SET_ONES (src_gvmi_qp_v1, bit_mask, source_gvmi, misc_mask, source_port);DR_STE_SET_ONES (src_gvmi_qp_v1, bit_mask, source_qp, misc_mask, source_sqn); + misc_mask->source_eswitch_owner_vhca_id =0 ; } static int dr_ste_v1_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 446/677 wilc1000: write value to WILC_INTR2_ENABLE register
In reply to Greg Kroah-HartmanFrom: Marcus Folkesson <[email protected]>
[ Upstream commit e21b6e5a54628cd3935f200049d4430c25c54e03 ]
Write the value instead of reading it twice.
--- drivers/net/wireless/microchip/wilc1000/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +1 -1
@@ -947,7 +947,7 @@ static int wilc_sdio_sync_ext(struct wilc *wilc, int nint)for (i =0 ; (i <3 ) && (nint >0 ); i++, nint--) reg |=BIT (i); - ret =wilc_sdio_read_reg (wilc,WILC_INTR2_ENABLE , ®); + ret =wilc_sdio_write_reg (wilc,WILC_INTR2_ENABLE , reg);if (ret) { dev_err(&func->dev, "Failed write reg (%08x)...\n",
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 447/677 KVM: x86/mmu: Retry page faults that hit an invalid memslot
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit e0c378684b6545ad2d4403bb701d0ac4932b4e95 ]
Retry page faults (re-enter the guest) that hit an invalid memslot instead of treating the memslot as not existing, i.e. handling the page fault as an MMIO access. When deleting a memslot, SPTEs aren't zapped and the TLBs aren't flushed until after the memslot has been marked invalid.
Handling the invalid slot as MMIO means there's a small window where a page fault could replace a valid SPTE with an MMIO SPTE. The legacy MMU handles such a scenario cleanly, but the TDP MMU assumes such behavior is impossible (see the BUG() in __handle_changed_spte()). There's really no good reason why the legacy MMU should allow such a scenario, and closing this hole allows for additional cleanups.
Message-Id: <[email protected]>
--- arch/x86/kvm/mmu/mmu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/kvm/mmu/mmu.c +8 -0
@@ -3665,6 +3665,14 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn,struct kvm_memory_slot *slot =kvm_vcpu_gfn_to_memslot (vcpu, gfn);bool async; +/* +* Retry the page fault if the gfn hit a memslot that is being deleted +* or moved. This ensures any existing SPTEs for the old memslot will +* be zapped before KVM inserts a new MMIO SPTE for the gfn. +*/ +if (slot && (slot->flags &KVM_MEMSLOT_INVALID )) +return true; +/* Don't expose private memslots to L2. */ if (is_guest_mode (vcpu) && !kvm_is_visible_memslot (slot)) { *pfn =KVM_PFN_NOSLOT ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 448/677 Bluetooth: avoid deadlock between hci_dev->lock and socket lock
In reply to Greg Kroah-HartmanFrom: Jiri Kosina <[email protected]>
[ Upstream commit 17486960d79b900c45e0bb8fbcac0262848582ba ]
Commit eab2404ba798 ("Bluetooth: Add BT_PHY socket option") added a dependency between socket lock and hci_dev->lock that could lead to deadlock.
It turns out that hci_conn_get_phy() is not in any way relying on hdev being immutable during the runtime of this function, neither does it even look at any of the members of hdev, and as such there is no need to hold that lock.
This fixes the lockdep splat below:
======================================================
WARNING: possible circular locking dependency detected 5.12.0-rc1-00026-g73d464503354 #10 Not tainted
------------------------------------------------------
bluetoothd/1118 is trying to acquire lock:
ffff8f078383c078 (&hdev->lock){+.+.}-{3:3}, at: hci_conn_get_phy+0x1c/0x150 [bluetooth]
but task is already holding lock:
ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}:
lock_sock_nested+0x72/0xa0
l2cap_sock_ready_cb+0x18/0x70 [bluetooth]
l2cap_config_rsp+0x27a/0x520 [bluetooth]
l2cap_sig_channel+0x658/0x1330 [bluetooth]
l2cap_recv_frame+0x1ba/0x310 [bluetooth]
hci_rx_work+0x1cc/0x640 [bluetooth]
process_one_work+0x244/0x5f0
worker_thread+0x3c/0x380
kthread+0x13e/0x160
ret_from_fork+0x22/0x30-> #2 (&chan->lock#2/1){+.+.}-{3:3}:
__mutex_lock+0xa3/0xa10
l2cap_chan_connect+0x33a/0x940 [bluetooth]
l2cap_sock_connect+0x141/0x2a0 [bluetooth]
__sys_connect+0x9b/0xc0
__x64_sys_connect+0x16/0x20
do_syscall_64+0x33/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xae-> #1 (&conn->chan_lock){+.+.}-{3:3}:
__mutex_lock+0xa3/0xa10
l2cap_chan_connect+0x322/0x940 [bluetooth]
l2cap_sock_connect+0x141/0x2a0 [bluetooth]
__sys_connect+0x9b/0xc0
__x64_sys_connect+0x16/0x20
do_syscall_64+0x33/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xae-> #0 (&hdev->lock){+.+.}-{3:3}:
__lock_acquire+0x147a/0x1a50
lock_acquire+0x277/0x3d0
__mutex_lock+0xa3/0xa10
hci_conn_get_phy+0x1c/0x150 [bluetooth]
l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth]
__sys_getsockopt+0xcc/0x200
__x64_sys_getsockopt+0x20/0x30
do_syscall_64+0x33/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xaeother info that might help us debug this:
Chain exists of: &hdev->lock --> &chan->lock#2/1 --> sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
lock(&chan->lock#2/1);
lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP); lock(&hdev->lock);
*** DEADLOCK ***
1 lock held by bluetoothd/1118:
#0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 [bluetooth]
stack backtrace: CPU: 3 PID: 1118 Comm: bluetoothd Not tainted 5.12.0-rc1-00026-g73d464503354 #10 Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017 Call Trace: dump_stack+0x7f/0xa1 check_noncircular+0x105/0x120 ? __lock_acquire+0x147a/0x1a50 __lock_acquire+0x147a/0x1a50 lock_acquire+0x277/0x3d0 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] ? __lock_acquire+0x2e1/0x1a50 ? lock_is_held_type+0xb4/0x120 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] __mutex_lock+0xa3/0xa10 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] ? lock_acquire+0x277/0x3d0 ? mark_held_locks+0x49/0x70 ? mark_held_locks+0x49/0x70 ? hci_conn_get_phy+0x1c/0x150 [bluetooth] hci_conn_get_phy+0x1c/0x150 [bluetooth] l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth] __sys_getsockopt+0xcc/0x200 __x64_sys_getsockopt+0x20/0x30 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fb73df33eee Code: 48 8b 0d 85 0f 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 37 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 52 0f 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007fffcfbbbf08 EFLAGS: 00000203 ORIG_RAX: 0000000000000037 RAX: ffffffffffffffda RBX: 0000000000000019 RCX: 00007fb73df33eee RDX: 000000000000000e RSI: 0000000000000112 RDI: 0000000000000018 RBP: 0000000000000000 R08: 00007fffcfbbbf44 R09: 0000000000000000 R10: 00007fffcfbbbf3c R11: 0000000000000203 R12: 0000000000000000 R13: 0000000000000018 R14: 0000000000000000 R15: 0000556fcefc70d0
--- net/bluetooth/hci_conn.c | 4 ---- 1 file changed, 4 deletions(-)
net/bluetooth/hci_conn.c +0 -4
@@ -1830,8 +1830,6 @@ u32 hci_conn_get_phy(struct hci_conn *conn) {u32 phys =0 ; -hci_dev_lock (conn->hdev); -/* BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 2, Part B page 471: * Table 6.2: Packets defined for synchronous, asynchronous, and * CSB logical transport types.
@@ -1928,7 +1926,5 @@ u32 hci_conn_get_phy(struct hci_conn *conn)break ; } -hci_dev_unlock (conn->hdev); -return phys; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 449/677 net: lapbether: Prevent racing when checking whether the netif is running
In reply to Greg Kroah-HartmanFrom: Xie He <[email protected]>
[ Upstream commit 5acd0cfbfbb5a688da1bfb1a2152b0c855115a35 ]
There are two "netif_running" checks in this driver. One is in "lapbeth_xmit" and the other is in "lapbeth_rcv". They serve to make sure that the LAPB APIs called in these functions are called before "lapb_unregister" is called by the "ndo_stop" function.
However, these "netif_running" checks are unreliable, because it's possible that immediately after "netif_running" returns true, "ndo_stop" is called (which causes "lapb_unregister" to be called).
This patch adds locking to make sure "lapbeth_xmit" and "lapbeth_rcv" can reliably check and ensure the netif is running while doing their work.
--- drivers/net/wan/lapbether.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/net/wan/lapbether.c +25 -7
@@ -51,6 +51,8 @@ struct lapbethdev {struct list_head node;struct net_device *ethdev;/* link to ethernet device */ struct net_device *axdev;/* lapbeth device (lapb#) */ +bool up; +spinlock_t up_lock;/* Protects "up" */ };static LIST_HEAD (lapbeth_devices);
@@ -101,8 +103,9 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packercu_read_lock (); lapbeth =lapbeth_get_x25_dev (dev);if (!lapbeth) - goto drop_unlock; -if (!netif_running (lapbeth->axdev)) + goto drop_unlock_rcu; +spin_lock_bh (&lapbeth->up_lock); +if (!lapbeth->up) goto drop_unlock; len = skb->data[0 ] + skb->data[1 ] *256 ;
@@ -117,11 +120,14 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe goto drop_unlock; } out: +spin_unlock_bh (&lapbeth->up_lock);rcu_read_unlock ();return 0 ; drop_unlock:kfree_skb (skb); goto out; +drop_unlock_rcu: +rcu_read_unlock (); drop:kfree_skb (skb);return 0 ;
@@ -151,13 +157,11 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)static netdev_tx_t lapbeth_xmit (struct sk_buff *skb,struct net_device *dev) { +struct lapbethdev *lapbeth =netdev_priv (dev);int err; -/* -* Just to be *really* sure not to send anything if the interface -* is down, the ethernet device may have gone. -*/ -if (!netif_running (dev)) +spin_lock_bh (&lapbeth->up_lock); +if (!lapbeth->up) goto drop;/* There should be a pseudo header of 1 byte added by upper layers.
@@ -194,6 +198,7 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, goto drop; } out: +spin_unlock_bh (&lapbeth->up_lock);return NETDEV_TX_OK ; drop:kfree_skb (skb);
@@ -285,6 +290,7 @@ static const struct lapb_register_struct lapbeth_callbacks = {*/ static int lapbeth_open (struct net_device *dev) { +struct lapbethdev *lapbeth =netdev_priv (dev);int err;if ((err =lapb_register (dev, &lapbeth_callbacks)) !=LAPB_OK ) {
@@ -292,13 +298,22 @@ static int lapbeth_open(struct net_device *dev)return -ENODEV ; } +spin_lock_bh (&lapbeth->up_lock); + lapbeth->up = true; +spin_unlock_bh (&lapbeth->up_lock); +return 0 ; }static int lapbeth_close (struct net_device *dev) { +struct lapbethdev *lapbeth =netdev_priv (dev);int err; +spin_lock_bh (&lapbeth->up_lock); + lapbeth->up = false; +spin_unlock_bh (&lapbeth->up_lock); +if ((err =lapb_unregister (dev)) !=LAPB_OK )pr_err ("lapb_unregister error: %d\n" , err);
@@ -356,6 +371,9 @@ static int lapbeth_new_device(struct net_device *dev)dev_hold (dev); lapbeth->ethdev = dev; + lapbeth->up = false; +spin_lock_init (&lapbeth->up_lock); + rc = -EIO ;if (register_netdevice (ndev)) goto fail;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 450/677 libbpf: Add explicit padding to bpf_xdp_set_link_opts
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit dde7b3f5f2f458297aeccfd4783e53ab8ca046db ]
Adding such anonymous padding fixes the issue with uninitialized portions of bpf_xdp_set_link_opts when using LIBBPF_DECLARE_OPTS macro with inline field initialization:
DECLARE_LIBBPF_OPTS(bpf_xdp_set_link_opts, opts, .old_fd = -1);
When such code is compiled in debug mode, compiler is generating code that leaves padding bytes uninitialized, which triggers error inside libbpf APIs that do strict zero initialization checks for OPTS structs.
Adding anonymous padding field fixes the issue.
--- tools/lib/bpf/libbpf.h | 1 + 1 file changed, 1 insertion(+)
tools/lib/bpf/libbpf.h +1 -0
@@ -507,6 +507,7 @@ struct xdp_link_info {struct bpf_xdp_set_link_opts {size_t sz;int old_fd; + size_t :0; };#define bpf_xdp_set_link_opts__last_field old_fd
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 451/677 bpftool: Fix maybe-uninitialized warnings
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 4bbb3583687051ef99966ddaeb1730441b777d40 ]
Somehow when bpftool is compiled in -Og mode, compiler produces new warnings about possibly uninitialized variables. Fix all the reported problems.
--- tools/bpf/bpftool/btf.c | 3 +++ tools/bpf/bpftool/main.c | 3 +-- tools/bpf/bpftool/map.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)
tools/bpf/bpftool/btf.c +3 -0
@@ -538,6 +538,7 @@ static int do_dump(int argc, char **argv)NEXT_ARG ();if (argc <1 ) {p_err ("expecting value for 'format' option\n" ); + err = -EINVAL ; goto done; }if (strcmp (*argv,"c" ) ==0 ) {
@@ -547,11 +548,13 @@ static int do_dump(int argc, char **argv) }else {p_err ("unrecognized format specifier: '%s', possible values: raw, c" , *argv); + err = -EINVAL ; goto done; }NEXT_ARG (); }else {p_err ("unrecognized option: '%s'" , *argv); + err = -EINVAL ; goto done; } }
tools/bpf/bpftool/main.c +1 -2
@@ -276,7 +276,7 @@ static int do_batch(int argc, char **argv)int n_argc;FILE *fp;char *cp; -int err; +int err =0 ;int i;if (argc <2 ) {
@@ -370,7 +370,6 @@ static int do_batch(int argc, char **argv) }else {if (!json_output)printf ("processed %d commands\n" , lines); - err =0 ; } err_close:if (fp != stdin)
tools/bpf/bpftool/map.c +1 -1
@@ -100,7 +100,7 @@ static int do_dump_btf(const struct btf_dumper *d, void *value) {__u32 value_id; -int ret; +int ret =0 ;/* start of key-value pair */ jsonw_start_object (d->jw);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 452/677 iommu: Check dev->iommu in iommu_dev_xxx functions
In reply to Greg Kroah-HartmanFrom: Shameer Kolothum <[email protected]>
[ Upstream commit b9abb19fa5fd2d8a4be61c6cd4b2a48aa1a17f9c ]
The device iommu probe/attach might have failed leaving dev->iommu to NULL and device drivers may still invoke these functions resulting in a crash in iommu vendor driver code.
Hence make sure we check that.
--- drivers/iommu/iommu.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/iommu/iommu.c +15 -9
@@ -2878,10 +2878,12 @@ EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);*/ int iommu_dev_enable_feature (struct device *dev,enum iommu_dev_features feat) { -const struct iommu_ops *ops = dev->bus->iommu_ops; +if (dev->iommu && dev->iommu->iommu_dev) { +const struct iommu_ops *ops = dev->iommu->iommu_dev->ops; -if (ops && ops->dev_enable_feat) -return ops->dev_enable_feat (dev, feat); +if (ops->dev_enable_feat) +return ops->dev_enable_feat (dev, feat); + }return -ENODEV ; }
@@ -2894,10 +2896,12 @@ EXPORT_SYMBOL_GPL(iommu_dev_enable_feature);*/ int iommu_dev_disable_feature (struct device *dev,enum iommu_dev_features feat) { -const struct iommu_ops *ops = dev->bus->iommu_ops; +if (dev->iommu && dev->iommu->iommu_dev) { +const struct iommu_ops *ops = dev->iommu->iommu_dev->ops; -if (ops && ops->dev_disable_feat) -return ops->dev_disable_feat (dev, feat); +if (ops->dev_disable_feat) +return ops->dev_disable_feat (dev, feat); + }return -EBUSY ; }
@@ -2905,10 +2909,12 @@ EXPORT_SYMBOL_GPL(iommu_dev_disable_feature);bool iommu_dev_feature_enabled (struct device *dev,enum iommu_dev_features feat) { -const struct iommu_ops *ops = dev->bus->iommu_ops; +if (dev->iommu && dev->iommu->iommu_dev) { +const struct iommu_ops *ops = dev->iommu->iommu_dev->ops; -if (ops && ops->dev_feat_enabled) -return ops->dev_feat_enabled (dev, feat); +if (ops->dev_feat_enabled) +return ops->dev_feat_enabled (dev, feat); + }return false; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 453/677 iommu/dma: Resurrect the "forcedac" option
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit 3542dcb15cef66c0b9e6c3b33168eb657e0d9520 ]
In converting intel-iommu over to the common IOMMU DMA ops, it quietly lost the functionality of its "forcedac" option. Since this is a handy thing both for testing and for performance optimisation on certain platforms, reimplement it under the common IOMMU parameter namespace.
For the sake of fixing the inadvertent breakage of the Intel-specific parameter, remove the dmar_forcedac remnants and hook it up as an alias while documenting the transition to the new common parameter.
--- Documentation/admin-guide/kernel-parameters.txt | 15 ++++++++------- drivers/iommu/dma-iommu.c | 13 ++++++++++++- drivers/iommu/intel/iommu.c | 5 ++--- include/linux/dma-iommu.h | 2 ++ 4 files changed, 24 insertions(+), 11 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +8 -7
@@ -1869,13 +1869,6 @@ bypassed by not enabling DMAR with this option. In this case, gfx device will use physical address for DMA. - forcedac [X86-64] - With this option iommu will not optimize to look - for io virtual address below 32-bit forcing dual - address cycle on pci bus for cards supporting greater - than 32-bit addressing. The default is to look - for translation below 32-bit and if not available - then look in the higher range. strict [Default Off] With this option on every unmap_single operation will result in a hardware IOTLB flush operation as opposed
@@ -1964,6 +1957,14 @@ nobypass [PPC/POWERNV] Disable IOMMU bypass, using IOMMU for PCI devices. + iommu.forcedac= [ARM64, X86] Control IOVA allocation for PCI devices. + Format: { "0" | "1" } + 0 - Try to allocate a 32-bit DMA address first, before + falling back to the full range if needed. + 1 - Allocate directly from the full usable range, + forcing Dual Address Cycle for PCI cards supporting + greater than 32-bit addressing. + iommu.strict= [ARM64] Configure TLB invalidation behaviour Format: { "0" | "1" } 0 - Lazy mode.
drivers/iommu/dma-iommu.c +12 -1
@@ -52,6 +52,17 @@ struct iommu_dma_cookie { };static DEFINE_STATIC_KEY_FALSE (iommu_deferred_attach_enabled); +bool iommu_dma_forcedac__read_mostly ; + +static int __init iommu_dma_forcedac_setup (char *str) +{ +int ret =kstrtobool (str, &iommu_dma_forcedac); + +if (!ret && iommu_dma_forcedac) +pr_info ("Forcing DAC for PCI devices\n" ); +return ret; +} +early_param ("iommu.forcedac" , iommu_dma_forcedac_setup);void iommu_dma_free_cpu_cached_iovas (unsigned int cpu,struct iommu_domain *domain)
@@ -444,7 +455,7 @@ static dma_addr_t iommu_dma_alloc_iova(struct iommu_domain *domain, dma_limit =min (dma_limit, (u64 )domain->geometry.aperture_end);/* Try to get PCI devices a SAC address */ -if (dma_limit >DMA_BIT_MASK (32 ) &&dev_is_pci (dev)) +if (dma_limit >DMA_BIT_MASK (32 ) && !iommu_dma_forcedac &&dev_is_pci (dev)) iova =alloc_iova_fast (iovad, iova_len,DMA_BIT_MASK (32 ) >> shift, false);
drivers/iommu/intel/iommu.c +2 -3
@@ -360,7 +360,6 @@ int intel_iommu_enabled = 0;EXPORT_SYMBOL_GPL (intel_iommu_enabled);static int dmar_map_gfx =1 ; -static int dmar_forcedac;static int intel_iommu_strict;static int intel_iommu_superpage =1 ;static int iommu_identity_mapping;
@@ -451,8 +450,8 @@ static int __init intel_iommu_setup(char *str) dmar_map_gfx =0 ;pr_info ("Disable GFX device mapping\n" ); }else if (!strncmp (str,"forcedac" ,8 )) { -pr_info ("Forcing DAC for PCI devices\n" ); - dmar_forcedac =1 ; +pr_warn ("intel_iommu=forcedac deprecated; use iommu.forcedac instead\n" ); + iommu_dma_forcedac = true; }else if (!strncmp (str,"strict" ,6 )) {pr_info ("Disable batched IOTLB flush\n" ); intel_iommu_strict =1 ;
include/linux/dma-iommu.h +2 -0
@@ -40,6 +40,8 @@ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);void iommu_dma_free_cpu_cached_iovas (unsigned int cpu,struct iommu_domain *domain); +extern bool iommu_dma_forcedac; +#else /* CONFIG_IOMMU_DMA */ struct iommu_domain ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 454/677 iommu/vt-d: Reject unsupported page request modes
In reply to Greg Kroah-HartmanFrom: Jacob Pan <[email protected]>
[ Upstream commit 78a523fe73b81b4447beb2d6c78c9fafae24eebb ]
When supervisor/privilige mode SVM is used, we bind init_mm.pgd with a supervisor PASID. There should not be any page fault for init_mm. Execution request with DMA read is also not supported.
This patch checks PRQ descriptor for both unsupported configurations, reject them both with invalid responses.
--- drivers/iommu/intel/svm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/iommu/intel/svm.c +11 -1
@@ -920,7 +920,17 @@ static irqreturn_t prq_event_thread(int irq, void *d) ((unsigned long long *)req)[1]); goto no_pasid; } - +/* We shall not receive page request for supervisor SVM */ +if (req->pm_req && (req->rd_req | req->wr_req)) { +pr_err ("Unexpected page request in Privilege Mode" ); +/* No need to find the matching sdev as for bad_req */ + goto no_pasid; + } +/* DMA read with exec requeset is not supported. */ +if (req->exe_req && req->rd_req) { +pr_err ("Execution request not supported\n" ); + goto no_pasid; + }if (!svm || svm->pasid != req->pasid) {rcu_read_lock (); svm =ioasid_find (NULL , req->pasid,NULL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 455/677 ASoC: tegra30: i2s: Restore hardware state on runtime PM resume
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 0bbcecaaab15a74ba69f93df46c753f2a64eadca ]
Tegra30 I2S driver syncs regmap cache only on resume from system suspend, but hardware is reset across the runtime suspend because RPM of the parent AHUB driver resets the I2S hardware, hence h/w state is lost after each RPM resume. The problem isn't visible because hardware happens to be fully reprogrammed after each RPM resume. Move hardware syncing to RPM resume in order to restore h/w state properly.
--- sound/soc/tegra/tegra30_i2s.c | 40 +++++++++++------------------------ 1 file changed, 12 insertions(+), 28 deletions(-)
sound/soc/tegra/tegra30_i2s.c +12 -28
@@ -58,8 +58,18 @@ static int tegra30_i2s_runtime_resume(struct device *dev) }regcache_cache_only (i2s->regmap, false); +regcache_mark_dirty (i2s->regmap); + + ret =regcache_sync (i2s->regmap); +if (ret) + goto disable_clocks;return 0 ; + +disable_clocks: +clk_disable_unprepare (i2s->clk_i2s); + +return ret; } static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai,
@@ -551,37 +561,11 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP -static int tegra30_i2s_suspend (struct device *dev) -{ -struct tegra30_i2s *i2s =dev_get_drvdata (dev); - -regcache_mark_dirty (i2s->regmap); - -return 0 ; -} - -static int tegra30_i2s_resume (struct device *dev) -{ -struct tegra30_i2s *i2s =dev_get_drvdata (dev); -int ret; - - ret =pm_runtime_get_sync (dev); -if (ret <0 ) { -pm_runtime_put (dev); -return ret; - } - ret =regcache_sync (i2s->regmap); -pm_runtime_put (dev); - -return ret; -} -#endif -static const struct dev_pm_ops tegra30_i2s_pm_ops = { SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend, tegra30_i2s_runtime_resume, NULL) -SET_SYSTEM_SLEEP_PM_OPS (tegra30_i2s_suspend, tegra30_i2s_resume) +SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, + pm_runtime_force_resume) };static struct platform_driver tegra30_i2s_driver = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 456/677 net: dsa: bcm_sf2: add function finding RGMII register
In reply to Greg Kroah-HartmanFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 55cfeb396965c3906a84d09a9c487d065e37773b ]
Simple macro like REG_RGMII_CNTRL_P() is insufficient as:
1. It doesn't validate port argument
2. It doesn't support chipsets with non-lineral RGMII regs layout
Missing port validation could result in getting register offset from out of array. Random memory -> random offset -> random reads/writes. It affected e.g. BCM4908 for REG_RGMII_CNTRL_P(7).
--- drivers/net/dsa/bcm_sf2.c | 49 +++++++++++++++++++++++++++++----- drivers/net/dsa/bcm_sf2_regs.h | 2 -- 2 files changed, 42 insertions(+), 9 deletions(-)
drivers/net/dsa/bcm_sf2.c +42 -7
@@ -32,6 +32,31 @@#include "b53/b53_priv.h" #include "b53/b53_regs.h" +static u16 bcm_sf2_reg_rgmii_cntrl (struct bcm_sf2_priv *priv,int port) +{ +switch (priv->type) { +case BCM4908_DEVICE_ID : +/* TODO */ +break ; +default : +switch (port) { +case 0 : +return REG_RGMII_0_CNTRL ; +case 1 : +return REG_RGMII_1_CNTRL ; +case 2 : +return REG_RGMII_2_CNTRL ; +default : +break ; + } + } + +WARN_ONCE (1 ,"Unsupported port %d\n" , port); + +/* RO fallback reg */ +return REG_SWITCH_STATUS ; +} +/* Return the number of active ports, not counting the IMP (CPU) port */ static unsigned int bcm_sf2_num_active_ports (struct dsa_switch *ds) {
@@ -647,6 +672,7 @@ static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port, {struct bcm_sf2_priv *priv =bcm_sf2_to_priv (ds);u32 id_mode_dis =0 , port_mode; +u32 reg_rgmii_ctrl;u32 reg;if (port ==core_readl (priv,CORE_IMP0_PRT_ID ))
@@ -670,10 +696,12 @@ static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,return ; } + reg_rgmii_ctrl =bcm_sf2_reg_rgmii_cntrl (priv, port); +/* Clear id_mode_dis bit, and the existing port mode, let * RGMII_MODE_EN bet set by mac_link_{up,down} */ - reg =reg_readl (priv,REG_RGMII_CNTRL_P (port)); + reg =reg_readl (priv, reg_rgmii_ctrl); reg &= ~ID_MODE_DIS ; reg &= ~(PORT_MODE_MASK <<PORT_MODE_SHIFT );
@@ -681,13 +709,14 @@ static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,if (id_mode_dis) reg |=ID_MODE_DIS ; -reg_writel (priv, reg,REG_RGMII_CNTRL_P (port)); +reg_writel (priv, reg, reg_rgmii_ctrl); }static void bcm_sf2_sw_mac_link_set (struct dsa_switch *ds,int port,phy_interface_t interface,bool link) {struct bcm_sf2_priv *priv =bcm_sf2_to_priv (ds); +u32 reg_rgmii_ctrl;u32 reg; if (!phy_interface_mode_is_rgmii(interface) &&
@@ -695,13 +724,15 @@ static void bcm_sf2_sw_mac_link_set(struct dsa_switch *ds, int port, interface != PHY_INTERFACE_MODE_REVMII)return ; + reg_rgmii_ctrl =bcm_sf2_reg_rgmii_cntrl (priv, port); +/* If the link is down, just disable the interface to conserve power */ - reg =reg_readl (priv,REG_RGMII_CNTRL_P (port)); + reg =reg_readl (priv, reg_rgmii_ctrl);if (link) reg |=RGMII_MODE_EN ;else reg &= ~RGMII_MODE_EN ; -reg_writel (priv, reg,REG_RGMII_CNTRL_P (port)); +reg_writel (priv, reg, reg_rgmii_ctrl); } static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port,
@@ -735,11 +766,15 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, {struct bcm_sf2_priv *priv =bcm_sf2_to_priv (ds);struct ethtool_eee *p = &priv->dev->ports[port].eee; -u32 reg, offset;bcm_sf2_sw_mac_link_set (ds, port, interface, true);if (port !=core_readl (priv,CORE_IMP0_PRT_ID )) { +u32 reg_rgmii_ctrl; +u32 reg, offset; + + reg_rgmii_ctrl =bcm_sf2_reg_rgmii_cntrl (priv, port); +if (priv->type ==BCM4908_DEVICE_ID || priv->type ==BCM7445_DEVICE_ID ) offset =CORE_STS_OVERRIDE_GMIIP_PORT (port);
@@ -750,7 +785,7 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, interface == PHY_INTERFACE_MODE_RGMII_TXID || interface == PHY_INTERFACE_MODE_MII || interface == PHY_INTERFACE_MODE_REVMII) { - reg =reg_readl (priv,REG_RGMII_CNTRL_P (port)); + reg =reg_readl (priv, reg_rgmii_ctrl); reg &= ~(RX_PAUSE_EN |TX_PAUSE_EN );if (tx_pause)
@@ -758,7 +793,7 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port,if (rx_pause) reg |=RX_PAUSE_EN ; -reg_writel (priv, reg,REG_RGMII_CNTRL_P (port)); +reg_writel (priv, reg, reg_rgmii_ctrl); } reg =SW_OVERRIDE |LINK_STS ;
drivers/net/dsa/bcm_sf2_regs.h +0 -2
@@ -48,8 +48,6 @@ enum bcm_sf2_reg_offs {#define PHY_PHYAD_SHIFT 8#define PHY_PHYAD_MASK 0x1F -#define REG_RGMII_CNTRL_P (x) (REG_RGMII_0_CNTRL + (x)) -/* Relative to REG_RGMII_CNTRL */ #define RGMII_MODE_EN (1 << 0)#define ID_MODE_DIS (1 << 1)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 457/677 net: dsa: bcm_sf2: fix BCM4908 RGMII reg(s)
In reply to Greg Kroah-HartmanFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 6859d91549341c2ad769d482de58129f080c0f04 ]
BCM4908 has only 1 RGMII reg for controlling port 7.
--- drivers/net/dsa/bcm_sf2.c | 11 +++++++---- drivers/net/dsa/bcm_sf2_regs.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/dsa/bcm_sf2.c +7 -4
@@ -36,7 +36,12 @@ static u16 bcm_sf2_reg_rgmii_cntrl(struct bcm_sf2_priv *priv, int port) {switch (priv->type) {case BCM4908_DEVICE_ID : -/* TODO */ +switch (port) { +case 7 : +return REG_RGMII_11_CNTRL ; +default : +break ; + }break ;default :switch (port) {
@@ -1179,9 +1184,7 @@ static const u16 bcm_sf2_4908_reg_offsets[] = { [REG_PHY_REVISION] = 0x14, [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, - [REG_RGMII_0_CNTRL] = 0xe0, - [REG_RGMII_1_CNTRL] = 0xec, - [REG_RGMII_2_CNTRL] = 0xf8, + [REG_RGMII_11_CNTRL] = 0x014c, [REG_LED_0_CNTRL] = 0x40, [REG_LED_1_CNTRL] = 0x4c, [REG_LED_2_CNTRL] = 0x58,
drivers/net/dsa/bcm_sf2_regs.h +1 -0
@@ -21,6 +21,7 @@ enum bcm_sf2_reg_offs {REG_RGMII_0_CNTRL ,REG_RGMII_1_CNTRL ,REG_RGMII_2_CNTRL , +REG_RGMII_11_CNTRL ,REG_LED_0_CNTRL ,REG_LED_1_CNTRL , REG_LED_2_CNTRL,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 458/677 selftests/bpf: Re-generate vmlinux.h and BPF skeletons if bpftool changed
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit cab62c37be057379a2a17b1b2eacd9dcba1e14dc ]
Trigger vmlinux.h and BPF skeletons re-generation if detected that bpftool was re-compiled. Otherwise full make clean is required to get updated skeletons, if bpftool is modified.
--- tools/testing/selftests/bpf/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +3 -2
@@ -221,7 +221,7 @@ $(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \ DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers endif -$(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) | $(BPFTOOL) $(INCLUDE_DIR) +$(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR) ifeq ($(VMLINUX_H),) $(call msg,GEN,,$@) $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
@@ -346,7 +346,8 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.o: \ $(TRUNNER_BPF_SKELS): $(TRUNNER_OUTPUT)/%.skel.h: \ $(TRUNNER_OUTPUT)/%.o \ - | $(BPFTOOL) $(TRUNNER_OUTPUT) + $(BPFTOOL) \ + | $(TRUNNER_OUTPUT) $$(call msg,GEN-SKEL,$(TRUNNER_BINARY),$$@) $(Q)$$(BPFTOOL) gen skeleton $$< > $$@ endif
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 459/677 libbpf: Add explicit padding to btf_dump_emit_type_decl_opts
In reply to Greg Kroah-HartmanFrom: KP Singh <[email protected]>
[ Upstream commit ea24b19562fe5f72c78319dbb347b701818956d9 ]
Similar to
https://lore.kernel.org/bpf/[email protected]/
When DECLARE_LIBBPF_OPTS is used with inline field initialization, e.g:
DECLARE_LIBBPF_OPTS(btf_dump_emit_type_decl_opts, opts,
.field_name = var_ident,
.indent_level = 2,
.strip_mods = strip_mods,
);
and compiled in debug mode, the compiler generates code which leaves the padding uninitialized and triggers errors within libbpf APIs which require strict zero initialization of OPTS structs.
Adding anonymous padding field fixes the issue.
--- tools/lib/bpf/btf.h | 1 + 1 file changed, 1 insertion(+)
tools/lib/bpf/btf.h +1 -0
@@ -173,6 +173,7 @@ struct btf_dump_emit_type_decl_opts {int indent_level;/* strip all the const/volatile/restrict mods */ bool strip_mods; + size_t :0; };#define btf_dump_emit_type_decl_opts__last_field strip_mods
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 460/677 powerpc/mm: Move the linear_mapping_mutex to the ifdef where it is used
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 9be77e11dade414d2fa63750aa5c754fac49d619 ]
The mutex linear_mapping_mutex is defined at the of the file while its only two user are within the CONFIG_MEMORY_HOTPLUG block.
A compile without CONFIG_MEMORY_HOTPLUG set fails on PREEMPT_RT because its mutex implementation is smart enough to realize that it is unused.
Move the definition of linear_mapping_mutex to ifdef block where it is used.
--- arch/powerpc/mm/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/mem.c +1 -1
@@ -54,7 +54,6 @@#include <mm/mmu_decl.h> -static DEFINE_MUTEX (linear_mapping_mutex);unsigned long long memory_limit;bool init_mem_is_free;
@@ -72,6 +71,7 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,EXPORT_SYMBOL (phys_mem_access_prot);#ifdef CONFIG_MEMORY_HOTPLUG +static DEFINE_MUTEX (linear_mapping_mutex);#ifdef CONFIG_NUMA int memory_add_physaddr_to_nid (u64 start)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 461/677 powerpc/fadump: Mark fadump_calculate_reserve_size as __init
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit fbced1546eaaab57a32e56c974ea8acf10c6abd8 ]
If fadump_calculate_reserve_size() is not inlined, there is a modpost warning:
WARNING: modpost: vmlinux.o(.text+0x5196c): Section mismatch in reference from the function fadump_calculate_reserve_size() to the function .init.text:parse_crashkernel()
The function fadump_calculate_reserve_size() references the function __init parse_crashkernel().
This is often because fadump_calculate_reserve_size lacks a __init annotation or the annotation of parse_crashkernel is wrong.
fadump_calculate_reserve_size() calls parse_crashkernel(), which is marked as __init and fadump_calculate_reserve_size() is called from within fadump_reserve_mem(), which is also marked as __init.
Mark fadump_calculate_reserve_size() as __init to fix the section mismatch. Additionally, remove the inline keyword as it is not necessary to inline this function; the compiler is still free to do so if it feels it is worthwhile since commit 889b3c1245de ("compiler: remove CONFIG_OPTIMIZE_INLINING entirely").
--- arch/powerpc/kernel/fadump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/fadump.c +1 -1
@@ -292,7 +292,7 @@ static void fadump_show_config(void)* that is required for a kernel to boot successfully. * */ -static inline u64 fadump_calculate_reserve_size (void ) +static __init u64 fadump_calculate_reserve_size (void ) {u64 base, size, bootmem_min;int ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 462/677 powerpc/prom: Mark identical_pvr_fixup as __init
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 1ef1dd9c7ed27b080445e1576e8a05957e0e4dfc ]
If identical_pvr_fixup() is not inlined, there are two modpost warnings:
WARNING: modpost: vmlinux.o(.text+0x54e8): Section mismatch in reference from the function identical_pvr_fixup() to the function .init.text:of_get_flat_dt_prop()
The function identical_pvr_fixup() references
the function __init of_get_flat_dt_prop().
This is often because identical_pvr_fixup lacks a __init annotation or the annotation of of_get_flat_dt_prop is wrong.
WARNING: modpost: vmlinux.o(.text+0x551c): Section mismatch in reference from the function identical_pvr_fixup() to the function .init.text:identify_cpu()
The function identical_pvr_fixup() references
the function __init identify_cpu().
This is often because identical_pvr_fixup lacks a __init annotation or the annotation of identify_cpu is wrong.
identical_pvr_fixup() calls two functions marked as __init and is only called by a function marked as __init so it should be marked as __init as well. At the same time, remove the inline keywork as it is not necessary to inline this function. The compiler is still free to do so if it feels it is worthwhile since commit 889b3c1245de ("compiler:
remove CONFIG_OPTIMIZE_INLINING entirely").
--- arch/powerpc/kernel/prom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom.c +1 -1
@@ -267,7 +267,7 @@ static struct feature_property { };#if defined(CONFIG_44x) && defined(CONFIG_PPC_FPU ) -static inline void identical_pvr_fixup (unsigned long node) +static __init void identical_pvr_fixup (unsigned long node) {unsigned int pvr;const char *model =of_get_flat_dt_prop (node,"model" ,NULL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 463/677 MIPS: fix local_irq_{disable,enable} in asmmacro.h
In reply to Greg Kroah-HartmanFrom: Huang Pei <[email protected]>
[ Upstream commit 05c4e2721d7af0df7bc1378a23712a0fd16947b5 ]
commit ba9196d2e005 ("MIPS: Make DIEI support as a config option") use CPU_HAS_DIEI to indicate whether di/ei is implemented correctly, without this patch, "local_irq_disable" from entry.S in 3A1000 (with buggy di/ei) lose protection of commit e97c5b609880 ("MIPS:
Make irqflags.h functions preempt-safe for non-mipsr2 cpus")
--- arch/mips/include/asm/asmmacro.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/mips/include/asm/asmmacro.h +1 -2
@@ -44,8 +44,7 @@ .endm#endif -#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR5 ) || \ - defined(CONFIG_CPU_MIPSR6 ) +#ifdef CONFIG_CPU_HAS_DIEI .macro local_irq_enable reg=t0ei irq_enable_hazard
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 464/677 ima: Fix the error code for restoring the PCR value
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 7990ccafaa37dc6d8bb095d4d7cd997e8903fd10 ]
In ima_restore_measurement_list(), hdr[HDR_PCR].data is pointing to a buffer of type u8, which contains the dumped 32-bit pcr value. Currently, only the least significant byte is used to restore the pcr value. We should convert hdr[HDR_PCR].data to a pointer of type u32 before fetching the value to restore the correct pcr value.
--- security/integrity/ima/ima_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/integrity/ima/ima_template.c +2 -2
@@ -494,8 +494,8 @@ int ima_restore_measurement_list(loff_t size, void *buf) } } - entry->pcr = !ima_canonical_fmt ? *(hdr[HDR_PCR ].data) : -le32_to_cpu (*(hdr[HDR_PCR ].data)); + entry->pcr = !ima_canonical_fmt ? *(u32 *)(hdr[HDR_PCR ].data) : +le32_to_cpu (*(u32 *)(hdr[HDR_PCR ].data)); ret =ima_restore_measurement_entry (entry);if (ret <0 )break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 465/677 inet: use bigger hash table for IP ID generation
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit aa6dd211e4b1dde9d5dc25d699d35f789ae7eeba ]
In commit 73f156a6e8c1 ("inetpeer: get rid of ip_id_count") I used a very small hash table that could be abused by patient attackers to reveal sensitive information.
Switch to a dynamic sizing, depending on RAM size.
Typical big hosts will now use 128x more storage (2 MB) to get a similar increase in security and reduction of hash collisions.
As a bonus, use of alloc_large_system_hash() spreads allocated memory among all NUMA nodes.
--- net/ipv4/route.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
net/ipv4/route.c +28 -14
@@ -66,6 +66,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/memblock.h> #include <linux/string.h> #include <linux/socket.h> #include <linux/sockios.h>
@@ -478,8 +479,10 @@ static void ipv4_confirm_neigh(const struct dst_entry *dst, const void *daddr)__ipv4_confirm_neigh (dev, *(__force u32 *)pkey); } -#define IP_IDENTS_SZ 2048u - +/* Hash tables of size 2048..262144 depending on RAM size. +* Each bucket uses 8 bytes. +*/ +static u32 ip_idents_mask__read_mostly ;static atomic_t *ip_idents__read_mostly ;static u32 *ip_tstamps__read_mostly ;
@@ -489,12 +492,16 @@ static u32 *ip_tstamps __read_mostly;*/ u32 ip_idents_reserve (u32 hash,int segs) { -u32 *p_tstamp = ip_tstamps + hash %IP_IDENTS_SZ ; -atomic_t *p_id = ip_idents + hash %IP_IDENTS_SZ ; -u32 old =READ_ONCE (*p_tstamp); -u32 now = (u32 )jiffies; +u32 bucket, old, now = (u32 )jiffies; +atomic_t *p_id; +u32 *p_tstamp;u32 delta =0 ; + bucket = hash & ip_idents_mask; + p_tstamp = ip_tstamps + bucket; + p_id = ip_idents + bucket; + old =READ_ONCE (*p_tstamp); +if (old != now &&cmpxchg (p_tstamp, old, now) == old) delta =prandom_u32_max (now - old);
@@ -3553,18 +3560,25 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;int __init ip_rt_init (void ) { +void *idents_hash;int cpu; - ip_idents =kmalloc_array (IP_IDENTS_SZ ,sizeof (*ip_idents), -GFP_KERNEL ); -if (!ip_idents) -panic ("IP: failed to allocate ip_idents\n" ); +/* For modern hosts, this will use 2 MB of memory */ + idents_hash =alloc_large_system_hash ("IP idents" , +sizeof (*ip_idents) +sizeof (*ip_tstamps), +0 , +16 ,/* one bucket per 64 KB */ +HASH_ZERO , +NULL , + &ip_idents_mask, +2048 , +256 *1024 ); + + ip_idents = idents_hash; -prandom_bytes (ip_idents,IP_IDENTS_SZ *sizeof (*ip_idents)); +prandom_bytes (ip_idents, (ip_idents_mask +1 ) *sizeof (*ip_idents)); - ip_tstamps =kcalloc (IP_IDENTS_SZ ,sizeof (*ip_tstamps),GFP_KERNEL ); -if (!ip_tstamps) -panic ("IP: failed to allocate ip_tstamps\n" ); + ip_tstamps = idents_hash + (ip_idents_mask +1 ) *sizeof (*ip_idents);for_each_possible_cpu (cpu) {struct uncached_list *ul = &per_cpu (rt_uncached_list, cpu);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 466/677 pinctrl: pinctrl-single: remove unused parameter
In reply to Greg Kroah-HartmanFrom: Hanna Hawa <[email protected]>
[ Upstream commit 8fa2ea202b13b6da81e26c399ff1d87488398453 ]
Remove unused parameter 'pin_pos' from pcs_add_pin().
--- drivers/pinctrl/pinctrl-single.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-single.c +2 -6
@@ -656,10 +656,8 @@ static const struct pinconf_ops pcs_pinconf_ops = {* pcs_add_pin() - add a pin to the static per controller pin array * @pcs: pcs driver instance * @offset: register offset from base -* @pin_pos: unused */ -static int pcs_add_pin (struct pcs_device *pcs,unsigned offset, -unsigned pin_pos) +static int pcs_add_pin (struct pcs_device *pcs,unsigned int offset) {struct pcs_soc_data *pcs_soc = &pcs->socdata;struct pinctrl_pin_desc *pin;
@@ -729,16 +727,14 @@ static int pcs_allocate_pin_table(struct pcs_device *pcs)unsigned offset;int res;int byte_num; -int pin_pos =0 ;if (pcs->bits_per_mux) { byte_num = (pcs->bits_per_pin * i) /BITS_PER_BYTE ; offset = (byte_num / mux_bytes) * mux_bytes; - pin_pos = i % num_pins_in_register; }else { offset = i * mux_bytes; } - res =pcs_add_pin (pcs, offset, pin_pos); + res =pcs_add_pin (pcs, offset);if (res <0 ) {dev_err (pcs->dev,"error adding pins: %i\n" , res);return res;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 467/677 pinctrl: pinctrl-single: fix pcs_pin_dbg_show() when bits_per_mux is not zero
In reply to Greg Kroah-HartmanFrom: Hanna Hawa <[email protected]>
[ Upstream commit bd85125ea88513f637a62a72e8949c579c5c0a87 ]
A System Error (SError, followed by kernel panic) was detected when trying to print the supported pins in a pinctrl device which supports multiple pins per register. This change fixes the pcs_pin_dbg_show() in pinctrl-single driver when bits_per_mux is not zero. In addition move offset calculation and pin offset in register to common function.
--- drivers/pinctrl/pinctrl-single.c | 55 ++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-)
drivers/pinctrl/pinctrl-single.c +35 -20
@@ -270,20 +270,44 @@ static void __maybe_unused pcs_writel(unsigned val, void __iomem *reg)writel (val, reg); } +static unsigned int pcs_pin_reg_offset_get (struct pcs_device *pcs, +unsigned int pin) +{ +unsigned int mux_bytes = pcs->width /BITS_PER_BYTE ; + +if (pcs->bits_per_mux) { +unsigned int pin_offset_bytes; + + pin_offset_bytes = (pcs->bits_per_pin * pin) /BITS_PER_BYTE ; +return (pin_offset_bytes / mux_bytes) * mux_bytes; + } + +return pin * mux_bytes; +} + +static unsigned int pcs_pin_shift_reg_get (struct pcs_device *pcs, +unsigned int pin) +{ +return (pin % (pcs->width / pcs->bits_per_pin)) * pcs->bits_per_pin; +} +static void pcs_pin_dbg_show (struct pinctrl_dev *pctldev,struct seq_file *s,unsigned pin) {struct pcs_device *pcs; -unsigned val, mux_bytes; +unsigned int val;unsigned long offset;size_t pa; pcs =pinctrl_dev_get_drvdata (pctldev); - mux_bytes = pcs->width /BITS_PER_BYTE ; - offset = pin * mux_bytes; + offset =pcs_pin_reg_offset_get (pcs, pin); val = pcs->read (pcs->base + offset); + +if (pcs->bits_per_mux) + val &= pcs->fmask <<pcs_pin_shift_reg_get (pcs, pin); + pa = pcs->res->start + offset;seq_printf (s,"%zx %08x %s " , pa, val,DRIVER_NAME );
@@ -384,7 +408,6 @@ static int pcs_request_gpio(struct pinctrl_dev *pctldev,struct pcs_device *pcs =pinctrl_dev_get_drvdata (pctldev);struct pcs_gpiofunc_range *frange =NULL ;struct list_head *pos, *tmp; -int mux_bytes =0 ;unsigned data;/* If function mask is null, return directly. */
@@ -392,29 +415,27 @@ static int pcs_request_gpio(struct pinctrl_dev *pctldev,return -ENOTSUPP ;list_for_each_safe (pos, tmp, &pcs->gpiofuncs) { +u32 offset; + frange = list_entry(pos, struct pcs_gpiofunc_range, node);if (pin >= frange->offset + frange->npins || pin < frange->offset)continue ; - mux_bytes = pcs->width /BITS_PER_BYTE ; -if (pcs->bits_per_mux) { -int byte_num, offset, pin_shift; + offset =pcs_pin_reg_offset_get (pcs, pin); - byte_num = (pcs->bits_per_pin * pin) /BITS_PER_BYTE ; - offset = (byte_num / mux_bytes) * mux_bytes; - pin_shift = pin % (pcs->width / pcs->bits_per_pin) * - pcs->bits_per_pin; +if (pcs->bits_per_mux) { +int pin_shift =pcs_pin_shift_reg_get (pcs, pin); data = pcs->read (pcs->base + offset); data &= ~(pcs->fmask << pin_shift); data |= frange->gpiofunc << pin_shift; pcs->write (data, pcs->base + offset); }else { - data = pcs->read (pcs->base + pin * mux_bytes); + data = pcs->read (pcs->base + offset); data &= ~pcs->fmask; data |= frange->gpiofunc; - pcs->write (data, pcs->base + pin * mux_bytes); + pcs->write (data, pcs->base + offset); }break ; }
@@ -726,14 +747,8 @@ static int pcs_allocate_pin_table(struct pcs_device *pcs)for (i =0 ; i < pcs->desc.npins; i++) {unsigned offset;int res; -int byte_num; -if (pcs->bits_per_mux) { - byte_num = (pcs->bits_per_pin * i) /BITS_PER_BYTE ; - offset = (byte_num / mux_bytes) * mux_bytes; - }else { - offset = i * mux_bytes; - } + offset =pcs_pin_reg_offset_get (pcs, i); res =pcs_add_pin (pcs, offset);if (res <0 ) {dev_err (pcs->dev,"error adding pins: %i\n" , res);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 468/677 MIPS: loongson64: fix bug when PAGE_SIZE > 16KB
In reply to Greg Kroah-HartmanFrom: Huang Pei <[email protected]>
[ Upstream commit 509d36a941a3466b78d4377913623d210b162458 ]
When page size larger than 16KB, arguments "vaddr + size(16KB)" in "ioremap_page_range(vaddr, vaddr + size,...)" called by "add_legacy_isa_io" is not page-aligned.
As loongson64 needs at least page size 16KB to get rid of cache alias, and "vaddr" is 64KB-aligned, and 64KB is largest page size supported, rounding "size" up to PAGE_SIZE is enough for all page size supported.
--- arch/mips/loongson64/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/loongson64/init.c +1 -1
@@ -126,7 +126,7 @@ static int __init add_legacy_isa_io(struct fwnode_handle *fwnode, resource_size_return -ENOMEM ; range->fwnode = fwnode; - range->size = size; + range->size = size =round_up (size,PAGE_SIZE ); range->hw_start = hw_start; range->flags =LOGIC_PIO_CPU_MMIO ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 469/677 ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 99067c07e8d877035f6249d194a317c78b7d052d ]
The call sequence in wm8960_configure_clocking is
ret = wm8960_configure_sysclk();
if (ret >= 0)
goto configure_clock;....
ret = wm8960_configure_pll();
configure_clock:
...
wm8960_configure_sysclk is called before wm8960_configure_pll, as there is bitclk relax on both functions, so wm8960_configure_sysclk always return success, then wm8960_configure_pll() never be called.
With this case:
aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav the required bitclk is 48000 * 24 * 2 = 2304000, bitclk got from wm8960_configure_sysclk is 3072000, but if go to wm8960_configure_pll. it can get correct bitclk 2304000.
So bitclk relax condition should be removed in wm8960_configure_sysclk, then wm8960_configure_pll can be called, and there is also bitclk relax function in wm8960_configure_pll.
--- sound/soc/codecs/wm8960.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
sound/soc/codecs/wm8960.c +1 -11
@@ -608,10 +608,6 @@ static const int bclk_divs[] = {* - lrclk = sysclk / dac_divs * - 10 * bclk = sysclk / bclk_divs * -* If we cannot find an exact match for (sysclk, lrclk, bclk) -* triplet, we relax the bclk such that bclk is chosen as the -* closest available frequency greater than expected bclk. -* * @wm8960: codec private data * @mclk: MCLK used to derive sysclk * @sysclk_idx: sysclk_divs index for found sysclk
@@ -629,7 +625,7 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk, {int sysclk, bclk, lrclk;int i, j, k; -int diff, closest = mclk; +int diff;/* marker for no match */ *bclk_idx =-1 ;
@@ -653,12 +649,6 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk, *bclk_idx = k;break ; } -if (diff >0 && closest > diff) { - *sysclk_idx = i; - *dac_idx = j; - *bclk_idx = k; - closest = diff; - } }if (k !=ARRAY_SIZE (bclk_divs))break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 470/677 iommu/arm-smmu-v3: add bit field SFM into GERROR_ERR_MASK
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 655c447c97d7fe462e6cd9e15809037be028bc70 ]
In arm_smmu_gerror_handler(), the value of the SMMU_GERROR register is filtered by GERROR_ERR_MASK. However, the GERROR_ERR_MASK does not contain the SFM bit. As a result, the subsequent error processing is not performed when only the SFM error occurs.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +1 -1
@@ -115,7 +115,7 @@#define GERROR_PRIQ_ABT_ERR (1 << 3)#define GERROR_EVTQ_ABT_ERR (1 << 2)#define GERROR_CMDQ_ERR (1 << 0) -#define GERROR_ERR_MASK 0xfd +#define GERROR_ERR_MASK 0x1fd#define ARM_SMMU_GERRORN 0x64
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 471/677 RDMA/mlx5: Fix drop packet rule in egress table
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit c73700806d4e430d182c2be069d230076818a99a ]
Initial drop action support missed that drop action can be added to egress flow tables as well. Add the missing support.
This requires making sure that dest_type isn't set to PORT which in turn exposes a possibility of passing dst while indicating number of dsts as zero. Explicitly check for number of dsts and pass the appropriate pointer.
--- drivers/infiniband/hw/mlx5/fs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/fs.c +5 -4
@@ -1528,8 +1528,8 @@ static struct mlx5_ib_flow_handler *raw_fs_rule_add( dst_num++; } - handler =_create_raw_flow_rule (dev, ft_prio, dst, fs_matcher, - flow_context, flow_act, + handler =_create_raw_flow_rule (dev, ft_prio, dst_num ? dst :NULL , + fs_matcher, flow_context, flow_act, cmd_in, inlen, dst_num);if (IS_ERR (handler)) {
@@ -1885,8 +1885,9 @@ static int get_dests(struct uverbs_attr_bundle *attrs,else *dest_id = mqp->raw_packet_qp.rq.tirn; *dest_type =MLX5_FLOW_DESTINATION_TYPE_TIR ; - }else if (fs_matcher->ns_type ==MLX5_FLOW_NAMESPACE_EGRESS || - fs_matcher->ns_type ==MLX5_FLOW_NAMESPACE_RDMA_TX ) { + }else if ((fs_matcher->ns_type ==MLX5_FLOW_NAMESPACE_EGRESS || + fs_matcher->ns_type ==MLX5_FLOW_NAMESPACE_RDMA_TX ) && + !(*flags &MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP )) { *dest_type =MLX5_FLOW_DESTINATION_TYPE_PORT ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 472/677 IB/isert: Fix a use after free in isert_connect_request
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit adb76a520d068a54ee5ca82e756cf8e5a47363a4 ]
The device is got by isert_device_get() with refcount is 1, and is assigned to isert_conn by
isert_conn->device = device.
When isert_create_qp() failed, device will be freed with isert_device_put().
Later, the device is used in isert_free_login_buf(isert_conn) by the isert_conn->device->ib_device statement.
Free the device in the correct order.
--- drivers/infiniband/ulp/isert/ib_isert.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +8 -8
@@ -438,23 +438,23 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)isert_init_conn (isert_conn); isert_conn->cm_id = cma_id; - ret =isert_alloc_login_buf (isert_conn, cma_id->device); -if (ret) - goto out; - device =isert_device_get (cma_id);if (IS_ERR (device)) { ret =PTR_ERR (device); - goto out_rsp_dma_map; + goto out; } isert_conn->device = device; + ret =isert_alloc_login_buf (isert_conn, cma_id->device); +if (ret) + goto out_conn_dev; +isert_set_nego_params (isert_conn, &event->param.conn); isert_conn->qp =isert_create_qp (isert_conn, cma_id);if (IS_ERR (isert_conn->qp)) { ret =PTR_ERR (isert_conn->qp); - goto out_conn_dev; + goto out_rsp_dma_map; } ret =isert_login_post_recv (isert_conn);
@@ -473,10 +473,10 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) out_destroy_qp:isert_destroy_qp (isert_conn); -out_conn_dev: -isert_device_put (device); out_rsp_dma_map:isert_free_login_buf (isert_conn); +out_conn_dev: +isert_device_put (device); out:kfree (isert_conn);rdma_reject (cma_id,NULL ,0 ,IB_CM_REJ_CONSUMER_DEFINED );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 473/677 powerpc/64s: Fix hash fault to use TRAP accessor
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 1479e3d3b7559133b0a107772b5841e9c2cad450 ]
Hash faults use the trap vector to decide whether this is an instruction or data fault. This should use the TRAP accessor rather than open access regs->trap.
This won't cause a problem at the moment because 64s only uses trap flags for system call interrupts (the norestart flag), but that could change if any other trap flags get used in future.
--- arch/powerpc/mm/book3s64/hash_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/book3s64/hash_utils.c +2 -2
@@ -1545,10 +1545,10 @@ DEFINE_INTERRUPT_HANDLER_RET(__do_hash_fault)if (user_mode (regs) || (region_id ==USER_REGION_ID )) access &= ~_PAGE_PRIVILEGED; -if (regs->trap ==0x400 ) +if (TRAP (regs) ==0x400 ) access |= _PAGE_EXEC; - err =hash_page_mm (mm, ea, access, regs->trap, flags); + err =hash_page_mm (mm, ea, access,TRAP (regs), flags);if (unlikely (err <0 )) {// failed to instert a hash PTE due to an hypervisor error if (user_mode (regs)) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 474/677 powerpc: Fix HAVE_HARDLOCKUP_DETECTOR_ARCH build configuration
In reply to Greg Kroah-HartmanFrom: Chen Huang <[email protected]>
[ Upstream commit 4fe529449d85e78972fa327999961ecc83a0b6db ]
When compiling the powerpc with the SMP disabled, it shows the issue:
arch/powerpc/kernel/watchdog.c: In function ‘watchdog_smp_panic’:arch/powerpc/kernel/watchdog.c:177:4: error: implicit declaration of function ‘smp_send_nmi_ipi’; did you mean ‘smp_send_stop’? [-Werror=implicit-function-declaration]
177 | smp_send_nmi_ipi(c, wd_lockup_ipi, 1000000);
| ^~~~~~~~~~~~~~~~
| smp_send_stopcc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:273: arch/powerpc/kernel/watchdog.o] Error 1 make[1]: *** [scripts/Makefile.build:534: arch/powerpc/kernel] Error 2
make: *** [Makefile:1980: arch/powerpc] Error 2
make: *** Waiting for unfinished jobs....
We found that powerpc used ipi to implement hardlockup watchdog, so the HAVE_HARDLOCKUP_DETECTOR_ARCH should depend on the SMP.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -224,7 +224,7 @@ config PPC select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S) - select HAVE_HARDLOCKUP_DETECTOR_ARCH if (PPC64 && PPC_BOOK3S) + select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC64 && PPC_BOOK3S && SMP select HAVE_OPTPROBES if PPC64 select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS_NMI if PPC64
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 475/677 MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 66633abd0642f1e89d26e15f36fb13d3a1c535ff ]
After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work"), bpf_probe_read{, str}() functions were no longer available on MIPS, so there exist some errors when running bpf program:
root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py bpf: Failed to load program: Invalid argument [...] 11: (85) call bpf_probe_read#4 unknown func bpf_probe_read#4 [...] Exception: Failed to load BPF program count_sched: Invalid argument
ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE should be restricted to archs with non-overlapping address ranges, but they can overlap in EVA mode on MIPS, so select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA in arch/mips/Kconfig, otherwise the bpf old helper bpf_probe_read() will not be available.
This is similar with the commit d195b1d1d119 ("powerpc/bpf: Enable bpf_probe_read{, str}() on powerpc again").
--- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/Kconfig +1 -0
@@ -6,6 +6,7 @@ config MIPS select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_KCOV + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 476/677 gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP
In reply to Greg Kroah-HartmanFrom: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 9c7d24693d864f90b27aad5d15fbfe226c02898b ]
The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP isn't enabled.
--- include/linux/gpio/driver.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/gpio/driver.h +9 -0
@@ -624,8 +624,17 @@ void gpiochip_irq_domain_deactivate(struct irq_domain *domain,bool gpiochip_irqchip_irq_valid (const struct gpio_chip *gc,unsigned int offset); +#ifdef CONFIG_GPIOLIB_IRQCHIP int gpiochip_irqchip_add_domain (struct gpio_chip *gc,struct irq_domain *domain); +#else +static inline int gpiochip_irqchip_add_domain (struct gpio_chip *gc, +struct irq_domain *domain) +{ +WARN_ON (1 ); +return -EINVAL ; +} +#endif int gpiochip_generic_request (struct gpio_chip *gc,unsigned int offset);void gpiochip_generic_free (struct gpio_chip *gc,unsigned int offset);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 477/677 fs: dlm: fix missing unlock on error in accept_from_sock()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2fd8db2dd05d895961c7c7b9fa02d72f385560e4 ]
Add the missing unlock before return from accept_from_sock() in the error handling case.
--- fs/dlm/lowcomms.c | 1 + 1 file changed, 1 insertion(+)
fs/dlm/lowcomms.c +1 -0
@@ -908,6 +908,7 @@ static int accept_from_sock(struct listen_connection *con) result =dlm_con_init (othercon, nodeid);if (result <0 ) {kfree (othercon); +mutex_unlock (&newcon->sock_mutex); goto accept_err; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 478/677 ASoC: q6afe-clocks: fix reprobing of the driver
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 96fadf7e8ff49fdb74754801228942b67c3eeebd ]
Q6afe-clocks driver can get reprobed. For example if the APR services are restarted after the firmware crash. However currently Q6afe-clocks driver will oops because hw.init will get cleared during first _probe call. Rewrite the driver to fill the clock data at runtime rather than using big static array of clocks.
--- sound/soc/qcom/qdsp6/q6afe-clocks.c | 209 ++++++++++++++-------------- sound/soc/qcom/qdsp6/q6afe.c | 2 +- sound/soc/qcom/qdsp6/q6afe.h | 2 +- 3 files changed, 108 insertions(+), 105 deletions(-)
sound/soc/qcom/qdsp6/q6afe-clocks.c +106 -103
@@ -11,33 +11,29 @@#include <linux/slab.h> #include "q6afe.h" -#define Q6AFE_CLK (id) &(struct q6afe_clk) { \ +#define Q6AFE_CLK (id) { \ .clk_id = id, \ .afe_clk_id = Q6AFE_##id, \ .name = #id, \ - .attributes = LPASS_CLK_ATTRIBUTE_COUPLE_NO, \ .rate = 19200000, \ - .hw.init = &(struct clk_init_data) { \ - .ops = &clk_q6afe_ops, \ - .name = #id, \ - }, \ } -#define Q6AFE_VOTE_CLK (id, blkid, n) &(struct q6afe_clk) { \ +#define Q6AFE_VOTE_CLK (id, blkid, n) { \ .clk_id = id, \ .afe_clk_id = blkid, \ - .name = #n, \ - .hw.init = &(struct clk_init_data) { \ - .ops = &clk_vote_q6afe_ops, \ - .name = #id, \ - }, \ + .name = n, \ } -struct q6afe_clk { -struct device *dev; +struct q6afe_clk_init {int clk_id;int afe_clk_id;char *name; +int rate; +}; + +struct q6afe_clk { +struct device *dev; +int afe_clk_id;int attributes;int rate;uint32_t handle;
@@ -48,8 +44,7 @@ struct q6afe_clk {struct q6afe_cc {struct device *dev; -struct q6afe_clk **clks; -int num_clks; +struct q6afe_clk *clks[Q6AFE_MAX_CLK_ID ]; };static int clk_q6afe_prepare (struct clk_hw *hw)
@@ -105,7 +100,7 @@ static int clk_vote_q6afe_block(struct clk_hw *hw)struct q6afe_clk *clk =to_q6afe_clk (hw);return q6afe_vote_lpass_core_hw (clk->dev, clk->afe_clk_id, - clk->name, &clk->handle); +clk_hw_get_name (&clk->hw), &clk->handle); }static void clk_unvote_q6afe_block (struct clk_hw *hw)
@@ -120,84 +115,76 @@ static const struct clk_ops clk_vote_q6afe_ops = { .unprepare = clk_unvote_q6afe_block, }; -static struct q6afe_clk *q6afe_clks[Q6AFE_MAX_CLK_ID ] = { - [LPASS_CLK_ID_PRI_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_PRI_MI2S_IBIT ), - [LPASS_CLK_ID_PRI_MI2S_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_PRI_MI2S_EBIT ), - [LPASS_CLK_ID_SEC_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEC_MI2S_IBIT ), - [LPASS_CLK_ID_SEC_MI2S_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEC_MI2S_EBIT ), - [LPASS_CLK_ID_TER_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_TER_MI2S_IBIT ), - [LPASS_CLK_ID_TER_MI2S_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_TER_MI2S_EBIT ), - [LPASS_CLK_ID_QUAD_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUAD_MI2S_IBIT ), - [LPASS_CLK_ID_QUAD_MI2S_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUAD_MI2S_EBIT ), - [LPASS_CLK_ID_SPEAKER_I2S_IBIT ] = -Q6AFE_CLK (LPASS_CLK_ID_SPEAKER_I2S_IBIT ), - [LPASS_CLK_ID_SPEAKER_I2S_EBIT ] = -Q6AFE_CLK (LPASS_CLK_ID_SPEAKER_I2S_EBIT ), - [LPASS_CLK_ID_SPEAKER_I2S_OSR ] = -Q6AFE_CLK (LPASS_CLK_ID_SPEAKER_I2S_OSR ), - [LPASS_CLK_ID_QUI_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUI_MI2S_IBIT ), - [LPASS_CLK_ID_QUI_MI2S_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUI_MI2S_EBIT ), - [LPASS_CLK_ID_SEN_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEN_MI2S_IBIT ), - [LPASS_CLK_ID_SEN_MI2S_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEN_MI2S_EBIT ), - [LPASS_CLK_ID_INT0_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT0_MI2S_IBIT ), - [LPASS_CLK_ID_INT1_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT1_MI2S_IBIT ), - [LPASS_CLK_ID_INT2_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT2_MI2S_IBIT ), - [LPASS_CLK_ID_INT3_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT3_MI2S_IBIT ), - [LPASS_CLK_ID_INT4_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT4_MI2S_IBIT ), - [LPASS_CLK_ID_INT5_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT5_MI2S_IBIT ), - [LPASS_CLK_ID_INT6_MI2S_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_INT6_MI2S_IBIT ), - [LPASS_CLK_ID_QUI_MI2S_OSR ] =Q6AFE_CLK (LPASS_CLK_ID_QUI_MI2S_OSR ), - [LPASS_CLK_ID_PRI_PCM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_PRI_PCM_IBIT ), - [LPASS_CLK_ID_PRI_PCM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_PRI_PCM_EBIT ), - [LPASS_CLK_ID_SEC_PCM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEC_PCM_IBIT ), - [LPASS_CLK_ID_SEC_PCM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEC_PCM_EBIT ), - [LPASS_CLK_ID_TER_PCM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_TER_PCM_IBIT ), - [LPASS_CLK_ID_TER_PCM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_TER_PCM_EBIT ), - [LPASS_CLK_ID_QUAD_PCM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUAD_PCM_IBIT ), - [LPASS_CLK_ID_QUAD_PCM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUAD_PCM_EBIT ), - [LPASS_CLK_ID_QUIN_PCM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUIN_PCM_IBIT ), - [LPASS_CLK_ID_QUIN_PCM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUIN_PCM_EBIT ), - [LPASS_CLK_ID_QUI_PCM_OSR ] =Q6AFE_CLK (LPASS_CLK_ID_QUI_PCM_OSR ), - [LPASS_CLK_ID_PRI_TDM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_PRI_TDM_IBIT ), - [LPASS_CLK_ID_PRI_TDM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_PRI_TDM_EBIT ), - [LPASS_CLK_ID_SEC_TDM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEC_TDM_IBIT ), - [LPASS_CLK_ID_SEC_TDM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_SEC_TDM_EBIT ), - [LPASS_CLK_ID_TER_TDM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_TER_TDM_IBIT ), - [LPASS_CLK_ID_TER_TDM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_TER_TDM_EBIT ), - [LPASS_CLK_ID_QUAD_TDM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUAD_TDM_IBIT ), - [LPASS_CLK_ID_QUAD_TDM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUAD_TDM_EBIT ), - [LPASS_CLK_ID_QUIN_TDM_IBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUIN_TDM_IBIT ), - [LPASS_CLK_ID_QUIN_TDM_EBIT ] =Q6AFE_CLK (LPASS_CLK_ID_QUIN_TDM_EBIT ), - [LPASS_CLK_ID_QUIN_TDM_OSR ] =Q6AFE_CLK (LPASS_CLK_ID_QUIN_TDM_OSR ), - [LPASS_CLK_ID_MCLK_1 ] =Q6AFE_CLK (LPASS_CLK_ID_MCLK_1 ), - [LPASS_CLK_ID_MCLK_2 ] =Q6AFE_CLK (LPASS_CLK_ID_MCLK_2 ), - [LPASS_CLK_ID_MCLK_3 ] =Q6AFE_CLK (LPASS_CLK_ID_MCLK_3 ), - [LPASS_CLK_ID_MCLK_4 ] =Q6AFE_CLK (LPASS_CLK_ID_MCLK_4 ), - [LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE ] = -Q6AFE_CLK (LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE ), - [LPASS_CLK_ID_INT_MCLK_0 ] =Q6AFE_CLK (LPASS_CLK_ID_INT_MCLK_0 ), - [LPASS_CLK_ID_INT_MCLK_1 ] =Q6AFE_CLK (LPASS_CLK_ID_INT_MCLK_1 ), - [LPASS_CLK_ID_WSA_CORE_MCLK ] =Q6AFE_CLK (LPASS_CLK_ID_WSA_CORE_MCLK ), - [LPASS_CLK_ID_WSA_CORE_NPL_MCLK ] = -Q6AFE_CLK (LPASS_CLK_ID_WSA_CORE_NPL_MCLK ), - [LPASS_CLK_ID_VA_CORE_MCLK ] =Q6AFE_CLK (LPASS_CLK_ID_VA_CORE_MCLK ), - [LPASS_CLK_ID_TX_CORE_MCLK ] =Q6AFE_CLK (LPASS_CLK_ID_TX_CORE_MCLK ), - [LPASS_CLK_ID_TX_CORE_NPL_MCLK ] = -Q6AFE_CLK (LPASS_CLK_ID_TX_CORE_NPL_MCLK ), - [LPASS_CLK_ID_RX_CORE_MCLK ] =Q6AFE_CLK (LPASS_CLK_ID_RX_CORE_MCLK ), - [LPASS_CLK_ID_RX_CORE_NPL_MCLK ] = -Q6AFE_CLK (LPASS_CLK_ID_RX_CORE_NPL_MCLK ), - [LPASS_CLK_ID_VA_CORE_2X_MCLK ] = -Q6AFE_CLK (LPASS_CLK_ID_VA_CORE_2X_MCLK ), - [LPASS_HW_AVTIMER_VOTE ] =Q6AFE_VOTE_CLK (LPASS_HW_AVTIMER_VOTE , -Q6AFE_LPASS_CORE_AVTIMER_BLOCK , -"LPASS_AVTIMER_MACRO" ), - [LPASS_HW_MACRO_VOTE ] =Q6AFE_VOTE_CLK (LPASS_HW_MACRO_VOTE , -Q6AFE_LPASS_CORE_HW_MACRO_BLOCK , -"LPASS_HW_MACRO" ), - [LPASS_HW_DCODEC_VOTE ] =Q6AFE_VOTE_CLK (LPASS_HW_DCODEC_VOTE , -Q6AFE_LPASS_CORE_HW_DCODEC_BLOCK , -"LPASS_HW_DCODEC" ), +static const struct q6afe_clk_init q6afe_clks[] = { +Q6AFE_CLK (LPASS_CLK_ID_PRI_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_PRI_MI2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEC_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEC_MI2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_TER_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_TER_MI2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUAD_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUAD_MI2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SPEAKER_I2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SPEAKER_I2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SPEAKER_I2S_OSR ), +Q6AFE_CLK (LPASS_CLK_ID_QUI_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUI_MI2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEN_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEN_MI2S_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT0_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT1_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT2_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT3_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT4_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT5_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_INT6_MI2S_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUI_MI2S_OSR ), +Q6AFE_CLK (LPASS_CLK_ID_PRI_PCM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_PRI_PCM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEC_PCM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEC_PCM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_TER_PCM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_TER_PCM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUAD_PCM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUAD_PCM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUIN_PCM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUIN_PCM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUI_PCM_OSR ), +Q6AFE_CLK (LPASS_CLK_ID_PRI_TDM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_PRI_TDM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEC_TDM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_SEC_TDM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_TER_TDM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_TER_TDM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUAD_TDM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUAD_TDM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUIN_TDM_IBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUIN_TDM_EBIT ), +Q6AFE_CLK (LPASS_CLK_ID_QUIN_TDM_OSR ), +Q6AFE_CLK (LPASS_CLK_ID_MCLK_1 ), +Q6AFE_CLK (LPASS_CLK_ID_MCLK_2 ), +Q6AFE_CLK (LPASS_CLK_ID_MCLK_3 ), +Q6AFE_CLK (LPASS_CLK_ID_MCLK_4 ), +Q6AFE_CLK (LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE ), +Q6AFE_CLK (LPASS_CLK_ID_INT_MCLK_0 ), +Q6AFE_CLK (LPASS_CLK_ID_INT_MCLK_1 ), +Q6AFE_CLK (LPASS_CLK_ID_WSA_CORE_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_WSA_CORE_NPL_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_VA_CORE_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_TX_CORE_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_TX_CORE_NPL_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_RX_CORE_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_RX_CORE_NPL_MCLK ), +Q6AFE_CLK (LPASS_CLK_ID_VA_CORE_2X_MCLK ), +Q6AFE_VOTE_CLK (LPASS_HW_AVTIMER_VOTE , +Q6AFE_LPASS_CORE_AVTIMER_BLOCK , +"LPASS_AVTIMER_MACRO" ), +Q6AFE_VOTE_CLK (LPASS_HW_MACRO_VOTE , +Q6AFE_LPASS_CORE_HW_MACRO_BLOCK , +"LPASS_HW_MACRO" ), +Q6AFE_VOTE_CLK (LPASS_HW_DCODEC_VOTE , +Q6AFE_LPASS_CORE_HW_DCODEC_BLOCK , +"LPASS_HW_DCODEC" ), }; static struct clk_hw *q6afe_of_clk_hw_get(struct of_phandle_args *clkspec,
@@ -207,7 +194,7 @@ static struct clk_hw *q6afe_of_clk_hw_get(struct of_phandle_args *clkspec,unsigned int idx = clkspec->args[0 ];unsigned int attr = clkspec->args[1 ]; -if (idx >= cc->num_clks || attr >LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR ) { +if (idx >=Q6AFE_MAX_CLK_ID || attr >LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR ) {dev_err (cc->dev,"Invalid clk specifier (%d, %d)\n" , idx, attr);return ERR_PTR (-EINVAL ); }
@@ -230,20 +217,36 @@ static int q6afe_clock_dev_probe(struct platform_device *pdev)if (!cc)return -ENOMEM ; - cc->clks = &q6afe_clks[0 ]; - cc->num_clks =ARRAY_SIZE (q6afe_clks); + cc->dev = dev;for (i =0 ; i <ARRAY_SIZE (q6afe_clks); i++) { -if (!q6afe_clks[i]) -continue ; +unsigned int id = q6afe_clks[i].clk_id; +struct clk_init_data init = { + .name = q6afe_clks[i].name, + }; +struct q6afe_clk *clk; + + clk =devm_kzalloc (dev,sizeof (*clk),GFP_KERNEL ); +if (!clk) +return -ENOMEM ; + + clk->dev = dev; + clk->afe_clk_id = q6afe_clks[i].afe_clk_id; + clk->rate = q6afe_clks[i].rate; + clk->hw.init = &init; + +if (clk->rate) + init.ops = &clk_q6afe_ops; +else + init.ops = &clk_vote_q6afe_ops; - q6afe_clks[i]->dev = dev; + cc->clks[id] = clk; - ret =devm_clk_hw_register (dev, &q6afe_clks[i]->hw); + ret =devm_clk_hw_register (dev, &clk->hw);if (ret)return ret; } - ret =of_clk_add_hw_provider (dev->of_node, q6afe_of_clk_hw_get, cc); + ret =devm_of_clk_add_hw_provider (dev, q6afe_of_clk_hw_get, cc);if (ret)return ret;
sound/soc/qcom/qdsp6/q6afe.c +1 -1
@@ -1681,7 +1681,7 @@ int q6afe_unvote_lpass_core_hw(struct device *dev, uint32_t hw_block_id,EXPORT_SYMBOL (q6afe_unvote_lpass_core_hw);int q6afe_vote_lpass_core_hw (struct device *dev,uint32_t hw_block_id, -char *client_name,uint32_t *client_handle) +const char *client_name,uint32_t *client_handle) {struct q6afe *afe =dev_get_drvdata (dev->parent);struct afe_cmd_remote_lpass_core_hw_vote_request *vote_cfg;
sound/soc/qcom/qdsp6/q6afe.h +1 -1
@@ -236,7 +236,7 @@ int q6afe_port_set_sysclk(struct q6afe_port *port, int clk_id,int q6afe_set_lpass_clock (struct device *dev,int clk_id,int clk_src,int clk_root,unsigned int freq);int q6afe_vote_lpass_core_hw (struct device *dev,uint32_t hw_block_id, -char *client_name,uint32_t *client_handle); +const char *client_name,uint32_t *client_handle);int q6afe_unvote_lpass_core_hw (struct device *dev,uint32_t hw_block_id,uint32_t client_handle);#endif /* __Q6AFE_H__ */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 479/677 ALSA: core: remove redundant spin_lock pair in snd_card_disconnect
In reply to Greg Kroah-HartmanFrom: Jia Zhou <[email protected]>
[ Upstream commit abc21649b3e5c34b143bf86f0c78e33d5815e250 ]
modification in commit 2a3f7221acdd ("ALSA: core: Fix card races between register and disconnect") resulting in this problem.
--- sound/core/init.c | 2 -- 1 file changed, 2 deletions(-)
sound/core/init.c +0 -2
@@ -398,10 +398,8 @@ int snd_card_disconnect(struct snd_card *card)return 0 ; } card->shutdown =1 ; -spin_unlock (&card->files_lock);/* replace file->f_op with special dummy operations */ -spin_lock (&card->files_lock);list_for_each_entry (mfile, &card->files_list, list) {/* it's critical part, use endless loop */ /* we have no room to fail */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 480/677 net: phy: lan87xx: fix access to wrong register of LAN87xx
In reply to Greg Kroah-HartmanFrom: Andre Edich <[email protected]>
[ Upstream commit fdb5cc6ab3b6a1c0122d3644a63ef9dc7a610d35 ]
The function lan87xx_config_aneg_ext was introduced to configure LAN95xxA but as well writes to undocumented register of LAN87xx. This fix prevents that access.
The function lan87xx_config_aneg_ext gets more suitable for the new behavior name.
--- drivers/net/phy/smsc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/phy/smsc.c +5 -2
@@ -185,10 +185,13 @@ static int lan87xx_config_aneg(struct phy_device *phydev)return genphy_config_aneg (phydev); } -static int lan87xx_config_aneg_ext (struct phy_device *phydev) +static int lan95xx_config_aneg_ext (struct phy_device *phydev) {int rc; +if (phydev->phy_id !=0x0007c0f0 )/* not (LAN9500A or LAN9505A) */ +return lan87xx_config_aneg (phydev); +/* Extend Manual AutoMDIX timer */ rc =phy_read (phydev,PHY_EDPD_CONFIG );if (rc <0 )
@@ -441,7 +444,7 @@ static struct phy_driver smsc_phy_driver[] = { .read_status = lan87xx_read_status, .config_init = smsc_phy_config_init, .soft_reset = smsc_phy_reset, - .config_aneg = lan87xx_config_aneg_ext, + .config_aneg = lan95xx_config_aneg_ext,/* IRQ related */ .config_intr = smsc_phy_config_intr,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 481/677 udp: skip L4 aggregation for UDP tunnel packets
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 18f25dc399901426dff61e676ba603ff52c666f7 ]
If NETIF_F_GRO_FRAGLIST or NETIF_F_GRO_UDP_FWD are enabled, and there are UDP tunnels available in the system, udp_gro_receive() could end-up doing L4 aggregation (either SKB_GSO_UDP_L4 or SKB_GSO_FRAGLIST) at the outer UDP tunnel level for packets effectively carrying and UDP tunnel header.
That could cause inner protocol corruption. If e.g. the relevant packets carry a vxlan header, different vxlan ids will be ignored/ aggregated to the same GSO packet. Inner headers will be ignored, too, so that e.g. TCP over vxlan push packets will be held in the GRO engine till the next flush, etc.
Just skip the SKB_GSO_UDP_L4 and SKB_GSO_FRAGLIST code path if the current packet could land in a UDP tunnel, and let udp_gro_receive() do GRO via udp_sk(sk)->gro_receive.
The check implemented in this patch is broader than what is strictly needed, as the existing UDP tunnel could be e.g. configured on top of a different device: we could end-up skipping GRO at-all for some packets.
Anyhow, that is a very thin corner case and covering it will add quite a bit of complexity.
v1 -> v2:
- hopefully clarify the commit message
--- net/ipv4/udp_offload.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
net/ipv4/udp_offload.c +11 -8
@@ -515,21 +515,24 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,unsigned int off =skb_gro_offset (skb);int flush =1 ; +/* we can do L4 aggregation only if the packet can't land in a tunnel +* otherwise we could corrupt the inner stream +*/ NAPI_GRO_CB (skb)->is_flist =0 ; -if (skb->dev->features &NETIF_F_GRO_FRAGLIST ) -NAPI_GRO_CB (skb)->is_flist = sk ? !udp_sk (sk)->gro_enabled:1 ; +if (!sk || !udp_sk (sk)->gro_receive) { +if (skb->dev->features &NETIF_F_GRO_FRAGLIST ) +NAPI_GRO_CB (skb)->is_flist = sk ? !udp_sk (sk)->gro_enabled :1 ; -if ((!sk && (skb->dev->features &NETIF_F_GRO_UDP_FWD )) || - (sk &&udp_sk (sk)->gro_enabled) ||NAPI_GRO_CB (skb)->is_flist) { - pp =call_gro_receive (udp_gro_receive_segment, head, skb); +if ((!sk && (skb->dev->features &NETIF_F_GRO_UDP_FWD )) || + (sk &&udp_sk (sk)->gro_enabled) ||NAPI_GRO_CB (skb)->is_flist) + pp =call_gro_receive (udp_gro_receive_segment, head, skb);return pp; } -if (!sk ||NAPI_GRO_CB (skb)->encap_mark || +if (NAPI_GRO_CB (skb)->encap_mark || (uh->check && skb->ip_summed !=CHECKSUM_PARTIAL &&NAPI_GRO_CB (skb)->csum_cnt ==0 && - !NAPI_GRO_CB (skb)->csum_valid) || - !udp_sk (sk)->gro_receive) + !NAPI_GRO_CB (skb)->csum_valid)) goto out;/* mark that this skb passed once through the tunnel gro layer */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 482/677 udp: never accept GSO_FRAGLIST packets
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 78352f73dc5047f3f744764cc45912498c52f3c9 ]
Currently the UDP protocol delivers GSO_FRAGLIST packets to the sockets without the expected segmentation.
This change addresses the issue introducing and maintaining a couple of new fields to explicitly accept SKB_GSO_UDP_L4 or GSO_FRAGLIST packets. Additionally updates udp_unexpected_gso() accordingly.
UDP sockets enabling UDP_GRO stil keep accept_udp_fraglist zeroed.
v1 -> v2:
- use 2 bits instead of a whole GSO bitmask (Willem)
--- include/linux/udp.h | 16 +++++++++++++--- net/ipv4/udp.c | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-)
include/linux/udp.h +13 -3
@@ -51,7 +51,9 @@ struct udp_sock {* different encapsulation layer set * this */ - gro_enabled:1 ;/* Can accept GRO packets */ + gro_enabled:1, /* Request GRO aggregation */ + accept_udp_l4:1, + accept_udp_fraglist:1;/* * Following member retains the information to create a UDP header * when the socket is uncorked.
@@ -131,8 +133,16 @@ static inline void udp_cmsg_recv(struct msghdr *msg, struct sock *sk,static inline bool udp_unexpected_gso (struct sock *sk,struct sk_buff *skb) { -return !udp_sk (sk)->gro_enabled &&skb_is_gso (skb) && -skb_shinfo (skb)->gso_type &SKB_GSO_UDP_L4 ; +if (!skb_is_gso (skb)) +return false; + +if (skb_shinfo (skb)->gso_type &SKB_GSO_UDP_L4 && !udp_sk (sk)->accept_udp_l4) +return true; + +if (skb_shinfo (skb)->gso_type &SKB_GSO_FRAGLIST && !udp_sk (sk)->accept_udp_fraglist) +return true; + +return false; }#define udp_portaddr_for_each_entry (__sk, list) \
net/ipv4/udp.c +3 -0
@@ -2664,9 +2664,12 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,case UDP_GRO :lock_sock (sk); + +/* when enabling GRO, accept the related GSO packet type */ if (valbool)udp_tunnel_encap_enable (sk->sk_socket); up->gro_enabled = valbool; + up->accept_udp_l4 = valbool;release_sock (sk);break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 483/677 powerpc/pseries: Only register vio drivers if vio bus exists
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 11d92156f7a862091009d7655d19c1e7de37fc7a ]
The vio bus is a fake bus, which we use on pseries LPARs (guests) to discover devices provided by the hypervisor. There's no need or sense in creating the vio bus on bare metal systems.
Which is why commit 4336b9337824 ("powerpc/pseries: Make vio and ibmebus initcalls pseries specific") made the initialisation of the vio bus only happen in LPARs.
However as a result of that commit we now see errors at boot on bare metal systems:
Driver 'hvc_console' was unable to register with bus_type 'vio' because the bus was not initialized. Driver 'tpm_ibmvtpm' was unable to register with bus_type 'vio' because the bus was not initialized.
This happens because those drivers are built-in, and are calling vio_register_driver(). It in turn calls driver_register() with a reference to vio_bus_type, but we haven't registered vio_bus_type with the driver core.
Fix it by also guarding vio_register_driver() with a check to see if we are on pseries.
--- arch/powerpc/platforms/pseries/vio.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/vio.c +4 -0
@@ -1285,6 +1285,10 @@ static int vio_bus_remove(struct device *dev)int __vio_register_driver (struct vio_driver *viodrv,struct module *owner,const char *mod_name) { +// vio_bus_type is only initialised for pseries +if (!machine_is (pseries)) +return -ENODEV ; +pr_debug ("%s: driver %s registering\n" , __func__, viodrv->name);/* fill in 'struct driver' fields */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 484/677 net/tipc: fix missing destroy_workqueue() on error in tipc_crypto_start()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ac1db7acea67777be1ba86e36e058c479eab6508 ]
Add the missing destroy_workqueue() before return from tipc_crypto_start() in the error handling case.
--- net/tipc/crypto.c | 2 ++ 1 file changed, 2 insertions(+)
net/tipc/crypto.c +2 -0
@@ -1492,6 +1492,8 @@ int tipc_crypto_start(struct tipc_crypto **crypto, struct net *net,/* Allocate statistic structure */ c->stats = alloc_percpu_gfp(struct tipc_crypto_stats, GFP_ATOMIC);if (!c->stats) { +if (c->wq) +destroy_workqueue (c->wq);kfree_sensitive (c);return -ENOMEM ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 485/677 bug: Remove redundant condition check in report_bug
In reply to Greg Kroah-HartmanFrom: Andrew Scull <[email protected]>
[ Upstream commit 3ad1a6cb0abc63d036fc866bd7c2c5983516dec5 ]
report_bug() will return early if it cannot find a bug corresponding to the provided address. The subsequent test for the bug will always be true so remove it.
--- lib/bug.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
lib/bug.c +15 -18
@@ -155,30 +155,27 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) file =NULL ; line =0 ; - warning =0 ; -if (bug) {#ifdef CONFIG_DEBUG_BUGVERBOSE #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS - file = bug->file; + file = bug->file;#else - file = (const char *)bug + bug->file_disp; + file = (const char *)bug + bug->file_disp;#endif - line = bug->line; + line = bug->line;#endif - warning = (bug->flags &BUGFLAG_WARNING ) !=0 ; - once = (bug->flags &BUGFLAG_ONCE ) !=0 ; - done = (bug->flags &BUGFLAG_DONE ) !=0 ; - -if (warning && once) { -if (done) -return BUG_TRAP_TYPE_WARN ; - -/* -* Since this is the only store, concurrency is not an issue. -*/ - bug->flags |=BUGFLAG_DONE ; - } + warning = (bug->flags &BUGFLAG_WARNING ) !=0 ; + once = (bug->flags &BUGFLAG_ONCE ) !=0 ; + done = (bug->flags &BUGFLAG_DONE ) !=0 ; + +if (warning && once) { +if (done) +return BUG_TRAP_TYPE_WARN ; + +/* +* Since this is the only store, concurrency is not an issue. +*/ + bug->flags |=BUGFLAG_DONE ; }/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 486/677 RDMA/core: Fix corrupted SL on passive side
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit 194f64a3cad3ab9e381e996a13089de3215d1887 ]
On RoCE systems, a CM REQ contains a Primary Hop Limit > 1 and Primary Subnet Local is zero.
In cm_req_handler(), the cm_process_routed_req() function is called. Since the Primary Subnet Local value is zero in the request, and since this is RoCE (Primary Local LID is permissive), the following statement will be executed:
IBA_SET(CM_REQ_PRIMARY_SL, req_msg, wc->sl);
This corrupts SL in req_msg if it was different from zero. In other words, a request to setup a connection using an SL != zero, will not be honored, and a connection using SL zero will be created instead.
Fixed by not calling cm_process_routed_req() on RoCE systems, the cm_process_route_req() is only for IB anyhow.
--- drivers/infiniband/core/cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/cm.c +2 -1
@@ -2138,7 +2138,8 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } -cm_process_routed_req (req_msg, work->mad_recv_wc->wc); +if (cm_id_priv->av.ah_attr.type !=RDMA_AH_ATTR_TYPE_ROCE ) +cm_process_routed_req (req_msg, work->mad_recv_wc->wc);memset (&work->path[0 ],0 ,sizeof (work->path[0 ]));if (cm_req_has_alt_path (req_msg))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 487/677 nfc: pn533: prevent potential memory corruption
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ca4d4c34ae9aa5c3c0da76662c5e549d2fc0cc86 ]
If the "type_a->nfcid_len" is too large then it would lead to memory corruption in pn533_target_found_type_a() when we do:
memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len);
--- drivers/nfc/pn533/pn533.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nfc/pn533/pn533.c +3 -0
@@ -706,6 +706,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a,if (PN533_TYPE_A_SEL_CASCADE (type_a->sel_res) !=0 )return false; +if (type_a->nfcid_len >NFC_NFCID1_MAXSIZE ) +return false; +return true; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 488/677 net: hns3: Limiting the scope of vector_ring_chain variable
In reply to Greg Kroah-HartmanFrom: Salil Mehta <[email protected]>
[ Upstream commit d392ecd1bc29ae15b0e284d5f732c2d36f244271 ]
Limiting the scope of the variable vector_ring_chain to the block where it is used.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 -1
@@ -3704,7 +3704,6 @@ static void hns3_nic_set_cpumask(struct hns3_nic_priv *priv)static int hns3_nic_init_vector_data (struct hns3_nic_priv *priv) { -struct hnae3_ring_chain_node vector_ring_chain;struct hnae3_handle *h = priv->ae_handle;struct hns3_enet_tqp_vector *tqp_vector;int ret;
@@ -3736,6 +3735,8 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) }for (i =0 ; i < priv->vector_num; i++) { +struct hnae3_ring_chain_node vector_ring_chain; + tqp_vector = &priv->tqp_vector[i]; tqp_vector->rx_group.total_bytes =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 489/677 mips: bmips: fix syscon-reboot nodes
In reply to Greg Kroah-HartmanFrom: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit cde58b861a1d365568588adda59d42351c0c4ad3 ]
Commit a23c4134955e added the clock controller nodes, incorrectly changing the syscon-reboot nodes addresses.
--- arch/mips/boot/dts/brcm/bcm3368.dtsi | 2 +- arch/mips/boot/dts/brcm/bcm63268.dtsi | 2 +- arch/mips/boot/dts/brcm/bcm6358.dtsi | 2 +- arch/mips/boot/dts/brcm/bcm6362.dtsi | 2 +- arch/mips/boot/dts/brcm/bcm6368.dtsi | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/mips/boot/dts/brcm/bcm3368.dtsi +1 -1
@@ -59,7 +59,7 @@ periph_cntl: syscon@fff8c008 { compatible = "syscon"; - reg = <0xfff8c000 0x4>; + reg = <0xfff8c008 0x4>; native-endian; };
arch/mips/boot/dts/brcm/bcm63268.dtsi +1 -1
@@ -59,7 +59,7 @@ periph_cntl: syscon@10000008 { compatible = "syscon"; - reg = <0x10000000 0xc>; + reg = <0x10000008 0x4>; native-endian; };
arch/mips/boot/dts/brcm/bcm6358.dtsi +1 -1
@@ -59,7 +59,7 @@ periph_cntl: syscon@fffe0008 { compatible = "syscon"; - reg = <0xfffe0000 0x4>; + reg = <0xfffe0008 0x4>; native-endian; };
arch/mips/boot/dts/brcm/bcm6362.dtsi +1 -1
@@ -59,7 +59,7 @@ periph_cntl: syscon@10000008 { compatible = "syscon"; - reg = <0x10000000 0xc>; + reg = <0x10000008 0x4>; native-endian; };
arch/mips/boot/dts/brcm/bcm6368.dtsi +1 -1
@@ -59,7 +59,7 @@ periph_cntl: syscon@100000008 { compatible = "syscon"; - reg = <0x10000000 0xc>; + reg = <0x10000008 0x4>; native-endian; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 490/677 KVM: arm64: Fix error return code in init_hyp_mode()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 52b9e265d22bccc5843e167da76ab119874e2883 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- arch/arm64/kvm/arm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/kvm/arm.c +3 -1
@@ -1808,8 +1808,10 @@ static int init_hyp_mode(void)if (is_protected_kvm_enabled ()) {init_cpu_logical_map (); -if (!init_psci_relay ()) +if (!init_psci_relay ()) { + err = -ENODEV ; goto out_err; + } }return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 491/677 iommu/vt-d: Dont set then clear private data in prq_event_thread()
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 1d421058c815d54113d9afdf6db3f995c788cf0d ]
The VT-d specification (section 7.6) requires that the value in the Private Data field of a Page Group Response Descriptor must match the value in the Private Data field of the respective Page Request Descriptor.
The private data field of a page group response descriptor is set then immediately cleared in prq_event_thread(). This breaks the rule defined by the VT-d specification. Fix it by moving clearing code up.
--- drivers/iommu/intel/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/intel/svm.c +2 -2
@@ -1031,12 +1031,12 @@ no_pasid:QI_PGRP_RESP_TYPE ; resp.qw1 =QI_PGRP_IDX (req->prg_index) |QI_PGRP_LPIG (req->lpig); + resp.qw2 =0 ; + resp.qw3 =0 ;if (req->priv_data_present)memcpy (&resp.qw2, req->priv_data,sizeof (req->priv_data)); - resp.qw2 =0 ; - resp.qw3 =0 ;qi_submit_sync (iommu, &resp,1 ,0 ); } prq_advance:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 492/677 iommu: Fix a boundary issue to avoid performance drop
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit 3431c3f660a39f6ced954548a59dba6541ce3eb1 ]
After the change of patch ("iommu: Switch gather->end to the inclusive end"), the performace drops from 1600+K IOPS to 1200K in our kunpeng ARM64 platform.
We find that the range [start1, end1) actually is joint from the range [end1, end2), but it is considered as disjoint after the change, so it needs more times of TLB sync, and spends more time on it. So fix the boundary issue to avoid performance drop.
--- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iommu.h +1 -1
@@ -547,7 +547,7 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain,* structure can be rewritten. */ if (gather->pgsize != size || - end < gather->start || start > gather->end) { + end +1 < gather->start || start > gather->end +1 ) {if (gather->pgsize)iommu_iotlb_sync (domain, gather); gather->pgsize = size;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 493/677 iommu/vt-d: Report right snoop capability when using FL for IOVA
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 6c00612d0cba10f7d0917cf1f73c945003ed4cd7 ]
The Intel VT-d driver checks wrong register to report snoop capablility when using first level page table for GPA to HPA translation. This might lead the IOMMU driver to say that it supports snooping control, but in reality, it does not. Fix this by always setting PASID-table-entry.PGSNP whenever a pasid entry is setting up for GPA to HPA translation so that the IOMMU driver could report snoop capability as long as it runs in the scalable mode.
--- drivers/iommu/intel/iommu.c | 12 +++++++++++- drivers/iommu/intel/pasid.c | 16 ++++++++++++++++ drivers/iommu/intel/pasid.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +11 -1
@@ -657,7 +657,14 @@ static int domain_update_iommu_snooping(struct intel_iommu *skip)rcu_read_lock ();for_each_active_iommu (iommu, drhd) {if (iommu != skip) { -if (!ecap_sc_support (iommu->ecap)) { +/* +* If the hardware is operating in the scalable mode, +* the snooping control is always supported since we +* always set PASID-table-entry.PGSNP bit if the domain +* is managed outside (UNMANAGED). +*/ +if (!sm_supported (iommu) && + !ecap_sc_support (iommu->ecap)) { ret =0 ;break ; }
@@ -2528,6 +2535,9 @@ static int domain_setup_first_level(struct intel_iommu *iommu, flags |= (level ==5 ) ?PASID_FLAG_FL5LP :0 ; +if (domain->domain.type ==IOMMU_DOMAIN_UNMANAGED ) + flags |=PASID_FLAG_PAGE_SNOOP ; +return intel_pasid_setup_first_level (iommu, dev, (pgd_t *)pgd, pasid, domain->iommu_did[iommu->seq_id], flags);
drivers/iommu/intel/pasid.c +16 -0
@@ -411,6 +411,16 @@ static inline void pasid_set_page_snoop(struct pasid_entry *pe, bool value)pasid_set_bits (&pe->val[1 ],1 <<23 , value <<23 ); } +/* +* Setup the Page Snoop (PGSNP) field (Bit 88) of a scalable mode +* PASID entry. +*/ +static inline void +pasid_set_pgsnp (struct pasid_entry *pe) +{ +pasid_set_bits (&pe->val[1 ],1ULL <<24 ,1ULL <<24 ); +} +/* * Setup the First Level Page table Pointer field (Bit 140~191) * of a scalable mode PASID entry.
@@ -565,6 +575,9 @@ int intel_pasid_setup_first_level(struct intel_iommu *iommu, } } +if (flags &PASID_FLAG_PAGE_SNOOP ) +pasid_set_pgsnp (pte); +pasid_set_domain_id (pte, did);pasid_set_address_width (pte, iommu->agaw);pasid_set_page_snoop (pte, !!ecap_smpwc (iommu->ecap));
@@ -643,6 +656,9 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu,pasid_set_fault_enable (pte);pasid_set_page_snoop (pte, !!ecap_smpwc (iommu->ecap)); +if (domain->domain.type ==IOMMU_DOMAIN_UNMANAGED ) +pasid_set_pgsnp (pte); +/* * Since it is a second level only translation setup, we should * set SRE bit as well (addresses are expected to be GPAs).
drivers/iommu/intel/pasid.h +1 -0
@@ -48,6 +48,7 @@*/ #define PASID_FLAG_SUPERVISOR_MODE BIT(0)#define PASID_FLAG_NESTED BIT(1) +#define PASID_FLAG_PAGE_SNOOP BIT(2)/* * The PASID_FLAG_FL5LP flag Indicates using 5-level paging for first-
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 494/677 iommu/vt-d: Report the right page fault address
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 03d205094af45bca4f8e0498c461a893aa3ec6d9 ]
The Address field of the Page Request Descriptor only keeps bit [63:12] of the offending address. Convert it to a full address before reporting it to device drivers.
--- drivers/iommu/intel/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/svm.c +1 -1
@@ -862,7 +862,7 @@ intel_svm_prq_report(struct device *dev, struct page_req_dsc *desc)/* Fill in event data for device specific processing */ memset (&event,0 ,sizeof (struct iommu_fault_event )); event.fault.type =IOMMU_FAULT_PAGE_REQ ; - event.fault.prm.addr = desc->addr; + event.fault.prm.addr = (u64 )desc->addr <<VTD_PAGE_SHIFT ; event.fault.prm.pasid = desc->pasid; event.fault.prm.grpid = desc->prg_index; event.fault.prm.perm =prq_to_iommu_prot (desc);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 495/677 iommu/vt-d: Remove WO permissions on second-level paging entries
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit eea53c5816889ee8b64544fa2e9311a81184ff9c ]
When the first level page table is used for IOVA translation, it only supports Read-Only and Read-Write permissions. The Write-Only permission is not supported as the PRESENT bit (implying Read permission) should always set. When using second level, we still give separate permissions that allows WriteOnly which seems inconsistent and awkward. We want to have consistent behavior. After moving to 1st level, we don't want things to work sometimes, and break if we use 2nd level for the same mappings. Hence remove this configuration.
--- drivers/iommu/intel/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +2 -1
@@ -2346,8 +2346,9 @@ __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,return -EINVAL ; attr = prot & (DMA_PTE_READ |DMA_PTE_WRITE |DMA_PTE_SNP ); + attr |=DMA_FL_PTE_PRESENT ;if (domain_use_first_level (domain)) { - attr |=DMA_FL_PTE_PRESENT |DMA_FL_PTE_XD |DMA_FL_PTE_US ; + attr |=DMA_FL_PTE_XD |DMA_FL_PTE_US ;if (domain->domain.type ==IOMMU_DOMAIN_DMA ) { attr |=DMA_FL_PTE_ACCESS ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 496/677 iommu/vt-d: Invalidate PASID cache when root/context entry changed
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit c0474a606ecb9326227b4d68059942f9db88a897 ]
When the Intel IOMMU is operating in the scalable mode, some information from the root and context table may be used to tag entries in the PASID cache. Software should invalidate the PASID-cache when changing root or context table entries.
--- drivers/iommu/intel/iommu.c | 18 +++++++++--------- include/linux/intel-iommu.h | 1 + 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/iommu/intel/iommu.c +9 -9
@@ -1346,6 +1346,11 @@ static void iommu_set_root_entry(struct intel_iommu *iommu) readl, (sts & DMA_GSTS_RTPS), sts);raw_spin_unlock_irqrestore (&iommu->register_lock, flag); + + iommu->flush.flush_context (iommu,0 ,0 ,0 ,DMA_CCMD_GLOBAL_INVL ); +if (sm_supported (iommu)) +qi_flush_pasid_cache (iommu,0 ,QI_PC_GLOBAL ,0 ); + iommu->flush.flush_iotlb (iommu,0 ,0 ,0 ,DMA_TLB_GLOBAL_FLUSH ); }void iommu_flush_write_buffer (struct intel_iommu *iommu)
@@ -2453,6 +2458,10 @@ static void domain_context_clear_one(struct intel_iommu *iommu, u8 bus, u8 devfn (((u16 )bus) <<8 ) | devfn,DMA_CCMD_MASK_NOBIT , DMA_CCMD_DEVICE_INVL); + +if (sm_supported (iommu)) +qi_flush_pasid_cache (iommu, did_old,QI_PC_ALL_PASIDS ,0 ); + iommu->flush.flush_iotlb(iommu, did_old, 0,
@@ -3301,8 +3310,6 @@ static int __init init_dmars(void)register_pasid_allocator (iommu);#endif iommu_set_root_entry (iommu); - iommu->flush.flush_context (iommu,0 ,0 ,0 ,DMA_CCMD_GLOBAL_INVL ); - iommu->flush.flush_iotlb (iommu,0 ,0 ,0 ,DMA_TLB_GLOBAL_FLUSH ); }#ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA
@@ -3492,12 +3499,7 @@ static int init_iommu_hw(void) }iommu_flush_write_buffer (iommu); -iommu_set_root_entry (iommu); - - iommu->flush.flush_context (iommu,0 ,0 ,0 , -DMA_CCMD_GLOBAL_INVL ); - iommu->flush.flush_iotlb (iommu,0 ,0 ,0 ,DMA_TLB_GLOBAL_FLUSH );iommu_enable_translation (iommu);iommu_disable_protect_mem_regions (iommu); }
@@ -3880,8 +3882,6 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru) goto disable_iommu;iommu_set_root_entry (iommu); - iommu->flush.flush_context (iommu,0 ,0 ,0 ,DMA_CCMD_GLOBAL_INVL ); - iommu->flush.flush_iotlb (iommu,0 ,0 ,0 ,DMA_TLB_GLOBAL_FLUSH );iommu_enable_translation (iommu);iommu_disable_protect_mem_regions (iommu);
include/linux/intel-iommu.h +1 -0
@@ -372,6 +372,7 @@ enum {/* PASID cache invalidation granu */ #define QI_PC_ALL_PASIDS 0#define QI_PC_PASID_SEL 1 +#define QI_PC_GLOBAL 3#define QI_EIOTLB_ADDR (addr) ((u64)(addr) & VTD_PAGE_MASK)#define QI_EIOTLB_IH (ih) (((u64)ih) << 6)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 497/677 ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 5fb45414ae03421255593fd5556aa2d1d82303aa ]
There are a few calls of usb_driver_claim_interface() but all of those miss the proper error checks, as reported by Coverity. This patch adds those missing checks.
Along with it, replace the magic pointer with -1 with a constant USB_AUDIO_IFACE_UNUSED for better readability.
Addresses-Coverity-ID: 1475943 ("Error handling issues")
Addresses-Coverity-ID: 1475944 ("Error handling issues")
Addresses-Coverity-ID: 1475945 ("Error handling issues")
--- sound/usb/card.c | 14 +++++++------- sound/usb/quirks.c | 16 ++++++++++++---- sound/usb/usbaudio.h | 2 ++ 3 files changed, 21 insertions(+), 11 deletions(-)
sound/usb/card.c +7 -7
@@ -181,9 +181,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ctrlif, interface);return -EINVAL ; } -usb_driver_claim_interface (&usb_audio_driver, iface, (void *)-1L ); - -return 0 ; +return usb_driver_claim_interface (&usb_audio_driver, iface, +USB_AUDIO_IFACE_UNUSED ); } if ((altsd->bInterfaceClass != USB_CLASS_AUDIO &&
@@ -203,7 +202,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int intif (!snd_usb_parse_audio_interface (chip, interface)) {usb_set_interface (dev, interface,0 );/* reset the current interface */ -usb_driver_claim_interface (&usb_audio_driver, iface, (void *)-1L ); +return usb_driver_claim_interface (&usb_audio_driver, iface, +USB_AUDIO_IFACE_UNUSED ); }return 0 ;
@@ -862,7 +862,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)struct snd_card *card;struct list_head *p; -if (chip == (void *)-1L ) +if (chip ==USB_AUDIO_IFACE_UNUSED )return ; card = chip->card;
@@ -992,7 +992,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)struct usb_mixer_interface *mixer;struct list_head *p; -if (chip == (void *)-1L ) +if (chip ==USB_AUDIO_IFACE_UNUSED )return 0 ;if (!chip->num_suspended_intf++) {
@@ -1022,7 +1022,7 @@ static int __usb_audio_resume(struct usb_interface *intf, bool reset_resume)struct list_head *p;int err =0 ; -if (chip == (void *)-1L ) +if (chip ==USB_AUDIO_IFACE_UNUSED )return 0 ;atomic_inc (&chip->active);/* avoid autopm */
sound/usb/quirks.c +12 -4
@@ -55,8 +55,12 @@ static int create_composite_quirk(struct snd_usb_audio *chip,if (!iface)continue ;if (quirk->ifnum != probed_ifnum && - !usb_interface_claimed (iface)) -usb_driver_claim_interface (driver, iface, (void *)-1L ); + !usb_interface_claimed (iface)) { + err =usb_driver_claim_interface (driver, iface, +USB_AUDIO_IFACE_UNUSED ); +if (err <0 ) +return err; + } }return 0 ;
@@ -426,8 +430,12 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,continue ; err =create_autodetect_quirk (chip, iface, driver); -if (err >=0 ) -usb_driver_claim_interface (driver, iface, (void *)-1L ); +if (err >=0 ) { + err =usb_driver_claim_interface (driver, iface, +USB_AUDIO_IFACE_UNUSED ); +if (err <0 ) +return err; + } }return 0 ;
sound/usb/usbaudio.h +2 -0
@@ -61,6 +61,8 @@ struct snd_usb_audio {struct media_intf_devnode *ctl_intf_media_devnode; }; +#define USB_AUDIO_IFACE_UNUSED ((void *)-1L) + #define usb_audio_err(chip, fmt, args...) \ dev_err(&(chip)->dev->dev, fmt, ##args) #define usb_audio_warn(chip, fmt, args...) \
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 498/677 HID: lenovo: Use brightness_set_blocking callback for setting LEDs brightness
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit bbf62645255f120bc2e7488c237e3f04da42ec70 ]
The lenovo_led_brightness_set function may sleep, so we should have the the led_class_dev's brightness_set_blocking callback point to it, rather then the regular brightness_set callback.
When toggled through sysfs this is not a problem, but the brightness_set callback may be called from atomic context when using LED-triggers.
--- drivers/hid/hid-lenovo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/hid/hid-lenovo.c +5 -3
@@ -777,7 +777,7 @@ static enum led_brightness lenovo_led_brightness_get( : LED_OFF; } -static void lenovo_led_brightness_set (struct led_classdev *led_cdev, +static int lenovo_led_brightness_set (struct led_classdev *led_cdev,enum led_brightness value) {struct device *dev = led_cdev->dev->parent;
@@ -802,6 +802,8 @@ static void lenovo_led_brightness_set(struct led_classdev *led_cdev,lenovo_led_set_tp10ubkbd (hdev, tp10ubkbd_led[led_nr], value);break ; } + +return 0 ; }static int lenovo_register_leds (struct hid_device *hdev)
@@ -822,7 +824,7 @@ static int lenovo_register_leds(struct hid_device *hdev) data->led_mute.name = name_mute; data->led_mute.brightness_get = lenovo_led_brightness_get; - data->led_mute.brightness_set = lenovo_led_brightness_set; + data->led_mute.brightness_set_blocking = lenovo_led_brightness_set; data->led_mute.dev = &hdev->dev; ret =led_classdev_register (&hdev->dev, &data->led_mute);if (ret <0 )
@@ -830,7 +832,7 @@ static int lenovo_register_leds(struct hid_device *hdev) data->led_micmute.name = name_micm; data->led_micmute.brightness_get = lenovo_led_brightness_get; - data->led_micmute.brightness_set = lenovo_led_brightness_set; + data->led_micmute.brightness_set_blocking = lenovo_led_brightness_set; data->led_micmute.dev = &hdev->dev; ret =led_classdev_register (&hdev->dev, &data->led_micmute);if (ret <0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 499/677 HID: lenovo: Fix lenovo_led_set_tp10ubkbd() error handling
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 658d04e6eb6be1601ae95d7bee92bbf4096cdc1e ]
Fix the following issues with lenovo_led_set_tp10ubkbd() error handling:
1. On success hid_hw_raw_request() returns the number of bytes sent. So we should check for (ret != 3) rather then for (ret != 0).
2. Actually propagate errors to the caller.
3. Since the LEDs are part of an USB keyboard-dock the mute LEDs can go away at any time. Don't log an error when ret == -ENODEV and set the LED_HW_PLUGGABLE flag to avoid errors getting logged when the USB gets disconnected.
--- drivers/hid/hid-lenovo.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/hid/hid-lenovo.c +21 -8
@@ -62,8 +62,8 @@ struct lenovo_drvdata {#define TP10UBKBD_LED_OFF 1#define TP10UBKBD_LED_ON 2 -static void lenovo_led_set_tp10ubkbd (struct hid_device *hdev,u8 led_code, -enum led_brightness value) +static int lenovo_led_set_tp10ubkbd (struct hid_device *hdev,u8 led_code, +enum led_brightness value) {struct lenovo_drvdata *data =hid_get_drvdata (hdev);int ret;
@@ -75,10 +75,18 @@ static void lenovo_led_set_tp10ubkbd(struct hid_device *hdev, u8 led_code, data->led_report[2 ] = value ?TP10UBKBD_LED_ON :TP10UBKBD_LED_OFF ; ret =hid_hw_raw_request (hdev, data->led_report[0 ], data->led_report,3 ,HID_OUTPUT_REPORT ,HID_REQ_SET_REPORT ); -if (ret) -hid_err (hdev,"Set LED output report error: %d\n" , ret); +if (ret !=3 ) { +if (ret != -ENODEV ) +hid_err (hdev,"Set LED output report error: %d\n" , ret); + + ret = ret <0 ? ret : -EIO ; + }else { + ret =0 ; + }mutex_unlock (&data->led_report_mutex); + +return ret; }static void lenovo_tp10ubkbd_sync_fn_lock (struct work_struct *work)
@@ -349,7 +357,7 @@ static ssize_t attr_fn_lock_store(struct device *dev, {struct hid_device *hdev =to_hid_device (dev);struct lenovo_drvdata *data =hid_get_drvdata (hdev); -int value; +int value, ret;if (kstrtoint (buf,10 , &value))return -EINVAL ;
@@ -364,7 +372,9 @@ static ssize_t attr_fn_lock_store(struct device *dev,lenovo_features_set_cptkbd (hdev);break ;case USB_DEVICE_ID_LENOVO_TP10UBKBD : -lenovo_led_set_tp10ubkbd (hdev,TP10UBKBD_FN_LOCK_LED , value); + ret =lenovo_led_set_tp10ubkbd (hdev,TP10UBKBD_FN_LOCK_LED , value); +if (ret) +return ret;break ; }
@@ -785,6 +795,7 @@ static int lenovo_led_brightness_set(struct led_classdev *led_cdev,struct lenovo_drvdata *data_pointer =hid_get_drvdata (hdev);u8 tp10ubkbd_led[] = {TP10UBKBD_MUTE_LED ,TP10UBKBD_MICMUTE_LED };int led_nr =0 ; +int ret =0 ;if (led_cdev == &data_pointer->led_micmute) led_nr =1 ;
@@ -799,11 +810,11 @@ static int lenovo_led_brightness_set(struct led_classdev *led_cdev,lenovo_led_set_tpkbd (hdev);break ;case USB_DEVICE_ID_LENOVO_TP10UBKBD : -lenovo_led_set_tp10ubkbd (hdev, tp10ubkbd_led[led_nr], value); + ret =lenovo_led_set_tp10ubkbd (hdev, tp10ubkbd_led[led_nr], value);break ; } -return 0 ; +return ret; }static int lenovo_register_leds (struct hid_device *hdev)
@@ -825,6 +836,7 @@ static int lenovo_register_leds(struct hid_device *hdev) data->led_mute.name = name_mute; data->led_mute.brightness_get = lenovo_led_brightness_get; data->led_mute.brightness_set_blocking = lenovo_led_brightness_set; + data->led_mute.flags =LED_HW_PLUGGABLE ; data->led_mute.dev = &hdev->dev; ret =led_classdev_register (&hdev->dev, &data->led_mute);if (ret <0 )
@@ -833,6 +845,7 @@ static int lenovo_register_leds(struct hid_device *hdev) data->led_micmute.name = name_micm; data->led_micmute.brightness_get = lenovo_led_brightness_get; data->led_micmute.brightness_set_blocking = lenovo_led_brightness_set; + data->led_micmute.flags =LED_HW_PLUGGABLE ; data->led_micmute.dev = &hdev->dev; ret =led_classdev_register (&hdev->dev, &data->led_micmute);if (ret <0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 500/677 HID: lenovo: Check hid_get_drvdata() returns non NULL in lenovo_event()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 34348a8661e3cd67dcf6938f08c8bb77522301f7 ]
The HID lenovo probe function only attaches drvdata to one of the USB interfaces, but lenovo_event() will get called for all USB interfaces to which hid-lenovo is bound.
This allows a malicious device to fake being a device handled by hid-lenovo, which generates events for which lenovo_event() has special handling (and thus dereferences hid_get_drvdata()) on another interface triggering a NULL pointer exception.
Add a check for hid_get_drvdata() returning NULL, avoiding this possible NULL pointer exception.
--- drivers/hid/hid-lenovo.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-lenovo.c +3 -0
@@ -508,6 +508,9 @@ static int lenovo_event_cptkbd(struct hid_device *hdev,static int lenovo_event (struct hid_device *hdev,struct hid_field *field,struct hid_usage *usage,__s32 value) { +if (!hid_get_drvdata (hdev)) +return 0 ; +switch (hdev->product) {case USB_DEVICE_ID_LENOVO_CUSBKBD :case USB_DEVICE_ID_LENOVO_CBTKBD :
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 501/677 HID: lenovo: Map mic-mute button to KEY_F20 instead of KEY_MICMUTE
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 617103246cfd19af837e4cb614ba9f877c4f7779 ]
Mapping the mic-mute button to KEY_MICMUTE is technically correct but KEY_MICMUTE translates to a scancode of 256 (248 + 8) under X, which does not fit in 8 bits, so it does not work.
Because of this userspace is expecting KEY_F20 instead, theoretically KEY_MICMUTE should work under Wayland but even there it does not work, because the desktop-environment is listening only for KEY_F20 and not for KEY_MICMUTE.
--- drivers/hid/hid-lenovo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hid/hid-lenovo.c +6 -3
@@ -33,6 +33,9 @@#include "hid-ids.h" +/* Userspace expects F20 for mic-mute KEY_MICMUTE does not work */ +#define LENOVO_KEY_MICMUTE KEY_F20 +struct lenovo_drvdata {u8 led_report[3 ];/* Must be first for proper alignment */ int led_state;
@@ -134,7 +137,7 @@ static int lenovo_input_mapping_tpkbd(struct hid_device *hdev,if (usage->hid == (HID_UP_BUTTON |0x0010 )) {/* This sub-device contains trackpoint, mark it */ hid_set_drvdata (hdev, (void *)1 ); -map_key_clear (KEY_MICMUTE ); +map_key_clear (LENOVO_KEY_MICMUTE );return 1 ; }return 0 ;
@@ -149,7 +152,7 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, (usage->hid & HID_USAGE_PAGE) == HID_UP_LNVENDOR) {switch (usage->hid &HID_USAGE ) {case 0x00f1 :/* Fn-F4: Mic mute */ -map_key_clear (KEY_MICMUTE ); +map_key_clear (LENOVO_KEY_MICMUTE );return 1 ;case 0x00f2 :/* Fn-F5: Brightness down */ map_key_clear (KEY_BRIGHTNESSDOWN );
@@ -239,7 +242,7 @@ static int lenovo_input_mapping_tp10_ultrabook_kbd(struct hid_device *hdev,map_key_clear (KEY_FN_ESC );return 1 ;case 9 :/* Fn-F4: Mic mute */ -map_key_clear (KEY_MICMUTE ); +map_key_clear (LENOVO_KEY_MICMUTE );return 1 ;case 10 :/* Fn-F7: Control panel */ map_key_clear (KEY_CONFIG );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 502/677 KVM: arm64: Initialize VCPU mdcr_el2 before loading it
In reply to Greg Kroah-HartmanFrom: Alexandru Elisei <[email protected]>
[ Upstream commit 263d6287da1433aba11c5b4046388f2cdf49675c ]
When a VCPU is created, the kvm_vcpu struct is initialized to zero in kvm_vm_ioctl_create_vcpu(). On VHE systems, the first time vcpu.arch.mdcr_el2 is loaded on hardware is in vcpu_load(), before it is set to a sensible value in kvm_arm_setup_debug() later in the run loop. The result is that KVM executes for a short time with MDCR_EL2 set to zero.
This has several unintended consequences:
* Setting MDCR_EL2.HPMN to 0 is constrained unpredictable according to ARM DDI 0487G.a, page D13-3820. The behavior specified by the architecture in this case is for the PE to behave as if MDCR_EL2.HPMN is set to a value less than or equal to PMCR_EL0.N, which means that an unknown number of counters are now disabled by MDCR_EL2.HPME, which is zero.
* The host configuration for the other debug features controlled by MDCR_EL2 is temporarily lost. This has been harmless so far, as Linux doesn't use the other fields, but that might change in the future.
Let's avoid both issues by initializing the VCPU's mdcr_el2 field in kvm_vcpu_vcpu_first_run_init(), thus making sure that the MDCR_EL2 register has a consistent value after each vcpu_load().
--- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/arm.c | 2 + arch/arm64/kvm/debug.c | 88 +++++++++++++++++++++---------- 3 files changed, 63 insertions(+), 28 deletions(-)
arch/arm64/include/asm/kvm_host.h +1 -0
@@ -713,6 +713,7 @@ static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}static inline void kvm_arch_vcpu_block_finish (struct kvm_vcpu *vcpu) {}void kvm_arm_init_debug (void ); +void kvm_arm_vcpu_init_debug (struct kvm_vcpu *vcpu);void kvm_arm_setup_debug (struct kvm_vcpu *vcpu);void kvm_arm_clear_debug (struct kvm_vcpu *vcpu);void kvm_arm_reset_debug_ptr (struct kvm_vcpu *vcpu);
arch/arm64/kvm/arm.c +2 -0
@@ -580,6 +580,8 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) vcpu->arch.has_run_once = true; +kvm_arm_vcpu_init_debug (vcpu); +if (likely (irqchip_in_kernel (kvm))) {/* * Map the VGIC hardware resources before running a vcpu the
arch/arm64/kvm/debug.c +60 -28
131 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 503/677 ASoC: simple-card: fix possible uninitialized single_cpu local variable
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit fa74c223b6fd78a5314b4c61b9abdbed3c2185b4 ]
The 'single_cpu' local variable is assigned by asoc_simple_parse_dai() and later used in a asoc_simple_canonicalize_cpu() call, assuming the entire function did not exit on errors.
However the first function returns 0 if passed device_node is NULL, thus leaving the variable uninitialized and reporting success.
Addresses-Coverity: Uninitialized scalar variable
--- sound/soc/generic/audio-graph-card.c | 2 +- sound/soc/generic/simple-card.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/generic/audio-graph-card.c +1 -1
@@ -380,7 +380,7 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,struct device_node *top = dev->of_node;struct asoc_simple_dai *cpu_dai;struct asoc_simple_dai *codec_dai; -int ret, single_cpu; +int ret, single_cpu =0 ;/* Do it only CPU turn */ if (!li->cpu)
sound/soc/generic/simple-card.c +1 -1
@@ -258,7 +258,7 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,struct device_node *plat =NULL ;char prop[128 ];char *prefix ="" ; -int ret, single_cpu; +int ret, single_cpu =0 ;/* * |CPU |Codec : turn
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 504/677 liquidio: Fix unintented sign extension of a left shift of a u16
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 298b58f00c0f86868ea717426beb5c1198772f81 ]
The macro CN23XX_PEM_BAR1_INDEX_REG is being used to shift oct->pcie_port (a u16) left 24 places. There are two subtle issues here, first the shift gets promoted to an signed int and then sign extended to a u64. If oct->pcie_port is 0x80 or more then the upper bits get sign extended to 1. Secondly shfiting a u16 24 bits will lead to an overflow so it needs to be cast to a u64 for all the bits to not overflow.
It is entirely possible that the u16 port value is never large enough for this to fail, but it is useful to fix unintended overflows such as this.
Fix this by casting the port parameter to the macro to a u64 before the shift.
Addresses-Coverity: ("Unintended sign extension")
--- drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h +1 -1
@@ -521,7 +521,7 @@#define CN23XX_BAR1_INDEX_OFFSET 3#define CN23XX_PEM_BAR1_INDEX_REG (port, idx) \ - (CN23XX_PEM_BAR1_INDEX_START + ((port) << CN23XX_PEM_OFFSET) + \ + (CN23XX_PEM_BAR1_INDEX_START + (((u64)port) << CN23XX_PEM_OFFSET) + \ ((idx) << CN23XX_BAR1_INDEX_OFFSET))/*############################ DPI #########################*/
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 505/677 IB/hfi1: Use kzalloc() for mmu_rb_handler allocation
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit ca5f72568e034e1295a7ae350b1f786fcbfb2848 ]
The code currently assumes that the mmu_notifier struct embedded in mmu_rb_handler only contains two fields.
There are now extra fields:
struct mmu_notifier {
struct hlist_node hlist;
const struct mmu_notifier_ops *ops;
struct mm_struct *mm;
struct rcu_head rcu;
unsigned int users;
};Given that there in no init for the mmu_notifier, a kzalloc() should be used to insure that any newly added fields are given a predictable initial value of zero.
--- drivers/infiniband/hw/hfi1/mmu_rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/mmu_rb.c +1 -1
@@ -89,7 +89,7 @@ int hfi1_mmu_rb_register(void *ops_arg,struct mmu_rb_handler *h;int ret; - h =kmalloc (sizeof (*h),GFP_KERNEL ); + h =kzalloc (sizeof (*h),GFP_KERNEL );if (!h)return -ENOMEM ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 506/677 powerpc/64s: Fix pte update for kernel memory on radix
In reply to Greg Kroah-HartmanFrom: Jordan Niethe <[email protected]>
[ Upstream commit b8b2f37cf632434456182e9002d63cbc4cccc50c ]
When adding a PTE a ptesync is needed to order the update of the PTE with subsequent accesses otherwise a spurious fault may be raised.
radix__set_pte_at() does not do this for performance gains. For non-kernel memory this is not an issue as any faults of this kind are corrected by the page fault handler. For kernel memory these faults are not handled. The current solution is that there is a ptesync in flush_cache_vmap() which should be called when mapping from the vmalloc region.
However, map_kernel_page() does not call flush_cache_vmap(). This is troublesome in particular for code patching with Strict RWX on radix. In do_patch_instruction() the page frame that contains the instruction to be patched is mapped and then immediately patched. With no ordering or synchronization between setting up the PTE and writing to the page it is possible for faults.
As the code patching is done using __put_user_asm_goto() the resulting fault is obscured - but using a normal store instead it can be seen:
BUG: Unable to handle kernel data access on write at 0xc008000008f24a3c Faulting instruction address: 0xc00000000008bd74 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV Modules linked in: nop_module(PO+) [last unloaded: nop_module] CPU: 4 PID: 757 Comm: sh Tainted: P O 5.10.0-rc5-01361-ge3c1b78c8440-dirty #43 NIP: c00000000008bd74 LR: c00000000008bd50 CTR: c000000000025810 REGS: c000000016f634a0 TRAP: 0300 Tainted: P O (5.10.0-rc5-01361-ge3c1b78c8440-dirty) MSR: 9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 44002884 XER: 00000000 CFAR: c00000000007c68c DAR: c008000008f24a3c DSISR: 42000000 IRQMASK: 1
This results in the kind of issue reported here:
https://lore.kernel.org/linuxppc-dev/[email protected]/
Chris Riedl suggested a reliable way to reproduce the issue:
$ mount -t debugfs none /sys/kernel/debug $ (while true; do echo function > /sys/kernel/debug/tracing/current_tracer ; echo nop > /sys/kernel/debug/tracing/current_tracer ; done) &
Turning ftrace on and off does a large amount of code patching which in usually less then 5min will crash giving a trace like:
ftrace-powerpc: (____ptrval____): replaced (4b473b11) != old (60000000) ------------[ ftrace bug ]------------
ftrace failed to modify
[<c000000000bf8e5c>] napi_busy_loop+0xc/0x390
actual: 11:3b:47:4b
Setting ftrace call site to call ftrace function
ftrace record flags: 80000001
(1)
expected tramp: c00000000006c96c
------------[ cut here ]------------
WARNING: CPU: 4 PID: 809 at kernel/trace/ftrace.c:2065 ftrace_bug+0x28c/0x2e8
Modules linked in: nop_module(PO-) [last unloaded: nop_module]
CPU: 4 PID: 809 Comm: sh Tainted: P O 5.10.0-rc5-01360-gf878ccaf250a #1
NIP: c00000000024f334 LR: c00000000024f330 CTR: c0000000001a5af0
REGS: c000000004c8b760 TRAP: 0700 Tainted: P O (5.10.0-rc5-01360-gf878ccaf250a)
MSR: 900000000282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 28008848 XER: 20040000
CFAR: c0000000001a9c98 IRQMASK: 0
GPR00: c00000000024f330 c000000004c8b9f0 c000000002770600 0000000000000022
GPR04: 00000000ffff7fff c000000004c8b6d0 0000000000000027 c0000007fe9bcdd8
GPR08: 0000000000000023 ffffffffffffffd8 0000000000000027 c000000002613118
GPR12: 0000000000008000 c0000007fffdca00 0000000000000000 0000000000000000
GPR16: 0000000023ec37c5 0000000000000000 0000000000000000 0000000000000008
GPR20: c000000004c8bc90 c0000000027a2d20 c000000004c8bcd0 c000000002612fe8
GPR24: 0000000000000038 0000000000000030 0000000000000028 0000000000000020
GPR28: c000000000ff1b68 c000000000bf8e5c c00000000312f700 c000000000fbb9b0
NIP ftrace_bug+0x28c/0x2e8
LR ftrace_bug+0x288/0x2e8
Call Trace:
ftrace_bug+0x288/0x2e8 (unreliable)
ftrace_modify_all_code+0x168/0x210
arch_ftrace_update_code+0x18/0x30
ftrace_run_update_code+0x44/0xc0
ftrace_startup+0xf8/0x1c0
register_ftrace_function+0x4c/0xc0
function_trace_init+0x80/0xb0
tracing_set_tracer+0x2a4/0x4f0
tracing_set_trace_write+0xd4/0x130
vfs_write+0xf0/0x330
ksys_write+0x84/0x140
system_call_exception+0x14c/0x230
system_call_common+0xf0/0x27cTo fix this when updating kernel memory PTEs using ptesync.
--- arch/powerpc/include/asm/book3s/64/radix.h | 6 ++++-- arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/book3s/64/radix.h +4 -2
@@ -222,8 +222,10 @@ static inline void radix__set_pte_at(struct mm_struct *mm, unsigned long addr,* from ptesync, it should probably go into update_mmu_cache, rather * than set_pte_at (which is used to set ptes unrelated to faults). * -* Spurious faults to vmalloc region are not tolerated, so there is -* a ptesync in flush_cache_vmap. +* Spurious faults from the kernel memory are not tolerated, so there +* is a ptesync in flush_cache_vmap, and __map_kernel_page() follows +* the pte update sequence from ISA Book III 6.10 Translation Table +* Update Synchronization Requirements. */ }
arch/powerpc/mm/book3s64/radix_pgtable.c +2 -2
@@ -108,7 +108,7 @@ static int early_map_kernel_page(unsigned long ea, unsigned long pa, set_the_pte:set_pte_at (&init_mm, ea, ptep,pfn_pte (pfn, flags)); -smp_wmb (); + asmvolatile ("ptesync" : : :"memory" );return 0 ; }
@@ -168,7 +168,7 @@ static int __map_kernel_page(unsigned long ea, unsigned long pa, set_the_pte:set_pte_at (&init_mm, ea, ptep,pfn_pte (pfn, flags)); -smp_wmb (); + asmvolatile ("ptesync" : : :"memory" );return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 507/677 powerpc/pseries: Add key to flags in pSeries_lpar_hpte_updateboltedpp()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit b56d55a5aa4aa9fc166595a7feb57f153ef7b555 ]
The flags argument to plpar_pte_protect() (aka. H_PROTECT), includes the key in bits 9-13, but currently we always set those bits to zero.
In the past that hasn't been a problem because we always used key 0 for the kernel, and updateboltedpp() is only used for kernel mappings.
However since commit d94b827e89dc ("powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation") we are now inadvertently changing the key (to zero) when we call plpar_pte_protect().
That hasn't broken anything because updateboltedpp() is only used for STRICT_KERNEL_RWX, which is currently disabled on 64s due to other bugs.
But we want to fix that, so first we need to pass the key correctly to plpar_pte_protect(). We can't pass our newpp value directly in, we have to convert it into the form expected by the hcall.
The hcall we're using here is H_PROTECT, which is specified in section 14.5.4.1.6 of LoPAPR v1.1.
It takes a flags parameter, and the description for flags says:
* flags: AVPN, pp0, pp1, pp2, key0-key4, n, and for the CMO
option: CMO Option flags as defined in Table 189‚
If you then go to the start of the parent section, 14.5.4.1, on page 405, it says:
Register Linkage (For hcall() tokens 0x04 - 0x18)
* On Call
* R3 function call token
* R4 flags (see Table 178‚ “Page Frame Table Access flags field definition‚” on page 401)
Then you have to go to section 14.5.3, and on page 394 there is a list of hcalls and their tokens (table 176), and there you can see that H_PROTECT == 0x18.
Finally you can look at table 178, on page 401, where it specifies the layout of the bits for the key:
Bit Function
-----------------
50-54 | key0-key4
Those are big-endian bit numbers, converting to normal bit numbers you get bits 9-13, or 0x3e00.
In the kernel we have:
#define HPTE_R_KEY_HI ASM_CONST(0x3000000000000000) #define HPTE_R_KEY_LO ASM_CONST(0x0000000000000e00)
So the LO bits of newpp are already in the right place, and the HI bits need to be shifted down by 48.
--- arch/powerpc/platforms/pseries/lpar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/lpar.c +3 -1
@@ -977,11 +977,13 @@ static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp, slot =pSeries_lpar_hpte_find (vpn, psize, ssize);BUG_ON (slot ==-1 ); - flags = newpp &7 ; + flags = newpp & (HPTE_R_PP |HPTE_R_N );if (mmu_has_feature (MMU_FTR_KERNEL_RO ))/* Move pp0 into bit 8 (IBM 55) */ flags |= (newpp &HPTE_R_PP0 ) >>55 ; + flags |= ((newpp &HPTE_R_KEY_HI ) >>48 ) | (newpp &HPTE_R_KEY_LO ); + lpar_rc =plpar_pte_protect (flags, slot,0 );BUG_ON (lpar_rc !=H_SUCCESS );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 508/677 powerpc/64s: Use htab_convert_pte_flags() in hash__mark_rodata_ro()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 2c02e656a29d5f64193eb93da92781bcf0517146 ]
In hash__mark_rodata_ro() we pass the raw PP_RXXX value to hash__change_memory_range(). That has the effect of setting the key to zero, because PP_RXXX contains no key value.
Fix it by using htab_convert_pte_flags(), which knows how to convert a pgprot into a pp value, including the key.
--- arch/powerpc/mm/book3s64/hash_pgtable.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/mm/book3s64/hash_pgtable.c +4 -2
@@ -428,12 +428,14 @@ static bool hash__change_memory_range(unsigned long start, unsigned long end,void hash__mark_rodata_ro (void ) { -unsigned long start, end; +unsigned long start, end, pp; start = (unsigned long )_stext; end = (unsigned long )__init_begin; -WARN_ON (!hash__change_memory_range (start, end,PP_RXXX )); + pp =htab_convert_pte_flags (pgprot_val (PAGE_KERNEL_ROX ),HPTE_USE_KERNEL_KEY ); + +WARN_ON (!hash__change_memory_range (start, end, pp)); }void hash__mark_initmem_nx (void )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 509/677 powerpc/perf: Fix PMU constraint check for EBB events
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 10f8f96179ecc7f69c927f6d231f6d02736cea83 ]
The power PMU group constraints includes check for EBB events to make sure all events in a group must agree on EBB. This will prevent scheduling EBB and non-EBB events together. But in the existing check, settings for constraint mask and value is interchanged. Patch fixes the same.
Before the patch, PMU selftest "cpu_event_pinned_vs_ebb_test" fails with below in dmesg logs. This happens because EBB event gets enabled along with a non-EBB cpu event.
[35600.453346] cpu_event_pinne[41326]: illegal instruction (4) at 10004a18 nip 10004a18 lr 100049f8 code 1 in cpu_event_pinned_vs_ebb_test[10000000+10000]
Test results after the patch:
$ ./pmu/ebb/cpu_event_pinned_vs_ebb_test test: cpu_event_pinned_vs_ebb tags: git_version:v5.12-rc5-93-gf28c3125acd3-dirty Binding to cpu 8 EBB Handler is at 0x100050c8 read error on event 0x7fffe6bd4040! PM_RUN_INST_CMPL: result 9872 running/enabled 37930432 success: cpu_event_pinned_vs_ebb
This bug was hidden by other logic until commit 1908dc911792 (perf:
Tweak perf_event_attr::exclusive semantics).
--- arch/powerpc/perf/isa207-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/isa207-common.c +2 -2
@@ -447,8 +447,8 @@ ebb_bhrb:* EBB events are pinned & exclusive, so this should never actually * hit, but we leave it as a fallback in case. */ - mask |=CNST_EBB_VAL (ebb); - value |=CNST_EBB_MASK ; + mask |=CNST_EBB_MASK ; + value |=CNST_EBB_VAL (ebb); *maskp = mask; *valp = value;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 510/677 powerpc: iommu: fix build when neither PCI or IBMVIO is set
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit b27dadecdf9102838331b9a0b41ffc1cfe288154 ]
When neither CONFIG_PCI nor CONFIG_IBMVIO is set/enabled, iommu.c has a build error. The fault injection code is not useful in that kernel config, so make the FAIL_IOMMU option depend on PCI || IBMVIO.
Prevents this build error (warning escalated to error):../arch/powerpc/kernel/iommu.c:178:30: error: 'fail_iommu_bus_notifier' defined but not used [-Werror=unused-variable]
178 | static struct notifier_block fail_iommu_bus_notifier = {
--- arch/powerpc/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/Kconfig.debug +1 -0
@@ -353,6 +353,7 @@ config PPC_EARLY_DEBUG_CPM_ADDR config FAIL_IOMMU bool "Fault-injection capability for IOMMU" depends on FAULT_INJECTION + depends on PCI || IBMVIO help Provide fault-injection capability for IOMMU. Each device can be selectively enabled via the fail_iommu property.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 511/677 mac80211: bail out if cipher schemes are invalid
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit db878e27a98106a70315d264cc92230d84009e72 ]
If any of the cipher schemes specified by the driver are invalid, bail out and fail the registration rather than just warning. Otherwise, we might later crash when we try to use the invalid cipher scheme, e.g. if the hdr_len is (significantly) less than the pn_offs + pn_len, we'd have an out-of-bounds access in RX validation.
--- net/mac80211/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/mac80211/main.c +5 -2
@@ -1141,8 +1141,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)if (local->hw.wiphy->max_scan_ie_len) local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; -WARN_ON (!ieee80211_cs_list_valid (local->hw.cipher_schemes, - local->hw.n_cipher_schemes)); +if (WARN_ON (!ieee80211_cs_list_valid (local->hw.cipher_schemes, + local->hw.n_cipher_schemes))) { + result = -EINVAL ; + goto fail_workqueue; + } result =ieee80211_init_cipher_suites (local);if (result <0 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 512/677 perf vendor events amd: Fix broken L2 Cache Hits from L2 HWPF metric
In reply to Greg Kroah-HartmanFrom: Smita Koralahalli <[email protected]>
[ Upstream commit 86c2bc3da769124e3e856b6e9457be3667c30919 ]
Commit 08ed77e414ab2342 ("perf vendor events amd: Add recommended events") added the hits event "L2 Cache Hits from L2 HWPF" with the same metric expression as the accesses event "L2 Cache Accesses from L2 HWPF":
$ perf list --details
...
l2_cache_accesses_from_l2_hwpf
[L2 Cache Accesses from L2 HWPF]
[l2_pf_hit_l2 + l2_pf_miss_l2_hit_l3 + l2_pf_miss_l2_l3]
l2_cache_hits_from_l2_hwpf
[L2 Cache Hits from L2 HWPF]
[l2_pf_hit_l2 + l2_pf_miss_l2_hit_l3 + l2_pf_miss_l2_l3]
...This was wrong and led to counting hits the same as accesses. Section 2.1.15.2 "Performance Measurement" of "PPR for AMD Family 17h Model 31h B0 - 55803 Rev 0.54 - Sep 12, 2019", documents the hits event with EventCode 0x70 which is the same as l2_pf_hit_l2.
Fix this, and massage the description for l2_pf_hit_l2 as the hits event is now the duplicate of l2_pf_hit_l2. AMD recommends using the recommended event over other events if the duplicate exists and maintain both for consistency. Hence, l2_cache_hits_from_l2_hwpf should override l2_pf_hit_l2.
Before:
# perf stat -M l2_cache_accesses_from_l2_hwpf,l2_cache_hits_from_l2_hwpf sleep 1
Performance counter stats for 'sleep 1':
1,436 l2_pf_miss_l2_l3 # 11114.00 l2_cache_accesses_from_l2_hwpf
# 11114.00 l2_cache_hits_from_l2_hwpf
4,482 l2_pf_hit_l2
5,196 l2_pf_miss_l2_hit_l3
1.001765339 seconds time elapsedAfter:
# perf stat -M l2_cache_accesses_from_l2_hwpf sleep 1
Performance counter stats for 'sleep 1':
1,477 l2_pf_miss_l2_l3 # 10442.00 l2_cache_accesses_from_l2_hwpf
3,978 l2_pf_hit_l2
4,987 l2_pf_miss_l2_hit_l31.001491186 seconds time elapsed
# perf stat -e l2_cache_hits_from_l2_hwpf sleep 1
Performance counter stats for 'sleep 1':
3,983 l2_cache_hits_from_l2_hwpf
1.001329970 seconds time elapsedNote the difference in performance counter values for the accesses versus the hits after the fix, and the hits event now counting the same as l2_pf_hit_l2.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206537
--- tools/perf/pmu-events/arch/x86/amdzen1/cache.json | 2 +- tools/perf/pmu-events/arch/x86/amdzen1/recommended.json | 6 +++--- tools/perf/pmu-events/arch/x86/amdzen2/cache.json | 2 +- tools/perf/pmu-events/arch/x86/amdzen2/recommended.json | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)
tools/perf/pmu-events/arch/x86/amdzen1/cache.json +1 -1
@@ -275,7 +275,7 @@ { "EventName": "l2_pf_hit_l2", "EventCode": "0x70", - "BriefDescription": "L2 prefetch hit in L2.", + "BriefDescription": "L2 prefetch hit in L2. Use l2_cache_hits_from_l2_hwpf instead.", "UMask": "0xff" }, {
tools/perf/pmu-events/arch/x86/amdzen1/recommended.json +3 -3
@@ -79,10 +79,10 @@ "UMask": "0x70" }, { - "MetricName": "l2_cache_hits_from_l2_hwpf", + "EventName": "l2_cache_hits_from_l2_hwpf", + "EventCode": "0x70", "BriefDescription": "L2 Cache Hits from L2 HWPF", - "MetricExpr": "l2_pf_hit_l2 + l2_pf_miss_l2_hit_l3 + l2_pf_miss_l2_l3", - "MetricGroup": "l2_cache" + "UMask": "0xff" }, { "EventName": "l3_accesses",
tools/perf/pmu-events/arch/x86/amdzen2/cache.json +1 -1
@@ -205,7 +205,7 @@ { "EventName": "l2_pf_hit_l2", "EventCode": "0x70", - "BriefDescription": "L2 prefetch hit in L2.", + "BriefDescription": "L2 prefetch hit in L2. Use l2_cache_hits_from_l2_hwpf instead.", "UMask": "0xff" }, {
tools/perf/pmu-events/arch/x86/amdzen2/recommended.json +3 -3
@@ -79,10 +79,10 @@ "UMask": "0x70" }, { - "MetricName": "l2_cache_hits_from_l2_hwpf", + "EventName": "l2_cache_hits_from_l2_hwpf", + "EventCode": "0x70", "BriefDescription": "L2 Cache Hits from L2 HWPF", - "MetricExpr": "l2_pf_hit_l2 + l2_pf_miss_l2_hit_l3 + l2_pf_miss_l2_l3", - "MetricGroup": "l2_cache" + "UMask": "0xff" }, { "EventName": "l3_accesses",
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 513/677 RDMA/hns: Fix missing assignment of max_inline_data
In reply to Greg Kroah-HartmanFrom: Weihang Li <[email protected]>
[ Upstream commit 9eab614338cdfe08db343954454fa5191d082a11 ]
When querying QP, the ULPs should be informed of the max length of inline data supported by the hardware.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
@@ -5068,6 +5068,7 @@ done: qp_attr->cur_qp_state = qp_attr->qp_state; qp_attr->cap.max_recv_wr = hr_qp->rq.wqe_cnt; qp_attr->cap.max_recv_sge = hr_qp->rq.max_gs - hr_qp->rq.rsv_sge; + qp_attr->cap.max_inline_data = hr_qp->max_inline_data;if (!ibqp->uobject) { qp_attr->cap.max_send_wr = hr_qp->sq.wqe_cnt;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 514/677 xfs: fix return of uninitialized value in variable error
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 3b6dd9a9aeeada19d0c820ff68e979243a888bb6 ]
A previous commit removed a call to xfs_attr3_leaf_read that assigned an error return code to variable error. We now have a few early error return paths to label 'out' that return error if error is set; however error now is uninitialized so potentially garbage is being returned. Fix this by setting error to zero to restore the original behaviour where error was zero at the label 'restart'.
Addresses-Coverity: ("Uninitialized scalar variable")
--- fs/xfs/libxfs/xfs_attr.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/libxfs/xfs_attr.c +1 -0
@@ -928,6 +928,7 @@ restart:* Search to see if name already exists, and get back a pointer * to where it should go. */ + error =0 ; retval =xfs_attr_node_hasname (args, &state);if (retval != -ENOATTR && retval != -EEXIST ) goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 515/677 rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c9eaee0c2ec6b1002044fb698cdfb5d9ef4ed28c ]
The sscanf() function returns the number of matches (0 or 1 in this case). It doesn't return error codes. We should return -EINVAL if the string is invalid
--- drivers/net/wireless/realtek/rtw88/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/debug.c +1 -1
@@ -270,7 +270,7 @@ static ssize_t rtw_debugfs_set_rsvd_page(struct file *filp,if (num !=2 ) {rtw_warn (rtwdev,"invalid arguments\n" ); -return num; +return -EINVAL ; } debugfs_priv->rsvd_page.page_offset = offset;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 516/677 mt7601u: fix always true expression
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 87fce88658ba047ae62e83497d3f3c5dc22fa6f9 ]
Currently the expression ~nic_conf1 is always true because nic_conf1 is a u16 and according to 6.5.3.3 of the C standard the ~ operator promotes the u16 to an integer before flipping all the bits. Thus the top 16 bits of the integer result are all set so the expression is always true. If the intention was to flip all the bits of nic_conf1 then casting the integer result back to a u16 is a suitabel fix.
Interestingly static analyzers seem to thing a bitwise ! should be used instead of ~ for this scenario, so I think the original intent of the expression may need some extra consideration.
Addresses-Coverity: ("Logical vs. bitwise operator")
--- drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1 -1
@@ -99,7 +99,7 @@ mt7601u_has_tssi(struct mt7601u_dev *dev, u8 *eeprom) {u16 nic_conf1 =get_unaligned_le16 (eeprom +MT_EE_NIC_CONF_1 ); -return ~nic_conf1 && (nic_conf1 &MT_EE_NIC_CONF_1_TX_ALC_EN ); +return (u16 )~nic_conf1 && (nic_conf1 &MT_EE_NIC_CONF_1_TX_ALC_EN ); } static void
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 517/677 mt76: mt7615: fix tx skb dma unmap
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit ebee7885bb12a8fe2c2f9bac87dbd87a05b645f9 ]
The first pointer in the txp needs to be unmapped as well, otherwise it will leak DMA mapping entries
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +1 -1
@@ -690,7 +690,7 @@ mt7615_txp_skb_unmap_fw(struct mt76_dev *dev, struct mt7615_fw_txp *txp) {int i; -for (i =1 ; i < txp->nbuf; i++) +for (i =0 ; i < txp->nbuf; i++)dma_unmap_single (dev->dev,le32_to_cpu (txp->buf[i]),le16_to_cpu (txp->len[i]),DMA_TO_DEVICE ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 518/677 mt76: mt7915: fix tx skb dma unmap
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 7dcf3c04f0aca746517a77433b33d40868ca4749 ]
The first pointer in the txp needs to be unmapped as well, otherwise it will leak DMA mapping entries
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
@@ -1091,7 +1091,7 @@ void mt7915_txp_skb_unmap(struct mt76_dev *dev,int i; txp =mt7915_txwi_to_txp (dev, t); -for (i =1 ; i < txp->nbuf; i++) +for (i =0 ; i < txp->nbuf; i++)dma_unmap_single (dev->dev,le32_to_cpu (txp->buf[i]),le16_to_cpu (txp->len[i]),DMA_TO_DEVICE ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 519/677 mt76: mt7921: fix suspend/resume sequence
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 5e30931494b4940ba74fa5796ca0b6d7e4c84e88 ]
Any pcie access should happen in pci D0 state and we should give ownership back to the device at the end of the suspend procedure.
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +7 -7
@@ -209,12 +209,12 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state)/* disable interrupt */ mt76_wr (dev,MT_WFDMA0_HOST_INT_ENA ,0 ); -pci_save_state (pdev); - err =pci_set_power_state (pdev,pci_choose_state (pdev, state)); + err =mt7921_mcu_fw_pmctrl (dev);if (err) goto restore; - err =mt7921_mcu_drv_pmctrl (dev); +pci_save_state (pdev); + err =pci_set_power_state (pdev,pci_choose_state (pdev, state));if (err) goto restore;
@@ -237,16 +237,16 @@ static int mt7921_pci_resume(struct pci_dev *pdev) struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);int i, err; - err =mt7921_mcu_fw_pmctrl (dev); -if (err <0 ) -return err; - err =pci_set_power_state (pdev,PCI_D0 );if (err)return err;pci_restore_state (pdev); + err =mt7921_mcu_drv_pmctrl (dev); +if (err <0 ) +return err; +/* enable interrupt */ mt7921_l1_wr (dev,MT_PCIE_MAC_INT_ENABLE ,0xff ); mt7921_irq_enable(dev, MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 520/677 mt76: mt7921: fix memory leak in mt7921_coredump_work
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 782b3e86ea970e899f8e723db9f64708a15ca30e ]
Fix possible memory leak in mt7921_coredump_work.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +4 -2
@@ -1503,8 +1503,10 @@ void mt7921_coredump_work(struct work_struct *work)break ;skb_pull (skb,sizeof (struct mt7921_mcu_rxd )); -if (data + skb->len - dump >MT76_CONNAC_COREDUMP_SZ ) -break ; +if (data + skb->len - dump >MT76_CONNAC_COREDUMP_SZ ) { +dev_kfree_skb (skb); +continue ; + }memcpy (data, skb->data, skb->len); data += skb->len;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 521/677 mt76: connac: fix up the setting for ht40 mode in mt76_connac_mcu_uni_add_bss
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit a7e3033fcdb60ad51b03896ae99ad9447389bed0 ]
Use proper value for ht40 mode configuration in mt76_connac_mcu_uni_add_bss routine and not ht20 one
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +2 -0
@@ -1195,6 +1195,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, .center_chan = ieee80211_frequency_to_channel(freq1), .center_chan2 = ieee80211_frequency_to_channel(freq2), .tx_streams = hweight8(phy->antenna_mask), + .ht_op_info = 4, /* set HT 40M allowed */ .rx_streams = phy->chainmask, .short_st = true, },
@@ -1287,6 +1288,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,case NL80211_CHAN_WIDTH_20 :default : rlm_req.rlm.bw =CMD_CBW_20MHZ ; + rlm_req.rlm.ht_op_info =0 ;break ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 522/677 mt76: mt7921: fixup rx bitrate statistics
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 0940605a2a70803fc3362eeccba4c31adf4e70e7 ]
Since the related rx bitrate fields have been moved to group3 in Rxv, fix rx bitrate statistics in mt7921_mac_fill_rx routine.
--- .../net/wireless/mediatek/mt76/mt7921/mac.c | 155 +++++++++--------- .../net/wireless/mediatek/mt76/mt7921/mac.h | 10 +- 2 files changed, 86 insertions(+), 79 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +78 -77
@@ -400,7 +400,9 @@ int mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)/* RXD Group 3 - P-RXV */ if (rxd1 &MT_RXD1_NORMAL_GROUP_3 ) { -u32 v0, v1, v2; +u8 stbc, gi; +u32 v0, v1; +bool cck; rxv = rxd; rxd +=2 ;
@@ -409,7 +411,6 @@ int mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) v0 =le32_to_cpu (rxv[0 ]); v1 =le32_to_cpu (rxv[1 ]); - v2 =le32_to_cpu (rxv[2 ]);if (v0 &MT_PRXV_HT_AD_CODE ) status->enc_flags |=RX_ENC_FLAG_LDPC ;
@@ -429,87 +430,87 @@ int mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) status->chain_signal[i]); } -/* RXD Group 5 - C-RXV */ -if (rxd1 &MT_RXD1_NORMAL_GROUP_5 ) { -u8 stbc =FIELD_GET (MT_CRXV_HT_STBC , v2); -u8 gi =FIELD_GET (MT_CRXV_HT_SHORT_GI , v2); -bool cck = false; + stbc =FIELD_GET (MT_PRXV_STBC , v0); + gi =FIELD_GET (MT_PRXV_SGI , v0); + cck = false; - rxd +=18 ; -if ((u8 *)rxd - skb->data >= skb->len) -return -EINVAL ; + idx = i =FIELD_GET (MT_PRXV_TX_RATE , v0); + mode =FIELD_GET (MT_PRXV_TX_MODE , v0); - idx = i =FIELD_GET (MT_PRXV_TX_RATE , v0); - mode =FIELD_GET (MT_CRXV_TX_MODE , v2); - -switch (mode) { -case MT_PHY_TYPE_CCK : - cck = true; - fallthrough; -case MT_PHY_TYPE_OFDM : - i =mt76_get_rate (&dev->mt76, sband, i, cck); -break ; -case MT_PHY_TYPE_HT_GF : -case MT_PHY_TYPE_HT : - status->encoding =RX_ENC_HT ; -if (i >31 ) -return -EINVAL ; -break ; -case MT_PHY_TYPE_VHT : - status->nss = -FIELD_GET (MT_PRXV_NSTS , v0) +1 ; - status->encoding =RX_ENC_VHT ; -if (i >9 ) -return -EINVAL ; -break ; -case MT_PHY_TYPE_HE_MU : - status->flag |=RX_FLAG_RADIOTAP_HE_MU ; - fallthrough; -case MT_PHY_TYPE_HE_SU : -case MT_PHY_TYPE_HE_EXT_SU : -case MT_PHY_TYPE_HE_TB : - status->nss = -FIELD_GET (MT_PRXV_NSTS , v0) +1 ; - status->encoding =RX_ENC_HE ; - status->flag |=RX_FLAG_RADIOTAP_HE ; - i &=GENMASK (3 ,0 ); - -if (gi <=NL80211_RATE_INFO_HE_GI_3_2 ) - status->he_gi = gi; - - status->he_dcm = !!(idx &MT_PRXV_TX_DCM ); -break ; -default : +switch (mode) { +case MT_PHY_TYPE_CCK : + cck = true; + fallthrough; +case MT_PHY_TYPE_OFDM : + i =mt76_get_rate (&dev->mt76, sband, i, cck); +break ; +case MT_PHY_TYPE_HT_GF : +case MT_PHY_TYPE_HT : + status->encoding =RX_ENC_HT ; +if (i >31 )return -EINVAL ; - } - status->rate_idx = i; - -switch (FIELD_GET (MT_CRXV_FRAME_MODE , v2)) { -case IEEE80211_STA_RX_BW_20 : -break ; -case IEEE80211_STA_RX_BW_40 : -if (mode &MT_PHY_TYPE_HE_EXT_SU && - (idx &MT_PRXV_TX_ER_SU_106T )) { - status->bw =RATE_INFO_BW_HE_RU ; - status->he_ru = -NL80211_RATE_INFO_HE_RU_ALLOC_106 ; - }else { - status->bw =RATE_INFO_BW_40 ; - } -break ; -case IEEE80211_STA_RX_BW_80 : - status->bw =RATE_INFO_BW_80 ; -break ; -case IEEE80211_STA_RX_BW_160 : - status->bw =RATE_INFO_BW_160 ; -break ; -default : +break ; +case MT_PHY_TYPE_VHT : + status->nss = +FIELD_GET (MT_PRXV_NSTS , v0) +1 ; + status->encoding =RX_ENC_VHT ; +if (i >9 )return -EINVAL ; +break ; +case MT_PHY_TYPE_HE_MU : + status->flag |=RX_FLAG_RADIOTAP_HE_MU ; + fallthrough; +case MT_PHY_TYPE_HE_SU : +case MT_PHY_TYPE_HE_EXT_SU : +case MT_PHY_TYPE_HE_TB : + status->nss = +FIELD_GET (MT_PRXV_NSTS , v0) +1 ; + status->encoding =RX_ENC_HE ; + status->flag |=RX_FLAG_RADIOTAP_HE ; + i &=GENMASK (3 ,0 ); + +if (gi <=NL80211_RATE_INFO_HE_GI_3_2 ) + status->he_gi = gi; + + status->he_dcm = !!(idx &MT_PRXV_TX_DCM ); +break ; +default : +return -EINVAL ; + } + + status->rate_idx = i; + +switch (FIELD_GET (MT_PRXV_FRAME_MODE , v0)) { +case IEEE80211_STA_RX_BW_20 : +break ; +case IEEE80211_STA_RX_BW_40 : +if (mode &MT_PHY_TYPE_HE_EXT_SU && + (idx &MT_PRXV_TX_ER_SU_106T )) { + status->bw =RATE_INFO_BW_HE_RU ; + status->he_ru = +NL80211_RATE_INFO_HE_RU_ALLOC_106 ; + }else { + status->bw =RATE_INFO_BW_40 ; } +break ; +case IEEE80211_STA_RX_BW_80 : + status->bw =RATE_INFO_BW_80 ; +break ; +case IEEE80211_STA_RX_BW_160 : + status->bw =RATE_INFO_BW_160 ; +break ; +default : +return -EINVAL ; + } + + status->enc_flags |=RX_ENC_FLAG_STBC_MASK * stbc; +if (mode <MT_PHY_TYPE_HE_SU && gi) + status->enc_flags |=RX_ENC_FLAG_SHORT_GI ; - status->enc_flags |=RX_ENC_FLAG_STBC_MASK * stbc; -if (mode <MT_PHY_TYPE_HE_SU && gi) - status->enc_flags |=RX_ENC_FLAG_SHORT_GI ; +if (rxd1 &MT_RXD1_NORMAL_GROUP_5 ) { + rxd +=18 ; +if ((u8 *)rxd - skb->data >= skb->len) +return -EINVAL ; } }
drivers/net/wireless/mediatek/mt76/mt7921/mac.h +8 -2
@@ -97,18 +97,24 @@ enum rx_pkt_type {#define MT_RXD3_NORMAL_PF_MODE BIT(29)#define MT_RXD3_NORMAL_PF_STS GENMASK(31, 30) -/* P-RXV */ +/* P-RXV DW0 */ #define MT_PRXV_TX_RATE GENMASK(6, 0)#define MT_PRXV_TX_DCM BIT(4)#define MT_PRXV_TX_ER_SU_106T BIT(5)#define MT_PRXV_NSTS GENMASK(9, 7)#define MT_PRXV_HT_AD_CODE BIT(11) +#define MT_PRXV_FRAME_MODE GENMASK(14, 12) +#define MT_PRXV_SGI GENMASK(16, 15) +#define MT_PRXV_STBC GENMASK(23, 22) +#define MT_PRXV_TX_MODE GENMASK(27, 24)#define MT_PRXV_HE_RU_ALLOC_L GENMASK(31, 28) -#define MT_PRXV_HE_RU_ALLOC_H GENMASK(3, 0) + +/* P-RXV DW1 */ #define MT_PRXV_RCPI3 GENMASK(31, 24)#define MT_PRXV_RCPI2 GENMASK(23, 16)#define MT_PRXV_RCPI1 GENMASK(15, 8)#define MT_PRXV_RCPI0 GENMASK(7, 0) +#define MT_PRXV_HE_RU_ALLOC_H GENMASK(3, 0)/* C-RXV */ #define MT_CRXV_HT_STBC GENMASK(1, 0)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 523/677 mt76: mt7615: fix memory leak in mt7615_coredump_work
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 49cc85059a2cb656f96ff3693f891e8fe8f669a9 ]
Similar to the issue fixed in mt7921_coredump_work, fix a possible memory leak in mt7615_coredump_work routine.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +4 -2
@@ -2308,8 +2308,10 @@ void mt7615_coredump_work(struct work_struct *work)break ;skb_pull (skb,sizeof (struct mt7615_mcu_rxd )); -if (data + skb->len - dump >MT76_CONNAC_COREDUMP_SZ ) -break ; +if (data + skb->len - dump >MT76_CONNAC_COREDUMP_SZ ) { +dev_kfree_skb (skb); +continue ; + }memcpy (data, skb->data, skb->len); data += skb->len;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 524/677 mt76: mt7921: fix aggr length histogram
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 461e3b7f45766f38eeb24ca7354ff01d993b5b47 ]
Fix register definitions for 802.11 aggr length histogram estimation.
--- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 5 ++--- drivers/net/wireless/mediatek/mt76/mt7921/regs.h | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +2 -3
@@ -44,14 +44,13 @@ mt7921_ampdu_stat_read_phy(struct mt7921_phy *phy, range[i] =mt76_rr (dev,MT_MIB_ARNG (0 , i));for (i =0 ; i <ARRAY_SIZE (bound); i++) - bound[i] =MT_MIB_ARNCR_RANGE (range[i /4 ], i) +1 ; + bound[i] =MT_MIB_ARNCR_RANGE (range[i /4 ], i %4 ) +1 ;seq_printf (file,"\nPhy0\n" );seq_printf (file,"Length: %8d | " , bound[0 ]);for (i =0 ; i <ARRAY_SIZE (bound) -1 ; i++) -seq_printf (file,"%3d -%3d | " , - bound[i] +1 , bound[i +1 ]); +seq_printf (file,"%3d %3d | " , bound[i] +1 , bound[i +1 ]);seq_puts (file,"\nCount: " );for (i =0 ; i <ARRAY_SIZE (bound); i++)
drivers/net/wireless/mediatek/mt76/mt7921/regs.h +3 -3
@@ -128,9 +128,9 @@#define MT_MIB_MB_SDR2 (_band, n) MT_WF_MIB(_band, 0x108 + ((n) << 4))#define MT_MIB_FRAME_RETRIES_COUNT_MASK GENMASK(15, 0) -#define MT_TX_AGG_CNT (_band, n) MT_WF_MIB(_band, 0x0a8 + ((n) << 2)) -#define MT_TX_AGG_CNT2 (_band, n) MT_WF_MIB(_band, 0x164 + ((n) << 2)) -#define MT_MIB_ARNG (_band, n) MT_WF_MIB(_band, 0x4b8 + ((n) << 2)) +#define MT_TX_AGG_CNT (_band, n) MT_WF_MIB(_band, 0x7dc + ((n) << 2)) +#define MT_TX_AGG_CNT2 (_band, n) MT_WF_MIB(_band, 0x7ec + ((n) << 2)) +#define MT_MIB_ARNG (_band, n) MT_WF_MIB(_band, 0x0b0 + ((n) << 2))#define MT_MIB_ARNCR_RANGE (val, n) (((val) >> ((n) << 3)) & GENMASK(7, 0))#define MT_WTBLON_TOP_BASE 0x34000
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 525/677 mt76: mt7915: fix aggr len debugfs node
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 9fb9d755fae20b5ad62ef8b4e9289e5baea2c6fc ]
Similar to mt7921, fix 802.11 aggr len debugfs reporting for mt7915 driver.
--- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +1 -1
@@ -124,7 +124,7 @@ mt7915_ampdu_stat_read_phy(struct mt7915_phy *phy, range[i] =mt76_rr (dev,MT_MIB_ARNG (ext_phy, i));for (i =0 ; i <ARRAY_SIZE (bound); i++) - bound[i] =MT_MIB_ARNCR_RANGE (range[i /4 ], i) +1 ; + bound[i] =MT_MIB_ARNCR_RANGE (range[i /4 ], i %4 ) +1 ;seq_printf (file,"\nPhy %d\n" , ext_phy);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 526/677 mt76: mt7921: fix stats register definitions
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit f76e9019913bffee0e49b096068e6f6b12f9b0e0 ]
Fix register definitions for mac80211 stats reporting. Move mib counter reset to mt7921_get_stats routine.
--- .../net/wireless/mediatek/mt76/mt7921/mac.c | 31 ++++++------------- .../net/wireless/mediatek/mt76/mt7921/main.c | 6 ++++ .../wireless/mediatek/mt76/mt7921/mt7921.h | 10 +++--- .../net/wireless/mediatek/mt76/mt7921/regs.h | 15 ++++++--- 4 files changed, 31 insertions(+), 31 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +10 -21
@@ -1318,31 +1318,20 @@ mt7921_mac_update_mib_stats(struct mt7921_phy *phy)struct mib_stats *mib = &phy->mib;int i, aggr0 =0 , aggr1; -memset (mib,0 ,sizeof (*mib)); - - mib->fcs_err_cnt =mt76_get_field (dev,MT_MIB_SDR3 (0 ), -MT_MIB_SDR3_FCS_ERR_MASK ); + mib->fcs_err_cnt +=mt76_get_field (dev,MT_MIB_SDR3 (0 ), +MT_MIB_SDR3_FCS_ERR_MASK ); + mib->ack_fail_cnt +=mt76_get_field (dev,MT_MIB_MB_BSDR3 (0 ), +MT_MIB_ACK_FAIL_COUNT_MASK ); + mib->ba_miss_cnt +=mt76_get_field (dev,MT_MIB_MB_BSDR2 (0 ), +MT_MIB_BA_FAIL_COUNT_MASK ); + mib->rts_cnt +=mt76_get_field (dev,MT_MIB_MB_BSDR0 (0 ), +MT_MIB_RTS_COUNT_MASK ); + mib->rts_retries_cnt +=mt76_get_field (dev,MT_MIB_MB_BSDR1 (0 ), +MT_MIB_RTS_FAIL_COUNT_MASK );for (i =0 , aggr1 = aggr0 +4 ; i <4 ; i++) {u32 val, val2; - val =mt76_rr (dev,MT_MIB_MB_SDR1 (0 , i)); - - val2 =FIELD_GET (MT_MIB_ACK_FAIL_COUNT_MASK , val); -if (val2 > mib->ack_fail_cnt) - mib->ack_fail_cnt = val2; - - val2 =FIELD_GET (MT_MIB_BA_MISS_COUNT_MASK , val); -if (val2 > mib->ba_miss_cnt) - mib->ba_miss_cnt = val2; - - val =mt76_rr (dev,MT_MIB_MB_SDR0 (0 , i)); - val2 =FIELD_GET (MT_MIB_RTS_RETRIES_COUNT_MASK , val); -if (val2 > mib->rts_retries_cnt) { - mib->rts_cnt =FIELD_GET (MT_MIB_RTS_COUNT_MASK , val); - mib->rts_retries_cnt = val2; - } - val =mt76_rr (dev,MT_TX_AGG_CNT (0 , i)); val2 =mt76_rr (dev,MT_TX_AGG_CNT2 (0 , i));
drivers/net/wireless/mediatek/mt76/mt7921/main.c +6 -0
@@ -814,11 +814,17 @@ mt7921_get_stats(struct ieee80211_hw *hw,struct mt7921_phy *phy =mt7921_hw_phy (hw);struct mib_stats *mib = &phy->mib; +mt7921_mutex_acquire (phy->dev); + stats->dot11RTSSuccessCount = mib->rts_cnt; stats->dot11RTSFailureCount = mib->rts_retries_cnt; stats->dot11FCSErrorCount = mib->fcs_err_cnt; stats->dot11ACKFailureCount = mib->ack_fail_cnt; +memset (mib,0 ,sizeof (*mib)); + +mt7921_mutex_release (phy->dev); +return 0 ; }
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +5 -5
@@ -102,11 +102,11 @@ struct mt7921_vif { };struct mib_stats { -u16 ack_fail_cnt; -u16 fcs_err_cnt; -u16 rts_cnt; -u16 rts_retries_cnt; -u16 ba_miss_cnt; +u32 ack_fail_cnt; +u32 fcs_err_cnt; +u32 rts_cnt; +u32 rts_retries_cnt; +u32 ba_miss_cnt; };struct mt7921_phy {
drivers/net/wireless/mediatek/mt76/mt7921/regs.h +10 -5
@@ -96,8 +96,8 @@#define MT_WF_MIB_BASE (_band) ((_band) ? 0xa4800 : 0x24800)#define MT_WF_MIB (_band, ofs) (MT_WF_MIB_BASE(_band) + (ofs)) -#define MT_MIB_SDR3 (_band) MT_WF_MIB(_band, 0x014) -#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(15, 0) +#define MT_MIB_SDR3 (_band) MT_WF_MIB(_band, 0x698) +#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(31, 16)#define MT_MIB_SDR9 (_band) MT_WF_MIB(_band, 0x02c)#define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0)
@@ -121,9 +121,14 @@#define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16)#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0) -#define MT_MIB_MB_SDR1 (_band, n) MT_WF_MIB(_band, 0x104 + ((n) << 4)) -#define MT_MIB_BA_MISS_COUNT_MASK GENMASK(15, 0) -#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(31, 16) +#define MT_MIB_MB_BSDR0 (_band) MT_WF_MIB(_band, 0x688) +#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0) +#define MT_MIB_MB_BSDR1 (_band) MT_WF_MIB(_band, 0x690) +#define MT_MIB_RTS_FAIL_COUNT_MASK GENMASK(15, 0) +#define MT_MIB_MB_BSDR2 (_band) MT_WF_MIB(_band, 0x518) +#define MT_MIB_BA_FAIL_COUNT_MASK GENMASK(15, 0) +#define MT_MIB_MB_BSDR3 (_band) MT_WF_MIB(_band, 0x520) +#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(15, 0)#define MT_MIB_MB_SDR2 (_band, n) MT_WF_MIB(_band, 0x108 + ((n) << 4))#define MT_MIB_FRAME_RETRIES_COUNT_MASK GENMASK(15, 0)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 527/677 mt76: mt7615: fix TSF configuration
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit a4a5a430b076860691e95337787bc666c8ab28ff ]
The index of TSF counters should follow HWBSSID.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 6 +++++- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 16 ++++++++++++++-- drivers/net/wireless/mediatek/mt76/mt7615/regs.h | 7 ++++--- .../net/wireless/mediatek/mt76/mt7615/usb_sdio.c | 6 +++++- 4 files changed, 28 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +5 -1
@@ -966,6 +966,7 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,struct mt7615_dev *dev = phy->dev;struct mt7615_rate_desc rd;u32 w5, w27, addr; +u16 idx = sta->vif->mt76.omac_idx;if (!mt76_is_mmio (&dev->mt76)) {mt7615_mac_queue_rate_update (phy, sta, probe_rate, rates);
@@ -1017,7 +1018,10 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,mt76_wr (dev, addr +27 *4 , w27); -mt76_set (dev,MT_LPON_T0CR ,MT_LPON_T0CR_MODE );/* TSF read */ + idx = idx >HW_BSSID_MAX ?HW_BSSID_0 : idx; + addr = idx >1 ?MT_LPON_TCR2 (idx):MT_LPON_TCR0 (idx); + +mt76_set (dev, addr,MT_LPON_TCR_MODE );/* TSF read */ sta->rate_set_tsf =mt76_rr (dev,MT_LPON_UTTR0 ) & ~BIT (0 ); sta->rate_set_tsf |= rd.rateset;
drivers/net/wireless/mediatek/mt76/mt7615/main.c +14 -2
@@ -814,15 +814,21 @@ mt7615_get_stats(struct ieee80211_hw *hw,static u64 mt7615_get_tsf (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { +struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;struct mt7615_dev *dev =mt7615_hw_dev (hw);union {u64 t64;u32 t32[2 ]; } tsf; +u16 idx = mvif->mt76.omac_idx; +u32 reg; + + idx = idx >HW_BSSID_MAX ?HW_BSSID_0 : idx; + reg = idx >1 ?MT_LPON_TCR2 (idx):MT_LPON_TCR0 (idx);mt7615_mutex_acquire (dev); -mt76_set (dev,MT_LPON_T0CR ,MT_LPON_T0CR_MODE );/* TSF read */ +mt76_set (dev, reg,MT_LPON_TCR_MODE );/* TSF read */ tsf.t32[0 ] =mt76_rr (dev,MT_LPON_UTTR0 ); tsf.t32[1 ] =mt76_rr (dev,MT_LPON_UTTR1 );
@@ -835,18 +841,24 @@ static void mt7615_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 timestamp) { + struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;struct mt7615_dev *dev =mt7615_hw_dev (hw);union {u64 t64;u32 t32[2 ]; } tsf = { .t64 = timestamp, }; +u16 idx = mvif->mt76.omac_idx; +u32 reg; + + idx = idx >HW_BSSID_MAX ?HW_BSSID_0 : idx; + reg = idx >1 ?MT_LPON_TCR2 (idx):MT_LPON_TCR0 (idx);mt7615_mutex_acquire (dev);mt76_wr (dev,MT_LPON_UTTR0 , tsf.t32[0 ]);mt76_wr (dev,MT_LPON_UTTR1 , tsf.t32[1 ]);/* TSF software overwrite */ -mt76_set (dev,MT_LPON_T0CR ,MT_LPON_T0CR_WRITE ); +mt76_set (dev, reg,MT_LPON_TCR_WRITE );mt7615_mutex_release (dev); }
drivers/net/wireless/mediatek/mt76/mt7615/regs.h +4 -3
@@ -447,9 +447,10 @@ enum mt7615_reg_base {#define MT_LPON (_n) ((dev)->reg_map[MT_LPON_BASE] + (_n)) -#define MT_LPON_T0CR MT_LPON(0x010) -#define MT_LPON_T0CR_MODE GENMASK(1, 0) -#define MT_LPON_T0CR_WRITE BIT(0) +#define MT_LPON_TCR0 (_n) MT_LPON(0x010 + ((_n) * 4)) +#define MT_LPON_TCR2 (_n) MT_LPON(0x0f8 + ((_n) - 2) * 4) +#define MT_LPON_TCR_MODE GENMASK(1, 0) +#define MT_LPON_TCR_WRITE BIT(0)#define MT_LPON_UTTR0 MT_LPON(0x018)#define MT_LPON_UTTR1 MT_LPON(0x01c)
drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c +5 -1
@@ -67,6 +67,7 @@ static int mt7663_usb_sdio_set_rates(struct mt7615_dev *dev,struct mt7615_rate_desc *rate = &wrd->rate;struct mt7615_sta *sta = wrd->sta;u32 w5, w27, addr, val; +u16 idx = sta->vif->mt76.omac_idx;lockdep_assert_held (&dev->mt76.mutex);
@@ -118,7 +119,10 @@ static int mt7663_usb_sdio_set_rates(struct mt7615_dev *dev, sta->rate_probe = sta->rateset[rate->rateset].probe_rate.idx !=-1 ; -mt76_set (dev,MT_LPON_T0CR ,MT_LPON_T0CR_MODE );/* TSF read */ + idx = idx >HW_BSSID_MAX ?HW_BSSID_0 : idx; + addr = idx >1 ?MT_LPON_TCR2 (idx):MT_LPON_TCR0 (idx); + +mt76_set (dev, addr,MT_LPON_TCR_MODE );/* TSF read */ val =mt76_rr (dev,MT_LPON_UTTR0 ); sta->rate_set_tsf = (val & ~BIT (0 )) | rate->rateset;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 528/677 mt76: mt7615: fix mib stats counter reporting to mac80211
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 2eb6f6c437745bce46bd7a8f3a22a732d5b9becb ]
In order to properly report MIB counters to mac80211, resets stats in mt7615_get_stats routine and hold mt76 mutex accessing MIB counters. Sum up MIB counters in mt7615_mac_update_mib_stats routine.
--- .../net/wireless/mediatek/mt76/mt7615/mac.c | 26 ++++++------------- .../net/wireless/mediatek/mt76/mt7615/main.c | 6 +++++ .../wireless/mediatek/mt76/mt7615/mt7615.h | 10 +++---- 3 files changed, 19 insertions(+), 23 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +8 -18
@@ -1825,10 +1825,8 @@ mt7615_mac_update_mib_stats(struct mt7615_phy *phy)int i, aggr;u32 val, val2; -memset (mib,0 ,sizeof (*mib)); - - mib->fcs_err_cnt =mt76_get_field (dev,MT_MIB_SDR3 (ext_phy), -MT_MIB_SDR3_FCS_ERR_MASK ); + mib->fcs_err_cnt +=mt76_get_field (dev,MT_MIB_SDR3 (ext_phy), +MT_MIB_SDR3_FCS_ERR_MASK ); val =mt76_get_field (dev,MT_MIB_SDR14 (ext_phy),MT_MIB_AMPDU_MPDU_COUNT );
@@ -1841,24 +1839,16 @@ mt7615_mac_update_mib_stats(struct mt7615_phy *phy) aggr = ext_phy ?ARRAY_SIZE (dev->mt76.aggr_stats) /2 :0 ;for (i =0 ; i <4 ; i++) { val =mt76_rr (dev,MT_MIB_MB_SDR1 (ext_phy, i)); - - val2 =FIELD_GET (MT_MIB_ACK_FAIL_COUNT_MASK , val); -if (val2 > mib->ack_fail_cnt) - mib->ack_fail_cnt = val2; - - val2 =FIELD_GET (MT_MIB_BA_MISS_COUNT_MASK , val); -if (val2 > mib->ba_miss_cnt) - mib->ba_miss_cnt = val2; + mib->ba_miss_cnt +=FIELD_GET (MT_MIB_BA_MISS_COUNT_MASK , val); + mib->ack_fail_cnt +=FIELD_GET (MT_MIB_ACK_FAIL_COUNT_MASK , + val); val =mt76_rr (dev,MT_MIB_MB_SDR0 (ext_phy, i)); - val2 =FIELD_GET (MT_MIB_RTS_RETRIES_COUNT_MASK , val); -if (val2 > mib->rts_retries_cnt) { - mib->rts_cnt =FIELD_GET (MT_MIB_RTS_COUNT_MASK , val); - mib->rts_retries_cnt = val2; - } + mib->rts_cnt +=FIELD_GET (MT_MIB_RTS_COUNT_MASK , val); + mib->rts_retries_cnt +=FIELD_GET (MT_MIB_RTS_RETRIES_COUNT_MASK , + val); val =mt76_rr (dev,MT_TX_AGG_CNT (ext_phy, i)); - dev->mt76.aggr_stats[aggr++] += val &0xffff ; dev->mt76.aggr_stats[aggr++] += val >>16 ; }
drivers/net/wireless/mediatek/mt76/mt7615/main.c +6 -0
@@ -803,11 +803,17 @@ mt7615_get_stats(struct ieee80211_hw *hw,struct mt7615_phy *phy =mt7615_hw_phy (hw);struct mib_stats *mib = &phy->mib; +mt7615_mutex_acquire (phy->dev); + stats->dot11RTSSuccessCount = mib->rts_cnt; stats->dot11RTSFailureCount = mib->rts_retries_cnt; stats->dot11FCSErrorCount = mib->fcs_err_cnt; stats->dot11ACKFailureCount = mib->ack_fail_cnt; +memset (mib,0 ,sizeof (*mib)); + +mt7615_mutex_release (phy->dev); +return 0 ; }
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +5 -5
@@ -133,11 +133,11 @@ struct mt7615_vif { };struct mib_stats { -u16 ack_fail_cnt; -u16 fcs_err_cnt; -u16 rts_cnt; -u16 rts_retries_cnt; -u16 ba_miss_cnt; +u32 ack_fail_cnt; +u32 fcs_err_cnt; +u32 rts_cnt; +u32 rts_retries_cnt; +u32 ba_miss_cnt;unsigned long aggr_per; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 529/677 mt76: mt7915: fix mib stats counter reporting to mac80211
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 2b35050a321865859fd2f12a3c18ed7be27858c9 ]
In order to properly report MIB counters to mac80211, resets stats in mt7915_get_stats routine() and hold mt76 mutex accessing MIB counters. Sum up MIB counters in mt7915_mac_update_mib_stats routine.
--- .../net/wireless/mediatek/mt76/mt7915/mac.c | 35 +++++++------------ .../net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++ .../wireless/mediatek/mt76/mt7915/mt7915.h | 10 +++--- 3 files changed, 24 insertions(+), 27 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +13 -22
@@ -1633,39 +1633,30 @@ mt7915_mac_update_mib_stats(struct mt7915_phy *phy)bool ext_phy = phy != &dev->phy;int i, aggr0, aggr1; -memset (mib,0 ,sizeof (*mib)); - - mib->fcs_err_cnt =mt76_get_field (dev,MT_MIB_SDR3 (ext_phy), -MT_MIB_SDR3_FCS_ERR_MASK ); + mib->fcs_err_cnt +=mt76_get_field (dev,MT_MIB_SDR3 (ext_phy), +MT_MIB_SDR3_FCS_ERR_MASK ); aggr0 = ext_phy ?ARRAY_SIZE (dev->mt76.aggr_stats) /2 :0 ;for (i =0 , aggr1 = aggr0 +4 ; i <4 ; i++) { -u32 val, val2; +u32 val; val =mt76_rr (dev,MT_MIB_MB_SDR1 (ext_phy, i)); - - val2 =FIELD_GET (MT_MIB_ACK_FAIL_COUNT_MASK , val); -if (val2 > mib->ack_fail_cnt) - mib->ack_fail_cnt = val2; - - val2 =FIELD_GET (MT_MIB_BA_MISS_COUNT_MASK , val); -if (val2 > mib->ba_miss_cnt) - mib->ba_miss_cnt = val2; + mib->ba_miss_cnt +=FIELD_GET (MT_MIB_BA_MISS_COUNT_MASK , val); + mib->ack_fail_cnt += +FIELD_GET (MT_MIB_ACK_FAIL_COUNT_MASK , val); val =mt76_rr (dev,MT_MIB_MB_SDR0 (ext_phy, i)); - val2 =FIELD_GET (MT_MIB_RTS_RETRIES_COUNT_MASK , val); -if (val2 > mib->rts_retries_cnt) { - mib->rts_cnt =FIELD_GET (MT_MIB_RTS_COUNT_MASK , val); - mib->rts_retries_cnt = val2; - } + mib->rts_cnt +=FIELD_GET (MT_MIB_RTS_COUNT_MASK , val); + mib->rts_retries_cnt += +FIELD_GET (MT_MIB_RTS_RETRIES_COUNT_MASK , val); val =mt76_rr (dev,MT_TX_AGG_CNT (ext_phy, i)); - val2 =mt76_rr (dev,MT_TX_AGG_CNT2 (ext_phy, i)); - dev->mt76.aggr_stats[aggr0++] += val &0xffff ; dev->mt76.aggr_stats[aggr0++] += val >>16 ; - dev->mt76.aggr_stats[aggr1++] += val2 &0xffff ; - dev->mt76.aggr_stats[aggr1++] += val2 >>16 ; + + val =mt76_rr (dev,MT_TX_AGG_CNT2 (ext_phy, i)); + dev->mt76.aggr_stats[aggr1++] += val &0xffff ; + dev->mt76.aggr_stats[aggr1++] += val >>16 ; } }
drivers/net/wireless/mediatek/mt76/mt7915/main.c +6 -0
@@ -717,13 +717,19 @@ mt7915_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) {struct mt7915_phy *phy =mt7915_hw_phy (hw); +struct mt7915_dev *dev =mt7915_hw_dev (hw);struct mib_stats *mib = &phy->mib; +mutex_lock (&dev->mt76.mutex); stats->dot11RTSSuccessCount = mib->rts_cnt; stats->dot11RTSFailureCount = mib->rts_retries_cnt; stats->dot11FCSErrorCount = mib->fcs_err_cnt; stats->dot11ACKFailureCount = mib->ack_fail_cnt; +memset (mib,0 ,sizeof (*mib)); + +mutex_unlock (&dev->mt76.mutex); +return 0 ; }
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +5 -5
@@ -108,11 +108,11 @@ struct mt7915_vif { };struct mib_stats { -u16 ack_fail_cnt; -u16 fcs_err_cnt; -u16 rts_cnt; -u16 rts_retries_cnt; -u16 ba_miss_cnt; +u32 ack_fail_cnt; +u32 fcs_err_cnt; +u32 rts_cnt; +u32 rts_retries_cnt; +u32 ba_miss_cnt; };struct mt7915_hif {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 530/677 mt76: connac: fix kernel warning adding monitor interface
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit c996f0346e40e3b1ac2ebaf0681df898fb157f60 ]
Fix the following kernel warning adding a monitor interface in mt76_connac_mcu_uni_add_dev routine.
[ 507.984882] ------------[ cut here ]------------ [ 507.989515] WARNING: CPU: 1 PID: 3017 at mt76_connac_mcu_uni_add_dev+0x178/0x190 [mt76_connac_lib] [ 508.059379] CPU: 1 PID: 3017 Comm: ifconfig Not tainted 5.4.98 #0 [ 508.065461] Hardware name: MT7622_MT7531 RFB (DT) [ 508.070156] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 508.074939] pc : mt76_connac_mcu_uni_add_dev+0x178/0x190 [mt76_connac_lib] [ 508.081806] lr : mt7921_eeprom_init+0x1288/0x1cb8 [mt7921e] [ 508.087367] sp : ffffffc013a33930 [ 508.090671] x29: ffffffc013a33930 x28: ffffff801e628ac0 [ 508.095973] x27: ffffff801c7f1200 x26: ffffff801c7eb008 [ 508.101275] x25: ffffff801c7eaef0 x24: ffffff801d025610 [ 508.106577] x23: ffffff801d022990 x22: ffffff801d024de8 [ 508.111879] x21: ffffff801d0226a0 x20: ffffff801c7eaee8 [ 508.117181] x19: ffffff801d0226a0 x18: 000000005d00b000 [ 508.122482] x17: 00000000ffffffff x16: 0000000000000000 [ 508.127785] x15: 0000000000000080 x14: ffffff801d704000 [ 508.133087] x13: 0000000000000040 x12: 0000000000000002 [ 508.138389] x11: 000000000000000c x10: 0000000000000000 [ 508.143691] x9 : 0000000000000020 x8 : 0000000000000001 [ 508.148992] x7 : 0000000000000000 x6 : 0000000000000000 [ 508.154294] x5 : ffffff801c7eaee8 x4 : 0000000000000006 [ 508.159596] x3 : 0000000000000001 x2 : 0000000000000000 [ 508.164898] x1 : ffffff801c7eac08 x0 : ffffff801d0226a0 [ 508.170200] Call trace: [ 508.172640] mt76_connac_mcu_uni_add_dev+0x178/0x190 [mt76_connac_lib] [ 508.179159] mt7921_eeprom_init+0x1288/0x1cb8 [mt7921e] [ 508.184394] drv_add_interface+0x34/0x88 [mac80211] [ 508.189271] ieee80211_add_virtual_monitor+0xe0/0xb48 [mac80211] [ 508.195277] ieee80211_do_open+0x86c/0x918 [mac80211] [ 508.200328] ieee80211_do_open+0x900/0x918 [mac80211] [ 508.205372] __dev_open+0xcc/0x150 [ 508.208763] __dev_change_flags+0x134/0x198 [ 508.212937] dev_change_flags+0x20/0x60 [ 508.216764] devinet_ioctl+0x3e8/0x748 [ 508.220503] inet_ioctl+0x1e4/0x350 [ 508.223983] sock_do_ioctl+0x48/0x2a0 [ 508.227635] sock_ioctl+0x310/0x4f8 [ 508.231116] do_vfs_ioctl+0xa4/0xac0 [ 508.234681] ksys_ioctl+0x44/0x90 [ 508.237985] __arm64_sys_ioctl+0x1c/0x48 [ 508.241901] el0_svc_common.constprop.1+0x7c/0x100 [ 508.246681] el0_svc_handler+0x18/0x20 [ 508.250421] el0_svc+0x8/0x1c8 [ 508.253465] ---[ end trace c7b90fee13d72c39 ]--- [ 508.261278] ------------[ cut here ]------------
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -0
@@ -946,6 +946,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,switch (vif->type) {case NL80211_IFTYPE_MESH_POINT : +case NL80211_IFTYPE_MONITOR :case NL80211_IFTYPE_AP : basic_req.basic.conn_type =cpu_to_le32 (CONNECTION_INFRA_AP );break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 531/677 mt76: check return value of mt76_txq_send_burst in mt76_txq_schedule_list
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 57b8b57516c5108b0078051a31c68dc9dfcbf68f ]
Since mt76_txq_send_burst routine can report a negative error code, check the returned value before incrementing the number of transmitted frames in mt76_txq_schedule_list routine.
Return -EBUSY directly if the device is in reset or in power management.
--- drivers/net/wireless/mediatek/mt76/tx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/tx.c +10 -5
@@ -461,11 +461,11 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)int ret =0 ;while (1 ) { +int n_frames =0 ; +if (test_bit (MT76_STATE_PM , &phy->state) || -test_bit (MT76_RESET , &phy->state)) { - ret = -EBUSY ; -break ; - } +test_bit (MT76_RESET , &phy->state)) +return -EBUSY ;if (dev->queue_ops->tx_cleanup && q->queued +2 *MT_TXQ_FREE_THR >= q->ndesc) {
@@ -497,11 +497,16 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) }if (!mt76_txq_stopped (q)) - ret +=mt76_txq_send_burst (phy, q, mtxq); + n_frames =mt76_txq_send_burst (phy, q, mtxq);spin_unlock_bh (&q->lock);ieee80211_return_txq (phy->hw, txq, false); + +if (unlikely (n_frames <0 )) +return n_frames; + + ret += n_frames; }return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 532/677 mt76: mt7921: fix the base of PCIe interrupt
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 23c1d2dc9ed5be1d0df7987335f5646e3826a461 ]
Should use 0x10000 as the base to operate PCIe interrupt according to the vendor reference driver.
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7921/regs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +2 -2
@@ -137,7 +137,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,mt76_wr (dev,MT_WFDMA0_HOST_INT_ENA ,0 ); -mt7921_l1_wr (dev,MT_PCIE_MAC_INT_ENABLE ,0xff ); +mt76_wr (dev,MT_PCIE_MAC_INT_ENABLE ,0xff ); ret =devm_request_irq (mdev->dev, pdev->irq, mt7921_irq_handler,IRQF_SHARED ,KBUILD_MODNAME , dev);
@@ -248,7 +248,7 @@ static int mt7921_pci_resume(struct pci_dev *pdev)return err;/* enable interrupt */ -mt7921_l1_wr (dev,MT_PCIE_MAC_INT_ENABLE ,0xff ); +mt76_wr (dev,MT_PCIE_MAC_INT_ENABLE ,0xff );mt7921_irq_enable (dev,MT_INT_RX_DONE_ALL |MT_INT_TX_DONE_ALL |MT_INT_MCU_CMD );
drivers/net/wireless/mediatek/mt76/mt7921/regs.h +1 -1
@@ -389,7 +389,7 @@#define MT_HW_CHIPID 0x70010200#define MT_HW_REV 0x70010204 -#define MT_PCIE_MAC_BASE 0x74030000 +#define MT_PCIE_MAC_BASE 0x10000#define MT_PCIE_MAC (ofs) (MT_PCIE_MAC_BASE + (ofs))#define MT_PCIE_MAC_INT_ENABLE MT_PCIE_MAC(0x188)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 533/677 mt76: mt7921: fix the base of the dynamic remap
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 53a8fb4afdc877f8f2d5e1e15cc5ad66155987a6 ]
We should change the base for the dynamic remap into another one, because the current base (0xe0000) have been the one used to operate the device ownership.
--- drivers/net/wireless/mediatek/mt76/mt7921/regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/regs.h +2 -2
@@ -362,11 +362,11 @@#define MT_INFRA_CFG_BASE 0xfe000#define MT_INFRA (ofs) (MT_INFRA_CFG_BASE + (ofs)) -#define MT_HIF_REMAP_L1 MT_INFRA(0x260) +#define MT_HIF_REMAP_L1 MT_INFRA(0x24c)#define MT_HIF_REMAP_L1_MASK GENMASK(15, 0)#define MT_HIF_REMAP_L1_OFFSET GENMASK(15, 0)#define MT_HIF_REMAP_L1_BASE GENMASK(31, 16) -#define MT_HIF_REMAP_BASE_L1 0xe0000 +#define MT_HIF_REMAP_BASE_L1 0x40000#define MT_SWDEF_BASE 0x41f200#define MT_SWDEF (ofs) (MT_SWDEF_BASE + (ofs))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 534/677 mt76: mt7915: fix rxrate reporting
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 7883906d22c1e73f1f316bd84fc4a7ff8edd12aa ]
Avoid directly updating sinfo->rxrate from firmware since rate_info might be overwritten by wrong results even mt7915_mcu_get_rx_rate() fails check.
Add more error handlings accordingly.
--- .../net/wireless/mediatek/mt76/mt7915/main.c | 5 +- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 47 ++++++++++--------- 2 files changed, 30 insertions(+), 22 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +4 -1
@@ -839,9 +839,12 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,struct mt7915_phy *phy =mt7915_hw_phy (hw);struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;struct mt7915_sta_stats *stats = &msta->stats; +struct rate_info rxrate = {}; -if (mt7915_mcu_get_rx_rate (phy, vif, sta, &sinfo->rxrate) ==0 ) +if (!mt7915_mcu_get_rx_rate (phy, vif, sta, &rxrate)) { + sinfo->rxrate = rxrate; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_RX_BITRATE ); + }if (!stats->tx_rate.legacy && !stats->tx_rate.flags)return ;
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +26 -21
90 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 535/677 mt76: mt7915: fix txrate reporting
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit f43b941fd61003659a3f0e039595e5e525917aa8 ]
Properly check rate_info to fix unexpected reporting.
[ 1215.161863] Call trace: [ 1215.164307] cfg80211_calculate_bitrate+0x124/0x200 [cfg80211] [ 1215.170139] ieee80211s_update_metric+0x80/0xc0 [mac80211] [ 1215.175624] ieee80211_tx_status_ext+0x508/0x838 [mac80211] [ 1215.181190] mt7915_mcu_get_rx_rate+0x28c/0x8d0 [mt7915e] [ 1215.186580] mt7915_mac_tx_free+0x324/0x7c0 [mt7915e] [ 1215.191623] mt7915_queue_rx_skb+0xa8/0xd0 [mt7915e] [ 1215.196582] mt76_dma_cleanup+0x7b0/0x11d0 [mt76] [ 1215.201276] __napi_poll+0x38/0xf8 [ 1215.204668] napi_workfn+0x40/0x80 [ 1215.208062] process_one_work+0x1fc/0x390 [ 1215.212062] worker_thread+0x48/0x4d0 [ 1215.215715] kthread+0x120/0x128 [ 1215.218935] ret_from_fork+0x10/0x1c
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +24 -14
@@ -351,54 +351,62 @@ mt7915_mcu_rx_radar_detected(struct mt7915_dev *dev, struct sk_buff *skb) dev->hw_pattern++; } -static void +static int mt7915_mcu_tx_rate_parse (struct mt76_phy *mphy,struct mt7915_mcu_ra_info *ra,struct rate_info *rate,u16 r) {struct ieee80211_supported_band *sband;u16 ru_idx =le16_to_cpu (ra->ru_idx); -u16 flags =0 ; +bool cck = false; rate->mcs =FIELD_GET (MT_RA_RATE_MCS , r); rate->nss =FIELD_GET (MT_RA_RATE_NSS , r) +1 ;switch (FIELD_GET (MT_RA_RATE_TX_MODE , r)) {case MT_PHY_TYPE_CCK : + cck = true; + fallthrough;case MT_PHY_TYPE_OFDM :if (mphy->chandef.chan->band ==NL80211_BAND_5GHZ ) sband = &mphy->sband_5g.sband;else sband = &mphy->sband_2g.sband; + rate->mcs =mt76_get_rate (mphy->dev, sband, rate->mcs, cck); rate->legacy = sband->bitrates[rate->mcs].bitrate;break ;case MT_PHY_TYPE_HT :case MT_PHY_TYPE_HT_GF : rate->mcs += (rate->nss -1 ) *8 ; - flags |=RATE_INFO_FLAGS_MCS ; +if (rate->mcs >31 ) +return -EINVAL ; + rate->flags =RATE_INFO_FLAGS_MCS ;if (ra->gi) - flags |=RATE_INFO_FLAGS_SHORT_GI ; + rate->flags |=RATE_INFO_FLAGS_SHORT_GI ;break ;case MT_PHY_TYPE_VHT : - flags |=RATE_INFO_FLAGS_VHT_MCS ; +if (rate->mcs >9 ) +return -EINVAL ; + rate->flags =RATE_INFO_FLAGS_VHT_MCS ;if (ra->gi) - flags |=RATE_INFO_FLAGS_SHORT_GI ; + rate->flags |=RATE_INFO_FLAGS_SHORT_GI ;break ;case MT_PHY_TYPE_HE_SU :case MT_PHY_TYPE_HE_EXT_SU :case MT_PHY_TYPE_HE_TB :case MT_PHY_TYPE_HE_MU : +if (ra->gi >NL80211_RATE_INFO_HE_GI_3_2 || rate->mcs >11 ) +return -EINVAL ; + rate->he_gi = ra->gi; rate->he_dcm =FIELD_GET (MT_RA_RATE_DCM_EN , r); - - flags |=RATE_INFO_FLAGS_HE_MCS ; + rate->flags =RATE_INFO_FLAGS_HE_MCS ;break ;default : -break ; +return -EINVAL ; } - rate->flags = flags;if (ru_idx) {switch (ru_idx) {
@@ -435,6 +443,8 @@ mt7915_mcu_tx_rate_parse(struct mt76_phy *mphy, struct mt7915_mcu_ra_info *ra,break ; } } + +return 0 ; } static void
@@ -465,12 +475,12 @@ mt7915_mcu_tx_rate_report(struct mt7915_dev *dev, struct sk_buff *skb) mphy = dev->mt76.phy2;/* current rate */ -mt7915_mcu_tx_rate_parse (mphy, ra, &rate, curr); - stats->tx_rate = rate; +if (!mt7915_mcu_tx_rate_parse (mphy, ra, &rate, curr)) + stats->tx_rate = rate;/* probing rate */ -mt7915_mcu_tx_rate_parse (mphy, ra, &prob_rate, probe); - stats->prob_rate = prob_rate; +if (!mt7915_mcu_tx_rate_parse (mphy, ra, &prob_rate, probe)) + stats->prob_rate = prob_rate;if (attempts) {u16 success =le16_to_cpu (ra->success);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 536/677 mt76: mt7663: fix when beacon filter is being applied
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 4bec61d9fb9629c21e60cd24a97235ea1f6020ec ]
HW beacon filter command is being applied until we're in associated state because the command would rely on the associated access point's beacon interval and DTIM information.
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -3
@@ -217,8 +217,6 @@ static int mt7615_add_interface(struct ieee80211_hw *hw, ret =mt7615_mcu_add_dev_info (phy, vif, true);if (ret) goto out; - -mt7615_mac_set_beacon_filter (phy, vif, true); out:mt7615_mutex_release (dev);
@@ -244,7 +242,6 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,mt76_connac_free_pending_tx_skbs (&dev->pm, &msta->wcid); -mt7615_mac_set_beacon_filter (phy, vif, false);mt7615_mcu_add_dev_info (phy, vif, false);rcu_assign_pointer (dev->mt76.wcid[idx],NULL );
@@ -544,6 +541,9 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,if (changed &BSS_CHANGED_ARP_FILTER )mt7615_mcu_update_arp_filter (hw, vif, info); +if (changed &BSS_CHANGED_ASSOC ) +mt7615_mac_set_beacon_filter (phy, vif, info->assoc); +mt7615_mutex_release (dev); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 537/677 mt76: mt7663s: make all of packets 4-bytes aligned in sdio tx aggregation
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 455ae5aabcc72fed7e5c803d59d122415500dc08 ]
Each packet should be padded with the additional zero to become 4-bytes alignment in sdio tx aggregation.
--- drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c +8 -1
@@ -218,6 +218,7 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)int qid, err, nframes =0 , len =0 , pse_sz =0 , ple_sz =0 ;bool mcu = q == dev->q_mcu[MT_MCUQ_WM ];struct mt76_sdio *sdio = &dev->sdio; +u8 pad; qid = mcu ?ARRAY_SIZE (sdio->xmit_buf) -1 : q->qid;while (q->first != q->head) {
@@ -234,7 +235,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) goto next; } -if (len + e->skb->len +4 >MT76S_XMIT_BUF_SZ ) + pad =roundup (e->skb->len,4 ) - e->skb->len; +if (len + e->skb->len + pad +4 >MT76S_XMIT_BUF_SZ )break ; if (mt7663s_tx_pick_quota(sdio, mcu, e->buf_sz, &pse_sz,
@@ -252,6 +254,11 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q) len += iter->len; nframes++; } + +if (unlikely (pad)) { +memset (sdio->xmit_buf[qid] + len,0 , pad); + len += pad; + } next: q->first = (q->first +1 ) % q->ndesc; e->done = true;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 538/677 mt76: mt7663s: fix the possible device hang in high traffic
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 45247a85614b49b07b9dc59a4e6783b17e766ff2 ]
Use the additional memory barrier to ensure the skb list up-to-date between the skb producer and consumer to avoid the invalid skb content written into sdio controller and then cause device hang due to mcu assert caught by WR_TIMEOUT_INT.
--- drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 2 ++ drivers/net/wireless/mediatek/mt76/sdio.c | 3 +++ 2 files changed, 5 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c +2 -0
@@ -225,6 +225,8 @@ static int mt7663s_tx_run_queue(struct mt76_dev *dev, struct mt76_queue *q)struct mt76_queue_entry *e = &q->entry[q->first];struct sk_buff *iter; +smp_rmb (); +if (!test_bit (MT76_STATE_MCU_RUNNING , &dev->phy.state)) {__skb_put_zero (e->skb,4 ); err = __mt7663s_xmit_queue(dev, e->skb->data,
drivers/net/wireless/mediatek/mt76/sdio.c +3 -0
@@ -256,6 +256,9 @@ mt76s_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, q->entry[q->head].skb = tx_info.skb; q->entry[q->head].buf_sz = len; + +smp_wmb (); + q->head = (q->head +1 ) % q->ndesc; q->queued++;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 539/677 mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset()
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 69e74d7f23d515fb559b2e0bebfdf4c458d9507d ]
With this patch, mt7615_mac_reset_work() can recover system back.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +5 -3
@@ -1970,15 +1970,17 @@ void mt7615_dma_reset(struct mt7615_dev *dev)mt76_clear (dev,MT_WPDMA_GLO_CFG ,MT_WPDMA_GLO_CFG_RX_DMA_EN |MT_WPDMA_GLO_CFG_TX_DMA_EN |MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE ); +usleep_range (1000 ,2000 ); -mt76_queue_tx_cleanup (dev, dev->mt76.q_mcu[MT_MCUQ_WM ], true);for (i =0 ; i < __MT_TXQ_MAX; i++)mt76_queue_tx_cleanup (dev, dev->mphy.q_tx[i], true); -mt76_for_each_q_rx (&dev->mt76, i) { +for (i =0 ; i < __MT_MCUQ_MAX; i++) +mt76_queue_tx_cleanup (dev, dev->mt76.q_mcu[i], true); + +mt76_for_each_q_rx (&dev->mt76, i)mt76_queue_rx_reset (dev, i); - } mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_TX_DMA_EN |
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 540/677 mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset()
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 1ebea45ef027ee31cd50ed92903071391e792edb ]
Cleanup mcu queues in mt7915_mac_reset_work().
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +8 -7
@@ -1470,9 +1470,8 @@ mt7915_update_beacons(struct mt7915_dev *dev) }static void -mt7915_dma_reset (struct mt7915_phy *phy) +mt7915_dma_reset (struct mt7915_dev *dev) { -struct mt7915_dev *dev = phy->dev;struct mt76_phy *mphy_ext = dev->mt76.phy2;u32 hif1_ofs =MT_WFDMA1_PCIE1_BASE -MT_WFDMA1_BASE ;int i;
@@ -1489,18 +1488,20 @@ mt7915_dma_reset(struct mt7915_phy *phy) (MT_WFDMA1_GLO_CFG_TX_DMA_EN | MT_WFDMA1_GLO_CFG_RX_DMA_EN)); } +usleep_range (1000 ,2000 ); -mt76_queue_tx_cleanup (dev, dev->mt76.q_mcu[MT_MCUQ_WA ], true);for (i =0 ; i < __MT_TXQ_MAX; i++) { -mt76_queue_tx_cleanup (dev, phy->mt76->q_tx[i], true); +mt76_queue_tx_cleanup (dev, dev->mphy.q_tx[i], true);if (mphy_ext)mt76_queue_tx_cleanup (dev, mphy_ext->q_tx[i], true); } -mt76_for_each_q_rx (&dev->mt76, i) { +for (i =0 ; i < __MT_MCUQ_MAX; i++) +mt76_queue_tx_cleanup (dev, dev->mt76.q_mcu[i], true); + +mt76_for_each_q_rx (&dev->mt76, i)mt76_queue_rx_reset (dev, i); - }/* re-init prefetch settings after reset */ mt7915_dma_prefetch (dev);
@@ -1584,7 +1585,7 @@ void mt7915_mac_reset_work(struct work_struct *work)idr_init (&dev->token);if (mt7915_wait_reset_state (dev,MT_MCU_CMD_RESET_DONE )) { -mt7915_dma_reset (&dev->phy); +mt7915_dma_reset (dev);mt76_wr (dev,MT_MCU_INT_EVENT ,MT_MCU_INT_EVENT_DMA_INIT );mt7915_wait_reset_state (dev,MT_MCU_CMD_RECOVERY_DONE );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 541/677 mt76: mt7921: always wake the device in mt7921_remove_interface
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 859c85fd19715349ce01539459095fd5fc7e483a ]
Make sure the mcu is not in sleep mode before sending mcu messages in mt7921_remove_interface routine.
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -1
@@ -348,6 +348,7 @@ static void mt7921_remove_interface(struct ieee80211_hw *hw,if (vif == phy->monitor_vif) phy->monitor_vif =NULL ; +mt7921_mutex_acquire (dev);mt76_connac_free_pending_tx_skbs (&dev->pm, &msta->wcid);if (dev->pm.enable) {
@@ -360,7 +361,6 @@ static void mt7921_remove_interface(struct ieee80211_hw *hw,rcu_assign_pointer (dev->mt76.wcid[idx],NULL ); -mt7921_mutex_acquire (dev); dev->mt76.vif_mask &= ~BIT (mvif->mt76.idx); phy->omac_mask &= ~BIT_ULL (mvif->mt76.omac_idx);mt7921_mutex_release (dev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 542/677 mt76: mt7921: fix inappropriate WoW setup with the missing ARP informaiton
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 9c9d83213424679b087267600d53a35acfa0201f ]
Fix the Wake-on-WoWLAN failure should rely on ARP Information is being updated in time to the firmware.
--- .../net/wireless/mediatek/mt76/mt7921/main.c | 3 ++ .../net/wireless/mediatek/mt76/mt7921/mcu.c | 44 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/mt7921.h | 3 ++ 3 files changed, 50 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +3 -0
@@ -587,6 +587,9 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,if (changed &BSS_CHANGED_PS )mt7921_mcu_uni_bss_ps (dev, vif); +if (changed &BSS_CHANGED_ARP_FILTER ) +mt7921_mcu_update_arp_filter (hw, vif, info); +mt7921_mutex_release (dev); }
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +44 -0
47 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +3 -0
@@ -339,4 +339,7 @@ int mt7921_mac_set_beacon_filter(struct mt7921_phy *phy, bool enable);void mt7921_pm_interface_iter (void *priv,u8 *mac,struct ieee80211_vif *vif);void mt7921_coredump_work (struct work_struct *work); +int mt7921_mcu_update_arp_filter (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_bss_conf *info);#endif
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 543/677 mt76: mt7921: fix the dwell time control
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 9db419f0cb39a63fb2f645a846cae17b81cd5c96 ]
dwell time for the scan is not configurable according to the current firmware submitted into linux-firmware.git, so leave the dwell time 0 to indicate the dwell time always determined by the firmware.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +2 -1
@@ -1309,7 +1309,7 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif, {struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;struct cfg80211_scan_request *sreq = &scan_req->req; -int n_ssids =0 , err, i, duration =MT76_CONNAC_SCAN_CHANNEL_TIME ; +int n_ssids =0 , err, i, duration;int ext_channels_num =max_t (int, sreq->n_channels -32 ,0 );struct ieee80211_channel **scan_list = sreq->channels;struct mt76_dev *mdev = phy->dev;
@@ -1346,6 +1346,7 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif, req->ssid_type_ext = n_ssids ?BIT (0 ) :0 ; req->ssids_num = n_ssids; + duration =is_mt7921 (phy->dev) ?0 :MT76_CONNAC_SCAN_CHANNEL_TIME ;/* increase channel time for passive scan */ if (!sreq->n_ssids) duration *=2 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 544/677 KVM: PPC: Book3S HV P9: Restore host CTRL SPR after guest exit
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 5088eb4092df12d701af8e0e92860b7186365279 ]
The host CTRL (runlatch) value is not restored after guest exit. The host CTRL should always be 1 except in CPU idle code, so this can result in the host running with runlatch clear, and potentially switching to a different vCPU which then runs with runlatch clear as well.
This has little effect on P9 machines, CTRL is only responsible for some PMU counter logic in the host and so other than corner cases of software relying on that, or explicitly reading the runlatch value (Linux does not appear to be affected but it's possible non-Linux guests could be), there should be no execution correctness problem, though it could be used as a covert channel between guests.
There may be microcontrollers, firmware or monitoring tools that sample the runlatch value out-of-band, however since the register is writable by guests, these values would (should) not be relied upon for correct operation of the host, so suboptimal performance or incorrect reporting should be the worst problem.
--- arch/powerpc/kvm/book3s_hv.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/kvm/book3s_hv.c +3 -0
@@ -3728,7 +3728,10 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, vcpu->arch.dec_expires = dec + tb; vcpu->cpu =-1 ; vcpu->arch.thread_cpu =-1 ; +/* Save guest CTRL register, set runlatch to 1 */ vcpu->arch.ctrl =mfspr (SPRN_CTRLF ); +if (!(vcpu->arch.ctrl &1 )) +mtspr (SPRN_CTRLT , vcpu->arch.ctrl |1 ); vcpu->arch.iamr =mfspr (SPRN_IAMR ); vcpu->arch.pspb =mfspr (SPRN_PSPB );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 545/677 ovl: show "userxattr" in the mount data
In reply to Greg Kroah-HartmanFrom: Giuseppe Scrivano <[email protected]>
[ Upstream commit 321b46b904816241044e177c1d6282ad20f17416 ]
This was missed when adding the option.
--- fs/overlayfs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/overlayfs/super.c +2 -0
@@ -380,6 +380,8 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry) ofs->config.metacopy ? "on" : "off");if (ofs->config.ovl_volatile)seq_puts (m,",volatile" ); +if (ofs->config.userxattr) +seq_puts (m,",userxattr" );return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 546/677 ovl: invalidate readdir cache on changes to dir with origin
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
[ Upstream commit 65cd913ec9d9d71529665924c81015b7ab7d9381 ]
The test in ovl_dentry_version_inc() was out-dated and did not include the case where readdir cache is used on a non-merge dir that has origin xattr, indicating that it may contain leftover whiteouts.
To make the code more robust, use the same helper ovl_dir_is_real() to determine if readdir cache should be used and if readdir cache should be invalidated.
--- fs/overlayfs/overlayfs.h | 30 +++++++++++++++++++++++++++--- fs/overlayfs/readdir.c | 12 ------------ fs/overlayfs/util.c | 31 +++++++++---------------------- 3 files changed, 36 insertions(+), 37 deletions(-)
fs/overlayfs/overlayfs.h +27 -3
@@ -319,9 +319,6 @@ int ovl_check_setxattr(struct dentry *dentry, struct dentry *upperdentry, enum ovl_xattr ox, const void *value, size_t size, int xerr);int ovl_set_impure (struct dentry *dentry,struct dentry *upperdentry); -void ovl_set_flag (unsigned long flag,struct inode *inode); -void ovl_clear_flag (unsigned long flag,struct inode *inode); -bool ovl_test_flag (unsigned long flag,struct inode *inode);bool ovl_inuse_trylock (struct dentry *dentry);void ovl_inuse_unlock (struct dentry *dentry);bool ovl_is_inuse (struct dentry *dentry);
@@ -335,6 +332,21 @@ char *ovl_get_redirect_xattr(struct ovl_fs *ofs, struct dentry *dentry, int padding);int ovl_sync_status (struct ovl_fs *ofs); +static inline void ovl_set_flag (unsigned long flag,struct inode *inode) +{ +set_bit (flag, &OVL_I (inode)->flags); +} + +static inline void ovl_clear_flag (unsigned long flag,struct inode *inode) +{ +clear_bit (flag, &OVL_I (inode)->flags); +} + +static inline bool ovl_test_flag (unsigned long flag,struct inode *inode) +{ +return test_bit (flag, &OVL_I (inode)->flags); +} +static inline bool ovl_is_impuredir (struct super_block *sb,struct dentry *dentry) {
@@ -439,6 +451,18 @@ int ovl_workdir_cleanup(struct inode *dir, struct vfsmount *mnt, struct dentry *dentry, int level);int ovl_indexdir_cleanup (struct ovl_fs *ofs); +/* +* Can we iterate real dir directly? +* +* Non-merge dir may contain whiteouts from a time it was a merge upper, before +* lower dir was removed under it and possibly before it was rotated from upper +* to lower layer. +*/ +static inline bool ovl_dir_is_real (struct dentry *dir) +{ +return !ovl_test_flag (OVL_WHITEOUTS ,d_inode (dir)); +} +/* inode.c */ int ovl_set_nlink_upper (struct dentry *dentry);int ovl_set_nlink_lower (struct dentry *dentry);
fs/overlayfs/readdir.c +0 -12
@@ -319,18 +319,6 @@ static inline int ovl_dir_read(struct path *realpath,return err; } -/* -* Can we iterate real dir directly? -* -* Non-merge dir may contain whiteouts from a time it was a merge upper, before -* lower dir was removed under it and possibly before it was rotated from upper -* to lower layer. -*/ -static bool ovl_dir_is_real (struct dentry *dir) -{ -return !ovl_test_flag (OVL_WHITEOUTS ,d_inode (dir)); -} -static void ovl_dir_reset (struct file *file) {struct ovl_dir_file *od = file->private_data;
fs/overlayfs/util.c +9 -22
@@ -422,18 +422,20 @@ void ovl_inode_update(struct inode *inode, struct dentry *upperdentry) } } -static void ovl_dentry_version_inc (struct dentry *dentry,bool impurity) +static void ovl_dir_version_inc (struct dentry *dentry,bool impurity) {struct inode *inode =d_inode (dentry);WARN_ON (!inode_is_locked (inode)); +WARN_ON (!d_is_dir (dentry));/* -* Version is used by readdir code to keep cache consistent. For merge -* dirs all changes need to be noted. For non-merge dirs, cache only -* contains impure (ones which have been copied up and have origins) -* entries, so only need to note changes to impure entries. +* Version is used by readdir code to keep cache consistent. +* For merge dirs (or dirs with origin) all changes need to be noted. +* For non-merge dirs, cache contains only impure entries (i.e. ones +* which have been copied up and have origins), so only need to note +* changes to impure entries. */ -if (OVL_TYPE_MERGE (ovl_path_type (dentry)) || impurity) +if (!ovl_dir_is_real (dentry) || impurity)OVL_I (inode)->version++; }
@@ -442,7 +444,7 @@ void ovl_dir_modified(struct dentry *dentry, bool impurity)/* Copy mtime/ctime */ ovl_copyattr (d_inode (ovl_dentry_upper (dentry)),d_inode (dentry)); -ovl_dentry_version_inc (dentry, impurity); +ovl_dir_version_inc (dentry, impurity); }u64 ovl_dentry_version_get (struct dentry *dentry)
@@ -638,21 +640,6 @@ int ovl_set_impure(struct dentry *dentry, struct dentry *upperdentry)return err; } -void ovl_set_flag (unsigned long flag,struct inode *inode) -{ -set_bit (flag, &OVL_I (inode)->flags); -} - -void ovl_clear_flag (unsigned long flag,struct inode *inode) -{ -clear_bit (flag, &OVL_I (inode)->flags); -} - -bool ovl_test_flag (unsigned long flag,struct inode *inode) -{ -return test_bit (flag, &OVL_I (inode)->flags); -} -/** * Caller must hold a reference to inode to prevent it from being freed while * it is marked inuse.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 547/677 RDMA/qedr: Fix error return code in qedr_iw_connect()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 10dd83dbcd157baf7a78a09ddb2f84c627bc7f1d ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qedr/qedr_iw_cm.c +3 -1
@@ -636,8 +636,10 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)memcpy (in_params.local_mac_addr, dev->ndev->dev_addr,ETH_ALEN );if (test_and_set_bit (QEDR_IWARP_CM_WAIT_FOR_CONNECT , - &qp->iwarp_cm_flags)) + &qp->iwarp_cm_flags)) { + rc = -ENODEV ; goto err;/* QP already being destroyed */ + } rc = dev->ops->iwarp_connect (dev->rdma_ctx, &in_params, &out_params);if (rc) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 548/677 IB/hfi1: Fix error return code in parse_platform_config()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 4c7d9c69adadfc31892c7e8e134deb3546552106 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/hw/hfi1/firmware.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hfi1/firmware.c +1 -0
@@ -1916,6 +1916,7 @@ int parse_platform_config(struct hfi1_devdata *dd)dd_dev_err (dd,"%s: Failed CRC check at offset %ld\n" , __func__, (ptr - (u32 *)dd->platform_config.data)); + ret = -EINVAL ; goto bail; }/* Jump the CRC DWORD */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 549/677 RDMA/bnxt_re: Fix error return code in bnxt_qplib_cq_process_terminal()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 22efb0a8d130c6379c1eb64cbace1542b27e37ff ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 -0
@@ -2784,6 +2784,7 @@ do_rq:dev_err (&cq->hwq.pdev->dev,"FP: CQ Processed terminal reported rq_cons_idx 0x%x exceeds max 0x%x\n" , cqe_cons, rq->max_wqe); + rc = -EINVAL ; goto done; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 550/677 cxgb4: Fix unintentional sign extension issues
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit dd2c79677375c37f8f9f8d663eb4708495d595ef ]
The shifting of the u8 integers f->fs.nat_lip[] by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to a u64. In the event that the top bit of the u8 is set then all then all the upper 32 bits of the u64 end up as also being set because of the sign-extension. Fix this by casting the u8 values to a u64 before the 24 bit left shift.
Addresses-Coverity: ("Unintended sign extension")
--- .../net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +11 -11
@@ -174,31 +174,31 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f,WORD_MASK , f->fs.nat_lip[15 ] | f->fs.nat_lip[14 ] <<8 | f->fs.nat_lip[13 ] <<16 | - f->fs.nat_lip[12] << 24, 1); + (u64)f->fs.nat_lip[12] << 24, 1);set_tcb_field (adap, f, tid,TCB_SND_UNA_RAW_W +1 ,WORD_MASK , f->fs.nat_lip[11 ] | f->fs.nat_lip[10 ] <<8 | f->fs.nat_lip[9 ] <<16 | - f->fs.nat_lip[8 ] <<24 ,1 ); + (u64 )f->fs.nat_lip[8 ] <<24 ,1 );set_tcb_field (adap, f, tid,TCB_SND_UNA_RAW_W +2 ,WORD_MASK , f->fs.nat_lip[7 ] | f->fs.nat_lip[6 ] <<8 | f->fs.nat_lip[5 ] <<16 | - f->fs.nat_lip[4 ] <<24 ,1 ); + (u64 )f->fs.nat_lip[4 ] <<24 ,1 );set_tcb_field (adap, f, tid,TCB_SND_UNA_RAW_W +3 ,WORD_MASK , f->fs.nat_lip[3 ] | f->fs.nat_lip[2 ] <<8 | f->fs.nat_lip[1 ] <<16 | - f->fs.nat_lip[0 ] <<24 ,1 ); + (u64 )f->fs.nat_lip[0 ] <<24 ,1 ); }else {set_tcb_field (adap, f, tid,TCB_RX_FRAG3_LEN_RAW_W ,WORD_MASK , f->fs.nat_lip[3 ] | f->fs.nat_lip[2 ] <<8 | f->fs.nat_lip[1 ] <<16 | - f->fs.nat_lip[0 ] <<24 ,1 ); + (u64 )f->fs.nat_lip[0 ] <<25 ,1 ); } }
@@ -208,25 +208,25 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f,WORD_MASK , f->fs.nat_fip[15 ] | f->fs.nat_fip[14 ] <<8 | f->fs.nat_fip[13 ] <<16 | - f->fs.nat_fip[12] << 24, 1); + (u64)f->fs.nat_fip[12] << 24, 1);set_tcb_field (adap, f, tid,TCB_RX_FRAG2_PTR_RAW_W +1 ,WORD_MASK , f->fs.nat_fip[11 ] | f->fs.nat_fip[10 ] <<8 | f->fs.nat_fip[9 ] <<16 | - f->fs.nat_fip[8 ] <<24 ,1 ); + (u64 )f->fs.nat_fip[8 ] <<24 ,1 );set_tcb_field (adap, f, tid,TCB_RX_FRAG2_PTR_RAW_W +2 ,WORD_MASK , f->fs.nat_fip[7 ] | f->fs.nat_fip[6 ] <<8 | f->fs.nat_fip[5 ] <<16 | - f->fs.nat_fip[4 ] <<24 ,1 ); + (u64 )f->fs.nat_fip[4 ] <<24 ,1 );set_tcb_field (adap, f, tid,TCB_RX_FRAG2_PTR_RAW_W +3 ,WORD_MASK , f->fs.nat_fip[3 ] | f->fs.nat_fip[2 ] <<8 | f->fs.nat_fip[1 ] <<16 | - f->fs.nat_fip[0 ] <<24 ,1 ); + (u64 )f->fs.nat_fip[0 ] <<24 ,1 ); }else { set_tcb_field(adap, f, tid,
@@ -234,13 +234,13 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f,WORD_MASK , f->fs.nat_fip[3 ] | f->fs.nat_fip[2 ] <<8 | f->fs.nat_fip[1 ] <<16 | - f->fs.nat_fip[0] << 24, 1); + (u64)f->fs.nat_fip[0] << 24, 1); } }set_tcb_field (adap, f, tid,TCB_PDU_HDR_LEN_W ,WORD_MASK , (dp ? (nat_lp[1 ] | nat_lp[0 ] <<8 ) :0 ) | - (sp ? (nat_fp[1 ] <<16 | nat_fp[0 ] <<24 ) :0 ), + (sp ? (nat_fp[1 ] <<16 | (u64 )nat_fp[0 ] <<24 ) :0 ),1 ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 551/677 net: thunderx: Fix unintentional sign extension issue
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit e701a25840360706fe4cf5de0015913ca19c274b ]
The shifting of the u8 integers rq->caching by 26 bits to the left will be promoted to a 32 bit signed int and then sign-extended to a u64. In the event that rq->caching is greater than 0x1f then all then all the upper 32 bits of the u64 end up as also being set because of the int sign-extension. Fix this by casting the u8 values to a u64 before the 26 bit left shift.
Addresses-Coverity: ("Unintended sign extension")
--- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/nicvf_queues.c +1 -1
@@ -776,7 +776,7 @@ static void nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs, mbx.rq.msg =NIC_MBOX_MSG_RQ_CFG ; mbx.rq.qs_num = qs->vnic_id; mbx.rq.rq_num = qidx; - mbx.rq.cfg = (rq->caching <<26 ) | (rq->cq_qs <<19 ) | + mbx.rq.cfg = ((u64 )rq->caching <<26 ) | (rq->cq_qs <<19 ) | (rq->cq_idx <<16 ) | (rq->cont_rbdr_qs <<9 ) | (rq->cont_qs_rbdr_idx <<8 ) | (rq->start_rbdr_qs <<1 ) | (rq->start_qs_rbdr_idx);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 552/677 mt76: mt7921: fix kernel crash when the firmware fails to download
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit e230f0c44f011f3270680a506b19b7e84c5e8923 ]
Fix kernel crash when the firmware is missing or fails to download.
[ 9.444758] kernel BUG at drivers/pci/msi.c:375! [ 9.449363] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP [ 9.501033] pstate: a0400009 (NzCv daif +PAN -UAO) [ 9.505814] pc : free_msi_irqs+0x180/0x184 [ 9.509897] lr : free_msi_irqs+0x40/0x184 [ 9.513893] sp : ffffffc015193870 [ 9.517194] x29: ffffffc015193870 x28: 00000000f0e94fa2 [ 9.522492] x27: 0000000000000acd x26: 000000000000009a [ 9.527790] x25: ffffffc0152cee58 x24: ffffffdbb383e0d8 [ 9.533087] x23: ffffffdbb38628d0 x22: 0000000000040200 [ 9.538384] x21: ffffff8cf7de7318 x20: ffffff8cd65a2480 [ 9.543681] x19: ffffff8cf7de7000 x18: 0000000000000000 [ 9.548979] x17: ffffff8cf9ca03b4 x16: ffffffdc13ad9a34 [ 9.554277] x15: 0000000000000000 x14: 0000000000080800 [ 9.559575] x13: ffffff8cd65a2980 x12: 0000000000000000 [ 9.564873] x11: ffffff8cfa45d820 x10: ffffff8cfa45d6d0 [ 9.570171] x9 : 0000000000000040 x8 : ffffff8ccef1b780 [ 9.575469] x7 : aaaaaaaaaaaaaaaa x6 : 0000000000000000 [ 9.580766] x5 : ffffffdc13824900 x4 : ffffff8ccefe0000 [ 9.586063] x3 : 0000000000000000 x2 : 0000000000000000 [ 9.591362] x1 : 0000000000000125 x0 : ffffff8ccefe0000 [ 9.596660] Call trace: [ 9.599095] free_msi_irqs+0x180/0x184 [ 9.602831] pci_disable_msi+0x100/0x130 [ 9.606740] pci_free_irq_vectors+0x24/0x30 [ 9.610915] mt7921_pci_probe+0xbc/0x250 [mt7921e] [ 9.615693] pci_device_probe+0xd4/0x14c [ 9.619604] really_probe+0x134/0x2ec [ 9.623252] driver_probe_device+0x64/0xfc [ 9.627335] device_driver_attach+0x4c/0x6c [ 9.631506] __driver_attach+0xac/0xc0 [ 9.635243] bus_for_each_dev+0x8c/0xd4 [ 9.639066] driver_attach+0x2c/0x38 [ 9.642628] bus_add_driver+0xfc/0x1d0 [ 9.646365] driver_register+0x64/0xf8 [ 9.650101] __pci_register_driver+0x6c/0x7c [ 9.654360] init_module+0x28/0xfdc [mt7921e] [ 9.658704] do_one_initcall+0x13c/0x2d0 [ 9.662615] do_init_module+0x58/0x1e8 [ 9.666351] load_module+0xd80/0xeb4 [ 9.669912] __arm64_sys_finit_module+0xa8/0xe0 [ 9.674430] el0_svc_common+0xa4/0x16c [ 9.678168] el0_svc_compat_handler+0x2c/0x40 [ 9.682511] el0_svc_compat+0x8/0x10 [ 9.686076] Code: a94257f6 f9400bf7 a8c47bfd d65f03c0 (d4210000) [ 9.692155] ---[ end trace 7621f966afbf0a29 ]--- [ 9.697385] Kernel panic - not syncing: Fatal exception [ 9.702599] SMP: stopping secondary CPUs [ 9.706549] Kernel Offset: 0x1c03600000 from 0xffffffc010000000 [ 9.712456] PHYS_OFFSET: 0xfffffff440000000 [ 9.716625] CPU features: 0x080026,2a80aa18 [ 9.720795] Memory Limit: none
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +3 -1
@@ -146,10 +146,12 @@ static int mt7921_pci_probe(struct pci_dev *pdev, ret =mt7921_register_device (dev);if (ret) - goto err_free_dev; + goto err_free_irq;return 0 ; +err_free_irq: +devm_free_irq (&pdev->dev, pdev->irq, dev); err_free_dev:mt76_free_device (&dev->mt76); err_free_pci_vec:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 553/677 RDMA/srpt: Fix error return code in srpt_cm_req_recv()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 6bc950beff0c440ac567cdc4e7f4542a9920953d ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -0
@@ -2378,6 +2378,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,pr_info ("rejected SRP_LOGIN_REQ because target %s_%d is not enabled\n" ,dev_name (&sdev->device->dev), port_num);mutex_unlock (&sport->mutex); + ret = -EINVAL ; goto reject; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 554/677 RDMA/rtrs-clt: destroy sysfs after removing session from active list
In reply to Greg Kroah-HartmanFrom: Gioh Kim <[email protected]>
[ Upstream commit 7f4a8592ff29f19c5a2ca549d0973821319afaad ]
A session can be removed dynamically by sysfs interface "remove_path" that eventually calls rtrs_clt_remove_path_from_sysfs function. The current rtrs_clt_remove_path_from_sysfs first removes the sysfs interfaces and frees sess->stats object. Second it removes the session from the active list.
Therefore some functions could access non-connected session and access the freed sess->stats object even-if they check the session status before accessing the session.
For instance rtrs_clt_request and get_next_path_min_inflight check the session status and try to send IO to the session. The session status could be changed when they are trying to send IO but they could not catch the change and update the statistics information in sess->stats object, and generate use-after-free problem.
(see: "RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading its stats")
This patch changes the rtrs_clt_remove_path_from_sysfs to remove the session from the active session list and then destroy the sysfs interfaces.
Each function still should check the session status because closing or error recovery paths can change the status.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +1 -1
@@ -2784,8 +2784,8 @@ int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_sess *sess, }while (!changed && old_state !=RTRS_CLT_DEAD );if (likely (changed)) { -rtrs_clt_destroy_sess_files (sess, sysfs_self);rtrs_clt_remove_path_from_arr (sess); +rtrs_clt_destroy_sess_files (sess, sysfs_self);kobject_put (&sess->kobj); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 555/677 pinctrl: at91-pio4: Fix slew rate disablement
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
[ Upstream commit cbde6c823bfaa553fb162257a5926ba15ebaaa43 ]
The slew rate was enabled by default for each configuration of the pin. In case the pin had more than one configuration, even if we set the slew rate as disabled in the device tree, the next pin configuration would set again the slew rate enabled by default, overwriting the slew rate disablement.
Instead of enabling the slew rate by default for each pin configuration, enable the slew rate by default just once per pin, regardless of the number of configurations. This way the slew rate disablement will also work for cases where pins have multiple configurations.
--- drivers/pinctrl/pinctrl-at91-pio4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +4 -4
@@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, conf =atmel_pin_config_read (pctldev, pin_id); +/* Keep slew rate enabled by default. */ +if (atmel_pioctrl->slew_rate_support) + conf |=ATMEL_PIO_SR_MASK ; +for (i =0 ; i < num_configs; i++) {unsigned int param =pinconf_to_config_param (configs[i]);unsigned int arg =pinconf_to_config_argument (configs[i]);
@@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,dev_dbg (pctldev->dev,"%s: pin=%u, config=0x%lx\n" , __func__, pin_id, configs[i]); -/* Keep slew rate enabled by default. */ -if (atmel_pioctrl->slew_rate_support) - conf |=ATMEL_PIO_SR_MASK ; -switch (param) {case PIN_CONFIG_BIAS_DISABLE : conf &= (~ATMEL_PIO_PUEN_MASK );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 556/677 i2c: cadence: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 23ceb8462dc6f4b4decdb5536a7e5fc477cdf0b6 ]
The PM reference count is not expected to be incremented on return in functions cdns_i2c_master_xfer and cdns_reg_slave.
However, pm_runtime_get_sync will increment pm usage counter even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-cadence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-cadence.c +2 -2
@@ -789,7 +789,7 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,bool change_role = false;#endif - ret =pm_runtime_get_sync (id->dev); + ret =pm_runtime_resume_and_get (id->dev);if (ret <0 )return ret;
@@ -911,7 +911,7 @@ static int cdns_reg_slave(struct i2c_client *slave)if (slave->flags &I2C_CLIENT_TEN )return -EAFNOSUPPORT ; - ret =pm_runtime_get_sync (id->dev); + ret =pm_runtime_resume_and_get (id->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 557/677 i2c: img-scb: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 223125e37af8a641ea4a09747a6a52172fc4b903 ]
The PM reference count is not expected to be incremented on return in functions img_i2c_xfer and img_i2c_init.
However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-img-scb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-img-scb.c +2 -2
@@ -1057,7 +1057,7 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, atomic = true; } - ret =pm_runtime_get_sync (adap->dev.parent); + ret =pm_runtime_resume_and_get (adap->dev.parent);if (ret <0 )return ret;
@@ -1158,7 +1158,7 @@ static int img_i2c_init(struct img_i2c *i2c)u32 rev;int ret; - ret =pm_runtime_get_sync (i2c->adap.dev.parent); + ret =pm_runtime_resume_and_get (i2c->adap.dev.parent);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 558/677 i2c: imx-lpi2c: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 278e5bbdb9a94fa063c0f9bcde2479d0b8042462 ]
The PM reference count is not expected to be incremented on return in lpi2c_imx_master_enable.
However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-imx-lpi2c.c +1 -1
@@ -259,7 +259,7 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx)unsigned int temp;int ret; - ret =pm_runtime_get_sync (lpi2c_imx->adapter.dev.parent); + ret =pm_runtime_resume_and_get (lpi2c_imx->adapter.dev.parent);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 559/677 i2c: imx: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 47ff617217ca6a13194fcb35c6c3a0c57c080693 ]
In i2c_imx_xfer() and i2c_imx_remove(), the pm reference count is not expected to be incremented on return.
However, pm_runtime_get_sync will increment pm reference count even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +2 -2
@@ -1253,7 +1253,7 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,struct imx_i2c_struct *i2c_imx =i2c_get_adapdata (adapter);int result; - result =pm_runtime_get_sync (i2c_imx->adapter.dev.parent); + result =pm_runtime_resume_and_get (i2c_imx->adapter.dev.parent);if (result <0 )return result;
@@ -1496,7 +1496,7 @@ static int i2c_imx_remove(struct platform_device *pdev)struct imx_i2c_struct *i2c_imx =platform_get_drvdata (pdev);int irq, ret; - ret =pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 560/677 i2c: omap: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 780f629741257ed6c54bd3eb53b57f648eabf200 ]
The PM reference count is not expected to be incremented on return in omap_i2c_probe() and omap_i2c_remove().
However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here. I Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
What's more, error path 'err_free_mem' seems not like a proper name any more. So I change the name to err_disable_pm and move pm_runtime_disable below, for pm_runtime of 'pdev->dev' should be disabled when pm_runtime_resume_and_get fails.
--- drivers/i2c/busses/i2c-omap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-omap.c +4 -4
@@ -1404,9 +1404,9 @@ omap_i2c_probe(struct platform_device *pdev)pm_runtime_set_autosuspend_delay (omap->dev,OMAP_I2C_PM_TIMEOUT );pm_runtime_use_autosuspend (omap->dev); - r =pm_runtime_get_sync (omap->dev); + r =pm_runtime_resume_and_get (omap->dev);if (r <0 ) - goto err_free_mem; + goto err_disable_pm;/* * Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2.
@@ -1513,8 +1513,8 @@ err_unuse_clocks:omap_i2c_write_reg (omap,OMAP_I2C_CON_REG ,0 );pm_runtime_dont_use_autosuspend (omap->dev);pm_runtime_put_sync (omap->dev); +err_disable_pm:pm_runtime_disable (&pdev->dev); -err_free_mem:return r; }
@@ -1525,7 +1525,7 @@ static int omap_i2c_remove(struct platform_device *pdev)int ret;i2c_del_adapter (&omap->adapter); - ret =pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 561/677 i2c: sprd: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 3a4f326463117cee3adcb72999ca34a9aaafda93 ]
The PM reference count is not expected to be incremented on return in sprd_i2c_master_xfer() and sprd_i2c_remove().
However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-sprd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-sprd.c +2 -2
@@ -290,7 +290,7 @@ static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap,struct sprd_i2c *i2c_dev = i2c_adap->algo_data;int im, ret; - ret =pm_runtime_get_sync (i2c_dev->dev); + ret =pm_runtime_resume_and_get (i2c_dev->dev);if (ret <0 )return ret;
@@ -576,7 +576,7 @@ static int sprd_i2c_remove(struct platform_device *pdev)struct sprd_i2c *i2c_dev =platform_get_drvdata (pdev);int ret; - ret =pm_runtime_get_sync (i2c_dev->dev); + ret =pm_runtime_resume_and_get (i2c_dev->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 562/677 i2c: stm32f7: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit 2c662660ce2bd3b09dae21a9a9ac9395e1e6c00b ]
The PM reference count is not expected to be incremented on return in these stm32f7_i2c_xx serious functions.
However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-stm32f7.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +6 -6
@@ -1652,7 +1652,7 @@ static int stm32f7_i2c_xfer(struct i2c_adapter *i2c_adap, i2c_dev->msg_id =0 ; f7_msg->smbus = false; - ret =pm_runtime_get_sync (i2c_dev->dev); + ret =pm_runtime_resume_and_get (i2c_dev->dev);if (ret <0 )return ret;
@@ -1698,7 +1698,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, f7_msg->read_write = read_write; f7_msg->smbus = true; - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 )return ret;
@@ -1799,7 +1799,7 @@ static int stm32f7_i2c_reg_slave(struct i2c_client *slave)if (ret)return ret; - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 )return ret;
@@ -1880,7 +1880,7 @@ static int stm32f7_i2c_unreg_slave(struct i2c_client *slave)WARN_ON (!i2c_dev->slave[id]); - ret =pm_runtime_get_sync (i2c_dev->dev); + ret =pm_runtime_resume_and_get (i2c_dev->dev);if (ret <0 )return ret;
@@ -2273,7 +2273,7 @@ static int stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev)int ret;struct stm32f7_i2c_regs *backup_regs = &i2c_dev->backup_regs; - ret =pm_runtime_get_sync (i2c_dev->dev); + ret =pm_runtime_resume_and_get (i2c_dev->dev);if (ret <0 )return ret;
@@ -2295,7 +2295,7 @@ static int stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev)int ret;struct stm32f7_i2c_regs *backup_regs = &i2c_dev->backup_regs; - ret =pm_runtime_get_sync (i2c_dev->dev); + ret =pm_runtime_resume_and_get (i2c_dev->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 563/677 i2c: xiic: fix reference leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
[ Upstream commit a85c5c7a3aa8041777ff691400b4046e56149fd3 ]
The PM reference count is not expected to be incremented on return in xiic_xfer and xiic_i2c_remove.
However, pm_runtime_get_sync will increment the PM reference count even failed. Forgetting to putting operation will result in a reference leak here.
Replace it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/i2c/busses/i2c-xiic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-xiic.c +2 -2
@@ -706,7 +706,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)dev_dbg (adap->dev.parent,"%s entry SR: 0x%x\n" , __func__,xiic_getreg8 (i2c,XIIC_SR_REG_OFFSET )); - err =pm_runtime_get_sync (i2c->dev); + err =pm_runtime_resume_and_get (i2c->dev);if (err <0 )return err;
@@ -873,7 +873,7 @@ static int xiic_i2c_remove(struct platform_device *pdev)/* remove adapter & data */ i2c_del_adapter (&i2c->adap); - ret =pm_runtime_get_sync (i2c->dev); + ret =pm_runtime_resume_and_get (i2c->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 564/677 i2c: cadence: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 5581c2c5d02bc63a0edb53e061c8e97cd490646e ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-cadence.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-cadence.c +4 -1
@@ -1200,7 +1200,10 @@ static int cdns_i2c_probe(struct platform_device *pdev)if (IS_ERR (id->membase))return PTR_ERR (id->membase); - id->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) +return ret; + id->irq = ret; id->adap.owner =THIS_MODULE ; id->adap.dev.of_node = pdev->dev.of_node;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 565/677 i2c: emev2: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit bb6129c32867baa7988f7fd2066cf18ed662d240 ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-emev2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-emev2.c +4 -1
@@ -395,7 +395,10 @@ static int em_i2c_probe(struct platform_device *pdev)em_i2c_reset (&priv->adap); - priv->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto err_clk; + priv->irq = ret; ret =devm_request_irq (&pdev->dev, priv->irq, em_i2c_irq_handler,0 ,"em_i2c" , priv);if (ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 566/677 i2c: jz4780: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit c5e5f7a8d931fb4beba245bdbc94734175fda9de ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-jz4780.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-jz4780.c +4 -1
@@ -825,7 +825,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev)jz4780_i2c_writew (i2c,JZ4780_I2C_INTM ,0x0 ); - i2c->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto err; + i2c->irq = ret; ret =devm_request_irq (&pdev->dev, i2c->irq, jz4780_i2c_irq,0 ,dev_name (&pdev->dev), i2c);if (ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 567/677 i2c: mlxbf: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 0d3bf53e897dce943b98d975bbde77156af6cd81 ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-mlxbf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-mlxbf.c +2 -0
@@ -2376,6 +2376,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)mlxbf_i2c_init_slave (pdev, priv); irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; ret =devm_request_irq (dev, irq, mlxbf_smbus_irq,IRQF_ONESHOT |IRQF_SHARED |IRQF_PROBE_SHARED ,dev_name (dev), priv);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 568/677 i2c: rcar: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 147178cf03a6dcb337e703d4dacd008683022a58 ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with the invalid IRQ #s.
--- drivers/i2c/busses/i2c-rcar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +4 -1
@@ -1027,7 +1027,10 @@ static int rcar_i2c_probe(struct platform_device *pdev)if (of_property_read_bool (dev->of_node,"smbus" )) priv->flags |=ID_P_HOST_NOTIFY ; - priv->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto out_pm_disable; + priv->irq = ret; ret =devm_request_irq (dev, priv->irq, irqhandler, irqflags,dev_name (dev), priv);if (ret <0 ) {dev_err (dev,"cannot get irq %d\n" , priv->irq);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 569/677 i2c: sh7760: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit e5b2e3e742015dd2aa6bc7bcef2cb59b2de1221c ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-sh7760.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-sh7760.c +4 -1
@@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev) goto out2; } - id->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) +return ret; + id->irq = ret; id->adap.nr = pdev->id; id->adap.algo = &sh7760_i2c_algo;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 570/677 fuse: fix matching of FUSE_DEV_IOC_CLONE command
In reply to Greg Kroah-HartmanFrom: Alessio Balsini <[email protected]>
[ Upstream commit 6076f5f341e612152879bfda99f0b76c1953bf0b ]
With commit f8425c939663 ("fuse: 32-bit user space ioctl compat for fuse device") the matching constraints for the FUSE_DEV_IOC_CLONE ioctl command are relaxed, limited to the testing of command type and number. As Arnd noticed, this is wrong as it wouldn't ensure the correctness of the data size or direction for the received FUSE device ioctl.
Fix by bringing back the comparison of the ioctl received by the FUSE device to the originally generated FUSE_DEV_IOC_CLONE.
--- fs/fuse/dev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/fuse/dev.c +2 -5
@@ -2233,11 +2233,8 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,int oldfd;struct fuse_dev *fud =NULL ; -if (_IOC_TYPE (cmd) !=FUSE_DEV_IOC_MAGIC ) -return -ENOTTY ; - -switch (_IOC_NR (cmd)) { -case _IOC_NR (FUSE_DEV_IOC_CLONE ): +switch (cmd) { +case FUSE_DEV_IOC_CLONE : res = -EFAULT ;if (!get_user (oldfd, (__u32 __user *)arg)) {struct file *old =fget (oldfd);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 571/677 iwlwifi: rs-fw: dont support stbc for HE 160
In reply to Greg Kroah-HartmanFrom: Mordechay Goodstein <[email protected]>
[ Upstream commit a9174578262b86f15cb1882f35e53b1fae0649fd ]
Our HE doesn't support it so never set HE 160 stbc
--- .../net/wireless/intel/iwlwifi/mvm/rs-fw.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +8 -12
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright (C) 2017 Intel Deutschland GmbH -* Copyright (C) 2018-2020 Intel Corporation +* Copyright (C) 2018-2021 Intel Corporation */ #include "rs.h" #include "fw-api.h"
@@ -72,19 +72,15 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,bool vht_ena = vht_cap->vht_supported;u16 flags =0 ; +/* get STBC flags */ if (mvm->cfg->ht_params->stbc && (num_of_ant (iwl_mvm_get_valid_tx_ant (mvm)) >1 )) { -if (he_cap->has_he) { -if (he_cap->he_cap_elem.phy_cap_info[2 ] & -IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ ) - flags |=IWL_TLC_MNG_CFG_FLAGS_STBC_MSK ; - -if (he_cap->he_cap_elem.phy_cap_info[7 ] & -IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ ) - flags |=IWL_TLC_MNG_CFG_FLAGS_HE_STBC_160MHZ_MSK ; - }else if ((ht_cap->cap &IEEE80211_HT_CAP_RX_STBC ) || - (vht_ena && - (vht_cap->cap &IEEE80211_VHT_CAP_RXSTBC_MASK ))) +if (he_cap->has_he && he_cap->he_cap_elem.phy_cap_info[2 ] & +IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ ) + flags |=IWL_TLC_MNG_CFG_FLAGS_STBC_MSK ; +else if (vht_cap->cap &IEEE80211_VHT_CAP_RXSTBC_MASK ) + flags |=IWL_TLC_MNG_CFG_FLAGS_STBC_MSK ; +else if (ht_cap->cap &IEEE80211_HT_CAP_RX_STBC ) flags |=IWL_TLC_MNG_CFG_FLAGS_STBC_MSK ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 572/677 iwlwifi: dbg: disable ini debug in 9000 family and below
In reply to Greg Kroah-HartmanFrom: Mukesh Sisodiya <[email protected]>
[ Upstream commit 7c81a025054cd0aeeeaf17aba2e9757f0a6a38a1 ]
Yoyo based debug is not applicable to old devices. As init debug is enabled by default in the driver, it needs to be disabled to work the old debug mechanism in old devices.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +3 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2018-2020 Intel Corporation +* Copyright (C) 2018-2021 Intel Corporation */ #include <linux/firmware.h> #include "iwl-drv.h"
@@ -426,7 +426,8 @@ void iwl_dbg_tlv_load_bin(struct device *dev, struct iwl_trans *trans)const struct firmware *fw;int res; -if (!iwlwifi_mod_params.enable_ini) +if (!iwlwifi_mod_params.enable_ini || + trans->trans_cfg->device_family <=IWL_DEVICE_FAMILY_9000 )return ; res =firmware_request_nowarn (&fw,"iwl-debug-yoyo.bin" , dev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 573/677 powerpc/xive: Drop check on irq_data in xive_core_debug_show()
In reply to Greg Kroah-HartmanFrom: Cédric Le Goater <[email protected]>
[ Upstream commit a74ce5926b20cd0e6d624a9b2527073a96dfed7f ]
When looping on IRQ descriptor, irq_data is always valid.
--- arch/powerpc/sysdev/xive/common.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
arch/powerpc/sysdev/xive/common.c +10 -11
@@ -1599,6 +1599,8 @@ static void xive_debug_show_irq(struct seq_file *m, u32 hw_irq, struct irq_datau32 target;u8 prio;u32 lirq; +struct xive_irq_data *xd; +u64 val;if (!is_xive_irq (chip))return ;
@@ -1612,17 +1614,14 @@ static void xive_debug_show_irq(struct seq_file *m, u32 hw_irq, struct irq_dataseq_printf (m,"IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x " , hw_irq, target, prio, lirq); -if (d) { -struct xive_irq_data *xd =irq_data_get_irq_handler_data (d); -u64 val =xive_esb_read (xd,XIVE_ESB_GET ); - -seq_printf (m,"flags=%c%c%c PQ=%c%c" , - xd->flags &XIVE_IRQ_FLAG_STORE_EOI ?'S' :' ' , - xd->flags &XIVE_IRQ_FLAG_LSI ?'L' :' ' , - xd->flags &XIVE_IRQ_FLAG_H_INT_ESB ?'H' :' ' , - val &XIVE_ESB_VAL_P ?'P' :'-' , - val &XIVE_ESB_VAL_Q ?'Q' :'-' ); - } + xd =irq_data_get_irq_handler_data (d); + val =xive_esb_read (xd,XIVE_ESB_GET ); +seq_printf (m,"flags=%c%c%c PQ=%c%c" , + xd->flags &XIVE_IRQ_FLAG_STORE_EOI ?'S' :' ' , + xd->flags &XIVE_IRQ_FLAG_LSI ?'L' :' ' , + xd->flags &XIVE_IRQ_FLAG_H_INT_ESB ?'H' :' ' , + val &XIVE_ESB_VAL_P ?'P' :'-' , + val &XIVE_ESB_VAL_Q ?'Q' :'-' );seq_puts (m,"\n" ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 574/677 powerpc/xive: Fix xmon command "dxi"
In reply to Greg Kroah-HartmanFrom: Cédric Le Goater <[email protected]>
[ Upstream commit 33e4bc5946432a4ac173fd08e8e30a13ab94d06d ]
When under xmon, the "dxi" command dumps the state of the XIVE interrupts. If an interrupt number is specified, only the state of the associated XIVE interrupt is dumped. This form of the command lacks an irq_data parameter which is nevertheless used by xmon_xive_get_irq_config(), leading to an xmon crash.
Fix that by doing a lookup in the system IRQ mapping to query the IRQ descriptor data. Invalid interrupt numbers, or not belonging to the XIVE IRQ domain, OPAL event interrupt number for instance, should be caught by the previous query done at the firmware level.
--- arch/powerpc/sysdev/xive/common.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/powerpc/sysdev/xive/common.c +10 -4
@@ -253,17 +253,20 @@ notrace void xmon_xive_do_dump(int cpu)xmon_printf ("\n" ); } +static struct irq_data *xive_get_irq_data (u32 hw_irq) +{ +unsigned int irq =irq_find_mapping (xive_irq_domain, hw_irq); + +return irq ?irq_get_irq_data (irq) :NULL ; +} +int xmon_xive_get_irq_config (u32 hw_irq,struct irq_data *d) { -struct irq_chip *chip =irq_data_get_irq_chip (d);int rc;u32 target;u8 prio;u32 lirq; -if (!is_xive_irq (chip)) -return -EINVAL ; - rc = xive_ops->get_irq_config (hw_irq, &target, &prio, &lirq);if (rc) {xmon_printf ("IRQ 0x%08x : no config rc=%d\n" , hw_irq, rc);
@@ -273,6 +276,9 @@ int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)xmon_printf ("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x " , hw_irq, target, prio, lirq); +if (!d) + d =xive_get_irq_data (hw_irq); +if (d) {struct xive_irq_data *xd =irq_data_get_irq_handler_data (d);u64 val =xive_esb_read (xd,XIVE_ESB_GET );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 575/677 powerpc/syscall: switch user_exit_irqoff and trace_hardirqs_off order
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 5a5a893c4ad897b8a36f846602895515b7407a71 ]
user_exit_irqoff() -> __context_tracking_exit -> vtime_user_exit warns in __seqprop_assert due to lockdep thinking preemption is enabled because trace_hardirqs_off() has not yet been called.
Switch the order of these two calls, which matches their ordering in interrupt_enter_prepare.
--- arch/powerpc/kernel/interrupt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/interrupt.c +2 -2
@@ -34,11 +34,11 @@ notrace long system_call_exception(long r3, long r4, long r5,if (IS_ENABLED (CONFIG_PPC_IRQ_SOFT_MASK_DEBUG ))BUG_ON (irq_soft_mask_return () !=IRQS_ALL_DISABLED ); +trace_hardirqs_off ();/* finish reconciling */ +CT_WARN_ON (ct_state () ==CONTEXT_KERNEL );user_exit_irqoff (); -trace_hardirqs_off ();/* finish reconciling */ -if (!IS_ENABLED (CONFIG_BOOKE ) && !IS_ENABLED (CONFIG_40x))BUG_ON (!(regs->msr &MSR_RI ));BUG_ON (!(regs->msr &MSR_PR ));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 576/677 ASoC: ak5558: correct reset polarity
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 0b93bbc977af55fd10687f2c96c807cba95cb927 ]
Reset (aka power off) happens when the reset gpio is made active. The reset gpio is GPIO_ACTIVE_LOW
--- sound/soc/codecs/ak5558.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/ak5558.c +2 -2
@@ -272,7 +272,7 @@ static void ak5558_power_off(struct ak5558_priv *ak5558)if (!ak5558->reset_gpiod)return ; -gpiod_set_value_cansleep (ak5558->reset_gpiod,0 ); +gpiod_set_value_cansleep (ak5558->reset_gpiod,1 );usleep_range (1000 ,2000 ); }
@@ -281,7 +281,7 @@ static void ak5558_power_on(struct ak5558_priv *ak5558)if (!ak5558->reset_gpiod)return ; -gpiod_set_value_cansleep (ak5558->reset_gpiod,1 ); +gpiod_set_value_cansleep (ak5558->reset_gpiod,0 );usleep_range (1000 ,2000 ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 577/677 net/mlx5: Fix bit-wise and with zero
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 82c3ba31c370b6001cbf90689e98da1fb6f26aef ]
The bit-wise and of the action field with MLX5_ACCEL_ESP_ACTION_DECRYPT is incorrect as MLX5_ACCEL_ESP_ACTION_DECRYPT is zero and not intended to be a bit-flag. Fix this by using the == operator as was originally intended.
Addresses-Coverity: ("Logically dead code")
--- drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +1 -1
@@ -850,7 +850,7 @@ mlx5_fpga_ipsec_release_sa_ctx(struct mlx5_fpga_ipsec_sa_ctx *sa_ctx)return ; } -if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action & +if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action ==MLX5_ACCEL_ESP_ACTION_DECRYPT )ida_simple_remove (&fipsec->halloc, sa_ctx->sa_handle);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 578/677 net/packet: remove data races in fanout operations
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 94f633ea8ade8418634d152ad0931133338226f6 ]
af_packet fanout uses RCU rules to ensure f->arr elements are not dismantled before RCU grace period.
However, it lacks rcu accessors to make sure KCSAN and other tools wont detect data races. Stupid compilers could also play games.
--- net/packet/af_packet.c | 15 +++++++++------ net/packet/internal.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-)
net/packet/af_packet.c +9 -6
@@ -1359,7 +1359,7 @@ static unsigned int fanout_demux_rollover(struct packet_fanout *f,struct packet_sock *po, *po_next, *po_skip =NULL ;unsigned int i, j, room =ROOM_NONE ; - po =pkt_sk (f->arr[idx]); + po =pkt_sk (rcu_dereference (f->arr[idx]));if (try_self) { room =packet_rcv_has_room (po, skb);
@@ -1371,7 +1371,7 @@ static unsigned int fanout_demux_rollover(struct packet_fanout *f, i = j =min_t (int, po->rollover->sock, num -1 ); do { - po_next = pkt_sk(f->arr[i]); + po_next = pkt_sk(rcu_dereference(f->arr[i])); if (po_next != po_skip && !READ_ONCE(po_next->pressure) && packet_rcv_has_room(po_next, skb) == ROOM_NORMAL) { if (i != j)
@@ -1466,7 +1466,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev,if (fanout_has_flag (f,PACKET_FANOUT_FLAG_ROLLOVER )) idx =fanout_demux_rollover (f, skb, idx, true, num); - po =pkt_sk (f->arr[idx]); + po =pkt_sk (rcu_dereference (f->arr[idx]));return po->prot_hook.func (skb, dev, &po->prot_hook, orig_dev); }
@@ -1480,7 +1480,7 @@ static void __fanout_link(struct sock *sk, struct packet_sock *po)struct packet_fanout *f = po->fanout;spin_lock (&f->lock); - f->arr[f->num_members] = sk; +rcu_assign_pointer (f->arr[f->num_members], sk);smp_wmb (); f->num_members++;if (f->num_members ==1 )
@@ -1495,11 +1495,14 @@ static void __fanout_unlink(struct sock *sk, struct packet_sock *po)spin_lock (&f->lock);for (i =0 ; i < f->num_members; i++) { -if (f->arr[i] == sk) +if (rcu_dereference_protected (f->arr[i], +lockdep_is_held (&f->lock)) == sk)break ; }BUG_ON (i >= f->num_members); - f->arr[i] = f->arr[f->num_members -1 ]; +rcu_assign_pointer (f->arr[i], +rcu_dereference_protected (f->arr[f->num_members -1 ], +lockdep_is_held (&f->lock))); f->num_members--;if (f->num_members ==0 )__dev_remove_pack (&f->prot_hook);
net/packet/internal.h +1 -1
@@ -94,7 +94,7 @@ struct packet_fanout {spinlock_t lock;refcount_t sk_ref;struct packet_type prot_hook____cacheline_aligned_in_smp ; -struct sock *arr[]; +struct sock __rcu *arr[]; };struct packet_rollover {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 579/677 drm/i915/gvt: Fix error code in intel_gvt_init_device()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 329328ec6a87f2c1275f50d979d55513de458409 ]
The intel_gvt_init_vgpu_type_groups() function is only called from intel_gvt_init_device(). If it fails then the intel_gvt_init_device() prints the error code and propagates it back again. That's a bug because false is zero/success. The fix is to modify it to return zero or negative error codes and make everything consistent.
--- drivers/gpu/drm/i915/gvt/gvt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.c +4 -4
@@ -126,7 +126,7 @@ static bool intel_get_gvt_attrs(struct attribute_group ***intel_vgpu_type_groupsreturn true; } -static bool intel_gvt_init_vgpu_type_groups (struct intel_gvt *gvt) +static int intel_gvt_init_vgpu_type_groups (struct intel_gvt *gvt) {int i, j;struct intel_vgpu_type *type;
@@ -144,7 +144,7 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) gvt_vgpu_type_groups[i] = group; } -return true; +return 0 ; unwind:for (j =0 ; j < i; j++) {
@@ -152,7 +152,7 @@ unwind:kfree (group); } -return false; +return -ENOMEM ; }static void intel_gvt_cleanup_vgpu_type_groups (struct intel_gvt *gvt)
@@ -360,7 +360,7 @@ int intel_gvt_init_device(struct drm_i915_private *i915) goto out_clean_thread; ret =intel_gvt_init_vgpu_type_groups (gvt); -if (ret == false) { +if (ret) {gvt_err ("failed to init vgpu type groups: %d\n" , ret); goto out_clean_types; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 580/677 iommu/vt-d: Fix an error handling path in intel_prepare_irq_remapping()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 745610c4a3e3baaebf6d1f8cd5b4d82892432520 ]
If 'intel_cap_audit()' fails, we should return directly, as already done in the surrounding error handling path.
--- drivers/iommu/intel/irq_remapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/irq_remapping.c +1 -1
@@ -736,7 +736,7 @@ static int __init intel_prepare_irq_remapping(void)return -ENODEV ;if (intel_cap_audit (CAP_AUDIT_STATIC_IRQR ,NULL )) - goto error; +return -ENODEV ;if (!dmar_ir_support ())return -ENODEV ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 581/677 iommu/amd: Put newline after closing bracket in warning
In reply to Greg Kroah-HartmanFrom: Paul Menzel <[email protected]>
[ Upstream commit 304c73ba69459d4c18c2a4b843be6f5777b4b85c ]
Currently, on the Dell OptiPlex 5055 the EFR mismatch warning looks like below.
[ 1.479774] smpboot: CPU0: AMD Ryzen 5 PRO 1500 Quad-Core Processor (family: 0x17, model: 0x1, stepping: 0x1)
[…]
[ 2.507370] AMD-Vi: [Firmware Warn]: EFR mismatch. Use IVHD EFR (0xf77ef22294ada : 0x400f77ef22294ada
).Add the newline after the )., so it’s on one line.
--- drivers/iommu/amd/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/init.c +1 -1
@@ -1837,7 +1837,7 @@ static void __init late_iommu_features_init(struct amd_iommu *iommu)* IVHD and MMIO conflict. */ if (features != iommu->features) -pr_warn (FW_WARN "EFR mismatch. Use IVHD EFR (%#llx : %#llx\n)." , +pr_warn (FW_WARN "EFR mismatch. Use IVHD EFR (%#llx : %#llx).\n" , features, iommu->features); }
Signature · 8 lines
2.30.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 582/677 perf beauty: Fix fsconfig generator
In reply to Greg Kroah-HartmanFrom: Vitaly Chikunov <[email protected]>
[ Upstream commit 2e1daee14e67fbf9b27280b974e2c680a22cabea ]
After gnulib update sed stopped matching `[[:space:]]*+' as before, causing the following compilation error:
In file included from builtin-trace.c:719:
trace/beauty/generated/fsconfig_arrays.c:2:3: error: expected expression before ']' token
2 | [] = "", | ^
trace/beauty/generated/fsconfig_arrays.c:2:3: error: array index in initializer not of integer type trace/beauty/generated/fsconfig_arrays.c:2:3: note: (near initialization for 'fsconfig_cmds')
Fix this by correcting the regular expression used in the generator. Also, clean up the script by removing redundant egrep, xargs, and printf invocations.
Committer testing:
Continues to work:
$ cat tools/perf/trace/beauty/fsconfig.sh #!/bin/sh # SPDX-License-Identifier: LGPL-2.1
if [ $# -ne 1 ] ; then
linux_header_dir=tools/include/uapi/linux
else
linux_header_dir=$1
fi
linux_mount=${linux_header_dir}/mount.h
printf "static const char *fsconfig_cmds[] = {\n"
ms='[[:space:]]*'
sed -nr "s/^${ms}FSCONFIG_([[:alnum:]_]+)${ms}=${ms}([[:digit:]]+)${ms},.*/\t[\2] = \"\1\",/p" \
${linux_mount}
printf "};\n"
$ tools/perf/trace/beauty/fsconfig.sh
static const char *fsconfig_cmds[] = {
[0] = "SET_FLAG",
[1] = "SET_STRING",
[2] = "SET_BINARY",
[3] = "SET_PATH",
[4] = "SET_PATH_EMPTY",
[5] = "SET_FD",
[6] = "CMD_CREATE",
[7] = "CMD_RECONFIGURE",
};
$--- tools/perf/trace/beauty/fsconfig.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tools/perf/trace/beauty/fsconfig.sh +3 -4
@@ -10,8 +10,7 @@ fi linux_mount=${linux_header_dir}/mount.h printf "static const char *fsconfig_cmds[] = {\n" -regex='^[[:space:]]*+FSCONFIG_([[:alnum:]_]+)[[:space:]]*=[[:space:]]*([[:digit:]]+)[[:space:]]*,[[:space:]]*.*' -egrep $regex ${linux_mount} | \ - sed -r "s/$regex/\2 \1/g" | \ - xargs printf "\t[%s] = \"%s\",\n" +ms='[[:space:]]*' +sed -nr "s/^${ms}FSCONFIG_([[:alnum:]_]+)${ms}=${ms}([[:digit:]]+)${ms},.*/\t[\2] = \"\1\",/p" \ + ${linux_mount} printf "};\n"
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 583/677 drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 90cb3d8aca1baea9471d28f28d5de1528dd5e424 ]
If the kmemdup() fails then this should return a negative error code but it currently returns success
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +3 -1
@@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry, pmu_entry->pmu.attr_groups =kmemdup (attr_groups,sizeof (attr_groups),GFP_KERNEL ); -if (!pmu_entry->pmu.attr_groups) +if (!pmu_entry->pmu.attr_groups) { + ret = -ENOMEM ; goto err_attr_group; + }snprintf (pmu_name,PMU_NAME_SIZE ,"%s_%d" , pmu_entry->pmu_file_prefix,adev_to_drm (pmu_entry->adev)->primary->index);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 584/677 drm/amd/pm: fix error code in smu_set_power_limit()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit bbdfe5aaef3c1d5c5e62fa235ef13f064e4c1c17 ]
We should return -EINVAL instead of success if the "limit" is too high.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
@@ -2086,6 +2086,7 @@ int smu_set_power_limit(struct smu_context *smu, uint32_t limit)dev_err (smu->adev->dev,"New power limit (%d) is over the max allowed %d\n" , limit, smu->max_power_limit); + ret = -EINVAL ; goto out; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 585/677 MIPS: pci-legacy: stop using of_pci_range_to_resource
In reply to Greg Kroah-HartmanFrom: Ilya Lipnitskiy <[email protected]>
[ Upstream commit 3ecb9dc1581eebecaee56decac70e35365260866 ]
Mirror commit aeba3731b150 ("powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change").
Most MIPS platforms do not define PCI_IOBASE, nor implement pci_address_to_pio(). Moreover, IO_SPACE_LIMIT is 0xffff for most MIPS platforms. of_pci_range_to_resource passes the _start address_ of the IO range into pci_address_to_pio, which then checks it against IO_SPACE_LIMIT and fails, because for MIPS platforms that use pci-legacy (pci-lantiq, pci-rt3883, pci-mt7620), IO ranges start much higher than 0xffff.
In fact, pci-mt7621 in staging already works around this problem, see commit 09dd629eeabb ("staging: mt7621-pci: fix io space and properly set resource limits")
So just stop using of_pci_range_to_resource, which does not work for MIPS.
Fixes PCI errors like:
pci_bus 0000:00: root bus resource [io 0xffffffff]
--- arch/mips/pci/pci-legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/pci/pci-legacy.c +7 -2
@@ -166,8 +166,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) res = hose->mem_resource;break ; } -if (res !=NULL ) -of_pci_range_to_resource (&range, node, res); +if (res !=NULL ) { + res->name = node->full_name; + res->flags = range.flags; + res->start = range.cpu_addr; + res->end = range.cpu_addr + range.size -1 ; + res->parent = res->child = res->sibling =NULL ; + } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 586/677 powerpc/pseries: extract host bridge from pci_bus prior to bus removal
In reply to Greg Kroah-HartmanFrom: Tyrel Datwyler <[email protected]>
[ Upstream commit 38d0b1c9cec71e6d0f3bddef0bbce41d05a3e796 ]
The pci_bus->bridge reference may no longer be valid after pci_bus_remove() resulting in passing a bad value to device_unregister() for the associated bridge device.
Store the host_bridge reference in a separate variable prior to pci_bus_remove().
--- arch/powerpc/platforms/pseries/pci_dlpar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/pci_dlpar.c +3 -1
@@ -50,6 +50,7 @@ EXPORT_SYMBOL_GPL(init_phb_dynamic);int remove_phb_dynamic (struct pci_controller *phb) {struct pci_bus *b = phb->bus; +struct pci_host_bridge *host_bridge =to_pci_host_bridge (b->bridge);struct resource *res;int rc, i;
@@ -76,7 +77,8 @@ int remove_phb_dynamic(struct pci_controller *phb)/* Remove the PCI bus and unregister the bridge device from sysfs */ phb->bus =NULL ;pci_remove_bus (b); -device_unregister (b->bridge); + host_bridge->bus =NULL ; +device_unregister (&host_bridge->dev);/* Now release the IO resource */ if (res->flags &IORESOURCE_IO )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 587/677 iommu/mediatek: Always enable the clk on resume
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit b34ea31fe013569d42b7e8681ef3f717f77c5b72 ]
In mtk_iommu_runtime_resume always enable the clk, even if m4u_dom is null. Otherwise the 'suspend' cb might disable the clk which is already disabled causing the warning:
[ 1.586104] infra_m4u already disabled [ 1.586133] WARNING: CPU: 0 PID: 121 at drivers/clk/clk.c:952 clk_core_disable+0xb0/0xb8 [ 1.594391] mtk-iommu 10205000.iommu: bound 18001000.larb (ops mtk_smi_larb_component_ops) [ 1.598108] Modules linked in: [ 1.598114] CPU: 0 PID: 121 Comm: kworker/0:2 Not tainted 5.12.0-rc5 #69 [ 1.609246] mtk-iommu 10205000.iommu: bound 14027000.larb (ops mtk_smi_larb_component_ops) [ 1.617487] Hardware name: Google Elm (DT) [ 1.617491] Workqueue: pm pm_runtime_work [ 1.620545] mtk-iommu 10205000.iommu: bound 19001000.larb (ops mtk_smi_larb_component_ops)
[ 1.627229] pstate: 60000085 (nZCv daIf -PAN -UAO -TCO BTYPE=--) [ 1.659297] pc : clk_core_disable+0xb0/0xb8 [ 1.663475] lr : clk_core_disable+0xb0/0xb8 [ 1.667652] sp : ffff800011b9bbe0 [ 1.670959] x29: ffff800011b9bbe0 x28: 0000000000000000 [ 1.676267] x27: ffff800011448000 x26: ffff8000100cfd98 [ 1.681574] x25: ffff800011b9bd48 x24: 0000000000000000 [ 1.686882] x23: 0000000000000000 x22: ffff8000106fad90 [ 1.692189] x21: 000000000000000a x20: ffff0000c0048500 [ 1.697496] x19: ffff0000c0048500 x18: ffffffffffffffff [ 1.702804] x17: 0000000000000000 x16: 0000000000000000 [ 1.708112] x15: ffff800011460300 x14: fffffffffffe0000 [ 1.713420] x13: ffff8000114602d8 x12: 0720072007200720 [ 1.718727] x11: 0720072007200720 x10: 0720072007200720 [ 1.724035] x9 : ffff800011b9bbe0 x8 : ffff800011b9bbe0 [ 1.729342] x7 : 0000000000000009 x6 : ffff8000114b8328 [ 1.734649] x5 : 0000000000000000 x4 : 0000000000000000 [ 1.739956] x3 : 00000000ffffffff x2 : ffff800011460298 [ 1.745263] x1 : 1af1d7de276f4500 x0 : 0000000000000000 [ 1.750572] Call trace: [ 1.753010] clk_core_disable+0xb0/0xb8 [ 1.756840] clk_core_disable_lock+0x24/0x40 [ 1.761105] clk_disable+0x20/0x30 [ 1.764501] mtk_iommu_runtime_suspend+0x88/0xa8 [ 1.769114] pm_generic_runtime_suspend+0x2c/0x48 [ 1.773815] __rpm_callback+0xe0/0x178 [ 1.777559] rpm_callback+0x24/0x88 [ 1.781041] rpm_suspend+0xdc/0x470 [ 1.784523] rpm_idle+0x12c/0x170 [ 1.787831] pm_runtime_work+0xa8/0xc0 [ 1.791573] process_one_work+0x1e8/0x360 [ 1.795580] worker_thread+0x44/0x478 [ 1.799237] kthread+0x150/0x158 [ 1.802460] ret_from_fork+0x10/0x30 [ 1.806034] ---[ end trace 82402920ef64573b ]--- [ 1.810728] ------------[ cut here ]------------
In addition, we now don't need to enable the clock from the function mtk_iommu_hw_init since it is already enabled by the resume.
--- drivers/iommu/mtk_iommu.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/iommu/mtk_iommu.c +8 -11
@@ -688,13 +688,6 @@ static const struct iommu_ops mtk_iommu_ops = {static int mtk_iommu_hw_init (const struct mtk_iommu_data *data) {u32 regval; -int ret; - - ret =clk_prepare_enable (data->bclk); -if (ret) { -dev_err (data->dev,"Failed to enable iommu bclk(%d)\n" , ret); -return ret; - }if (data->plat_data->m4u_plat ==M4U_MT8173 ) { regval = F_MMU_PREFETCH_RT_REPLACE_MOD |
@@ -760,7 +753,6 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data)if (devm_request_irq (data->dev, data->irq, mtk_iommu_isr,0 ,dev_name (data->dev), (void *)data)) {writel_relaxed (0 , data->base +REG_MMU_PT_BASE_ADDR ); -clk_disable_unprepare (data->bclk);dev_err (data->dev,"Failed @ IRQ-%d Request\n" , data->irq);return -ENODEV ; }
@@ -977,14 +969,19 @@ static int __maybe_unused mtk_iommu_runtime_resume(struct device *dev)void __iomem *base = data->base;int ret; -/* Avoid first resume to affect the default value of registers below. */ -if (!m4u_dom) -return 0 ; ret =clk_prepare_enable (data->bclk);if (ret) {dev_err (data->dev,"Failed to enable clk(%d) in resume\n" , ret);return ret; } + +/* +* Uppon first resume, only enable the clk and return, since the values of the +* registers are not yet set. +*/ +if (!m4u_dom) +return 0 ; +writel_relaxed (reg->wr_len_ctrl, base +REG_MMU_WR_LEN_CTRL );writel_relaxed (reg->misc_ctrl, base +REG_MMU_MISC_CTRL );writel_relaxed (reg->dcm_dis, base +REG_MMU_DCM_DIS );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 588/677 mptcp: fix format specifiers for unsigned int
In reply to Greg Kroah-HartmanFrom: Geliang Tang <[email protected]>
[ Upstream commit e4b6135134a75f530bd634ea7c168efaf0f9dff3 ]
Some of the sequence numbers are printed as the negative ones in the debug log:
[ 46.250932] MPTCP: DSS [ 46.250940] MPTCP: data_fin=0 dsn64=0 use_map=0 ack64=1 use_ack=1 [ 46.250948] MPTCP: data_ack=2344892449471675613 [ 46.251012] MPTCP: msk=000000006e157e3f status=10 [ 46.251023] MPTCP: msk=000000006e157e3f snd_data_fin_enable=0 pending=0 snd_nxt=2344892449471700189 write_seq=2344892449471700189 [ 46.251343] MPTCP: msk=00000000ec44a129 ssk=00000000f7abd481 sending dfrag at seq=-1658937016627538668 len=100 already sent=0 [ 46.251360] MPTCP: data_seq=16787807057082012948 subflow_seq=1 data_len=100 dsn64=1
This patch used the format specifier %u instead of %d for the unsigned int values to fix it.
--- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +2 -2
@@ -1275,7 +1275,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,int avail_size;size_t ret =0 ; -pr_debug ("msk=%p ssk=%p sending dfrag at seq=%lld len=%d already sent=%d" , +pr_debug ("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u" , msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent);/* compute send limit */
@@ -1693,7 +1693,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)if (!msk->first_pending)WRITE_ONCE (msk->first_pending, dfrag); } -pr_debug ("msk=%p dfrag at seq=%lld len=%d sent=%d new=%d" , msk, +pr_debug ("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d" , msk, dfrag->data_seq, dfrag->data_len, dfrag->already_sent, !dfrag_collapsed);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 589/677 powerpc/smp: Reintroduce cpu_core_mask
In reply to Greg Kroah-HartmanFrom: Srikar Dronamraju <[email protected]>
[ Upstream commit c47f892d7aa62765bf0689073f75990b4517a4cf ]
Daniel reported that with Commit 4ca234a9cbd7 ("powerpc/smp: Stop updating cpu_core_mask") QEMU was unable to set single NUMA node SMP topologies such as:
-smp 8,maxcpus=8,cores=2,threads=2,sockets=2
i.e he expected 2 sockets in one NUMA node.
The above commit helped to reduce boot time on Large Systems for example 4096 vCPU single socket QEMU instance. PAPR is silent on having more than one socket within a NUMA node.
cpu_core_mask and cpu_cpu_mask for any CPU would be same unless the number of sockets is different from the number of NUMA nodes.
One option is to reintroduce cpu_core_mask but use a slightly different method to arrive at the cpu_core_mask. Previously each CPU's chip-id would be compared with all other CPU's chip-id to verify if both the CPUs were related at the chip level. Now if a CPU 'A' is found related / (unrelated) to another CPU 'B', all the thread siblings of 'A' and thread siblings of 'B' are automatically marked as related / (unrelated).
Also if a platform doesn't support ibm,chip-id property, i.e its cpu_to_chip_id returns -1, cpu_core_map holds a copy of cpu_cpu_mask().
--- arch/powerpc/include/asm/smp.h | 5 +++++ arch/powerpc/kernel/smp.c | 39 ++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/smp.h +5 -0
@@ -121,6 +121,11 @@ static inline struct cpumask *cpu_sibling_mask(int cpu)return per_cpu (cpu_sibling_map, cpu); } +static inline struct cpumask *cpu_core_mask (int cpu) +{ +return per_cpu (cpu_core_map, cpu); +} +static inline struct cpumask *cpu_l2_cache_mask (int cpu) {return per_cpu (cpu_l2_cache_map, cpu);
arch/powerpc/kernel/smp.c +32 -7
@@ -1057,17 +1057,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus) local_memory_node(numa_cpu_lookup_table[cpu])); }#endif -/* -* cpu_core_map is now more updated and exists only since -* its been exported for long. It only will have a snapshot -* of cpu_cpu_mask. -*/ -cpumask_copy (per_cpu (cpu_core_map, cpu),cpu_cpu_mask (cpu)); }/* Init the cpumasks so the boot CPU is related to itself */ cpumask_set_cpu (boot_cpuid,cpu_sibling_mask (boot_cpuid));cpumask_set_cpu (boot_cpuid,cpu_l2_cache_mask (boot_cpuid)); +cpumask_set_cpu (boot_cpuid,cpu_core_mask (boot_cpuid));if (has_coregroup_support ())cpumask_set_cpu (boot_cpuid,cpu_coregroup_mask (boot_cpuid));
@@ -1408,6 +1403,9 @@ static void remove_cpu_from_masks(int cpu)set_cpus_unrelated (cpu, i, cpu_smallcore_mask); } +for_each_cpu (i,cpu_core_mask (cpu)) +set_cpus_unrelated (cpu, i, cpu_core_mask); +if (has_coregroup_support ()) {for_each_cpu (i,cpu_coregroup_mask (cpu))set_cpus_unrelated (cpu, i, cpu_coregroup_mask);
@@ -1468,8 +1466,11 @@ static void update_coregroup_mask(int cpu, cpumask_var_t *mask)static void add_cpu_to_masks (int cpu) { +struct cpumask *(*submask_fn)(int ) = cpu_sibling_mask;int first_thread =cpu_first_thread_sibling (cpu); +int chip_id =cpu_to_chip_id (cpu);cpumask_var_t mask; +bool ret;int i;/*
@@ -1485,12 +1486,36 @@ static void add_cpu_to_masks(int cpu)add_cpu_to_smallcore_masks (cpu);/* In CPU-hotplug path, hence use GFP_ATOMIC */ -alloc_cpumask_var_node (&mask,GFP_ATOMIC ,cpu_to_node (cpu)); + ret =alloc_cpumask_var_node (&mask,GFP_ATOMIC ,cpu_to_node (cpu));update_mask_by_l2 (cpu, &mask);if (has_coregroup_support ())update_coregroup_mask (cpu, &mask); +if (chip_id ==-1 || !ret) { +cpumask_copy (per_cpu (cpu_core_map, cpu),cpu_cpu_mask (cpu)); + goto out; + } + +if (shared_caches) + submask_fn = cpu_l2_cache_mask; + +/* Update core_mask with all the CPUs that are part of submask */ +or_cpumasks_related (cpu, cpu, submask_fn, cpu_core_mask); + +/* Skip all CPUs already part of current CPU core mask */ +cpumask_andnot (mask, cpu_online_mask,cpu_core_mask (cpu)); + +for_each_cpu (i, mask) { +if (chip_id ==cpu_to_chip_id (i)) { +or_cpumasks_related (cpu, i, submask_fn, cpu_core_mask); +cpumask_andnot (mask, mask,submask_fn (i)); + }else { +cpumask_andnot (mask, mask,cpu_core_mask (i)); + } + } + +out:free_cpumask_var (mask); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 590/677 KVM: x86: dump_vmcs should not assume GUEST_IA32_EFER is valid
In reply to Greg Kroah-HartmanFrom: David Edmondson <[email protected]>
[ Upstream commit d9e46d344e62a0d56fd86a8289db5bed8a57c92e ]
If the VM entry/exit controls for loading/saving MSR_EFER are either not available (an older processor or explicitly disabled) or not used (host and guest values are the same), reading GUEST_IA32_EFER from the VMCS returns an inaccurate value.
Because of this, in dump_vmcs() don't use GUEST_IA32_EFER to decide whether to print the PDPTRs - always do so if the fields exist.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
arch/x86/kvm/vmx/vmx.c +3 -6
@@ -5792,7 +5792,6 @@ void dump_vmcs(void)u32 vmentry_ctl, vmexit_ctl;u32 cpu_based_exec_ctrl, pin_based_exec_ctrl, secondary_exec_control;unsigned long cr4; -u64 efer;if (!dump_invalid_vmcs) {pr_warn_ratelimited ("set kvm_intel.dump_invalid_vmcs=1 to dump internal KVM state.\n" );
@@ -5804,7 +5803,6 @@ void dump_vmcs(void) cpu_based_exec_ctrl =vmcs_read32 (CPU_BASED_VM_EXEC_CONTROL ); pin_based_exec_ctrl =vmcs_read32 (PIN_BASED_VM_EXEC_CONTROL ); cr4 =vmcs_readl (GUEST_CR4 ); - efer =vmcs_read64 (GUEST_IA32_EFER ); secondary_exec_control =0 ;if (cpu_has_secondary_exec_ctrls ()) secondary_exec_control =vmcs_read32 (SECONDARY_VM_EXEC_CONTROL );
@@ -5816,9 +5814,7 @@ void dump_vmcs(void)pr_err ("CR4: actual=0x%016lx, shadow=0x%016lx, gh_mask=%016lx\n" , cr4,vmcs_readl (CR4_READ_SHADOW ),vmcs_readl (CR4_GUEST_HOST_MASK ));pr_err ("CR3 = 0x%016lx\n" ,vmcs_readl (GUEST_CR3 )); -if ((secondary_exec_control &SECONDARY_EXEC_ENABLE_EPT ) && - (cr4 &X86_CR4_PAE ) && !(efer &EFER_LMA )) - { +if (cpu_has_vmx_ept ()) {pr_err ("PDPTR0 = 0x%016llx PDPTR1 = 0x%016llx\n" ,vmcs_read64 (GUEST_PDPTR0 ),vmcs_read64 (GUEST_PDPTR1 )); pr_err("PDPTR2 = 0x%016llx PDPTR3 = 0x%016llx\n",
@@ -5844,7 +5840,8 @@ void dump_vmcs(void)if ((vmexit_ctl & (VM_EXIT_SAVE_IA32_PAT |VM_EXIT_SAVE_IA32_EFER )) || (vmentry_ctl & (VM_ENTRY_LOAD_IA32_PAT |VM_ENTRY_LOAD_IA32_EFER )))pr_err ("EFER = 0x%016llx PAT = 0x%016llx\n" , - efer,vmcs_read64 (GUEST_IA32_PAT )); +vmcs_read64 (GUEST_IA32_EFER ), +vmcs_read64 (GUEST_IA32_PAT ));pr_err ("DebugCtl = 0x%016llx DebugExceptions = 0x%016lx\n" ,vmcs_read64 (GUEST_IA32_DEBUGCTL ),vmcs_readl (GUEST_PENDING_DBG_EXCEPTIONS ));
Signature · 1 line
2.30.2