Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"A bunch of fixes for aacraid, a set of coherency fixes that only
affect non-coherent platforms and one coccinelle detected null check
after use"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: libsas: align sata_device's rps_resp on a cacheline
scsi: use dma_get_cache_alignment() as minimum DMA alignment
scsi: dma-mapping: always provide dma_get_cache_alignment
scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg
scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path
scsi: aacraid: Perform initialization reset only once
scsi: aacraid: Check for PCI state of device in a generic way

+43 -52
+1
drivers/scsi/aacraid/aacraid.h
··· 1673 1673 struct aac_hba_map_info hba_map[AAC_MAX_BUSES][AAC_MAX_TARGETS]; 1674 1674 u8 adapter_shutdown; 1675 1675 u32 handle_pci_error; 1676 + bool init_reset; 1676 1677 }; 1677 1678 1678 1679 #define aac_adapter_interrupt(dev) \
+3 -32
drivers/scsi/aacraid/commsup.c
··· 467 467 return 0; 468 468 } 469 469 470 - #ifdef CONFIG_EEH 471 - static inline int aac_check_eeh_failure(struct aac_dev *dev) 472 - { 473 - /* Check for an EEH failure for the given 474 - * device node. Function eeh_dev_check_failure() 475 - * returns 0 if there has not been an EEH error 476 - * otherwise returns a non-zero value. 477 - * 478 - * Need to be called before any PCI operation, 479 - * i.e.,before aac_adapter_check_health() 480 - */ 481 - struct eeh_dev *edev = pci_dev_to_eeh_dev(dev->pdev); 482 - 483 - if (eeh_dev_check_failure(edev)) { 484 - /* The EEH mechanisms will handle this 485 - * error and reset the device if 486 - * necessary. 487 - */ 488 - return 1; 489 - } 490 - return 0; 491 - } 492 - #else 493 - static inline int aac_check_eeh_failure(struct aac_dev *dev) 494 - { 495 - return 0; 496 - } 497 - #endif 498 - 499 470 /* 500 471 * Define the highest level of host to adapter communication routines. 501 472 * These routines will support host to adapter FS commuication. These ··· 672 701 return -ETIMEDOUT; 673 702 } 674 703 675 - if (aac_check_eeh_failure(dev)) 704 + if (unlikely(pci_channel_offline(dev->pdev))) 676 705 return -EFAULT; 677 706 678 707 if ((blink = aac_adapter_check_health(dev)) > 0) { ··· 772 801 773 802 spin_unlock_irqrestore(&fibptr->event_lock, flags); 774 803 775 - if (aac_check_eeh_failure(dev)) 804 + if (unlikely(pci_channel_offline(dev->pdev))) 776 805 return -EFAULT; 777 806 778 807 fibptr->flags |= FIB_CONTEXT_FLAG_WAIT; ··· 1554 1583 * will ensure that i/o is queisced and the card is flushed in that 1555 1584 * case. 1556 1585 */ 1586 + aac_free_irq(aac); 1557 1587 aac_fib_map_free(aac); 1558 1588 dma_free_coherent(&aac->pdev->dev, aac->comm_size, aac->comm_addr, 1559 1589 aac->comm_phys); ··· 1562 1590 aac->comm_phys = 0; 1563 1591 kfree(aac->queues); 1564 1592 aac->queues = NULL; 1565 - aac_free_irq(aac); 1566 1593 kfree(aac->fsa_dev); 1567 1594 aac->fsa_dev = NULL; 1568 1595
+3
drivers/scsi/aacraid/linit.c
··· 1680 1680 aac->cardtype = index; 1681 1681 INIT_LIST_HEAD(&aac->entry); 1682 1682 1683 + if (aac_reset_devices || reset_devices) 1684 + aac->init_reset = true; 1685 + 1683 1686 aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL); 1684 1687 if (!aac->fibs) 1685 1688 goto out_free_host;
+10 -5
drivers/scsi/aacraid/rx.c
··· 561 561 dev->a_ops.adapter_sync_cmd = rx_sync_cmd; 562 562 dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; 563 563 dev->OIMR = status = rx_readb (dev, MUnit.OIMR); 564 - if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) && 565 - !aac_rx_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) 566 - /* Make sure the Hardware FIFO is empty */ 567 - while ((++restart < 512) && 568 - (rx_readl(dev, MUnit.OutboundQueue) != 0xFFFFFFFFL)); 564 + 565 + if (((status & 0x0c) != 0x0c) || dev->init_reset) { 566 + dev->init_reset = false; 567 + if (!aac_rx_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) { 568 + /* Make sure the Hardware FIFO is empty */ 569 + while ((++restart < 512) && 570 + (rx_readl(dev, MUnit.OutboundQueue) != 0xFFFFFFFFL)); 571 + } 572 + } 573 + 569 574 /* 570 575 * Check to see if the board panic'd while booting. 571 576 */
+14 -6
drivers/scsi/aacraid/src.c
··· 868 868 /* Failure to reset here is an option ... */ 869 869 dev->a_ops.adapter_sync_cmd = src_sync_cmd; 870 870 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; 871 - if ((aac_reset_devices || reset_devices) && 872 - !aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) 873 - ++restart; 871 + 872 + if (dev->init_reset) { 873 + dev->init_reset = false; 874 + if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) 875 + ++restart; 876 + } 877 + 874 878 /* 875 879 * Check to see if the board panic'd while booting. 876 880 */ ··· 1018 1014 /* Failure to reset here is an option ... */ 1019 1015 dev->a_ops.adapter_sync_cmd = src_sync_cmd; 1020 1016 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; 1021 - if ((aac_reset_devices || reset_devices) && 1022 - !aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) 1023 - ++restart; 1017 + 1018 + if (dev->init_reset) { 1019 + dev->init_reset = false; 1020 + if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) 1021 + ++restart; 1022 + } 1023 + 1024 1024 /* 1025 1025 * Check to see if flash update is running. 1026 1026 * Wait for the adapter to be up and running. Wait up to 5 minutes
+6 -4
drivers/scsi/scsi_lib.c
··· 2148 2148 q->limits.cluster = 0; 2149 2149 2150 2150 /* 2151 - * set a reasonable default alignment on word boundaries: the 2152 - * host and device may alter it using 2153 - * blk_queue_update_dma_alignment() later. 2151 + * Set a reasonable default alignment: The larger of 32-byte (dword), 2152 + * which is a common minimum for HBAs, and the minimum DMA alignment, 2153 + * which is set by the platform. 2154 + * 2155 + * Devices that require a bigger alignment can increase it later. 2154 2156 */ 2155 - blk_queue_dma_alignment(q, 0x03); 2157 + blk_queue_dma_alignment(q, max(4, dma_get_cache_alignment()) - 1); 2156 2158 } 2157 2159 EXPORT_SYMBOL_GPL(__scsi_init_queue); 2158 2160
+5 -2
drivers/scsi/ufs/ufshcd.c
··· 6559 6559 struct ufs_vreg *vreg, bool on) 6560 6560 { 6561 6561 int ret = 0; 6562 - struct regulator *reg = vreg->reg; 6563 - const char *name = vreg->name; 6562 + struct regulator *reg; 6563 + const char *name; 6564 6564 int min_uV, uA_load; 6565 6565 6566 6566 BUG_ON(!vreg); 6567 + 6568 + reg = vreg->reg; 6569 + name = vreg->name; 6567 6570 6568 6571 if (regulator_count_voltages(reg) > 0) { 6569 6572 min_uV = on ? vreg->min_uV : 0;
-2
include/linux/dma-mapping.h
··· 704 704 return ret; 705 705 } 706 706 707 - #ifdef CONFIG_HAS_DMA 708 707 static inline int dma_get_cache_alignment(void) 709 708 { 710 709 #ifdef ARCH_DMA_MINALIGN ··· 711 712 #endif 712 713 return 1; 713 714 } 714 - #endif 715 715 716 716 /* flags for the coherent memory api */ 717 717 #define DMA_MEMORY_EXCLUSIVE 0x01
+1 -1
include/scsi/libsas.h
··· 159 159 160 160 struct sata_device { 161 161 unsigned int class; 162 - struct smp_resp rps_resp; /* report_phy_sata_resp */ 163 162 u8 port_no; /* port number, if this is a PM (Port) */ 164 163 165 164 struct ata_port *ap; 166 165 struct ata_host ata_host; 166 + struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */ 167 167 u8 fis[ATA_RESP_FIS_SIZE]; 168 168 }; 169 169