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>
This commit is contained in:
Viswas G 2021-04-15 16:03:52 +05:30 committed by Martin K. Petersen
parent b431472bc8
commit 1f02beff22
3 changed files with 9 additions and 5 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;
}