Skip to content

Commit 2f5a314

Browse files
James BottomleyJames Bottomley
authored andcommitted
Merge remote-tracking branch 'mkp-scsi/4.10/scsi-fixes' into fixes
2 parents a47fff1 + cd60be4 commit 2f5a314

File tree

5 files changed

+33
-85
lines changed

5 files changed

+33
-85
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5954,18 +5954,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
59545954

59555955
free_vfi_bmask:
59565956
kfree(phba->sli4_hba.vfi_bmask);
5957+
phba->sli4_hba.vfi_bmask = NULL;
59575958
free_xri_ids:
59585959
kfree(phba->sli4_hba.xri_ids);
5960+
phba->sli4_hba.xri_ids = NULL;
59595961
free_xri_bmask:
59605962
kfree(phba->sli4_hba.xri_bmask);
5963+
phba->sli4_hba.xri_bmask = NULL;
59615964
free_vpi_ids:
59625965
kfree(phba->vpi_ids);
5966+
phba->vpi_ids = NULL;
59635967
free_vpi_bmask:
59645968
kfree(phba->vpi_bmask);
5969+
phba->vpi_bmask = NULL;
59655970
free_rpi_ids:
59665971
kfree(phba->sli4_hba.rpi_ids);
5972+
phba->sli4_hba.rpi_ids = NULL;
59675973
free_rpi_bmask:
59685974
kfree(phba->sli4_hba.rpi_bmask);
5975+
phba->sli4_hba.rpi_bmask = NULL;
59695976
err_exit:
59705977
return rc;
59715978
}

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,15 @@ qla2x00_sysfs_read_optrom(struct file *filp, struct kobject *kobj,
243243
struct qla_hw_data *ha = vha->hw;
244244
ssize_t rval = 0;
245245

246+
mutex_lock(&ha->optrom_mutex);
247+
246248
if (ha->optrom_state != QLA_SREADING)
247-
return 0;
249+
goto out;
248250

249-
mutex_lock(&ha->optrom_mutex);
250251
rval = memory_read_from_buffer(buf, count, &off, ha->optrom_buffer,
251252
ha->optrom_region_size);
253+
254+
out:
252255
mutex_unlock(&ha->optrom_mutex);
253256

254257
return rval;
@@ -263,14 +266,19 @@ qla2x00_sysfs_write_optrom(struct file *filp, struct kobject *kobj,
263266
struct device, kobj)));
264267
struct qla_hw_data *ha = vha->hw;
265268

266-
if (ha->optrom_state != QLA_SWRITING)
269+
mutex_lock(&ha->optrom_mutex);
270+
271+
if (ha->optrom_state != QLA_SWRITING) {
272+
mutex_unlock(&ha->optrom_mutex);
267273
return -EINVAL;
268-
if (off > ha->optrom_region_size)
274+
}
275+
if (off > ha->optrom_region_size) {
276+
mutex_unlock(&ha->optrom_mutex);
269277
return -ERANGE;
278+
}
270279
if (off + count > ha->optrom_region_size)
271280
count = ha->optrom_region_size - off;
272281

273-
mutex_lock(&ha->optrom_mutex);
274282
memcpy(&ha->optrom_buffer[off], buf, count);
275283
mutex_unlock(&ha->optrom_mutex);
276284

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,7 +2732,7 @@ struct isp_operations {
27322732
#define QLA_MSIX_FW_MODE(m) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7)
27332733
#define QLA_MSIX_FW_MODE_1(m) (QLA_MSIX_FW_MODE(m) == 1)
27342734

2735-
#define QLA_MSIX_DEFAULT 0x00
2735+
#define QLA_BASE_VECTORS 2 /* default + RSP */
27362736
#define QLA_MSIX_RSP_Q 0x01
27372737
#define QLA_ATIO_VECTOR 0x02
27382738
#define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x03
@@ -2754,7 +2754,6 @@ struct qla_msix_entry {
27542754
uint16_t entry;
27552755
char name[30];
27562756
void *handle;
2757-
struct irq_affinity_notify irq_notify;
27582757
int cpuid;
27592758
};
27602759

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 11 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ static void qla2x00_status_entry(scsi_qla_host_t *, struct rsp_que *, void *);
1919
static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *);
2020
static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *,
2121
sts_entry_t *);
22-
static void qla_irq_affinity_notify(struct irq_affinity_notify *,
23-
const cpumask_t *);
24-
static void qla_irq_affinity_release(struct kref *);
25-
2622

2723
/**
2824
* qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200.
@@ -2572,14 +2568,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
25722568
if (!vha->flags.online)
25732569
return;
25742570

2575-
if (rsp->msix && rsp->msix->cpuid != smp_processor_id()) {
2576-
/* if kernel does not notify qla of IRQ's CPU change,
2577-
* then set it here.
2578-
*/
2579-
rsp->msix->cpuid = smp_processor_id();
2580-
ha->tgt.rspq_vector_cpuid = rsp->msix->cpuid;
2581-
}
2582-
25832571
while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) {
25842572
pkt = (struct sts_entry_24xx *)rsp->ring_ptr;
25852573

@@ -3018,13 +3006,20 @@ static struct qla_init_msix_entry qla82xx_msix_entries[] = {
30183006
static int
30193007
qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
30203008
{
3021-
#define MIN_MSIX_COUNT 2
30223009
int i, ret;
30233010
struct qla_msix_entry *qentry;
30243011
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
3012+
struct irq_affinity desc = {
3013+
.pre_vectors = QLA_BASE_VECTORS,
3014+
};
3015+
3016+
if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha))
3017+
desc.pre_vectors++;
3018+
3019+
ret = pci_alloc_irq_vectors_affinity(ha->pdev, QLA_BASE_VECTORS,
3020+
ha->msix_count, PCI_IRQ_MSIX | PCI_IRQ_AFFINITY,
3021+
&desc);
30253022

3026-
ret = pci_alloc_irq_vectors(ha->pdev, MIN_MSIX_COUNT, ha->msix_count,
3027-
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
30283023
if (ret < 0) {
30293024
ql_log(ql_log_fatal, vha, 0x00c7,
30303025
"MSI-X: Failed to enable support, "
@@ -3069,13 +3064,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
30693064
qentry->have_irq = 0;
30703065
qentry->in_use = 0;
30713066
qentry->handle = NULL;
3072-
qentry->irq_notify.notify = qla_irq_affinity_notify;
3073-
qentry->irq_notify.release = qla_irq_affinity_release;
3074-
qentry->cpuid = -1;
30753067
}
30763068

30773069
/* Enable MSI-X vectors for the base queue */
3078-
for (i = 0; i < (QLA_MSIX_RSP_Q + 1); i++) {
3070+
for (i = 0; i < QLA_BASE_VECTORS; i++) {
30793071
qentry = &ha->msix_entries[i];
30803072
qentry->handle = rsp;
30813073
rsp->msix = qentry;
@@ -3093,18 +3085,6 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
30933085
goto msix_register_fail;
30943086
qentry->have_irq = 1;
30953087
qentry->in_use = 1;
3096-
3097-
/* Register for CPU affinity notification. */
3098-
irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify);
3099-
3100-
/* Schedule work (ie. trigger a notification) to read cpu
3101-
* mask for this specific irq.
3102-
* kref_get is required because
3103-
* irq_affinity_notify() will do
3104-
* kref_put().
3105-
*/
3106-
kref_get(&qentry->irq_notify.kref);
3107-
schedule_work(&qentry->irq_notify.work);
31083088
}
31093089

31103090
/*
@@ -3301,49 +3281,3 @@ int qla25xx_request_irq(struct qla_hw_data *ha, struct qla_qpair *qpair,
33013281
msix->handle = qpair;
33023282
return ret;
33033283
}
3304-
3305-
3306-
/* irq_set_affinity/irqbalance will trigger notification of cpu mask update */
3307-
static void qla_irq_affinity_notify(struct irq_affinity_notify *notify,
3308-
const cpumask_t *mask)
3309-
{
3310-
struct qla_msix_entry *e =
3311-
container_of(notify, struct qla_msix_entry, irq_notify);
3312-
struct qla_hw_data *ha;
3313-
struct scsi_qla_host *base_vha;
3314-
struct rsp_que *rsp = e->handle;
3315-
3316-
/* user is recommended to set mask to just 1 cpu */
3317-
e->cpuid = cpumask_first(mask);
3318-
3319-
ha = rsp->hw;
3320-
base_vha = pci_get_drvdata(ha->pdev);
3321-
3322-
ql_dbg(ql_dbg_init, base_vha, 0xffff,
3323-
"%s: host %ld : vector %d cpu %d \n", __func__,
3324-
base_vha->host_no, e->vector, e->cpuid);
3325-
3326-
if (e->have_irq) {
3327-
if ((IS_QLA83XX(ha) || IS_QLA27XX(ha)) &&
3328-
(e->entry == QLA83XX_RSPQ_MSIX_ENTRY_NUMBER)) {
3329-
ha->tgt.rspq_vector_cpuid = e->cpuid;
3330-
ql_dbg(ql_dbg_init, base_vha, 0xffff,
3331-
"%s: host%ld: rspq vector %d cpu %d runtime change\n",
3332-
__func__, base_vha->host_no, e->vector, e->cpuid);
3333-
}
3334-
}
3335-
}
3336-
3337-
static void qla_irq_affinity_release(struct kref *ref)
3338-
{
3339-
struct irq_affinity_notify *notify =
3340-
container_of(ref, struct irq_affinity_notify, kref);
3341-
struct qla_msix_entry *e =
3342-
container_of(notify, struct qla_msix_entry, irq_notify);
3343-
struct rsp_que *rsp = e->handle;
3344-
struct scsi_qla_host *base_vha = pci_get_drvdata(rsp->hw->pdev);
3345-
3346-
ql_dbg(ql_dbg_init, base_vha, 0xffff,
3347-
"%s: host%ld: vector %d cpu %d\n", __func__,
3348-
base_vha->host_no, e->vector, e->cpuid);
3349-
}

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static void qla2x00_free_queues(struct qla_hw_data *ha)
466466
continue;
467467

468468
rsp = ha->rsp_q_map[cnt];
469-
clear_bit(cnt, ha->req_qid_map);
469+
clear_bit(cnt, ha->rsp_qid_map);
470470
ha->rsp_q_map[cnt] = NULL;
471471
spin_unlock_irqrestore(&ha->hardware_lock, flags);
472472
qla2x00_free_rsp_que(ha, rsp);

0 commit comments

Comments
 (0)