Skip to content

Commit 13231ca

Browse files
committed
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
2 parents e6cdd80 + c2e8fbf commit 13231ca

File tree

9 files changed

+43
-52
lines changed

9 files changed

+43
-52
lines changed

drivers/scsi/aacraid/aacraid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ struct aac_dev
16731673
struct aac_hba_map_info hba_map[AAC_MAX_BUSES][AAC_MAX_TARGETS];
16741674
u8 adapter_shutdown;
16751675
u32 handle_pci_error;
1676+
bool init_reset;
16761677
};
16771678

16781679
#define aac_adapter_interrupt(dev) \

drivers/scsi/aacraid/commsup.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -467,35 +467,6 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw
467467
return 0;
468468
}
469469

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-
499470
/*
500471
* Define the highest level of host to adapter communication routines.
501472
* These routines will support host to adapter FS commuication. These
@@ -701,7 +672,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
701672
return -ETIMEDOUT;
702673
}
703674

704-
if (aac_check_eeh_failure(dev))
675+
if (unlikely(pci_channel_offline(dev->pdev)))
705676
return -EFAULT;
706677

707678
if ((blink = aac_adapter_check_health(dev)) > 0) {
@@ -801,7 +772,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
801772

802773
spin_unlock_irqrestore(&fibptr->event_lock, flags);
803774

804-
if (aac_check_eeh_failure(dev))
775+
if (unlikely(pci_channel_offline(dev->pdev)))
805776
return -EFAULT;
806777

807778
fibptr->flags |= FIB_CONTEXT_FLAG_WAIT;
@@ -1583,14 +1554,14 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
15831554
* will ensure that i/o is queisced and the card is flushed in that
15841555
* case.
15851556
*/
1557+
aac_free_irq(aac);
15861558
aac_fib_map_free(aac);
15871559
dma_free_coherent(&aac->pdev->dev, aac->comm_size, aac->comm_addr,
15881560
aac->comm_phys);
15891561
aac->comm_addr = NULL;
15901562
aac->comm_phys = 0;
15911563
kfree(aac->queues);
15921564
aac->queues = NULL;
1593-
aac_free_irq(aac);
15941565
kfree(aac->fsa_dev);
15951566
aac->fsa_dev = NULL;
15961567

drivers/scsi/aacraid/linit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,9 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
16801680
aac->cardtype = index;
16811681
INIT_LIST_HEAD(&aac->entry);
16821682

1683+
if (aac_reset_devices || reset_devices)
1684+
aac->init_reset = true;
1685+
16831686
aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL);
16841687
if (!aac->fibs)
16851688
goto out_free_host;

drivers/scsi/aacraid/rx.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,16 @@ int _aac_rx_init(struct aac_dev *dev)
561561
dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
562562
dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt;
563563
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+
569574
/*
570575
* Check to see if the board panic'd while booting.
571576
*/

drivers/scsi/aacraid/src.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -868,9 +868,13 @@ int aac_src_init(struct aac_dev *dev)
868868
/* Failure to reset here is an option ... */
869869
dev->a_ops.adapter_sync_cmd = src_sync_cmd;
870870
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+
874878
/*
875879
* Check to see if the board panic'd while booting.
876880
*/
@@ -1014,9 +1018,13 @@ int aac_srcv_init(struct aac_dev *dev)
10141018
/* Failure to reset here is an option ... */
10151019
dev->a_ops.adapter_sync_cmd = src_sync_cmd;
10161020
dev->a_ops.adapter_enable_int = aac_src_disable_interrupt;
1017-
if ((aac_reset_devices || reset_devices) &&
1018-
!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
1019-
++restart;
1021+
1022+
if (dev->init_reset) {
1023+
dev->init_reset = false;
1024+
if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
1025+
++restart;
1026+
}
1027+
10201028
/*
10211029
* Check to see if flash update is running.
10221030
* Wait for the adapter to be up and running. Wait up to 5 minutes

drivers/scsi/scsi_lib.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,11 +2148,13 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
21482148
q->limits.cluster = 0;
21492149

21502150
/*
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.
21542156
*/
2155-
blk_queue_dma_alignment(q, 0x03);
2157+
blk_queue_dma_alignment(q, max(4, dma_get_cache_alignment()) - 1);
21562158
}
21572159
EXPORT_SYMBOL_GPL(__scsi_init_queue);
21582160

drivers/scsi/ufs/ufshcd.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6559,12 +6559,15 @@ static int ufshcd_config_vreg(struct device *dev,
65596559
struct ufs_vreg *vreg, bool on)
65606560
{
65616561
int ret = 0;
6562-
struct regulator *reg = vreg->reg;
6563-
const char *name = vreg->name;
6562+
struct regulator *reg;
6563+
const char *name;
65646564
int min_uV, uA_load;
65656565

65666566
BUG_ON(!vreg);
65676567

6568+
reg = vreg->reg;
6569+
name = vreg->name;
6570+
65686571
if (regulator_count_voltages(reg) > 0) {
65696572
min_uV = on ? vreg->min_uV : 0;
65706573
ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);

include/linux/dma-mapping.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,15 +704,13 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
704704
return ret;
705705
}
706706

707-
#ifdef CONFIG_HAS_DMA
708707
static inline int dma_get_cache_alignment(void)
709708
{
710709
#ifdef ARCH_DMA_MINALIGN
711710
return ARCH_DMA_MINALIGN;
712711
#endif
713712
return 1;
714713
}
715-
#endif
716714

717715
/* flags for the coherent memory api */
718716
#define DMA_MEMORY_EXCLUSIVE 0x01

include/scsi/libsas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ struct expander_device {
159159

160160
struct sata_device {
161161
unsigned int class;
162-
struct smp_resp rps_resp; /* report_phy_sata_resp */
163162
u8 port_no; /* port number, if this is a PM (Port) */
164163

165164
struct ata_port *ap;
166165
struct ata_host ata_host;
166+
struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */
167167
u8 fis[ATA_RESP_FIS_SIZE];
168168
};
169169

0 commit comments

Comments
 (0)