Commit 1f02beff authored by Viswas G's avatar Viswas G Committed by Martin K. Petersen

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.comAcked-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: default avatarViswas G <Viswas.G@microchip.com>
Signed-off-by: default avatarRuksar Devadi <Ruksar.devadi@microchip.com>
Signed-off-by: default avatarAshokkumar N <Ashokkumar.N@microchip.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b431472b
...@@ -267,7 +267,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, ...@@ -267,7 +267,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
{ {
int i, count = 0, rc = 0; int i, count = 0, rc = 0;
u32 ci_offset, ib_offset, ob_offset, pi_offset; 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->lock);
spin_lock_init(&pm8001_ha->bitmap_lock); spin_lock_init(&pm8001_ha->bitmap_lock);
...@@ -315,8 +316,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, ...@@ -315,8 +316,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
pm8001_ha->memoryMap.region[IOP].alignment = 32; pm8001_ha->memoryMap.region[IOP].alignment = 32;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
circularQ = &pm8001_ha->inbnd_q_tbl[i]; ibq = &pm8001_ha->inbnd_q_tbl[i];
spin_lock_init(&circularQ->iq_lock); spin_lock_init(&ibq->iq_lock);
/* MPI Memory region 3 for consumer Index of inbound queues */ /* 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].num_elements = 1;
pm8001_ha->memoryMap.region[ci_offset+i].element_size = 4; pm8001_ha->memoryMap.region[ci_offset+i].element_size = 4;
...@@ -345,6 +346,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, ...@@ -345,6 +346,8 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
} }
for (i = 0; i < count; i++) { 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 */ /* 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].num_elements = 1;
pm8001_ha->memoryMap.region[pi_offset+i].element_size = 4; pm8001_ha->memoryMap.region[pi_offset+i].element_size = 4;
......
...@@ -456,6 +456,7 @@ struct outbound_queue_table { ...@@ -456,6 +456,7 @@ struct outbound_queue_table {
u32 dinterrup_to_pci_offset; u32 dinterrup_to_pci_offset;
__le32 producer_index; __le32 producer_index;
u32 consumer_idx; u32 consumer_idx;
spinlock_t oq_lock;
}; };
struct pm8001_hba_memspace { struct pm8001_hba_memspace {
void __iomem *memvirtaddr; void __iomem *memvirtaddr;
......
...@@ -4133,8 +4133,8 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) ...@@ -4133,8 +4133,8 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
return ret; return ret;
} }
} }
spin_lock_irqsave(&pm8001_ha->lock, flags);
circularQ = &pm8001_ha->outbnd_q_tbl[vec]; circularQ = &pm8001_ha->outbnd_q_tbl[vec];
spin_lock_irqsave(&circularQ->oq_lock, flags);
do { do {
/* spurious interrupt during setup if kexec-ing and /* spurious interrupt during setup if kexec-ing and
* driver doing a doorbell access w/ the pre-kexec oq * 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) ...@@ -4160,7 +4160,7 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
break; break;
} }
} while (1); } while (1);
spin_unlock_irqrestore(&pm8001_ha->lock, flags); spin_unlock_irqrestore(&circularQ->oq_lock, flags);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment