diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2017-01-13 10:02:51 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2017-01-13 10:02:51 -0500 |
commit | 2f5a31456ee80b37ef1170319fa134af0a1dfcc4 (patch) | |
tree | 8e2fe2668613106f581d203745cfbb09b34a8d4b | |
parent | a47fff1056376fab0929661e8cc85f90572cf55a (diff) | |
parent | cd60be4916ae689387d04b86b6fc15931e4c95ae (diff) |
Merge remote-tracking branch 'mkp-scsi/4.10/scsi-fixes' into fixes
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 7 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 18 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 3 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_isr.c | 88 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 2 |
5 files changed, 33 insertions, 85 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 4faa7672fc1d..a78a3df68f67 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -5954,18 +5954,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5954 | 5954 | ||
5955 | free_vfi_bmask: | 5955 | free_vfi_bmask: |
5956 | kfree(phba->sli4_hba.vfi_bmask); | 5956 | kfree(phba->sli4_hba.vfi_bmask); |
5957 | phba->sli4_hba.vfi_bmask = NULL; | ||
5957 | free_xri_ids: | 5958 | free_xri_ids: |
5958 | kfree(phba->sli4_hba.xri_ids); | 5959 | kfree(phba->sli4_hba.xri_ids); |
5960 | phba->sli4_hba.xri_ids = NULL; | ||
5959 | free_xri_bmask: | 5961 | free_xri_bmask: |
5960 | kfree(phba->sli4_hba.xri_bmask); | 5962 | kfree(phba->sli4_hba.xri_bmask); |
5963 | phba->sli4_hba.xri_bmask = NULL; | ||
5961 | free_vpi_ids: | 5964 | free_vpi_ids: |
5962 | kfree(phba->vpi_ids); | 5965 | kfree(phba->vpi_ids); |
5966 | phba->vpi_ids = NULL; | ||
5963 | free_vpi_bmask: | 5967 | free_vpi_bmask: |
5964 | kfree(phba->vpi_bmask); | 5968 | kfree(phba->vpi_bmask); |
5969 | phba->vpi_bmask = NULL; | ||
5965 | free_rpi_ids: | 5970 | free_rpi_ids: |
5966 | kfree(phba->sli4_hba.rpi_ids); | 5971 | kfree(phba->sli4_hba.rpi_ids); |
5972 | phba->sli4_hba.rpi_ids = NULL; | ||
5967 | free_rpi_bmask: | 5973 | free_rpi_bmask: |
5968 | kfree(phba->sli4_hba.rpi_bmask); | 5974 | kfree(phba->sli4_hba.rpi_bmask); |
5975 | phba->sli4_hba.rpi_bmask = NULL; | ||
5969 | err_exit: | 5976 | err_exit: |
5970 | return rc; | 5977 | return rc; |
5971 | } | 5978 | } |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 47eb4d545d13..83f8527c0363 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -243,12 +243,15 @@ qla2x00_sysfs_read_optrom(struct file *filp, struct kobject *kobj, | |||
243 | struct qla_hw_data *ha = vha->hw; | 243 | struct qla_hw_data *ha = vha->hw; |
244 | ssize_t rval = 0; | 244 | ssize_t rval = 0; |
245 | 245 | ||
246 | mutex_lock(&ha->optrom_mutex); | ||
247 | |||
246 | if (ha->optrom_state != QLA_SREADING) | 248 | if (ha->optrom_state != QLA_SREADING) |
247 | return 0; | 249 | goto out; |
248 | 250 | ||
249 | mutex_lock(&ha->optrom_mutex); | ||
250 | rval = memory_read_from_buffer(buf, count, &off, ha->optrom_buffer, | 251 | rval = memory_read_from_buffer(buf, count, &off, ha->optrom_buffer, |
251 | ha->optrom_region_size); | 252 | ha->optrom_region_size); |
253 | |||
254 | out: | ||
252 | mutex_unlock(&ha->optrom_mutex); | 255 | mutex_unlock(&ha->optrom_mutex); |
253 | 256 | ||
254 | return rval; | 257 | return rval; |
@@ -263,14 +266,19 @@ qla2x00_sysfs_write_optrom(struct file *filp, struct kobject *kobj, | |||
263 | struct device, kobj))); | 266 | struct device, kobj))); |
264 | struct qla_hw_data *ha = vha->hw; | 267 | struct qla_hw_data *ha = vha->hw; |
265 | 268 | ||
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); | ||
267 | return -EINVAL; | 273 | return -EINVAL; |
268 | if (off > ha->optrom_region_size) | 274 | } |
275 | if (off > ha->optrom_region_size) { | ||
276 | mutex_unlock(&ha->optrom_mutex); | ||
269 | return -ERANGE; | 277 | return -ERANGE; |
278 | } | ||
270 | if (off + count > ha->optrom_region_size) | 279 | if (off + count > ha->optrom_region_size) |
271 | count = ha->optrom_region_size - off; | 280 | count = ha->optrom_region_size - off; |
272 | 281 | ||
273 | mutex_lock(&ha->optrom_mutex); | ||
274 | memcpy(&ha->optrom_buffer[off], buf, count); | 282 | memcpy(&ha->optrom_buffer[off], buf, count); |
275 | mutex_unlock(&ha->optrom_mutex); | 283 | mutex_unlock(&ha->optrom_mutex); |
276 | 284 | ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index f7df01b76714..1549aace296a 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2732,7 +2732,7 @@ struct isp_operations { | |||
2732 | #define QLA_MSIX_FW_MODE(m) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7) | 2732 | #define QLA_MSIX_FW_MODE(m) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7) |
2733 | #define QLA_MSIX_FW_MODE_1(m) (QLA_MSIX_FW_MODE(m) == 1) | 2733 | #define QLA_MSIX_FW_MODE_1(m) (QLA_MSIX_FW_MODE(m) == 1) |
2734 | 2734 | ||
2735 | #define QLA_MSIX_DEFAULT 0x00 | 2735 | #define QLA_BASE_VECTORS 2 /* default + RSP */ |
2736 | #define QLA_MSIX_RSP_Q 0x01 | 2736 | #define QLA_MSIX_RSP_Q 0x01 |
2737 | #define QLA_ATIO_VECTOR 0x02 | 2737 | #define QLA_ATIO_VECTOR 0x02 |
2738 | #define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x03 | 2738 | #define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x03 |
@@ -2754,7 +2754,6 @@ struct qla_msix_entry { | |||
2754 | uint16_t entry; | 2754 | uint16_t entry; |
2755 | char name[30]; | 2755 | char name[30]; |
2756 | void *handle; | 2756 | void *handle; |
2757 | struct irq_affinity_notify irq_notify; | ||
2758 | int cpuid; | 2757 | int cpuid; |
2759 | }; | 2758 | }; |
2760 | 2759 | ||
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 5093ca9b02ec..54e1223b66d7 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -19,10 +19,6 @@ static void qla2x00_status_entry(scsi_qla_host_t *, struct rsp_que *, void *); | |||
19 | static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *); | 19 | static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *); |
20 | static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, | 20 | static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *, |
21 | sts_entry_t *); | 21 | 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 | |||
26 | 22 | ||
27 | /** | 23 | /** |
28 | * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200. | 24 | * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200. |
@@ -2572,14 +2568,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, | |||
2572 | if (!vha->flags.online) | 2568 | if (!vha->flags.online) |
2573 | return; | 2569 | return; |
2574 | 2570 | ||
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 | |||
2583 | while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { | 2571 | while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { |
2584 | pkt = (struct sts_entry_24xx *)rsp->ring_ptr; | 2572 | pkt = (struct sts_entry_24xx *)rsp->ring_ptr; |
2585 | 2573 | ||
@@ -3018,13 +3006,20 @@ static struct qla_init_msix_entry qla82xx_msix_entries[] = { | |||
3018 | static int | 3006 | static int |
3019 | qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) | 3007 | qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) |
3020 | { | 3008 | { |
3021 | #define MIN_MSIX_COUNT 2 | ||
3022 | int i, ret; | 3009 | int i, ret; |
3023 | struct qla_msix_entry *qentry; | 3010 | struct qla_msix_entry *qentry; |
3024 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | 3011 | 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); | ||
3025 | 3022 | ||
3026 | ret = pci_alloc_irq_vectors(ha->pdev, MIN_MSIX_COUNT, ha->msix_count, | ||
3027 | PCI_IRQ_MSIX | PCI_IRQ_AFFINITY); | ||
3028 | if (ret < 0) { | 3023 | if (ret < 0) { |
3029 | ql_log(ql_log_fatal, vha, 0x00c7, | 3024 | ql_log(ql_log_fatal, vha, 0x00c7, |
3030 | "MSI-X: Failed to enable support, " | 3025 | "MSI-X: Failed to enable support, " |
@@ -3069,13 +3064,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) | |||
3069 | qentry->have_irq = 0; | 3064 | qentry->have_irq = 0; |
3070 | qentry->in_use = 0; | 3065 | qentry->in_use = 0; |
3071 | qentry->handle = NULL; | 3066 | 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; | ||
3075 | } | 3067 | } |
3076 | 3068 | ||
3077 | /* Enable MSI-X vectors for the base queue */ | 3069 | /* 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++) { |
3079 | qentry = &ha->msix_entries[i]; | 3071 | qentry = &ha->msix_entries[i]; |
3080 | qentry->handle = rsp; | 3072 | qentry->handle = rsp; |
3081 | rsp->msix = qentry; | 3073 | rsp->msix = qentry; |
@@ -3093,18 +3085,6 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) | |||
3093 | goto msix_register_fail; | 3085 | goto msix_register_fail; |
3094 | qentry->have_irq = 1; | 3086 | qentry->have_irq = 1; |
3095 | qentry->in_use = 1; | 3087 | 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); | ||
3108 | } | 3088 | } |
3109 | 3089 | ||
3110 | /* | 3090 | /* |
@@ -3301,49 +3281,3 @@ int qla25xx_request_irq(struct qla_hw_data *ha, struct qla_qpair *qpair, | |||
3301 | msix->handle = qpair; | 3281 | msix->handle = qpair; |
3302 | return ret; | 3282 | return ret; |
3303 | } | 3283 | } |
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 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8521cfe302e9..ad4edc13ebcf 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -466,7 +466,7 @@ static void qla2x00_free_queues(struct qla_hw_data *ha) | |||
466 | continue; | 466 | continue; |
467 | 467 | ||
468 | rsp = ha->rsp_q_map[cnt]; | 468 | rsp = ha->rsp_q_map[cnt]; |
469 | clear_bit(cnt, ha->req_qid_map); | 469 | clear_bit(cnt, ha->rsp_qid_map); |
470 | ha->rsp_q_map[cnt] = NULL; | 470 | ha->rsp_q_map[cnt] = NULL; |
471 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 471 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
472 | qla2x00_free_rsp_que(ha, rsp); | 472 | qla2x00_free_rsp_que(ha, rsp); |