s390/qeth: uninstall IRQ handler on device removal
Subsystems (34)
Sasha Levin
maintainerPATCH 145/191 PCI/ERR: Run error recovery callbacks for all affected devices
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit bfcb79fca19d267712e425af1dd48812c40dec0c ]
If an Endpoint reported an error with ERR_FATAL, we previously ran driver error recovery callbacks only for the Endpoint's driver. But if we reset a Link to recover from the error, all downstream components are affected, including the Endpoint, any multi-function peers, and children of those peers.
Initiate the Link reset from the deepest Downstream Port that is reliable, and call the error recovery callbacks for all its children.
If a Downstream Port (including a Root Port) reports an error, we assume the Port itself is reliable and we need to reset its downstream Link. In all other cases (Switch Upstream Ports, Endpoints, Bridges, etc), we assume the Link leading to the component needs to be reset, so we initiate the reset at the parent Downstream Port.
This allows two other clean-ups. First, we currently only use a Link reset, which can only be initiated using a Downstream Port, so we can remove checks for Endpoints. Second, the Downstream Port where we initiate the Link reset is reliable (unlike components downstream from it), so the special cases for error detect and resume are no longer necessary.
--- drivers/pci/pcie/err.c | 85 +++++++++++------------------------------- 1 file changed, 21 insertions(+), 64 deletions(-)
drivers/pci/pcie/err.c +21 -64
@@ -63,30 +63,12 @@ static int report_error_detected(struct pci_dev *dev, void *data)if (!dev->driver || !dev->driver->err_handler || !dev->driver->err_handler->error_detected) { -if (result_data->state == pci_channel_io_frozen && - dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) { -/* -* In case of fatal recovery, if one of down- -* stream device has no driver. We might be -* unable to recover because a later insmod -* of a driver for this device is unaware of -* its hw state. -*/ -pci_printk (KERN_DEBUG , dev,"device has %s\n" , - dev->driver ? -"no AER-aware driver" :"no driver" ); - } -/* -* If there's any device in the subtree that does not -* have an error_detected callback, returning -* PCI_ERS_RESULT_NO_AER_DRIVER prevents calling of -* the subsequent mmio_enabled/slot_reset/resume -* callbacks of "any" device in the subtree. All the -* devices in the subtree are left in the error state -* without recovery. +* If any device in the subtree does not have an error_detected +* callback, PCI_ERS_RESULT_NO_AER_DRIVER prevents subsequent +* error callbacks of "any" device in the subtree, and will +* exit in the disconnected error state. */ -if (dev->hdr_type !=PCI_HEADER_TYPE_BRIDGE ) vote =PCI_ERS_RESULT_NO_AER_DRIVER ;else
@@ -184,34 +166,23 @@ static pci_ers_result_t default_reset_link(struct pci_dev *dev)static pci_ers_result_t reset_link (struct pci_dev *dev,u32 service) { -struct pci_dev *udev;pci_ers_result_t status;struct pcie_port_service_driver *driver =NULL ; -if (dev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) { -/* Reset this port for all subordinates */ - udev = dev; - }else { -/* Reset the upstream component (likely downstream port) */ - udev = dev->bus->self; - } - -/* Use the aer driver of the component firstly */ - driver =pcie_port_find_service (udev, service); - + driver =pcie_port_find_service (dev, service);if (driver && driver->reset_link) { - status = driver->reset_link (udev); - }else if (udev->has_secondary_link) { - status =default_reset_link (udev); + status = driver->reset_link (dev); + }else if (dev->has_secondary_link) { + status =default_reset_link (dev); }else {pci_printk (KERN_DEBUG , dev,"no link-reset support at upstream device %s\n" , -pci_name (udev)); +pci_name (dev));return PCI_ERS_RESULT_DISCONNECT ; }if (status !=PCI_ERS_RESULT_RECOVERED ) {pci_printk (KERN_DEBUG , dev,"link reset at upstream device %s failed\n" , -pci_name (udev)); +pci_name (dev));return PCI_ERS_RESULT_DISCONNECT ; }
@@ -243,31 +214,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,else result_data.result =PCI_ERS_RESULT_RECOVERED ; -if (dev->hdr_type ==PCI_HEADER_TYPE_BRIDGE ) { -/* -* If the error is reported by a bridge, we think this error -* is related to the downstream link of the bridge, so we -* do error recovery on all subordinates of the bridge instead -* of the bridge and clear the error status of the bridge. -*/ -if (cb == report_error_detected) - dev->error_state = state; -pci_walk_bus (dev->subordinate, cb, &result_data); -if (cb == report_resume) { -pci_aer_clear_device_status (dev); -pci_cleanup_aer_uncorrect_error_status (dev); - dev->error_state = pci_channel_io_normal; - } - }else { -/* -* If the error is reported by an end point, we think this -* error is related to the upstream link of the end point. -* The error is non fatal so the bus is ok; just invoke -* the callback for the function that logged the error. -*/ -cb (dev, &result_data); - } - +pci_walk_bus (dev->subordinate, cb, &result_data);return result_data.result; }
@@ -347,6 +294,14 @@ void pcie_do_nonfatal_recovery(struct pci_dev *dev) state = pci_channel_io_normal; +/* +* Error recovery runs on all subordinates of the first downstream port. +* If the downstream port detected the error, it is cleared at the end. +*/ +if (!(pci_pcie_type (dev) ==PCI_EXP_TYPE_ROOT_PORT || +pci_pcie_type (dev) ==PCI_EXP_TYPE_DOWNSTREAM )) + dev = dev->bus->self; + status = broadcast_error_message(dev, state, "error_detected",
@@ -378,6 +333,8 @@ void pcie_do_nonfatal_recovery(struct pci_dev *dev)"resume" , report_resume); +pci_aer_clear_device_status (dev); +pci_cleanup_aer_uncorrect_error_status (dev);pci_info (dev,"AER: Device recovery successful\n" );return ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 146/191 f2fs: update i_size after DIO completion
In reply to Sasha LevinFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 0a4daae5ffea39f5015334e4d18a6a80b447cae4 ]
This is related toee70daaba82d ("xfs: update i_size after unwritten conversion in dio completion")
If we update i_size during dio_write, dio_read can read out stale data, which breaks xfstests/465.
--- fs/f2fs/data.c | 15 +++++++-------- fs/f2fs/f2fs.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-)
fs/f2fs/data.c +7 -8
@@ -887,7 +887,6 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type)struct f2fs_summary sum;struct node_info ni;block_t old_blkaddr; -pgoff_t fofs;blkcnt_t count =1 ;int err;
@@ -916,12 +915,10 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type) old_blkaddr, old_blkaddr);f2fs_set_data_blkaddr (dn); -/* update i_size */ - fofs =f2fs_start_bidx_of_node (ofs_of_node (dn->node_page), dn->inode) + - dn->ofs_in_node; -if (i_size_read (dn->inode) < ((loff_t)(fofs +1 ) <<PAGE_SHIFT )) -f2fs_i_size_write (dn->inode, - ((loff_t)(fofs +1 ) <<PAGE_SHIFT )); +/* +* i_size will be updated by direct_IO. Otherwise, we'll get stale +* data from unwritten block via dio_read. +*/ return 0 ; }
@@ -1087,6 +1084,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, last_ofs_in_node = dn.ofs_in_node; } }else { +WARN_ON (flag !=F2FS_GET_BLOCK_PRE_DIO && + flag !=F2FS_GET_BLOCK_DIO ); err =__allocate_data_block (&dn, map->m_seg_type);if (!err)
@@ -1266,7 +1265,7 @@ static int get_data_block_dio(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) {return __get_data_block (inode, iblock, bh_result, create, -F2FS_GET_BLOCK_DEFAULT ,NULL , +F2FS_GET_BLOCK_DIO ,NULL ,f2fs_rw_hint_to_seg_type ( inode->i_write_hint)); }
fs/f2fs/f2fs.h +1 -0
@@ -600,6 +600,7 @@ enum {F2FS_GET_BLOCK_DEFAULT ,F2FS_GET_BLOCK_FIEMAP ,F2FS_GET_BLOCK_BMAP , +F2FS_GET_BLOCK_DIO ,F2FS_GET_BLOCK_PRE_DIO ,F2FS_GET_BLOCK_PRE_AIO , F2FS_GET_BLOCK_PRECACHE,
Signature · 8 lines
2.20.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 147/191 f2fs: fix to recover inode's project id during POR
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit f4474aa6e5e901ee4af21f39f1b9115aaaaec503 ]
Testcase to reproduce this bug:
1. mkfs.f2fs -O extra_attr -O project_quota /dev/sdd
2. mount -t f2fs /dev/sdd /mnt/f2fs
3. touch /mnt/f2fs/file
4. sync
5. chattr -p 1 /mnt/f2fs/file
6. xfs_io -f /mnt/f2fs/file -c "fsync"
7. godown /mnt/f2fs
8. umount /mnt/f2fs
9. mount -t f2fs /dev/sdd /mnt/f2fs
10. lsattr -p /mnt/f2fs/file
0 -----------------N- /mnt/f2fs/file
But actually, we expect the correct result is:
1 -----------------N- /mnt/f2fs/file
The reason is we didn't recover inode.i_projid field during mount, fix it.
--- fs/f2fs/recovery.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/f2fs/recovery.c +13 -0
@@ -218,6 +218,19 @@ static void recover_inode(struct inode *inode, struct page *page) inode->i_mode =le16_to_cpu (raw->i_mode);i_uid_write (inode,le32_to_cpu (raw->i_uid));i_gid_write (inode,le32_to_cpu (raw->i_gid)); + +if (raw->i_inline &F2FS_EXTRA_ATTR ) { +if (f2fs_sb_has_project_quota (F2FS_I_SB (inode)->sb) && +F2FS_FITS_IN_INODE (raw,le16_to_cpu (raw->i_extra_isize), + i_projid)) { +projid_t i_projid; + + i_projid = (projid_t )le32_to_cpu (raw->i_projid); +F2FS_I (inode)->i_projid = +make_kprojid (&init_user_ns, i_projid); + } + } +f2fs_i_size_write (inode,le64_to_cpu (raw->i_size)); inode->i_atime.tv_sec =le64_to_cpu (raw->i_atime); inode->i_ctime.tv_sec =le64_to_cpu (raw->i_ctime);
Signature · 8 lines
2.20.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 148/191 f2fs: mark inode dirty explicitly in recover_inode()
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit 4a1728cad6340bfbe17bd17fd158b2165cd99508 ]
Mark inode dirty explicitly in the end of recover_inode() to make sure that all recoverable fields can be persisted later.
--- fs/f2fs/recovery.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/recovery.c +2 -0
@@ -247,6 +247,8 @@ static void recover_inode(struct inode *inode, struct page *page)recover_inline_flags (inode, raw); +f2fs_mark_inode_dirty_sync (inode, true); +if (file_enc_name (inode)) name ="<encrypted>" ;else
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 149/191 RDMA: Fix dependencies for rdma_user_mmap_io
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 46bdf777685677c1cc6b3da9220aace9da690731 ]
The mlx4 driver produces a link error when it is configured as built-in while CONFIG_INFINIBAND_USER_ACCESS is set to =m:
drivers/infiniband/hw/mlx4/main.o: In function `mlx4_ib_mmap':
main.c:(.text+0x1af4): undefined reference to `rdma_user_mmap_io'
The same function is called from mlx5, which already has a dependency to ensure we can call it, and from hns, which appears to suffer from the same problem.
This adds the same dependency that mlx5 uses to the other two.
--- drivers/infiniband/hw/hns/Kconfig | 1 + drivers/infiniband/hw/mlx4/Kconfig | 1 + 2 files changed, 2 insertions(+)
drivers/infiniband/hw/hns/Kconfig +1 -0
@@ -1,6 +1,7 @@ config INFINIBAND_HNS tristate "HNS RoCE Driver" depends on NET_VENDOR_HISILICON + depends on INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS depends on ARM64 || (COMPILE_TEST && 64BIT) ---help--- This is a RoCE/RDMA driver for the Hisilicon RoCE engine. The engine
drivers/infiniband/hw/mlx4/Kconfig +1 -0
@@ -1,6 +1,7 @@ config MLX4_INFINIBAND tristate "Mellanox ConnectX HCA support" depends on NETDEVICES && ETHERNET && PCI && INET + depends on INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS depends on MAY_USE_DEVLINK select NET_VENDOR_MELLANOX select MLX4_CORE
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 150/191 EDAC: Raise the maximum number of memory controllers
In reply to Sasha LevinFrom: Justin Ernst <[email protected]>
[ Upstream commit 6b58859419554fb824e09cfdd73151a195473cbc ]
We observe an oops in the skx_edac module during boot:
EDAC MC0: Giving out device to module skx_edac controller Skylake Socket#0 IMC#0 EDAC MC1: Giving out device to module skx_edac controller Skylake Socket#0 IMC#1 EDAC MC2: Giving out device to module skx_edac controller Skylake Socket#1 IMC#0
...
EDAC MC13: Giving out device to module skx_edac controller Skylake Socket#0 IMC#1 EDAC MC14: Giving out device to module skx_edac controller Skylake Socket#1 IMC#0 EDAC MC15: Giving out device to module skx_edac controller Skylake Socket#1 IMC#1 Too many memory controllers: 16
EDAC MC: Removed device 0 for skx_edac Skylake Socket#0 IMC#0
We observe there are two memory controllers per socket, with a limit of 16. Raise the maximum number of memory controllers from 16 to 2 * MAX_NUMNODES (1024).
[ bp: This is just a band-aid fix until we've sorted out the whole issue
with the bus_type association and handling in EDAC and can get rid of this arbitrary limit. ]
--- include/linux/edac.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/edac.h +2 -1
@@ -17,6 +17,7 @@#include <linux/completion.h> #include <linux/workqueue.h> #include <linux/debugfs.h> +#include <linux/numa.h> #define EDAC_DEVICE_NAME_LEN 31
@@ -670,6 +671,6 @@ struct mem_ctl_info {/* * Maximum number of memory controllers in the coherent fabric. */ -#define EDAC_MAX_MCS 16 +#define EDAC_MAX_MCS 2 * MAX_NUMNODES#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 151/191 ARM: dts: realview: Fix SPI controller node names
In reply to Sasha LevinFrom: Rob Herring <[email protected]>
[ Upstream commit 016add12977bcc30f77d7e48fc9a3a024cb46645 ]
SPI controller nodes should be named 'spi' rather than 'ssp'. Fixing the name enables dtc SPI bus checks.
--- arch/arm/boot/dts/arm-realview-eb.dtsi | 2 +- arch/arm/boot/dts/arm-realview-pb1176.dts | 2 +- arch/arm/boot/dts/arm-realview-pb11mp.dts | 2 +- arch/arm/boot/dts/arm-realview-pbx.dtsi | 2 +- arch/arm/boot/dts/versatile-ab.dts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/arm-realview-eb.dtsi +1 -1
@@ -371,7 +371,7 @@ clock-names = "uartclk", "apb_pclk"; }; - ssp: ssp@1000d000 { + ssp: spi@1000d000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x1000d000 0x1000>; clocks = <&sspclk>, <&pclk>;
arch/arm/boot/dts/arm-realview-pb1176.dts +1 -1
@@ -380,7 +380,7 @@ clock-names = "apb_pclk"; }; - pb1176_ssp: ssp@1010b000 { + pb1176_ssp: spi@1010b000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x1010b000 0x1000>; interrupt-parent = <&intc_dc1176>;
arch/arm/boot/dts/arm-realview-pb11mp.dts +1 -1
@@ -523,7 +523,7 @@ clock-names = "uartclk", "apb_pclk"; }; - ssp@1000d000 { + spi@1000d000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x1000d000 0x1000>; interrupt-parent = <&intc_pb11mp>;
arch/arm/boot/dts/arm-realview-pbx.dtsi +1 -1
@@ -362,7 +362,7 @@ clock-names = "uartclk", "apb_pclk"; }; - ssp: ssp@1000d000 { + ssp: spi@1000d000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x1000d000 0x1000>; clocks = <&sspclk>, <&pclk>;
arch/arm/boot/dts/versatile-ab.dts +1 -1
@@ -373,7 +373,7 @@ clock-names = "apb_pclk"; }; - ssp@101f4000 { + spi@101f4000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x101f4000 0x1000>; interrupts = <11>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 152/191 firmware: dell_rbu: Make payload memory uncachable
In reply to Sasha LevinFrom: Stuart Hayes <[email protected]>
[ Upstream commit 6aecee6ad41cf97c0270f72da032c10eef025bf0 ]
The dell_rbu driver takes firmware update payloads and puts them in memory so the system BIOS can find them after a reboot. This sometimes fails (though rarely), because the memory containing the payload is in the CPU cache but never gets written back to main memory before the system is rebooted (CPU cache contents are lost on reboot).
With this patch, the payload memory will be changed to uncachable to ensure that the payload is actually in main memory before the system is rebooted.
--- drivers/firmware/dell_rbu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/firmware/dell_rbu.c +8 -0
@@ -45,6 +45,7 @@#include <linux/moduleparam.h> #include <linux/firmware.h> #include <linux/dma-mapping.h> +#include <asm/set_memory.h> MODULE_AUTHOR ("Abhay Salunke <[email protected]>" );MODULE_DESCRIPTION ("Driver for updating BIOS image on DELL systems" );
@@ -181,6 +182,11 @@ static int create_packet(void *data, size_t length) packet_data_temp_buf =NULL ; } } +/* +* set to uncachable or it may never get written back before reboot +*/ +set_memory_uc ((unsigned long )packet_data_temp_buf,1 << ordernum); +spin_lock (&rbu_data.lock); newpacket->data = packet_data_temp_buf;
@@ -349,6 +355,8 @@ static void packet_empty_list(void)* to make sure there are no stale RBU packets left in memory */ memset (newpacket->data,0 , rbu_data.packetsize); +set_memory_wb ((unsigned long )newpacket->data, +1 << newpacket->ordernum);free_pages ((unsigned long ) newpacket->data, newpacket->ordernum);kfree (newpacket);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 153/191 Bluetooth: hci_serdev: clear HCI_UART_PROTO_READY to avoid closing proto races
In reply to Sasha LevinFrom: Balakrishna Godavarthi <[email protected]>
[ Upstream commit 7cf7846d27bfc9731e449857db3eec5e0e9701ba ]
Clearing HCI_UART_PROTO_READY will avoid usage of proto function pointers before running the proto close function pointer. There is chance of kernel crash, due to usage of non proto close function pointers after proto close.
--- drivers/bluetooth/hci_serdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/hci_serdev.c +1 -0
@@ -368,6 +368,7 @@ void hci_uart_unregister_device(struct hci_uart *hu) {struct hci_dev *hdev = hu->hdev; +clear_bit (HCI_UART_PROTO_READY , &hu->flags);hci_unregister_dev (hdev);hci_free_dev (hdev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 154/191 Bluetooth: L2CAP: Detect if remote is not able to use the whole MPS
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit a5c3021bb62b970713550db3f7fd08aa70665d7e ]
If the remote is not able to fully utilize the MPS choosen recalculate the credits based on the actual amount it is sending that way it can still send packets of MTU size without credits dropping to 0.
--- net/bluetooth/l2cap_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/bluetooth/l2cap_core.c +10 -0
@@ -6819,6 +6819,16 @@ static int l2cap_le_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb) chan->sdu_len = sdu_len; chan->sdu_last_frag = skb; +/* Detect if remote is not able to use the selected MPS */ +if (skb->len +L2CAP_SDULEN_SIZE < chan->mps) { +u16 mps_len = skb->len +L2CAP_SDULEN_SIZE ; + +/* Adjust the number of credits */ +BT_DBG ("chan->mps %u -> %u" , chan->mps, mps_len); + chan->mps = mps_len; +l2cap_chan_le_send_credits (chan); + } +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 155/191 Bluetooth: btrsi: fix bt tx timeout issue
In reply to Sasha LevinFrom: Sanjay Kumar Konduri <[email protected]>
[ Upstream commit 7cbfd1e2aad410d96fa6162aeb3f9cff1fecfc58 ]
observed sometimes data is coming with unaligned address from kernel BT stack. If unaligned address is passed, some data in payload is stripped when packet is loading to firmware and this results, BT connection timeout is happening.
sh# hciconfig hci0 up
Can't init device hci0: hci0 command 0x0c03 tx timeout
Fixed this by moving the data to aligned address.
--- drivers/bluetooth/btrsi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/bluetooth/btrsi.c +12 -1
@@ -21,8 +21,9 @@#include <net/rsi_91x.h> #include <net/genetlink.h> -#define RSI_HEADROOM_FOR_BT_HAL 16 +#define RSI_DMA_ALIGN 8#define RSI_FRAME_DESC_SIZE 16 +#define RSI_HEADROOM_FOR_BT_HAL (RSI_FRAME_DESC_SIZE + RSI_DMA_ALIGN)struct rsi_hci_adapter {void *priv;
@@ -70,6 +71,16 @@ static int rsi_hci_send_pkt(struct hci_dev *hdev, struct sk_buff *skb)bt_cb (new_skb)->pkt_type =hci_skb_pkt_type (skb);kfree_skb (skb); skb = new_skb; +if (!IS_ALIGNED ((unsigned long )skb->data,RSI_DMA_ALIGN )) { +u8 *skb_data = skb->data; +int skb_len = skb->len; + +skb_push (skb,RSI_DMA_ALIGN ); +skb_pull (skb,PTR_ALIGN (skb->data, +RSI_DMA_ALIGN ) - skb->data); +memmove (skb->data, skb_data, skb_len); +skb_trim (skb, skb_len); + } } return h_adapter->proto_ops->coex_send_pkt(h_adapter->priv, skb,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 156/191 x86/hyperv: Suppress "PCI: Fatal: No config space access function found"
In reply to Sasha LevinFrom: Dexuan Cui <[email protected]>
[ Upstream commit 2f285f46240d67060061d153786740d4df53cd78 ]
A Generation-2 Linux VM on Hyper-V doesn't have the legacy PCI bus, and users always see the scary warning, which is actually harmless.
Suppress it.
--- arch/x86/hyperv/hv_init.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/x86/hyperv/hv_init.c +19 -0
@@ -17,6 +17,7 @@* */ +#include <linux/efi.h> #include <linux/types.h> #include <asm/apic.h> #include <asm/desc.h>
@@ -257,6 +258,22 @@ static int hv_cpu_die(unsigned int cpu)return 0 ; } +static int __init hv_pci_init (void ) +{ +int gen2vm =efi_enabled (EFI_BOOT ); + +/* +* For Generation-2 VM, we exit from pci_arch_init() by returning 0. +* The purpose is to suppress the harmless warning: +* "PCI: Fatal: No config space access function found" +*/ +if (gen2vm) +return 0 ; + +/* For Generation-1 VM, we'll proceed in pci_arch_init(). */ +return 1 ; +} +/* * This function is to be invoked early in the boot sequence after the * hypervisor has been detected.
@@ -333,6 +350,8 @@ void __init hyperv_init(void)hv_apic_init (); + x86_init.pci.arch_init = hv_pci_init; +/* * Register Hyper-V specific clocksource. */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 157/191 crypto: s5p-sss: Fix race in error handling
In reply to Sasha LevinFrom: Christoph Manszewski <[email protected]>
[ Upstream commit 5842cd44786055231b233ed5ed98cdb63ffb7db3 ]
Remove a race condition introduced by error path in functions:s5p_aes_interrupt and s5p_aes_crypt_start. Setting the busy field of struct s5p_aes_dev to false made it possible for s5p_tasklet_cb to change the req field, before s5p_aes_complete was called.
Change the first parameter of s5p_aes_complete to struct ablkcipher_request. Before spin_unlock, make a copy of the currently handled request, to ensure s5p_aes_complete function call with the correct request.
--- drivers/crypto/s5p-sss.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/crypto/s5p-sss.c +7 -5
@@ -475,9 +475,9 @@ static void s5p_sg_done(struct s5p_aes_dev *dev) }/* Calls the completion. Cannot be called with dev->lock hold. */ -static void s5p_aes_complete (struct s5p_aes_dev *dev,int err) +static void s5p_aes_complete (struct ablkcipher_request *req,int err) { - dev->req->base.complete (&dev->req->base, err); + req->base.complete (&req->base, err); }static void s5p_unset_outdata (struct s5p_aes_dev *dev)
@@ -655,6 +655,7 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id) {struct platform_device *pdev = dev_id;struct s5p_aes_dev *dev =platform_get_drvdata (pdev); +struct ablkcipher_request *req;int err_dma_tx =0 ;int err_dma_rx =0 ;int err_dma_hx =0 ;
@@ -727,7 +728,7 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id)spin_unlock_irqrestore (&dev->lock, flags); -s5p_aes_complete (dev,0 ); +s5p_aes_complete (dev->req,0 );/* Device is still busy */ tasklet_schedule (&dev->tasklet); }else {
@@ -752,11 +753,12 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id) error:s5p_sg_done (dev); dev->busy = false; + req = dev->req;if (err_dma_hx ==1 )s5p_set_dma_hashdata (dev, dev->hash_sg_iter);spin_unlock_irqrestore (&dev->lock, flags); -s5p_aes_complete (dev, err); +s5p_aes_complete (req, err); hash_irq_end:/*
@@ -1983,7 +1985,7 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)s5p_sg_done (dev); dev->busy = false;spin_unlock_irqrestore (&dev->lock, flags); -s5p_aes_complete (dev, err); +s5p_aes_complete (req, err); }static void s5p_tasklet_cb (unsigned long data)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 158/191 crypto: s5p-sss: Fix Fix argument list alignment
In reply to Sasha LevinFrom: Christoph Manszewski <[email protected]>
[ Upstream commit 6c12b6ba45490eeb820fdceccf5a53f42a26799c ]
Fix misalignment of continued argument list.
--- drivers/crypto/s5p-sss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/s5p-sss.c +2 -2
@@ -491,7 +491,7 @@ static void s5p_unset_indata(struct s5p_aes_dev *dev) }static int s5p_make_sg_cpy (struct s5p_aes_dev *dev,struct scatterlist *src, -struct scatterlist **dst) +struct scatterlist **dst) {void *pages;int len;
@@ -1889,7 +1889,7 @@ static int s5p_set_indata_start(struct s5p_aes_dev *dev, }static int s5p_set_outdata_start (struct s5p_aes_dev *dev, -struct ablkcipher_request *req) +struct ablkcipher_request *req) {struct scatterlist *sg;int err;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 159/191 crypto: fix a memory leak in rsa-kcs1pad's encryption mode
In reply to Sasha LevinFrom: Dan Aloni <[email protected]>
[ Upstream commit 3944f139d5592790b70bc64f197162e643a8512b ]
The encryption mode of pkcs1pad never uses out_sg and out_buf, so there's no need to allocate the buffer, which presently is not even being freed.
--- crypto/rsa-pkcs1pad.c | 9 --------- 1 file changed, 9 deletions(-)
crypto/rsa-pkcs1pad.c +0 -9
@@ -261,15 +261,6 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)pkcs1pad_sg_set_buf (req_ctx->in_sg, req_ctx->in_buf, ctx->key_size -1 - req->src_len, req->src); - req_ctx->out_buf =kmalloc (ctx->key_size,GFP_KERNEL ); -if (!req_ctx->out_buf) { -kfree (req_ctx->in_buf); -return -ENOMEM ; - } - -pkcs1pad_sg_set_buf (req_ctx->out_sg, req_ctx->out_buf, - ctx->key_size,NULL ); -akcipher_request_set_tfm (&req_ctx->child_req, ctx->child);akcipher_request_set_callback (&req_ctx->child_req, req->base.flags, pkcs1pad_encrypt_sign_complete_cb, req);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 160/191 iwlwifi: dbg: don't crash if the firmware crashes in the middle of a debug dump
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 79f25b10c9da3dbc953e47033d0494e51580ac3b ]
We can dump data from the firmware either when it crashes, or when the firmware is alive.
Not all the data is available if the firmware is running (like the Tx / Rx FIFOs which are available only when the firmware is halted), so we first check that the firmware is alive to compute the required size for the dump and then fill the buffer with the data.
When we allocate the buffer, we test the STATUS_FW_ERROR bit to check if the firmware is alive or not. This bit can be changed during the course of the dump since it is modified in the interrupt handler.
We hit a case where we allocate the buffer while the firmware is sill working, and while we start to fill the buffer, the firmware crashes. Then we test STATUS_FW_ERROR again and decide to fill the buffer with data like the FIFOs even if no room was allocated for this data in the buffer. This means that we overflow the buffer that was allocated leading to memory corruption.
To fix this, test the STATUS_FW_ERROR bit only once and rely on local variables to check if we should dump fifos or other firmware components.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1 -1
@@ -824,7 +824,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt) }/* We only dump the FIFOs if the FW is in error state */ -if (test_bit (STATUS_FW_ERROR , &fwrt->trans->status)) { +if (fifo_data_len) {iwl_fw_dump_fifos (fwrt, &dump_data);if (radio_len)iwl_read_radio_regs (fwrt, &dump_data);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 161/191 iwlwifi: fix non_shared_ant for 22000 devices
In reply to Sasha LevinFrom: Erel Geron <[email protected]>
[ Upstream commit a40287727d9b737e183959fd31a4e0c55f312853 ]
The non-shared antenna was wrong for 22000 device series. Fix it to ANT_B for correct antenna preference by coex in MVM driver.
--- drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/cfg/22000.c +1 -1
@@ -143,7 +143,7 @@ static const struct iwl_ht_params iwl_22000_ht_params = { .ucode_api_min = IWL_22000_UCODE_API_MIN, \ .led_mode = IWL_LED_RF_STATE, \ .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_22000, \ - .non_shared_ant = ANT_A, \ + .non_shared_ant = ANT_B, \ .dccm_offset = IWL_22000_DCCM_OFFSET, \ .dccm_len = IWL_22000_DCCM_LEN, \ .dccm2_offset = IWL_22000_DCCM2_OFFSET, \
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 162/191 iwlwifi: pcie: read correct prph address for newer devices
In reply to Sasha LevinFrom: Sara Sharon <[email protected]>
[ Upstream commit 84fb372c892e231e9a2ffdaa5c2df52d94aa536c ]
For newer devices we have higher range of periphery addresses. Currently it is masked out, so we end up reading another address.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +14 -2
@@ -1830,18 +1830,30 @@ static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs)return readl (IWL_TRANS_GET_PCIE_TRANS (trans)->hw_base + ofs); } +static u32 iwl_trans_pcie_prph_msk (struct iwl_trans *trans) +{ +if (trans->cfg->device_family >=IWL_DEVICE_FAMILY_22560 ) +return 0x00FFFFFF ; +else +return 0x000FFFFF ; +} +static u32 iwl_trans_pcie_read_prph (struct iwl_trans *trans,u32 reg) { +u32 mask =iwl_trans_pcie_prph_msk (trans); +iwl_trans_pcie_write32 (trans,HBUS_TARG_PRPH_RADDR , - ((reg &0x000FFFFF ) | (3 <<24 ))); + ((reg & mask) | (3 <<24 )));return iwl_trans_pcie_read32 (trans,HBUS_TARG_PRPH_RDAT ); }static void iwl_trans_pcie_write_prph (struct iwl_trans *trans,u32 addr,u32 val) { +u32 mask =iwl_trans_pcie_prph_msk (trans); +iwl_trans_pcie_write32 (trans,HBUS_TARG_PRPH_WADDR , - ((addr &0x000FFFFF ) | (3 <<24 ))); + ((addr & mask) | (3 <<24 )));iwl_trans_pcie_write32 (trans,HBUS_TARG_PRPH_WDAT , val); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 163/191 iwlwifi: api: annotate compressed BA notif array sizes
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 6f68cc367ab6578a33cca21b6056804165621f00 ]
Annotate the compressed BA notification array sizes and make both of them 0-length since the length of 1 is just confusing - it may be different than that and the offset to the second one needs to be calculated in the C code anyhow.
--- drivers/net/wireless/intel/iwlwifi/fw/api/tx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/tx.h +3 -3
@@ -747,9 +747,9 @@ enum iwl_mvm_ba_resp_flags {* @tfd_cnt: number of TFD-Q elements * @ra_tid_cnt: number of RATID-Q elements * @tfd: array of TFD queue status updates. See &iwl_mvm_compressed_ba_tfd -* for details. +* for details. Length in @tfd_cnt. * @ra_tid: array of RA-TID queue status updates. For debug purposes only. See -* &iwl_mvm_compressed_ba_ratid for more details. +* &iwl_mvm_compressed_ba_ratid for more details. Length in @ra_tid_cnt. */ struct iwl_mvm_compressed_ba_notif {__le32 flags;
@@ -766,7 +766,7 @@ struct iwl_mvm_compressed_ba_notif {__le32 tx_rate;__le16 tfd_cnt;__le16 ra_tid_cnt; -struct iwl_mvm_compressed_ba_tfd tfd[1 ]; +struct iwl_mvm_compressed_ba_tfd tfd[0 ];struct iwl_mvm_compressed_ba_ratid ra_tid[0 ]; } __packed;/* COMPRESSED_BA_RES_API_S_VER_4 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 164/191 iwlwifi: pcie: gen2: build A-MSDU only for GSO
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 53f474e6a8d74d5dc0c3a015d889471f9a157685 ]
If the incoming frame should be an A-MSDU, it may already be one, for example in the case of NAN multicast being encapsulated in an A-MSDU. Thus, use the GSO algorithm to build A-MSDU only if the skb actually contains GSO data.
--- drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +6 -1
@@ -526,7 +526,12 @@ struct iwl_tfh_tfd *iwl_pcie_gen2_build_tfd(struct iwl_trans *trans, hdr_len =ieee80211_hdrlen (hdr->frame_control); -if (amsdu) +/* +* Only build A-MSDUs here if doing so by GSO, otherwise it may be +* an A-MSDU for other reasons, e.g. NAN or an A-MSDU having been +* built in the higher layers already. +*/ +if (amsdu &&skb_shinfo (skb)->gso_size)return iwl_pcie_gen2_build_tx_amsdu (trans, txq, dev_cmd, skb, out_meta, hdr_len, len);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 165/191 iwlwifi: pcie: fit reclaim msg to MAX_MSG_LEN
In reply to Sasha LevinFrom: Golan Ben Ami <[email protected]>
[ Upstream commit 81f0c66187e1ebb7b63529d82faf7ff1e0ef428a ]
Today, the length of a debug message in iwl_trans_pcie_reclaim may pass the MAX_MSG_LEN, which is 110.
An example for this kind of message is:
'iwl_trans_pcie_reclaim: Read index for DMA queue txq id (2), last_to_free 65535 is out of range [0-65536] 2 2.'
Cut the message a bit so it will fit the allowed MAX_MSG_LEN.
--- drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/tx.c +1 -1
@@ -1103,7 +1103,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,if (!iwl_queue_used (txq, last_to_free)) {IWL_ERR (trans, -"%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n" , +"%s: Read index for txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n" , __func__, txq_id, last_to_free, trans->cfg->base_params->max_tfd_queue_size, txq->write_ptr, txq->read_ptr);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 166/191 iwlwifi: mvm: use correct FIFO length
In reply to Sasha LevinFrom: Sara Sharon <[email protected]>
[ Upstream commit 7126b6f2bbdf8e25f85e7ca6d91d49ea4ce9f6a6 ]
Current FIFO size calculation is wrong for two reasons:
- We access lmac 0 by default
- We don't take 11ax into consideration.
Fix both.
--- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 4 ++ drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 47 +++++++++++++------ 2 files changed, 36 insertions(+), 15 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +4 -0
@@ -85,6 +85,10 @@ const u8 iwl_mvm_ac_to_gen2_tx_fifo[] = {IWL_GEN2_EDCA_TX_FIFO_VI ,IWL_GEN2_EDCA_TX_FIFO_BE ,IWL_GEN2_EDCA_TX_FIFO_BK , +IWL_GEN2_TRIG_TX_FIFO_VO , +IWL_GEN2_TRIG_TX_FIFO_VI , +IWL_GEN2_TRIG_TX_FIFO_BE , + IWL_GEN2_TRIG_TX_FIFO_BK, }; struct iwl_mvm_mac_iface_iterator_data {
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +32 -15
65 lines not on this page · raw message
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 167/191 iwlwifi: mvm: Allow TKIP for AP mode
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 6f3df8c1192c873a6ad9a76328920f6f85af90a8 ]
Support for setting keys for TKIP cipher suite was mistakenly removed for AP mode. Fix this.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +0 -4
@@ -3133,10 +3133,6 @@ static int __iwl_mvm_set_sta_key(struct iwl_mvm *mvm,switch (keyconf->cipher) {case WLAN_CIPHER_SUITE_TKIP : -if (vif->type ==NL80211_IFTYPE_AP ) { - ret = -EINVAL ; -break ; - } addr =iwl_mvm_get_mac_addr (mvm, vif, sta);/* get phase 1 key from mac80211 */ ieee80211_get_key_rx_seq (keyconf,0 , &seq);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 168/191 scsi: NCR5380: Clear all unissued commands on host reset
In reply to Sasha LevinFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 1aeeeed7f03c576f096eede7b0384f99a98f588c ]
When doing a host reset we should be clearing all outstanding commands, not just the command triggering the reset.
[mkp: adjusted Hannes' SoB address]
--- drivers/scsi/NCR5380.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/NCR5380.c +5 -2
@@ -2303,7 +2303,7 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)spin_lock_irqsave (&hostdata->lock, flags);#if (NDEBUG &NDEBUG_ANY ) -scmd_printk (KERN_INFO , cmd, __func__); +shost_printk (KERN_INFO , instance, __func__);#endif NCR5380_dprint (NDEBUG_ANY , instance);NCR5380_dprint_phase (NDEBUG_ANY , instance);
@@ -2321,10 +2321,13 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)* commands! */ -if (list_del_cmd (&hostdata->unissued, cmd)) { +list_for_each_entry (ncmd, &hostdata->unissued, list) { +struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); + cmd->result =DID_RESET <<16 ; cmd->scsi_done (cmd); } +INIT_LIST_HEAD (&hostdata->unissued);if (hostdata->selecting) { hostdata->selecting->result =DID_RESET <<16 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 169/191 scsi: NCR5380: Have NCR5380_select() return a bool
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit dad8261e643849ea134c7cd5c8e794e31d93b9eb ]
The return value is taken to mean "retry" or "don't retry". Change it to bool to improve readability. Fix related comments. No functional change.
--- drivers/scsi/NCR5380.c | 46 +++++++++++++++++++----------------------- drivers/scsi/NCR5380.h | 2 +- 2 files changed, 22 insertions(+), 26 deletions(-)
drivers/scsi/NCR5380.c +21 -25
@@ -904,20 +904,16 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id)return IRQ_RETVAL (handled); } -/* -* Function : int NCR5380_select(struct Scsi_Host *instance, -* struct scsi_cmnd *cmd) -* -* Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, -* including ARBITRATION, SELECTION, and initial message out for -* IDENTIFY and queue messages. +/** +* NCR5380_select - attempt arbitration and selection for a given command +* @instance: the Scsi_Host instance +* @cmd: the scsi_cmnd to execute * -* Inputs : instance - instantiation of the 5380 driver on which this -* target lives, cmd - SCSI command to execute. +* This routine establishes an I_T_L nexus for a SCSI command. This involves +* ARBITRATION, SELECTION and MESSAGE OUT phases and an IDENTIFY message. * -* Returns cmd if selection failed but should be retried, -* NULL if selection failed and should not be retried, or -* NULL if selection succeeded (hostdata->connected == cmd). +* Returns true if the operation should be retried. +* Returns false if it should not be retried. * * Side effects : * If bus busy, arbitration failed, etc, NCR5380_select() will exit
@@ -925,16 +921,15 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id)* SELECT_ENABLE will be set appropriately, the NCR5380 * will cease to drive any SCSI bus signals. * -* If successful : I_T_L or I_T_L_Q nexus will be established, -* instance->connected will be set to cmd. +* If successful : the I_T_L nexus will be established, and +* hostdata->connected will be set to cmd. * SELECT interrupt will be disabled. * * If failed (no target) : cmd->scsi_done() will be called, and the * cmd->result host byte set to DID_BAD_TARGET. */ -static struct scsi_cmnd *NCR5380_select (struct Scsi_Host *instance, -struct scsi_cmnd *cmd) +static bool NCR5380_select (struct Scsi_Host *instance,struct scsi_cmnd *cmd) __releases(&hostdata->lock) __acquires(&hostdata->lock) {struct NCR5380_hostdata *hostdata =shost_priv (instance);
@@ -942,6 +937,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,unsigned char *data;int len;int err; +bool ret = true;NCR5380_dprint (NDEBUG_ARBITRATION , instance); dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n",
@@ -950,7 +946,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,/* * Arbitration and selection phases are slow and involve dropping the * lock, so we have to watch out for EH. An exception handler may -* change 'selecting' to NULL. This function will then return NULL +* change 'selecting' to NULL. This function will then return false * so that the caller will forget about 'cmd'. (During information * transfer phases, EH may change 'connected' to NULL.) */
@@ -986,7 +982,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,if (!hostdata->selecting) {/* Command was aborted */ NCR5380_write (MODE_REG ,MR_BASE ); -return NULL ; +return false; }if (err <0 ) {NCR5380_write (MODE_REG ,MR_BASE );
@@ -1035,7 +1031,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,if (!hostdata->selecting) {NCR5380_write (MODE_REG ,MR_BASE );NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -return NULL ; +return false; }dsprintk (NDEBUG_ARBITRATION , instance,"won arbitration\n" );
@@ -1118,13 +1114,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,/* Can't touch cmd if it has been reclaimed by the scsi ML */ if (!hostdata->selecting) -return NULL ; +return false; cmd->result =DID_BAD_TARGET <<16 ;complete_cmd (instance, cmd);dsprintk (NDEBUG_SELECTION , instance,"target did not respond within 250ms\n" ); - cmd =NULL ; + ret = false; goto out; }
@@ -1156,7 +1152,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, }if (!hostdata->selecting) {do_abort (instance); -return NULL ; +return false; } dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
@@ -1172,7 +1168,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, cmd->result =DID_ERROR <<16 ;complete_cmd (instance, cmd);dsprintk (NDEBUG_SELECTION , instance,"IDENTIFY message transfer failed\n" ); - cmd =NULL ; + ret = false; goto out; }
@@ -1187,13 +1183,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,initialize_SCp (cmd); - cmd =NULL ; + ret = false; out:if (!hostdata->selecting)return NULL ; hostdata->selecting =NULL ; -return cmd; +return ret; }/*
drivers/scsi/NCR5380.h +1 -1
@@ -275,7 +275,7 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id);static void NCR5380_main (struct work_struct *work);static const char *NCR5380_info (struct Scsi_Host *instance);static void NCR5380_reselect (struct Scsi_Host *instance); -static struct scsi_cmnd *NCR5380_select (struct Scsi_Host *,struct scsi_cmnd *); +static bool NCR5380_select (struct Scsi_Host *,struct scsi_cmnd *);static int NCR5380_transfer_dma (struct Scsi_Host *instance,unsigned char *phase,int *count,unsigned char **data);static int NCR5380_transfer_pio (struct Scsi_Host *instance,unsigned char *phase,int *count,unsigned char **data); static int NCR5380_poll_politely2(struct NCR5380_hostdata *,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 170/191 scsi: NCR5380: Withhold disconnect privilege for REQUEST SENSE
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 7c8ed783c2faa1e3f741844ffac41340338ea0f4 ]
This is mostly needed because an AztecMonster II target has been observed disconnecting REQUEST SENSE commands and then failing to reselect properly.
--- drivers/scsi/NCR5380.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/NCR5380.c +3 -1
@@ -938,6 +938,8 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)int len;int err;bool ret = true; +bool can_disconnect = instance->irq !=NO_IRQ && + cmd->cmnd[0 ] !=REQUEST_SENSE ;NCR5380_dprint (NDEBUG_ARBITRATION , instance); dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n",
@@ -1157,7 +1159,7 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)dsprintk (NDEBUG_SELECTION , instance,"target %d selected, going into MESSAGE OUT phase.\n" ,scmd_id (cmd)); - tmp[0 ] =IDENTIFY (((instance->irq ==NO_IRQ ) ?0 :1 ), cmd->device->lun); + tmp[0 ] =IDENTIFY (can_disconnect, cmd->device->lun); len =1 ; data = tmp;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 171/191 scsi: NCR5380: Use DRIVER_SENSE to indicate valid sense data
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 070356513963be6196142acff56acc8359069fa1 ]
When sense data is valid, call set_driver_byte(cmd, DRIVER_SENSE). Otherwise some callers of scsi_execute() will ignore sense data. Don't set DID_ERROR or DID_RESET just because sense data is missing.
--- drivers/scsi/NCR5380.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/scsi/NCR5380.c +4 -5
@@ -513,11 +513,12 @@ static void complete_cmd(struct Scsi_Host *instance,if (hostdata->sensing == cmd) {/* Autosense processing ends here */ -if ((cmd->result &0xff ) !=SAM_STAT_GOOD ) { +if (status_byte (cmd->result) !=GOOD ) {scsi_eh_restore_cmnd (cmd, &hostdata->ses); -set_host_byte (cmd,DID_ERROR ); - }else + }else {scsi_eh_restore_cmnd (cmd, &hostdata->ses); +set_driver_byte (cmd,DRIVER_SENSE ); + } hostdata->sensing =NULL ; }
@@ -2265,7 +2266,6 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)if (list_del_cmd (&hostdata->autosense, cmd)) {dsprintk (NDEBUG_ABORT , instance,"abort: removed %p from sense queue\n" , cmd); -set_host_byte (cmd,DID_ERROR );complete_cmd (instance, cmd); }
@@ -2344,7 +2344,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)list_for_each_entry (ncmd, &hostdata->autosense, list) {struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); -set_host_byte (cmd,DID_RESET ); cmd->scsi_done (cmd); }INIT_LIST_HEAD (&hostdata->autosense);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 172/191 scsi: NCR5380: Check for invalid reselection target
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 7ef55f6744c45e3d7c85a3f74ada39b67ac741dd ]
The X3T9.2 specification (draft) says, under "6.1.4.1 RESELECTION", that "the initiator shall not respond to a RESELECTION phase if other than two SCSI ID bits are on the DATA BUS." This issue (too many bits set) has been observed in the wild, so add a check.
--- drivers/scsi/NCR5380.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/NCR5380.c +5 -0
@@ -2008,6 +2008,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance)NCR5380_write (MODE_REG ,MR_BASE ); target_mask =NCR5380_read (CURRENT_SCSI_DATA_REG ) & ~(hostdata->id_mask); +if (!target_mask || target_mask & (target_mask -1 )) { +shost_printk (KERN_WARNING , instance, +"reselect: bad target_mask 0x%02x\n" , target_mask); +return ; + }dsprintk (NDEBUG_RESELECTION , instance,"reselect\n" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 173/191 scsi: NCR5380: Don't clear busy flag when abort fails
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 45ddc1b24806cc8f1a09f23dd4e7b6e4a8ae36e1 ]
When NCR5380_abort() returns FAILED, the driver forgets that the target is still busy. Hence, further commands may be sent to the target, which may fail during selection and produce the error message, "reselection after won arbitration?". Prevent this by leaving the busy flag set when NCR5380_abort() fails.
--- drivers/scsi/NCR5380.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/NCR5380.c +10 -4
@@ -522,8 +522,6 @@ static void complete_cmd(struct Scsi_Host *instance, hostdata->sensing =NULL ; } - hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun); - cmd->scsi_done (cmd); }
@@ -1711,6 +1709,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) cmd->result =DID_ERROR <<16 ;complete_cmd (instance, cmd); hostdata->connected =NULL ; + hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun);return ;#endif case PHASE_DATAIN :
@@ -1793,6 +1792,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) cmd, scmd_id(cmd), cmd->device->lun); hostdata->connected =NULL ; + hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun); cmd->result &= ~0xffff ; cmd->result |= cmd->SCp.Status;
@@ -1946,6 +1946,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)NCR5380_transfer_pio (instance, &phase, &len, &data);if (msgout ==ABORT ) { hostdata->connected =NULL ; + hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun); cmd->result =DID_ERROR <<16 ;complete_cmd (instance, cmd);maybe_release_dma_irq (instance);
@@ -2100,13 +2101,16 @@ static void NCR5380_reselect(struct Scsi_Host *instance)dsprintk (NDEBUG_RESELECTION |NDEBUG_QUEUES , instance,"reselect: removed %p from disconnected queue\n" , tmp); }else { +int target =ffs (target_mask) -1 ; +shost_printk (KERN_ERR , instance,"target bitmask 0x%02x lun %d not in disconnected queue.\n" , target_mask, lun);/* * Since we have an established nexus that we can't do anything * with, we must abort it. */ -do_abort (instance); +if (do_abort (instance) ==0 ) + hostdata->busy[target] &= ~(1 << lun);return ; }
@@ -2277,8 +2281,10 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) out:if (result ==FAILED )dsprintk (NDEBUG_ABORT , instance,"abort: failed to abort %p\n" , cmd); -else +else { + hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun);dsprintk (NDEBUG_ABORT , instance,"abort: successfully aborted %p\n" , cmd); + }queue_work (hostdata->work_q, &hostdata->main_task);maybe_release_dma_irq (instance);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 174/191 scsi: NCR5380: Don't call dsprintk() following reselection interrupt
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 08267216b3f8aa5adc204bdccf8deb72c1cd7665 ]
The X3T9.2 specification (draft) says, under "6.1.4.1 RESELECTION",
... The reselected initiator shall then assert the BSY signal within a selection abort time of its most recent detection of being reselected; this is required for correct operation of the time-out procedure.
The selection abort time is only 200 us which may be insufficient time for a printk() call. Move the diagnostics to the error paths.
--- drivers/scsi/NCR5380.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/NCR5380.c +2 -2
@@ -2015,8 +2015,6 @@ static void NCR5380_reselect(struct Scsi_Host *instance)return ; } -dsprintk (NDEBUG_RESELECTION , instance,"reselect\n" ); -/* * At this point, we have detected that our SCSI ID is on the bus, * SEL is true and BSY was false for at least one bus settle delay
@@ -2029,6 +2027,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_BSY );if (NCR5380_poll_politely (hostdata,STATUS_REG ,SR_SEL ,0 ,2 *HZ ) <0 ) { +shost_printk (KERN_ERR , instance,"reselect: !SEL timeout\n" );NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE );return ; }
@@ -2040,6 +2039,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)if (NCR5380_poll_politely (hostdata,STATUS_REG ,SR_REQ ,SR_REQ ,2 *HZ ) <0 ) { +shost_printk (KERN_ERR , instance,"reselect: REQ timeout\n" );do_abort (instance);return ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 175/191 scsi: NCR5380: Handle BUS FREE during reselection
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit ca694afad707cb3ae2fdef3b28454444d9ac726e ]
The X3T9.2 specification (draft) says, under "6.1.4.2 RESELECTION time-out procedure", that a target may assert RST or go to BUS FREE phase if the initiator does not respond within 200 us. Something like this has been observed with AztecMonster II target. When it happens, all we can do is wait for the target to try again.
--- drivers/scsi/NCR5380.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/NCR5380.c +3 -0
@@ -2039,6 +2039,9 @@ static void NCR5380_reselect(struct Scsi_Host *instance)if (NCR5380_poll_politely (hostdata,STATUS_REG ,SR_REQ ,SR_REQ ,2 *HZ ) <0 ) { +if ((NCR5380_read (STATUS_REG ) & (SR_BSY |SR_SEL )) ==0 ) +/* BUS FREE phase */ +return ;shost_printk (KERN_ERR , instance,"reselect: REQ timeout\n" );do_abort (instance);return ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 176/191 scsi: NCR5380: Check for bus reset
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 6b0e87a6aafe12d75c2bea6fc8e49e88b98b3083 ]
The SR_RST bit isn't latched. Hence, detecting a bus reset isn't reliable. When it is detected, the right thing to do is to drop all connected and disconnected commands. The code for that is already present so refactor it and call it when SR_RST is set.
--- drivers/scsi/NCR5380.c | 74 +++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 29 deletions(-)
drivers/scsi/NCR5380.c +45 -29
@@ -131,6 +131,7 @@static int do_abort (struct Scsi_Host *);static void do_reset (struct Scsi_Host *); +static void bus_reset_cleanup (struct Scsi_Host *);/** * initialize_SCp - init the scsi pointer field
@@ -885,7 +886,14 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id)/* Probably Bus Reset */ NCR5380_read (RESET_PARITY_INTERRUPT_REG ); -dsprintk (NDEBUG_INTR , instance,"unknown interrupt\n" ); +if (sr &SR_RST ) { +/* Certainly Bus Reset */ +shost_printk (KERN_WARNING , instance, +"bus reset interrupt\n" ); +bus_reset_cleanup (instance); + }else { +dsprintk (NDEBUG_INTR , instance,"unknown interrupt\n" ); + }#ifdef SUN3_SCSI_VME dregs->csr |=CSR_DMA_ENABLE ;#endif
@@ -2297,31 +2305,12 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) } -/** -* NCR5380_host_reset - reset the SCSI host -* @cmd: SCSI command undergoing EH -* -* Returns SUCCESS -*/ - -static int NCR5380_host_reset (struct scsi_cmnd *cmd) +static void bus_reset_cleanup (struct Scsi_Host *instance) { -struct Scsi_Host *instance = cmd->device->host;struct NCR5380_hostdata *hostdata =shost_priv (instance);int i; -unsigned long flags;struct NCR5380_cmd *ncmd; -spin_lock_irqsave (&hostdata->lock, flags); - -#if (NDEBUG &NDEBUG_ANY ) -shost_printk (KERN_INFO , instance, __func__); -#endif -NCR5380_dprint (NDEBUG_ANY , instance); -NCR5380_dprint_phase (NDEBUG_ANY , instance); - -do_reset (instance); -/* reset NCR registers */ NCR5380_write (MODE_REG ,MR_BASE );NCR5380_write (TARGET_COMMAND_REG ,0 );
@@ -2333,14 +2322,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)* commands! */ -list_for_each_entry (ncmd, &hostdata->unissued, list) { -struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); - - cmd->result =DID_RESET <<16 ; - cmd->scsi_done (cmd); - } -INIT_LIST_HEAD (&hostdata->unissued); -if (hostdata->selecting) { hostdata->selecting->result =DID_RESET <<16 ;complete_cmd (instance, hostdata->selecting);
@@ -2374,6 +2355,41 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)queue_work (hostdata->work_q, &hostdata->main_task);maybe_release_dma_irq (instance); +} + +/** +* NCR5380_host_reset - reset the SCSI host +* @cmd: SCSI command undergoing EH +* +* Returns SUCCESS +*/ + +static int NCR5380_host_reset (struct scsi_cmnd *cmd) +{ +struct Scsi_Host *instance = cmd->device->host; +struct NCR5380_hostdata *hostdata =shost_priv (instance); +unsigned long flags; +struct NCR5380_cmd *ncmd; + +spin_lock_irqsave (&hostdata->lock, flags); + +#if (NDEBUG &NDEBUG_ANY ) +shost_printk (KERN_INFO , instance, __func__); +#endif +NCR5380_dprint (NDEBUG_ANY , instance); +NCR5380_dprint_phase (NDEBUG_ANY , instance); + +list_for_each_entry (ncmd, &hostdata->unissued, list) { +struct scsi_cmnd *scmd =NCR5380_to_scmd (ncmd); + + scmd->result =DID_RESET <<16 ; + scmd->scsi_done (scmd); + } +INIT_LIST_HEAD (&hostdata->unissued); + +do_reset (instance); +bus_reset_cleanup (instance); +spin_unlock_irqrestore (&hostdata->lock, flags);return SUCCESS ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 177/191 arm64: dts: amd: Fix SPI bus warnings
In reply to Sasha LevinFrom: Rob Herring <[email protected]>
[ Upstream commit e9f0878c4b2004ac19581274c1ae4c61ae3ca70e ]
dtc has new checks for SPI buses. Fix the warnings in node names.
arch/arm64/boot/dts/amd/amd-overdrive.dtb: Warning (spi_bus_bridge): /smb/ssp@e1030000: node name for SPI buses should be 'spi' arch/arm64/boot/dts/amd/amd-overdrive-rev-b0.dtb: Warning (spi_bus_bridge): /smb/ssp@e1030000: node name for SPI buses should be 'spi' arch/arm64/boot/dts/amd/amd-overdrive-rev-b1.dtb: Warning (spi_bus_bridge): /smb/ssp@e1030000: node name for SPI buses should be 'spi'
--- arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi +2 -2
@@ -107,7 +107,7 @@ clock-names = "uartclk", "apb_pclk"; }; - spi0: ssp@e1020000 { + spi0: spi@e1020000 { status = "disabled"; compatible = "arm,pl022", "arm,primecell"; reg = <0 0xe1020000 0 0x1000>;
@@ -117,7 +117,7 @@ clock-names = "apb_pclk"; }; - spi1: ssp@e1030000 { + spi1: spi@e1030000 { status = "disabled"; compatible = "arm,pl022", "arm,primecell"; reg = <0 0xe1030000 0 0x1000>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 178/191 arm64: dts: lg: Fix SPI controller node names
In reply to Sasha LevinFrom: Rob Herring <[email protected]>
[ Upstream commit 09bae3b64cb580c95329bd8d16f08f0a5cb81ec9 ]
SPI controller nodes should be named 'spi' rather than 'ssp'. Fixing the name enables dtc SPI bus checks.
--- arch/arm64/boot/dts/lg/lg1312.dtsi | 4 ++-- arch/arm64/boot/dts/lg/lg1313.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/lg/lg1312.dtsi +2 -2
@@ -168,14 +168,14 @@ clock-names = "apb_pclk"; status="disabled"; }; - spi0: ssp@fe800000 { + spi0: spi@fe800000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x0 0xfe800000 0x1000>; interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk_bus>; clock-names = "apb_pclk"; }; - spi1: ssp@fe900000 { + spi1: spi@fe900000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x0 0xfe900000 0x1000>; interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
arch/arm64/boot/dts/lg/lg1313.dtsi +2 -2
@@ -168,14 +168,14 @@ clock-names = "apb_pclk"; status="disabled"; }; - spi0: ssp@fe800000 { + spi0: spi@fe800000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x0 0xfe800000 0x1000>; interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk_bus>; clock-names = "apb_pclk"; }; - spi1: ssp@fe900000 { + spi1: spi@fe900000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x0 0xfe900000 0x1000>; interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 179/191 ARM: dts: lpc32xx: Fix SPI controller node names
In reply to Sasha LevinFrom: Rob Herring <[email protected]>
[ Upstream commit 11236ef582b8d66290bb3b3710e03ca1d85d8ad8 ]
SPI controller nodes should be named 'spi' rather than 'ssp'. Fixing the name enables dtc SPI bus checks.
--- arch/arm/boot/dts/lpc32xx.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/lpc32xx.dtsi +2 -2
@@ -179,7 +179,7 @@ * ssp0 and spi1 are shared pins; * enable one in your board dts, as needed. */ - ssp0: ssp@20084000 { + ssp0: spi@20084000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x20084000 0x1000>; interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
@@ -199,7 +199,7 @@ * ssp1 and spi2 are shared pins; * enable one in your board dts, as needed. */ - ssp1: ssp@2008c000 { + ssp1: spi@2008c000 { compatible = "arm,pl022", "arm,primecell"; reg = <0x2008c000 0x1000>; interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 180/191 rtc: isl1208: avoid possible sysfs race
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit 1b4c794fda583edabe864ac466e9cd43c707be80 ]
Use rtc_add_group to add the common sysfs group to avoid a possible race condition.
The move of atrim, dtrim usr sysfs properties from i2c device to rtc device require to access them via dev->parent. This patch also aligns timestamp0.
--- drivers/rtc/rtc-isl1208.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
drivers/rtc/rtc-isl1208.c +10 -17
@@ -518,7 +518,7 @@ static ssize_t timestamp0_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = dev_get_drvdata(dev); + struct i2c_client *client = to_i2c_client(dev->parent);int sr; sr =isl1208_i2c_get_sr (client);
@@ -540,7 +540,7 @@ static ssize_t timestamp0_store(struct device *dev,static ssize_t timestamp0_show (struct device *dev,struct device_attribute *attr,char *buf) { -struct i2c_client *client =dev_get_drvdata (dev); +struct i2c_client *client =to_i2c_client (dev->parent);u8 regs[ISL1219_EVT_SECTION_LEN ] = {0 , };struct rtc_time tm;int sr;
@@ -650,7 +650,7 @@ static ssize_t isl1208_sysfs_show_atrim(struct device *dev, struct device_attribute *attr, char *buf) { - int atr = isl1208_i2c_get_atr(to_i2c_client(dev)); + int atr = isl1208_i2c_get_atr(to_i2c_client(dev->parent));if (atr <0 )return atr;
@@ -663,7 +663,7 @@ static ssize_t isl1208_sysfs_show_dtrim(struct device *dev, struct device_attribute *attr, char *buf) { - int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev)); + int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev->parent));if (dtr <0 )return dtr;
@@ -676,7 +676,7 @@ static ssize_t isl1208_sysfs_show_usr(struct device *dev, struct device_attribute *attr, char *buf) { - int usr = isl1208_i2c_get_usr(to_i2c_client(dev)); + int usr = isl1208_i2c_get_usr(to_i2c_client(dev->parent));if (usr <0 )return usr;
@@ -701,7 +701,10 @@ isl1208_sysfs_store_usr(struct device *dev,if (usr <0 || usr >0xffff )return -EINVAL ; -return isl1208_i2c_set_usr (to_i2c_client (dev), usr) ? -EIO : count; +if (isl1208_i2c_set_usr (to_i2c_client (dev->parent), usr)) +return -EIO ; + +return count; } static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr,
@@ -765,7 +768,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) rtc->ops = &isl1208_rtc_ops;i2c_set_clientdata (client, rtc); -dev_set_drvdata (&rtc->dev, client); rc =isl1208_i2c_get_sr (client);if (rc <0 ) {
@@ -804,7 +806,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) evdet_irq =of_irq_get_byname (np,"evdet" ); } - rc =sysfs_create_group (&client->dev.kobj, &isl1208_rtc_sysfs_files); + rc =rtc_add_group (rtc, &isl1208_rtc_sysfs_files);if (rc)return rc;
@@ -821,14 +823,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)return rtc_register_device (rtc); } -static int -isl1208_remove (struct i2c_client *client) -{ -sysfs_remove_group (&client->dev.kobj, &isl1208_rtc_sysfs_files); - -return 0 ; -} -static const struct i2c_device_id isl1208_id[] = { {"isl1208" ,TYPE_ISL1208 }, {"isl1218" ,TYPE_ISL1218 },
@@ -851,7 +845,6 @@ static struct i2c_driver isl1208_driver = { .of_match_table = of_match_ptr(isl1208_of_match), }, .probe = isl1208_probe, - .remove = isl1208_remove, .id_table = isl1208_id, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 181/191 rtc: tx4939: fixup nvmem name and register size
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit 2ab78755e93a10f6216c860a2012f3592f395603 ]
The default word_size and stride of 1 are correct for the tx4939. Also fix the nvmem folder name.
--- drivers/rtc/rtc-tx4939.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-tx4939.c +1 -3
@@ -253,9 +253,7 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev)struct resource *res;int irq, ret;struct nvmem_config nvmem_cfg = { - .name ="rv8803_nvram" , - .word_size =4 , - .stride =4 , + .name ="tx4939_nvram" , .size =TX4939_RTC_REG_RAMSIZE , .reg_read = tx4939_nvram_read, .reg_write = tx4939_nvram_write,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 182/191 rtc: armada38x: fix possible race condition
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit 7d61cbb945a753af08e247b5f10bdd5dbb8d6c80 ]
The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference.
Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ.
--- drivers/rtc/rtc-armada38x.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/rtc/rtc-armada38x.c +11 -11
@@ -514,7 +514,6 @@ MODULE_DEVICE_TABLE(of, armada38x_rtc_of_match_table);static __init int armada38x_rtc_probe (struct platform_device *pdev) { -const struct rtc_class_ops *ops;struct resource *res;struct armada38x_rtc *rtc;const struct of_device_id *match;
@@ -551,6 +550,11 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)dev_err (&pdev->dev,"no irq\n" );return rtc->irq; } + + rtc->rtc_dev =devm_rtc_allocate_device (&pdev->dev); +if (IS_ERR (rtc->rtc_dev)) +return PTR_ERR (rtc->rtc_dev); +if (devm_request_irq (&pdev->dev, rtc->irq, armada38x_rtc_alarm_irq,0 , pdev->name, rtc) <0 ) {dev_warn (&pdev->dev,"Interrupt not available.\n" );
@@ -560,28 +564,24 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)if (rtc->irq !=-1 ) {device_init_wakeup (&pdev->dev,1 ); - ops = &armada38x_rtc_ops; + rtc->rtc_dev->ops = &armada38x_rtc_ops; }else {/* * If there is no interrupt available then we can't * use the alarm */ - ops = &armada38x_rtc_ops_noirq; + rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq; } rtc->data = (struct armada38x_rtc_data *)match->data; -/* Update RTC-MBUS bridge timing parameters */ rtc->data->update_mbus_timing (rtc); - rtc->rtc_dev =devm_rtc_device_register (&pdev->dev, pdev->name, - ops,THIS_MODULE ); -if (IS_ERR (rtc->rtc_dev)) { - ret =PTR_ERR (rtc->rtc_dev); + ret =rtc_register_device (rtc->rtc_dev); +if (ret)dev_err (&pdev->dev,"Failed to register RTC device: %d\n" , ret); -return ret; - } -return 0 ; + +return ret; }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 183/191 netfilter: masquerade: don't flush all conntracks if only one address deleted on device
In reply to Sasha LevinFrom: Tan Hu <[email protected]>
[ Upstream commit 097f95d319f817e651bd51f8846aced92a55a6a1 ]
We configured iptables as below, which only allowed incoming data on established connections:
iptables -t mangle -A PREROUTING -m state --state ESTABLISHED -j ACCEPT iptables -t mangle -P PREROUTING DROP
When deleting a secondary address, current masquerade implements would flush all conntracks on this device. All the established connections on primary address also be deleted, then subsequent incoming data on the connections would be dropped wrongly because it was identified as NEW connection.
So when an address was delete, it should only flush connections related with the address.
--- net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | 22 ++++++++++++++++++--- net/ipv6/netfilter/nf_nat_masquerade_ipv6.c | 19 +++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-)
net/ipv4/netfilter/nf_nat_masquerade_ipv4.c +19 -3
@@ -104,12 +104,26 @@ static int masq_device_event(struct notifier_block *this,return NOTIFY_DONE ; } +static int inet_cmp (struct nf_conn *ct,void *ptr) +{ +struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; +struct net_device *dev = ifa->ifa_dev->dev; +struct nf_conntrack_tuple *tuple; + +if (!device_cmp (ct, (void *)(long )dev->ifindex)) +return 0 ; + + tuple = &ct->tuplehash[IP_CT_DIR_REPLY ].tuple; + +return ifa->ifa_address == tuple->dst.u3.ip; +} +static int masq_inet_event (struct notifier_block *this,unsigned long event,void *ptr) {struct in_device *idev = ((struct in_ifaddr *)ptr)->ifa_dev; -struct netdev_notifier_info info; +struct net *net =dev_net (idev->dev);/* The masq_dev_notifier will catch the case of the device going * down. So if the inetdev is dead and being destroyed we have
@@ -119,8 +133,10 @@ static int masq_inet_event(struct notifier_block *this,if (idev->dead)return NOTIFY_DONE ; -netdev_notifier_info_init (&info, idev->dev); -return masq_device_event (this, event, &info); +if (event ==NETDEV_DOWN ) +nf_ct_iterate_cleanup_net (net, inet_cmp, ptr,0 ,0 ); + +return NOTIFY_DONE ; }static struct notifier_block masq_dev_notifier = {
net/ipv6/netfilter/nf_nat_masquerade_ipv6.c +16 -3
@@ -87,18 +87,30 @@ static struct notifier_block masq_dev_notifier = {struct masq_dev_work {struct work_struct work;struct net *net; +struct in6_addr addr;int ifindex; }; +static int inet_cmp (struct nf_conn *ct,void *work) +{ +struct masq_dev_work *w = (struct masq_dev_work *)work; +struct nf_conntrack_tuple *tuple; + +if (!device_cmp (ct, (void *)(long )w->ifindex)) +return 0 ; + + tuple = &ct->tuplehash[IP_CT_DIR_REPLY ].tuple; + +return ipv6_addr_equal (&w->addr, &tuple->dst.u3.in6); +} +static void iterate_cleanup_work (struct work_struct *work) {struct masq_dev_work *w; -long index; w = container_of(work, struct masq_dev_work, work); - index = w->ifindex; -nf_ct_iterate_cleanup_net (w->net, device_cmp, (void *)index,0 ,0 ); +nf_ct_iterate_cleanup_net (w->net, inet_cmp, (void *)w,0 ,0 );put_net (w->net);kfree (w);
@@ -147,6 +159,7 @@ static int masq_inet6_event(struct notifier_block *this,INIT_WORK (&w->work, iterate_cleanup_work); w->ifindex = dev->ifindex; w->net = net; + w->addr = ifa->addr;schedule_work (&w->work);return NOTIFY_DONE ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 184/191 usb: xhci-mtk: fix ISOC error when interval is zero
In reply to Sasha LevinFrom: Chunfeng Yun <[email protected]>
[ Upstream commit 87173acc0d8f0987bda8827da35fff67f52ad15d ]
If the interval equal zero, needn't round up to power of two for the number of packets in each ESIT, so fix it.
--- drivers/usb/host/xhci-mtk-sch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-mtk-sch.c +3 -1
@@ -113,7 +113,9 @@ static void setup_sch_info(struct usb_device *udev, }if (ep_type ==ISOC_IN_EP || ep_type ==ISOC_OUT_EP ) { -if (esit_pkts <= sch_ep->esit) +if (sch_ep->esit ==1 ) + sch_ep->pkts = esit_pkts; +else if (esit_pkts <= sch_ep->esit) sch_ep->pkts =1 ;else sch_ep->pkts =roundup_pow_of_two (esit_pkts)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 185/191 usb: usbtmc: uninitialized symbol 'actual' in usbtmc_ioctl_clear
In reply to Sasha LevinFrom: Guido Kiener <[email protected]>
[ Upstream commit 9a83190300867fb024d53f47c31088e34188efc1 ]
Fix uninitialized symbol 'actual' in function usbtmc_ioctl_clear.
When symbol 'actual' is not initialized and usb_bulk_msg() fails, the subsequent kernel debug message shows a random value.
--- drivers/usb/class/usbtmc.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/class/usbtmc.c +1 -0
@@ -1016,6 +1016,7 @@ static int usbtmc_ioctl_clear(struct usbtmc_device_data *data) do { dev_dbg(dev, "Reading from bulk in EP\n"); + actual = 0; rv = usb_bulk_msg(data->usb_dev, usb_rcvbulkpipe(data->usb_dev, data->bulk_in),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 186/191 fuse: use READ_ONCE on congestion_threshold and max_background
In reply to Sasha LevinFrom: Kirill Tkhai <[email protected]>
[ Upstream commit 2a23f2b8adbe4bd584f936f7ac17a99750eed9d7 ]
Since they are of unsigned int type, it's allowed to read them unlocked during reporting to userspace. Let's underline this fact with READ_ONCE() macroses.
--- fs/fuse/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fuse/control.c +2 -2
@@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file,if (!fc)return 0 ; - val = fc->max_background; + val =READ_ONCE (fc->max_background);fuse_conn_put (fc);return fuse_conn_limit_read (file, buf, len, ppos, val);
@@ -144,7 +144,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file,if (!fc)return 0 ; - val = fc->congestion_threshold; + val =READ_ONCE (fc->congestion_threshold);fuse_conn_put (fc);return fuse_conn_limit_read (file, buf, len, ppos, val);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 187/191 IB/iser: Fix possible NULL deref at iser_inv_desc()
In reply to Sasha LevinFrom: Israel Rukshin <[email protected]>
[ Upstream commit 65f07f5a09dacf3b60619f196f096ea3671a5eda ]
In case target remote invalidates bogus rkey and signature is not used, pi_ctx is NULL deref.
The commit also fails the connection on bogus remote invalidation.
--- drivers/infiniband/ulp/iser/iser_initiator.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/infiniband/ulp/iser/iser_initiator.c +13 -5
@@ -589,13 +589,19 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc) ib_conn->post_recv_buf_count--; } -static inline void +static inline int iser_inv_desc (struct iser_fr_desc *desc,u32 rkey) { -if (likely (rkey == desc->rsc.mr->rkey)) +if (likely (rkey == desc->rsc.mr->rkey)) { desc->rsc.mr_valid =0 ; -else if (likely (rkey == desc->pi_ctx->sig_mr->rkey)) + }else if (likely (desc->pi_ctx && rkey == desc->pi_ctx->sig_mr->rkey)) { desc->pi_ctx->sig_mr_valid =0 ; + }else { +iser_err ("Bogus remote invalidation for rkey %#x\n" , rkey); +return -EINVAL ; + } + +return 0 ; } static int
@@ -623,12 +629,14 @@ iser_check_remote_inv(struct iser_conn *iser_conn,if (iser_task->dir[ISER_DIR_IN ]) { desc = iser_task->rdma_reg[ISER_DIR_IN ].mem_h; -iser_inv_desc (desc, rkey); +if (unlikely (iser_inv_desc (desc, rkey))) +return -EINVAL ; }if (iser_task->dir[ISER_DIR_OUT ]) { desc = iser_task->rdma_reg[ISER_DIR_OUT ].mem_h; -iser_inv_desc (desc, rkey); +if (unlikely (iser_inv_desc (desc, rkey))) +return -EINVAL ; } }else {iser_err ("failed to get task for itt=%d\n" , hdr->itt);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 188/191 media: ov2680: fix null dereference at power on
In reply to Sasha LevinFrom: Rui Miguel Silva <[email protected]>
[ Upstream commit c45fbdf24c61a7b7a37f1b3bbd46f054637a3627 ]
Swapping the order between v4l2 subdevice registration and checking chip id in b7a417628abf ("media: ov2680: don't register the v4l2 subdevice before checking chip ID") makes the mode restore to use the sensor controls before they are set, so move the mode restore call to s_power after the handler setup for controls is done.
This remove also the need for the error code path in power on function.
--- drivers/media/i2c/ov2680.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/media/i2c/ov2680.c +2 -10
@@ -568,10 +568,6 @@ static int ov2680_power_on(struct ov2680_dev *sensor)if (ret <0 )return ret; - ret =ov2680_mode_restore (sensor); -if (ret <0 ) - goto disable; - sensor->is_enabled = true;/* Set clock lane into LP-11 state */
@@ -580,12 +576,6 @@ static int ov2680_power_on(struct ov2680_dev *sensor)ov2680_stream_disable (sensor);return 0 ; - -disable: -dev_err (dev,"failed to enable sensor: %d\n" , ret); -ov2680_power_off (sensor); - -return ret; }static int ov2680_s_power (struct v4l2_subdev *sd,int on)
@@ -606,6 +596,8 @@ static int ov2680_s_power(struct v4l2_subdev *sd, int on) ret =v4l2_ctrl_handler_setup (&sensor->ctrls.handler);if (ret <0 )return ret; + + ret =ov2680_mode_restore (sensor); }return ret;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 189/191 s390/vdso: correct vdso mapping for compat tasks
In reply to Sasha LevinFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 190f056fba230abee80712eb810939ef9a8c462f ]
While "s390/vdso: avoid 64-bit vdso mapping for compat tasks" fixed 64-bit vdso mapping for compat tasks under gdb it introduced another problem. "compat_mm" flag is not inherited during fork and when 31-bit process forks a child (but does not perform exec) it ends up with 64-bit vdso. To address that, init_new_context (which is called during fork and exec) now initialize compat_mm based on thread TIF_31BIT flag. Later compat_mm is adjusted in arch_setup_additional_pages, which is called during exec.
--- arch/s390/include/asm/mmu_context.h | 2 +- arch/s390/kernel/vdso.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-)
arch/s390/include/asm/mmu_context.h +1 -1
@@ -25,7 +25,7 @@ static inline int init_new_context(struct task_struct *tsk,atomic_set (&mm->context.flush_count,0 ); mm->context.gmap_asce =0 ; mm->context.flush_mm =0 ; - mm->context.compat_mm =0 ; + mm->context.compat_mm =test_thread_flag (TIF_31BIT );#ifdef CONFIG_PGSTE mm->context.alloc_pgste = page_table_allocate_pgste || test_thread_flag(TIF_PGSTE) ||
arch/s390/kernel/vdso.c +2 -3
@@ -224,10 +224,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) vdso_pages = vdso64_pages;#ifdef CONFIG_COMPAT -if (is_compat_task ()) { + mm->context.compat_mm =is_compat_task (); +if (mm->context.compat_mm) vdso_pages = vdso32_pages; - mm->context.compat_mm =1 ; - }#endif /* * vDSO has a problem and was disabled, just don't "enable" it for
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 190/191 net: phy: mdio-bcm-unimac: mark PM functions as __maybe_unused
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9b97123a584f60a5bca5a2663485768a1f6cd0a4 ]
The newly added runtime-pm support causes a harmless warning when CONFIG_PM is disabled:
drivers/net/phy/mdio-bcm-unimac.c:330:12: error: 'unimac_mdio_resume' defined but not used [-Werror=unused-function]
static int unimac_mdio_resume(struct device *d)drivers/net/phy/mdio-bcm-unimac.c:321:12: error: 'unimac_mdio_suspend' defined but not used [-Werror=unused-function]
static int unimac_mdio_suspend(struct device *d)
Marking the functions as __maybe_unused is the easiest workaround and avoids adding #ifdef checks.
--- drivers/net/phy/mdio-bcm-unimac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/mdio-bcm-unimac.c +2 -2
@@ -318,7 +318,7 @@ static int unimac_mdio_remove(struct platform_device *pdev)return 0 ; } -static int unimac_mdio_suspend (struct device *d) +static int __maybe_unused unimac_mdio_suspend (struct device *d) {struct unimac_mdio_priv *priv =dev_get_drvdata (d);
@@ -327,7 +327,7 @@ static int unimac_mdio_suspend(struct device *d)return 0 ; } -static int unimac_mdio_resume (struct device *d) +static int __maybe_unused unimac_mdio_resume (struct device *d) {struct unimac_mdio_priv *priv =dev_get_drvdata (d);int ret;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 191/191 x86/efi: fix a -Wtype-limits compilation warning
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit 919aef44d73d5d0c04213cb1bc31149cc074e65e ]
Compiling a kernel with W=1 generates this warning,
arch/x86/platform/efi/quirks.c:731:16: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
--- arch/x86/platform/efi/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/efi/quirks.c +1 -1
@@ -684,7 +684,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr)* Address range 0x0000 - 0x0fff is always mapped in the efi_pgd, so * page faulting on these addresses isn't expected. */ -if (phys_addr >=0x0000 && phys_addr <=0x0fff ) +if (phys_addr <=0x0fff )return ;/*
Signature · 1 line
2.20.1