diff options
author | Viswas G <Viswas.G@microchip.com> | 2021-04-15 16:03:52 +0530 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-04-15 22:29:00 -0400 |
commit | 1f02beff224e6176c1a0aacced7fb5127b240996 (patch) | |
tree | 6c5cb5116e01a1b64486860da57c0f070e658464 | |
parent | b431472bc88b4a230c88049ed077fcccf4448980 (diff) | |
download | linux-1f02beff224e6176c1a0aacced7fb5127b240996.tar.bz2 |
scsi: pm80xx: Remove global lock from outbound queue processing
Introduce spin lock for outbound queue. With this, driver need not acquire
HBA global lock for outbound queue processing.
Link: https://lore.kernel.org/r/20210415103352.3580-9-Viswas.G@microchip.com
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Viswas G <Viswas.G@microchip.com>
Signed-off-by: Ruksar Devadi <Ruksar.devadi@microchip.com>
Signed-off-by: Ashokkumar N <Ashokkumar.N@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/pm8001/pm8001_init.c | 9 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.h | 1 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm80xx_hwi.c | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 0f7b3fffb393..390c33df0357 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -267,7 +267,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, { int i, count = 0, rc = 0; u32 ci_offset, ib_offset, ob_offset, pi_offset; - struct inbound_queue_table *circularQ; + struct inbound_queue_table *ibq; + struct outbound_queue_table *obq; spin_lock_init(&pm8001_ha->lock); spin_lock_init(&pm8001_ha->bitmap_lock); @@ -315,8 +316,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, pm8001_ha->memoryMap.region[IOP].alignment = 32; for (i = 0; i < count; i++) { - circularQ = &pm8001_ha->inbnd_q_tbl[i]; - spin_lock_init(&circularQ->iq_lock); + ibq = &pm8001_ha->inbnd_q_tbl[i]; + spin_lock_init(&ibq->iq_lock); /* MPI Memory region 3 for consumer Index of inbound queues */ pm8001_ha->memoryMap.region[ci_offset+i].num_elements = 1; pm8001_ha->memoryMap.region[ci_offset+i].element_size = 4; @@ -345,6 +346,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, } for (i = 0; i < count; i++) { + obq = &pm8001_ha->outbnd_q_tbl[i]; + spin_lock_init(&obq->oq_lock); /* MPI Memory region 4 for producer Index of outbound queues */ pm8001_ha->memoryMap.region[pi_offset+i].num_elements = 1; pm8001_ha->memoryMap.region[pi_offset+i].element_size = 4; diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index b5562f7fc7e5..62d08b535a4b 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -456,6 +456,7 @@ struct outbound_queue_table { u32 dinterrup_to_pci_offset; __le32 producer_index; u32 consumer_idx; + spinlock_t oq_lock; }; struct pm8001_hba_memspace { void __iomem *memvirtaddr; diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 771490223f87..4e980830f9f5 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -4133,8 +4133,8 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) return ret; } } - spin_lock_irqsave(&pm8001_ha->lock, flags); circularQ = &pm8001_ha->outbnd_q_tbl[vec]; + spin_lock_irqsave(&circularQ->oq_lock, flags); do { /* spurious interrupt during setup if kexec-ing and * driver doing a doorbell access w/ the pre-kexec oq @@ -4160,7 +4160,7 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) break; } } while (1); - spin_unlock_irqrestore(&pm8001_ha->lock, flags); + spin_unlock_irqrestore(&circularQ->oq_lock, flags); return ret; } |