4.19.129-rc1 review
Subsystems (8)
Re: [PATCH 4.19 157/267] mt76: avoid rx reorder buffer overflow
In reply to Greg Kroah-HartmanQuoted 10 lines · Greg Kroah-Hartman
From: Ryder Lee <[email protected]>
[ Upstream commit
7c4f744d6703757be959f521a7a441bf34745d99]Enlarge slot to support 11ax 256 BA (256 MPDUs in an AMPDU)
Signed-off-by Chih-Min Chen <[email protected]>Signed-off-by Ryder Lee <[email protected]>Signed-off-by Felix Fietkau <[email protected]>Signed-off-by Sasha Levin <[email protected]>
It does not make sense to backport this commit. It doesn't fix anything, it's just preparation work for the mt7915 driver.
- Felix
Greg Kroah-Hartman
maintainerPATCH 158/267 md: dont flush workqueue unconditionally in md_open
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit f6766ff6afff70e2aaf39e1511e16d471de7c3ae ]
We need to check mddev->del_work before flush workqueu since the purpose of flush is to ensure the previous md is disappeared. Otherwise the similar deadlock appeared if LOCKDEP is enabled, it is due to md_open holds the bdev->bd_mutex before flush workqueue.
kernel: [ 154.522645] ======================================================
kernel: [ 154.522647] WARNING: possible circular locking dependency detected
kernel: [ 154.522650] 5.6.0-rc7-lp151.27-default #25 Tainted: G O
kernel: [ 154.522651] ------------------------------------------------------
kernel: [ 154.522653] mdadm/2482 is trying to acquire lock:
kernel: [ 154.522655] ffff888078529128 ((wq_completion)md_misc){+.+.}, at: flush_workqueue+0x84/0x4b0
kernel: [ 154.522673]
kernel: [ 154.522673] but task is already holding lock:
kernel: [ 154.522675] ffff88804efa9338 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x79/0x590
kernel: [ 154.522691]
kernel: [ 154.522691] which lock already depends on the new lock.
kernel: [ 154.522691]
kernel: [ 154.522694]
kernel: [ 154.522694] the existing dependency chain (in reverse order) is:
kernel: [ 154.522696]
kernel: [ 154.522696] -> #4 (&bdev->bd_mutex){+.+.}:
kernel: [ 154.522704] __mutex_lock+0x87/0x950
kernel: [ 154.522706] __blkdev_get+0x79/0x590
kernel: [ 154.522708] blkdev_get+0x65/0x140
kernel: [ 154.522709] blkdev_get_by_dev+0x2f/0x40
kernel: [ 154.522716] lock_rdev+0x3d/0x90 [md_mod]
kernel: [ 154.522719] md_import_device+0xd6/0x1b0 [md_mod]
kernel: [ 154.522723] new_dev_store+0x15e/0x210 [md_mod]
kernel: [ 154.522728] md_attr_store+0x7a/0xc0 [md_mod]
kernel: [ 154.522732] kernfs_fop_write+0x117/0x1b0
kernel: [ 154.522735] vfs_write+0xad/0x1a0
kernel: [ 154.522737] ksys_write+0xa4/0xe0
kernel: [ 154.522745] do_syscall_64+0x64/0x2b0
kernel: [ 154.522748] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522749]
kernel: [ 154.522749] -> #3 (&mddev->reconfig_mutex){+.+.}:
kernel: [ 154.522752] __mutex_lock+0x87/0x950
kernel: [ 154.522756] new_dev_store+0xc9/0x210 [md_mod]
kernel: [ 154.522759] md_attr_store+0x7a/0xc0 [md_mod]
kernel: [ 154.522761] kernfs_fop_write+0x117/0x1b0
kernel: [ 154.522763] vfs_write+0xad/0x1a0
kernel: [ 154.522765] ksys_write+0xa4/0xe0
kernel: [ 154.522767] do_syscall_64+0x64/0x2b0
kernel: [ 154.522769] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522770]
kernel: [ 154.522770] -> #2 (kn->count#253){++++}:
kernel: [ 154.522775] __kernfs_remove+0x253/0x2c0
kernel: [ 154.522778] kernfs_remove+0x1f/0x30
kernel: [ 154.522780] kobject_del+0x28/0x60
kernel: [ 154.522783] mddev_delayed_delete+0x24/0x30 [md_mod]
kernel: [ 154.522786] process_one_work+0x2a7/0x5f0
kernel: [ 154.522788] worker_thread+0x2d/0x3d0
kernel: [ 154.522793] kthread+0x117/0x130
kernel: [ 154.522795] ret_from_fork+0x3a/0x50
kernel: [ 154.522796]
kernel: [ 154.522796] -> #1 ((work_completion)(&mddev->del_work)){+.+.}:
kernel: [ 154.522800] process_one_work+0x27e/0x5f0
kernel: [ 154.522802] worker_thread+0x2d/0x3d0
kernel: [ 154.522804] kthread+0x117/0x130
kernel: [ 154.522806] ret_from_fork+0x3a/0x50
kernel: [ 154.522807]
kernel: [ 154.522807] -> #0 ((wq_completion)md_misc){+.+.}:
kernel: [ 154.522813] __lock_acquire+0x1392/0x1690
kernel: [ 154.522816] lock_acquire+0xb4/0x1a0
kernel: [ 154.522818] flush_workqueue+0xab/0x4b0
kernel: [ 154.522821] md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522823] __blkdev_get+0xea/0x590
kernel: [ 154.522825] blkdev_get+0x65/0x140
kernel: [ 154.522828] do_dentry_open+0x1d1/0x380
kernel: [ 154.522831] path_openat+0x567/0xcc0
kernel: [ 154.522834] do_filp_open+0x9b/0x110
kernel: [ 154.522836] do_sys_openat2+0x201/0x2a0
kernel: [ 154.522838] do_sys_open+0x57/0x80
kernel: [ 154.522840] do_syscall_64+0x64/0x2b0
kernel: [ 154.522842] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522844]
kernel: [ 154.522844] other info that might help us debug this:
kernel: [ 154.522844]
kernel: [ 154.522846] Chain exists of:
kernel: [ 154.522846] (wq_completion)md_misc --> &mddev->reconfig_mutex --> &bdev->bd_mutex
kernel: [ 154.522846]
kernel: [ 154.522850] Possible unsafe locking scenario:
kernel: [ 154.522850]
kernel: [ 154.522852] CPU0 CPU1
kernel: [ 154.522853] ---- ----
kernel: [ 154.522854] lock(&bdev->bd_mutex);
kernel: [ 154.522856] lock(&mddev->reconfig_mutex);
kernel: [ 154.522858] lock(&bdev->bd_mutex);
kernel: [ 154.522860] lock((wq_completion)md_misc);
kernel: [ 154.522861]
kernel: [ 154.522861] *** DEADLOCK ***
kernel: [ 154.522861]
kernel: [ 154.522864] 1 lock held by mdadm/2482:
kernel: [ 154.522865] #0: ffff88804efa9338 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x79/0x590
kernel: [ 154.522868]
kernel: [ 154.522868] stack backtrace:
kernel: [ 154.522873] CPU: 1 PID: 2482 Comm: mdadm Tainted: G O 5.6.0-rc7-lp151.27-default #25
kernel: [ 154.522875] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
kernel: [ 154.522878] Call Trace:
kernel: [ 154.522881] dump_stack+0x8f/0xcb
kernel: [ 154.522884] check_noncircular+0x194/0x1b0
kernel: [ 154.522888] ? __lock_acquire+0x1392/0x1690
kernel: [ 154.522890] __lock_acquire+0x1392/0x1690
kernel: [ 154.522893] lock_acquire+0xb4/0x1a0
kernel: [ 154.522895] ? flush_workqueue+0x84/0x4b0
kernel: [ 154.522898] flush_workqueue+0xab/0x4b0
kernel: [ 154.522900] ? flush_workqueue+0x84/0x4b0
kernel: [ 154.522905] ? md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522908] md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522910] __blkdev_get+0xea/0x590
kernel: [ 154.522912] ? bd_acquire+0xc0/0xc0
kernel: [ 154.522914] blkdev_get+0x65/0x140
kernel: [ 154.522916] ? bd_acquire+0xc0/0xc0
kernel: [ 154.522918] do_dentry_open+0x1d1/0x380
kernel: [ 154.522921] path_openat+0x567/0xcc0
kernel: [ 154.522923] ? __lock_acquire+0x380/0x1690
kernel: [ 154.522926] do_filp_open+0x9b/0x110
kernel: [ 154.522929] ? __alloc_fd+0xe5/0x1f0
kernel: [ 154.522935] ? kmem_cache_alloc+0x28c/0x630
kernel: [ 154.522939] ? do_sys_openat2+0x201/0x2a0
kernel: [ 154.522941] do_sys_openat2+0x201/0x2a0
kernel: [ 154.522944] do_sys_open+0x57/0x80
kernel: [ 154.522946] do_syscall_64+0x64/0x2b0
kernel: [ 154.522948] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522951] RIP: 0033:0x7f98d279d9ae
And md_alloc also flushed the same workqueue, but the thing is different here. Because all the paths call md_alloc don't hold bdev->bd_mutex, and the flush is necessary to avoid race condition, so leave it as it is.
--- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -7438,7 +7438,8 @@ static int md_open(struct block_device *bdev, fmode_t mode)*/ mddev_put (mddev);/* Wait until bdev->bd_disk is definitely gone */ -flush_workqueue (md_misc_wq); +if (work_pending (&mddev->del_work)) +flush_workqueue (md_misc_wq);/* Then retry the open from the top */ return -ERESTARTSYS ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 159/267 veth: Adjust hard_start offset on redirect XDP frames
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 5c8572251fabc5bb49fd623c064e95a9daf6a3e3 ]
When native XDP redirect into a veth device, the frame arrives in the xdp_frame structure. It is then processed in veth_xdp_rcv_one(), which can run a new XDP bpf_prog on the packet. Doing so requires converting xdp_frame to xdp_buff, but the tricky part is that xdp_frame memory area is located in the top (data_hard_start) memory area that xdp_buff will point into.
The current code tried to protect the xdp_frame area, by assigning xdp_buff.data_hard_start past this memory. This results in 32 bytes less headroom to expand into via BPF-helper bpf_xdp_adjust_head().
This protect step is actually not needed, because BPF-helper bpf_xdp_adjust_head() already reserve this area, and don't allow BPF-prog to expand into it. Thus, it is safe to point data_hard_start directly at xdp_frame memory area.
--- drivers/net/veth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/veth.c +4 -4
@@ -377,13 +377,15 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq, unsigned int *xdp_xmit) {void *hard_start = frame->data - frame->headroom; -void *head = hard_start -sizeof (struct xdp_frame );int len = frame->len, delta =0 ;struct xdp_frame orig_frame;struct bpf_prog *xdp_prog;unsigned int headroom;struct sk_buff *skb; +/* bpf_xdp_adjust_head() assures BPF cannot access xdp_frame area */ + hard_start -=sizeof (struct xdp_frame ); +rcu_read_lock (); xdp_prog =rcu_dereference (rq->xdp_prog);if (likely (xdp_prog)) {
@@ -405,7 +407,6 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,break ;case XDP_TX : orig_frame = *frame; - xdp.data_hard_start = head; xdp.rxq->mem = frame->mem;if (unlikely (veth_xdp_tx (rq->dev, &xdp) <0 )) {trace_xdp_exception (rq->dev, xdp_prog, act);
@@ -417,7 +418,6 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq, goto xdp_xmit;case XDP_REDIRECT : orig_frame = *frame; - xdp.data_hard_start = head; xdp.rxq->mem = frame->mem;if (xdp_do_redirect (rq->dev, &xdp, xdp_prog)) { frame = &orig_frame;
@@ -437,7 +437,7 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,rcu_read_unlock (); headroom =sizeof (struct xdp_frame ) + frame->headroom - delta; - skb =veth_build_skb (head, headroom, len,0 ); + skb =veth_build_skb (hard_start, headroom, len,0 );if (!skb) {xdp_return_frame (frame); goto err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 160/267 net/mlx5e: IPoIB, Drop multicast packets that this interface sent
In reply to Greg Kroah-HartmanFrom: Erez Shitrit <[email protected]>
[ Upstream commit 8b46d424a743ddfef8056d5167f13ee7ebd1dcad ]
After enabled loopback packets for IPoIB, we need to drop these packets that this HCA has replicated and came back to the same interface that sent them.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +12 -3
@@ -1314,6 +1314,7 @@ out:#ifdef CONFIG_MLX5_CORE_IPOIB +#define MLX5_IB_GRH_SGID_OFFSET 8#define MLX5_IB_GRH_DGID_OFFSET 24#define MLX5_GID_SIZE 16
@@ -1327,6 +1328,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,struct net_device *netdev;struct mlx5e_priv *priv;char *pseudo_header; +u32 flags_rqpn;u32 qpn;u8 *dgid;u8 g;
@@ -1347,7 +1349,8 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, priv =mlx5i_epriv (netdev); tstamp = &priv->tstamp; - g = (be32_to_cpu (cqe->flags_rqpn) >>28 ) &3 ; + flags_rqpn =be32_to_cpu (cqe->flags_rqpn); + g = (flags_rqpn >>28 ) &3 ; dgid = skb->data +MLX5_IB_GRH_DGID_OFFSET ;if ((!g) || dgid[0 ] !=0xff ) skb->pkt_type =PACKET_HOST ;
@@ -1356,9 +1359,15 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,else skb->pkt_type =PACKET_MULTICAST ; -/* TODO: IB/ipoib: Allow mcast packets from other VFs -* 68996a6e760e5c74654723eeb57bf65628ae87f4 +/* Drop packets that this interface sent, ie multicast packets +* that the HCA has replicated. */ +if (g && (qpn == (flags_rqpn &0xffffff )) && + (memcmp (netdev->dev_addr +4 , skb->data +MLX5_IB_GRH_SGID_OFFSET , +MLX5_GID_SIZE ) ==0 )) { + skb->dev =NULL ; +return ; + }skb_pull (skb,MLX5_IB_GRH_BYTES );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 161/267 rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit beb12813bc75d4a23de43b85ad1c7cb28d27631e ]
Seven years ago we tried to fix a leak but actually introduced a double free instead. It was an understandable mistake because the code was a bit confusing and the free was done in the wrong place. The "skb" pointer is freed in both _rtl_usb_tx_urb_setup() and _rtl_usb_transmit(). The free belongs _rtl_usb_transmit() instead of _rtl_usb_tx_urb_setup() and I've cleaned the code up a bit to hopefully make it more clear.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +2 -6
@@ -910,10 +910,8 @@ static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw,WARN_ON (NULL == skb); _urb =usb_alloc_urb (0 ,GFP_ATOMIC ); -if (!_urb) { -kfree_skb (skb); +if (!_urb)return NULL ; - }_rtl_install_trx_info (rtlusb, skb, ep_num);usb_fill_bulk_urb (_urb, rtlusb->udev,usb_sndbulkpipe (rtlusb->udev, ep_num), skb->data, skb->len, _rtl_tx_complete, skb);
@@ -927,7 +925,6 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,struct rtl_usb *rtlusb =rtl_usbdev (rtl_usbpriv (hw));u32 ep_num;struct urb *_urb =NULL ; -struct sk_buff *_skb =NULL ;WARN_ON (NULL == rtlusb->usb_tx_aggregate_hdl);if (unlikely (IS_USB_STOP (rtlusb))) {
@@ -936,8 +933,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,return ; } ep_num = rtlusb->ep_map.ep_mapping[qnum]; - _skb = skb; - _urb =_rtl_usb_tx_urb_setup (hw, _skb, ep_num); + _urb =_rtl_usb_tx_urb_setup (hw, skb, ep_num);if (unlikely (!_urb)) {pr_err ("Can't allocate urb. Drop skb!\n" );kfree_skb (skb);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 162/267 mwifiex: Fix memory corruption in dump_station
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 3aa42bae9c4d1641aeb36f1a8585cd1d506cf471 ]
The mwifiex_cfg80211_dump_station() uses static variable for iterating over a linked list of all associated stations (when the driver is in UAP role). This has a race condition if .dump_station is called in parallel for multiple interfaces. This corruption can be triggered by registering multiple SSIDs and calling, in parallel for multiple interfaces
iw dev <iface> station dump
[16750.719775] Unable to handle kernel paging request at virtual address dead000000000110 ... [16750.899173] Call trace: [16750.901696] mwifiex_cfg80211_dump_station+0x94/0x100 [mwifiex] [16750.907824] nl80211_dump_station+0xbc/0x278 [cfg80211] [16750.913160] netlink_dump+0xe8/0x320 [16750.916827] netlink_recvmsg+0x1b4/0x338 [16750.920861] ____sys_recvmsg+0x7c/0x2b0 [16750.924801] ___sys_recvmsg+0x70/0x98 [16750.928564] __sys_recvmsg+0x58/0xa0 [16750.932238] __arm64_sys_recvmsg+0x28/0x30 [16750.936453] el0_svc_common.constprop.3+0x90/0x158 [16750.941378] do_el0_svc+0x74/0x90 [16750.944784] el0_sync_handler+0x12c/0x1a8 [16750.948903] el0_sync+0x114/0x140 [16750.952312] Code: f9400003 f907f423 eb02007f 54fffd60 (b9401060) [16750.958583] ---[ end trace c8ad181c2f4b8576 ]---
This patch drops the use of the static iterator, and instead every time the function is called iterates to the idx-th position of the linked-list.
It would be better to convert the code not to use linked list for associated stations storage (since the chip has a limited number of associated stations anyway - it could just be an array). Such a change may be proposed in the future. In the meantime this patch can backported into stable kernels in this simple form.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -8
@@ -1468,7 +1468,8 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); -static struct mwifiex_sta_node *node; +struct mwifiex_sta_node *node; +int i;if ((GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_STA ) && priv->media_connected && idx ==0 ) {
@@ -1478,13 +1479,10 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,mwifiex_send_cmd (priv,HOST_CMD_APCMD_STA_LIST , HostCmd_ACT_GEN_GET,0 ,NULL , true); -if (node && (&node->list == &priv->sta_list)) { - node =NULL ; -return -ENOENT ; - } - - node =list_prepare_entry (node, &priv->sta_list, list); -list_for_each_entry_continue (node, &priv->sta_list, list) { + i =0 ; +list_for_each_entry (node, &priv->sta_list, list) { +if (i++ != idx) +continue ;ether_addr_copy (mac, node->mac_addr);return mwifiex_dump_station_info (priv, node, sinfo); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 163/267 x86/boot: Correct relocation destination on old linkers
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit 5214028dd89e49ba27007c3ee475279e584261f0 ]
For the 32-bit kernel, as described in
6d92bc9d483a ("x86/build: Build compressed x86 kernels as PIE"),
pre-2.26 binutils generates R_386_32 relocations in PIE mode. Since the startup code does not perform relocation, any reloc entry with R_386_32 will remain as 0 in the executing code.
Commit
974f221c84b0 ("x86/boot: Move compressed kernel to the end of the
decompression buffer")
added a new symbol _end but did not mark it hidden, which doesn't give the correct offset on older linkers. This causes the compressed kernel to be copied beyond the end of the decompression buffer, rather than flush against it. This region of memory may be reserved or already allocated for other purposes by the bootloader.
Mark _end as hidden to fix. This changes the relocation from R_386_32 to R_386_RELATIVE even on the pre-2.26 binutils.
For 64-bit, this is not strictly necessary, as the 64-bit kernel is only built as PIE if the linker supports -z noreloc-overflow, which implies binutils-2.27+, but for consistency, mark _end as hidden here too.
The below illustrates the before/after impact of the patch using binutils-2.25 and gcc-4.6.4 (locally compiled from source) and QEMU.
Disassembly before patch:
48: 8b 86 60 02 00 00 mov 0x260(%esi),%eax
4e: 2d 00 00 00 00 sub $0x0,%eax
4f: R_386_32 _end
Disassembly after patch:
48: 8b 86 60 02 00 00 mov 0x260(%esi),%eax
4e: 2d 00 f0 76 00 sub $0x76f000,%eax
4f: R_386_RELATIVE *ABS*Dump from extract_kernel before patch:
early console in extract_kernel input_data: 0x0207c098 <--- this is at output + init_size input_len: 0x0074fef1 output: 0x01000000 output_len: 0x00fa63d0 kernel_total_size: 0x0107c000 needed_size: 0x0107c000
Dump from extract_kernel after patch:
early console in extract_kernel input_data: 0x0190d098 <--- this is at output + init_size - _end input_len: 0x0074fef1 output: 0x01000000 output_len: 0x00fa63d0 kernel_total_size: 0x0107c000 needed_size: 0x0107c000
--- arch/x86/boot/compressed/head_32.S | 5 +++-- arch/x86/boot/compressed/head_64.S | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/boot/compressed/head_32.S +3 -2
@@ -49,16 +49,17 @@ * Position Independent Executable (PIE) so that linker won't optimize * R_386_GOT32X relocation to its fixed symbol address. Older * linkers generate R_386_32 relocations against locally defined symbols, - * _bss, _ebss, _got and _egot, in PIE. It isn't wrong, just less + * _bss, _ebss, _got, _egot and _end, in PIE. It isn't wrong, just less * optimal than R_386_RELATIVE. But the x86 kernel fails to properly handle * R_386_32 relocations when relocating the kernel. To generate - * R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as + * R_386_RELATIVE relocations, we mark _bss, _ebss, _got, _egot and _end as * hidden: */ .hidden _bss .hidden _ebss .hidden _got .hidden _egot + .hidden _end __HEAD ENTRY(startup_32)
arch/x86/boot/compressed/head_64.S +1 -0
@@ -42,6 +42,7 @@ .hidden _ebss .hidden _got .hidden _egot + .hidden _end __HEAD .code32
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 164/267 mips: MAAR: Use more precise address mask
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit bbb5946eb545fab8ad8f46bce8a803e1c0c39d47 ]
Indeed according to the MIPS32 Privileged Resource Architecgture the MAAR pair register address field either takes [12:31] bits for non-XPA systems and [12:55] otherwise. In any case the current address mask is just wrong for 64-bit and 32-bits XPA chips. So lets extend it to 59-bits of physical address value. This shall cover the 64-bits architecture and systems with XPA enabled, and won't cause any problem for non-XPA 32-bit systems, since address values exceeding the architecture specific MAAR mask will be just truncated with setting zeros in the unsupported upper bits.
--- arch/mips/include/asm/mipsregs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/mipsregs.h +1 -1
@@ -749,7 +749,7 @@/* MAAR bit definitions */ #define MIPS_MAAR_VH (_U64CAST_(1) << 63) -#define MIPS_MAAR_ADDR ((BIT_ULL(BITS_PER_LONG - 12) - 1) << 12) +#define MIPS_MAAR_ADDR GENMASK_ULL(55, 12)#define MIPS_MAAR_ADDR_SHIFT 12#define MIPS_MAAR_S (_ULCAST_(1) << 1)#define MIPS_MAAR_VL (_ULCAST_(1) << 0)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 165/267 mips: Add udelay lpj numbers adjustment
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit ed26aacfb5f71eecb20a51c4467da440cb719d66 ]
Loops-per-jiffies is a special number which represents a number of noop-loop cycles per CPU-scheduler quantum - jiffies. As you understand aside from CPU-specific implementation it depends on the CPU frequency. So when a platform has the CPU frequency fixed, we have no problem and the current udelay interface will work just fine. But as soon as CPU-freq driver is enabled and the cores frequency changes, we'll end up with distorted udelay's. In order to fix this we have to accordinly adjust the per-CPU udelay_val (the same as the global loops_per_jiffy) number. This can be done in the CPU-freq transition event handler. We subscribe to that event in the MIPS arch time-inititalization method.
--- arch/mips/kernel/time.c | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
arch/mips/kernel/time.c +70 -0
@@ -22,12 +22,82 @@#include <linux/smp.h> #include <linux/spinlock.h> #include <linux/export.h> +#include <linux/cpufreq.h> +#include <linux/delay.h> #include <asm/cpu-features.h> #include <asm/cpu-type.h> #include <asm/div64.h> #include <asm/time.h> +#ifdef CONFIG_CPU_FREQ + +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref); +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref_freq); +static unsigned long glb_lpj_ref; +static unsigned long glb_lpj_ref_freq; + +static int cpufreq_callback (struct notifier_block *nb, +unsigned long val,void *data) +{ +struct cpufreq_freqs *freq = data; +struct cpumask *cpus = freq->policy->cpus; +unsigned long lpj; +int cpu; + +/* +* Skip lpj numbers adjustment if the CPU-freq transition is safe for +* the loops delay. (Is this possible?) +*/ +if (freq->flags &CPUFREQ_CONST_LOOPS ) +return NOTIFY_OK ; + +/* Save the initial values of the lpjes for future scaling. */ +if (!glb_lpj_ref) { + glb_lpj_ref = boot_cpu_data.udelay_val; + glb_lpj_ref_freq = freq->old; + +for_each_online_cpu (cpu) { +per_cpu (pcp_lpj_ref, cpu) = + cpu_data[cpu].udelay_val; +per_cpu (pcp_lpj_ref_freq, cpu) = freq->old; + } + } + +/* +* Adjust global lpj variable and per-CPU udelay_val number in +* accordance with the new CPU frequency. +*/ +if ((val ==CPUFREQ_PRECHANGE && freq->old < freq->new) || + (val ==CPUFREQ_POSTCHANGE && freq->old > freq->new)) { + loops_per_jiffy =cpufreq_scale (glb_lpj_ref, + glb_lpj_ref_freq, + freq->new); + +for_each_cpu (cpu, cpus) { + lpj =cpufreq_scale (per_cpu (pcp_lpj_ref, cpu), +per_cpu (pcp_lpj_ref_freq, cpu), + freq->new); + cpu_data[cpu].udelay_val = (unsigned int )lpj; + } + } + +return NOTIFY_OK ; +} + +static struct notifier_block cpufreq_notifier = { + .notifier_call = cpufreq_callback, +}; + +static int __init register_cpufreq_notifier (void ) +{ +return cpufreq_register_notifier (&cpufreq_notifier, +CPUFREQ_TRANSITION_NOTIFIER ); +} +core_initcall (register_cpufreq_notifier); + +#endif /* CONFIG_CPU_FREQ */ +/* * forward reference */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 166/267 crypto: stm32/crc32 - fix ext4 chksum BUG_ON()
In reply to Greg Kroah-HartmanFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit 49c2c082e00e0bc4f5cbb7c21c7f0f873b35ab09 ]
Allow use of crc_update without prior call to crc_init.
And change (and fix) driver to use CRC device even on unaligned buffers.
--- drivers/crypto/stm32/stm32_crc32.c | 98 +++++++++++++++--------------- 1 file changed, 48 insertions(+), 50 deletions(-)
drivers/crypto/stm32/stm32_crc32.c +48 -50
@@ -28,8 +28,10 @@/* Registers values */ #define CRC_CR_RESET BIT(0) -#define CRC_CR_REVERSE (BIT(7) | BIT(6) | BIT(5))#define CRC_INIT_DEFAULT 0xFFFFFFFF +#define CRC_CR_REV_IN_WORD (BIT(6) | BIT(5)) +#define CRC_CR_REV_IN_BYTE BIT(5) +#define CRC_CR_REV_OUT BIT(7)#define CRC_AUTOSUSPEND_DELAY 50
@@ -38,8 +40,6 @@ struct stm32_crc {struct device *dev;void __iomem *regs;struct clk *clk; -u8 pending_data[sizeof (u32)]; -size_t nb_pending_bytes; };struct stm32_crc_list {
@@ -59,7 +59,6 @@ struct stm32_crc_ctx {struct stm32_crc_desc_ctx {u32 partial;/* crc32c: partial in first 4 bytes of that struct */ -struct stm32_crc *crc; };static int stm32_crc32_cra_init (struct crypto_tfm *tfm)
@@ -101,25 +100,22 @@ static int stm32_crc_init(struct shash_desc *desc)struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); -list_for_each_entry (crc, &crc_list.dev_list, list) { - ctx->crc = crc; -break ; - } + crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list);spin_unlock_bh (&crc_list.lock); -pm_runtime_get_sync (ctx->crc->dev); +pm_runtime_get_sync (crc->dev);/* Reset, set key, poly and configure in bit reverse mode */ -writel_relaxed (bitrev32 (mctx->key), ctx->crc->regs +CRC_INIT ); -writel_relaxed (bitrev32 (mctx->poly), ctx->crc->regs +CRC_POL ); -writel_relaxed (CRC_CR_RESET |CRC_CR_REVERSE , ctx->crc->regs +CRC_CR ); +writel_relaxed (bitrev32 (mctx->key), crc->regs +CRC_INIT ); +writel_relaxed (bitrev32 (mctx->poly), crc->regs +CRC_POL ); +writel_relaxed (CRC_CR_RESET |CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR );/* Store partial result */ - ctx->partial =readl_relaxed (ctx->crc->regs +CRC_DR ); - ctx->crc->nb_pending_bytes =0 ; + ctx->partial =readl_relaxed (crc->regs +CRC_DR ); -pm_runtime_mark_last_busy (ctx->crc->dev); -pm_runtime_put_autosuspend (ctx->crc->dev); +pm_runtime_mark_last_busy (crc->dev); +pm_runtime_put_autosuspend (crc->dev);return 0 ; }
@@ -128,31 +124,49 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8, unsigned int length) {struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); -struct stm32_crc *crc = ctx->crc; -u32 *d32; -unsigned int i; +struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm); +struct stm32_crc *crc; + +spin_lock_bh (&crc_list.lock); + crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); +spin_unlock_bh (&crc_list.lock);pm_runtime_get_sync (crc->dev); -if (unlikely (crc->nb_pending_bytes)) { -while (crc->nb_pending_bytes !=sizeof (u32) && length) { -/* Fill in pending data */ - crc->pending_data[crc->nb_pending_bytes++] = *(d8++); +/* +* Restore previously calculated CRC for this context as init value +* Restore polynomial configuration +* Configure in register for word input data, +* Configure out register in reversed bit mode data. +*/ +writel_relaxed (bitrev32 (ctx->partial), crc->regs +CRC_INIT ); +writel_relaxed (bitrev32 (mctx->poly), crc->regs +CRC_POL ); +writel_relaxed (CRC_CR_RESET |CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); + +if (d8 !=PTR_ALIGN (d8,sizeof (u32))) { +/* Configure for byte data */ +writel_relaxed (CRC_CR_REV_IN_BYTE |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); +while (d8 !=PTR_ALIGN (d8,sizeof (u32)) && length) { +writeb_relaxed (*d8++, crc->regs +CRC_DR ); length--; } - -if (crc->nb_pending_bytes ==sizeof (u32)) { -/* Process completed pending data */ -writel_relaxed (*(u32 *)crc->pending_data, - crc->regs +CRC_DR ); - crc->nb_pending_bytes =0 ; - } +/* Configure for word data */ +writel_relaxed (CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); } - d32 = (u32 *)d8; -for (i =0 ; i < length >>2 ; i++) -/* Process 32 bits data */ -writel_relaxed (*(d32++), crc->regs +CRC_DR ); +for (; length >=sizeof (u32); d8 +=sizeof (u32), length -=sizeof (u32)) +writel_relaxed (*((u32 *)d8), crc->regs +CRC_DR ); + +if (length) { +/* Configure for byte data */ +writel_relaxed (CRC_CR_REV_IN_BYTE |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); +while (length--) +writeb_relaxed (*d8++, crc->regs +CRC_DR ); + }/* Store partial result */ ctx->partial =readl_relaxed (crc->regs +CRC_DR );
@@ -160,22 +174,6 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8,pm_runtime_mark_last_busy (crc->dev);pm_runtime_put_autosuspend (crc->dev); -/* Check for pending data (non 32 bits) */ - length &=3 ; -if (likely (!length)) -return 0 ; - -if ((crc->nb_pending_bytes + length) >=sizeof (u32)) { -/* Shall not happen */ -dev_err (crc->dev,"Pending data overflow\n" ); -return -EINVAL ; - } - - d8 = (const u8 *)d32; -for (i =0 ; i < length; i++) -/* Store pending data */ - crc->pending_data[crc->nb_pending_bytes++] = *(d8++); -return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 167/267 crypto: stm32/crc32 - fix run-time self test issue.
In reply to Greg Kroah-HartmanFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit a8cc3128bf2c01c4d448fe17149e87132113b445 ]
Fix wrong crc32 initialisation value:
"alg: shash: stm32_crc32 test failed (wrong result) on test vector 0, cfg="init+update+final aligned buffer"
cra_name="crc32c" expects an init value of 0XFFFFFFFF, cra_name="crc32" expects an init value of 0.
--- drivers/crypto/stm32/stm32_crc32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/stm32/stm32_crc32.c +3 -3
@@ -28,10 +28,10 @@/* Registers values */ #define CRC_CR_RESET BIT(0) -#define CRC_INIT_DEFAULT 0xFFFFFFFF#define CRC_CR_REV_IN_WORD (BIT(6) | BIT(5))#define CRC_CR_REV_IN_BYTE BIT(5)#define CRC_CR_REV_OUT BIT(7) +#define CRC32C_INIT_DEFAULT 0xFFFFFFFF#define CRC_AUTOSUSPEND_DELAY 50
@@ -65,7 +65,7 @@ static int stm32_crc32_cra_init(struct crypto_tfm *tfm) {struct stm32_crc_ctx *mctx =crypto_tfm_ctx (tfm); - mctx->key =CRC_INIT_DEFAULT ; + mctx->key =0 ; mctx->poly =CRC32_POLY_LE ;return 0 ; }
@@ -74,7 +74,7 @@ static int stm32_crc32c_cra_init(struct crypto_tfm *tfm) {struct stm32_crc_ctx *mctx =crypto_tfm_ctx (tfm); - mctx->key =CRC_INIT_DEFAULT ; + mctx->key =CRC32C_INIT_DEFAULT ; mctx->poly =CRC32C_POLY_LE ;return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 168/267 crypto: stm32/crc32 - fix multi-instance
In reply to Greg Kroah-HartmanFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit 10b89c43a64eb0d236903b79a3bc9d8f6cbfd9c7 ]
Ensure CRC algorithm is registered only once in crypto framework when there are several instances of CRC devices.
Update the CRC device list management to avoid that only the first CRC instance is used.
--- drivers/crypto/stm32/stm32_crc32.c | 48 ++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 12 deletions(-)
drivers/crypto/stm32/stm32_crc32.c +36 -12
@@ -93,16 +93,29 @@ static int stm32_crc_setkey(struct crypto_shash *tfm, const u8 *key,return 0 ; } -static int stm32_crc_init (struct shash_desc *desc) +static struct stm32_crc *stm32_crc_get_next_crc (void ) { -struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); -struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm);struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); +if (crc) +list_move_tail (&crc->list, &crc_list.dev_list);spin_unlock_bh (&crc_list.lock); +return crc; +} + +static int stm32_crc_init (struct shash_desc *desc) +{ +struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); +struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm); +struct stm32_crc *crc; + + crc =stm32_crc_get_next_crc (); +if (!crc) +return -ENODEV ; +pm_runtime_get_sync (crc->dev);/* Reset, set key, poly and configure in bit reverse mode */
@@ -127,9 +140,9 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8,struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm);struct stm32_crc *crc; -spin_lock_bh (&crc_list.lock); - crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); -spin_unlock_bh (&crc_list.lock); + crc =stm32_crc_get_next_crc (); +if (!crc) +return -ENODEV ;pm_runtime_get_sync (crc->dev);
@@ -202,6 +215,8 @@ static int stm32_crc_digest(struct shash_desc *desc, const u8 *data,return stm32_crc_init (desc) ?:stm32_crc_finup (desc, data, length, out); } +static unsigned int refcnt; +static DEFINE_MUTEX (refcnt_lock);static struct shash_alg algs[] = {/* CRC-32 */ {
@@ -294,12 +309,18 @@ static int stm32_crc_probe(struct platform_device *pdev)list_add (&crc->list, &crc_list.dev_list);spin_unlock (&crc_list.lock); - ret =crypto_register_shashes (algs,ARRAY_SIZE (algs)); -if (ret) { -dev_err (dev,"Failed to register\n" ); -clk_disable_unprepare (crc->clk); -return ret; +mutex_lock (&refcnt_lock); +if (!refcnt) { + ret =crypto_register_shashes (algs,ARRAY_SIZE (algs)); +if (ret) { +mutex_unlock (&refcnt_lock); +dev_err (dev,"Failed to register\n" ); +clk_disable_unprepare (crc->clk); +return ret; + } } + refcnt++; +mutex_unlock (&refcnt_lock);dev_info (dev,"Initialized\n" );
@@ -320,7 +341,10 @@ static int stm32_crc_remove(struct platform_device *pdev)list_del (&crc->list);spin_unlock (&crc_list.lock); -crypto_unregister_shashes (algs,ARRAY_SIZE (algs)); +mutex_lock (&refcnt_lock); +if (!--refcnt) +crypto_unregister_shashes (algs,ARRAY_SIZE (algs)); +mutex_unlock (&refcnt_lock);pm_runtime_disable (crc->dev);pm_runtime_put_noidle (crc->dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 169/267 x86/mm: Stop printing BRK addresses
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit 67d631b7c05eff955ccff4139327f0f92a5117e5 ]
This currently leaks kernel physical addresses into userspace.
--- arch/x86/mm/init.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/init.c +0 -2
@@ -120,8 +120,6 @@ __ref void *alloc_low_pages(unsigned int num) }else { pfn = pgt_buf_end; pgt_buf_end += num; -printk (KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n" , - pfn <<PAGE_SHIFT , (pgt_buf_end <<PAGE_SHIFT ) -1 ); }for (i =0 ; i < num; i++) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 170/267 m68k: mac: Dont call via_flush_cache() on Mac IIfx
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit bcc44f6b74106b31f0b0408b70305a40360d63b7 ]
There is no VIA2 chip on the Mac IIfx, so don't call via_flush_cache(). This avoids a boot crash which appeared in v5.4.
printk: console [ttyS0] enabled
printk: bootconsole [debug0] disabled
printk: bootconsole [debug0] disabled
Calibrating delay loop... 9.61 BogoMIPS (lpj=48064)pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
devtmpfs: initialized
random: get_random_u32 called from bucket_table_alloc.isra.27+0x68/0x194 with crng_init=0
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns futex hash table entries: 256 (order: -1, 3072 bytes, linear)
NET: Registered protocol family 16
Data read fault at 0x00000000 in Super Data (pc=0x8a6a)
BAD KERNEL BUSERR
Oops: 00000000 Modules linked in: PC: [<00008a6a>] via_flush_cache+0x12/0x2c SR: 2700 SP: 01c1fe3c a2: 01c24000 d0: 00001119 d1: 0000000c d2: 00012000 d3: 0000000f d4: 01c06840 d5: 00033b92 a0: 00000000 a1: 00000000
Process swapper (pid: 1, task=01c24000)
Frame format=B ssw=0755 isc=0200 isb=fff7 daddr=00000000 dobuf=01c1fed0 baddr=00008a6e dibuf=0000004e ver=f
Stack from 01c1fec4:
01c1fed0 00007d7e 00010080 01c1fedc 0000792e 00000001 01c1fef4 00006b40
01c80000 00040000 00000006 00000003 01c1ff1c 004a545e 004ff200 00040000
00000000 00000003 01c06840 00033b92 004a5410 004b6c88 01c1ff84 000021e2
00000073 00000003 01c06840 00033b92 0038507a 004bb094 004b6ca8 004b6c88
004b6ca4 004b6c88 000021ae 00020002 00000000 01c0685d 00000000 01c1ffb4
0049f938 00409c85 01c06840 0045bd40 00000073 00000002 00000002 00000000
Call Trace: [<00007d7e>] mac_cache_card_flush+0x12/0x1c
[<00010080>] fix_dnrm+0x2/0x18
[<0000792e>] cache_push+0x46/0x5a
[<00006b40>] arch_dma_prep_coherent+0x60/0x6e
[<00040000>] switched_to_dl+0x76/0xd0
[<004a545e>] dma_atomic_pool_init+0x4e/0x188
[<00040000>] switched_to_dl+0x76/0xd0
[<00033b92>] parse_args+0x0/0x370
[<004a5410>] dma_atomic_pool_init+0x0/0x188
[<000021e2>] do_one_initcall+0x34/0x1be
[<00033b92>] parse_args+0x0/0x370
[<0038507a>] strcpy+0x0/0x1e
[<000021ae>] do_one_initcall+0x0/0x1be
[<00020002>] do_proc_dointvec_conv+0x54/0x74
[<0049f938>] kernel_init_freeable+0x126/0x190
[<0049f94c>] kernel_init_freeable+0x13a/0x190
[<004a5410>] dma_atomic_pool_init+0x0/0x188
[<00041798>] complete+0x0/0x3c
[<000b9b0c>] kfree+0x0/0x20a
[<0038df98>] schedule+0x0/0xd0
[<0038d604>] kernel_init+0x0/0xda
[<0038d610>] kernel_init+0xc/0xda
[<0038d604>] kernel_init+0x0/0xda
[<00002d38>] ret_from_kernel_thread+0xc/0x14
Code: 0000 2079 0048 10da 2279 0048 10c8 d3c8 <1011> 0200 fff7 1280 d1f9 0048 10c8 1010 0000 0008 1080 4e5e 4e75 4e56 0000 2039
Disabling lock debugging due to kernel taint
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000bThanks to Stan Johnson for capturing the console log and running git bisect.
Git bisect said commit 8e3a68fb55e0 ("dma-mapping: make dma_atomic_pool_init self-contained") is the first "bad" commit. I don't know why. Perhaps mach_l2_flush first became reachable with that commit.
--- arch/m68k/include/asm/mac_via.h | 1 + arch/m68k/mac/config.c | 21 ++------------------- arch/m68k/mac/via.c | 6 +++++- 3 files changed, 8 insertions(+), 20 deletions(-)
arch/m68k/include/asm/mac_via.h +1 -0
@@ -257,6 +257,7 @@ extern int rbv_present,via_alt_mapping;struct irq_desc ; +extern void via_l2_flush (int writeback);extern void via_register_interrupts (void );extern void via_irq_enable (int );extern void via_irq_disable (int );
arch/m68k/mac/config.c +2 -19
@@ -61,7 +61,6 @@ extern void iop_preinit(void);extern void iop_init (void );extern void via_init (void );extern void via_init_clock (irq_handler_t func); -extern void via_flush_cache (void );extern void oss_init (void );extern void psc_init (void );extern void baboon_init (void );
@@ -132,21 +131,6 @@ int __init mac_parse_bootinfo(const struct bi_record *record)return unknown; } -/* -* Flip into 24bit mode for an instant - flushes the L2 cache card. We -* have to disable interrupts for this. Our IRQ handlers will crap -* themselves if they take an IRQ in 24bit mode! -*/ - -static void mac_cache_card_flush (int writeback) -{ -unsigned long flags; - -local_irq_save (flags); -via_flush_cache (); -local_irq_restore (flags); -} -void __init config_mac (void ) {if (!MACH_IS_MAC )
@@ -178,9 +162,8 @@ void __init config_mac(void)* not. */ -if (macintosh_config->ident ==MAC_MODEL_IICI - || macintosh_config->ident ==MAC_MODEL_IIFX ) - mach_l2_flush = mac_cache_card_flush; +if (macintosh_config->ident ==MAC_MODEL_IICI ) + mach_l2_flush = via_l2_flush; }
arch/m68k/mac/via.c +5 -1
@@ -289,10 +289,14 @@ void via_debug_dump(void)* the system into 24-bit mode for an instant. */ -void via_flush_cache (void ) +void via_l2_flush (int writeback) { +unsigned long flags; + +local_irq_save (flags); via2[gBufB] &= ~VIA2B_vMode32; via2[gBufB] |= VIA2B_vMode32; +local_irq_restore (flags); }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 171/267 btrfs: qgroup: mark qgroup inconsistent if were inherting snapshot to a new qgroup
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit cbab8ade585a18c4334b085564d9d046e01a3f70 ]
[BUG]
For the following operation, qgroup is guaranteed to be screwed up due to snapshot adding to a new qgroup:
# mkfs.btrfs -f $dev # mount $dev $mnt # btrfs qgroup en $mnt # btrfs subv create $mnt/src # xfs_io -f -c "pwrite 0 1m" $mnt/src/file # sync # btrfs qgroup create 1/0 $mnt/src # btrfs subv snapshot -i 1/0 $mnt/src $mnt/snapshot # btrfs qgroup show -prce $mnt/src qgroupid rfer excl max_rfer max_excl parent child -------- ---- ---- -------- -------- ------ ----- 0/5 16.00KiB 16.00KiB none none --- --- 0/257 1.02MiB 16.00KiB none none --- --- 0/258 1.02MiB 16.00KiB none none 1/0 --- 1/0 0.00B 0.00B none none --- 0/258 ^^^^^^^^^^^^^^^^^^^^
[CAUSE]
The problem is in btrfs_qgroup_inherit(), we don't have good enough check to determine if the new relation would break the existing accounting.
Unlike btrfs_add_qgroup_relation(), which has proper check to determine if we can do quick update without a rescan, in btrfs_qgroup_inherit() we can even assign a snapshot to multiple qgroups.
[FIX]
Fix it by manually marking qgroup inconsistent for snapshot inheritance.
For subvolume creation, since all its extents are exclusively owned, we don't need to rescan.
In theory, we should call relation check like quick_update_accounting() when doing qgroup inheritance and inform user about qgroup accounting inconsistency.
But we don't have good mechanism to relay that back to the user in the snapshot creation context, thus we can only silently mark the qgroup inconsistent.
Anyway, user shouldn't use qgroup inheritance during snapshot creation, and should add qgroup relationship after snapshot creation by 'btrfs qgroup assign', which has a much better UI to inform user about qgroup inconsistent and kick in rescan automatically.
--- fs/btrfs/qgroup.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/qgroup.c +14 -0
@@ -2259,6 +2259,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,struct btrfs_root *quota_root;struct btrfs_qgroup *srcgroup;struct btrfs_qgroup *dstgroup; +bool need_rescan = false;u32 level_size =0 ;u64 nums;
@@ -2402,6 +2403,13 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, goto unlock; } ++i_qgroups; + +/* +* If we're doing a snapshot, and adding the snapshot to a new +* qgroup, the numbers are guaranteed to be incorrect. +*/ +if (srcid) + need_rescan = true; }for (i =0 ; i < inherit->num_ref_copies; ++i, i_qgroups +=2 ) {
@@ -2421,6 +2429,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dst->rfer = src->rfer - level_size; dst->rfer_cmpr = src->rfer_cmpr - level_size; + +/* Manually tweaking numbers certainly needs a rescan */ + need_rescan = true; }for (i =0 ; i < inherit->num_excl_copies; ++i, i_qgroups +=2 ) {struct btrfs_qgroup *src;
@@ -2439,6 +2450,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dst->excl = src->excl + level_size; dst->excl_cmpr = src->excl_cmpr + level_size; + need_rescan = true; } unlock:
@@ -2446,6 +2458,8 @@ unlock: out:if (!committing)mutex_unlock (&fs_info->qgroup_ioctl_lock); +if (need_rescan) + fs_info->qgroup_flags |=BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT ;return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 172/267 net: ethernet: fec: move GPR register offset and bit into DT
In reply to Greg Kroah-HartmanFrom: Fugang Duan <[email protected]>
[ Upstream commit 8a448bf832af537d26aa557d183a16943dce4510 ]
The commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) set the GPR reigster offset and bit in driver for wake on lan feature.
But it introduces two issues here:
- one SOC has two instances, they have different bit
- different SOCs may have different offset and bit
So to support wake-on-lan feature on other i.MX platforms, it should configure the GPR reigster offset and bit from DT.
So the patch is to improve the commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) to support multiple ethernet instances on i.MX series.
v2:
* switch back to store the quirks bitmask in driver_data
v3:
* suggested by Sascha Hauer, use a struct fec_devinfo for abstracting differences between different hardware variants, it can give more freedom to describe the differences.
--- drivers/net/ethernet/freescale/fec_main.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +12 -12
@@ -88,8 +88,6 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);struct fec_devinfo {u32 quirks; -u8 stop_gpr_reg; -u8 stop_gpr_bit; };static const struct fec_devinfo fec_imx25_info = {
@@ -112,8 +110,6 @@ static const struct fec_devinfo fec_imx6q_info = {FEC_QUIRK_HAS_BUFDESC_EX |FEC_QUIRK_HAS_CSUM |FEC_QUIRK_HAS_VLAN |FEC_QUIRK_ERR006358 | FEC_QUIRK_HAS_RACC, - .stop_gpr_reg = 0x34, - .stop_gpr_bit = 27, }; static const struct fec_devinfo fec_mvf600_info = {
@@ -3401,19 +3397,23 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) }static int fec_enet_init_stop_mode (struct fec_enet_private *fep, -struct fec_devinfo *dev_info,struct device_node *np) {struct device_node *gpr_np; +u32 out_val[3 ];int ret =0 ; -if (!dev_info) -return 0 ; - - gpr_np =of_parse_phandle (np,"gpr" ,0 ); + gpr_np =of_parse_phandle (np,"fsl,stop-mode" ,0 );if (!gpr_np)return 0 ; + ret =of_property_read_u32_array (np,"fsl,stop-mode" , out_val, +ARRAY_SIZE (out_val)); +if (ret) { +dev_dbg (&fep->pdev->dev,"no stop mode property\n" ); +return ret; + } + fep->stop_gpr.gpr =syscon_node_to_regmap (gpr_np);if (IS_ERR (fep->stop_gpr.gpr)) {dev_err (&fep->pdev->dev,"could not find gpr regmap\n" );
@@ -3422,8 +3422,8 @@ static int fec_enet_init_stop_mode(struct fec_enet_private *fep, goto out; } - fep->stop_gpr.reg = dev_info->stop_gpr_reg; - fep->stop_gpr.bit = dev_info->stop_gpr_bit; + fep->stop_gpr.reg = out_val[1 ]; + fep->stop_gpr.bit = out_val[2 ]; out:of_node_put (gpr_np);
@@ -3501,7 +3501,7 @@ fec_probe(struct platform_device *pdev)if (of_get_property (np,"fsl,magic-packet" ,NULL )) fep->wol_flag |=FEC_WOL_HAS_MAGIC_PACKET ; - ret =fec_enet_init_stop_mode (fep, dev_info, np); + ret =fec_enet_init_stop_mode (fep, np);if (ret) goto failed_stop_mode;
Signature · 1 line
2.25.1
Re: [PATCH 4.19 172/267] net: ethernet: fec: move GPR register offset and bit into DT
Hi!
Quoted 6 lines
[ Upstream commit
8a448bf832af537d26aa557d183a16943dce4510]The commit
da722186f654(net: fec: set GPR bit on suspend by DT configuration) set the GPR reigster offset and bit in driver for wake on lan feature.
Quoted 6 lines
But it introduces two issues here:
- one SOC has two instances, they have different bit
- different SOCs may have different offset and bitSo to support wake-on-lan feature on other i.MX platforms, it should configure the GPR reigster offset and bit from DT.
Ok, so this really is not a bugfix.
Plus, it really depends on dts changes...
Quoted 4 lines
---
a/drivers/net/ethernet/freescale/fec_main.c
{drivers/net/ethernet/freescale/fec_main.c +0
-0struct device_node *gpr_np;
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_get_irq_cnt(struct platform_device *pdev) · line 3408
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +2
-4+u32 out_val[3 ];int ret =0 ; -if (!dev_info) -return 0 ; - - gpr_np =of_parse_phandle (np,"gpr" ,0 ); + gpr_np =of_parse_phandle (np,"fsl,stop-mode" ,0 );if (!gpr_np)return 0 ;
...and those changes are not present in v4.19. There's no fsl,stop-mode in v4.19, unlike mainline.
pavel@amd:~/cip/krc$ grep -ri fsl,stop-mode arch/arm*/boot/dts pavel@amd:~/cip/krc$
This will break driver for everyone, AFAICT. Please drop it from stable.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 172/267] net: ethernet: fec: move GPR register offset and bit into DT
Quoted 37 lines · Pavel Machek
Hi!
Quoted 6 lines
[ Upstream commit
8a448bf832af537d26aa557d183a16943dce4510]The commit
da722186f654(net: fec: set GPR bit on suspend by DT configuration) set the GPR reigster offset and bit in driver for wake on lan feature.Quoted 6 lines
But it introduces two issues here:
- one SOC has two instances, they have different bit
- different SOCs may have different offset and bitSo to support wake-on-lan feature on other i.MX platforms, it should configure the GPR reigster offset and bit from DT.
Ok, so this really is not a bugfix.
Plus, it really depends on dts changes...
Quoted 4 lines
---
a/drivers/net/ethernet/freescale/fec_main.c
{drivers/net/ethernet/freescale/fec_main.c +0
-0struct device_node *gpr_np;drivers/net/ethernet/freescale/fec_main.c static int fec_enet_get_irq_cnt(struct platform_device *pdev) · line 3408
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +2
-4+u32 out_val[3 ];int ret =0 ; -if (!dev_info) -return 0 ; - - gpr_np =of_parse_phandle (np,"gpr" ,0 ); + gpr_np =of_parse_phandle (np,"fsl,stop-mode" ,0 );if (!gpr_np)return 0 ;...and those changes are not present in v4.19. There's no fsl,stop-mode in v4.19, unlike mainline.
Quoted 5 lines
pavel@amd:~/cip/krc$ grep -ri fsl,stop-mode arch/arm*/boot/dts pavel@amd:~/cip/krc$This will break driver for everyone, AFAICT. Please drop it from stable.
Thanks for the report, dropping it from everywhere.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 173/267 macvlan: Skip loopback packets in RX handler
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
[ Upstream commit 81f3dc9349ce0bf7b8447f147f45e70f0a5b36a6 ]
Ignore loopback-originatig packets soon enough and don't try to process L2 header where it doesn't exist. The very similar br_handle_frame() in bridge code performs exactly the same check.
This is an example of such ICMPv6 packet:
skb len=96 headroom=40 headlen=96 tailroom=56 mac=(40,0) net=(40,40) trans=80shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0)) csum(0xae2e9a2f ip_summed=1 complete_sw=0 valid=0 level=0) hash(0xc97ebd88 sw=1 l4=1) proto=0x86dd pkttype=5 iif=24 dev name=etha01.212 feat=0x0x0000000040005000
skb headroom: 00000000: 00 7c 86 52 84 88 ff ff 00 00 00 00 00 00 08 00 skb headroom: 00000010: 45 00 00 9e 5d 5c 40 00 40 11 33 33 00 00 00 01 skb headroom: 00000020: 02 40 43 80 00 00 86 dd skb linear: 00000000: 60 09 88 bd 00 38 3a ff fe 80 00 00 00 00 00 00 skb linear: 00000010: 00 40 43 ff fe 80 00 00 ff 02 00 00 00 00 00 00 skb linear: 00000020: 00 00 00 00 00 00 00 01 86 00 61 00 40 00 00 2d skb linear: 00000030: 00 00 00 00 00 00 00 00 03 04 40 e0 00 00 01 2c skb linear: 00000040: 00 00 00 78 00 00 00 00 fd 5f 42 68 23 87 a8 81 skb linear: 00000050: 00 00 00 00 00 00 00 00 01 01 02 40 43 80 00 00 skb tailroom: 00000000: ... skb tailroom: 00000010: ... skb tailroom: 00000020: ... skb tailroom: 00000030: ...
Call Trace, how it happens exactly:
...
macvlan_handle_frame+0x321/0x425 [macvlan] ? macvlan_forward_source+0x110/0x110 [macvlan] __netif_receive_skb_core+0x545/0xda0 ? enqueue_task_fair+0xe5/0x8e0 ? __netif_receive_skb_one_core+0x36/0x70 __netif_receive_skb_one_core+0x36/0x70 process_backlog+0x97/0x140 net_rx_action+0x1eb/0x350 ? __hrtimer_run_queues+0x136/0x2e0 __do_softirq+0xe3/0x383 do_softirq_own_stack+0x2a/0x40 </IRQ> do_softirq.part.4+0x4e/0x50 netif_rx_ni+0x60/0xd0 dev_loopback_xmit+0x83/0xf0 ip6_finish_output2+0x575/0x590 [ipv6] ? ip6_cork_release.isra.1+0x64/0x90 [ipv6] ? __ip6_make_skb+0x38d/0x680 [ipv6] ? ip6_output+0x6c/0x140 [ipv6] ip6_output+0x6c/0x140 [ipv6] ip6_send_skb+0x1e/0x60 [ipv6] rawv6_sendmsg+0xc4b/0xe10 [ipv6] ? proc_put_long+0xd0/0xd0 ? rw_copy_check_uvector+0x4e/0x110 ? sock_sendmsg+0x36/0x40 sock_sendmsg+0x36/0x40 ___sys_sendmsg+0x2b6/0x2d0 ? proc_dointvec+0x23/0x30 ? addrconf_sysctl_forward+0x8d/0x250 [ipv6] ? dev_forward_change+0x130/0x130 [ipv6] ? _raw_spin_unlock+0x12/0x30 ? proc_sys_call_handler.isra.14+0x9f/0x110 ? __call_rcu+0x213/0x510 ? get_max_files+0x10/0x10 ? trace_hardirqs_on+0x2c/0xe0 ? __sys_sendmsg+0x63/0xa0 __sys_sendmsg+0x63/0xa0 do_syscall_64+0x6c/0x1e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- drivers/net/macvlan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/macvlan.c +4 -0
@@ -451,6 +451,10 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)int ret;rx_handler_result_t handle_res; +/* Packets from dev_loopback_xmit() do not have L2 header, bail out */ +if (unlikely (skb->pkt_type ==PACKET_LOOPBACK )) +return RX_HANDLER_PASS ; + port =macvlan_port_get_rcu (skb->dev);if (is_multicast_ether_addr (eth->h_dest)) {unsigned int hash;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 174/267 PCI: Dont disable decoding when mmio_always_on is set
In reply to Greg Kroah-HartmanFrom: Jiaxun Yang <[email protected]>
[ Upstream commit b6caa1d8c80cb71b6162cb1f1ec13aa655026c9f ]
Don't disable MEM/IO decoding when a device have both non_compliant_bars and mmio_always_on.
That would allow us quirk devices with junk in BARs but can't disable their decoding.
--- drivers/pci/probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/probe.c +1 -1
@@ -1634,7 +1634,7 @@ int pci_setup_device(struct pci_dev *dev)/* Device class may be changed after fixup */ class = dev->class >>8 ; -if (dev->non_compliant_bars) { +if (dev->non_compliant_bars && !dev->mmio_always_on) {pci_read_config_word (dev,PCI_COMMAND , &cmd);if (cmd & (PCI_COMMAND_IO |PCI_COMMAND_MEMORY )) {pci_info (dev,"device has non-compliant BARs; disabling IO/MEM decoding\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 175/267 MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()
In reply to Greg Kroah-HartmanFrom: YuanJunQing <[email protected]>
[ Upstream commit 31e1b3efa802f97a17628dde280006c4cee4ce5e ]
Register "a1" is unsaved in this function,
when CONFIG_TRACE_IRQFLAGS is enabled,
the TRACE_IRQS_OFF macro will call trace_hardirqs_off(), and this may change register "a1".
The changed register "a1" as argument will be send to do_fpe() and do_msa_fpe().
--- arch/mips/kernel/genex.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/kernel/genex.S +3 -3
@@ -477,20 +477,20 @@ NESTED(nmi_handler, PT_SIZE, sp) .endm .macro __build_clear_fpe + CLI + TRACE_IRQS_OFF .set push /* gas fails to assemble cfc1 for some archs (octeon).*/ \ .set mips1 SET_HARDFLOAT cfc1 a1, fcr31 .set pop - CLI - TRACE_IRQS_OFF .endm .macro __build_clear_msa_fpe - _cfcmsa a1, MSA_CSR CLI TRACE_IRQS_OFF + _cfcmsa a1, MSA_CSR .endm .macro __build_clear_ade
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 176/267 bcache: fix refcount underflow in bcache_device_free()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit 86da9f736740eba602389908574dfbb0f517baa5 ]
The problematic code piece in bcache_device_free() is,
785 static void bcache_device_free(struct bcache_device *d) 786 {
787 struct gendisk *disk = d->disk;
[snipped]
799 if (disk) {
800 if (disk->flags & GENHD_FL_UP)
801 del_gendisk(disk);
802
803 if (disk->queue)
804 blk_cleanup_queue(disk->queue);
805
806 ida_simple_remove(&bcache_device_idx,
807 first_minor_to_idx(disk->first_minor));
808 put_disk(disk);
809 }
[snipped]
816 }
At line 808, put_disk(disk) may encounter kobject refcount of 'disk' being underflow.
Here is how to reproduce the issue,
- Attche the backing device to a cache device and do random write to make the cache being dirty.
- Stop the bcache device while the cache device has dirty data of the backing device.
- Only register the backing device back, NOT register cache device.
- The bcache device node /dev/bcache0 won't show up, because backing device waits for the cache device shows up for the missing dirty data.
- Now echo 1 into /sys/fs/bcache/pendings_cleanup, to stop the pending backing device.
- After the pending backing device stopped, use 'dmesg' to check kernel message, a use-after-free warning from KASA reported the refcount of kobject linked to the 'disk' is underflow.
The dropping refcount at line 808 in the above code piece is added by add_disk(d->disk) in bch_cached_dev_run(). But in the above condition the cache device is not registered, bch_cached_dev_run() has no chance to be called and the refcount is not added. The put_disk() for a non- added refcount of gendisk kobject triggers a underflow warning.
This patch checks whether GENHD_FL_UP is set in disk->flags, if it is not set then the bcache device was not added, don't call put_disk() and the the underflow issue can be avoided.
--- drivers/md/bcache/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/bcache/super.c +5 -2
@@ -775,7 +775,9 @@ static void bcache_device_free(struct bcache_device *d)bcache_device_detach (d);if (disk) { -if (disk->flags &GENHD_FL_UP ) +bool disk_added = (disk->flags &GENHD_FL_UP ) !=0 ; + +if (disk_added)del_gendisk (disk);if (disk->queue)
@@ -783,7 +785,8 @@ static void bcache_device_free(struct bcache_device *d)ida_simple_remove (&bcache_device_idx,first_minor_to_idx (disk->first_minor)); -put_disk (disk); +if (disk_added) +put_disk (disk); }bioset_exit (&d->bio_split);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 177/267 mmc: sdhci-msm: Set SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 quirk
In reply to Greg Kroah-HartmanFrom: Veerabhadrarao Badiganti <[email protected]>
[ Upstream commit d863cb03fb2aac07f017b2a1d923cdbc35021280 ]
sdhci-msm can support auto cmd12.
So enable SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 quirk.
--- drivers/mmc/host/sdhci-msm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-msm.c +3 -1
@@ -1706,7 +1706,9 @@ static const struct sdhci_ops sdhci_msm_ops = {static const struct sdhci_pltfm_data sdhci_msm_pdata = { .quirks =SDHCI_QUIRK_BROKEN_CARD_DETECTION |SDHCI_QUIRK_SINGLE_POWER_WRITE | -SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN , +SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | +SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 , + .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN , .ops = &sdhci_msm_ops, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 178/267 staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit a389087ee9f195fcf2f31cd771e9ec5f02c16650 ]
Using a fixed 1s timeout for all commands is a bit problematic.
For some commands it means waiting longer than needed for the timeout to expire, which may not a big issue, but still. For other commands, like for an erase (CMD38) that uses a R1B response, may require longer timeouts than 1s. In these cases, we may end up treating the command as it failed, while it just needed some more time to complete successfully.
Fix the problem by respecting the cmd->busy_timeout, which is provided by the mmc core.
--- drivers/staging/greybus/sdio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/staging/greybus/sdio.c +7 -3
@@ -411,6 +411,7 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd)struct gb_sdio_command_request request = {0 };struct gb_sdio_command_response response;struct mmc_data *data = host->mrq->data; +unsigned int timeout_ms;u8 cmd_flags;u8 cmd_type;int i;
@@ -469,9 +470,12 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) request.data_blksz =cpu_to_le16 (data->blksz); } - ret =gb_operation_sync (host->connection,GB_SDIO_TYPE_COMMAND , - &request,sizeof (request), &response, -sizeof (response)); + timeout_ms = cmd->busy_timeout ? cmd->busy_timeout : +GB_OPERATION_TIMEOUT_DEFAULT ; + + ret =gb_operation_sync_timeout (host->connection,GB_SDIO_TYPE_COMMAND , + &request,sizeof (request), &response, +sizeof (response), timeout_ms);if (ret <0 ) goto out;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 179/267 mmc: via-sdmmc: Respect the cmd->busy_timeout from the mmc core
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit 966244ccd2919e28f25555a77f204cd1c109cad8 ]
Using a fixed 1s timeout for all commands (and data transfers) is a bit problematic.
For some commands it means waiting longer than needed for the timer to expire, which may not a big issue, but still. For other commands, like for an erase (CMD38) that uses a R1B response, may require longer timeouts than 1s. In these cases, we may end up treating the command as it failed, while it just needed some more time to complete successfully.
Fix the problem by respecting the cmd->busy_timeout, which is provided by the mmc core.
--- drivers/mmc/host/via-sdmmc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mmc/host/via-sdmmc.c +6 -1
@@ -323,6 +323,8 @@ struct via_crdr_mmc_host {/* some devices need a very long delay for power to stabilize */ #define VIA_CRDR_QUIRK_300MS_PWRDELAY 0x0001 +#define VIA_CMD_TIMEOUT_MS 1000 +static const struct pci_device_id via_ids[] = { {PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_9530 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 ,},
@@ -555,14 +557,17 @@ static void via_sdc_send_command(struct via_crdr_mmc_host *host, {void __iomem *addrbase;struct mmc_data *data; +unsigned int timeout_ms;u32 cmdctrl =0 ;WARN_ON (host->cmd); data = cmd->data; -mod_timer (&host->timer, jiffies +HZ ); host->cmd = cmd; + timeout_ms = cmd->busy_timeout ? cmd->busy_timeout :VIA_CMD_TIMEOUT_MS ; +mod_timer (&host->timer, jiffies +msecs_to_jiffies (timeout_ms)); +/*Command index*/ cmdctrl = cmd->opcode <<8 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 180/267 ixgbe: fix signed-integer-overflow warning
In reply to Greg Kroah-HartmanFrom: Xie XiuQi <[email protected]>
[ Upstream commit 3b70683fc4d68f5d915d9dc7e5ba72c732c7315c ]
ubsan report this warning, fix it by adding a unsigned suffix.
UBSAN: signed-integer-overflow in drivers/net/ethernet/intel/ixgbe/ixgbe_common.c:2246:26 65535 * 65537 cannot be represented in type 'int' CPU: 21 PID: 7 Comm: kworker/u256:0 Not tainted 5.7.0-rc3-debug+ #39 Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 03/27/2020 Workqueue: ixgbe ixgbe_service_task [ixgbe] Call trace: dump_backtrace+0x0/0x3f0 show_stack+0x28/0x38 dump_stack+0x154/0x1e4 ubsan_epilogue+0x18/0x60 handle_overflow+0xf8/0x148 __ubsan_handle_mul_overflow+0x34/0x48 ixgbe_fc_enable_generic+0x4d0/0x590 [ixgbe] ixgbe_service_task+0xc20/0x1f78 [ixgbe] process_one_work+0x8f0/0xf18 worker_thread+0x430/0x6d0 kthread+0x218/0x238 ret_from_fork+0x10/0x18
--- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +1 -1
@@ -2243,7 +2243,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw) }/* Configure pause time (2 TCs per register) */ - reg = hw->fc.pause_time *0x00010001 ; + reg = hw->fc.pause_time *0x00010001U ;for (i =0 ; i < (MAX_TRAFFIC_CLASS /2 ); i++)IXGBE_WRITE_REG (hw,IXGBE_FCTTV (i), reg);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 181/267 mmc: sdhci-esdhc-imx: fix the mask for tuning start point
In reply to Greg Kroah-HartmanFrom: Haibo Chen <[email protected]>
[ Upstream commit 1194be8c949b8190b2882ad8335a5d98aa50c735 ]
According the RM, the bit[6~0] of register ESDHC_TUNING_CTRL is TUNING_START_TAP, bit[7] of this register is to disable the command CRC check for standard tuning. So fix it here.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-esdhc-imx.c +1 -1
@@ -82,7 +82,7 @@#define ESDHC_STD_TUNING_EN (1 << 24)/* NOTE: the minimum valid tuning start tap for mx6sl is 1 */ #define ESDHC_TUNING_START_TAP_DEFAULT 0x1 -#define ESDHC_TUNING_START_TAP_MASK 0xff +#define ESDHC_TUNING_START_TAP_MASK 0x7f#define ESDHC_TUNING_STEP_MASK 0x00070000#define ESDHC_TUNING_STEP_SHIFT 16
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 182/267 spi: dw: Return any value retrieved from the dma_transfer callback
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit f0410bbf7d0fb80149e3b17d11d31f5b5197873e ]
DW APB SSI DMA-part of the driver may need to perform the requested SPI-transfer synchronously. In that case the dma_transfer() callback will return 0 as a marker of the SPI transfer being finished so the SPI core doesn't need to wait and may proceed with the SPI message trasnfers pumping procedure. This will be needed to fix the problem when DMA transactions are finished, but there is still data left in the SPI Tx/Rx FIFOs being sent/received. But for now make dma_transfer to return 1 as the normal dw_spi_transfer_one() method.
--- drivers/spi/spi-dw-mid.c | 2 +- drivers/spi/spi-dw.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/spi/spi-dw-mid.c +1 -1
@@ -274,7 +274,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)dma_async_issue_pending (dws->txchan); } -return 0 ; +return 1 ; }static void mid_spi_dma_stop (struct dw_spi *dws)
drivers/spi/spi-dw.c +2 -5
@@ -383,11 +383,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,spi_enable_chip (dws,1 ); -if (dws->dma_mapped) { - ret = dws->dma_ops->dma_transfer (dws, transfer); -if (ret <0 ) -return ret; - } +if (dws->dma_mapped) +return dws->dma_ops->dma_transfer (dws, transfer);if (chip->poll_mode)return poll_transfer (dws);
Signature · 1 line
2.25.1
Re: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
Quoted 4 lines · Greg Kroah-Hartman
From: Serge Semin <[email protected]>
[ Upstream commit
f0410bbf7d0fb80149e3b17d11d31f5b5197873e]
Quoted 8 lines
DW APB SSI DMA-part of the driver may need to perform the requested SPI-transfer synchronously. In that case the
dma_transfer()callback will return 0 as a marker of the SPI transfer being finished so the SPI core doesn't need to wait and may proceed with the SPI message trasnfers pumping procedure. This will be needed to fix the problem when DMA transactions are finished, but there is still data left in the SPI Tx/Rx FIFOs being sent/received. But for now makedma_transferto return 1 as the normaldw_spi_transfer_one()method.
As far as I understand, this is support for new SoC, not a fix?
Quoted 5 lines
+++
b/drivers/spi/spi-dw.cdrivers/spi/spi-dw.c +0
-0@@ -383,11 +383,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,spi_enable_chip (dws,1 );
drivers/spi/spi-dw.c static int dw_spi_transfer_one(struct spi_controller *master, · line 390
Quoted 10 lines
drivers/spi/spi-dw.c +2
-5-if (dws->dma_mapped) { - ret = dws->dma_ops->dma_transfer (dws, transfer); -if (ret <0 ) -return ret; - } +if (dws->dma_mapped) +return dws->dma_ops->dma_transfer (dws, transfer);if (chip->poll_mode)return poll_transfer (dws);
Mainline patch simply changes return value, but code is different in v4.19, and poll_transfer will now be avoided when dws->dma_mapped. Is that a problem?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
Hello Pavel
Quoted 15 lines · Pavel Machek
Quoted 4 lines · Greg Kroah-Hartman
From: Serge Semin <[email protected]>
[ Upstream commit
f0410bbf7d0fb80149e3b17d11d31f5b5197873e]Quoted 8 lines
DW APB SSI DMA-part of the driver may need to perform the requested SPI-transfer synchronously. In that case the
dma_transfer()callback will return 0 as a marker of the SPI transfer being finished so the SPI core doesn't need to wait and may proceed with the SPI message trasnfers pumping procedure. This will be needed to fix the problem when DMA transactions are finished, but there is still data left in the SPI Tx/Rx FIFOs being sent/received. But for now makedma_transferto return 1 as the normaldw_spi_transfer_one()method.
Quoted 1 line
As far as I understand, this is support for new SoC, not a fix?
Not really. That patch is a first one of a series fixing a problem with SPI transfer completion:33726eff3d98 spi: dw: Add SPI Rx-done wait method to DMA-based transfer 1ade2d8a72f9 spi: dw: Add SPI Tx-done wait method to DMA-based transfer bdbdf0f06337 spi: dw: Locally wait for the DMA transfers completion f0410bbf7d0f spi: dw: Return any value retrieved from the dma_transfer callback
In anyway having just first commit applied is harmless, though pretty much pointless in fixing the problem it had been originally introduced for. But it can be useful for something else. See my comment below.
Quoted 14 lines
Quoted 14 lines
+++
b/drivers/spi/spi-dw.cdrivers/spi/spi-dw.c +2
-5@@ -383,11 +383,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,spi_enable_chip (dws,1 ); -if (dws->dma_mapped) { - ret = dws->dma_ops->dma_transfer (dws, transfer); -if (ret <0 ) -return ret; - } +if (dws->dma_mapped) +return dws->dma_ops->dma_transfer (dws, transfer);
Quoted 7 lines
drivers/spi/spi-dw.c static int dw_spi_transfer_one(struct spi_controller *master, · line 390
Quoted 2 lines
drivers/spi/spi-dw.c +0
-0if (chip->poll_mode)return poll_transfer (dws);Mainline patch simply changes return value, but code is different in v4.19, and
poll_transferwill now be avoided whendws->dma_mapped. Is that a problem?
Actually no.) In that old 4.19 context it's even better to return straight away no matter what value is returned by the dma_transfer() callback. In the code without this patch applied, the transfer_one() method will check the poll_mode flag state even if the dma_transfer() returns a positive value. The positive value (1) means that the DMA transfer has been executed and the SPI core must wait for its completion. Needless to say, that if the poll_mode flag state gets to be true, then a poll-transfer will be executed alongside with the DMA transfer. Which as you understand will be very wrong. So by having this patch applied we implicitly fix that problem. Although a probability of the problematic situation is very low, since the DW APB SSI driver poll-mode hasn't been utilized by any SPI client driver since long time ago...
-Sergey
Quoted 6 lines
Best regards,
PavelSignature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
Hi Serge, Pavel, Greg,
Quoted 10 lines · Serge Semin
Hello Pavel
Quoted 3 lines · Pavel Machek
Mainline patch simply changes return value, but code is different in v4.19, and
poll_transferwill now be avoided whendws->dma_mapped. Is that a problem?Actually no.) In that old 4.19 context it's even better to return straight away no matter what value is returned by the
dma_transfer()callback.
This patch changes the return dma_transfer return value from 0 to 1, however it was only done in spi-dw-mid.c func mid_spi_dma_transfer().
There is an identical function in spi-dw-mmio.c that needs the same treatment, otherwise access to the SPI device becomes erratic and even causes kernel to hang. Guess how I found this ;-)
So the following patch is needed as well, at least in 4.9 and 4.19, I did not check/test other versions. Mainline does not need this, since the code seems to have been refactored to avoid the duplication.
Regards,
-Ralph
drivers/spi/spi-dw-mmio.c +0 -0
@@ -358,7 +358,7 @@ static int mmio_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
dma_async_issue_pending(dws->txchan); }
- return 0;
+ return 1;
}
static void mmio_spi_dma_stop(struct dw_spi *dws)
Signature · 1 line
2.17.1
Sasha Levin
maintainerRe: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
Quoted 11 lines · Ralph Siemsen
Hi Serge, Pavel, Greg,
Quoted 8 lines · Serge Semin
Hello Pavel
Quoted 3 lines · Pavel Machek
Mainline patch simply changes return value, but code is different in v4.19, and
poll_transferwill now be avoided whendws->dma_mapped. Is that a problem?
Quoted 8 lines
Quoted 2 lines
Actually no.) In that old 4.19 context it's even better to return straight away no matter what value is returned by the
dma_transfer()callback.This patch changes the return
dma_transferreturn value from 0 to 1, however it was only done inspi-dw-mid.cfuncmid_spi_dma_transfer().There is an identical function in
spi-dw-mmio.cthat needs the same treatment, otherwise access to the SPI device becomes erratic and even causes kernel to hang. Guess how I found this ;-)So the following patch is needed as well, at least in 4.9 and 4.19, I did not check/test other versions. Mainline does not need this, since the code seems to have been refactored to avoid the duplication.
Could you add your signed-off-by tag please? :)
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
Hi Sasha,
Quoted 5 lines · Sasha Levin
Quoted 2 lines · Ralph Siemsen
So the following patch is needed as well, at least in 4.9 and 4.19, I did not check/test other versions. Mainline does not need this, since the code seems to have been refactored to avoid the duplication.
Could you add your signed-off-by tag please? :)
Whoops, for some reason I snipped it out... sorry about that! Here it is again, with the commit message tweaked for clarity.
Subject: [PATCH] spi: dw: Fix return value of dma_transfer callback
Earlier commit "spi: dw: Return any value retrieved from the dma_transfer callback" changed the return code of mid_spi_dma_transfer() from 0 to 1 in drivers/spi/spi-dw-mid.c.
A similar change is needed spi-dw-mmio.c for mmio_spi_dma_transfer() function. Note this only applies to older branches, as mainline has refactored the code to avoid duplication.
---drivers/spi/spi-dw-mmio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-dw-mmio.c +0 -0
@@ -358,7 +358,7 @@ static int mmio_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
dma_async_issue_pending(dws->txchan); }
- return 0;
+ return 1;
}
static void mmio_spi_dma_stop(struct dw_spi *dws)
Signature · 1 line
2.17.1
Sasha Levin
maintainerRe: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
In reply to Ralph Siemsendrivers/spi/spi-dw-mmio.c static int mmio_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
Quoted 28 lines · Ralph Siemsen
Hi Serge, Pavel, Greg,
Quoted 10 lines · Serge Semin
Hello Pavel
Quoted 3 lines · Pavel Machek
Mainline patch simply changes return value, but code is different in v4.19, and
poll_transferwill now be avoided whendws->dma_mapped. Is that a problem?Actually no.) In that old 4.19 context it's even better to return straight away no matter what value is returned by the
dma_transfer()callback.This patch changes the return
dma_transferreturn value from 0 to 1, however it was only done inspi-dw-mid.cfuncmid_spi_dma_transfer().There is an identical function in
spi-dw-mmio.cthat needs the same treatment, otherwise access to the SPI device becomes erratic and even causes kernel to hang. Guess how I found this ;-)So the following patch is needed as well, at least in 4.9 and 4.19, I did not check/test other versions. Mainline does not need this, since the code seems to have been refactored to avoid the duplication.
Regards,
(quoted diff) +0
-1-Ralphdrivers/spi/spi-dw-mmio.c +0
-0@@ -358,7 +358,7 @@ static int mmio_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
Um, I can't find this function anywhere... what am I missing?
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback
Quoted 7 lines · Sasha Levin
drivers/spi/spi-dw-mmio.c static int mmio_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)
Quoted 5 lines
drivers/spi/spi-dw-mmio.c +0
-0@@ -358,7 +358,7 @@ static int mmio_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)Um, I can't find this function anywhere... what am I missing?
Nothing... my bad. The code in question was added on a vendor branch
(https://github.com/renesas-rz/rzn1_linux/blob/rzn1-stable-v4.19/drivers/spi/spi-dw-mmio.c#L338
if you are curious).
I'm very sorry for wasting your time... please disregard the patch!
-Ralph
Greg Kroah-Hartman
maintainerPATCH 183/267 cpuidle: Fix three reference count leaks
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit c343bf1ba5efcbf2266a1fe3baefec9cc82f867f ]
kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
Previous commit "b8eb718348b8" fixed a similar problem.
--- drivers/cpuidle/sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cpuidle/sysfs.c +3 -3
@@ -467,7 +467,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) ret =kobject_init_and_add (&kobj->kobj, &ktype_state_cpuidle, &kdev->kobj,"state%d" , i);if (ret) { -kfree (kobj); +kobject_put (&kobj->kobj); goto error_state; }cpuidle_add_s2idle_attr_group (kobj);
@@ -598,7 +598,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev) ret =kobject_init_and_add (&kdrv->kobj, &ktype_driver_cpuidle, &kdev->kobj,"driver" );if (ret) { -kfree (kdrv); +kobject_put (&kdrv->kobj);return ret; }
@@ -692,7 +692,7 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) error =kobject_init_and_add (&kdev->kobj, &ktype_cpuidle, &cpu_dev->kobj,"cpuidle" );if (error) { -kfree (kdev); +kobject_put (&kdev->kobj);return error; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 184/267 platform/x86: hp-wmi: Convert simple_strtoul() to kstrtou32()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5cdc45ed3948042f0d73c6fec5ee9b59e637d0d2 ]
First of all, unsigned long can overflow u32 value on 64-bit machine. Second, simple_strtoul() doesn't check for overflow in the input.
Convert simple_strtoul() to kstrtou32() to eliminate above issues.
--- drivers/platform/x86/hp-wmi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +8 -2
@@ -474,8 +474,14 @@ static ssize_t postcode_show(struct device *dev, struct device_attribute *attr,static ssize_t als_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { -u32 tmp =simple_strtoul (buf,NULL ,10 ); -int ret =hp_wmi_perform_query (HPWMI_ALS_QUERY ,HPWMI_WRITE , &tmp, +u32 tmp; +int ret; + + ret =kstrtou32 (buf,10 , &tmp); +if (ret) +return ret; + + ret =hp_wmi_perform_query (HPWMI_ALS_QUERY ,HPWMI_WRITE , &tmp,sizeof (tmp),sizeof (tmp));if (ret)return ret <0 ? ret : -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 185/267 platform/x86: intel-hid: Add a quirk to support HP Spectre X2 (2015)
In reply to Greg Kroah-HartmanFrom: Nickolai Kozachenko <[email protected]>
[ Upstream commit 8fe63eb757ac6e661a384cc760792080bdc738dc ]
HEBC method reports capabilities of 5 button array but HP Spectre X2 (2015) does not have this control method (the same was for Wacom MobileStudio Pro). Expand previous DMI quirk by Alex Hung to also enable 5 button array for this system.
--- drivers/platform/x86/intel-hid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel-hid.c +7 -0
@@ -87,6 +87,13 @@ static const struct dmi_system_id button_array_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Wacom MobileStudio Pro 16"), }, }, + { + .ident = "HP Spectre x2 (2015)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"), + }, + }, { } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 186/267 platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit cfae58ed681c5fe0185db843013ecc71cd265ebf ]
The HP Stream x360 11-p000nd no longer report SW_TABLET_MODE state / events with recent kernels. This model reports a chassis-type of 10 / "Notebook" which is not on the recently introduced chassis-type whitelist
Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a chassis-type whitelist and only listed 31 / "Convertible" as being capable of generating valid SW_TABLET_MOD events.
Commit 1fac39fd0316 ("platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types") extended the whitelist with chassis-types 8 / "Portable" and 32 / "Detachable".
And now we need to exten the whitelist again with 10 / "Notebook"...
The issue original fixed by the whitelist is really a ACPI DSDT bug on the Dell XPS 9360 where it has a VGBS which reports it is in tablet mode even though it is not a 2-in-1 at all, but a regular laptop.
So since this is a workaround for a DSDT issue on that specific model, instead of extending the whitelist over and over again, lets switch to a blacklist and only blacklist the chassis-type of the model for which the chassis-type check was added.
Note this also fixes the current version of the code no longer checking if dmi_get_system_info(DMI_CHASSIS_TYPE) returns NULL.
--- drivers/platform/x86/intel-vbtn.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/platform/x86/intel-vbtn.c +8 -11
@@ -157,21 +157,18 @@ static void detect_tablet_mode(struct platform_device *device)static bool intel_vbtn_has_switches (acpi_handle handle) {const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE ); -unsigned long chassis_type_int;unsigned long long vgbs;acpi_status status; -if (kstrtoul (chassis_type,10 , &chassis_type_int)) -return false; - -switch (chassis_type_int) { -case 8 :/* Portable */ -case 31 :/* Convertible */ -case 32 :/* Detachable */ -break ; -default : +/* +* Some normal laptops have a VGBS method despite being non-convertible +* and their VGBS method always returns 0, causing detect_tablet_mode() +* to report SW_TABLET_MODE=1 to userspace, which causes issues. +* These laptops have a DMI chassis_type of 9 ("Laptop"), do not report +* switches on any devices with a DMI chassis_type of 9. +*/ +if (chassis_type &&strcmp (chassis_type,"9" ) ==0 )return false; - } status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);return ACPI_SUCCESS (status);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 187/267 string.h: fix incompatibility between FORTIFY_SOURCE and KASAN
In reply to Greg Kroah-HartmanFrom: Daniel Axtens <[email protected]>
[ Upstream commit 47227d27e2fcb01a9e8f5958d8997cf47a820afc ]
The memcmp KASAN self-test fails on a kernel with both KASAN and FORTIFY_SOURCE.
When FORTIFY_SOURCE is on, a number of functions are replaced with fortified versions, which attempt to check the sizes of the operands. However, these functions often directly invoke __builtin_foo() once they have performed the fortify check. Using __builtins may bypass KASAN checks if the compiler decides to inline it's own implementation as sequence of instructions, rather than emit a function call that goes out to a KASAN-instrumented implementation.
Why is only memcmp affected?
============================
Of the string and string-like functions that kasan_test tests, only memcmp is replaced by an inline sequence of instructions in my testing on x86 with gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2).
I believe this is due to compiler heuristics. For example, if I annotate kmalloc calls with the alloc_size annotation (and disable some fortify compile-time checking!), the compiler will replace every memset except the one in kmalloc_uaf_memset with inline instructions. (I have some WIP patches to add this annotation.)
Does this affect other functions in string.h?
=============================================
Yes. Anything that uses __builtin_* rather than __real_* could be affected. This looks like:
- strncpy
- strcat
- strlen
- strlcpy maybe, under some circumstances?
- strncat under some circumstances
- memset
- memcpy
- memmove
- memcmp (as noted)
- memchr
- strcpy
Whether a function call is emitted always depends on the compiler. Most bugs should get caught by FORTIFY_SOURCE, but the missed memcmp test shows that this is not always the case.
Isn't FORTIFY_SOURCE disabled with KASAN?
========================================-
The string headers on all arches supporting KASAN disable fortify with kasan, but only when address sanitisation is _also_ disabled. For example from x86:
#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__) /*
* For files that are not instrumented (e.g. mm/slub.c) we
* should use not instrumented version of mem* functions. */
#define memcpy(dst, src, len) __memcpy(dst, src, len) #define memmove(dst, src, len) __memmove(dst, src, len) #define memset(s, c, n) __memset(s, c, n)
#ifndef __NO_FORTIFY
#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */ #endif
#endif
This comes from commit 6974f0c4555e ("include/linux/string.h: add the option of fortified string.h functions"), and doesn't work when KASAN is enabled and the file is supposed to be sanitised - as with test_kasan.c
I'm pretty sure this is not wrong, but not as expansive it should be:
* we shouldn't use __builtin_memcpy etc in files where we don't have instrumentation - it could devolve into a function call to memcpy, which will be instrumented. Rather, we should use __memcpy which by convention is not instrumented.
* we also shouldn't be using __builtin_memcpy when we have a KASAN instrumented file, because it could be replaced with inline asm that will not be instrumented.
What is correct behaviour?
==========================
Firstly, there is some overlap between fortification and KASAN: both provide some level of _runtime_ checking. Only fortify provides compile-time checking.
KASAN and fortify can pick up different things at runtime:
- Some fortify functions, notably the string functions, could easily be modified to consider sub-object sizes (e.g. members within a struct), and I have some WIP patches to do this. KASAN cannot detect these because it cannot insert poision between members of a struct.
- KASAN can detect many over-reads/over-writes when the sizes of both operands are unknown, which fortify cannot.
So there are a couple of options:
1) Flip the test: disable fortify in santised files and enable it in unsanitised files. This at least stops us missing KASAN checking, but we lose the fortify checking.
2) Make the fortify code always call out to real versions. Do this only for KASAN, for fear of losing the inlining opportunities we get from __builtin_*.
(We can't use kasan_check_{read,write}: because the fortify functions are _extern inline_, you can't include _static_ inline functions without a compiler warning. kasan_check_{read,write} are static inline so we can't use them even when they would otherwise be suitable.)
Take approach 2 and call out to real versions when KASAN is enabled.
Use __underlying_foo to distinguish from __real_foo: __real_foo always refers to the kernel's implementation of foo, __underlying_foo could be either the kernel implementation or the __builtin_foo implementation.
This is sometimes enough to make the memcmp test succeed with FORTIFY_SOURCE enabled. It is at least enough to get the function call into the module. One more fix is needed to make it reliable: see the next patch.
--- include/linux/string.h | 60 +++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-)
include/linux/string.h +48 -12
@@ -239,6 +239,31 @@ void __read_overflow3(void) __compiletime_error("detected read beyond size of ob void __write_overflow(void) __compiletime_error("detected write beyond size of object passed as 1st parameter");#if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE ) + +#ifdef CONFIG_KASAN +extern void *__underlying_memchr (const void *p,int c,__kernel_size_t size)__RENAME (memchr); +extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp); +extern void *__underlying_memcpy (void *p,const void *q,__kernel_size_t size)__RENAME (memcpy); +extern void *__underlying_memmove (void *p,const void *q,__kernel_size_t size)__RENAME (memmove); +extern void *__underlying_memset (void *p,int c,__kernel_size_t size)__RENAME (memset); +extern char *__underlying_strcat (char *p,const char *q)__RENAME (strcat); +extern char *__underlying_strcpy (char *p,const char *q)__RENAME (strcpy); +extern __kernel_size_t __underlying_strlen(const char *p) __RENAME(strlen); +extern char *__underlying_strncat (char *p,const char *q,__kernel_size_t count)__RENAME (strncat); +extern char *__underlying_strncpy (char *p,const char *q,__kernel_size_t size)__RENAME (strncpy); +#else +#define __underlying_memchr __builtin_memchr +#define __underlying_memcmp __builtin_memcmp +#define __underlying_memcpy __builtin_memcpy +#define __underlying_memmove __builtin_memmove +#define __underlying_memset __builtin_memset +#define __underlying_strcat __builtin_strcat +#define __underlying_strcpy __builtin_strcpy +#define __underlying_strlen __builtin_strlen +#define __underlying_strncat __builtin_strncat +#define __underlying_strncpy __builtin_strncpy +#endif + __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size) {size_t p_size =__builtin_object_size (p,0 );
@@ -246,14 +271,14 @@ __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size)__write_overflow ();if (p_size < size)fortify_panic (__func__); -return __builtin_strncpy (p, q, size); +return __underlying_strncpy (p, q, size); } __FORTIFY_INLINE char *strcat(char *p, const char *q) {size_t p_size =__builtin_object_size (p,0 );if (p_size == (size_t )-1 ) -return __builtin_strcat (p, q); +return __underlying_strcat (p, q);if (strlcat (p, q, p_size) >= p_size)fortify_panic (__func__);return p;
@@ -267,7 +292,7 @@ __FORTIFY_INLINE __kernel_size_t strlen(const char *p)/* Work around gcc excess stack consumption issue */ if (p_size == (size_t )-1 || (__builtin_constant_p (p[p_size -1 ]) && p[p_size -1 ] =='\0' )) -return __builtin_strlen (p); +return __underlying_strlen (p); ret =strnlen (p, p_size);if (p_size <= ret)fortify_panic (__func__);
@@ -300,7 +325,7 @@ __FORTIFY_INLINE size_t strlcpy(char *p, const char *q, size_t size)__write_overflow ();if (len >= p_size)fortify_panic (__func__); -__builtin_memcpy (p, q, len); +__underlying_memcpy (p, q, len); p[len] ='\0' ; }return ret;
@@ -313,12 +338,12 @@ __FORTIFY_INLINE char *strncat(char *p, const char *q, __kernel_size_t count)size_t p_size =__builtin_object_size (p,0 );size_t q_size =__builtin_object_size (q,0 );if (p_size == (size_t )-1 && q_size == (size_t )-1 ) -return __builtin_strncat (p, q, count); +return __underlying_strncat (p, q, count); p_len =strlen (p); copy_len =strnlen (q, count);if (p_size < p_len + copy_len +1 )fortify_panic (__func__); -__builtin_memcpy (p + p_len, q, copy_len); +__underlying_memcpy (p + p_len, q, copy_len); p[p_len + copy_len] ='\0' ;return p; }
@@ -330,7 +355,7 @@ __FORTIFY_INLINE void *memset(void *p, int c, __kernel_size_t size)__write_overflow ();if (p_size < size)fortify_panic (__func__); -return __builtin_memset (p, c, size); +return __underlying_memset (p, c, size); } __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size)
@@ -345,7 +370,7 @@ __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size) }if (p_size < size || q_size < size)fortify_panic (__func__); -return __builtin_memcpy (p, q, size); +return __underlying_memcpy (p, q, size); } __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size)
@@ -360,7 +385,7 @@ __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size) }if (p_size < size || q_size < size)fortify_panic (__func__); -return __builtin_memmove (p, q, size); +return __underlying_memmove (p, q, size); }extern void *__real_memscan (void *,int ,__kernel_size_t )__RENAME (memscan);
@@ -386,7 +411,7 @@ __FORTIFY_INLINE int memcmp(const void *p, const void *q, __kernel_size_t size) }if (p_size < size || q_size < size)fortify_panic (__func__); -return __builtin_memcmp (p, q, size); +return __underlying_memcmp (p, q, size); } __FORTIFY_INLINE void *memchr(const void *p, int c, __kernel_size_t size)
@@ -396,7 +421,7 @@ __FORTIFY_INLINE void *memchr(const void *p, int c, __kernel_size_t size)__read_overflow ();if (p_size < size)fortify_panic (__func__); -return __builtin_memchr (p, c, size); +return __underlying_memchr (p, c, size); }void *__real_memchr_inv (const void *s,int c,size_t n)__RENAME (memchr_inv);
@@ -427,11 +452,22 @@ __FORTIFY_INLINE char *strcpy(char *p, const char *q)size_t p_size =__builtin_object_size (p,0 );size_t q_size =__builtin_object_size (q,0 );if (p_size == (size_t )-1 && q_size == (size_t )-1 ) -return __builtin_strcpy (p, q); +return __underlying_strcpy (p, q);memcpy (p, q,strlen (q) +1 ); return p; } +/* Don't use these outside the FORITFY_SOURCE implementation */ +#undef __underlying_memchr +#undef __underlying_memcmp +#undef __underlying_memcpy +#undef __underlying_memmove +#undef __underlying_memset +#undef __underlying_strcat +#undef __underlying_strcpy +#undef __underlying_strlen +#undef __underlying_strncat +#undef __underlying_strncpy#endif /**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 188/267 btrfs: include non-missing as a qualifier for the latest_bdev
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
commit 998a0671961f66e9fad4990ed75f80ba3088c2f1 upstream.
btrfs_free_extra_devids() updates fs_devices::latest_bdev to point to the bdev with greatest device::generation number. For a typical-missing device the generation number is zero so fs_devices::latest_bdev will never point to it.
But if the missing device is due to alienation [1], then device::generation is not zero and if it is greater or equal to the rest of device generations in the list, then fs_devices::latest_bdev ends up pointing to the missing device and reports the error like [2].
[1] We maintain devices of a fsid (as in fs_device::fsid) in the fs_devices::devices list, a device is considered as an alien device if its fsid does not match with the fs_device::fsid
Consider a working filesystem with raid1:
$ mkfs.btrfs -f -d raid1 -m raid1 /dev/sda /dev/sdb $ mount /dev/sda /mnt-raid1 $ umount /mnt-raid1
While mnt-raid1 was unmounted the user force-adds one of its devices to another btrfs filesystem:
$ mkfs.btrfs -f /dev/sdc $ mount /dev/sdc /mnt-single $ btrfs dev add -f /dev/sda /mnt-single
Now the original mnt-raid1 fails to mount in degraded mode, because fs_devices::latest_bdev is pointing to the alien device.
$ mount -o degraded /dev/sdb /mnt-raid1
[2]
mount: wrong fs type, bad option, bad superblock on /dev/sdb,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail or so.
kernel: BTRFS warning (device sdb): devid 1 uuid 072a0192-675b-4d5a-8640-a5cf2b2c704d is missing
kernel: BTRFS error (device sdb): failed to read devices
kernel: BTRFS error (device sdb): open_ctree failed
Fix the root cause by checking if the device is not missing before it can be considered for the fs_devices::latest_bdev.
--- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/volumes.c +2 -0
@@ -951,6 +951,8 @@ again: &device->dev_state)) {if (!test_bit (BTRFS_DEV_STATE_REPLACE_TGT , &device->dev_state) && + !test_bit (BTRFS_DEV_STATE_MISSING , + &device->dev_state) && (!latest_dev || device->generation > latest_dev->generation)) { latest_dev = device;
Greg Kroah-Hartman
maintainerPATCH 189/267 btrfs: send: emit file capabilities after chown
In reply to Greg Kroah-HartmanFrom: Marcos Paulo de Souza <[email protected]>
commit 89efda52e6b6930f80f5adda9c3c9edfb1397191 upstream.
Whenever a chown is executed, all capabilities of the file being touched are lost. When doing incremental send with a file with capabilities, there is a situation where the capability can be lost on the receiving side. The sequence of actions bellow shows the problem:
$ mount /dev/sda fs1 $ mount /dev/sdb fs2
$ touch fs1/foo.bar $ setcap cap_sys_nice+ep fs1/foo.bar $ btrfs subvolume snapshot -r fs1 fs1/snap_init $ btrfs send fs1/snap_init | btrfs receive fs2
$ chgrp adm fs1/foo.bar $ setcap cap_sys_nice+ep fs1/foo.bar
$ btrfs subvolume snapshot -r fs1 fs1/snap_complete $ btrfs subvolume snapshot -r fs1 fs1/snap_incremental
$ btrfs send fs1/snap_complete | btrfs receive fs2 $ btrfs send -p fs1/snap_init fs1/snap_incremental | btrfs receive fs2
At this point, only a chown was emitted by "btrfs send" since only the group was changed. This makes the cap_sys_nice capability to be dropped from fs2/snap_incremental/foo.bar
To fix that, only emit capabilities after chown is emitted. The current code first checks for xattrs that are new/changed, emits them, and later emit the chown. Now, __process_new_xattr skips capabilities, letting only finish_inode_if_needed to emit them, if they exist, for the inode being processed.
This behavior was being worked around in "btrfs receive" side by caching the capability and only applying it after chown. Now, xattrs are only emmited _after_ chown, making that workaround not needed anymore.
--- fs/btrfs/send.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
fs/btrfs/send.c +67 -0
@@ -23,6 +23,7 @@#include "btrfs_inode.h" #include "transaction.h" #include "compression.h" +#include "xattr.h" /* * Maximum number of references an extent can have in order for us to attempt to
@@ -4543,6 +4544,10 @@ static int __process_new_xattr(int num,struct fs_path *p;struct posix_acl_xattr_header dummy_acl; +/* Capabilities are emitted by finish_inode_if_needed */ +if (!strncmp (name,XATTR_NAME_CAPS , name_len)) +return 0 ; + p =fs_path_alloc ();if (!p)return -ENOMEM ;
@@ -5105,6 +5110,64 @@ static int send_extent_data(struct send_return 0 ; } +/* +* Search for a capability xattr related to sctx->cur_ino. If the capability is +* found, call send_set_xattr function to emit it. +* +* Return 0 if there isn't a capability, or when the capability was emitted +* successfully, or < 0 if an error occurred. +*/ +static int send_capabilities (struct send_ctx *sctx) +{ +struct fs_path *fspath =NULL ; +struct btrfs_path *path; +struct btrfs_dir_item *di; +struct extent_buffer *leaf; +unsigned long data_ptr; +char *buf =NULL ; +int buf_len; +int ret =0 ; + + path =alloc_path_for_send (); +if (!path) +return -ENOMEM ; + + di =btrfs_lookup_xattr (NULL , sctx->send_root, path, sctx->cur_ino, +XATTR_NAME_CAPS ,strlen (XATTR_NAME_CAPS ),0 ); +if (!di) { +/* There is no xattr for this inode */ + goto out; + }else if (IS_ERR (di)) { + ret =PTR_ERR (di); + goto out; + } + + leaf = path->nodes[0 ]; + buf_len =btrfs_dir_data_len (leaf, di); + + fspath =fs_path_alloc (); + buf =kmalloc (buf_len,GFP_KERNEL ); +if (!fspath || !buf) { + ret = -ENOMEM ; + goto out; + } + + ret =get_cur_path (sctx, sctx->cur_ino, sctx->cur_inode_gen, fspath); +if (ret <0 ) + goto out; + + data_ptr = (unsigned long )(di +1 ) +btrfs_dir_name_len (leaf, di); +read_extent_buffer (leaf, buf, data_ptr, buf_len); + + ret =send_set_xattr (sctx, fspath,XATTR_NAME_CAPS , +strlen (XATTR_NAME_CAPS ), buf, buf_len); +out: +kfree (buf); +fs_path_free (fspath); +btrfs_free_path (path); +return ret; +} + static int clone_range(struct send_ctx *sctx, struct clone_root *clone_root, const u64 disk_byte,
@@ -5936,6 +5999,10 @@ static int finish_inode_if_needed(struct goto out; } + ret =send_capabilities (sctx); +if (ret <0 ) + goto out; +/* * If other directory inodes depended on our current directory * inode's move/rename, now do their move/rename operations.
Greg Kroah-Hartman
maintainerPATCH 190/267 mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()
In reply to Greg Kroah-HartmanFrom: Andrea Arcangeli <[email protected]>
commit c444eb564fb16645c172d550359cb3d75fe8a040 upstream.
Write protect anon page faults require an accurate mapcount to decide if to break the COW or not. This is implemented in the THP path with reuse_swap_page() -> page_trans_huge_map_swapcount()/page_trans_huge_mapcount().
If the COW triggers while the other processes sharing the page are under a huge pmd split, to do an accurate reading, we must ensure the mapcount isn't computed while it's being transferred from the head page to the tail pages.
reuse_swap_cache() already runs serialized by the page lock, so it's enough to add the page lock around __split_huge_pmd_locked too, in order to add the missing serialization.
Note: the commit in "Fixes" is just to facilitate the backporting, because the code before such commit didn't try to do an accurate THP mapcount calculation and it instead used the page_count() to decide if to COW or not. Both the page_count and the pin_count are THP-wide refcounts, so they're inaccurate if used in reuse_swap_page(). Reverting such commit (besides the unrelated fix to the local anon_vma assignment) would have also opened the window for memory corruption side effects to certain workloads as documented in such commit header.
--- mm/huge_memory.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
mm/huge_memory.c +28 -3
@@ -2273,6 +2273,8 @@ void __split_huge_pmd(struct vm_area_strspinlock_t *ptl;struct mm_struct *mm = vma->vm_mm;unsigned long haddr = address &HPAGE_PMD_MASK ; +bool was_locked = false; +pmd_t _pmd;mmu_notifier_invalidate_range_start (mm, haddr, haddr +HPAGE_PMD_SIZE ); ptl =pmd_lock (mm, pmd);
@@ -2282,11 +2284,32 @@ void __split_huge_pmd(struct vm_area_str* pmd against. Otherwise we can end up replacing wrong page. */ VM_BUG_ON (freeze && !page); -if (page && page !=pmd_page (*pmd)) - goto out; +if (page) { +VM_WARN_ON_ONCE (!PageLocked (page)); + was_locked = true; +if (page !=pmd_page (*pmd)) + goto out; + } +repeat:if (pmd_trans_huge (*pmd)) { - page =pmd_page (*pmd); +if (!page) { + page =pmd_page (*pmd); +if (unlikely (!trylock_page (page))) { +get_page (page); + _pmd = *pmd; +spin_unlock (ptl); +lock_page (page); +spin_lock (ptl); +if (unlikely (!pmd_same (*pmd, _pmd))) { +unlock_page (page); +put_page (page); + page =NULL ; + goto repeat; + } +put_page (page); + } + }if (PageMlocked (page))clear_page_mlock (page); }else if (!(pmd_devmap (*pmd) ||is_pmd_migration_entry (*pmd)))
@@ -2294,6 +2317,8 @@ void __split_huge_pmd(struct vm_area_str__split_huge_pmd_locked (vma, pmd, haddr, freeze); out:spin_unlock (ptl); +if (!was_locked && page) +unlock_page (page);/* * No need to double call mmu_notifier->invalidate_range() callback. * They are 3 cases to consider inside __split_huge_pmd_locked():
Greg Kroah-Hartman
maintainerPATCH 191/267 mm: initialize deferred pages with interrupts enabled
In reply to Greg Kroah-HartmanFrom: Pavel Tatashin <[email protected]>
commit 3d060856adfc59afb9d029c233141334cfaba418 upstream.
Initializing struct pages is a long task and keeping interrupts disabled for the duration of this operation introduces a number of problems.
1. jiffies are not updated for long period of time, and thus incorrect time is reported. See proposed solution and discussion here:
lkml/[email protected]
2. It prevents farther improving deferred page initialization by allowing intra-node multi-threading.
We are keeping interrupts disabled to solve a rather theoretical problem that was never observed in real world (See 3a2d7fa8a3d5).
Let's keep interrupts enabled. In case we ever encounter a scenario where an interrupt thread wants to allocate large amount of memory this early in boot we can deal with that by growing zone (see deferred_grow_zone()) by the needed amount before starting deferred_init_memmap() threads.
Before:
[ 1.232459] node 0 initialised, 12058412 pages in 1ms
After:
[ 1.632580] node 0 initialised, 12051227 pages in 436ms
--- include/linux/mmzone.h | 2 ++ mm/page_alloc.c | 19 +++++++------------ 2 files changed, 9 insertions(+), 12 deletions(-)
include/linux/mmzone.h +2 -0
@@ -638,6 +638,8 @@ typedef struct pglist_data {/* * Must be held any time you expect node_start_pfn, node_present_pages * or node_spanned_pages stay constant. +* Also synchronizes pgdat->first_deferred_pfn during deferred page +* init. * * pgdat_resize_lock() and pgdat_resize_unlock() are provided to * manipulate node_size_lock without checking for CONFIG_MEMORY_HOTPLUG
mm/page_alloc.c +7 -12
@@ -1586,6 +1586,13 @@ static int __init deferred_init_memmap(vBUG_ON (pgdat->first_deferred_pfn >pgdat_end_pfn (pgdat)); pgdat->first_deferred_pfn =ULONG_MAX ; +/* +* Once we unlock here, the zone cannot be grown anymore, thus if an +* interrupt thread must allocate this early in boot, zone must be +* pre-grown prior to start of deferred page initialization. +*/ +pgdat_resize_unlock (pgdat, &flags); +/* Only the highest zone is deferred so find it */ for (zid =0 ; zid <MAX_NR_ZONES ; zid++) { zone = pgdat->node_zones + zid;
@@ -1610,7 +1617,6 @@ static int __init deferred_init_memmap(v epfn = min_t(unsigned long, zone_end_pfn(zone), PFN_DOWN(epa));deferred_free_pages (nid, zid, spfn, epfn); } -pgdat_resize_unlock (pgdat, &flags);/* Sanity check that the next zone really is unpopulated */ WARN_ON (++zid <MAX_NR_ZONES &&populated_zone (++zone));
@@ -1657,17 +1663,6 @@ deferred_grow_zone(struct zone *zone, unpgdat_resize_lock (pgdat, &flags);/* -* If deferred pages have been initialized while we were waiting for -* the lock, return true, as the zone was grown. The caller will retry -* this zone. We won't return to this function since the caller also -* has this static branch. -*/ -if (!static_branch_unlikely (&deferred_pages)) { -pgdat_resize_unlock (pgdat, &flags); -return true; - } - -/* * If someone grew this zone while we were waiting for spinlock, return * true, as there might be enough pages already. */
Greg Kroah-Hartman
maintainerPATCH 192/267 MIPS: CPU_LOONGSON2EF need software to maintain cache consistency
In reply to Greg Kroah-HartmanFrom: Lichao Liu <[email protected]>
commit a202bf71f08b3ef15356db30535e30b03cf23aec upstream.
CPU_LOONGSON2EF need software to maintain cache consistency, so modify the 'cpu_needs_post_dma_flush' function to return true when the cpu type is CPU_LOONGSON2EF.
--- arch/mips/mm/dma-noncoherent.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/mm/dma-noncoherent.c +1 -0
@@ -56,6 +56,7 @@ static inline bool cpu_needs_post_dma_flcase CPU_R10000 :case CPU_R12000 :case CPU_BMIPS5000 : +case CPU_LOONGSON2EF :return true;default :/*
Greg Kroah-Hartman
maintainerPATCH 193/267 ima: Fix ima digest hash table key calculation
In reply to Greg Kroah-HartmanFrom: Krzysztof Struczynski <[email protected]>
commit 1129d31b55d509f15e72dc68e4b5c3a4d7b4da8d upstream.
Function hash_long() accepts unsigned long, while currently only one byte is passed from ima_hash_key(), which calculates a key for ima_htable.
Given that hashing the digest does not give clear benefits compared to using the digest itself, remove hash_long() and return the modulus calculated on the first two bytes of the digest with the number of slots. Also reduce the depth of the hash table by doubling the number of slots.
--- security/integrity/ima/ima.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
security/integrity/ima/ima.h +4 -3
@@ -40,7 +40,7 @@ enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 =#define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE#define IMA_EVENT_NAME_LEN_MAX 255 -#define IMA_HASH_BITS 9 +#define IMA_HASH_BITS 10#define IMA_MEASURE_HTABLE_SIZE (1 << IMA_HASH_BITS)#define IMA_TEMPLATE_FIELD_ID_MAX_LEN 16
@@ -166,9 +166,10 @@ struct ima_h_table { };extern struct ima_h_table ima_htable; -static inline unsigned long ima_hash_key (u8 *digest) +static inline unsigned int ima_hash_key (u8 *digest) { -return hash_long (*digest,IMA_HASH_BITS ); +/* there is no point in taking a hash of part of a digest */ +return (digest[0 ] | digest[1 ] <<8 ) %IMA_MEASURE_HTABLE_SIZE ; }#define __ima_hooks (hook) \
Greg Kroah-Hartman
maintainerPATCH 194/267 ima: Directly assign the ima_default_policy pointer to ima_rules
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 067a436b1b0aafa593344fddd711a755a58afb3b upstream.
This patch prevents the following oops:
[ 10.771813] BUG: kernel NULL pointer dereference, address: 0000000000000 [...] [ 10.779790] RIP: 0010:ima_match_policy+0xf7/0xb80 [...] [ 10.798576] Call Trace: [ 10.798993] ? ima_lsm_policy_change+0x2b0/0x2b0 [ 10.799753] ? inode_init_owner+0x1a0/0x1a0 [ 10.800484] ? _raw_spin_lock+0x7a/0xd0 [ 10.801592] ima_must_appraise.part.0+0xb6/0xf0 [ 10.802313] ? ima_fix_xattr.isra.0+0xd0/0xd0 [ 10.803167] ima_must_appraise+0x4f/0x70 [ 10.804004] ima_post_path_mknod+0x2e/0x80 [ 10.804800] do_mknodat+0x396/0x3c0
It occurs when there is a failure during IMA initialization, and ima_init_policy() is not called. IMA hooks still call ima_match_policy() but ima_rules is NULL. This patch prevents the crash by directly assigning the ima_default_policy pointer to ima_rules when ima_rules is defined. This wouldn't alter the existing behavior, as ima_rules is always set at the end of ima_init_policy().
--- security/integrity/ima/ima_policy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/integrity/ima/ima_policy.c +1 -2
@@ -196,7 +196,7 @@ static struct ima_rule_entry secure_bootstatic LIST_HEAD (ima_default_rules);static LIST_HEAD (ima_policy_rules);static LIST_HEAD (ima_temp_rules); -static struct list_head *ima_rules; +static struct list_head *ima_rules = &ima_default_rules;static int ima_policy__initdata ;
@@ -544,7 +544,6 @@ void __init ima_init_policy(void) temp_ima_appraise |=IMA_APPRAISE_POLICY ; } - ima_rules = &ima_default_rules;ima_update_policy_flag (); }
Greg Kroah-Hartman
maintainerPATCH 195/267 evm: Fix possible memory leak in evm_calc_hmac_or_hash()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 0c4395fb2aa77341269ea619c5419ea48171883f upstream.
Don't immediately return if the signature is portable and security.ima is not present. Just set error so that memory allocated is freed before returning from evm_calc_hmac_or_hash().
--- security/integrity/evm/evm_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_crypto.c +1 -1
@@ -249,7 +249,7 @@ static int evm_calc_hmac_or_hash(struct/* Portable EVM signatures must include an IMA hash */ if (type ==EVM_XATTR_PORTABLE_DIGSIG && !ima_present) -return -EPERM ; + error = -EPERM ; out:kfree (xattr_value);kfree (desc);
Greg Kroah-Hartman
maintainerPATCH 196/267 ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max
In reply to Greg Kroah-HartmanFrom: Harshad Shirwadkar <[email protected]>
commit c36a71b4e35ab35340facdd6964a00956b9fef0a upstream.
If eh->eh_max is 0, EXT_MAX_EXTENT/INDEX would evaluate to unsigned (-1) resulting in illegal memory accesses. Although there is no consistent repro, we see that generic/019 sometimes crashes because of this bug.
Ran gce-xfstests smoke and verified that there were no regressions.
--- fs/ext4/ext4_extents.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ext4/ext4_extents.h +6 -3
@@ -157,10 +157,13 @@ struct ext4_ext_path { (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)#define EXT_LAST_INDEX (__hdr__) \ (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) -#define EXT_MAX_EXTENT (__hdr__) \ - (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) +#define EXT_MAX_EXTENT (__hdr__) \ + ((le16_to_cpu((__hdr__)->eh_max)) ? \ + ((EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)) \ + : 0)#define EXT_MAX_INDEX (__hdr__) \ - (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) + ((le16_to_cpu((__hdr__)->eh_max)) ? \ + ((EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)) : 0)static inline struct ext4_extent_header *ext_inode_hdr (struct inode *inode) {
Greg Kroah-Hartman
maintainerPATCH 197/267 ext4: fix error pointer dereference
In reply to Greg Kroah-HartmanFrom: Jeffle Xu <[email protected]>
commit 8418897f1bf87da0cb6936489d57a4320c32c0af upstream.
Don't pass error pointers to brelse().
commit 7159a986b420 ("ext4: fix some error pointer dereferences") has fixed some cases, fix the remaining one case.
Once ext4_xattr_block_find()->ext4_sb_bread() failed, error pointer is stored in @bs->bh, which will be passed to brelse() in the cleanup routine of ext4_xattr_set_handle(). This will then cause a NULL panic crash in __brelse().
BUG: unable to handle kernel NULL pointer dereference at 000000000000005b RIP: 0010:__brelse+0x1b/0x50 Call Trace: ext4_xattr_set_handle+0x163/0x5d0 ext4_xattr_set+0x95/0x110 __vfs_setxattr+0x6b/0x80 __vfs_setxattr_noperm+0x68/0x1b0 vfs_setxattr+0xa0/0xb0 setxattr+0x12c/0x1a0 path_setxattr+0x8d/0xc0 __x64_sys_setxattr+0x27/0x30 do_syscall_64+0x60/0x250 entry_SYSCALL_64_after_hwframe+0x49/0xbe
In this case, @bs->bh stores '-EIO' actually.
--- fs/ext4/xattr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/ext4/xattr.c +5 -2
@@ -1824,8 +1824,11 @@ ext4_xattr_block_find(struct inode *inodif (EXT4_I (inode)->i_file_acl) {/* The inode already has an extended attribute block. */ bs->bh =ext4_sb_bread (sb,EXT4_I (inode)->i_file_acl,REQ_PRIO ); -if (IS_ERR (bs->bh)) -return PTR_ERR (bs->bh); +if (IS_ERR (bs->bh)) { + error =PTR_ERR (bs->bh); + bs->bh =NULL ; +return error; + }ea_bdebug (bs->bh,"b_count=%d, refcount=%d" ,atomic_read (&(bs->bh->b_count)),le32_to_cpu (BHDR (bs->bh)->h_refcount));
Greg Kroah-Hartman
maintainerPATCH 198/267 ext4: fix race between ext4_sync_parent() and rename()
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 08adf452e628b0e2ce9a01048cfbec52353703d7 upstream.
'igrab(d_inode(dentry->d_parent))' without holding dentry->d_lock is broken because without d_lock, d_parent can be concurrently changed due to a rename(). Then if the old directory is immediately deleted, old d_parent->inode can be NULL. That causes a NULL dereference in igrab().
To fix this, use dget_parent() to safely grab a reference to the parent dentry, which pins the inode. This also eliminates the need to use d_find_any_alias() other than for the initial inode, as we no longer throw away the dentry at each step.
This is an extremely hard race to hit, but it is possible. Adding a udelay() in between the reads of ->d_parent and its ->d_inode makes it reproducible on a no-journal filesystem using the following program:
#include <fcntl.h>
#include <unistd.h>
int main()
{
if (fork()) {
for (;;) {
mkdir("dir1", 0700);
int fd = open("dir1/file", O_RDWR|O_CREAT|O_SYNC);
write(fd, "X", 1);
close(fd);
}
} else {
mkdir("dir2", 0700);
for (;;) {
rename("dir1/file", "dir2/file");
rmdir("dir1");
}
}
}--- fs/ext4/fsync.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
fs/ext4/fsync.c +13 -15
@@ -44,30 +44,28 @@*/ static int ext4_sync_parent (struct inode *inode) { -struct dentry *dentry =NULL ; -struct inode *next; +struct dentry *dentry, *next;int ret =0 ;if (!ext4_test_inode_state (inode,EXT4_STATE_NEWENTRY ))return 0 ; - inode =igrab (inode); + dentry =d_find_any_alias (inode); +if (!dentry) +return 0 ;while (ext4_test_inode_state (inode,EXT4_STATE_NEWENTRY )) {ext4_clear_inode_state (inode,EXT4_STATE_NEWENTRY ); - dentry =d_find_any_alias (inode); -if (!dentry) -break ; - next =igrab (d_inode (dentry->d_parent)); + + next =dget_parent (dentry);dput (dentry); -if (!next) -break ; -iput (inode); - inode = next; + dentry = next; + inode = dentry->d_inode; +/* * The directory inode may have gone through rmdir by now. But * the inode itself and its blocks are still allocated (we hold -* a reference to the inode so it didn't go through -* ext4_evict_inode()) and so we are safe to flush metadata -* blocks and the inode. +* a reference to the inode via its dentry), so it didn't go +* through ext4_evict_inode()) and so we are safe to flush +* metadata blocks and the inode. */ ret =sync_mapping_buffers (inode->i_mapping);if (ret)
@@ -76,7 +74,7 @@ static int ext4_sync_parent(struct inodeif (ret)break ; } -iput (inode); +dput (dentry);return ret; }
Greg Kroah-Hartman
maintainerPATCH 199/267 PCI: Avoid Pericom USB controller OHCI/EHCI PME# defect
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 68f5fc4ea9ddf9f77720d568144219c4e6452cde ]
Both Pericom OHCI and EHCI devices advertise PME# support from all power states:
06:00.0 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) (prog-if 10 [OHCI])
Subsystem: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e]
Capabilities: [80] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
06:00.2 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f] (rev 01) (prog-if 20 [EHCI])
Subsystem: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f]
Capabilities: [80] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
But testing shows that it's unreliable: there is a 20% chance PME# won't be asserted when a USB device is plugged.
Remove PME support for both devices to make USB plugging work reliably.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205981
--- drivers/pci/quirks.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
@@ -5294,6 +5294,19 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev) }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ASMEDIA ,0x2142 , pci_fixup_no_d0_pme); +/* +* Device [12d8:0x400e] and [12d8:0x400f] +* These devices advertise PME# support in all power states but don't +* reliably assert it. +*/ +static void pci_fixup_no_pme (struct pci_dev *dev) +{ +pci_info (dev,"PME# is unreliable, disabling it\n" ); + dev->pme_support =0 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_PERICOM ,0x400e , pci_fixup_no_pme); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_PERICOM ,0x400f , pci_fixup_no_pme); +static void apex_pci_fixup_class (struct pci_dev *pdev) { pdev->class = (PCI_CLASS_SYSTEM_OTHER <<8 ) | pdev->class;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 200/267 PCI: Avoid FLR for AMD Matisse HD Audio & USB 3.0
In reply to Greg Kroah-HartmanFrom: Marcos Scriven <[email protected]>
[ Upstream commit 0d14f06cd6657ba3446a5eb780672da487b068e7 ]
The AMD Matisse HD Audio & USB 3.0 devices advertise Function Level Reset support, but hang when an FLR is triggered.
To reproduce the problem, attach the device to a VM, then detach and try to attach again.
Rename the existing quirk_intel_no_flr(), which was not Intel-specific, to quirk_no_flr(), and apply it to prevent the use of FLR on these AMD devices.
--- drivers/pci/quirks.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/pci/quirks.c +14 -4
@@ -4956,13 +4956,23 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev) }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x443 , quirk_intel_qat_vf_cap); -/* FLR may cause some 82579 devices to hang */ -static void quirk_intel_no_flr (struct pci_dev *dev) +/* +* FLR may cause the following to devices to hang: +* +* AMD Starship/Matisse HD Audio Controller 0x1487 +* AMD Matisse USB 3.0 Host Controller 0x149c +* Intel 82579LM Gigabit Ethernet Controller 0x1502 +* Intel 82579V Gigabit Ethernet Controller 0x1503 +* +*/ +static void quirk_no_flr (struct pci_dev *dev) { dev->dev_flags |=PCI_DEV_FLAGS_NO_FLR_RESET ; } -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1502 , quirk_intel_no_flr); -DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1503 , quirk_intel_no_flr); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x1487 , quirk_no_flr); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x149c , quirk_no_flr); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1502 , quirk_no_flr); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1503 , quirk_no_flr);static void quirk_no_ext_tags (struct pci_dev *pdev) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 201/267 PCI: Avoid FLR for AMD Starship USB 3.0
In reply to Greg Kroah-HartmanFrom: Kevin Buettner <[email protected]>
[ Upstream commit 5727043c73fdfe04597971b5f3f4850d879c1f4f ]
The AMD Starship USB 3.0 host controller advertises Function Level Reset support, but it apparently doesn't work. Add a quirk to prevent use of FLR on this device.
Without this quirk, when attempting to assign (pass through) an AMD Starship USB 3.0 host controller to a guest OS, the system becomes increasingly unresponsive over the course of several minutes, eventually requiring a hard reset. Shortly after attempting to start the guest, I see these messages:
vfio-pci 0000:05:00.3: not ready 1023ms after FLR; waiting vfio-pci 0000:05:00.3: not ready 2047ms after FLR; waiting vfio-pci 0000:05:00.3: not ready 4095ms after FLR; waiting vfio-pci 0000:05:00.3: not ready 8191ms after FLR; waiting
And then eventually:
vfio-pci 0000:05:00.3: not ready 65535ms after FLR; giving up
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 0.000 msecs
perf: interrupt took too long (642744 > 2500), lowering kernel.perf_event_max_sample_rate to 1000
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 82.270 msecs
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 680.608 msecs
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 100.952 msecs
...
watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [qemu-system-x86:7487]
Tested on a Micro-Star International Co., Ltd. MS-7C59/Creator TRX40 motherboard with an AMD Ryzen Threadripper 3970X.
--- drivers/pci/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -4960,6 +4960,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap);* FLR may cause the following to devices to hang: * * AMD Starship/Matisse HD Audio Controller 0x1487 +* AMD Starship USB 3.0 Host Controller 0x148c * AMD Matisse USB 3.0 Host Controller 0x149c * Intel 82579LM Gigabit Ethernet Controller 0x1502 * Intel 82579V Gigabit Ethernet Controller 0x1503
@@ -4970,6 +4971,7 @@ static void quirk_no_flr(struct pci_dev *dev) dev->dev_flags |=PCI_DEV_FLAGS_NO_FLR_RESET ; }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x1487 , quirk_no_flr); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x148c , quirk_no_flr);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x149c , quirk_no_flr);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1502 , quirk_no_flr);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1503 , quirk_no_flr);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 202/267 PCI: Add ACS quirk for iProc PAXB
In reply to Greg Kroah-HartmanFrom: Abhinav Ratna <[email protected]>
[ Upstream commit 46b2c32df7a462d0e64b68c513e5c4c1b2a399a7 ]
iProc PAXB Root Ports don't advertise an ACS capability, but they do not allow peer-to-peer transactions between Root Ports. Add an ACS quirk so each Root Port can be in a separate IOMMU group.
--- drivers/pci/quirks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/pci/quirks.c +14 -0
@@ -4543,6 +4543,19 @@ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags)return acs_flags ?0 :1 ; } +static int pci_quirk_brcm_acs (struct pci_dev *dev,u16 acs_flags) +{ +/* +* iProc PAXB Root Ports don't advertise an ACS capability, but +* they do not allow peer-to-peer transactions between Root Ports. +* Allow each Root Port to be in a separate IOMMU group by masking +* SV/RR/CR/UF bits. +*/ + acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); + +return acs_flags ?0 :1 ; +} + static const struct pci_dev_acs_enabled { u16 vendor; u16 device;
@@ -4634,6 +4647,7 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs }, { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs }, { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, + { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, { 0 } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 203/267 PCI: Add ACS quirk for Intel Root Complex Integrated Endpoints
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
[ Upstream commit 3247bd10a4502a3075ce8e1c3c7d31ef76f193ce ]
All Intel platforms guarantee that all root complex implementations must send transactions up to IOMMU for address translations. Hence for Intel RCiEP devices, we can assume some ACS-type isolation even without an ACS capability.
Quoted 1 line
From the Intel VT-d spec, r3.1, sec 3.16 ("Root-Complex Peer to Peer
Considerations"):
When DMA remapping is enabled, peer-to-peer requests through the Root-Complex must be handled as follows:
- The input address in the request is translated (through first-level, second-level or nested translation) to a host physical address (HPA). The address decoding for peer addresses must be done only on the translated HPA. Hardware implementations are free to further limit peer-to-peer accesses to specific host physical address regions (or to completely disallow peer-forwarding of translated requests).
- Since address translation changes the contents (address field) of the PCI Express Transaction Layer Packet (TLP), for PCI Express peer-to-peer requests with ECRC, the Root-Complex hardware must use the new ECRC (re-computed with the translated address) if it decides to forward the TLP as a peer request.
- Root-ports, and multi-function root-complex integrated endpoints, may support additional peer-to-peer control features by supporting PCI Express Access Control Services (ACS) capability. Refer to ACS capability in PCI Express specifications for details.
Since Linux didn't give special treatment to allow this exception, certain RCiEP MFD devices were grouped in a single IOMMU group. This doesn't permit a single device to be assigned to a guest for instance.
In one vendor system: Device 14.x were grouped in a single IOMMU group.
/sys/kernel/iommu_groups/5/devices/0000:00:14.0
/sys/kernel/iommu_groups/5/devices/0000:00:14.2
/sys/kernel/iommu_groups/5/devices/0000:00:14.3
After this patch:
/sys/kernel/iommu_groups/5/devices/0000:00:14.0 /sys/kernel/iommu_groups/5/devices/0000:00:14.2 /sys/kernel/iommu_groups/6/devices/0000:00:14.3 <<< new group
14.0 and 14.2 are integrated devices, but legacy end points, whereas 14.3 was a PCIe-compliant RCiEP.
00:14.3 Network controller: Intel Corporation Device 9df0 (rev 30)
Capabilities: [40] Express (v2) Root Complex Integrated Endpoint, MSI 00
This permits assigning this device to a guest VM.
--- drivers/pci/quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/pci/quirks.c +15 -0
@@ -4543,6 +4543,20 @@ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags)return acs_flags ?0 :1 ; } +static int pci_quirk_rciep_acs (struct pci_dev *dev,u16 acs_flags) +{ +/* +* Intel RCiEP's are required to allow p2p only on translated +* addresses. Refer to Intel VT-d specification, r3.1, sec 3.16, +* "Root-Complex Peer to Peer Considerations". +*/ +if (pci_pcie_type (dev) !=PCI_EXP_TYPE_RC_END ) +return -ENOTTY ; + +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); +} +static int pci_quirk_brcm_acs (struct pci_dev *dev,u16 acs_flags) {/*
@@ -4626,6 +4640,7 @@ static const struct pci_dev_acs_enabled {/* I219 */ { PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_rciep_acs },/* QCOM QDF2xxx root ports */ { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 204/267 PCI: Remove unused NFP32xx IDs
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 1ccce46c5e8b8a0d2606fb8bb72bff069ffdc3ab ]
Defines for NFP32xx are no longer used anywhere, remove them.
--- include/linux/pci_ids.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/pci_ids.h +0 -2
@@ -2539,8 +2539,6 @@#define PCI_VENDOR_ID_HUAWEI 0x19e5#define PCI_VENDOR_ID_NETRONOME 0x19ee -#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200 -#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240#define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000#define PCI_DEVICE_ID_NETRONOME_NFP5000 0x5000#define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 205/267 pci:ipmi: Move IPMI PCI class id defines to pci_ids.h
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit 05c3d056086a6217a77937b7fa0df35ec75715e6 ]
--- drivers/char/ipmi/ipmi_si_pci.c | 5 ----- include/linux/pci_ids.h | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/char/ipmi/ipmi_si_pci.c +0 -5
@@ -18,11 +18,6 @@ module_param_named(trypci, si_trypci, bool, 0);MODULE_PARM_DESC (trypci,"Setting this to zero will disable the" " default scan of the interfaces identified via pci" ); -#define PCI_CLASS_SERIAL_IPMI 0x0c07 -#define PCI_CLASS_SERIAL_IPMI_SMIC 0x0c0700 -#define PCI_CLASS_SERIAL_IPMI_KCS 0x0c0701 -#define PCI_CLASS_SERIAL_IPMI_BT 0x0c0702 -#define PCI_DEVICE_ID_HP_MMC 0x121Astatic void ipmi_pci_cleanup (struct si_sm_io *io)
include/linux/pci_ids.h +4 -0
@@ -117,6 +117,10 @@#define PCI_CLASS_SERIAL_USB_DEVICE 0x0c03fe#define PCI_CLASS_SERIAL_FIBER 0x0c04#define PCI_CLASS_SERIAL_SMBUS 0x0c05 +#define PCI_CLASS_SERIAL_IPMI 0x0c07 +#define PCI_CLASS_SERIAL_IPMI_SMIC 0x0c0700 +#define PCI_CLASS_SERIAL_IPMI_KCS 0x0c0701 +#define PCI_CLASS_SERIAL_IPMI_BT 0x0c0702#define PCI_BASE_CLASS_WIRELESS 0x0d#define PCI_CLASS_WIRELESS_RF_CONTROLLER 0x0d10
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 206/267 hwmon/k10temp, x86/amd_nb: Consolidate shared device IDs
In reply to Greg Kroah-HartmanFrom: Woods, Brian <[email protected]>
[ Upstream commit dedf7dce4cec5c0abe69f4fa6938d5100398220b ]
Consolidate shared PCI_DEVICE_IDs that were scattered through k10temp and amd_nb, and move them into pci_ids.
--- arch/x86/kernel/amd_nb.c | 3 +-- drivers/hwmon/k10temp.c | 9 +-------- include/linux/pci_ids.h | 2 ++ 3 files changed, 4 insertions(+), 10 deletions(-)
arch/x86/kernel/amd_nb.c +1 -2
@@ -11,13 +11,12 @@#include <linux/errno.h> #include <linux/export.h> #include <linux/spinlock.h> +#include <linux/pci_ids.h> #include <asm/amd_nb.h> #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 -#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463#define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464 -#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec/* Protect the PCI config register pairs used for SMN and DF indirect access. */
drivers/hwmon/k10temp.c +1 -8
@@ -23,6 +23,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/pci.h> +#include <linux/pci_ids.h> #include <asm/amd_nb.h> #include <asm/processor.h>
@@ -41,14 +42,6 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);#define PCI_DEVICE_ID_AMD_15H_M70H_NB_F3 0x15b3#endif -#ifndef PCI_DEVICE_ID_AMD_17H_DF_F3 -#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 -#endif - -#ifndef PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 -#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb -#endif -/* CPUID function 0x80000001, ebx */ #define CPUID_PKGTYPE_MASK 0xf0000000#define CPUID_PKGTYPE_F 0x00000000
include/linux/pci_ids.h +2 -0
@@ -545,6 +545,8 @@#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F3 0x1583#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F4 0x1584 +#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 +#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 207/267 x86/amd_nb: Add PCI device IDs for family 17h, model 30h
In reply to Greg Kroah-HartmanFrom: Woods, Brian <[email protected]>
[ Upstream commit be3518a16ef270e3b030a6ae96055f83f51bd3dd ]
Add the PCI device IDs for family 17h model 30h, since they are needed for accessing various registers via the data fabric/SMN interface.
--- arch/x86/kernel/amd_nb.c | 6 ++++++ include/linux/pci_ids.h | 1 + 2 files changed, 7 insertions(+)
arch/x86/kernel/amd_nb.c +6 -0
@@ -16,8 +16,10 @@#define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480#define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec +#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494/* Protect the PCI config register pairs used for SMN and DF indirect access. */ static DEFINE_MUTEX (smn_mutex);
@@ -27,9 +29,11 @@ static u32 *flush_words;static const struct pci_device_id amd_root_ids[] = { {PCI_DEVICE (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_17H_ROOT ) }, {PCI_DEVICE (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_17H_M10H_ROOT ) }, + {PCI_DEVICE (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_17H_M30H_ROOT ) }, {} }; +#define PCI_DEVICE_ID_AMD_CNB17H_F4 0x1704const struct pci_device_id amd_nb_misc_ids[] = {
@@ -43,6 +47,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, {} };
@@ -56,6 +61,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, {} };
include/linux/pci_ids.h +1 -0
@@ -547,6 +547,7 @@#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F4 0x1584#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb +#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 208/267 PCI: add USR vendor id and use it in r8169 and w6692 driver
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 9206eb0bc5679d06d2f54b9db86fe2b9a55e07e4 ]
The PCI vendor id of U.S. Robotics isn't defined in pci_ids.h so far, only ISDN driver w6692 has a private definition. Move the definition to pci_ids.h and use it in the r8169 driver too.
--- drivers/isdn/hardware/mISDN/w6692.c | 3 --- drivers/net/ethernet/realtek/r8169.c | 2 +- include/linux/pci_ids.h | 2 ++ 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/isdn/hardware/mISDN/w6692.c +0 -3
@@ -52,10 +52,7 @@ static const struct w6692map w6692_map[] = {W6692_USR, "USR W6692"} }; -#ifndef PCI_VENDOR_ID_USR -#define PCI_VENDOR_ID_USR 0x16ec#define PCI_DEVICE_ID_USR_6692 0x3409 -#endif struct w6692_ch {struct bchannel bch;
drivers/net/ethernet/realtek/r8169.c +1 -1
@@ -229,7 +229,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4300), 0, 0, RTL_CFG_0 }, { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4302), 0, 0, RTL_CFG_0 }, { PCI_DEVICE(PCI_VENDOR_ID_AT, 0xc107), 0, 0, RTL_CFG_0 }, - { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, + { PCI_DEVICE(PCI_VENDOR_ID_USR, 0x0116), 0, 0, RTL_CFG_0 }, { PCI_VENDOR_ID_LINKSYS, 0x1032, PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, { 0x0001, 0x8168,
include/linux/pci_ids.h +2 -0
@@ -2362,6 +2362,8 @@#define PCI_VENDOR_ID_SYNOPSYS 0x16c3 +#define PCI_VENDOR_ID_USR 0x16ec +#define PCI_VENDOR_ID_VITESSE 0x1725#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 209/267 PCI: Move Synopsys HAPS platform device IDs
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit b6061b1e566d70c7686d194a6c47dc6ffa665c77 ]
Move Synopsys HAPS platform device IDs to pci_ids.h so that both drivers/pci/quirks.c and dwc3-haps driver can reference these IDs.
--- drivers/usb/dwc3/dwc3-haps.c | 4 ---- include/linux/pci_ids.h | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-haps.c +0 -4
@@ -15,10 +15,6 @@#include <linux/platform_device.h> #include <linux/property.h> -#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd -#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce -#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf -/** * struct dwc3_haps - Driver private structure * @dwc3: child dwc3 platform_device
include/linux/pci_ids.h +3 -0
@@ -2361,6 +2361,9 @@#define PCI_DEVICE_ID_CENATEK_IDE 0x0001#define PCI_VENDOR_ID_SYNOPSYS 0x16c3 +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf#define PCI_VENDOR_ID_USR 0x16ec
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 210/267 PCI: Move Rohm Vendor ID to generic list
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 0ce26a1c31ca928df4dfc7504c8898b71ff9f5d5 ]
Move the Rohm Vendor ID to pci_ids.h instead of defining it in several drivers.
--- drivers/dma/pch_dma.c | 1 - drivers/gpio/gpio-ml-ioh.c | 2 -- drivers/gpio/gpio-pch.c | 1 - drivers/i2c/busses/i2c-eg20t.c | 1 - drivers/misc/pch_phub.c | 1 - drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 7 ++----- drivers/spi/spi-topcliff-pch.c | 1 - drivers/tty/serial/pch_uart.c | 2 -- drivers/usb/gadget/udc/pch_udc.c | 1 - include/linux/pci_ids.h | 2 ++ 10 files changed, 4 insertions(+), 15 deletions(-)
drivers/dma/pch_dma.c +0 -1
@@ -972,7 +972,6 @@ static void pch_dma_remove(struct pci_dev *pdev) }/* PCI Device ID of DMA device */ -#define PCI_VENDOR_ID_ROHM 0x10DB#define PCI_DEVICE_ID_EG20T_PCH_DMA_8CH 0x8810#define PCI_DEVICE_ID_EG20T_PCH_DMA_4CH 0x8815#define PCI_DEVICE_ID_ML7213_DMA1_8CH 0x8026
drivers/gpio/gpio-ml-ioh.c +0 -2
@@ -31,8 +31,6 @@#define IOH_IRQ_BASE 0 -#define PCI_VENDOR_ID_ROHM 0x10DB -struct ioh_reg_comn {u32 ien;u32 istatus;
drivers/gpio/gpio-pch.c +0 -1
@@ -524,7 +524,6 @@ static int pch_gpio_resume(struct pci_dev *pdev)#define pch_gpio_resume NULL#endif -#define PCI_VENDOR_ID_ROHM 0x10DBstatic const struct pci_device_id pch_gpio_pcidev_id[] = { {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x8803 ) }, {PCI_DEVICE (PCI_VENDOR_ID_ROHM ,0x8014 ) },
drivers/i2c/busses/i2c-eg20t.c +0 -1
@@ -177,7 +177,6 @@ static wait_queue_head_t pch_event;static DEFINE_MUTEX (pch_mutex);/* Definition for ML7213 by LAPIS Semiconductor */ -#define PCI_VENDOR_ID_ROHM 0x10DB#define PCI_DEVICE_ID_ML7213_I2C 0x802D#define PCI_DEVICE_ID_ML7223_I2C 0x8010#define PCI_DEVICE_ID_ML7831_I2C 0x8817
drivers/misc/pch_phub.c +0 -1
@@ -64,7 +64,6 @@#define CLKCFG_UARTCLKSEL (1 << 18)/* Macros for ML7213 */ -#define PCI_VENDOR_ID_ROHM 0x10db#define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A/* Macros for ML7223 */
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +2 -5
@@ -27,7 +27,6 @@#define DRV_VERSION "1.01"const char pch_driver_version[] =DRV_VERSION ; -#define PCI_DEVICE_ID_INTEL_IOH1_GBE 0x8802/* Pci device ID */ #define PCH_GBE_MAR_ENTRIES 16#define PCH_GBE_SHORT_PKT 64#define DSC_INIT16 0xC000
@@ -37,11 +36,9 @@ const char pch_driver_version[] = DRV_VERSION;#define PCH_GBE_PCI_BAR 1#define PCH_GBE_RESERVE_MEMORY 0x200000/* 2MB */ -/* Macros for ML7223 */ -#define PCI_VENDOR_ID_ROHM 0x10db -#define PCI_DEVICE_ID_ROHM_ML7223_GBE 0x8013 +#define PCI_DEVICE_ID_INTEL_IOH1_GBE 0x8802 -/* Macros for ML7831 */ +#define PCI_DEVICE_ID_ROHM_ML7223_GBE 0x8013#define PCI_DEVICE_ID_ROHM_ML7831_GBE 0x8802#define PCH_GBE_TX_WEIGHT 64
drivers/spi/spi-topcliff-pch.c +0 -1
@@ -92,7 +92,6 @@#define PCH_MAX_SPBR 1023/* Definition for ML7213/ML7223/ML7831 by LAPIS Semiconductor */ -#define PCI_VENDOR_ID_ROHM 0x10DB#define PCI_DEVICE_ID_ML7213_SPI 0x802c#define PCI_DEVICE_ID_ML7223_SPI 0x800F#define PCI_DEVICE_ID_ML7831_SPI 0x8816
drivers/tty/serial/pch_uart.c +0 -2
@@ -192,8 +192,6 @@ enum {#define PCH_UART_HAL_LOOP (PCH_UART_MCR_LOOP)#define PCH_UART_HAL_AFE (PCH_UART_MCR_AFE) -#define PCI_VENDOR_ID_ROHM 0x10DB -#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)#define DEFAULT_UARTCLK 1843200/* 1.8432 MHz */
drivers/usb/gadget/udc/pch_udc.c +0 -1
@@ -368,7 +368,6 @@ struct pch_udc_dev {#define PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC 0x0939#define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 -#define PCI_VENDOR_ID_ROHM 0x10DB#define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D#define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808
include/linux/pci_ids.h +2 -0
@@ -1140,6 +1140,8 @@#define PCI_VENDOR_ID_TCONRAD 0x10da#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508 +#define PCI_VENDOR_ID_ROHM 0x10db +#define PCI_VENDOR_ID_NVIDIA 0x10de#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 211/267 misc: pci_endpoint_test: Add the layerscape EP device support
In reply to Greg Kroah-HartmanFrom: Xiaowei Bao <[email protected]>
[ Upstream commit 85cef374d0ba93b8a2bd24850b97c1b34c666ccb ]
Add the layerscape EP device support in pci_endpoint_test driver.
--- drivers/misc/pci_endpoint_test.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/pci_endpoint_test.c +1 -0
@@ -795,6 +795,7 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)static const struct pci_device_id pci_endpoint_test_tbl[] = { {PCI_DEVICE (PCI_VENDOR_ID_TI , PCI_DEVICE_ID_TI_DRA74x) }, {PCI_DEVICE (PCI_VENDOR_ID_TI , PCI_DEVICE_ID_TI_DRA72x) }, + {PCI_DEVICE (PCI_VENDOR_ID_FREESCALE ,0x81c0 ) }, {PCI_DEVICE (PCI_VENDOR_ID_SYNOPSYS ,0xedda ) }, { } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 212/267 misc: pci_endpoint_test: Add support to test PCI EP in AM654x
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 5bb04b19230c02cc1b450b029856cbe093e09908 ]
TI's AM654x PCIe EP has a restriction that BAR_0 is mapped to application registers. "PCIe Inbound Address Translation" section in AM65x Sitara Processors TRM (SPRUID7 – April 2018) describes BAR0 as reserved.
Configure pci_endpoint_test to use BAR_2 instead.
Also set alignment to 64K since "PCIe Subsystem Address Translation" section in TRM indicates minimum ATU window size is 64K.
--- drivers/misc/pci_endpoint_test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/misc/pci_endpoint_test.c +17 -0
@@ -75,6 +75,11 @@#define PCI_ENDPOINT_TEST_IRQ_TYPE 0x24#define PCI_ENDPOINT_TEST_IRQ_NUMBER 0x28 +#define PCI_DEVICE_ID_TI_AM654 0xb00c + +#define is_am654_pci_dev (pdev) \ + ((pdev)->device == PCI_DEVICE_ID_TI_AM654) +static DEFINE_IDA (pci_endpoint_test_ida);#define to_endpoint_test (priv) container_of((priv), struct pci_endpoint_test, \
@@ -593,6 +598,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,int ret = -EINVAL ;enum pci_barno bar;struct pci_endpoint_test *test =to_endpoint_test (file->private_data); +struct pci_dev *pdev = test->pdev;mutex_lock (&test->mutex);switch (cmd) {
@@ -600,6 +606,8 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, bar = arg;if (bar <0 || bar >5 ) goto ret; +if (is_am654_pci_dev (pdev) && bar ==BAR_0 ) + goto ret; ret =pci_endpoint_test_bar (test, bar);break ;case PCITEST_LEGACY_IRQ :
@@ -792,11 +800,20 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)pci_disable_device (pdev); } +static const struct pci_endpoint_test_data am654_data = { + .test_reg_bar =BAR_2 , + .alignment =SZ_64K , + .irq_type =IRQ_TYPE_MSI , +}; +static const struct pci_device_id pci_endpoint_test_tbl[] = { {PCI_DEVICE (PCI_VENDOR_ID_TI , PCI_DEVICE_ID_TI_DRA74x) }, {PCI_DEVICE (PCI_VENDOR_ID_TI , PCI_DEVICE_ID_TI_DRA72x) }, {PCI_DEVICE (PCI_VENDOR_ID_FREESCALE ,0x81c0 ) }, {PCI_DEVICE (PCI_VENDOR_ID_SYNOPSYS ,0xedda ) }, + {PCI_DEVICE (PCI_VENDOR_ID_TI ,PCI_DEVICE_ID_TI_AM654 ), + .driver_data = (kernel_ulong_t)&am654_data + }, { } };MODULE_DEVICE_TABLE (pci, pci_endpoint_test_tbl);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 213/267 PCI: Add Synopsys endpoint EDDA Device ID
In reply to Greg Kroah-HartmanFrom: Gustavo Pimentel <[email protected]>
[ Upstream commit 1f418f46503d72594bbe6407d97fd2ae1ce15ee6 ]
Create and add Synopsys Endpoint EDDA Device ID to PCI ID list, since this ID is now being use on two different drivers (pci_endpoint_test.ko and dw-edma-pcie.ko).
--- drivers/misc/pci_endpoint_test.c | 2 +- include/linux/pci_ids.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/misc/pci_endpoint_test.c +1 -1
@@ -810,7 +810,7 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA74x) }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_DRA72x) }, { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, 0x81c0) }, - { PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, 0xedda) }, + { PCI_DEVICE_DATA(SYNOPSYS, EDDA, NULL) }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM654), .driver_data = (kernel_ulong_t)&am654_data },
include/linux/pci_ids.h +1 -0
@@ -2366,6 +2366,7 @@#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf +#define PCI_DEVICE_ID_SYNOPSYS_EDDA 0xedda#define PCI_VENDOR_ID_USR 0x16ec
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 214/267 PCI: Add NVIDIA GPU multi-function power dependencies
In reply to Greg Kroah-HartmanFrom: Abhishek Sahu <[email protected]>
[ Upstream commit 6d2e369f0d4c3e6125c886847c04106b03d2609e ]
The NVIDIA Turing GPU is a multi-function PCI device with the following functions:
- Function 0: VGA display controller
- Function 1: Audio controller
- Function 2: USB xHCI Host controller
- Function 3: USB Type-C UCSI controller
Function 0 is tightly coupled with other functions in the hardware. When function 0 is in D3, it gates power for hardware blocks used by other functions, which means those functions only work when function 0 is in D0. If any of these functions (1/2/3) are in D0, then function 0 should also be in D0.
Commit 07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller") already creates a device link to show the dependency of function 1 on function 0 of this GPU. Create additional device links to express the dependencies of functions 2 and 3 on function 0. This means function 0 will be in D0 if any other function is in D0.
[bhelgaas: I think the PCI spec expectation is that functions can be power-managed independently, so I don't think this device is technically compliant. For example, the PCIe r5.0 spec, sec 1.4, says "the PCI/PCIe hardware/software model includes architectural constructs necessary to discover, configure, and use a Function, without needing Function-specific knowledge" and sec 5.1 says "D states are associated with a particular Function" and "PM provides ... a mechanism to identify power management capabilities of a given Function [and] the ability to transition a Function into a certain power management state."]
--- drivers/pci/quirks.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/pci/quirks.c +26 -0
@@ -5094,6 +5094,32 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMD, PCI_ANY_ID,DECLARE_PCI_FIXUP_CLASS_FINAL (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID ,PCI_CLASS_MULTIMEDIA_HD_AUDIO ,8 , quirk_gpu_hda); +/* +* Create device link for NVIDIA GPU with integrated USB xHCI Host +* controller to VGA. +*/ +static void quirk_gpu_usb (struct pci_dev *usb) +{ +pci_create_device_link (usb,2 ,0 ,PCI_BASE_CLASS_DISPLAY ,16 ); +} +DECLARE_PCI_FIXUP_CLASS_FINAL (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID , +PCI_CLASS_SERIAL_USB ,8 , quirk_gpu_usb); + +/* +* Create device link for NVIDIA GPU with integrated Type-C UCSI controller +* to VGA. Currently there is no class code defined for UCSI device over PCI +* so using UNKNOWN class for now and it will be updated when UCSI +* over PCI gets a class code. +*/ +#define PCI_CLASS_SERIAL_UNKNOWN 0x0c80 +static void quirk_gpu_usb_typec_ucsi (struct pci_dev *ucsi) +{ +pci_create_device_link (ucsi,3 ,0 ,PCI_BASE_CLASS_DISPLAY ,16 ); +} +DECLARE_PCI_FIXUP_CLASS_FINAL (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID , +PCI_CLASS_SERIAL_UNKNOWN ,8 , + quirk_gpu_usb_typec_ucsi); +/* * Some IDT switches incorrectly flag an ACS Source Validation error on * completions for config read requests even though PCIe r4.0, sec
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 215/267 PCI: Enable NVIDIA HDA controllers
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
[ Upstream commit b516ea586d717472178e6ef1c152e85608b0ce32 ]
Many NVIDIA GPUs can be configured as either a single-function video device or a multi-function device with video at function 0 and an HDA audio controller at function 1. The HDA controller can be enabled or disabled by a bit in the function 0 config space.
Some BIOSes leave the HDA disabled, which means the HDMI connector from the NVIDIA GPU may not work. Sometimes the BIOS enables the HDA if an HDMI cable is connected at boot time, but that doesn't handle hotplug cases.
Enable the HDA controller on device enumeration and resume and re-read the header type, which tells us whether the GPU is a multi-function device.
This quirk is limited to NVIDIA PCI devices with the VGA Controller device class. This is expected to correspond to product configurations where the NVIDIA GPU has connectors attached. Other products where the device class is 3D Controller are expected to correspond to configurations where the NVIDIA GPU is dedicated (dGPU) and has no connectors. See original post (URL below) for more details.
This commit takes inspiration from an earlier patch by Daniel Drake.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75985
--- drivers/pci/quirks.c | 30 ++++++++++++++++++++++++++++++ include/linux/pci_ids.h | 1 + 2 files changed, 31 insertions(+)
drivers/pci/quirks.c +30 -0
@@ -5120,6 +5120,36 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,PCI_CLASS_SERIAL_UNKNOWN ,8 , quirk_gpu_usb_typec_ucsi); +/* +* Enable the NVIDIA GPU integrated HDA controller if the BIOS left it +* disabled. https://devtalk.nvidia.com/default/topic/1024022 +*/ +static void quirk_nvidia_hda (struct pci_dev *gpu) +{ +u8 hdr_type; +u32 val; + +/* There was no integrated HDA controller before MCP89 */ +if (gpu->device <PCI_DEVICE_ID_NVIDIA_GEFORCE_320M ) +return ; + +/* Bit 25 at offset 0x488 enables the HDA controller */ +pci_read_config_dword (gpu,0x488 , &val); +if (val &BIT (25 )) +return ; + +pci_info (gpu,"Enabling HDA controller\n" ); +pci_write_config_dword (gpu,0x488 , val |BIT (25 )); + +/* The GPU becomes a multi-function device when the HDA is enabled */ +pci_read_config_byte (gpu,PCI_HEADER_TYPE , &hdr_type); + gpu->multifunction = !!(hdr_type &0x80 ); +} +DECLARE_PCI_FIXUP_CLASS_HEADER (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID , +PCI_BASE_CLASS_DISPLAY ,16 , quirk_nvidia_hda); +DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID , +PCI_BASE_CLASS_DISPLAY ,16 , quirk_nvidia_hda); +/* * Some IDT switches incorrectly flag an ACS Source Validation error on * completions for config read requests even though PCIe r4.0, sec
include/linux/pci_ids.h +1 -0
@@ -1336,6 +1336,7 @@#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_320M 0x08A0#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 216/267 PCI: mediatek: Add controller support for MT7629
In reply to Greg Kroah-HartmanFrom: Jianjun Wang <[email protected]>
[ Upstream commit 0cccd42e6193e168cbecc271dae464e4a53fd7b3 ]
MT7629 is an ARM platform SoC which has the same PCIe IP as MT7622.
The HW default value of its PCI host controller Device ID is invalid, fix it to match the hardware implementation.
--- drivers/pci/controller/pcie-mediatek.c | 18 ++++++++++++++++++ include/linux/pci_ids.h | 1 + 2 files changed, 19 insertions(+)
drivers/pci/controller/pcie-mediatek.c +18 -0
@@ -72,6 +72,7 @@#define PCIE_MSI_VECTOR 0x0c0#define PCIE_CONF_VEND_ID 0x100 +#define PCIE_CONF_DEVICE_ID 0x102#define PCIE_CONF_CLASS_ID 0x106#define PCIE_INT_MASK 0x420
@@ -134,12 +135,16 @@ struct mtk_pcie_port;/** * struct mtk_pcie_soc - differentiate between host generations * @need_fix_class_id: whether this host's class ID needed to be fixed or not +* @need_fix_device_id: whether this host's device ID needed to be fixed or not +* @device_id: device ID which this host need to be fixed * @ops: pointer to configuration access functions * @startup: pointer to controller setting functions * @setup_irq: pointer to initialize IRQ functions */ struct mtk_pcie_soc {bool need_fix_class_id; +bool need_fix_device_id; +unsigned int device_id;struct pci_ops *ops;int (*startup)(struct mtk_pcie_port *port);int (*setup_irq)(struct mtk_pcie_port *port,struct device_node *node);
@@ -678,6 +683,9 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)writew (val, port->base +PCIE_CONF_CLASS_ID ); } +if (soc->need_fix_device_id) +writew (soc->device_id, port->base +PCIE_CONF_DEVICE_ID ); +/* 100ms timeout value should be enough for Gen1/2 training */ err = readl_poll_timeout(port->base + PCIE_LINK_STATUS_V2, val, !!(val & PCIE_PORT_LINKUP_V2), 20,
@@ -1213,11 +1221,21 @@ static const struct mtk_pcie_soc mtk_pcie_soc_mt7622 = { .setup_irq = mtk_pcie_setup_irq, }; +static const struct mtk_pcie_soc mtk_pcie_soc_mt7629 = { + .need_fix_class_id = true, + .need_fix_device_id = true, + .device_id =PCI_DEVICE_ID_MEDIATEK_7629 , + .ops = &mtk_pcie_ops_v2, + .startup = mtk_pcie_startup_port_v2, + .setup_irq = mtk_pcie_setup_irq, +}; +static const struct of_device_id mtk_pcie_ids[] = { { .compatible ="mediatek,mt2701-pcie" , .data = &mtk_pcie_soc_v1 }, { .compatible ="mediatek,mt7623-pcie" , .data = &mtk_pcie_soc_v1 }, { .compatible ="mediatek,mt2712-pcie" , .data = &mtk_pcie_soc_mt2712 }, { .compatible ="mediatek,mt7622-pcie" , .data = &mtk_pcie_soc_mt7622 }, + { .compatible ="mediatek,mt7629-pcie" , .data = &mtk_pcie_soc_mt7629 }, {}, };
include/linux/pci_ids.h +1 -0
@@ -2132,6 +2132,7 @@#define PCI_VENDOR_ID_MYRICOM 0x14c1#define PCI_VENDOR_ID_MEDIATEK 0x14c3 +#define PCI_DEVICE_ID_MEDIATEK_7629 0x7629#define PCI_VENDOR_ID_TITAN 0x14D2#define PCI_DEVICE_ID_TITAN_010L 0x8001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 217/267 x86/amd_nb: Add PCI device IDs for family 17h, model 70h
In reply to Greg Kroah-HartmanFrom: Marcel Bocu <[email protected]>
[ Upstream commit af4e1c5eca95bed1192d8dc45c8ed63aea2209e8 ]
The AMD Ryzen gen 3 processors came with a different PCI IDs for the function 3 & 4 which are used to access the SMN interface. The root PCI address however remained at the same address as the model 30h.
Adding the F3/F4 PCI IDs respectively to the misc and link ids appear to be sufficient for k10temp, so let's add them and follow up on the patch if other functions need more tweaking.
Vicki Pfau sent an identical patch after I checked that no-one had written this patch. I would have been happy about dropping my patch but unlike for his patch series, I had already Cc:ed the x86 people and they already reviewed the changes. Since Vicki has not answered to any email after his initial series, let's assume she is on vacation and let's avoid duplication of reviews from the maintainers and merge my series. To acknowledge Vicki's anteriority, I added her S-o-b to the patch.
v2, suggested by Guenter Roeck and Brian Woods:
- rename from 71h to 70h
--- arch/x86/kernel/amd_nb.c | 3 +++ include/linux/pci_ids.h | 1 + 2 files changed, 4 insertions(+)
arch/x86/kernel/amd_nb.c +3 -0
@@ -20,6 +20,7 @@#define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494 +#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F4 0x1444/* Protect the PCI config register pairs used for SMN and DF indirect access. */ static DEFINE_MUTEX (smn_mutex);
@@ -49,6 +50,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) }, {} };EXPORT_SYMBOL_GPL (amd_nb_misc_ids);
@@ -62,6 +64,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, {} };
include/linux/pci_ids.h +1 -0
@@ -548,6 +548,7 @@#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493 +#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 218/267 ALSA: lx6464es - add support for LX6464ESe pci express variant
In reply to Greg Kroah-HartmanFrom: Tim Blechmann <[email protected]>
[ Upstream commit 789492f0c86505e63369907bcb1afdf52dec9366 ]
The pci express variant of the digigram lx6464es card has a different device ID, but works without changes to the driver.
Thanks to Nikolas Slottke for reporting and testing.
--- include/linux/pci_ids.h | 2 ++ sound/pci/lx6464es/lx6464es.c | 8 ++++++++ 2 files changed, 10 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -1952,6 +1952,8 @@#define PCI_VENDOR_ID_DIGIGRAM 0x1369#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM 0xc001#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM 0xc002 +#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ESE_SERIAL_SUBSYSTEM 0xc021 +#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ESE_CAE_SERIAL_SUBSYSTEM 0xc022#define PCI_VENDOR_ID_KAWASAKI 0x136b#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01
sound/pci/lx6464es/lx6464es.c +8 -0
@@ -65,6 +65,14 @@ static const struct pci_device_id snd_lx6464es_ids[] = { PCI_VENDOR_ID_DIGIGRAM, PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM), }, /* LX6464ES-CAE */ + { PCI_DEVICE_SUB(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_LX6464ES, +PCI_VENDOR_ID_DIGIGRAM , +PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ESE_SERIAL_SUBSYSTEM ), + }, /* LX6464ESe */ + { PCI_DEVICE_SUB(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_LX6464ES, +PCI_VENDOR_ID_DIGIGRAM , + PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ESE_CAE_SERIAL_SUBSYSTEM), + }, /* LX6464ESe-CAE */ { 0, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 219/267 PCI: Add Genesys Logic, Inc. Vendor ID
In reply to Greg Kroah-HartmanFrom: Ben Chuang <[email protected]>
[ Upstream commit 4460d68f0b2f9092273531fbc65613e1855c2e07 ]
Add the Genesys Logic, Inc. vendor ID to pci_ids.h.
--- include/linux/pci_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -2409,6 +2409,8 @@#define PCI_DEVICE_ID_RDC_R6061 0x6061#define PCI_DEVICE_ID_RDC_D1010 0x1010 +#define PCI_VENDOR_ID_GLI 0x17a0 +#define PCI_VENDOR_ID_LENOVO 0x17aa#define PCI_VENDOR_ID_QCOM 0x17cb
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 220/267 PCI: Add Amazons Annapurna Labs vendor ID
In reply to Greg Kroah-HartmanFrom: Jonathan Chocron <[email protected]>
[ Upstream commit 4a36a60c34f42f75e8b4f8cd24fcfade26111334 ]
Add Amazon's Annapurna Labs vendor ID to pci_ids.h.
--- include/linux/pci_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -2576,6 +2576,8 @@#define PCI_VENDOR_ID_ASMEDIA 0x1b21 +#define PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS 0x1c36 +#define PCI_VENDOR_ID_CIRCUITCO 0x1cc8#define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 221/267 PCI: vmd: Add device id for VMD device 8086:9A0B
In reply to Greg Kroah-HartmanFrom: Jon Derrick <[email protected]>
[ Upstream commit ec11e5c213cc20cac5e8310728b06793448b9f6d ]
This patch adds support for this VMD device which supports the bus restriction mode.
--- drivers/pci/controller/vmd.c | 2 ++ include/linux/pci_ids.h | 1 + 2 files changed, 3 insertions(+)
drivers/pci/controller/vmd.c +2 -0
@@ -866,6 +866,8 @@ static const struct pci_device_id vmd_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_28C0), .driver_data =VMD_FEAT_HAS_MEMBAR_SHADOW | VMD_FEAT_HAS_BUS_RESTRICTIONS,}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_9A0B), + .driver_data = VMD_FEAT_HAS_BUS_RESTRICTIONS,}, {0,} };MODULE_DEVICE_TABLE (pci, vmd_ids);
include/linux/pci_ids.h +1 -0
@@ -3003,6 +3003,7 @@#define PCI_DEVICE_ID_INTEL_84460GX 0x84ea#define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 +#define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152#define PCI_VENDOR_ID_SCALEMP 0x8686
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 222/267 x86/amd_nb: Add Family 19h PCI IDs
In reply to Greg Kroah-HartmanFrom: Yazen Ghannam <[email protected]>
[ Upstream commit b3f79ae45904ae987a7c06a9e8d6084d7b73e67f ]
Add the new PCI Device 18h IDs for AMD Family 19h systems. Note that Family 19h systems will not have a new PCI root device ID.
--- arch/x86/kernel/amd_nb.c | 3 +++ include/linux/pci_ids.h | 1 + 2 files changed, 4 insertions(+)
arch/x86/kernel/amd_nb.c +3 -0
@@ -21,6 +21,7 @@#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F4 0x1444 +#define PCI_DEVICE_ID_AMD_19H_DF_F4 0x1654/* Protect the PCI config register pairs used for SMN and DF indirect access. */ static DEFINE_MUTEX (smn_mutex);
@@ -51,6 +52,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F3) }, {} };EXPORT_SYMBOL_GPL (amd_nb_misc_ids);
@@ -65,6 +67,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, {} };
include/linux/pci_ids.h +1 -0
@@ -549,6 +549,7 @@#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443 +#define PCI_DEVICE_ID_AMD_19H_DF_F3 0x1653#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 223/267 PCI: Add Loongson vendor ID
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 9acb9fe18d863aacc99948963f8d5d447dc311be ]
Add the Loongson vendor ID to pci_ids.h to be used by the controller driver in the future.
The Loongson vendor ID can be found at the following link:
https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids
--- include/linux/pci_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -148,6 +148,8 @@/* Vendors and devices. Sort key: vendor first, device next. */ +#define PCI_VENDOR_ID_LOONGSON 0x0014 +#define PCI_VENDOR_ID_TTTECH 0x0357#define PCI_DEVICE_ID_TTTECH_MC322 0x000a
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 224/267 serial: 8250_pci: Move Pericom IDs to pci_ids.h
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 62a7f3009a460001eb46984395280dd900bc4ef4 ]
Move the IDs to pci_ids.h so it can be used by next patch.
--- drivers/tty/serial/8250/8250_pci.c | 6 ------ include/linux/pci_ids.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_pci.c +0 -6
@@ -1690,12 +1690,6 @@ pci_wch_ch38x_setup(struct serial_private *priv,#define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470#define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253 -#define PCI_VENDOR_ID_PERICOM 0x12D8 -#define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951 -#define PCI_DEVICE_ID_PERICOM_PI7C9X7952 0x7952 -#define PCI_DEVICE_ID_PERICOM_PI7C9X7954 0x7954 -#define PCI_DEVICE_ID_PERICOM_PI7C9X7958 0x7958 -#define PCI_VENDOR_ID_ACCESIO 0x494f#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB 0x1051#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S 0x1053
include/linux/pci_ids.h +6 -0
@@ -1833,6 +1833,12 @@#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 +#define PCI_VENDOR_ID_PERICOM 0x12D8 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7952 0x7952 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7954 0x7954 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7958 0x7958 +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 225/267 PCI: Make ACS quirk implementations more uniform
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit c8de8ed2dcaac82e5d76d467dc0b02e0ee79809b ]
The ACS quirks differ in needless ways, which makes them look more different than they really are.
Reorder the ACS flags in order of definitions in the spec:
PCI_ACS_SV Source Validation PCI_ACS_TB Translation Blocking PCI_ACS_RR P2P Request Redirect PCI_ACS_CR P2P Completion Redirect PCI_ACS_UF Upstream Forwarding PCI_ACS_EC P2P Egress Control PCI_ACS_DT Direct Translated P2P
(PCIe r5.0, sec 7.7.8.2) and use similar code structure in all. No functional change intended.
--- drivers/pci/quirks.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-)
drivers/pci/quirks.c +19 -22
@@ -4333,18 +4333,18 @@ static bool pci_quirk_cavium_acs_match(struct pci_dev *dev)static int pci_quirk_cavium_acs (struct pci_dev *dev,u16 acs_flags) { +if (!pci_quirk_cavium_acs_match (dev)) +return -ENOTTY ; +/* -* Cavium root ports don't advertise an ACS capability. However, +* Cavium Root Ports don't advertise an ACS capability. However, * the RTL internally implements similar protection as if ACS had -* Request Redirection, Completion Redirection, Source Validation, +* Source Validation, Request Redirection, Completion Redirection, * and Upstream Forwarding features enabled. Assert that the * hardware implements and enables equivalent ACS functionality for * these flags. */ - acs_flags &= ~(PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_SV |PCI_ACS_UF ); - -if (!pci_quirk_cavium_acs_match (dev)) -return -ENOTTY ; + acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF );return acs_flags ?0 :1 ; }
@@ -4362,7 +4362,7 @@ static int pci_quirk_xgene_acs(struct pci_dev *dev, u16 acs_flags) }/* -* Many Intel PCH root ports do provide ACS-like features to disable peer +* Many Intel PCH Root Ports do provide ACS-like features to disable peer * transactions and validate bus numbers in requests, but do not provide an * actual PCIe ACS capability. This is the list of device IDs known to fall * into that category as provided by Intel in Red Hat bugzilla 1037684.
@@ -4410,37 +4410,34 @@ static bool pci_quirk_intel_pch_acs_match(struct pci_dev *dev)return false; } -#define INTEL_PCH_ACS_FLAGS (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_SV) +#define INTEL_PCH_ACS_FLAGS (PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)static int pci_quirk_intel_pch_acs (struct pci_dev *dev,u16 acs_flags) { -u16 flags = dev->dev_flags &PCI_DEV_FLAGS_ACS_ENABLED_QUIRK ? -INTEL_PCH_ACS_FLAGS :0 ; -if (!pci_quirk_intel_pch_acs_match (dev))return -ENOTTY ; -return acs_flags & ~flags ?0 :1 ; +if (dev->dev_flags &PCI_DEV_FLAGS_ACS_ENABLED_QUIRK ) + acs_flags &= ~(INTEL_PCH_ACS_FLAGS ); + +return acs_flags ?0 :1 ; }/* -* These QCOM root ports do provide ACS-like features to disable peer +* These QCOM Root Ports do provide ACS-like features to disable peer * transactions and validate bus numbers in requests, but do not provide an * actual PCIe ACS capability. Hardware supports source validation but it * will report the issue as Completer Abort instead of ACS Violation. -* Hardware doesn't support peer-to-peer and each root port is a root -* complex with unique segment numbers. It is not possible for one root -* port to pass traffic to another root port. All PCIe transactions are -* terminated inside the root port. +* Hardware doesn't support peer-to-peer and each Root Port is a Root +* Complex with unique segment numbers. It is not possible for one Root +* Port to pass traffic to another Root Port. All PCIe transactions are +* terminated inside the Root Port. */ static int pci_quirk_qcom_rp_acs (struct pci_dev *dev,u16 acs_flags) { -u16 flags = (PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF |PCI_ACS_SV ); -int ret = acs_flags & ~flags ?0 :1 ; - -pci_info (dev,"Using QCOM ACS Quirk (%d)\n" , ret); + acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); -return ret; +return acs_flags ?0 :1 ; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 226/267 PCI: Unify ACS quirk desired vs provided checking
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 7cf2cba43f15c74bac46dc5f0326805d25ef514d ]
Most of the ACS quirks have a similar pattern of:
acs_flags &= ~( <controls provided by this device> ); return acs_flags ? 0 : 1;
Pull this out into a helper function to simplify the quirks slightly. The helper function is also a convenient place for comments about what the list of ACS controls means. No functional change intended.
--- drivers/pci/quirks.c | 67 +++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 22 deletions(-)
drivers/pci/quirks.c +45 -22
@@ -4263,6 +4263,24 @@ static void quirk_chelsio_T5_disable_root_port_attributes(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_CHELSIO ,PCI_ANY_ID , quirk_chelsio_T5_disable_root_port_attributes); +/* +* pci_acs_ctrl_enabled - compare desired ACS controls with those provided +* by a device +* @acs_ctrl_req: Bitmask of desired ACS controls +* @acs_ctrl_ena: Bitmask of ACS controls enabled or provided implicitly by +* the hardware design +* +* Return 1 if all ACS controls in the @acs_ctrl_req bitmask are included +* in @acs_ctrl_ena, i.e., the device provides all the access controls the +* caller desires. Return 0 otherwise. +*/ +static int pci_acs_ctrl_enabled (u16 acs_ctrl_req,u16 acs_ctrl_ena) +{ +if ((acs_ctrl_req & acs_ctrl_ena) == acs_ctrl_req) +return 1 ; +return 0 ; +} +/* * AMD has indicated that the devices below do not support peer-to-peer * in any system where they are found in the southbridge with an AMD
@@ -4306,7 +4324,7 @@ static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags)/* Filter out flags not applicable to multifunction */ acs_flags &= (PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_EC |PCI_ACS_DT ); -return acs_flags & ~(PCI_ACS_RR |PCI_ACS_CR ) ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags,PCI_ACS_RR |PCI_ACS_CR );#else return -ENODEV ;#endif
@@ -4344,9 +4362,8 @@ static int pci_quirk_cavium_acs(struct pci_dev *dev, u16 acs_flags)* hardware implements and enables equivalent ACS functionality for * these flags. */ - acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); - -return acs_flags ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); }static int pci_quirk_xgene_acs (struct pci_dev *dev,u16 acs_flags)
@@ -4356,9 +4373,8 @@ static int pci_quirk_xgene_acs(struct pci_dev *dev, u16 acs_flags)* transactions with others, allowing masking out these bits as if they * were unimplemented in the ACS capability. */ - acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); - -return acs_flags ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); }/*
@@ -4410,17 +4426,16 @@ static bool pci_quirk_intel_pch_acs_match(struct pci_dev *dev)return false; } -#define INTEL_PCH_ACS_FLAGS (PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF) -static int pci_quirk_intel_pch_acs (struct pci_dev *dev,u16 acs_flags) {if (!pci_quirk_intel_pch_acs_match (dev))return -ENOTTY ;if (dev->dev_flags &PCI_DEV_FLAGS_ACS_ENABLED_QUIRK ) - acs_flags &= ~(INTEL_PCH_ACS_FLAGS ); +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); -return acs_flags ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags,0 ); }/*
@@ -4435,9 +4450,8 @@ static int pci_quirk_intel_pch_acs(struct pci_dev *dev, u16 acs_flags)*/ static int pci_quirk_qcom_rp_acs (struct pci_dev *dev,u16 acs_flags) { - acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); - -return acs_flags ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); }/*
@@ -4520,7 +4534,7 @@ static int pci_quirk_intel_spt_pch_acs(struct pci_dev *dev, u16 acs_flags)pci_read_config_dword (dev, pos +INTEL_SPT_ACS_CTRL , &ctrl); -return acs_flags & ~ctrl ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags, ctrl); }static int pci_quirk_mf_endpoint_acs (struct pci_dev *dev,u16 acs_flags)
@@ -4534,10 +4548,9 @@ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags)* perform peer-to-peer with other functions, allowing us to mask out * these bits as if they were unimplemented in the ACS capability. */ - acs_flags &= ~(PCI_ACS_SV |PCI_ACS_TB |PCI_ACS_RR | -PCI_ACS_CR |PCI_ACS_UF |PCI_ACS_DT ); - -return acs_flags ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_TB |PCI_ACS_RR | +PCI_ACS_CR |PCI_ACS_UF |PCI_ACS_DT ); }static int pci_quirk_rciep_acs (struct pci_dev *dev,u16 acs_flags)
@@ -4562,9 +4575,8 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags)* Allow each Root Port to be in a separate IOMMU group by masking * SV/RR/CR/UF bits. */ - acs_flags &= ~(PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); - -return acs_flags ?0 :1 ; +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); } static const struct pci_dev_acs_enabled {
@@ -4663,6 +4675,17 @@ static const struct pci_dev_acs_enabled { { 0 } }; +/* +* pci_dev_specific_acs_enabled - check whether device provides ACS controls +* @dev: PCI device +* @acs_flags: Bitmask of desired ACS controls +* +* Returns: +* -ENOTTY: No quirk applies to this device; we can't tell whether the +* device provides the desired controls +* 0: Device does not provide all the desired controls +* >0: Device provides all the controls in @acs_flags +*/ int pci_dev_specific_acs_enabled (struct pci_dev *dev,u16 acs_flags) {const struct pci_dev_acs_enabled *i;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 227/267 PCI: Generalize multi-function power dependency device links
In reply to Greg Kroah-HartmanFrom: Abhishek Sahu <[email protected]>
[ Upstream commit a17beb1a0882a544523dcb5d0da4801272dfd43a ]
Although not allowed by the PCI specs, some multi-function devices have power dependencies between the functions. For example, function 1 may not work unless function 0 is in the D0 power state.
The existing quirk_gpu_hda() adds a device link to express this dependency for GPU and HDA devices, but it really is not specific to those device types.
Generalize it and rename it to pci_create_device_link() so we can create dependencies between any "consumer" and "producer" functions of a multi-function device, where the consumer is only functional if the producer is in D0. This reorganization should not affect any functionality.
--- drivers/pci/quirks.c | 54 ++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 20 deletions(-)
drivers/pci/quirks.c +34 -20
@@ -5077,35 +5077,49 @@ static void quirk_fsl_no_msi(struct pci_dev *pdev)DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_FREESCALE ,PCI_ANY_ID , quirk_fsl_no_msi);/* -* GPUs with integrated HDA controller for streaming audio to attached displays -* need a device link from the HDA controller (consumer) to the GPU (supplier) -* so that the GPU is powered up whenever the HDA controller is accessed. -* The GPU and HDA controller are functions 0 and 1 of the same PCI device. -* The device link stays in place until shutdown (or removal of the PCI device -* if it's hotplugged). Runtime PM is allowed by default on the HDA controller -* to prevent it from permanently keeping the GPU awake. +* Although not allowed by the spec, some multi-function devices have +* dependencies of one function (consumer) on another (supplier). For the +* consumer to work in D0, the supplier must also be in D0. Create a +* device link from the consumer to the supplier to enforce this +* dependency. Runtime PM is allowed by default on the consumer to prevent +* it from permanently keeping the supplier awake. */ -static void quirk_gpu_hda (struct pci_dev *hda) +static void pci_create_device_link (struct pci_dev *pdev,unsigned int consumer, +unsigned int supplier,unsigned int class, +unsigned int class_shift) { -struct pci_dev *gpu; +struct pci_dev *supplier_pdev; -if (PCI_FUNC (hda->devfn) !=1 ) +if (PCI_FUNC (pdev->devfn) != consumer)return ; - gpu =pci_get_domain_bus_and_slot (pci_domain_nr (hda->bus), - hda->bus->number, -PCI_DEVFN (PCI_SLOT (hda->devfn),0 )); -if (!gpu || (gpu->class >>16 ) !=PCI_BASE_CLASS_DISPLAY ) { -pci_dev_put (gpu); + supplier_pdev =pci_get_domain_bus_and_slot (pci_domain_nr (pdev->bus), + pdev->bus->number, +PCI_DEVFN (PCI_SLOT (pdev->devfn), supplier)); +if (!supplier_pdev || (supplier_pdev->class >> class_shift) != class) { +pci_dev_put (supplier_pdev);return ; } -if (!device_link_add (&hda->dev, &gpu->dev, -DL_FLAG_STATELESS |DL_FLAG_PM_RUNTIME )) -pci_err (hda,"cannot link HDA to GPU %s\n" ,pci_name (gpu)); +if (device_link_add (&pdev->dev, &supplier_pdev->dev, +DL_FLAG_STATELESS |DL_FLAG_PM_RUNTIME )) +pci_info (pdev,"D0 power state depends on %s\n" , +pci_name (supplier_pdev)); +else +pci_err (pdev,"Cannot enforce power dependency on %s\n" , +pci_name (supplier_pdev)); + +pm_runtime_allow (&pdev->dev); +pci_dev_put (supplier_pdev); +} -pm_runtime_allow (&hda->dev); -pci_dev_put (gpu); +/* +* Create device link for GPUs with integrated HDA controller for streaming +* audio to attached displays. +*/ +static void quirk_gpu_hda (struct pci_dev *hda) +{ +pci_create_device_link (hda,1 ,0 ,PCI_BASE_CLASS_DISPLAY ,16 ); }DECLARE_PCI_FIXUP_CLASS_FINAL (PCI_VENDOR_ID_ATI ,PCI_ANY_ID ,PCI_CLASS_MULTIMEDIA_HD_AUDIO ,8 , quirk_gpu_hda);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 228/267 btrfs: fix error handling when submitting direct I/O bio
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 6d3113a193e3385c72240096fe397618ecab6e43 ]
In btrfs_submit_direct_hook(), if a direct I/O write doesn't span a RAID stripe or chunk, we submit orig_bio without cloning it. In this case, we don't increment pending_bios. Then, if btrfs_submit_dio_bio() fails, we decrement pending_bios to -1, and we never complete orig_bio. Fix it by initializing pending_bios to 1 instead of incrementing later.
Fixing this exposes another bug: we put orig_bio prematurely and then put it again from end_io. Fix it by not putting orig_bio.
After this change, pending_bios is really more of a reference count, but I'll leave that cleanup separate to keep the fix small.
--- fs/btrfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/inode.c +3 -3
@@ -8399,7 +8399,6 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip)/* bio split */ ASSERT (map_length <=INT_MAX ); -atomic_inc (&dip->pending_bios); do { clone_len = min_t(int, submit_len, map_length);
@@ -8450,7 +8449,8 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip)if (!status)return 0 ; -bio_put (bio); +if (bio != orig_bio) +bio_put (bio); out_err: dip->errors =1 ;/*
@@ -8491,7 +8491,7 @@ static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, bio->bi_private = dip; dip->orig_bio = bio; dip->dio_bio = dio_bio; -atomic_set (&dip->pending_bios,0 ); +atomic_set (&dip->pending_bios,1 ); io_bio =btrfs_io_bio (bio); io_bio->logical = file_offset;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 229/267 btrfs: fix wrong file range cleanup after an error filling dealloc range
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
[ Upstream commit e2c8e92d1140754073ad3799eb6620c76bab2078 ]
If an error happens while running dellaloc in COW mode for a range, we can end up calling extent_clear_unlock_delalloc() for a range that goes beyond our range's end offset by 1 byte, which affects 1 extra page. This results in clearing bits and doing page operations (such as a page unlock) outside our target range.
Fix that by calling extent_clear_unlock_delalloc() with an inclusive end offset, instead of an exclusive end offset, at cow_file_range().
--- fs/btrfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +2 -2
@@ -1136,8 +1136,8 @@ static noinline int cow_file_range(struct inode *inode,*/ if (extent_reserved) {extent_clear_unlock_delalloc (inode, start, - start + cur_alloc_size, - start + cur_alloc_size, + start + cur_alloc_size -1 , + start + cur_alloc_size -1 , locked_page, clear_bits, page_ops);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 230/267 ima: Call ima_calc_boot_aggregate() in ima_eventdigest_init()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
[ Upstream commit 6cc7c266e5b47d3cd2b5bb7fd3aac4e6bb2dd1d2 ]
If the template field 'd' is chosen and the digest to be added to the measurement entry was not calculated with SHA1 or MD5, it is recalculated with SHA1, by using the passed file descriptor. However, this cannot be done for boot_aggregate, because there is no file descriptor.
This patch adds a call to ima_calc_boot_aggregate() in ima_eventdigest_init(), so that the digest can be recalculated also for the boot_aggregate entry.
--- security/integrity/ima/ima.h | 3 ++- security/integrity/ima/ima_crypto.c | 6 +++--- security/integrity/ima/ima_init.c | 2 +- security/integrity/ima/ima_template_lib.c | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-)
security/integrity/ima/ima.h +2 -1
@@ -56,6 +56,7 @@ extern int ima_policy_flag;extern int ima_hash_algo;extern int ima_appraise;extern struct tpm_chip *ima_tpm_chip; +extern const char boot_aggregate_name[];/* IMA event related data */ struct ima_event_data {
@@ -139,7 +140,7 @@ int ima_calc_buffer_hash(const void *buf, loff_t len,int ima_calc_field_array_hash (struct ima_field_data *field_data,struct ima_template_desc *desc,int num_fields,struct ima_digest_data *hash); -int __init ima_calc_boot_aggregate (struct ima_digest_data *hash); +int ima_calc_boot_aggregate (struct ima_digest_data *hash);void ima_add_violation (struct file *file,const unsigned char *filename,struct integrity_iint_cache *iint,const char *op,const char *cause);
security/integrity/ima/ima_crypto.c +3 -3
@@ -663,8 +663,8 @@ static void __init ima_pcrread(int idx, u8 *pcr)/* * Calculate the boot aggregate hash */ -static int __init ima_calc_boot_aggregate_tfm (char *digest, -struct crypto_shash *tfm) +static int ima_calc_boot_aggregate_tfm (char *digest, +struct crypto_shash *tfm) {u8 pcr_i[TPM_DIGEST_SIZE ];int rc, i;
@@ -688,7 +688,7 @@ static int __init ima_calc_boot_aggregate_tfm(char *digest,return rc; } -int __init ima_calc_boot_aggregate (struct ima_digest_data *hash) +int ima_calc_boot_aggregate (struct ima_digest_data *hash) {struct crypto_shash *tfm;int rc;
security/integrity/ima/ima_init.c +1 -1
@@ -25,7 +25,7 @@#include "ima.h" /* name for boot aggregate entry */ -static const char *boot_aggregate_name ="boot_aggregate" ; +const char boot_aggregate_name[] ="boot_aggregate" ;struct tpm_chip *ima_tpm_chip;/* Add the boot aggregate to the IMA measurement list and extend
security/integrity/ima/ima_template_lib.c +18 -0
@@ -284,6 +284,24 @@ int ima_eventdigest_init(struct ima_event_data *event_data, goto out; } +if ((const char *)event_data->filename == boot_aggregate_name) { +if (ima_tpm_chip) { + hash.hdr.algo =HASH_ALGO_SHA1 ; + result =ima_calc_boot_aggregate (&hash.hdr); + +/* algo can change depending on available PCR banks */ +if (!result && hash.hdr.algo !=HASH_ALGO_SHA1 ) + result = -EINVAL ; + +if (result <0 ) +memset (&hash,0 ,sizeof (hash)); + } + + cur_digest = hash.hdr.digest; + cur_digestsize = hash_digest_size[HASH_ALGO_SHA1 ]; + goto out; + } +if (!event_data->file)/* missing info to re-calculate the digest */ return -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 231/267 PCI: Program MPS for RCiEP devices
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
commit aa0ce96d72dd2e1b0dfd0fb868f82876e7790878 upstream.
Root Complex Integrated Endpoints (RCiEPs) do not have an upstream bridge, so pci_configure_mps() previously ignored them, which may result in reduced performance.
Instead, program the Max_Payload_Size of RCiEPs to the maximum supported value (unless it is limited for the PCIE_BUS_PEER2PEER case). This also affects the subsequent programming of Max_Read_Request_Size because Linux programs MRRS based on the MPS value.
--- drivers/pci/probe.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/pci/probe.c +21 -1
@@ -1748,13 +1748,33 @@ static void pci_configure_mps(struct pcistruct pci_dev *bridge =pci_upstream_bridge (dev);int mps, mpss, p_mps, rc; -if (!pci_is_pcie (dev) || !bridge || !pci_is_pcie (bridge)) +if (!pci_is_pcie (dev))return ;/* MPS and MRRS fields are of type 'RsvdP' for VFs, short-circuit out */ if (dev->is_virtfn)return ; +/* +* For Root Complex Integrated Endpoints, program the maximum +* supported value unless limited by the PCIE_BUS_PEER2PEER case. +*/ +if (pci_pcie_type (dev) ==PCI_EXP_TYPE_RC_END ) { +if (pcie_bus_config ==PCIE_BUS_PEER2PEER ) + mps =128 ; +else + mps =128 << dev->pcie_mpss; + rc =pcie_set_mps (dev, mps); +if (rc) { +pci_warn (dev,"can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n" , + mps); + } +return ; + } + +if (!bridge || !pci_is_pcie (bridge)) +return ; + mps =pcie_get_mps (dev); p_mps =pcie_get_mps (bridge);
Greg Kroah-Hartman
maintainerPATCH 232/267 e1000e: Disable TSO for buffer overrun workaround
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit f29801030ac67bf98b7a65d3aea67b30769d4f7c upstream.
Commit b10effb92e27 ("e1000e: fix buffer overrun while the I219 is processing DMA transactions") imposes roughly 30% performance penalty.
The commit log states that "Disabling TSO eliminates performance loss for TCP traffic without a noticeable impact on CPU performance", so let's disable TSO by default to regain the loss.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +4 -0
@@ -5251,6 +5251,10 @@ static void e1000_watchdog_task(struct w/* oops */ break ; } +if (hw->mac.type == e1000_pch_spt) { + netdev->features &= ~NETIF_F_TSO ; + netdev->features &= ~NETIF_F_TSO6 ; + } }/* enable transmits in the hardware, need to do this
Greg Kroah-Hartman
maintainerPATCH 233/267 e1000e: Relax condition to trigger reset for ME workaround
In reply to Greg Kroah-HartmanFrom: Punit Agrawal <[email protected]>
commit d601afcae2febc49665008e9a79e701248d56c50 upstream.
It's an error if the value of the RX/TX tail descriptor does not match what was written. The error condition is true regardless the duration of the interference from ME. But the driver only performs the reset if E1000_ICH_FWSM_PCIM2PCI_COUNT (2000) iterations of 50us delay have transpired. The extra condition can lead to inconsistency between the state of hardware as expected by the driver.
Fix this by dropping the check for number of delay iterations.
While at it, also make __ew32_prepare() static as it's not used anywhere else.
--- drivers/net/ethernet/intel/e1000e/e1000.h | 1 - drivers/net/ethernet/intel/e1000e/netdev.c | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/e1000e/e1000.h +0 -1
@@ -574,7 +574,6 @@ static inline u32 __er32(struct e1000_hw#define er32 (reg) __er32(hw, E1000_##reg) -s32 __ew32_prepare (struct e1000_hw *hw);void __ew32 (struct e1000_hw *hw,unsigned long reg,u32 val);#define ew32 (reg, val) __ew32(hw, E1000_##reg, (val))
drivers/net/ethernet/intel/e1000e/netdev.c +5 -7
@@ -119,14 +119,12 @@ static const struct e1000_reg_info e1000* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set * and try again a number of times. **/ -s32 __ew32_prepare (struct e1000_hw *hw) +static void __ew32_prepare (struct e1000_hw *hw) {s32 i =E1000_ICH_FWSM_PCIM2PCI_COUNT ;while ((er32 (FWSM ) &E1000_ICH_FWSM_PCIM2PCI ) && --i)udelay (50 ); - -return i; }void __ew32 (struct e1000_hw *hw,unsigned long reg,u32 val)
@@ -607,11 +605,11 @@ static void e1000e_update_rdt_wa(struct {struct e1000_adapter *adapter = rx_ring->adapter;struct e1000_hw *hw = &adapter->hw; -s32 ret_val =__ew32_prepare (hw); +__ew32_prepare (hw);writel (i, rx_ring->tail); -if (unlikely (!ret_val && (i !=readl (rx_ring->tail)))) { +if (unlikely (i !=readl (rx_ring->tail))) {u32 rctl =er32 (RCTL );ew32 (RCTL , rctl & ~E1000_RCTL_EN );
@@ -624,11 +622,11 @@ static void e1000e_update_tdt_wa(struct {struct e1000_adapter *adapter = tx_ring->adapter;struct e1000_hw *hw = &adapter->hw; -s32 ret_val =__ew32_prepare (hw); +__ew32_prepare (hw);writel (i, tx_ring->tail); -if (unlikely (!ret_val && (i !=readl (tx_ring->tail)))) { +if (unlikely (i !=readl (tx_ring->tail))) {u32 tctl =er32 (TCTL );ew32 (TCTL , tctl & ~E1000_TCTL_EN );
Greg Kroah-Hartman
maintainerPATCH 234/267 carl9170: remove P2P_GO support
In reply to Greg Kroah-HartmanFrom: Christian Lamparter <[email protected]>
commit b14fba7ebd04082f7767a11daea7f12f3593de22 upstream.
This patch follows up on a bug-report by Frank Schäfer that discovered P2P GO wasn't working with wpa_supplicant. This patch removes part of the broken P2P GO support but keeps the vif switchover code in place.
--- drivers/net/wireless/ath/carl9170/fw.c | 4 +--- drivers/net/wireless/ath/carl9170/main.c | 21 ++++----------------- 2 files changed, 5 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/carl9170/fw.c +1 -3
@@ -351,9 +351,7 @@ static int carl9170_fw(struct ar9170 *ar ar->hw->wiphy->interface_modes |=BIT (NL80211_IFTYPE_ADHOC );if (SUPP (CARL9170FW_WLANTX_CAB )) { - if_comb_types |= -BIT (NL80211_IFTYPE_AP ) | -BIT (NL80211_IFTYPE_P2P_GO ); + if_comb_types |=BIT (NL80211_IFTYPE_AP );#ifdef CONFIG_MAC80211_MESH if_comb_types |=
drivers/net/wireless/ath/carl9170/main.c +4 -17
@@ -582,11 +582,10 @@ static int carl9170_init_interface(struc ar->disable_offload |= ((vif->type !=NL80211_IFTYPE_STATION ) && (vif->type !=NL80211_IFTYPE_AP )); -/* While the driver supports HW offload in a single -* P2P client configuration, it doesn't support HW -* offload in the favourit, concurrent P2P GO+CLIENT -* configuration. Hence, HW offload will always be -* disabled for P2P. +/* The driver used to have P2P GO+CLIENT support, +* but since this was dropped and we don't know if +* there are any gremlins lurking in the shadows, +* so best we keep HW offload disabled for P2P. */ ar->disable_offload |= vif->p2p;
@@ -639,18 +638,6 @@ static int carl9170_op_add_interface(strif (vif->type ==NL80211_IFTYPE_STATION )break ; -/* P2P GO [master] use-case -* Because the P2P GO station is selected dynamically -* by all participating peers of a WIFI Direct network, -* the driver has be able to change the main interface -* operating mode on the fly. -*/ -if (main_vif->p2p && vif->p2p && - vif->type ==NL80211_IFTYPE_AP ) { - old_main = main_vif; -break ; - } - err = -EBUSY ;rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 235/267 media: go7007: fix a miss of snd_card_free
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
commit 9453264ef58638ce8976121ac44c07a3ef375983 upstream.
go7007_snd_init() misses a snd_card_free() in an error path. Add the missed call to fix it.
[Salvatore Bonaccorso: Adjust context for backport to versions which do not contain c0decac19da3 ("media: use strscpy() instead of strlcpy()") and ba78170ef153 ("media: go7007: Fix misuse of strscpy")]
--- drivers/media/usb/go7007/snd-go7007.c | 35 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
drivers/media/usb/go7007/snd-go7007.c +17 -18
@@ -244,22 +244,18 @@ int go7007_snd_init(struct go7007 *go) gosnd->capturing =0 ; ret =snd_card_new (go->dev, index[dev], id[dev],THIS_MODULE ,0 , &gosnd->card); -if (ret <0 ) { -kfree (gosnd); -return ret; - } +if (ret <0 ) + goto free_snd; + ret =snd_device_new (gosnd->card,SNDRV_DEV_LOWLEVEL , go, &go7007_snd_device_ops); -if (ret <0 ) { -kfree (gosnd); -return ret; - } +if (ret <0 ) + goto free_card; + ret =snd_pcm_new (gosnd->card,"go7007" ,0 ,0 ,1 , &gosnd->pcm); -if (ret <0 ) { -snd_card_free (gosnd->card); -kfree (gosnd); -return ret; - } +if (ret <0 ) + goto free_card; +strlcpy (gosnd->card->driver,"go7007" ,sizeof (gosnd->card->driver));strlcpy (gosnd->card->shortname, go->name,sizeof (gosnd->card->driver)); strlcpy(gosnd->card->longname, gosnd->card->shortname,
@@ -270,11 +266,8 @@ int go7007_snd_init(struct go7007 *go) &go7007_snd_capture_ops); ret =snd_card_register (gosnd->card); -if (ret <0 ) { -snd_card_free (gosnd->card); -kfree (gosnd); -return ret; - } +if (ret <0 ) + goto free_card; gosnd->substream =NULL ; go->snd_context = gosnd;
@@ -282,6 +275,12 @@ int go7007_snd_init(struct go7007 *go) ++dev;return 0 ; + +free_card: +snd_card_free (gosnd->card); +free_snd: +kfree (gosnd); +return ret; }EXPORT_SYMBOL (go7007_snd_init);
Greg Kroah-Hartman
maintainerPATCH 236/267 Bluetooth: hci_bcm: fix freeing not-requested IRQ
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit 81bd5d0c62437c02caac6b3f942fcda874063cb0 upstream.
When BT module can't be initialized, but it has an IRQ, unloading the driver WARNs when trying to free not-yet-requested IRQ. Fix it by noting whether the IRQ was requested.
WARNING: CPU: 2 PID: 214 at kernel/irq/devres.c:144 devm_free_irq+0x49/0x4ca [...] WARNING: CPU: 2 PID: 214 at kernel/irq/manage.c:1746 __free_irq+0x8b/0x27c Trying to free already-free IRQ 264 Modules linked in: hci_uart(-) btbcm bluetooth ecdh_generic ecc libaes CPU: 2 PID: 214 Comm: rmmod Tainted: G W 5.6.1mq-00044-ga5f9ea098318-dirty #928
[...]
[<b016aefb>] (devm_free_irq) from [<af8ba1ff>] (bcm_close+0x97/0x118 [hci_uart]) [<af8ba1ff>] (bcm_close [hci_uart]) from [<af8b736f>] (hci_uart_unregister_device+0x33/0x3c [hci_uart]) [<af8b736f>] (hci_uart_unregister_device [hci_uart]) from [<b035930b>] (serdev_drv_remove+0x13/0x20) [<b035930b>] (serdev_drv_remove) from [<b037093b>] (device_release_driver_internal+0x97/0x118) [<b037093b>] (device_release_driver_internal) from [<b0370a0b>] (driver_detach+0x2f/0x58) [<b0370a0b>] (driver_detach) from [<b036f855>] (bus_remove_driver+0x41/0x94) [<b036f855>] (bus_remove_driver) from [<af8ba8db>] (bcm_deinit+0x1b/0x740 [hci_uart]) [<af8ba8db>] (bcm_deinit [hci_uart]) from [<af8ba86f>] (hci_uart_exit+0x13/0x30 [hci_uart]) [<af8ba86f>] (hci_uart_exit [hci_uart]) from [<b01900bd>] (sys_delete_module+0x109/0x1d0) [<b01900bd>] (sys_delete_module) from [<b0101001>] (ret_fast_syscall+0x1/0x5a)
[...]
--- drivers/bluetooth/hci_bcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_bcm.c +4 -1
@@ -115,6 +115,7 @@ struct bcm_device {u32 oper_speed;int irq;bool irq_active_low; +bool irq_acquired;#ifdef CONFIG_PM struct hci_uart *hu;
@@ -288,6 +289,8 @@ static int bcm_request_irq(struct bcm_da goto unlock; } + bdev->irq_acquired = true; +device_init_wakeup (bdev->dev, true); pm_runtime_set_autosuspend_delay(bdev->dev,
@@ -456,7 +459,7 @@ static int bcm_close(struct hci_uart *hu }if (bdev) { -if (IS_ENABLED (CONFIG_PM ) && bdev->irq >0 ) { +if (IS_ENABLED (CONFIG_PM ) && bdev->irq_acquired) {devm_free_irq (bdev->dev, bdev->irq, bdev);device_init_wakeup (bdev->dev, false);pm_runtime_disable (bdev->dev);
Greg Kroah-Hartman
maintainerPATCH 237/267 b43legacy: Fix case where channel status is corrupted
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
commit ec4d3e3a054578de34cd0b587ab8a1ac36f629d9 upstream.
This patch fixes commit 75388acd0cd8 ("add mac80211-based driver for legacy BCM43xx devices")
In https://bugzilla.kernel.org/show_bug.cgi?id=207093, a defect in b43legacy is reported. Upon testing, thus problem exists on PPC and X86 platforms, is present in the oldest kernel tested (3.2), and has been present in the driver since it was first added to the kernel.
The problem is a corrupted channel status received from the device. Both the internal card in a PowerBook G4 and the PCMCIA version (Broadcom BCM4306 with PCI ID 14e4:4320) have the problem. Only Rev, 2 (revision 4 of the 802.11 core) of the chip has been tested. No other devices using b43legacy are available for testing.
Various sources of the problem were considered. Buffer overrun and other sources of corruption within the driver were rejected because the faulty channel status is always the same, not a random value. It was concluded that the faulty data is coming from the device, probably due to a firmware bug. As that source is not available, the driver must take appropriate action to recover.
At present, the driver reports the error, and them continues to process the bad packet. This is believed that to be a mistake, and the correct action is to drop the correpted packet.
Reported-and-tested by: F. Erhard <[email protected]>
--- drivers/net/wireless/broadcom/b43legacy/xmit.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/b43legacy/xmit.c +1 -0
@@ -571,6 +571,7 @@ void b43legacy_rx(struct b43legacy_wldevdefault :b43legacywarn (dev->wl,"Unexpected value for chanstat (0x%X)\n" , chanstat); + goto drop; }memcpy (IEEE80211_SKB_RXCB (skb), &status,sizeof (status));
Greg Kroah-Hartman
maintainerPATCH 238/267 b43: Fix connection problem with WPA3
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
commit 75d057bda1fbca6ade21378aa45db712e5f7d962 upstream.
Since the driver was first introduced into the kernel, it has only handled the ciphers associated with WEP, WPA, and WPA2. It fails with WPA3 even though mac80211 can handle those additional ciphers in software, b43 did not report that it could handle them. By setting MFP_CAPABLE using ieee80211_set_hw(), the problem is fixed.
With this change, b43 will handle the ciphers it knows in hardware, and let mac80211 handle the others in software. It is not necessary to use the module parameter NOHWCRYPT to turn hardware encryption off. Although this change essentially eliminates that module parameter, I am choosing to keep it for cases where the hardware is broken, and software encryption is required for all ciphers.
--- drivers/net/wireless/broadcom/b43/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/main.c +1 -1
@@ -5596,7 +5596,7 @@ static struct b43_wl *b43_wireless_init(/* fill hw info */ ieee80211_hw_set (hw,RX_INCLUDES_FCS );ieee80211_hw_set (hw,SIGNAL_DBM ); - +ieee80211_hw_set (hw,MFP_CAPABLE ); hw->wiphy->interface_modes =BIT (NL80211_IFTYPE_AP ) | BIT(NL80211_IFTYPE_MESH_POINT) |
Greg Kroah-Hartman
maintainerPATCH 239/267 b43_legacy: Fix connection problem with WPA3
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
commit 6a29d134c04a8acebb7a95251acea7ad7abba106 upstream.
Since the driver was first introduced into the kernel, it has only handled the ciphers associated with WEP, WPA, and WPA2. It fails with WPA3 even though mac80211 can handle those additional ciphers in software, b43legacy did not report that it could handle them. By setting MFP_CAPABLE using ieee80211_set_hw(), the problem is fixed.
With this change, b43legacy will handle the ciphers it knows in hardware, and let mac80211 handle the others in software. It is not necessary to use the module parameter NOHWCRYPT to turn hardware encryption off. Although this change essentially eliminates that module parameter, I am choosing to keep it for cases where the hardware is broken, and software encryption is required for all ciphers.
--- drivers/net/wireless/broadcom/b43legacy/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/b43legacy/main.c +1 -0
@@ -3835,6 +3835,7 @@ static int b43legacy_wireless_init(struc/* fill hw info */ ieee80211_hw_set (hw,RX_INCLUDES_FCS );ieee80211_hw_set (hw,SIGNAL_DBM ); +ieee80211_hw_set (hw,MFP_CAPABLE );/* Allow WPA3 in software */ hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_AP) |
Greg Kroah-Hartman
maintainerPATCH 240/267 media: ov5640: fix use of destroyed mutex
In reply to Greg Kroah-HartmanFrom: Tomi Valkeinen <[email protected]>
commit bfcba38d95a0aed146a958a84a2177af1459eddc upstream.
v4l2_ctrl_handler_free() uses hdl->lock, which in ov5640 driver is set to sensor's own sensor->lock. In ov5640_remove(), the driver destroys the sensor->lock first, and then calls v4l2_ctrl_handler_free(), resulting in the use of the destroyed mutex.
Fix this by calling moving the mutex_destroy() to the end of the cleanup sequence, as there's no need to destroy the mutex as early as possible.
--- drivers/media/i2c/ov5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +2 -2
@@ -2829,8 +2829,8 @@ static int ov5640_probe(struct i2c_clien free_ctrls:v4l2_ctrl_handler_free (&sensor->ctrls.handler); entity_cleanup: -mutex_destroy (&sensor->lock);media_entity_cleanup (&sensor->sd.entity); +mutex_destroy (&sensor->lock);return ret; }
@@ -2840,9 +2840,9 @@ static int ov5640_remove(struct i2c_cliestruct ov5640_dev *sensor =to_ov5640_dev (sd);v4l2_async_unregister_subdev (&sensor->sd); -mutex_destroy (&sensor->lock);media_entity_cleanup (&sensor->sd.entity);v4l2_ctrl_handler_free (&sensor->ctrls.handler); +mutex_destroy (&sensor->lock);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 241/267 igb: Report speed and duplex as unknown when device is runtime suspended
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit 165ae7a8feb53dc47fb041357e4b253bfc927cf9 upstream.
igb device gets runtime suspended when there's no link partner. We can't get correct speed under that state:
$ cat /sys/class/net/enp3s0/speed 1000
In addition to that, an error can also be spotted in dmesg:
[ 385.991957] igb 0000:03:00.0 enp3s0: PCIe link lost
Since device can only be runtime suspended when there's no link partner, we can skip reading register and let the following logic set speed and duplex with correct status.
The more generic approach will be wrap get_link_ksettings() with begin() and complete() callbacks. However, for this particular issue, begin() calls igb_runtime_resume() , which tries to rtnl_lock() while the lock is already hold by upper ethtool layer.
So let's take this approach until the igb_runtime_resume() no longer needs to hold rtnl_lock.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +2 -1
@@ -143,7 +143,8 @@ static int igb_get_link_ksettings(structu32 speed;u32 supported, advertising; - status =rd32 (E1000_STATUS ); + status =pm_runtime_suspended (&adapter->pdev->dev) ? +0 :rd32 (E1000_STATUS );if (hw->phy.media_type == e1000_media_type_copper) { supported = (SUPPORTED_10baseT_Half |
Greg Kroah-Hartman
maintainerPATCH 242/267 power: vexpress: add suppress_bind_attrs to true
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
commit 73174acc9c75960af2daa7dcbdb9781fc0d135cb upstream.
Make sure that the POWER_RESET_VEXPRESS driver won't have bind/unbind attributes available via the sysfs, so lets be explicit here and use ".suppress_bind_attrs = true" to prevent userspace from doing something silly.
--- drivers/power/reset/vexpress-poweroff.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/reset/vexpress-poweroff.c +1 -0
@@ -150,6 +150,7 @@ static struct platform_driver vexpress_r .driver = { .name = "vexpress-reset", .of_match_table = vexpress_reset_of_match, + .suppress_bind_attrs = true, }, };
Greg Kroah-Hartman
maintainerPATCH 243/267 pinctrl: samsung: Correct setting of eint wakeup mask on s5pv210
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
commit b577a279914085c6b657c33e9f39ef56d96a3302 upstream.
Commit a8be2af0218c ("pinctrl: samsung: Write external wakeup interrupt mask") started writing the eint wakeup mask from the pinctrl driver. Unfortunately, it made the assumption that the private retention data was always a regmap while in the case of s5pv210 it is a raw pointer to the clock base (as the eint wakeup mask not in the PMU as with newer Exynos platforms).
--- drivers/pinctrl/samsung/pinctrl-exynos.c | 73 ++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 24 deletions(-)
drivers/pinctrl/samsung/pinctrl-exynos.c +49 -24
@@ -40,6 +40,8 @@ struct exynos_irq_chip {u32 eint_pend;u32 eint_wake_mask_value;u32 eint_wake_mask_reg; +void (*set_eint_wakeup_mask)(struct samsung_pinctrl_drv_data *drvdata, +struct exynos_irq_chip *irq_chip); };static inline struct exynos_irq_chip *to_exynos_irq_chip (struct irq_chip *chip)
@@ -350,6 +352,47 @@ static int exynos_wkup_irq_set_wake(strureturn 0 ; } +static void +exynos_pinctrl_set_eint_wakeup_mask (struct samsung_pinctrl_drv_data *drvdata, +struct exynos_irq_chip *irq_chip) +{ +struct regmap *pmu_regs; + +if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { +dev_warn (drvdata->dev, +"No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n" ); +return ; + } + + pmu_regs = drvdata->retention_ctrl->priv; +dev_info (drvdata->dev, +"Setting external wakeup interrupt mask: 0x%x\n" , + irq_chip->eint_wake_mask_value); + +regmap_write (pmu_regs, irq_chip->eint_wake_mask_reg, + irq_chip->eint_wake_mask_value); +} + +static void +s5pv210_pinctrl_set_eint_wakeup_mask (struct samsung_pinctrl_drv_data *drvdata, +struct exynos_irq_chip *irq_chip) + +{ +void __iomem *clk_base; + +if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { +dev_warn (drvdata->dev, +"No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n" ); +return ; + } + + + clk_base = (void __iomem *) drvdata->retention_ctrl->priv; + +__raw_writel (irq_chip->eint_wake_mask_value, + clk_base + irq_chip->eint_wake_mask_reg); +} +/* * irq_chip for wakeup interrupts */
@@ -368,8 +411,9 @@ static const struct exynos_irq_chip s5pv .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, .eint_pend = EXYNOS_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, - /* Only difference with exynos4210_wkup_irq_chip: */ + /* Only differences with exynos4210_wkup_irq_chip: */ .eint_wake_mask_reg = S5PV210_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = s5pv210_pinctrl_set_eint_wakeup_mask, };static const struct exynos_irq_chip exynos4210_wkup_irq_chip__initconst = {
@@ -388,6 +432,7 @@ static const struct exynos_irq_chip exyn .eint_pend = EXYNOS_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, .eint_wake_mask_reg = EXYNOS_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = exynos_pinctrl_set_eint_wakeup_mask, };static const struct exynos_irq_chip exynos7_wkup_irq_chip__initconst = {
@@ -406,6 +451,7 @@ static const struct exynos_irq_chip exyn .eint_pend = EXYNOS7_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, .eint_wake_mask_reg = EXYNOS5433_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = exynos_pinctrl_set_eint_wakeup_mask, };/* list of external wakeup controllers supported */
@@ -582,27 +628,6 @@ int exynos_eint_wkup_init(struct samsungreturn 0 ; } -static void -exynos_pinctrl_set_eint_wakeup_mask (struct samsung_pinctrl_drv_data *drvdata, -struct exynos_irq_chip *irq_chip) -{ -struct regmap *pmu_regs; - -if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { -dev_warn (drvdata->dev, -"No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n" ); -return ; - } - - pmu_regs = drvdata->retention_ctrl->priv; -dev_info (drvdata->dev, -"Setting external wakeup interrupt mask: 0x%x\n" , - irq_chip->eint_wake_mask_value); - -regmap_write (pmu_regs, irq_chip->eint_wake_mask_reg, - irq_chip->eint_wake_mask_value); -} -static void exynos_pinctrl_suspend_bank (struct samsung_pinctrl_drv_data *drvdata,struct samsung_pin_bank *bank)
@@ -634,8 +659,8 @@ void exynos_pinctrl_suspend(struct samsuelse if (bank->eint_type ==EINT_TYPE_WKUP ) {if (!irq_chip) { irq_chip = bank->irq_chip; -exynos_pinctrl_set_eint_wakeup_mask (drvdata, - irq_chip); + irq_chip->set_eint_wakeup_mask (drvdata, + irq_chip); }else if (bank->irq_chip != irq_chip) { dev_warn(drvdata->dev, "More than one external wakeup interrupt chip configured (bank: %s). This is not supported by hardware nor by driver.\n",
Greg Kroah-Hartman
maintainerPATCH 244/267 pinctrl: samsung: Save/restore eint_mask over suspend for EINT_TYPE GPIOs
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
commit f354157a7d184db430c1a564c506434e33b1bec5 upstream.
Currently, for EINT_TYPE GPIOs, the CON and FLTCON registers are saved and restored over a suspend/resume cycle. However, the EINT_MASK registers are not.
On S5PV210 at the very least, these registers are not retained over suspend, leading to the interrupts remaining masked upon resume and therefore no interrupts being triggered for the device. There should be no effect on any SoCs that do retain these registers as theoretically we would just be re-writing what was already there.
--- drivers/pinctrl/samsung/pinctrl-exynos.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/pinctrl/samsung/pinctrl-exynos.c +9 -0
@@ -267,6 +267,7 @@ struct exynos_eint_gpio_save {u32 eint_con;u32 eint_fltcon0;u32 eint_fltcon1; +u32 eint_mask; };/*
@@ -641,10 +642,13 @@ static void exynos_pinctrl_suspend_bank( + 2 * bank->eint_offset); save->eint_fltcon1 =readl (regs +EXYNOS_GPIO_EFLTCON_OFFSET +2 * bank->eint_offset +4 ); + save->eint_mask =readl (regs + bank->irq_chip->eint_mask + + bank->eint_offset);pr_debug ("%s: save con %#010x\n" , bank->name, save->eint_con);pr_debug ("%s: save fltcon0 %#010x\n" , bank->name, save->eint_fltcon0);pr_debug ("%s: save fltcon1 %#010x\n" , bank->name, save->eint_fltcon1); +pr_debug ("%s: save mask %#010x\n" , bank->name, save->eint_mask); }void exynos_pinctrl_suspend (struct samsung_pinctrl_drv_data *drvdata)
@@ -686,6 +690,9 @@ static void exynos_pinctrl_resume_bank(pr_debug ("%s: fltcon1 %#010x => %#010x\n" , bank->name,readl (regs +EXYNOS_GPIO_EFLTCON_OFFSET +2 * bank->eint_offset +4 ), save->eint_fltcon1); +pr_debug ("%s: mask %#010x => %#010x\n" , bank->name, +readl (regs + bank->irq_chip->eint_mask + + bank->eint_offset), save->eint_mask);writel (save->eint_con, regs +EXYNOS_GPIO_ECON_OFFSET + bank->eint_offset);
@@ -693,6 +700,8 @@ static void exynos_pinctrl_resume_bank( + 2 * bank->eint_offset);writel (save->eint_fltcon1, regs +EXYNOS_GPIO_EFLTCON_OFFSET +2 * bank->eint_offset +4 ); +writel (save->eint_mask, regs + bank->irq_chip->eint_mask + + bank->eint_offset); }void exynos_pinctrl_resume (struct samsung_pinctrl_drv_data *drvdata)
Greg Kroah-Hartman
maintainerPATCH 245/267 gnss: sirf: fix error return code in sirf_probe()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
commit 43d7ce70ae43dd8523754b17f567417e0e75dbce upstream.
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
This avoids a use-after-free in case the driver is later unbound.
--- drivers/gnss/sirf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gnss/sirf.c +6 -2
@@ -292,14 +292,18 @@ static int sirf_probe(struct serdev_devi data->on_off =devm_gpiod_get_optional (dev,"sirf,onoff" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->on_off)) +if (IS_ERR (data->on_off)) { + ret =PTR_ERR (data->on_off); goto err_put_device; + }if (data->on_off) { data->wakeup =devm_gpiod_get_optional (dev,"sirf,wakeup" ,GPIOD_IN ); -if (IS_ERR (data->wakeup)) +if (IS_ERR (data->wakeup)) { + ret =PTR_ERR (data->wakeup); goto err_put_device; + }/* * Configurations where WAKEUP has been left not connected,
Greg Kroah-Hartman
maintainerPATCH 246/267 sparc32: fix register window handling in genregs32_[gs]et()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit cf51e129b96847f969bfb8af1ee1516a01a70b39 upstream.
It needs access_process_vm() if the traced process does not share mm with the caller. Solution is similar to what sparc64 does. Note that genregs32_set() is only ever called with pos being 0 or 32 * sizeof(u32) (the latter - as part of PTRACE_SETREGS handling).
--- arch/sparc/kernel/ptrace_32.c | 230 ++++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 131 deletions(-)
arch/sparc/kernel/ptrace_32.c +99 -131
@@ -46,82 +46,79 @@ enum sparc_regset { REGSET_FP, }; +static int regwindow32_get (struct task_struct *target, +const struct pt_regs *regs, +u32 *uregs) +{ +unsigned long reg_window = regs->u_regs[UREG_I6 ]; +int size =16 *sizeof (u32); + +if (target == current) { +if (copy_from_user (uregs, (void __user *)reg_window, size)) +return -EFAULT ; + }else { +if (access_process_vm (target, reg_window, uregs, size, +FOLL_FORCE ) != size) +return -EFAULT ; + } +return 0 ; +} + +static int regwindow32_set (struct task_struct *target, +const struct pt_regs *regs, +u32 *uregs) +{ +unsigned long reg_window = regs->u_regs[UREG_I6 ]; +int size =16 *sizeof (u32); + +if (target == current) { +if (copy_to_user ((void __user *)reg_window, uregs, size)) +return -EFAULT ; + }else { +if (access_process_vm (target, reg_window, uregs, size, +FOLL_FORCE |FOLL_WRITE ) != size) +return -EFAULT ; + } +return 0 ; +} +static int genregs32_get (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,void *kbuf,void __user *ubuf) {const struct pt_regs *regs = target->thread.kregs; -unsigned long __user *reg_window; -unsigned long *k = kbuf; -unsigned long __user *u = ubuf; -unsigned long reg; +u32 uregs[16 ]; +int ret;if (target == current)flush_user_windows (); - pos /=sizeof (reg); - count /=sizeof (reg); + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, + regs->u_regs, +0 ,16 *sizeof (u32)); +if (ret || !count) +return ret; -if (kbuf) { -for (; count >0 && pos <16 ; count--) - *k++ = regs->u_regs[pos++]; - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (get_user (*k++, ®_window[pos++])) -return -EFAULT ; - } - }else { -for (; count >0 && pos <16 ; count--) { -if (put_user (regs->u_regs[pos++], u++)) -return -EFAULT ; - } - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (get_user (reg, ®_window[pos++]) || -put_user (reg, u++)) -return -EFAULT ; - } - } -while (count >0 ) { -switch (pos) { -case 32 :/* PSR */ - reg = regs->psr; -break ; -case 33 :/* PC */ - reg = regs->pc; -break ; -case 34 :/* NPC */ - reg = regs->npc; -break ; -case 35 :/* Y */ - reg = regs->y; -break ; -case 36 :/* WIM */ -case 37 :/* TBR */ - reg =0 ; -break ; -default : - goto finish; - } - -if (kbuf) - *k++ = reg; -else if (put_user (reg, u++)) +if (pos <32 *sizeof (u32)) { +if (regwindow32_get (target, regs, uregs))return -EFAULT ; - pos++; - count--; + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, + uregs, +16 *sizeof (u32),32 *sizeof (u32)); +if (ret || !count) +return ret; } -finish: - pos *=sizeof (reg); - count *=sizeof (reg); -return user_regset_copyout_zero (&pos, &count, &kbuf, &ubuf, -38 *sizeof (reg),-1 ); + uregs[0 ] = regs->psr; + uregs[1 ] = regs->pc; + uregs[2 ] = regs->npc; + uregs[3 ] = regs->y; + uregs[4 ] =0 ;/* WIM */ + uregs[5 ] =0 ;/* TBR */ +return user_regset_copyout (&pos, &count, &kbuf, &ubuf, + uregs, +32 *sizeof (u32),38 *sizeof (u32)); } static int genregs32_set(struct task_struct *target,
@@ -130,82 +127,53 @@ static int genregs32_set(struct task_str const void *kbuf, const void __user *ubuf) { struct pt_regs *regs = target->thread.kregs; -unsigned long __user *reg_window; -const unsigned long *k = kbuf; -const unsigned long __user *u = ubuf; -unsigned long reg; +u32 uregs[16 ]; +u32 psr; +int ret;if (target == current)flush_user_windows (); - pos /=sizeof (reg); - count /=sizeof (reg); - -if (kbuf) { -for (; count >0 && pos <16 ; count--) - regs->u_regs[pos++] = *k++; - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (put_user (*k++, ®_window[pos++])) -return -EFAULT ; - } - }else { -for (; count >0 && pos <16 ; count--) { -if (get_user (reg, u++)) -return -EFAULT ; - regs->u_regs[pos++] = reg; - } - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (get_user (reg, u++) || -put_user (reg, ®_window[pos++])) -return -EFAULT ; - } - } -while (count >0 ) { -unsigned long psr; - -if (kbuf) - reg = *k++; -else if (get_user (reg, u++)) -return -EFAULT ; - -switch (pos) { -case 32 :/* PSR */ - psr = regs->psr; - psr &= ~(PSR_ICC |PSR_SYSCALL ); - psr |= (reg & (PSR_ICC |PSR_SYSCALL )); - regs->psr = psr; -break ; -case 33 :/* PC */ - regs->pc = reg; -break ; -case 34 :/* NPC */ - regs->npc = reg; -break ; -case 35 :/* Y */ - regs->y = reg; -break ; -case 36 :/* WIM */ -case 37 :/* TBR */ -break ; -default : - goto finish; - } + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + regs->u_regs, +0 ,16 *sizeof (u32)); +if (ret || !count) +return ret; - pos++; - count--; +if (pos <32 *sizeof (u32)) { +if (regwindow32_get (target, regs, uregs)) +return -EFAULT ; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + uregs, +16 *sizeof (u32),32 *sizeof (u32)); +if (ret) +return ret; +if (regwindow32_set (target, regs, uregs)) +return -EFAULT ; +if (!count) +return 0 ; } -finish: - pos *=sizeof (reg); - count *=sizeof (reg); - + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + &psr, +32 *sizeof (u32),33 *sizeof (u32)); +if (ret) +return ret; + regs->psr = (regs->psr & ~(PSR_ICC |PSR_SYSCALL )) | + (psr & (PSR_ICC |PSR_SYSCALL )); +if (!count) +return 0 ; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + ®s->pc, +33 *sizeof (u32),34 *sizeof (u32)); +if (ret || !count) +return ret; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + ®s->y, +34 *sizeof (u32),35 *sizeof (u32)); +if (ret || !count) +return ret;return user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf, -38 *sizeof (reg),-1 ); +35 *sizeof (u32),38 *sizeof (u32)); } static int fpregs32_get(struct task_struct *target,
Greg Kroah-Hartman
maintainerPATCH 247/267 sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 142cd25293f6a7ecbdff4fb0af17de6438d46433 upstream.
We do need access_process_vm() to access the target's reg_window. However, access to caller's memory (storing the result in genregs32_get(), fetching the new values in case of genregs32_set()) should be done by normal uaccess primitives.
--- arch/sparc/kernel/ptrace_64.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
arch/sparc/kernel/ptrace_64.c +3 -14
@@ -571,19 +571,13 @@ static int genregs32_get(struct task_strfor (; count >0 && pos <32 ; count--) {if (access_process_vm (target, (unsigned long ) - ®_window[pos], + ®_window[pos++], ®,sizeof (reg),FOLL_FORCE ) !=sizeof (reg))return -EFAULT ; -if (access_process_vm (target, - (unsigned long ) u, - ®,sizeof (reg), -FOLL_FORCE |FOLL_WRITE ) - !=sizeof (reg)) +if (put_user (reg, u++))return -EFAULT ; - pos++; - u++; } } }
@@ -683,12 +677,7 @@ static int genregs32_set(struct task_str } }else {for (; count >0 && pos <32 ; count--) { -if (access_process_vm (target, - (unsigned long ) - u, - ®,sizeof (reg), -FOLL_FORCE ) - !=sizeof (reg)) +if (get_user (reg, u++))return -EFAULT ; if (access_process_vm(target, (unsigned long)
Greg Kroah-Hartman
maintainerPATCH 248/267 dm crypt: avoid truncating the logical block size
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 64611a15ca9da91ff532982429c44686f4593b5f upstream.
queue_limits::logical_block_size got changed from unsigned short to unsigned int, but it was forgotten to update crypt_io_hints() to use the new type. Fix it.
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -3078,7 +3078,7 @@ static void crypt_io_hints(struct dm_tar limits->max_segment_size =PAGE_SIZE ; limits->logical_block_size = - max_t(unsigned short, limits->logical_block_size, cc->sector_size); +max_t (unsigned, limits->logical_block_size, cc->sector_size); limits->physical_block_size =max_t (unsigned, limits->physical_block_size, cc->sector_size); limits->io_min =max_t (unsigned, limits->io_min, cc->sector_size);
Greg Kroah-Hartman
maintainerPATCH 249/267 alpha: fix memory barriers so that they conform to the specification
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 54505a1e2083fc54cbe8779b97479f969cd30a00 upstream.
The commits cd0e00c10672 and 92d7223a7423 broke boot on the Alpha Avanti platform. The patches move memory barriers after a write before the write. The result is that if there's iowrite followed by ioread, there is no barrier between them.
The Alpha architecture allows reordering of the accesses to the I/O space, and the missing barrier between write and read causes hang with serial port and real time clock.
This patch makes barriers confiorm to the specification.
1. We add mb() before readX_relaxed and writeX_relaxed - memory-barriers.txt claims that these functions must be ordered w.r.t. each other. Alpha doesn't order them, so we need an explicit barrier.
2. We add mb() before reads from the I/O space - so that if there's a write followed by a read, there should be a barrier between them.
--- arch/alpha/include/asm/io.h | 74 +++++++++++++++++++++++++++++++++++--------- arch/alpha/kernel/io.c | 60 +++++++++++++++++++++++++++++++---- 2 files changed, 112 insertions(+), 22 deletions(-)
arch/alpha/include/asm/io.h +59 -15
@@ -327,14 +327,18 @@ static inline int __is_mmio(const volati#if IO_CONCAT (__IO_PREFIX,trivial_io_bw)extern inline unsigned int ioread8 (void __iomem *addr) { -unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr); +unsigned int ret; +mb (); + ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; }extern inline unsigned int ioread16 (void __iomem *addr) { -unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr); +unsigned int ret; +mb (); + ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; }
@@ -375,7 +379,9 @@ extern inline void outw(u16 b, unsigned#if IO_CONCAT (__IO_PREFIX,trivial_io_lq)extern inline unsigned int ioread32 (void __iomem *addr) { -unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr); +unsigned int ret; +mb (); + ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();return ret; }
@@ -420,14 +426,18 @@ extern inline void __raw_writew(u16 b, vextern inline u8 readb (const volatile void __iomem *addr) { -u8 ret =__raw_readb (addr); +u8 ret; +mb (); + ret =__raw_readb (addr);mb ();return ret; }extern inline u16 readw (const volatile void __iomem *addr) { -u16 ret =__raw_readw (addr); +u16 ret; +mb (); + ret =__raw_readw (addr);mb ();return ret; }
@@ -468,14 +478,18 @@ extern inline void __raw_writeq(u64 b, vextern inline u32 readl (const volatile void __iomem *addr) { -u32 ret =__raw_readl (addr); +u32 ret; +mb (); + ret =__raw_readl (addr);mb ();return ret; }extern inline u64 readq (const volatile void __iomem *addr) { -u64 ret =__raw_readq (addr); +u64 ret; +mb (); + ret =__raw_readq (addr);mb ();return ret; }
@@ -504,14 +518,44 @@ extern inline void writeq(u64 b, volatil#define outb_p outb#define outw_p outw#define outl_p outl -#define readb_relaxed (addr) __raw_readb(addr) -#define readw_relaxed (addr) __raw_readw(addr) -#define readl_relaxed (addr) __raw_readl(addr) -#define readq_relaxed (addr) __raw_readq(addr) -#define writeb_relaxed (b, addr) __raw_writeb(b, addr) -#define writew_relaxed (b, addr) __raw_writew(b, addr) -#define writel_relaxed (b, addr) __raw_writel(b, addr) -#define writeq_relaxed (b, addr) __raw_writeq(b, addr) + +extern u8 readb_relaxed (const volatile void __iomem *addr); +extern u16 readw_relaxed (const volatile void __iomem *addr); +extern u32 readl_relaxed (const volatile void __iomem *addr); +extern u64 readq_relaxed (const volatile void __iomem *addr); + +#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) +extern inline u8 readb_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readb (addr); +} + +extern inline u16 readw_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readw (addr); +} +#endif + +#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) +extern inline u32 readl_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readl (addr); +} + +extern inline u64 readq_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readq (addr); +} +#endif + +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel +#define writeq_relaxed writeq#define mmiowb ()
arch/alpha/kernel/io.c +53 -7
108 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 250/267 kernel/cpu_pm: Fix uninitted local in cpu_pm
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
commit b5945214b76a1f22929481724ffd448000ede914 upstream.
cpu_pm_notify() is basically a wrapper of notifier_call_chain(). notifier_call_chain() doesn't initialize *nr_calls to 0 before it starts incrementing it--presumably it's up to the callers to do this.
Unfortunately the callers of cpu_pm_notify() don't init *nr_calls. This potentially means you could get too many or two few calls to CPU_PM_ENTER_FAILED or CPU_CLUSTER_PM_ENTER_FAILED depending on the luck of the stack.
Let's fix this.
--- kernel/cpu_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/cpu_pm.c +2 -2
@@ -89,7 +89,7 @@ EXPORT_SYMBOL_GPL(cpu_pm_unregister_noti*/ int cpu_pm_enter (void ) { -int nr_calls; +int nr_calls =0 ;int ret =0 ; ret =cpu_pm_notify (CPU_PM_ENTER ,-1 , &nr_calls);
@@ -140,7 +140,7 @@ EXPORT_SYMBOL_GPL(cpu_pm_exit);*/ int cpu_cluster_pm_enter (void ) { -int nr_calls; +int nr_calls =0 ;int ret =0 ; ret =cpu_pm_notify (CPU_CLUSTER_PM_ENTER ,-1 , &nr_calls);
Greg Kroah-Hartman
maintainerPATCH 251/267 ARM: tegra: Correct PL310 Auxiliary Control Register initialization
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit 35509737c8f958944e059d501255a0bf18361ba0 upstream.
The PL310 Auxiliary Control Register shouldn't have the "Full line of zero" optimization bit being set before L2 cache is enabled. The L2X0 driver takes care of enabling the optimization by itself.
This patch fixes a noisy error message on Tegra20 and Tegra30 telling that cache optimization is erroneously enabled without enabling it for the CPU:
L2C-310: enabling full line of zeros but not enabled in Cortex-A9
--- arch/arm/mach-tegra/tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/tegra.c +2 -2
@@ -112,8 +112,8 @@ static const char * const tegra_dt_board };DT_MACHINE_START (TEGRA_DT ,"NVIDIA Tegra SoC (Flattened Device Tree)" ) - .l2c_aux_val = 0x3c400001, - .l2c_aux_mask = 0xc20fc3fe, + .l2c_aux_val = 0x3c400000, + .l2c_aux_mask = 0xc20fc3ff, .smp = smp_ops(tegra_smp_ops), .map_io = tegra_map_common_io, .init_early = tegra_init_early,
Greg Kroah-Hartman
maintainerPATCH 252/267 ARM: dts: exynos: Fix GPIO polarity for thr GalaxyS3 CM36651 sensors bus
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
commit 8807d356bfea92b0a8f04ce421800ed83400cd22 upstream.
GPIO lines for the CM36651 sensor I2C bus use the normal not the inverted polarity. This bug has been there since adding the CM36651 sensor by commit 85cb4e0bd229 ("ARM: dts: add cm36651 light/proximity sensor node for exynos4412-trats2"), but went unnoticed because the "i2c-gpio" driver ignored the GPIO polarity specified in the device-tree.
The recent conversion of "i2c-gpio" driver to the new, descriptor based GPIO API, automatically made it the DT-specified polarity aware, what broke the CM36651 sensor operation.
--- arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi +1 -1
@@ -50,7 +50,7 @@ i2c_cm36651: i2c-gpio-2 { compatible = "i2c-gpio"; - gpios = <&gpf0 0 GPIO_ACTIVE_LOW>, <&gpf0 1 GPIO_ACTIVE_LOW>; + gpios = <&gpf0 0 GPIO_ACTIVE_HIGH>, <&gpf0 1 GPIO_ACTIVE_HIGH>; i2c-gpio,delay-us = <2>; #address-cells = <1>; #size-cells = <0>;
Greg Kroah-Hartman
maintainerPATCH 253/267 ARM: dts: at91: sama5d2_ptc_ek: fix vbus pin
In reply to Greg Kroah-HartmanFrom: Ludovic Desroches <[email protected]>
commit baa998aecb75c04d62be0a4ab6b724af6d73a0f9 upstream.
The gpio property for the vbus pin doesn't match the pinctrl and is not correct.
--- arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +1 -1
@@ -40,7 +40,7 @@ ahb { usb0: gadget@300000 { - atmel,vbus-gpio = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>; + atmel,vbus-gpio = <&pioA PIN_PB11 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usba_vbus>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 254/267 ARM: dts: s5pv210: Set keep-power-in-suspend for SDHCI1 on Aries
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
commit 869d42e6eba821905e1a0950623aadafe1a6e6d3 upstream.
SDHCI1 is connected to a BCM4329 WiFi/BT chip which requires power to be kept over suspend. As the surrounding hardware supports this, mark it as such. This fixes WiFi after a suspend/resume cycle.
--- arch/arm/boot/dts/s5pv210-aries.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/s5pv210-aries.dtsi +1 -0
@@ -374,6 +374,7 @@ pinctrl-names = "default"; cap-sd-highspeed; cap-mmc-highspeed; + keep-power-in-suspend; mmc-pwrseq = <&wifi_pwrseq>; non-removable;
Greg Kroah-Hartman
maintainerPATCH 255/267 drivers/macintosh: Fix memleak in windfarm_pm112 driver
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 93900337b9ac2f4eca427eff6d187be2dc3b5551 upstream.
create_cpu_loop() calls smu_sat_get_sdb_partition() which does kmalloc() and returns the allocated buffer. In fact it's called twice, and neither buffer is freed.
This results in a memory leak as reported by Erhard:
unreferenced object 0xc00000047081f840 (size 32):
comm "kwindfarm", pid 203, jiffies 4294880630 (age 5552.877s)
hex dump (first 32 bytes):
c8 06 02 7f ff 02 ff 01 fb bf 00 41 00 20 00 00 ...........A. ..
00 07 89 37 00 a0 00 00 00 00 00 00 00 00 00 00 ...7............
backtrace:
[<0000000083f0a65c>] .smu_sat_get_sdb_partition+0xc4/0x2d0 [windfarm_smu_sat]
[<000000003010fcb7>] .pm112_wf_notify+0x104c/0x13bc [windfarm_pm112]
[<00000000b958b2dd>] .notifier_call_chain+0xa8/0x180
[<0000000070490868>] .blocking_notifier_call_chain+0x64/0x90
[<00000000131d8149>] .wf_thread_func+0x114/0x1a0
[<000000000d54838d>] .kthread+0x13c/0x190
[<00000000669b72bc>] .ret_from_kernel_thread+0x58/0x64
unreferenced object 0xc0000004737089f0 (size 16):
comm "kwindfarm", pid 203, jiffies 4294880879 (age 5552.050s)
hex dump (first 16 bytes):
c4 04 01 7f 22 11 e0 e6 ff 55 7b 12 ec 11 00 00 ...."....U{.....
backtrace:
[<0000000083f0a65c>] .smu_sat_get_sdb_partition+0xc4/0x2d0 [windfarm_smu_sat]
[<00000000b94ef7e1>] .pm112_wf_notify+0x1294/0x13bc [windfarm_pm112]
[<00000000b958b2dd>] .notifier_call_chain+0xa8/0x180
[<0000000070490868>] .blocking_notifier_call_chain+0x64/0x90
[<00000000131d8149>] .wf_thread_func+0x114/0x1a0
[<000000000d54838d>] .kthread+0x13c/0x190
[<00000000669b72bc>] .ret_from_kernel_thread+0x58/0x64Fix it by rearranging the logic so we deal with each buffer separately, which then makes it easy to free the buffer once we're done with it.
--- drivers/macintosh/windfarm_pm112.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/macintosh/windfarm_pm112.c +13 -8
@@ -133,14 +133,6 @@ static int create_cpu_loop(int cpu)s32 tmax;int fmin; -/* Get PID params from the appropriate SAT */ - hdr =smu_sat_get_sdb_partition (chip,0xC8 + core,NULL ); -if (hdr ==NULL ) { -printk (KERN_WARNING "windfarm: can't get CPU PID fan config\n" ); -return -EINVAL ; - } - piddata = (struct smu_sdbp_cpupiddata *)&hdr[1 ]; -/* Get FVT params to get Tmax; if not found, assume default */ hdr =smu_sat_get_sdb_partition (chip,0xC4 + core,NULL );if (hdr) {
@@ -153,6 +145,16 @@ static int create_cpu_loop(int cpu)if (tmax < cpu_all_tmax) cpu_all_tmax = tmax; +kfree (hdr); + +/* Get PID params from the appropriate SAT */ + hdr =smu_sat_get_sdb_partition (chip,0xC8 + core,NULL ); +if (hdr ==NULL ) { +printk (KERN_WARNING "windfarm: can't get CPU PID fan config\n" ); +return -EINVAL ; + } + piddata = (struct smu_sdbp_cpupiddata *)&hdr[1 ]; +/* * Darwin has a minimum fan speed of 1000 rpm for the 4-way and * 515 for the 2-way. That appears to be overkill, so for now,
@@ -175,6 +177,9 @@ static int create_cpu_loop(int cpu) pid.min = fmin;wf_cpu_pid_init (&cpu_pid[cpu], &pid); + +kfree (hdr); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 256/267 powerpc/64s: Dont let DT CPU features set FSCR_DSCR
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 993e3d96fd08c3ebf7566e43be9b8cd622063e6d upstream.
The device tree CPU features binding includes FSCR bit numbers which Linux is instructed to set by firmware.
Whether that's a good idea or not, in the case of the DSCR the Linux implementation has a hard requirement that the FSCR_DSCR bit not be set by default. We use it to track when a process reads/writes to DSCR, so it must be clear to begin with.
So if firmware tells us to set FSCR_DSCR we must ignore it.
Currently this does not cause a bug in our DSCR handling because the value of FSCR that the device tree CPU features code establishes is only used by swapper. All other tasks use the value hard coded in init_task.thread.fscr.
However we'd like to fix that in a future commit, at which point this will become necessary.
--- arch/powerpc/kernel/dt_cpu_ftrs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/powerpc/kernel/dt_cpu_ftrs.c +8 -0
@@ -346,6 +346,14 @@ static int __init feat_enable_dscr(struc {u64 lpcr; +/* +* Linux relies on FSCR[DSCR] being clear, so that we can take the +* facility unavailable interrupt and track the task's usage of DSCR. +* See facility_unavailable_exception(). +* Clear the bit here so that feat_enable() doesn't set it. +*/ + f->fscr_bit_nr =-1 ; +feat_enable (f); lpcr =mfspr (SPRN_LPCR );
Greg Kroah-Hartman
maintainerPATCH 257/267 powerpc/64s: Save FSCR to init_task.thread.fscr after feature init
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 912c0a7f2b5daa3cbb2bc10f303981e493de73bd upstream.
At boot the FSCR is initialised via one of two paths. On most systems it's set to a hard coded value in __init_FSCR().
On newer skiboot systems we use the device tree CPU features binding, where firmware can tell Linux what bits to set in FSCR (and HFSCR).
In both cases the value that's configured at boot is not propagated into the init_task.thread.fscr value prior to the initial fork of init (pid 1), which means the value is not used by any processes other than swapper (the idle task).
For the __init_FSCR() case this is OK, because the value in init_task.thread.fscr is initialised to something sensible. However it does mean that the value set in __init_FSCR() is not used other than for swapper, which is odd and confusing.
The bigger problem is for the device tree CPU features case it prevents firmware from setting (or clearing) FSCR bits for use by user space. This means all existing kernels can not have features enabled/disabled by firmware if those features require setting/clearing FSCR bits.
We can handle both cases by saving the FSCR value into init_task.thread.fscr after we have initialised it at boot. This fixes the bug for device tree CPU features, and will allow us to simplify the initialisation for the __init_FSCR() case in a future patch.
--- arch/powerpc/kernel/prom.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/powerpc/kernel/prom.c +19 -0
@@ -685,6 +685,23 @@ static void __init tm_init(void)static void tm_init (void ) { }#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ +#ifdef CONFIG_PPC64 +static void __init save_fscr_to_task (void ) +{ +/* +* Ensure the init_task (pid 0, aka swapper) uses the value of FSCR we +* have configured via the device tree features or via __init_FSCR(). +* That value will then be propagated to pid 1 (init) and all future +* processes. +*/ +if (early_cpu_has_feature (CPU_FTR_ARCH_207S )) + init_task.thread.fscr =mfspr (SPRN_FSCR ); +} +#else +static inline void save_fscr_to_task (void ) {}; +#endif + +void __init early_init_devtree (void *params) {phys_addr_t limit;
@@ -770,6 +787,8 @@ void __init early_init_devtree(void *parBUG (); } +save_fscr_to_task (); +#if defined(CONFIG_SMP ) && defined(CONFIG_PPC64 )/* We'll later wait for secondaries to check in; there are * NCPUS-1 non-boot CPUs :-)
Greg Kroah-Hartman
maintainerPATCH 258/267 kbuild: force to build vmlinux if CONFIG_MODVERSION=y
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 4b50c8c4eaf06a825d1c005c0b1b4a8307087b83 upstream.
This code does not work as stated in the comment.
$(CONFIG_MODVERSIONS) is always empty because it is expanded before include/config/auto.conf is included. Hence, 'make modules' with CONFIG_MODVERSION=y cannot record the version CRCs.
This has been broken since 2003, commit ("kbuild: Enable modules to be build using the "make dir/" syntax"). [1]
--- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Makefile +8 -5
@@ -554,12 +554,8 @@ KBUILD_MODULES := KBUILD_BUILTIN := 1 # If we have only "make modules", don't compile built-in objects. -# When we're building modules with modversions, we need to consider -# the built-in objects during the descend as well, in order to -# make sure the checksums are up to date before we record them. - ifeq ($(MAKECMDGOALS),modules) - KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) + KBUILD_BUILTIN := endif # If we have "make <whatever> modules", compile modules
@@ -1229,6 +1225,13 @@ ifdef CONFIG_MODULES all: modules +# When we're building modules with modversions, we need to consider +# the built-in objects during the descend as well, in order to +# make sure the checksums are up to date before we record them. +ifdef CONFIG_MODVERSIONS + KBUILD_BUILTIN := 1 +endif + # Build modules # # A module can be listed more than once in obj-m resulting in
Greg Kroah-Hartman
maintainerPATCH 259/267 sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations.
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
commit d47a5dc2888fd1b94adf1553068b8dad76cec96c upstream.
There is no valid case for supporting duplicate pseudoflavor registrations.
Currently the silent acceptance of such registrations is hiding a bug. The rpcsec_gss_krb5 module registers 2 flavours but does not unregister them, so if you load, unload, reload the module, it will happily continue to use the old registration which now has pointers to the memory were the module was originally loaded. This could lead to unexpected results.
So disallow duplicate registrations.
--- net/sunrpc/auth_gss/svcauth_gss.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +4 -2
@@ -796,9 +796,11 @@ svcauth_gss_register_pseudoflavor(u32 ps new->h.flavour = &svcauthops_gss; new->pseudoflavor = pseudoflavor; - stat =0 ; test =auth_domain_lookup (name, &new->h); -if (test != &new->h) {/* Duplicate registration */ +if (test != &new->h) { +pr_warn ("svc: duplicate registration of gss pseudo flavour %s.\n" , + name); + stat = -EADDRINUSE ;auth_domain_put (test);kfree (new->h.name); goto out_free_dom;
Greg Kroah-Hartman
maintainerPATCH 260/267 sunrpc: clean up properly in gss_mech_unregister()
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
commit 24c5efe41c29ee3e55bcf5a1c9f61ca8709622e8 upstream.
gss_mech_register() calls svcauth_gss_register_pseudoflavor() for each flavour, but gss_mech_unregister() does not call auth_domain_put(). This is unbalanced and makes it impossible to reload the module.
Change svcauth_gss_register_pseudoflavor() to return the registered auth_domain, and save it for later release.
--- include/linux/sunrpc/gss_api.h | 1 + include/linux/sunrpc/svcauth_gss.h | 3 ++- net/sunrpc/auth_gss/gss_mech_switch.c | 12 +++++++++--- net/sunrpc/auth_gss/svcauth_gss.c | 12 ++++++------ 4 files changed, 18 insertions(+), 10 deletions(-)
include/linux/sunrpc/gss_api.h +1 -0
@@ -83,6 +83,7 @@ struct pf_desc {u32 service;char *name;char *auth_domain_name; +struct auth_domain *domain;bool datatouch; };
include/linux/sunrpc/svcauth_gss.h +2 -1
@@ -21,7 +21,8 @@ int gss_svc_init(void);void gss_svc_shutdown (void );int gss_svc_init_net (struct net *net);void gss_svc_shutdown_net (struct net *net); -int svcauth_gss_register_pseudoflavor (u32 pseudoflavor,char * name); +struct auth_domain *svcauth_gss_register_pseudoflavor (u32 pseudoflavor, +char *name);u32 svcauth_gss_flavor (struct auth_domain *dom);#endif /* __KERNEL__ */
net/sunrpc/auth_gss/gss_mech_switch.c +9 -3
@@ -61,6 +61,8 @@ gss_mech_free(struct gss_api_mech *gm)for (i =0 ; i < gm->gm_pf_num; i++) { pf = &gm->gm_pfs[i]; +if (pf->domain) +auth_domain_put (pf->domain);kfree (pf->auth_domain_name); pf->auth_domain_name =NULL ; }
@@ -83,6 +85,7 @@ make_auth_domain_name(char *name)static int gss_mech_svc_setup (struct gss_api_mech *gm) { +struct auth_domain *dom;struct pf_desc *pf;int i, status;
@@ -92,10 +95,13 @@ gss_mech_svc_setup(struct gss_api_mech * status = -ENOMEM ;if (pf->auth_domain_name ==NULL ) goto out; - status =svcauth_gss_register_pseudoflavor (pf->pseudoflavor, - pf->auth_domain_name); -if (status) + dom =svcauth_gss_register_pseudoflavor ( + pf->pseudoflavor, pf->auth_domain_name); +if (IS_ERR (dom)) { + status =PTR_ERR (dom); goto out; + } + pf->domain = dom; }return 0 ; out:
net/sunrpc/auth_gss/svcauth_gss.c +6 -6
@@ -779,7 +779,7 @@ u32 svcauth_gss_flavor(struct auth_domaiEXPORT_SYMBOL_GPL (svcauth_gss_flavor); -int +struct auth_domain *svcauth_gss_register_pseudoflavor (u32 pseudoflavor,char * name) {struct gss_domain *new;
@@ -802,17 +802,17 @@ svcauth_gss_register_pseudoflavor(u32 ps name); stat = -EADDRINUSE ;auth_domain_put (test); -kfree (new->h.name); - goto out_free_dom; + goto out_free_name; } -return 0 ; +return test; +out_free_name: +kfree (new->h.name); out_free_dom:kfree (new); out: -return stat; +return ERR_PTR (stat); } -EXPORT_SYMBOL_GPL (svcauth_gss_register_pseudoflavor); static inline int
Greg Kroah-Hartman
maintainerPATCH 261/267 mtd: rawnand: brcmnand: fix hamming oob layout
In reply to Greg Kroah-HartmanFrom: Álvaro Fernández Rojas <[email protected]>
commit 130bbde4809b011faf64f99dddc14b4b01f440c3 upstream.
First 2 bytes are used in large-page nand.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +7 -4
@@ -911,11 +911,14 @@ static int brcmnand_hamming_ooblayout_frif (!section) {/* * Small-page NAND use byte 6 for BBI while large-page -* NAND use byte 0. +* NAND use bytes 0 and 1. */ -if (cfg->page_size >512 ) - oobregion->offset++; - oobregion->length--; +if (cfg->page_size >512 ) { + oobregion->offset +=2 ; + oobregion->length -=2 ; + }else { + oobregion->length--; + } } }
Greg Kroah-Hartman
maintainerPATCH 262/267 mtd: rawnand: pasemi: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit f51466901c07e6930435d30b02a21f0841174f61 upstream.
nand_cleanup() is supposed to be called on error after a successful call to nand_scan() to free all NAND resources.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.
--- drivers/mtd/nand/raw/pasemi_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/pasemi_nand.c +3 -1
@@ -163,7 +163,7 @@ static int pasemi_nand_probe(struct platif (mtd_device_register (pasemi_nand_mtd,NULL ,0 )) {dev_err (dev,"Unable to register MTD device\n" ); err = -ENODEV ; - goto out_lpc; + goto out_cleanup_nand; } dev_info(dev, "PA Semi NAND flash at %pR, control at I/O %x\n", &res,
@@ -171,6 +171,8 @@ static int pasemi_nand_probe(struct platreturn 0 ; + out_cleanup_nand: +nand_cleanup (chip); out_lpc:release_region (lpcctl,4 ); out_ior:
Greg Kroah-Hartman
maintainerPATCH 263/267 w1: omap-hdq: cleanup to add missing newline for some dev_dbg
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
commit 5e02f3b31704e24537697bce54f8156bdb72b7a6 upstream.
Otherwise it will corrupt the console log during debugging.
--- drivers/w1/masters/omap_hdq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/w1/masters/omap_hdq.c +5 -5
@@ -176,7 +176,7 @@ static int hdq_write_byte(struct hdq_dat/* check irqstatus */ if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) {dev_dbg (hdq_data->dev,"timeout waiting for" -" TXCOMPLETE/RXCOMPLETE, %x" , *status); +" TXCOMPLETE/RXCOMPLETE, %x\n" , *status); ret = -ETIMEDOUT ; goto out; }
@@ -187,7 +187,7 @@ static int hdq_write_byte(struct hdq_dat OMAP_HDQ_FLAG_CLEAR, &tmp_status);if (ret) {dev_dbg (hdq_data->dev,"timeout waiting GO bit" -" return to zero, %x" , tmp_status); +" return to zero, %x\n" , tmp_status); } out:
@@ -203,7 +203,7 @@ static irqreturn_t hdq_isr(int irq, voidspin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); hdq_data->hdq_irqstatus =hdq_reg_in (hdq_data,OMAP_HDQ_INT_STATUS );spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); -dev_dbg (hdq_data->dev,"hdq_isr: %x" , hdq_data->hdq_irqstatus); +dev_dbg (hdq_data->dev,"hdq_isr: %x\n" , hdq_data->hdq_irqstatus); if (hdq_data->hdq_irqstatus & (OMAP_HDQ_INT_STATUS_TXCOMPLETE | OMAP_HDQ_INT_STATUS_RXCOMPLETE
@@ -311,7 +311,7 @@ static int omap_hdq_break(struct hdq_dat tmp_status = hdq_data->hdq_irqstatus;/* check irqstatus */ if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { -dev_dbg (hdq_data->dev,"timeout waiting for TIMEOUT, %x" , +dev_dbg (hdq_data->dev,"timeout waiting for TIMEOUT, %x\n" , tmp_status); ret = -ETIMEDOUT ; goto out;
@@ -338,7 +338,7 @@ static int omap_hdq_break(struct hdq_dat &tmp_status);if (ret)dev_dbg (hdq_data->dev,"timeout waiting INIT&GO bits" -" return to zero, %x" , tmp_status); +" return to zero, %x\n" , tmp_status); out:mutex_unlock (&hdq_data->hdq_mutex);
Greg Kroah-Hartman
maintainerPATCH 264/267 perf probe: Do not show the skipped events
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit f41ebe9defacddeae96a872a33f0f22ced0bfcef upstream.
When a probe point is expanded to several places (like inlined) and if some of them are skipped because of blacklisted or __init function, those trace_events has no event name. It must be skipped while showing results.
Without this fix, you can see "(null):(null)" on the list,
# ./perf probe request_resource
reserve_setup is out of .text, skip it.
Added new events:
(null):(null) (on request_resource)
probe:request_resource (on request_resource)You can now use it in all perf tools, such as:
perf record -e probe:request_resource -aR sleep 1
#
With this fix, it is ignored:
# ./perf probe request_resource
reserve_setup is out of .text, skip it.
Added new events:
probe:request_resource (on request_resource)You can now use it in all perf tools, such as:
perf record -e probe:request_resource -aR sleep 1
#
--- tools/perf/builtin-probe.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-probe.c +3 -0
@@ -376,6 +376,9 @@ static int perf_add_probe_events(structfor (k =0 ; k < pev->ntevs; k++) {struct probe_trace_event *tev = &pev->tevs[k]; +/* Skipped events have no event name */ +if (!tev->event) +continue ;/* We use tev's name for showing new events */ show_perf_probe_event(tev->group, tev->event, pev,
Greg Kroah-Hartman
maintainerPATCH 265/267 perf probe: Fix to check blacklist address correctly
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit 80526491c2ca6abc028c0f0dbb0707a1f35fb18a upstream.
Fix to check kprobe blacklist address correctly with relocated address by adjusting debuginfo address.
Since the address in the debuginfo is same as objdump, it is different from relocated kernel address with KASLR. Thus, 'perf probe' always misses to catch the blacklisted addresses.
Without this patch, 'perf probe' can not detect the blacklist addresses on a KASLR enabled kernel.
# perf probe kprobe_dispatcher
Failed to write event: Invalid argument
Error: Failed to add events.
#With this patch, it correctly shows the error message.
# perf probe kprobe_dispatcher
kprobe_dispatcher is blacklisted function, skip it.
Probe point 'kprobe_dispatcher' not found.
Error: Failed to add events.
#--- tools/perf/util/probe-event.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tools/perf/util/probe-event.c +15 -6
@@ -111,7 +111,7 @@ void exit_probe_symbol_maps(void)symbol__exit (); } -static struct ref_reloc_sym *kernel_get_ref_reloc_sym (void ) +static struct ref_reloc_sym *kernel_get_ref_reloc_sym (struct map **pmap) {/* kmap->ref_reloc_sym should be set if host_machine is initialized */ struct kmap *kmap;
@@ -123,6 +123,10 @@ static struct ref_reloc_sym *kernel_get_ kmap =map__kmap (map);if (!kmap)return NULL ; + +if (pmap) + *pmap = map; +return kmap->ref_reloc_sym; }
@@ -134,7 +138,7 @@ static int kernel_get_symbol_address_by_struct map *map;/* ref_reloc_sym is just a label. Need a special fix*/ - reloc_sym =kernel_get_ref_reloc_sym (); + reloc_sym =kernel_get_ref_reloc_sym (NULL );if (reloc_sym &&strcmp (name, reloc_sym->name) ==0 ) *addr = (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr;else {
@@ -751,6 +755,7 @@ post_process_kernel_probe_trace_events(s int ntevs) {struct ref_reloc_sym *reloc_sym; +struct map *map;char *tmp;int i, skipped =0 ;
@@ -759,7 +764,7 @@ post_process_kernel_probe_trace_events(sreturn post_process_offline_probe_trace_events (tevs, ntevs, symbol_conf.vmlinux_name); - reloc_sym =kernel_get_ref_reloc_sym (); + reloc_sym =kernel_get_ref_reloc_sym (&map);if (!reloc_sym) {pr_warning ("Relocated base symbol is not found!\n" );return -EINVAL ;
@@ -770,9 +775,13 @@ post_process_kernel_probe_trace_events(scontinue ;if (tevs[i].point.retprobe && !kretprobe_offset_is_supported ())continue ; -/* If we found a wrong one, mark it by NULL symbol */ +/* +* If we found a wrong one, mark it by NULL symbol. +* Since addresses in debuginfo is same as objdump, we need +* to convert it to addresses on memory. +*/ if (kprobe_warn_out_range (tevs[i].point.symbol, - tevs[i].point.address)) { +map__objdump_2mem (map, tevs[i].point.address))) { tmp =NULL ; skipped++; }else {
@@ -2887,7 +2896,7 @@ static int find_probe_trace_events_from_/* Note that the symbols in the kmodule are not relocated */ if (!pev->uprobes && !pev->target && (!pp->retprobe ||kretprobe_offset_is_supported ())) { - reloc_sym =kernel_get_ref_reloc_sym (); + reloc_sym =kernel_get_ref_reloc_sym (NULL );if (!reloc_sym) {pr_warning ("Relocated base symbol is not found!\n" ); ret = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 266/267 perf probe: Check address correctness by map instead of _etext
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit 2ae5d0d7d8868df7c05c2013c0b9cddd4d40610e upstream.
Since commit 03db8b583d1c ("perf tools: Fix maps__find_symbol_by_name()") introduced map address range check in maps__find_symbol_by_name(), we can not get "_etext" from kernel map because _etext is placed on the edge of the kernel .text section (= kernel map in perf.)
To fix this issue, this checks the address correctness by map address range information (map->start and map->end) instead of using _etext address.
This can cause an error if the target inlined function is embedded in both __init function and normal function.
For exaample, request_resource() is a normal function but also embedded in __init reserve_setup(). In this case, the probe point in reserve_setup() must be skipped.
However, without this fix, it failes to setup all probe points:
# ./perf probe -v request_resource
probe-definition(0): request_resource
symbol:request_resource file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux for symbols
Open Debuginfo file: /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux
Try to find probe point from debuginfo.
Matched function: request_resource [15e29ad]
found inline addr: 0xffffffff82fbf892
Probe point found: reserve_setup+204
found inline addr: 0xffffffff810e9790
Probe point found: request_resource+0
Found 2 probe_trace_events.
Opening /sys/kernel/debug/tracing//kprobe_events write=1
Opening /sys/kernel/debug/tracing//README write=0
Writing event: p:probe/request_resource _text+33290386
Failed to write event: Invalid argument
Error: Failed to add events. Reason: Invalid argument (Code: -22)
#With this fix,
# ./perf probe request_resource
reserve_setup is out of .text, skip it.
Added new events:
(null):(null) (on request_resource)
probe:request_resource (on request_resource)You can now use it in all perf tools, such as:
perf record -e probe:request_resource -aR sleep 1
#
--- tools/perf/util/probe-event.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
tools/perf/util/probe-event.c +13 -12
@@ -245,21 +245,22 @@ static void clear_probe_trace_events(strstatic bool kprobe_blacklist__listed (unsigned long address);static bool kprobe_warn_out_range (const char *symbol,unsigned long address) { -u64 etext_addr =0 ; -int ret; +struct map *map; +bool ret = false; -/* Get the address of _etext for checking non-probable text symbol */ - ret =kernel_get_symbol_address_by_name ("_etext" , &etext_addr, - false, false); - -if (ret ==0 && etext_addr < address) -pr_warning ("%s is out of .text, skip it.\n" , symbol); -else if (kprobe_blacklist__listed (address)) + map =kernel_get_module_map (NULL ); +if (map) { + ret = address <= map->start || map->end < address; +if (ret) +pr_warning ("%s is out of .text, skip it.\n" , symbol); +map__put (map); + } +if (!ret &&kprobe_blacklist__listed (address)) {pr_warning ("%s is blacklisted function, skip it.\n" , symbol); -else -return false; + ret = true; + } -return true; +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 267/267 perf symbols: Fix debuginfo search for Ubuntu
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 85afd35575a3c1a3a905722dde5ee70b49282e70 upstream.
Reportedly, from 19.10 Ubuntu has begun mixing up the location of some debug symbol files, putting files expected to be in /usr/lib/debug/usr/lib into /usr/lib/debug/lib instead. Fix by adding another dso_binary_type.
Example on Ubuntu 20.04
Before:
$ perf record -e intel_pt//u uname
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.030 MB perf.data ]
$ perf script --call-trace | head -5
uname 14003 [005] 15321.764958566: cbr: 42 freq: 4219 MHz (156%)
uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4100
uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4df0
uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4e18
uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc5128After:
$ perf script --call-trace | head -5
uname 14003 [005] 15321.764958566: cbr: 42 freq: 4219 MHz (156%)
uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _start
uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start
uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start
uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start--- tools/perf/util/dso.c | 16 ++++++++++++++++ tools/perf/util/dso.h | 1 + tools/perf/util/probe-finder.c | 1 + tools/perf/util/symbol.c | 2 ++ 4 files changed, 20 insertions(+)
tools/perf/util/dso.c +16 -0
@@ -38,6 +38,7 @@ char dso__symtab_origin(const struct dso [DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO] = 'D', [DSO_BINARY_TYPE__FEDORA_DEBUGINFO] = 'f', [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO] = 'u', + [DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO] = 'x', [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO] = 'o', [DSO_BINARY_TYPE__BUILDID_DEBUGINFO] = 'b', [DSO_BINARY_TYPE__SYSTEM_PATH_DSO] = 'd',
@@ -120,6 +121,21 @@ int dso__read_binary_type_filename(constsnprintf (filename + len, size - len,"%s" , dso->long_name);break ; +case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO : +/* +* Ubuntu can mixup /usr/lib with /lib, putting debuginfo in +* /usr/lib/debug/lib when it is expected to be in +* /usr/lib/debug/usr/lib +*/ +if (strlen (dso->long_name) <9 || +strncmp (dso->long_name,"/usr/lib/" ,9 )) { + ret =-1 ; +break ; + } + len =__symbol__join_symfs (filename, size,"/usr/lib/debug" ); +snprintf (filename + len, size - len,"%s" , dso->long_name +4 ); +break ; +case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO : {const char *last_slash;
tools/perf/util/dso.h +1 -0
@@ -25,6 +25,7 @@ enum dso_binary_type {DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO ,DSO_BINARY_TYPE__FEDORA_DEBUGINFO ,DSO_BINARY_TYPE__UBUNTU_DEBUGINFO , +DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO ,DSO_BINARY_TYPE__BUILDID_DEBUGINFO ,DSO_BINARY_TYPE__SYSTEM_PATH_DSO , DSO_BINARY_TYPE__GUEST_KMODULE,
tools/perf/util/probe-finder.c +1 -0
@@ -114,6 +114,7 @@ enum dso_binary_type distro_dwarf_types[DSO_BINARY_TYPE__UBUNTU_DEBUGINFO ,DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO ,DSO_BINARY_TYPE__BUILDID_DEBUGINFO , +DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO , DSO_BINARY_TYPE__NOT_FOUND, };
tools/perf/util/symbol.c +2 -0
@@ -65,6 +65,7 @@ static enum dso_binary_type binary_type_DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ,DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ,DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO , +DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO , DSO_BINARY_TYPE__NOT_FOUND, };
@@ -1419,6 +1420,7 @@ static bool dso__is_compatible_symtab_tycase DSO_BINARY_TYPE__SYSTEM_PATH_DSO :case DSO_BINARY_TYPE__FEDORA_DEBUGINFO :case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO : +case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO :case DSO_BINARY_TYPE__BUILDID_DEBUGINFO :case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO :return !kmod && dso->kernel ==DSO_TYPE_USER ;
Guenter Roeck
maintainerQuoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.129 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 21 Jun 2020 14:15:50 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 144 fail: 11 Failed builds: <most mips> Qemu test results: total: 420 pass: 360 fail: 60
Failed tests:
<all mips>
arch/mips/mm/dma-noncoherent.c: In function 'cpu_needs_post_dma_flush':arch/mips/mm/dma-noncoherent.c:59:7: error: 'CPU_LOONGSON2EF' undeclared
Guenter
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.129 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 21 Jun 2020 14:15:50 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.129-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.19.129-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.19.y
git commit: a00c59b6375644f707a3554536d03d4ecaf17c05
git describe: v4.19.128-268-ga00c59b63756
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.19-oe/build/v4.19.128-268-ga00c59b63756
No regressions (compared to build v4.19.128)
No fixes (compared to build v4.19.128)
Ran 34131 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- nxp-ls2088
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
- x86-kasan
Test Suites
-----------
* build
* kselftest
* kselftest/drivers
* kselftest/filesystems
* kselftest/net
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-native/drivers
* kselftest-vsyscall-mode-native/filesystems
* kselftest-vsyscall-mode-native/net
* kselftest-vsyscall-mode-none
* kselftest-vsyscall-mode-none/drivers
* kselftest-vsyscall-mode-none/filesystems
* kselftest-vsyscall-mode-none/net
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fs-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* network-basic-tests
* perf
* v4l2-compliance
Greetings!
Daniel Díaz
[email protected]
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org